/*
 * APEX design system.
 *
 * Tokens + cross-page primitives. Page-specific layout stays inline in
 * each page's own <style> block.
 *
 * Typography intent: an institutional terminal, not a consumer
 * dashboard. Prose/labels use a humanist grotesque; every NUMBER uses a
 * tabular monospace so digits align in columns and a changing price does
 * not make the row jitter. Fonts are resolved from the system stack -
 * no webfont is downloaded, so the platform stays fully offline and adds
 * no render-blocking request. On macOS this resolves to SF Pro / SF
 * Mono, which are genuinely high-quality faces.
 */

/* ═══════════════════════════════════════════════════════════════════
 * APEX V3 — "ORBITAL INSTRUMENT"
 *
 * The concept, so every value below has a reason:
 *
 *   APEX is not a dashboard. It is an INSTRUMENT TRAINED ON THE PLANET.
 *   The world is rendered in near-black void; the interface is machined
 *   from titanium hairlines and smoked glass FLOATING ABOVE it.
 *
 * Three laws:
 *
 *   1. SURFACES CATCH LIGHT, THEY DO NOT EMIT IT. Every APEX surface has
 *      a lit top edge and a shadowed underside, as though lit from above
 *      by a single hard source. Nothing glows. A glowing box is a game
 *      HUD; a lit edge is machined metal. This is the most recognisable
 *      trait in the system.
 *
 *   2. ONE ACCENT, SPENT SPARINGLY. Electric ice. It marks what is
 *      INTERACTIVE or what the system is ASSERTING — never decoration.
 *      Gold is RESERVED for gold-market information and is used nowhere
 *      else, so that when gold appears it MEANS gold.
 *
 *   3. TYPE SPLITS BY AUTHORSHIP. Editorial display type for statements
 *      APEX makes about the world; tabular monospace for anything the
 *      MARKET determines. The two never mix inside one line.
 * ═══════════════════════════════════════════════════════════════════ */

:root {
  /* ---------- Surfaces: the void ramp ----------
     Void → obsidian → graphite. Blue-black rather than neutral grey: at
     these luminances a neutral dark reads as "unfinished", a slightly
     cool one reads as deliberate. V3 sinks the floor considerably darker
     than V2 so the globe and lit panel edges become the only light. */
  --void: #04050a;
  --bg: #04050a;
  --bg-elev: #070910;
  --panel: #0b0e15;
  --panel-2: #11151e;
  --panel-3: #171c27;

  /* GLOBAL / landing (globe entrance) — true void, so Earth dominates */
  --bg-global: #010204;
  --panel-global: #06080d;

  /* ---------- Borders: titanium hairlines ---------- */
  --border: #1a1f2b;
  --border-strong: #2a3242;
  --border-accent: rgba(134, 184, 222, 0.34);
  --titanium: #6c7789;
  --platinum: #c2ccd8;

  /* ---------- Type colour ramp ----------
     Four steps, deliberately spaced: primary reads, secondary supports,
     muted labels, dim metadata. */
  --text: #e9edf5;
  --text-strong: #ffffff;
  --muted: #8f98ac;
  --dim: #566072;

  /* ---------- Accent: electric ice ----------
     A cool blue-white. Light enough to sit as a button fill with dark
     text on top, saturated enough not to read as grey. */
  --accent: #86b8de;
  --accent-bright: #d3e7f7;
  --accent-dim: rgba(134, 184, 222, 0.13);

  /* ---------- Semantic: controlled, never lurid ---------- */
  --green: #4fb98a;
  --green-dim: rgba(79, 185, 138, 0.12);
  --red: #d9576b;
  --red-dim: rgba(217, 87, 107, 0.12);

  /* GOLD — reserved exclusively for gold-market information.
     --amber is kept as an alias: existing badges/tags reference it. */
  --gold: #c9a45c;
  --gold-dim: rgba(201, 164, 92, 0.12);
  --amber: #c9a45c;
  --amber-dim: rgba(201, 164, 92, 0.12);

  --gray: #6b7280;
  --gray-dim: rgba(107, 114, 128, 0.15);

  /* ---------- Radius ---------- */
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* ---------- Spacing scale ----------
     A 4px base. Named by step, not by pixel, so rhythm survives a
     re-tune. Replaces the ad-hoc 12/13/14/16/18/20/22/24 sprawl. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 96px;
  --sp-10: 128px;

  /* ---------- Z-index scale ----------
     Every layer named once, here. Prevents the z-index arms race that
     otherwise emerges across ten independently-built pages. */
  --z-globe: 0;
  --z-grain: 1;
  --z-content: 2;
  --z-rail: 20;
  --z-header: 40;
  --z-overlay: 60;
  --z-tooltip: 80;
  --z-modal: 100;
  --z-toast: 120;

  /* ---------- Type stacks ---------- */
  --font-sans: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Inter",
               "Segoe UI", system-ui, sans-serif;
  --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont,
                  "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", "Menlo",
               "Cascadia Code", monospace;

  /* ---------- Type scale ----------
     A real scale rather than ad-hoc pixel values. V3 adds the editorial
     display sizes the landing page needs, using clamp() so they are
     fluid instead of a stack of breakpoint overrides. */
  --fs-micro: 10px;
  --fs-label: 11px;
  --fs-caption: 12px;
  --fs-body: 13px;
  --fs-lead: 15px;
  --fs-title: 19px;
  --fs-display: 27px;
  --fs-hero: 38px;

  --fs-editorial-sm: clamp(22px, 2.4vw, 30px);
  --fs-editorial: clamp(30px, 4.4vw, 56px);
  --fs-editorial-lg: clamp(38px, 7vw, 92px);

  /* Tracking: tight on large display type, open on small caps labels -
     the inverse of the default, and what makes small text look set
     rather than shrunk. */
  --track-tight: -0.02em;
  --track-normal: 0;
  --track-label: 0.08em;
  --track-caps: 0.12em;
  --track-wordmark: 0.3em;

  --lh-tight: 1.15;
  --lh-normal: 1.5;
  --lh-relaxed: 1.65;

  --shadow-panel: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

/*
 * Background: layered, not a flat fill.
 *   1. two very low-alpha radial pools for atmospheric depth
 *   2. a fixed hairline grid that reads as instrumentation
 *   3. the base colour
 * All extremely low contrast - depth should be felt, not noticed, and
 * panel text must stay perfectly legible on top.
 */
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 55% at 18% -8%, rgba(47, 184, 198, 0.055), transparent 60%),
    radial-gradient(ellipse 65% 50% at 88% 4%, rgba(91, 141, 238, 0.045), transparent 62%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 64px 64px, 64px 64px;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  font-feature-settings: "cv05" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---------- Typographic primitives ---------- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: var(--track-tight);
  line-height: var(--lh-tight);
  color: var(--text-strong);
  font-weight: 600;
}

