/*
 * Console: the AI-first look of FlowMatriX (validated by the owner on 2026-09-11).
 *
 * Two layers, on purpose:
 *   1. The header, the mobile menu and the footer drawn by js/components.js. Their classes are all
 *      `cx-` prefixed, so this file can also be loaded by the pages that still run on the old
 *      styles.css (admin, rooms) without either stylesheet reaching into the other.
 *   2. Page styles, which only apply under `body.cx`. A page opts into the Console look by carrying
 *      that class; a page without it keeps its own ground and only borrows the header.
 *
 * One committed dark world: there is no light theme, and that is a design decision, not a gap.
 */

:root {
  --cx-ground: #030607;
  --cx-panel: #071013;
  --cx-panel-2: #0B171B;
  --cx-deep: #040A0C;
  --cx-line: #132A30;
  --cx-line-2: #1D3D45;
  --cx-ink: #D3EEF0;
  --cx-soft: #A9C5C9;
  --cx-mute: #6A8990;
  --cx-dim: #3C565C;
  --cx-acc: #39F5D6;
  --cx-acc-soft: rgba(57, 245, 214, .14);
  --cx-bid: #2BE08A;
  --cx-ask: #FF4F6E;
  --cx-warn: #FFC857;
  --cx-f-disp: "Martian Mono", "IBM Plex Mono", ui-monospace, monospace;
  --cx-f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --cx-f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --cx-wrap: 1120px;
}

/* ------------------------------------------------------------------------------------------------
   Page base (opt-in)
   ------------------------------------------------------------------------------------------------ */

html:has(body.cx) { background: var(--cx-ground); }
body.cx {
  margin: 0;
  background: var(--cx-ground);
  color: var(--cx-ink);
  font: 400 15px/1.6 var(--cx-f-body);
  -webkit-font-smoothing: antialiased;
  opacity: 1;
}
body.cx *, body.cx *::before, body.cx *::after { box-sizing: border-box; }
/* :where() keeps this at zero specificity, so every class-based link colour (buttons, menus, the
   account rail) wins over it. Written as `body.cx a`, it outranked them all and painted the solid
   buttons' label in the page ink, light on cyan. */
:where(body.cx) a { color: inherit; }
body.cx :focus-visible { outline: 2px solid var(--cx-acc); outline-offset: 3px; }
body.cx [hidden] { display: none !important; }

.cx-wrap { max-width: var(--cx-wrap); margin: 0 auto; padding-inline: clamp(16px, 4vw, 40px); }
.cx-label { font: 500 11px/1 var(--cx-f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--cx-mute); }
.cx-num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------------------------------ */

.cx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: 600 11px/1 var(--cx-f-mono); letter-spacing: .1em; text-transform: uppercase;
  text-decoration: none; padding: 10px 14px; border: 1px solid var(--cx-acc);
  color: var(--cx-acc); background: transparent; cursor: pointer; border-radius: 0;
}
.cx-btn:hover { background: var(--cx-acc-soft); box-shadow: 0 0 24px rgba(57, 245, 214, .25); }
.cx-btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.cx-btn--solid { background: var(--cx-acc); color: var(--cx-ground); }
.cx-btn--solid:hover { background: var(--cx-acc); box-shadow: 0 0 30px rgba(57, 245, 214, .45); }
.cx-btn--quiet { border-color: var(--cx-line-2); color: var(--cx-ink); }
.cx-btn--quiet:hover { border-color: var(--cx-mute); background: transparent; box-shadow: none; }
.cx-ghost {
  font: 500 11px/1 var(--cx-f-mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--cx-mute); text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0;
}
.cx-ghost:hover { color: var(--cx-ink); }

/* ------------------------------------------------------------------------------------------------
   Header (drawn by js/components.js on every page that loads it)
   ------------------------------------------------------------------------------------------------ */

.cx-hdr {
  position: sticky; top: 0; z-index: 50;
  background: rgba(3, 6, 7, .86);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--cx-line);
  font-family: var(--cx-f-body);
  color: var(--cx-ink);
}
.cx-hdr *, .cx-drawer *, .cx-ftr * { box-sizing: border-box; }
.cx-hdr-in { display: flex; align-items: center; gap: 22px; height: 52px; }
/* Every item in the bar is a 30px inline-flex box centred on the row. Centring text of different
   faces and sizes on their baselines is what made the row look uneven. */