/*
 * Every numeric readout: tabular figures so columns align and a ticking
 * price never shifts its neighbours. This is the single highest-impact
 * typographic rule in a trading interface.
 */
.mono, .num, td.mono, .kv .v.mono, .value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
  letter-spacing: var(--track-normal);
}

/* Small caps label style, used for every field name / section header. */
.label, .k, th, .section-title, .panel h2 {
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--muted);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Focus states (accessibility - visible on every control,
   never conveyed by colour alone) ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------- Controls ---------- */
select, input, button {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  font-family: var(--font-sans);
  font-size: var(--fs-caption);
  font-weight: 500;
  letter-spacing: var(--track-normal);
}
input, select { font-variant-numeric: tabular-nums; }

button {
  cursor: pointer;
  font-weight: 600;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
button:hover { border-color: var(--accent); color: var(--text-strong); }
button:active { background: var(--panel); }
button:disabled { opacity: 0.45; cursor: default; }
button:disabled:hover { border-color: var(--border-strong); color: var(--text); }

button.primary {
  background: var(--accent);
  color: #04060a;
  border-color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.02em;
}
button.primary:hover { color: #04060a; filter: brightness(1.08); }
button.secondary { color: var(--accent); }

/* ---------- Tags / badges ---------- */
.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: var(--fs-micro);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--track-caps);
  border: 1px solid var(--border-strong);
  color: var(--muted);
}
.tag.readonly { color: var(--amber); border-color: rgba(232, 182, 76, 0.35); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  font-variant-numeric: tabular-nums;
}
.badge.buy { background: var(--green-dim); color: var(--green); }
.badge.sell { background: var(--red-dim); color: var(--red); }
.badge.wait, .badge.no-trade { background: var(--gray-dim); color: var(--gray); }
.badge.pass, .badge.ok, .badge.healthy, .badge.approved, .badge.fresh, .badge.aligned-bull { background: var(--green-dim); color: var(--green); }
.badge.blocked, .badge.unhealthy, .badge.stale, .badge.aligned-bear { background: var(--red-dim); color: var(--red); }
.badge.info, .badge.mixed, .badge.insufficient { background: var(--gray-dim); color: var(--muted); }
.badge.unavailable { background: var(--gray-dim); color: var(--muted); border: 1px solid var(--border-strong); }


/* ═══════════════════════════════════════════════════════════════════
 * PREMIUM LAYER
 *
 * Surface treatment, motion, navigation and modals — shared by all five
 * pages so they stop looking like five separate builds.
 *
 * Three rules govern everything below:
 *
 *   1. MOTION IS FEEDBACK, NOT DECORATION. Every transition here is
 *      triggered by something real: a page arriving, a pointer entering,
 *      a NUMBER THE BACKEND ACTUALLY CHANGED. Nothing loops forever to
 *      look busy, and nothing animates to imply activity that isn't
 *      happening. A perpetually shimmering panel on a dead bridge is a
 *      lie told in CSS.
 *
 *   2. TRANSFORM AND OPACITY ONLY. Both are compositor properties, so
 *      animation never triggers layout and never competes with the
 *      globe's WebGL frame budget or the chart's tick path.
 *
 *   3. REDUCED MOTION IS HONOURED COMPLETELY (see the end of this file).
 *      Not damped — removed. Final states stay identical, so nothing is
 *      ever left invisible or unreadable.
 * ═══════════════════════════════════════════════════════════════════ */

:root {
  /* Easing. `--ease-out` decelerates hard — things arrive and settle
     rather than drifting. `--ease-spring` overshoots slightly and is
     reserved for elements that "pop" (modals), never for data. */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);

  --dur-fast: 140ms;
  --dur: 220ms;
  --dur-slow: 380ms;

  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.42), 0 16px 44px rgba(0, 0, 0, 0.34);
  --shadow-modal: 0 32px 90px rgba(0, 0, 0, 0.72), 0 2px 10px rgba(0, 0, 0, 0.5);

  /* Specular top edge — the single detail that most separates a "real"
     surface from a flat rectangle. Light appears to fall from above. */
  --edge-top: inset 0 1px 0 rgba(255, 255, 255, 0.055);

  /* Film grain, generated by the browser (feTurbulence), not downloaded.
     Kills the plastic flatness of large dark fills at almost no cost. */
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Global grain overlay ----------
   Fixed, non-interactive, very low alpha. Sits above the background
   wash but below all content. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--noise);
  opacity: 0.019;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: overlay;
}
body > * { position: relative; z-index: 2; }

/* ---------- Surface treatment ----------
   A panel is a lit surface: a vertical sheen that fades within the first
   ~140px, a specular top edge, and a layered shadow. Applied to every
   page's card primitive so all five inherit the same physics. */
.panel,
.coverage-card,
.detail-panel,
.research-section,
.event-detail-card,
.globe-panel {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 140px);
  box-shadow: var(--shadow-panel), var(--edge-top);
  transition: box-shadow var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out),
              transform var(--dur) var(--ease-out);
}

/* Hover lift. Displacement stays at 2px: enough to read as response,
   too little to read as movement. Only on devices with a real pointer —
   a touch device has no hover state to reverse out of. */
@media (hover: hover) {
  .panel:hover,
  .coverage-card:hover,
  .research-section:hover,
  .event-detail-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lift), var(--edge-top);
    border-color: var(--border-strong);
  }
}

/* ---------- Entrance reveal ----------
   Opt-in via [data-reveal]. `--i` staggers siblings so a grid assembles
   in sequence instead of snapping in as one block.

   Deliberately NOT applied to live data regions: a value that re-renders
   on every poll must not re-animate on every poll. */
@keyframes apex-reveal {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
[data-reveal] {
  animation: apex-reveal var(--dur-slow) var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 55ms);
}

/* ---------- Value-change flash ----------
   Applied by motion.js ONLY when a rendered number actually differs from
   the previous render. This is the one animation that carries meaning:
   it says "this specific figure just moved", which is precisely the
   thing a trader must not miss. Direction-coloured, then gone. */
@keyframes apex-flash-up {
  from { background-color: var(--green-dim); }
  to   { background-color: transparent; }
}
@keyframes apex-flash-down {
  from { background-color: var(--red-dim); }
  to   { background-color: transparent; }
}
.flash-up   { animation: apex-flash-up 900ms var(--ease-out); border-radius: 3px; }
.flash-down { animation: apex-flash-down 900ms var(--ease-out); border-radius: 3px; }

/* ---------- Unified navigation ----------
   Replaces three divergent header patterns (.nav-link / .nav-links /
   .back-link) with one. The active page is marked structurally with
   aria-current, not merely by colour. */
.apex-header {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 13px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  position: sticky;
  top: 0;
  z-index: 40;
}
.apex-header .brand { display: flex; align-items: baseline; gap: 10px; }
.apex-header .wordmark {
  font-family: var(--font-display);
  font-size: var(--fs-title);
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-strong);
}
.apex-header .subtitle {
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-caps);
  color: var(--dim);
}

.apex-nav { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; }
.apex-nav a {
  position: relative;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--muted);
  transition: color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.apex-nav a:hover { color: var(--text-strong); background: rgba(255, 255, 255, 0.045); text-decoration: none; }

/* Active page: accent text plus an underline that scales in from the
   centre. `aria-current="page"` is the source of truth. */