.cx-hdr ul, .cx-hdr li { list-style: none; margin: 0; padding: 0; }
.cx-hdr-in > nav { margin-right: auto; display: flex; align-items: center; }
.cx-hdr-in .cx-logo, .cx-hdr .cx-nav a, .cx-hdr .cx-out, .cx-hdr .cx-ghost, .cx-hdr .cx-btn {
  display: inline-flex; align-items: center; height: 30px; line-height: 1;
}
.cx-hdr .cx-btn { padding: 0 12px; }
.cx-logo {
  font: 800 15px/1 var(--cx-f-disp); letter-spacing: -.02em; text-decoration: none;
  color: var(--cx-ink);
}
.cx-logo b { color: var(--cx-acc); font-weight: 800; text-shadow: 0 0 14px rgba(57, 245, 214, .7); }
.cx-nav { display: flex; align-items: center; gap: 20px; }
.cx-nav a {
  font: 500 11px/1 var(--cx-f-mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--cx-mute); text-decoration: none;
}
.cx-nav a:hover, .cx-nav a.is-on { color: var(--cx-ink); }
.cx-nav .cx-legacy { color: var(--cx-dim); }
.cx-out {
  font: 500 10.5px/1 var(--cx-f-mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--cx-mute); white-space: nowrap;
  text-decoration: underline dotted var(--cx-dim); text-underline-offset: 5px;
}
.cx-out:hover { color: var(--cx-ink); text-decoration-color: var(--cx-ink); }
.cx-hdr-acts, .cx-acct-slot { display: flex; align-items: center; gap: 16px; }

.cx-acct { position: relative; }
.cx-acct-menu {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 190px;
  display: none; flex-direction: column; padding: 6px;
  background: var(--cx-deep); border: 1px solid var(--cx-line-2);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .8);
}
.cx-acct:hover .cx-acct-menu, .cx-acct:focus-within .cx-acct-menu { display: flex; }
.cx-acct-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }
.cx-acct-menu a {
  font: 500 12px/1 var(--cx-f-mono); color: var(--cx-soft); text-decoration: none; padding: 10px 12px;
}
.cx-acct-menu a:hover { color: var(--cx-acc); background: var(--cx-acc-soft); }
.cx-acct-menu .cx-acct-admin { color: var(--cx-warn); }
.cx-acct-menu .cx-acct-admin:hover { color: var(--cx-warn); background: rgba(255, 200, 87, .08); }
.cx-btn--admin { border-color: var(--cx-warn); color: var(--cx-warn); }
.cx-btn--admin:hover { background: rgba(255, 200, 87, .08); box-shadow: none; }
.cx-acct-menu .cx-sep { height: 1px; background: var(--cx-line); margin: 4px 0; }

.cx-menu-btn {
  display: none; width: 36px; height: 30px; padding: 0; border: 1px solid var(--cx-line-2);
  background: transparent; color: var(--cx-ink); cursor: pointer;
}
.cx-menu-btn span { display: block; width: 16px; height: 1.5px; background: currentColor; margin: 4px auto; }

/* ------------------------------------------------------------------------------------------------
   Mobile menu
   ------------------------------------------------------------------------------------------------ */

.cx-drawer-veil {
  position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .6);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.cx-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100; width: min(320px, 86vw);
  background: var(--cx-deep); border-left: 1px solid var(--cx-line-2);
  transform: translateX(100%); transition: transform .25s ease;
  display: flex; flex-direction: column; font-family: var(--cx-f-body); color: var(--cx-ink);
}
.cx-drawer.is-open { transform: none; }
.cx-drawer-veil.is-open { opacity: 1; pointer-events: auto; }
.cx-drawer-top {
  display: flex; justify-content: space-between; align-items: center;
  height: 52px; padding-inline: 18px; border-bottom: 1px solid var(--cx-line);
}
.cx-drawer-close { background: none; border: 0; color: var(--cx-mute); font: 500 22px/1 var(--cx-f-mono); cursor: pointer; }
.cx-drawer nav { display: flex; flex-direction: column; padding: 10px 0; overflow-y: auto; }
.cx-drawer nav a {
  font: 500 12px/1 var(--cx-f-mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--cx-soft); text-decoration: none; padding: 14px 18px; border-bottom: 1px solid var(--cx-line);
}
.cx-drawer nav a:hover { color: var(--cx-acc); }
.cx-drawer-foot { margin-top: auto; padding: 18px; display: grid; gap: 10px; }

/* ------------------------------------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------------------------------------ */