.apex-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-dim); }
.apex-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 13px; right: 13px; bottom: 3px;
  height: 1.5px;
  background: var(--accent);
  border-radius: 2px;
  transform-origin: center;
  animation: apex-underline var(--dur-slow) var(--ease-out) backwards;
}
@keyframes apex-underline { from { transform: scaleX(0); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }

/* ---------- Modal / popup ----------
   Backdrop dims and blurs the page; the dialog scales up from 96%.
   Focus handling, ESC and restore live in components/modal.js — this is
   presentation only. */
.apex-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 4, 8, 0.72);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: apex-fade var(--dur) var(--ease-out);
}
.apex-modal-backdrop.closing { animation: apex-fade var(--dur-fast) var(--ease-out) reverse forwards; }

.apex-modal {
  width: min(680px, 100%);
  max-height: 84vh;
  overflow: auto;
  background: var(--panel);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 180px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-modal), var(--edge-top);
  animation: apex-modal-in var(--dur-slow) var(--ease-spring) backwards;
}
.apex-modal-backdrop.closing .apex-modal { animation: apex-modal-in var(--dur-fast) var(--ease-out) reverse forwards; }

@keyframes apex-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes apex-modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.apex-modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}
.apex-modal-head h2 { margin: 0; font-size: var(--fs-lead); text-transform: none; letter-spacing: var(--track-tight); color: var(--text-strong); }
.apex-modal-close {
  margin-left: auto;
  width: 28px; height: 28px;
  padding: 0;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  font-size: 15px; line-height: 1;
}
.apex-modal-body { padding: 20px; }

/* ---------- Reduced motion ----------
   Removed, not damped. Every element still lands in its final visual
   state — the animation simply never plays. The value-flash keeps a
   brief static tint so the "this number changed" signal survives for
   users who disable motion; losing it would cost information, not
   decoration. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { animation: none; opacity: 1; transform: none; }
  .panel:hover, .coverage-card:hover, .research-section:hover, .event-detail-card:hover { transform: none; }
  .flash-up   { background-color: var(--green-dim); }
  .flash-down { background-color: var(--red-dim); }
}

/* ---------- Market Map ---------- */

.muted {
  color: var(--muted);
}

.horizon-grid {
  display: flex;
  flex-direction: row;
  gap: 12px;
  margin: 12px 0;
}

.horizon-card {
  flex: 1;
  padding: 12px;
  border-radius: 6px;
  text-align: center;
}

.horizon-card.bias-bullish { color: var(--text-strong); }
.horizon-card.bias-bearish { color: var(--text-strong); }
.horizon-card.bias-transition { color: var(--muted); }
.horizon-card.bias-neutral { color: var(--dim); }

.horizon-name { font-weight: 600; font-size: 13px; }
.horizon-bias { font-size: 14px; font-weight: 500; }
.horizon-conf { font-size: 12px; color: var(--muted); }
.horizon-phase { font-size: 12px; color: var(--dim); }

@media (max-width: 900px) {
  .horizon-grid {
    grid-template-columns: 1fr;
    flex-direction: column;
  }
}

/* ═══════════════════════════════════════════════════════════════════
 * APEX V3 SYSTEM
 *
 * Everything below is new in V3 and additive: no V2 class is redefined,
 * so all ten existing pages keep rendering exactly as before until they
 * opt in. Ordered: materials → signal language → status language →
 * controls → data → feedback → editorial → rhythm.
 * ═══════════════════════════════════════════════════════════════════ */

/* ---------- 1. MATERIALS ----------
 * Three, and only three. A surface is glass, solid, or void. Anything
 * that looks like a fourth material is a mistake.
 *
 * SMOKED GLASS is for surfaces that float over the globe — you must
 * sense the world behind them. It is expensive (backdrop-filter forces a
 * new compositor layer), so it is reserved for overlay chrome, never
 * applied to a list of forty rows. */
.mat-glass {
  background: rgba(11, 14, 21, 0.62);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-panel), var(--edge-top);
}
/* Fallback: without backdrop-filter the glass would read as a flat wash
   over the globe and lose all legibility, so go opaque instead. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .mat-glass { background: rgba(7, 9, 16, 0.94); }
}

.mat-solid {
  background: var(--panel);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 140px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-panel), var(--edge-top);
}

.mat-void {
  background: var(--void);
  border: 1px solid var(--border);
}

/* Machined-titanium hairline divider. Fades at both ends so it reads as
   a milled groove rather than a drawn line. */
.hairline {
  height: 1px;
  border: 0;
  margin: 0;
  background: linear-gradient(90deg, transparent, var(--border-strong) 12%, var(--border-strong) 88%, transparent);
}

/* ---------- 2. THE APEX SIGNAL RAIL ----------
 * The signature information device of the platform, used identically on
 * a landing-page card and a terminal decision panel.
 *
 *   COLOUR encodes SEVERITY   (what kind of thing this is)
 *   LENGTH encodes CONFIDENCE (how sure APEX is)
 *
 * A 1px vertical rail on the leading edge. Set --confidence to a 0–1
 * number; the rail fills that proportion of the surface height. This
 * makes confidence readable at a glance across a whole column without a
 * single number being parsed — and it degrades honestly: unknown
 * confidence means NO rail, not a full one. */
.signal {
  position: relative;
  padding-left: var(--sp-4);
}
.signal::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: calc(var(--confidence, 0) * 100%);
  min-height: 0;
  border-radius: 2px;
  background: var(--signal-colour, var(--titanium));
  transition: height var(--dur-slow) var(--ease-out);
}
/* Unknown confidence: the rail is absent and a hairline stub marks the
   edge, so "we don't know" never looks like "zero". */
.signal[data-confidence="unknown"]::before {
  height: 100%;
  background: repeating-linear-gradient(180deg, var(--border-strong) 0 3px, transparent 3px 7px);
}

.signal[data-severity="critical"] { --signal-colour: var(--red); }
.signal[data-severity="high"]     { --signal-colour: #e0834f; }
.signal[data-severity="medium"]   { --signal-colour: var(--gold); }
.signal[data-severity="low"]      { --signal-colour: var(--accent); }
.signal[data-severity="info"]     { --signal-colour: var(--titanium); }
/* Gold-market severity keeps the reserved hue regardless of level. */
.signal[data-asset="gold"]        { --signal-colour: var(--gold); }

/* ---------- ORBITAL PULSE ----------
 * The live-event marker language. An expanding ring that dissipates —
 * never a bouncing pin, never a spinning icon. Two rings, offset, so it
 * reads as a signal propagating outward from a point.
 *
 * IMPORTANT: this animates only where a real event exists. A pulse on
 * stale or absent data is a lie told in CSS. */
.pulse {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 10px;
  height: 10px;
}
.pulse::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--signal-colour, var(--accent));
}
.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--signal-colour, var(--accent));
  animation: apex-orbital 2600ms var(--ease-out) infinite;
}
@keyframes apex-orbital {
  from { transform: scale(0.4); opacity: 0.9; }
  to   { transform: scale(2.4); opacity: 0; }
}

/* ---------- 3. STATUS LANGUAGE ----------
 * Six states, each meaning a genuinely different thing. The whole point
 * is that a 404 on a frontend route and a disconnected MT5 bridge are
 * NOT the same event and must never render identically.
 *
 * Colour is never the only channel: each state also carries a distinct
 * dot treatment, so it survives greyscale and colour-blindness. */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--muted);
}
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--titanium);
  flex: none;
}
.status[data-state="ONLINE"]      { color: var(--green); }
.status[data-state="ONLINE"]::before      { background: var(--green); }
.status[data-state="DEGRADED"]    { color: var(--gold); }
.status[data-state="DEGRADED"]::before    { background: var(--gold); }
/* STALE: data exists but is old. Hollow dot — present but not live. */
.status[data-state="STALE"]       { color: var(--gold); }
.status[data-state="STALE"]::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--gold);
}
/* CONNECTING: the only status permitted to animate, because it is the
   only one describing something actively in progress. */
.status[data-state="CONNECTING"]  { color: var(--accent); }
.status[data-state="CONNECTING"]::before {
  background: var(--accent);
  animation: apex-breathe 1400ms var(--ease-out) infinite;
}
@keyframes apex-breathe { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
/* UNAVAILABLE: we cannot know. Hollow titanium — deliberately NOT red,
   because "no provider" is not "broken". */
.status[data-state="UNAVAILABLE"] { color: var(--muted); }
.status[data-state="UNAVAILABLE"]::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--titanium);
}
.status[data-state="OFFLINE"]     { color: var(--red); }
.status[data-state="OFFLINE"]::before     { background: var(--red); }

/* ---------- HONEST EMPTY / UNAVAILABLE SURFACE ----------
 * The house style for "we have nothing to show you". Never a spinner
 * that spins forever, never invented placeholder content. */
.unavail {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-5);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.012);
  text-align: center;
}
.unavail__title {
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--track-caps);
  color: var(--muted);
}
.unavail__detail { font-size: var(--fs-caption); color: var(--dim); }

/* ---------- 4. EXECUTION MODE BANNER ----------
 * ANALYSIS / PAPER / LIVE must never be visually confusable. They differ
 * in colour AND in a repeating edge treatment, and LIVE is the only one
 * that gets a filled bar. Nothing in APEX may render LIVE styling unless
 * the backend actually reports live authority. */
.mode {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--fs-micro);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: var(--track-caps);
  border: 1px solid var(--border-strong);
  color: var(--muted);
}
.mode[data-mode="ANALYSIS"] {
  color: var(--accent);
  border-color: var(--border-accent);
  background: var(--accent-dim);
}
.mode[data-mode="PAPER"] {
  color: var(--gold);
  border-color: rgba(201, 164, 92, 0.4);
  background: repeating-linear-gradient(135deg, rgba(201, 164, 92, 0.14) 0 6px, transparent 6px 12px);
}
.mode[data-mode="LIVE"] {
  color: #05070c;
  background: var(--red);
  border-color: var(--red);
}