.cx-ftr { border-top: 1px solid var(--cx-line); padding-block: 32px 52px; background: var(--cx-ground); font-family: var(--cx-f-body); }
.cx-ftr-top { display: flex; flex-wrap: wrap; gap: 18px 32px; align-items: center; justify-content: space-between; }
.cx-ftr nav { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.cx-ftr nav a {
  font: 500 11px/1 var(--cx-f-mono); letter-spacing: .08em; color: var(--cx-mute); text-decoration: none;
}
.cx-ftr nav a:hover { color: var(--cx-ink); }
.cx-ftr-legal { margin-top: 28px; display: grid; gap: 10px; max-width: 72em; }
.cx-ftr-legal p { margin: 0; font: 400 11px/1.6 var(--cx-f-mono); color: var(--cx-dim); }
.cx-ftr-legal strong { color: var(--cx-mute); font-weight: 500; }

/* ------------------------------------------------------------------------------------------------
   Shared page blocks (Console pages only)
   ------------------------------------------------------------------------------------------------ */

body.cx h1, body.cx h2, body.cx h3 { text-wrap: balance; }
.cx-path { font: 500 12px/1.4 var(--cx-f-mono); color: var(--cx-acc); letter-spacing: .04em; }
.cx-path span { color: var(--cx-dim); }
.cx-h1 { font: 800 clamp(28px, 3.6vw, 44px)/1.04 var(--cx-f-disp); letter-spacing: -.045em; margin: 10px 0 14px; }
.cx-h2 { font: 800 clamp(22px, 2.6vw, 32px)/1.08 var(--cx-f-disp); letter-spacing: -.04em; margin: 0 0 14px; }
.cx-lede { max-width: 38em; color: var(--cx-soft); font-size: 15.5px; margin: 0; }

.cx-page-head { border-bottom: 1px solid var(--cx-line); padding-block: clamp(36px, 5vw, 64px) clamp(24px, 3.5vw, 40px); }
.cx-page { padding-block: clamp(32px, 4.5vw, 56px) clamp(48px, 7vw, 80px); }

/* Long-form text, used by the legal pages */
.cx-prose { max-width: 46em; }
.cx-prose h2 { font: 800 17px/1.3 var(--cx-f-disp); letter-spacing: -.03em; margin: 44px 0 12px; }
.cx-prose h2:first-of-type { margin-top: 8px; }
.cx-prose p, .cx-prose ul { color: var(--cx-soft); line-height: 1.75; margin: 0 0 16px; }
.cx-prose ul { padding-left: 22px; }
.cx-prose li { margin-bottom: 6px; }
.cx-prose strong { color: var(--cx-ink); font-weight: 600; }
.cx-prose a { color: var(--cx-acc); }
.cx-prose .tos-updated { font: 400 12.5px/1.5 var(--cx-f-mono); color: var(--cx-mute); }

/* Forms */
.cx-field { display: grid; gap: 8px; }
.cx-field label, body.cx .form-group label {
  font: 500 11px/1 var(--cx-f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--cx-mute);
}
body.cx input[type="text"], body.cx input[type="email"], body.cx input[type="password"],
body.cx select, body.cx textarea {
  width: 100%; background: var(--cx-deep); color: var(--cx-ink);
  border: 1px solid var(--cx-line-2); border-radius: 0; padding: 11px 12px;
  font: 400 13.5px/1.4 var(--cx-f-mono); outline: none;
}
body.cx input:focus, body.cx select:focus, body.cx textarea:focus { border-color: var(--cx-acc); box-shadow: 0 0 0 1px var(--cx-acc); }
body.cx textarea { min-height: 150px; resize: vertical; }
body.cx input::placeholder, body.cx textarea::placeholder { color: var(--cx-dim); }

/* Tables */
.cx-tbl { overflow-x: auto; border: 1px solid var(--cx-line); }
.cx-tbl table { width: 100%; border-collapse: collapse; min-width: 520px; }
.cx-tbl th {
  font: 500 11px/1 var(--cx-f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--cx-mute);
  text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--cx-line-2); background: var(--cx-panel);
}
.cx-tbl td { padding: 12px 16px; border-bottom: 1px solid var(--cx-line); font: 400 13px/1.4 var(--cx-f-mono); color: var(--cx-soft); }
.cx-tbl tr:last-child td { border-bottom: 0; }

@keyframes cx-blink { 50% { opacity: 0; } }
@keyframes cx-pulse { 50% { opacity: .35; } }
.cx-led { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; animation: cx-pulse 2.4s ease-in-out infinite; display: inline-block; }

@media (max-width: 980px) {
  .cx-nav, .cx-out, .cx-hdr-acts .cx-ghost, .cx-hdr-acts .cx-acct { display: none; }
  .cx-hdr-acts { margin-left: auto; }
  .cx-menu-btn { display: block; }
}
@media (max-width: 480px) {
  .cx-hdr-acts .cx-btn { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  body.cx *, body.cx *::before, body.cx *::after { animation: none !important; transition: none !important; }
  .cx-drawer, .cx-drawer-veil { transition: none; }
}