/* ---------- 5. CONTROLS ----------
 * .btn is the V3 button. The V2 bare `button` rules still stand for
 * pages that have not migrated.
 *
 * The hover is a MAGNETIC one: a specular sweep crosses the face and the
 * surface rises 1px. No scale transform — scaling type makes it blur. */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 11px var(--sp-5);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-caption);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 40%, rgba(255, 255, 255, 0.16) 50%, transparent 60%);
  transform: translateX(-110%);
  transition: transform var(--dur-slow) var(--ease-out);
  pointer-events: none;
}
@media (hover: hover) {
  .btn:hover { transform: translateY(-1px); border-color: var(--border-accent); box-shadow: var(--shadow-lift); }
  .btn:hover::after { transform: translateX(110%); }
}
.btn:active { transform: translateY(0); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn:disabled::after, .btn[aria-disabled="true"]::after { display: none; }

.btn--primary {
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  border-color: var(--accent);
  color: #04060a;
  font-weight: 800;
}
.btn--ghost { background: transparent; border-color: var(--border-strong); color: var(--muted); }
@media (hover: hover) { .btn--ghost:hover { color: var(--text-strong); } }
.btn--danger { background: transparent; border-color: rgba(217, 87, 107, 0.45); color: var(--red); }
.btn--sm { padding: 7px var(--sp-3); font-size: var(--fs-micro); }
.btn--block { width: 100%; }

/* ---------- FIELDS ----------
 * Label above, control, then a reserved message row. The message row is
 * always present in the layout even when empty, so validating a form
 * never shifts the fields below it. */
.field { display: grid; gap: var(--sp-1); }
.field__label {
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--muted);
}
.field__control {
  width: 100%;
  padding: 11px var(--sp-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-lead);
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.field__control::placeholder { color: var(--dim); }
.field__control:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(134, 184, 222, 0.05);
}
.field__control:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Validity is carried on the wrapper by JS, never inferred from :invalid
   alone — :invalid fires while the user is still mid-typing. */
.field[data-valid="false"] .field__control { border-color: var(--red); }
.field[data-valid="true"]  .field__control { border-color: rgba(79, 185, 138, 0.5); }
.field__msg {
  min-height: 15px;
  font-size: var(--fs-caption);
  color: var(--red);
  line-height: 1.25;
}
.field[data-valid="true"] .field__msg { color: var(--green); }
.field__hint { min-height: 15px; font-size: var(--fs-caption); color: var(--dim); }

/* Password reveal sits inside the control's box. */
.field__wrap { position: relative; display: block; }
.field__wrap .field__control { padding-right: 76px; }
.field__reveal {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 5px var(--sp-2);
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--muted);
  font-size: var(--fs-micro);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  cursor: pointer;
}

/* Password strength: four discrete segments, not a continuous bar. A
   continuous bar implies a precision the estimate does not have. */
.strength { display: flex; gap: 3px; }
.strength__seg {
  height: 3px;
  flex: 1;
  border-radius: 2px;
  background: var(--border);
  transition: background var(--dur) var(--ease-out);
}
.strength[data-score="1"] .strength__seg:nth-child(-n+1),
.strength[data-score="2"] .strength__seg:nth-child(-n+2),
.strength[data-score="3"] .strength__seg:nth-child(-n+3),
.strength[data-score="4"] .strength__seg:nth-child(-n+4) { background: var(--gold); }
.strength[data-score="4"] .strength__seg { background: var(--green); }
.strength[data-score="1"] .strength__seg:nth-child(-n+1) { background: var(--red); }

/* Checkbox row for consent. The control keeps its native semantics; only
   the box is restyled, so keyboard and screen-reader behaviour is intact. */
.check { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-3); align-items: start; }
.check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  flex: none;
}
.check input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
  /* Tick drawn with a border, so no icon font or SVG request. */
  background-image: linear-gradient(45deg, transparent 45%, #04060a 45%, #04060a 55%, transparent 55%),
                    linear-gradient(-45deg, transparent 45%, #04060a 45%, #04060a 55%, transparent 55%);
  background-size: 60% 2px, 60% 2px;
  background-position: 52% 62%, 48% 62%;
  background-repeat: no-repeat;
}
.check label { font-size: var(--fs-caption); color: var(--muted); line-height: var(--lh-normal); }
.check a { color: var(--accent); }

/* ---------- 6. DATA ---------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-caption); }
.table th {
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.table td {
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.table td.num, .table th.num { text-align: right; font-family: var(--font-mono); }
.table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
@media (hover: hover) { .table tbody tr:hover { background: rgba(255, 255, 255, 0.022); } }
/* Wide tables scroll inside their own box; the page never scrolls sideways. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- 7. FEEDBACK ---------- */
/* Skeleton: a slow titanium sweep. Reads as "loading", not as content. */
.skel {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 25%, rgba(255, 255, 255, 0.07) 37%, rgba(255, 255, 255, 0.03) 63%);
  background-size: 400% 100%;
  /*
   * FINITE on purpose: 10 iterations (~16s), then the sweep stops and the
   * skeleton settles into a flat placeholder.
   *
   * A skeleton that shimmers forever is the exact failure this project's
   * animation rule exists to prevent — after a hung request it is a moving
   * surface reporting activity that is no longer happening. Stopping turns
   * it into an honest "still nothing here", and callers that know the
   * request failed replace it outright via status.js renderUnavailable().
   */
  animation: apex-skel 1600ms linear 10;
}
@keyframes apex-skel { from { background-position: 100% 0; } to { background-position: 0 0; } }
.skel--line { height: 11px; margin: 6px 0; }
.skel--title { height: 19px; width: 42%; margin: 8px 0; }

/* Tooltip. Positioned by the caller; this is presentation only. Moves in
   from 4px below so it feels attached to its trigger. */
.tip {
  position: absolute;
  z-index: var(--z-tooltip);
  max-width: 280px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  background: rgba(4, 5, 10, 0.96);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lift);
  font-size: var(--fs-caption);
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.tip[data-open="true"] { opacity: 1; transform: none; }

/* ---------- 8. EDITORIAL TYPE ----------
 * For statements APEX makes about the world. Tight tracking, tight
 * leading, and a hard cap on measure — an unbounded line length is what
 * makes a hero read as a marketing page rather than a masthead. */
.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--fs-label);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--track-caps);
  color: var(--accent);
}
.editorial {
  font-family: var(--font-display);
  font-size: var(--fs-editorial);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.028em;
  color: var(--text-strong);
  max-width: 22ch;
  margin: 0;
  text-wrap: balance;
}
.editorial--lg { font-size: var(--fs-editorial-lg); max-width: 14ch; }
.editorial--sm { font-size: var(--fs-editorial-sm); max-width: 30ch; }
.statement {
  font-size: var(--fs-lead);
  line-height: var(--lh-relaxed);
  color: var(--muted);
  max-width: 58ch;
  margin: 0;
}

/* The wordmark. Wide tracking is the entire identity — APEX is set as an
   instrument label, not a logotype. */
.wordmark-lg {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: var(--track-wordmark);
  color: var(--text-strong);
  /* Optical correction: letter-spacing adds trailing space after the
     final glyph, which visually de-centres the word. */
  text-indent: var(--track-wordmark);
}

/* ---------- 9. RHYTHM ---------- */
.shell { width: min(1280px, 100% - var(--sp-6)); margin-inline: auto; }
.shell--wide { width: min(1600px, 100% - var(--sp-6)); }
.shell--narrow { width: min(460px, 100% - var(--sp-5)); }
.stack > * + * { margin-top: var(--stack-gap, var(--sp-4)); }
.section { padding-block: clamp(var(--sp-7), 9vh, var(--sp-9)); }

/* Visually hidden but available to screen readers. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Skip link — first tab stop on every page. */
.skip {
  position: absolute;
  left: var(--sp-3);
  top: -60px;
  z-index: var(--z-toast);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #04060a;
  font-weight: 700;
  font-size: var(--fs-caption);
  transition: top var(--dur-fast) var(--ease-out);
}
.skip:focus { top: var(--sp-3); text-decoration: none; }

/* ---------- 10. REDUCED MOTION (V3 additions) ----------
 * Removed, not damped — matching the V2 rule above. The orbital pulse
 * and CONNECTING dot lose their animation but keep a static, visible
 * final state, so no information is lost. */
@media (prefers-reduced-motion: reduce) {
  .pulse::after { animation: none; opacity: 0.5; transform: scale(1.5); }
  .status[data-state="CONNECTING"]::before { animation: none; opacity: 1; }
  .skel { animation: none; background-position: 0 0; }
  .btn::after { display: none; }
  @media (hover: hover) { .btn:hover { transform: none; } }
  .signal::before { transition: none; }
}

/* ---------- 11. SHELL CHROME (core/shell.js) ----------
 * The V3 header. Extends the V2 .apex-header rules above rather than
 * replacing them, so pages that still hand-roll a header are untouched. */

.apex-brand {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  text-decoration: none;
}
.apex-brand:hover { text-decoration: none; }

/* The mark: a machined ring with an off-centre aperture. Drawn in CSS —
 * no image request, scales perfectly, and reads as an instrument iris. */
.apex-brand__mark {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  position: relative;
  align-self: center;
  flex: none;
}
.apex-brand__mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(1px, -1px);
  opacity: 0.85;
}
.apex-brand .wordmark { letter-spacing: 0.22em; text-indent: 0.22em; }

.apex-actions { display: flex; align-items: center; gap: var(--sp-2); margin-left: var(--sp-4); }
.apex-header[data-variant="marketing"] .apex-nav { margin-left: auto; }
.apex-header[data-variant="marketing"] .apex-actions { margin-left: var(--sp-5); }

.apex-account { display: flex; align-items: center; gap: var(--sp-2); }
.apex-account__name {
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--muted);
  max-width: 18ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile disclosure — hidden on pointer-capable wide screens. */
.apex-menu-toggle {
  display: none;
  margin-left: auto;
  /* 44px minimum touch target (WCAG 2.5.5 / Apple HIG). The control
     previously measured 28px tall, which is small enough to miss on a
     phone and reads to the user as "the button did not respond". The
     border keeps its visual size; the padding grows the hit area. */
  min-height: 44px;
  padding: 11px var(--sp-3);
  align-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: var(--track-caps);
  cursor: pointer;
  /* Suppress the double-tap-to-zoom delay on touch, so one tap acts once. */
  touch-action: manipulation;
}

@media (max-width: 900px) {
  .apex-header { gap: var(--sp-3); }
  .apex-menu-toggle { display: inline-flex; }
  /* Collapsed by default; the toggle reveals nav + actions as a column.
     Using explicit [data-menu] rather than :target or a checkbox so the
     state is owned by JS and reflected in aria-expanded. */
  .apex-header .apex-nav,
  .apex-header .apex-actions {
    display: none;
    width: 100%;
    margin-left: 0;
  }
  .apex-header[data-menu="open"] .apex-nav,
  .apex-header[data-menu="open"] .apex-actions {
    display: flex;
    flex-wrap: wrap;
  }
  .apex-header[data-menu="open"] .apex-nav { flex-direction: column; }
  .apex-header[data-menu="open"] .apex-nav a { width: 100%; }
  .apex-account__name { max-width: none; }
}

/* A frozen product section that has no page yet: present in the
   information architecture, visibly not yet reachable. Not a link, so it
   can never 404, and announced as disabled to assistive tech. */
.apex-nav__pending {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--dim);
  opacity: 0.55;
  cursor: default;
  border: 1px dashed transparent;
}

/* ============================================================
   V3.1 — SHARED CHROME UPGRADE
   ------------------------------------------------------------
   One header, one card language, one control language across the
   landing page AND every application page (Command Centre, APEX
   Intelligence, Trade Lab, Strategy Lab, Broker Accounts, auth).
   mountShell() renders .apex-header on all of them, so restyling it
   here is what makes the product feel like a single system rather
   than a marketing page bolted to a tool.

   Appended, not edited in place: the existing rules above stay the
   base, these refine them.
   ============================================================ */

.apex-header {
  padding: 14px 26px;
  gap: 22px;
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  transition: background 220ms ease, border-color 220ms ease;
}
/* A hairline that only appears once the page has scrolled under it. */
.apex-header::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong) 18%, var(--border-strong) 82%, transparent);
  opacity: 0.9;
}
.apex-header .wordmark { letter-spacing: 0.30em; font-weight: 600; }
.apex-header .subtitle { letter-spacing: 0.18em; }

/* Navigation: quiet by default, accent underline on the active item. */
.apex-header nav a {
  position: relative;
  font-size: 12px; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
  padding-block: 7px;
  transition: color 160ms ease;
}
.apex-header nav a:hover { color: var(--text); }
.apex-header nav a[aria-current="page"],
.apex-header nav a.is-active { color: var(--text-strong); }
.apex-header nav a[aria-current="page"]::after,
.apex-header nav a.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

/* ---------- Cards / panels shared by the app pages ---------- */
.card, .panel, .mat-glass, .mat-solid {
  border-radius: var(--radius-lg);
}
.mat-glass {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
}
.mat-solid {
  border: 1px solid var(--border);
  background: var(--panel);
}

/* ---------- Section headings across app pages ---------- */
.section-title, .panel-title {
  font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--dim);
}

/* ---------- Status pills: one vocabulary everywhere ---------- */
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: var(--radius-pill);
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px solid var(--border-strong); color: var(--muted);
  background: var(--panel-2);
}
.status-pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gray); flex: none;
}
.status-pill[data-state="live"], .status-pill[data-state="ok"] {
  color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, var(--border));
}
.status-pill[data-state="live"]::before, .status-pill[data-state="ok"]::before {
  background: var(--green); box-shadow: 0 0 9px var(--green);
}
.status-pill[data-state="stale"], .status-pill[data-state="warn"] {
  color: var(--gold); border-color: color-mix(in srgb, var(--gold) 40%, var(--border));
}
.status-pill[data-state="stale"]::before, .status-pill[data-state="warn"]::before { background: var(--gold); }
.status-pill[data-state="down"], .status-pill[data-state="error"] {
  color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--border));
}
.status-pill[data-state="down"]::before, .status-pill[data-state="error"]::before { background: var(--red); }

/* ---------- Focus visibility (accessibility, all pages) ---------- */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  .apex-header { transition: none; }
}
