/* ============================================================
   CODEX — Design System
   codex.css  ·  single, self-contained foundation

   Codex is a dark, engineered, abstract design system: a deep-indigo
   ground, faceted-glass primitives drawn in thin light edges with
   luminous nodes, and a minimal geometric-sans voice. Cool by
   default, signed in a single warm amber accent.

   This file is fully self-contained — zero external variables. Link it alone:

       <link rel="stylesheet" href="codex.css">

   TYPE — one geometric family, used across the whole system:
     • Space Grotesk ......... display, labels, body, numerals
   Minimal and cool by intent. Numerals are tabular everywhere.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Jost:wght@400;500;600&display=swap');

:root {
  /* ---- GROUND (the dark stage) ----------------------------------- */
  --cdx-ground:        #07091f;   /* deepest base — page background     */
  --cdx-ground-core:   #1a2258;   /* indigo core of the radial glow     */
  --cdx-ground-mid:    #0c1033;   /* mid stop of the radial ground      */
  --cdx-surface:       #0d1130;   /* raised card / panel surface        */
  --cdx-surface-deep:  #0b0f30;   /* recessed / inner surface           */

  /* The signature ground gradient — apply to any full-bleed stage.    */
  --cdx-ground-grad:
      radial-gradient(1300px 900px at 50% 30%,
        var(--cdx-ground-core) 0%, var(--cdx-ground-mid) 56%, var(--cdx-ground) 100%); /* @kind other */

  /* ---- FACETED-GLASS PRIMITIVES ---------------------------------- */
  /* The motif is built from three ink primitives over the ground:
     translucent FACES, light EDGES, and luminous NODES.              */
  --cdx-face:          #ffffff;             /* polygon fill (low opacity) */
  --cdx-edge:          rgba(255,255,255,0.60); /* primary wire edge       */
  --cdx-edge-bright:   rgba(255,255,255,0.85); /* front / silhouette edge */
  --cdx-edge-faint:    rgba(255,255,255,0.18); /* back / hidden edge       */
  --cdx-node:          #ffffff;             /* vertex node fill           */
  --cdx-node-glow:     rgba(255,255,255,0.90); /* node halo colour         */

  /* Tunable knobs the FacetedGlyph component drives per-instance.     */
  --cdx-edge-w:        0.9;   /* @kind other */ /* base edge stroke width (px in 300 vb)  */
  --cdx-glow:          3px;   /* node drop-shadow blur radius           */

  /* ---- ACCENTS (the single warm signature) ----------------------- */
  /* Codex is cool by default. One warm amber accent signs the system
     — luminous nodes, rules, and the wordmark when wanted.            */
  --cdx-amber:         #D48628;   /* catalyst amber — warm node / rule  */
  --cdx-amber-glow:    rgba(212,134,40,0.95);
  --cdx-amber-deep:    #b06e1d;   /* pressed / hover amber              */
  --cdx-amber-soft:    rgba(212,134,40,0.14);  /* tint fill (chips)     */
  --cdx-ember:         #B52127;   /* deep ember — rules / "live" badge  */
  --cdx-ember-soft:    rgba(181,33,39,0.16);   /* tint fill            */
  --cdx-on-amber:      #0a0c1f;   /* ink that sits on an amber fill     */

  /* ---- BRAND / LOGO ---------------------------------------------- */
  /* The Codex mark is a C-ring enclosing an ×, in its own colours —
     an indigo ring + amber ×. The logotype is set in Jost — a clean
     geometric face — wide-tracked, all-caps.                          */
  --cdx-brand-indigo:  #1A237E;   /* logo ring on light grounds         */
  --cdx-logo-font:     'Jost', 'Futura', 'Century Gothic', sans-serif;
  --cdx-logo-spacing:  0.2em;

  /* ---- TEXT (on the dark ground) --------------------------------- */
  /* Tuned for WCAG AA on the indigo ground (#07091f–#0d1130):
     muted ≈ 8.6:1, soft ≈ 5.6:1, faint ≈ 4.7:1 (AA for ≥16px / UI text). */
  --cdx-text:          #ffffff;
  --cdx-text-muted:    rgba(255,255,255,0.68);
  --cdx-text-soft:     rgba(255,255,255,0.54);
  --cdx-text-faint:    rgba(255,255,255,0.48);

  /* ---- LINES & BORDERS ------------------------------------------- */
  --cdx-line:          rgba(255,255,255,0.10);  /* hairline on dark     */
  --cdx-line-strong:   rgba(255,255,255,0.16);

  /* ---- ELEVATION (glow, not shadow) ------------------------------ */
  --cdx-elev-1:  0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 30px rgba(0,0,0,0.45);
  --cdx-elev-2:  0 1px 0 rgba(255,255,255,0.06) inset, 0 18px 50px rgba(0,0,0,0.55);

  /* ---- RADII ----------------------------------------------------- */
  /* Tight & schematic — crisp corners that echo the faceted vertices.
     Circles (nodes, status, avatars) and linear meters stay round.   */
  --cdx-radius-sm: 2px;
  --cdx-radius:    3px;
  --cdx-radius-lg: 4px;

  /* ---- MOTION & FOCUS -------------------------------------------- */
  /* Calm ease-out, no bounce. Hover darkens; press nudges ~1px.      */
  --cdx-dur:   180ms; /* @kind other */
  --cdx-ease:  cubic-bezier(0.22, 0.61, 0.36, 1); /* @kind other */
  --cdx-focus: 0 0 0 3px rgba(212,134,40,0.38);

  /* ---- ICONOGRAPHY ----------------------------------------------- */
  /* Lucide, drawn thin to match the hairline faceted-glass edges.    */
  --cdx-icon-stroke: 1.4;

  /* ---- SPACING SCALE (4px base) ---------------------------------- */
  --cdx-space-1: 4px;
  --cdx-space-2: 8px;
  --cdx-space-3: 12px;
  --cdx-space-4: 16px;
  --cdx-space-5: 24px;
  --cdx-space-6: 32px;
  --cdx-space-7: 48px;
  --cdx-space-8: 64px;

  /* ---- TYPE ------------------------------------------------------- */
  --cdx-font: 'Space Grotesk', 'Jost', 'Century Gothic', system-ui, sans-serif;

  --cdx-line-tight: 1.08; /* @kind other */
  --cdx-line-snug:  1.2; /* @kind other */
  --cdx-line-body:  1.6; /* @kind other */

  --cdx-track-wide: 0.24em;   /* wordmark / eyebrow tracking            */
  --cdx-track-mid:  0.14em;   /* label tracking                         */

  /* ---- DATA VISUALISATION ---------------------------------------- */
  /* Series order on the dark indigo ground — AMBER is the hero (the one
     value that matters); every supporting series is a muted cool slate,
     the same white→slate family as the faceted-glass edges. Restraint by
     design: the chart should never look like a rainbow dashboard.       */
  --cdx-series-1: #E0922E;   /* amber        — the catalyst / hero series */
  --cdx-series-2: #C2D4E8;   /* cool white   — first supporting series    */
  --cdx-series-3: #93A9CC;   /* slate-blue   — second supporting          */
  --cdx-series-4: #6A7EA4;   /* deep slate   — third supporting           */
  --cdx-series-5: #47587A;   /* deepest slate — the muted rest            */

  /* Semantic deltas — kept OUTSIDE the series scale so trend arrows read
     instantly without reintroducing colour into the series themselves.  */
  --cdx-pos: #43D98A;   /* positive / growth — matches the live status dot */
  --cdx-neg: #E0635A;   /* negative / signal — a softened ember            */

  --cdx-grid:       rgba(255,255,255,0.07);  /* chart gridlines         */
  --cdx-axis:       rgba(255,255,255,0.20);  /* baseline / axis stroke  */
  --cdx-track:      rgba(255,255,255,0.08);  /* bar / ring track fill   */
  --cdx-area-top:   rgba(224,146,46,0.30);   /* area gradient top stop  */
  --cdx-area-bot:   rgba(224,146,46,0.00);   /* area gradient bottom    */
}

/* ============================================================
   LIGHT / INVERTED SURFACE — an OPTIONAL scope for embedding Codex
   UI in light documents, print, or bright contexts. Add class
   "cdx-light" to a container (or <body>) to remap the core tokens
   to a cool, indigo-inked light surface. Amber stays the accent;
   elevation softens from glow to shadow.
   NOTE: the FacetedGlyph motif is built from WHITE edges/nodes and
   is intended to stay on the DARK ground — render glyphs in a dark
   panel even within a light layout.
   ============================================================ */
.cdx-light {
  --cdx-ground:        #eceef6;
  --cdx-ground-core:   #ffffff;
  --cdx-ground-mid:    #e7e9f3;
  --cdx-surface:       #ffffff;
  --cdx-surface-deep:  #f4f5fa;
  --cdx-ground-grad:   radial-gradient(1300px 900px at 50% 30%, #ffffff 0%, #eceef6 60%, #e4e7f2 100%); /* @kind other */

  --cdx-text:          #14173a;
  --cdx-text-muted:    rgba(20,23,58,0.70);
  --cdx-text-soft:     rgba(20,23,58,0.56);
  --cdx-text-faint:    rgba(20,23,58,0.46);

  --cdx-line:          rgba(20,23,58,0.12);
  --cdx-line-strong:   rgba(20,23,58,0.20);

  /* elevation = soft shadow, not glow */
  --cdx-elev-1:  0 1px 2px rgba(20,23,58,0.06), 0 6px 20px rgba(20,23,58,0.07);
  --cdx-elev-2:  0 2px 4px rgba(20,23,58,0.08), 0 16px 40px rgba(20,23,58,0.12);

  /* warm accent holds; tint fills lift slightly for the light ground */
  --cdx-amber-soft:    rgba(212,134,40,0.16);
  --cdx-ember-soft:    rgba(181,33,39,0.12);

  /* data-viz on light: keep amber hero, darken the supporting ramp */
  --cdx-series-2: #5577A8;
  --cdx-series-3: #7A8BB0;
  --cdx-series-4: #9AA6C0;
  --cdx-series-5: #B7BFD2;
  --cdx-grid:    rgba(20,23,58,0.08);
  --cdx-axis:    rgba(20,23,58,0.22);
  --cdx-track:   rgba(20,23,58,0.07);
}

/* ============================================================
   SEMANTIC TYPE — one geometric voice, minimal and cool
   ============================================================ */

.cdx-wordmark {
  font-family: var(--cdx-font);
  font-weight: 500;
  letter-spacing: var(--cdx-track-wide);
  text-transform: uppercase;
  color: var(--cdx-text);
  line-height: var(--cdx-line-tight);
}

/* LOGOTYPE — the "CODEX" wordmark, set in Jost (geometric, all-caps).
   Distinct from the UI .cdx-wordmark (Space Grotesk).   */
.cdx-logo-wordmark {
  font-family: var(--cdx-logo-font);
  font-weight: 500;
  letter-spacing: var(--cdx-logo-spacing);
  text-transform: uppercase;
  line-height: 1;
  color: var(--cdx-amber);
}

/* THE MARK — C-ring + ×. Ring uses currentColor; × reads --mk-x.
   Drop in via <svg class="cdx-mark"><use href="#codexMark"/></svg>. */
.cdx-mark { display: block; color: var(--cdx-brand-indigo); }
.cdx-mark .mk-x { fill: var(--mk-x, var(--cdx-amber)); }
.cdx-mark.reversed { color: #fff; }

.cdx-eyebrow {
  font-family: var(--cdx-font);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: var(--cdx-track-wide);
  text-transform: uppercase;
  color: var(--cdx-amber);
}

/* DISPLAY — the big structural heading */
.cdx-display {
  font-family: var(--cdx-font);
  font-weight: 400;
  font-size: 44px;
  line-height: var(--cdx-line-tight);
  letter-spacing: -0.02em;
  color: var(--cdx-text);
}
.cdx-h1 {
  font-family: var(--cdx-font);
  font-weight: 500;
  font-size: 34px;
  line-height: var(--cdx-line-tight);
  letter-spacing: -0.02em;
  color: var(--cdx-text);
}
.cdx-h2 {
  font-family: var(--cdx-font);
  font-weight: 500;
  font-size: 24px;
  line-height: var(--cdx-line-snug);
  letter-spacing: -0.01em;
  color: var(--cdx-text);
}
.cdx-label {
  font-family: var(--cdx-font);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: var(--cdx-track-mid);
  text-transform: uppercase;
  color: var(--cdx-text-soft);
}

.cdx-lead {
  font-family: var(--cdx-font);
  font-weight: 400;
  font-size: 18px;
  line-height: var(--cdx-line-body);
  color: var(--cdx-text-muted);
}
.cdx-body {
  font-family: var(--cdx-font);
  font-weight: 400;
  font-size: 15px;
  line-height: var(--cdx-line-body);
  color: var(--cdx-text-muted);
}
.cdx-caption {
  font-family: var(--cdx-font);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.45;
  color: var(--cdx-text-faint);
}

/* Statistic / figure — geometric, tabular */
.cdx-figure {
  font-family: var(--cdx-font);
  font-weight: 300;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--cdx-text);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   THE DARK STAGE  —  full-bleed engineered ground
   ============================================================ */
.cdx-stage {
  background: var(--cdx-ground);
  background-image: var(--cdx-ground-grad);
  color: var(--cdx-text);
  font-family: var(--cdx-font);
}

/* A raised dark panel/card on the stage */
.cdx-panel {
  background: var(--cdx-surface);
  border: 1px solid var(--cdx-line);
  border-radius: var(--cdx-radius);
  box-shadow: var(--cdx-elev-1);
}

/* ============================================================
   FACETED-GLASS SVG CLASSES
   These style the <FacetedGlyph> output. Edge widths and node
   glow read from the --cdx-edge-w / --cdx-glow / --cdx-node
   custom properties, which the component sets per instance.
   ============================================================ */
.cdx-glyph { display: block; overflow: visible; }
.cdx-glyph .face        { fill: var(--cdx-face); }
.cdx-glyph .edge        { stroke: var(--cdx-edge);   stroke-width: var(--cdx-edge-w); fill: none; stroke-linejoin: round; }
.cdx-glyph .edge.bright { stroke: var(--cdx-edge-bright); }
.cdx-glyph .edge-b      { stroke: var(--cdx-edge-faint); stroke-width: calc(var(--cdx-edge-w) * 0.66); fill: none; stroke-linejoin: round; }
.cdx-glyph .node        { fill: var(--cdx-node); filter: drop-shadow(0 0 var(--cdx-glow) var(--cdx-node-glow)); }
.cdx-glyph .node-w      { fill: var(--cdx-node); opacity: 0.4; }

/* ============================================================
   COVER / SECTION-BREAK COMPOSITIONS
   Three temperatures of the same engineered cover:
     .cool  — monochrome indigo, motif as hero
     .warm  — red+amber glow, amber nodes, ember rule (on-brand)
     .photo — documentary photo leads, motif as quiet watermark
   ============================================================ */
.cdx-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--cdx-radius);
  overflow: hidden;
  border: 1px solid var(--cdx-line-strong);
}
.cdx-cover .wm {
  position: absolute; top: 18px; left: 20px; z-index: 3;
  font-family: var(--cdx-font); font-weight: 500;
  letter-spacing: var(--cdx-track-wide); font-size: 12px; text-transform: uppercase;
}
.cdx-cover .ttl {
  position: absolute; left: 20px; bottom: 20px; right: 30%; z-index: 3;
  font-family: var(--cdx-font); font-weight: 500; font-size: 21px; line-height: 1.12;
  letter-spacing: -0.01em; color: var(--cdx-text);
}
.cdx-cover .glyph-slot {
  position: absolute; right: -26px; bottom: -30px; z-index: 2;
  width: 188px; height: 188px;
}
.cdx-cover .rule {
  position: absolute; left: 20px; bottom: 74px; width: 40px; height: 3px; z-index: 3;
  background: var(--cdx-ember);
}

/* cool / monochrome */
.cdx-cover.cool { background: radial-gradient(420px 300px at 74% 26%, var(--cdx-ground-core), var(--cdx-ground-mid) 72%); }
.cdx-cover.cool .wm { color: var(--cdx-text); }

/* warm / branded */
.cdx-cover.warm {
  background:
    radial-gradient(440px 320px at 80% 16%, rgba(181,33,39,0.55) 0%, rgba(181,33,39,0) 60%),
    radial-gradient(360px 300px at 18% 110%, rgba(212,134,40,0.34) 0%, rgba(212,134,40,0) 62%),
    linear-gradient(155deg, #1c245e, var(--cdx-ground-mid));
}
.cdx-cover.warm .wm { color: var(--cdx-amber); }

/* photo-anchored */
.cdx-cover.photo .ph {
  position: absolute; inset: 0; z-index: 1;
  background: repeating-linear-gradient(135deg, #34281a 0 14px, #2c2116 14px 28px);
}
.cdx-cover.photo .phlabel {
  position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 0 30px;
  font-family: var(--cdx-font); font-size: 12px; color: rgba(255,255,255,0.55); letter-spacing: 0.04em;
}
.cdx-cover.photo .scrim {
  position: absolute; inset: 0; z-index: 2;
  background: linear-gradient(to top, rgba(7,9,20,0.92) 0%, rgba(7,9,20,0.36) 42%, rgba(7,9,20,0.05) 70%);
}
.cdx-cover.photo .wm { color: var(--cdx-text); }
.cdx-cover.photo .glyph-slot { width: 116px; height: 116px; right: 14px; bottom: 10px; opacity: 0.55; }

.cdx-badge {
  position: absolute; top: 14px; right: 14px; z-index: 4;
  background: var(--cdx-ember); color: #fff;
  font-family: var(--cdx-font); font-weight: 500; font-size: 9.5px;
  letter-spacing: 0.1em; text-transform: uppercase; padding: 5px 9px; border-radius: 2px;
}

/* ============================================================
   COVER LAYOUTS — composition modifiers (stack with cool/warm/photo)
   The temperature classes (.cool/.warm/.photo) set the GROUND;
   these set the COMPOSITION. Mix one of each.
   ============================================================ */

/* Centred — glyph behind a centred wordmark + title, for a title card */
.cdx-cover.center { display: grid; place-items: center; text-align: center; }
.cdx-cover.center .glyph-slot {
  position: absolute; inset: 0; right: auto; bottom: auto; left: 50%; top: 46%;
  width: 300px; height: 300px; transform: translate(-50%, -50%); opacity: 0.5; z-index: 1;
}
.cdx-cover.center .wm { position: static; margin-bottom: 10px; }
.cdx-cover.center .ttl { position: static; right: auto; max-width: 78%; z-index: 3; }
.cdx-cover.center .rule { position: static; margin: 14px auto 0; }

/* Split — copy column left, large glyph bleeding off the right edge */
.cdx-cover.split .glyph-slot { width: 300px; height: 300px; right: -64px; bottom: 50%; transform: translateY(50%); }

/* Minimal — title only, motif demoted to a small top-right mark */
.cdx-cover.minimal .glyph-slot { width: 84px; height: 84px; right: 18px; top: 18px; bottom: auto; opacity: 0.7; }

/* ============================================================
   BUTTONS
   Amber is the primary action; ember for "live"/destructive accents;
   ghost + quiet for secondary. Calm ease-out, ~1px press nudge.
   ============================================================ */
.cdx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--cdx-font); font-weight: 500; font-size: 13.5px;
  letter-spacing: 0.01em; line-height: 1;
  padding: 10px 16px; border-radius: var(--cdx-radius-sm); white-space: nowrap;
  background: transparent; color: var(--cdx-text);
  border: 1px solid var(--cdx-line-strong); cursor: pointer; text-decoration: none;
  transition: background var(--cdx-dur) var(--cdx-ease), border-color var(--cdx-dur) var(--cdx-ease),
    color var(--cdx-dur) var(--cdx-ease), transform var(--cdx-dur) var(--cdx-ease),
    box-shadow var(--cdx-dur) var(--cdx-ease);
}
.cdx-btn:focus-visible { outline: none; box-shadow: var(--cdx-focus); }
.cdx-btn:active { transform: translateY(1px); }
.cdx-btn svg, .cdx-btn [data-lucide] { width: 16px; height: 16px; }

/* Global Lucide icon weight — thin, to match the hairline glyph edges.
   Overrides Lucide's default stroke-width: 2 attribute via CSS.        */
.lucide, svg[data-lucide], [data-lucide] svg { stroke-width: var(--cdx-icon-stroke); }

/* PRIMARY — outline + glow. The default action speaks the edge/node
   language: a thin amber border, a faint amber tint, and a luminous
   hover. Reserve the solid fill for .cdx-btn--emphasis (the rare CTA). */
.cdx-btn--primary { background: rgba(212,134,40,0.10); color: var(--cdx-amber); border-color: rgba(212,134,40,0.55); }
.cdx-btn--primary:hover { background: rgba(212,134,40,0.16); border-color: var(--cdx-amber); box-shadow: 0 0 0 1px rgba(212,134,40,0.22), 0 0 16px rgba(212,134,40,0.35); }
.cdx-btn--primary:focus-visible { box-shadow: var(--cdx-focus); }
/* EMPHASIS — the one solid amber CTA that must dominate. Use sparingly. */
.cdx-btn--emphasis { background: var(--cdx-amber); color: var(--cdx-on-amber); border-color: var(--cdx-amber); box-shadow: 0 0 18px rgba(212,134,40,0.28); }
.cdx-btn--emphasis:hover { background: var(--cdx-amber-deep); border-color: var(--cdx-amber-deep); }
.cdx-btn--ember { background: rgba(181,33,39,0.12); color: #e8888c; border-color: rgba(181,33,39,0.55); }
.cdx-btn--ember:hover { background: rgba(181,33,39,0.18); border-color: var(--cdx-ember); box-shadow: 0 0 0 1px rgba(181,33,39,0.22), 0 0 16px rgba(181,33,39,0.32); }
.cdx-btn--ghost { background: transparent; color: var(--cdx-text); border-color: var(--cdx-line-strong); }
.cdx-btn--ghost:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.28); }
.cdx-btn--quiet { background: transparent; color: var(--cdx-text-muted); border-color: transparent; padding-left: 8px; padding-right: 8px; }
.cdx-btn--quiet:hover { color: var(--cdx-text); }

.cdx-btn--sm { font-size: 12.5px; padding: 8px 13px; }
.cdx-btn--lg { font-size: 15px; padding: 14px 24px; }
.cdx-btn[disabled], .cdx-btn.is-disabled { opacity: 0.4; pointer-events: none; }

/* ============================================================
   CARDS — raised dark surface; emphasis cards take an amber top-
   or left-rule (never a full coloured border-box).
   ============================================================ */
.cdx-card {
  position: relative; background: var(--cdx-surface);
  border: 1px solid var(--cdx-line); border-radius: var(--cdx-radius);
  padding: var(--cdx-space-5); box-shadow: var(--cdx-elev-1);
  transition: transform var(--cdx-dur) var(--cdx-ease), box-shadow var(--cdx-dur) var(--cdx-ease),
    border-color var(--cdx-dur) var(--cdx-ease);
}
.cdx-card--hover:hover { transform: translateY(-3px); box-shadow: var(--cdx-elev-2); border-color: var(--cdx-line-strong); }
.cdx-card--toprule { border-top: 3px solid var(--cdx-amber); border-top-left-radius: var(--cdx-radius); border-top-right-radius: var(--cdx-radius); }
.cdx-card--toprule.ember { border-top-color: var(--cdx-ember); }
.cdx-card--leftrule { border-left: 4px solid var(--cdx-amber); }
.cdx-card--leftrule.ember { border-left-color: var(--cdx-ember); }
/* Frosted variant — over photography / brighter grounds */
.cdx-card--frost {
  background: rgba(13,17,48,0.55); backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1); border-color: var(--cdx-line-strong);
}
.cdx-card__title { font-family: var(--cdx-font); font-weight: 500; font-size: 17px; color: var(--cdx-text); margin: 0; letter-spacing: -0.01em; }
.cdx-card__body  { font-family: var(--cdx-font); font-weight: 400; font-size: 14px; line-height: var(--cdx-line-body); color: var(--cdx-text-muted); margin: 8px 0 0; }

/* ============================================================
   KPI / STAT BLOCK — geometric figure, label, caption
   ============================================================ */
.cdx-kpi { display: flex; flex-direction: column; gap: 6px; }
.cdx-kpi .figure { font-family: var(--cdx-font); font-weight: 300; font-size: 46px; line-height: 1; letter-spacing: -0.02em; color: var(--cdx-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cdx-kpi .figure .accent { color: var(--cdx-amber); }
.cdx-kpi .k-label { font-family: var(--cdx-font); font-weight: 500; font-size: 12px; letter-spacing: var(--cdx-track-mid); text-transform: uppercase; color: var(--cdx-amber); }
.cdx-kpi .k-caption { font-family: var(--cdx-font); font-size: 12.5px; color: var(--cdx-text-faint); }

/* ============================================================
   TAGS / CHIPS / STATUS
   ============================================================ */
.cdx-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--cdx-font); font-weight: 500; font-size: 11.5px;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 3px;
  background: rgba(255,255,255,0.06); color: var(--cdx-text-muted);
  border: 1px solid var(--cdx-line);
}
.cdx-tag--amber { background: var(--cdx-amber-soft); color: var(--cdx-amber); border-color: rgba(212,134,40,0.32); }
.cdx-tag--ember { background: var(--cdx-ember-soft); color: #e8a0a3; border-color: rgba(181,33,39,0.38); }
.cdx-tag--solid { background: var(--cdx-amber); color: var(--cdx-on-amber); border-color: var(--cdx-amber); }

.cdx-status { display: inline-flex; align-items: center; gap: 7px; font-family: var(--cdx-font); font-size: 12.5px; color: var(--cdx-text-muted); }
.cdx-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--cdx-amber); box-shadow: 0 0 8px var(--cdx-amber-glow); }
.cdx-status.live::before { background: #3ddc84; box-shadow: 0 0 8px rgba(61,220,132,0.9); }
.cdx-status.off::before  { background: var(--cdx-text-faint); box-shadow: none; }

/* ============================================================
   NAV — sticky top bar on the dark stage
   ============================================================ */
.cdx-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px; border-bottom: 1px solid var(--cdx-line);
  background: rgba(7,9,20,0.72); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.cdx-nav__brand { display: flex; align-items: center; gap: 11px; }
.cdx-nav__brand .cdx-mark { width: 28px; height: 28px; }
.cdx-nav__links { display: flex; align-items: center; gap: 26px; }
.cdx-nav__links a:not(.cdx-btn) {
  font-family: var(--cdx-font); font-weight: 500; font-size: 13px;
  letter-spacing: var(--cdx-track-mid); text-transform: uppercase;
  color: var(--cdx-text-soft); text-decoration: none;
  transition: color var(--cdx-dur) var(--cdx-ease);
}
.cdx-nav__links a:not(.cdx-btn):hover, .cdx-nav__links a:not(.cdx-btn)[aria-current="page"] { color: var(--cdx-text); }
.cdx-nav__links a:not(.cdx-btn)[aria-current="page"] { color: var(--cdx-amber); }

/* ============================================================
   FORM FIELD — input on the dark ground
   ============================================================ */
.cdx-field { display: flex; flex-direction: column; gap: 7px; }
.cdx-field > .cdx-label { color: var(--cdx-text-soft); }
.cdx-input {
  font-family: var(--cdx-font); font-size: 14px; color: var(--cdx-text);
  background: var(--cdx-surface-deep); border: 1px solid var(--cdx-line-strong);
  border-radius: var(--cdx-radius-sm); padding: 11px 13px; width: 100%; box-sizing: border-box;
  transition: border-color var(--cdx-dur) var(--cdx-ease), box-shadow var(--cdx-dur) var(--cdx-ease);
}
.cdx-input::placeholder { color: var(--cdx-text-faint); }
.cdx-input:focus { outline: none; border-color: var(--cdx-amber); box-shadow: var(--cdx-focus); }

/* ============================================================
   DIVIDERS / RULES — the signature thin accent rule
   ============================================================ */
.cdx-rule { height: 1px; border: 0; background: var(--cdx-line); margin: var(--cdx-space-5) 0; }
.cdx-rule--amber { height: 3px; width: 40px; background: var(--cdx-amber); margin: 0; border-radius: 2px; }
.cdx-rule--ember { height: 3px; width: 40px; background: var(--cdx-ember); margin: 0; border-radius: 2px; }

/* ============================================================
   CHARTS — engineered data-viz on the dark ground.
   Same language as the FacetedGlyph: thin light strokes, luminous
   nodes, amber catalyst lead. The SVG itself is drawn by the chart
   helper; these classes carry the shared chrome (frame, axes,
   legend, caption) so every chart reads as one family.
   ============================================================ */
.cdx-chart {
  position: relative; background: var(--cdx-surface);
  border: 1px solid var(--cdx-line); border-radius: var(--cdx-radius);
  padding: var(--cdx-space-5); box-shadow: var(--cdx-elev-1);
}
.cdx-chart__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.cdx-chart__title { font-family: var(--cdx-font); font-weight: 500; font-size: 16px; letter-spacing: -0.01em; color: var(--cdx-text); margin: 0; }
.cdx-chart__eyebrow { font-family: var(--cdx-font); font-weight: 500; font-size: 11px; letter-spacing: var(--cdx-track-mid); text-transform: uppercase; color: var(--cdx-amber); margin: 0 0 6px; }
.cdx-chart__caption { font-family: var(--cdx-font); font-size: 12px; color: var(--cdx-text-faint); margin: 12px 0 0; }
.cdx-chart svg { display: block; width: 100%; height: auto; overflow: visible; }

/* SVG primitives the helper emits — theme GLOBALLY (class-driven) so a
   CodexCharts svg renders correctly in ANY container, not only .cdx-chart. */
.cx-grid    { stroke: var(--cdx-grid); stroke-width: 1; }
.cx-axis    { stroke: var(--cdx-axis); stroke-width: 1; }
.cx-axis-lbl{ fill: var(--cdx-text-faint); font-family: var(--cdx-font); font-size: 11px; font-variant-numeric: tabular-nums; }
.cx-axis-lbl.y { text-anchor: end; }
.cx-axis-lbl.x { text-anchor: middle; }
.cx-line    { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cx-node    { stroke: var(--cdx-surface); stroke-width: 1.5; }
.cx-bar     { rx: 3; }
.cx-track   { fill: var(--cdx-track); }
.cx-val     { fill: var(--cdx-text); font-family: var(--cdx-font); font-weight: 500; font-variant-numeric: tabular-nums; }

/* shared legend */
.cdx-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; }
.cdx-legend__item { display: inline-flex; align-items: center; gap: 7px; font-family: var(--cdx-font); font-size: 12.5px; color: var(--cdx-text-muted); }
.cdx-legend__dot { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.cdx-legend__dot.round { border-radius: 50%; }

/* the data-series palette as utility classes (stroke + fill) */
.cdx-s1 { color: var(--cdx-series-1); }
.cdx-s2 { color: var(--cdx-series-2); }
.cdx-s3 { color: var(--cdx-series-3); }
.cdx-s4 { color: var(--cdx-series-4); }
.cdx-s5 { color: var(--cdx-series-5); }

/* ============================================================
   TABLES — engineered data rows on the dark ground.
   Hairline row rules, tabular numerals, right-aligned numbers,
   amber highlight for the row that matters. Sortable headers carry
   a caret; a header is .is-sorted (asc/desc) when active.
   ============================================================ */
.cdx-table-wrap {
  border: 1px solid var(--cdx-line); border-radius: var(--cdx-radius);
  overflow: hidden; box-shadow: var(--cdx-elev-1); background: var(--cdx-surface);
}
.cdx-table { width: 100%; border-collapse: collapse; font-family: var(--cdx-font); }
.cdx-table thead th {
  text-align: left; font-weight: 500; font-size: 11px; letter-spacing: var(--cdx-track-mid);
  text-transform: uppercase; color: var(--cdx-text-soft);
  padding: 13px 18px; background: var(--cdx-surface-deep);
  border-bottom: 1px solid var(--cdx-line-strong); white-space: nowrap;
}
.cdx-table tbody td {
  font-size: 14px; color: var(--cdx-text-muted); padding: 14px 18px;
  border-top: 1px solid var(--cdx-line); vertical-align: middle;
}
.cdx-table tbody tr:first-child td { border-top: 0; }
.cdx-table tbody td.strong { color: var(--cdx-text); font-weight: 500; }
.cdx-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cdx-table th.num { text-align: right; }

/* row interactions */
.cdx-table tbody tr { transition: background var(--cdx-dur) var(--cdx-ease); }
.cdx-table--hover tbody tr:hover { background: rgba(255,255,255,0.035); }
.cdx-table tbody tr.is-highlight { background: var(--cdx-amber-soft); }
.cdx-table tbody tr.is-highlight td:first-child { box-shadow: inset 3px 0 0 var(--cdx-amber); }
.cdx-table tbody tr.is-highlight td.strong { color: #fff; }

/* density & zebra modifiers */
.cdx-table--zebra tbody tr:nth-child(even) { background: rgba(255,255,255,0.022); }
.cdx-table--compact thead th { padding: 9px 14px; }
.cdx-table--compact tbody td { padding: 9px 14px; font-size: 13px; }

/* sortable header */
.cdx-th--sort { cursor: pointer; user-select: none; transition: color var(--cdx-dur) var(--cdx-ease); }
.cdx-th--sort:hover { color: var(--cdx-text); }
.cdx-th--sort .caret { display: inline-block; margin-left: 6px; opacity: 0.4; transition: opacity var(--cdx-dur) var(--cdx-ease), transform var(--cdx-dur) var(--cdx-ease); }
.cdx-th--sort.is-sorted { color: var(--cdx-amber); }
.cdx-th--sort.is-sorted .caret { opacity: 1; }
.cdx-th--sort.is-sorted.desc .caret { transform: rotate(180deg); }

/* a delta cell (paired with --cdx-pos / --cdx-neg) */
.cdx-delta { font-variant-numeric: tabular-nums; font-weight: 500; }
.cdx-delta.up { color: var(--cdx-pos); }
.cdx-delta.down { color: var(--cdx-neg); }

/* ============================================================
   FORM CONTROLS — the dark-ground input family.
   Shared focus ring (amber), recessed surface, hairline border that
   warms to amber on focus. Selection controls fill amber when checked.
   ============================================================ */

/* shared label / hint / row scaffolding (extends .cdx-field) */
.cdx-field .cdx-hint { font-family: var(--cdx-font); font-size: 12px; color: var(--cdx-text-faint); }
.cdx-field--error .cdx-input,
.cdx-field--error .cdx-select select,
.cdx-field--error .cdx-textarea { border-color: var(--cdx-neg); }
.cdx-field--error .cdx-hint { color: var(--cdx-neg); }

/* TEXTAREA — same skin as .cdx-input */
.cdx-textarea {
  font-family: var(--cdx-font); font-size: 14px; color: var(--cdx-text); line-height: 1.5;
  background: var(--cdx-surface-deep); border: 1px solid var(--cdx-line-strong);
  border-radius: var(--cdx-radius-sm); padding: 11px 13px; width: 100%; box-sizing: border-box;
  resize: vertical; min-height: 88px;
  transition: border-color var(--cdx-dur) var(--cdx-ease), box-shadow var(--cdx-dur) var(--cdx-ease);
}
.cdx-textarea::placeholder { color: var(--cdx-text-faint); }
.cdx-textarea:focus { outline: none; border-color: var(--cdx-amber); box-shadow: var(--cdx-focus); }

/* SELECT — native <select> reskinned with a custom caret */
.cdx-select { position: relative; display: inline-flex; width: 100%; }
.cdx-select select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  font-family: var(--cdx-font); font-size: 14px; color: var(--cdx-text); width: 100%;
  background: var(--cdx-surface-deep); border: 1px solid var(--cdx-line-strong);
  border-radius: var(--cdx-radius-sm); padding: 11px 38px 11px 13px; cursor: pointer;
  transition: border-color var(--cdx-dur) var(--cdx-ease), box-shadow var(--cdx-dur) var(--cdx-ease);
}
.cdx-select select:focus { outline: none; border-color: var(--cdx-amber); box-shadow: var(--cdx-focus); }
.cdx-select option { background: var(--cdx-surface); color: var(--cdx-text); }
.cdx-select::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px;
  border-right: 1.5px solid var(--cdx-text-soft); border-bottom: 1.5px solid var(--cdx-text-soft);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}

/* CHECKBOX & RADIO — custom control via the input + sibling box pattern.
   Markup: <label class="cdx-check"><input type="checkbox"><span class="box"></span> Label</label> */
.cdx-check, .cdx-radio {
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
  font-family: var(--cdx-font); font-size: 14px; color: var(--cdx-text-muted); user-select: none;
}
.cdx-check input, .cdx-radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.cdx-check .box, .cdx-radio .box {
  flex: none; width: 19px; height: 19px; background: var(--cdx-surface-deep);
  border: 1.5px solid var(--cdx-line-strong); display: grid; place-items: center;
  transition: background var(--cdx-dur) var(--cdx-ease), border-color var(--cdx-dur) var(--cdx-ease);
}
.cdx-check .box { border-radius: 2px; }
.cdx-radio .box { border-radius: 50%; }
.cdx-check .box::after {
  content: ""; width: 10px; height: 6px; border-left: 2px solid var(--cdx-on-amber);
  border-bottom: 2px solid var(--cdx-on-amber); transform: rotate(-45deg) translateY(-1px) scale(0);
  transition: transform var(--cdx-dur) var(--cdx-ease);
}
.cdx-radio .box::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cdx-on-amber);
  transform: scale(0); transition: transform var(--cdx-dur) var(--cdx-ease);
}
.cdx-check input:checked + .box, .cdx-radio input:checked + .box { background: var(--cdx-amber); border-color: var(--cdx-amber); }
.cdx-check input:checked + .box::after, .cdx-radio input:checked + .box::after { transform: rotate(-45deg) translateY(-1px) scale(1); }
.cdx-radio input:checked + .box::after { transform: scale(1); }
.cdx-check input:focus-visible + .box, .cdx-radio input:focus-visible + .box { box-shadow: var(--cdx-focus); }
.cdx-check:hover .box, .cdx-radio:hover .box { border-color: rgba(255,255,255,0.30); }
.cdx-check.is-disabled, .cdx-radio.is-disabled { opacity: 0.4; pointer-events: none; }

/* TOGGLE / SWITCH — track + knob.
   Markup: <label class="cdx-switch"><input type="checkbox"><span class="track"></span> Label</label> */
.cdx-switch { display: inline-flex; align-items: center; gap: 11px; cursor: pointer;
  font-family: var(--cdx-font); font-size: 14px; color: var(--cdx-text-muted); user-select: none; }
.cdx-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.cdx-switch .track {
  flex: none; width: 40px; height: 23px; border-radius: 4px; position: relative;
  background: var(--cdx-surface-deep); border: 1.5px solid var(--cdx-line-strong);
  transition: background var(--cdx-dur) var(--cdx-ease), border-color var(--cdx-dur) var(--cdx-ease);
}
.cdx-switch .track::after {
  content: ""; position: absolute; top: 50%; left: 3px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--cdx-text-soft); transform: translateY(-50%);
  transition: transform var(--cdx-dur) var(--cdx-ease), background var(--cdx-dur) var(--cdx-ease);
}
.cdx-switch input:checked + .track { background: var(--cdx-amber); border-color: var(--cdx-amber); }
.cdx-switch input:checked + .track::after { transform: translate(17px, -50%); background: var(--cdx-on-amber); }
.cdx-switch input:focus-visible + .track { box-shadow: var(--cdx-focus); }
.cdx-switch.is-disabled { opacity: 0.4; pointer-events: none; }

/* RANGE / SLIDER — amber fill on a thin track, luminous knob.
   For a filled track, set --val (0-100) on the input's style. */
.cdx-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 999px;
  background: linear-gradient(to right, var(--cdx-amber) 0 calc(var(--val, 50) * 1%), var(--cdx-track) calc(var(--val, 50) * 1%) 100%);
  cursor: pointer; outline: none;
}
.cdx-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 17px; height: 17px; border-radius: 50%;
  background: var(--cdx-amber); border: 3px solid var(--cdx-surface);
  box-shadow: 0 0 8px var(--cdx-amber-glow); transition: transform var(--cdx-dur) var(--cdx-ease);
}
.cdx-range::-webkit-slider-thumb:hover { transform: scale(1.12); }
.cdx-range::-moz-range-thumb {
  width: 17px; height: 17px; border-radius: 50%; background: var(--cdx-amber);
  border: 3px solid var(--cdx-surface); box-shadow: 0 0 8px var(--cdx-amber-glow);
}
.cdx-range:focus-visible { box-shadow: var(--cdx-focus); }

/* SEGMENTED CONTROL — formalised from the glyph-page toggle.
   Markup: <div class="cdx-seg"><button aria-pressed="true">A</button>…</div> */
.cdx-seg { display: inline-flex; border: 1px solid var(--cdx-line-strong); border-radius: var(--cdx-radius-sm); overflow: hidden; }
.cdx-seg button {
  font-family: var(--cdx-font); font-weight: 500; font-size: 12.5px; letter-spacing: 0.01em;
  padding: 8px 16px; background: transparent; color: var(--cdx-text-muted); border: 0; cursor: pointer;
  border-left: 1px solid var(--cdx-line); white-space: nowrap;
  transition: background var(--cdx-dur) var(--cdx-ease), color var(--cdx-dur) var(--cdx-ease);
}
.cdx-seg button:first-child { border-left: 0; }
.cdx-seg button:hover { color: var(--cdx-text); }
.cdx-seg button[aria-pressed="true"] { background: var(--cdx-amber); color: var(--cdx-on-amber); }

/* INPUT WITH LEADING ICON / ADDON — wrap an .cdx-input row */
.cdx-input-group { position: relative; display: flex; align-items: center; }
.cdx-input-group .lead { position: absolute; left: 12px; display: grid; place-items: center; color: var(--cdx-text-faint); pointer-events: none; }
.cdx-input-group .lead svg { width: 16px; height: 16px; }
.cdx-input-group .lead ~ .cdx-input { padding-left: 38px; }

/* ============================================================
   FEEDBACK — alerts, toasts, tooltips, empty states, skeletons,
   progress. Tinted by intent: amber (info/notice), green (success),
   ember (error/critical). Tint fills stay low; the accent lives in a
   left-rule + the icon, never a full saturated panel.
   ============================================================ */

/* ALERT / BANNER — inline message with a left-rule + icon */
.cdx-alert {
  display: flex; gap: 13px; align-items: flex-start;
  background: var(--cdx-amber-soft); border: 1px solid var(--cdx-line);
  border-left: 3px solid var(--cdx-amber); border-radius: var(--cdx-radius-sm);
  padding: 14px 16px; font-family: var(--cdx-font);
}
.cdx-alert .ico { flex: none; color: var(--cdx-amber); margin-top: 1px; display: grid; place-items: center; }
.cdx-alert .ico svg { width: 18px; height: 18px; }
.cdx-alert .body { flex: 1; min-width: 0; }
.cdx-alert .t { font-weight: 500; font-size: 14px; color: var(--cdx-text); margin: 0; }
.cdx-alert .d { font-size: 13px; color: var(--cdx-text-muted); margin: 4px 0 0; line-height: 1.5; }
.cdx-alert .x { flex: none; background: none; border: 0; color: var(--cdx-text-faint); cursor: pointer; padding: 2px; line-height: 0; transition: color var(--cdx-dur) var(--cdx-ease); }
.cdx-alert .x:hover { color: var(--cdx-text); }
.cdx-alert--success { background: rgba(67,217,138,0.12); border-left-color: var(--cdx-pos); }
.cdx-alert--success .ico { color: var(--cdx-pos); }
.cdx-alert--error   { background: var(--cdx-ember-soft); border-left-color: var(--cdx-neg); }
.cdx-alert--error .ico { color: var(--cdx-neg); }
.cdx-alert--neutral { background: rgba(255,255,255,0.05); border-left-color: var(--cdx-text-soft); }
.cdx-alert--neutral .ico { color: var(--cdx-text-soft); }

/* TOAST — floating notification; stack in a .cdx-toast-stack */
.cdx-toast-stack { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 12px; z-index: 60; }
.cdx-toast {
  display: flex; gap: 12px; align-items: flex-start; min-width: 280px; max-width: 380px;
  background: var(--cdx-surface); border: 1px solid var(--cdx-line-strong);
  border-radius: var(--cdx-radius); padding: 14px 16px; box-shadow: var(--cdx-elev-2);
  font-family: var(--cdx-font);
}
.cdx-toast .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--cdx-amber); box-shadow: 0 0 8px var(--cdx-amber); }
.cdx-toast .t { font-weight: 500; font-size: 13.5px; color: var(--cdx-text); margin: 0; }
.cdx-toast .d { font-size: 12.5px; color: var(--cdx-text-muted); margin: 3px 0 0; }
.cdx-toast--success .dot { background: var(--cdx-pos); box-shadow: 0 0 8px var(--cdx-pos); }
.cdx-toast--error .dot   { background: var(--cdx-neg); box-shadow: 0 0 8px var(--cdx-neg); }

/* TOOLTIP — pure-CSS label on [data-cdx-tip]; appears on hover/focus */
.cdx-tip { position: relative; display: inline-flex; }
.cdx-tip[data-cdx-tip]::after {
  content: attr(data-cdx-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px);
  background: #04060f; color: var(--cdx-text); font-family: var(--cdx-font); font-size: 12px; font-weight: 500;
  white-space: nowrap; padding: 7px 10px; border-radius: var(--cdx-radius-sm); border: 1px solid var(--cdx-line-strong);
  box-shadow: var(--cdx-elev-2); opacity: 0; pointer-events: none;
  transition: opacity var(--cdx-dur) var(--cdx-ease), transform var(--cdx-dur) var(--cdx-ease); z-index: 50;
}
.cdx-tip[data-cdx-tip]::before {
  content: ""; position: absolute; bottom: calc(100% + 3px); left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--cdx-line-strong); opacity: 0;
  transition: opacity var(--cdx-dur) var(--cdx-ease); z-index: 50;
}
.cdx-tip:hover::after, .cdx-tip:focus-within::after { opacity: 1; transform: translateX(-50%) translateY(0); }
.cdx-tip:hover::before, .cdx-tip:focus-within::before { opacity: 1; }

/* EMPTY STATE — centred glyph slot + message + action */
.cdx-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 48px 24px; }
.cdx-empty .glyph { width: 96px; height: 96px; opacity: 0.5; }
.cdx-empty .t { font-family: var(--cdx-font); font-weight: 500; font-size: 17px; color: var(--cdx-text); margin: 0; }
.cdx-empty .d { font-family: var(--cdx-font); font-size: 13.5px; color: var(--cdx-text-muted); margin: 0; max-width: 340px; line-height: 1.55; }

/* SKELETON — shimmering placeholder while loading */
.cdx-skeleton { position: relative; overflow: hidden; background: rgba(255,255,255,0.05); border-radius: var(--cdx-radius-sm); }
.cdx-skeleton.line { height: 12px; }
.cdx-skeleton.line.sh { width: 60%; }
.cdx-skeleton.block { height: 120px; border-radius: var(--cdx-radius); }
.cdx-skeleton.circle { width: 44px; height: 44px; border-radius: 50%; }
.cdx-skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  transform: translateX(-100%); animation: cdx-shimmer 1.4s infinite;
}
@keyframes cdx-shimmer { 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .cdx-skeleton::after { animation: none; } }

/* PROGRESS — linear determinate / indeterminate bar */
.cdx-progress { height: 6px; width: 100%; background: var(--cdx-track); border-radius: 999px; overflow: hidden; }
.cdx-progress .bar { height: 100%; border-radius: 999px; background: var(--cdx-amber); box-shadow: 0 0 8px var(--cdx-amber-glow); transition: width var(--cdx-dur) var(--cdx-ease); }
.cdx-progress--indeterminate .bar { width: 40%; animation: cdx-indeterminate 1.3s var(--cdx-ease) infinite; }
@keyframes cdx-indeterminate { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
@media (prefers-reduced-motion: reduce) { .cdx-progress--indeterminate .bar { animation: none; width: 100%; } }

/* ============================================================
   OVERLAYS — modal/dialog, popover, drawer. Share one scrim.
   Toggle the .is-open class; entrance is a calm fade + small rise.
   ============================================================ */
.cdx-scrim {
  position: fixed; inset: 0; z-index: 70; background: rgba(4,6,15,0.66);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 24px;
  opacity: 0; pointer-events: none; transition: opacity var(--cdx-dur) var(--cdx-ease);
}
.cdx-scrim.is-open { opacity: 1; pointer-events: auto; }

/* MODAL / DIALOG */
.cdx-modal {
  width: 100%; max-width: 460px; background: var(--cdx-surface);
  border: 1px solid var(--cdx-line-strong); border-radius: var(--cdx-radius-lg);
  box-shadow: var(--cdx-elev-2); padding: 26px; font-family: var(--cdx-font);
  transform: translateY(8px) scale(0.99); transition: transform var(--cdx-dur) var(--cdx-ease);
}
.cdx-scrim.is-open .cdx-modal { transform: none; }
.cdx-modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.cdx-modal__title { font-weight: 500; font-size: 19px; letter-spacing: -0.01em; color: var(--cdx-text); margin: 0; }
.cdx-modal__body { font-size: 14px; color: var(--cdx-text-muted); line-height: 1.6; margin: 12px 0 0; }
.cdx-modal__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.cdx-modal .x { background: none; border: 0; color: var(--cdx-text-faint); cursor: pointer; padding: 2px; line-height: 0; transition: color var(--cdx-dur) var(--cdx-ease); }
.cdx-modal .x:hover { color: var(--cdx-text); }

/* POPOVER — small anchored panel (position via the wrapper) */
.cdx-popover-anchor { position: relative; display: inline-flex; }
.cdx-popover {
  position: absolute; top: calc(100% + 10px); left: 0; z-index: 55; min-width: 220px;
  background: var(--cdx-surface); border: 1px solid var(--cdx-line-strong);
  border-radius: var(--cdx-radius); box-shadow: var(--cdx-elev-2); padding: 8px;
  font-family: var(--cdx-font);
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity var(--cdx-dur) var(--cdx-ease), transform var(--cdx-dur) var(--cdx-ease);
}
.cdx-popover.right { left: auto; right: 0; }
.cdx-popover.is-open { opacity: 1; transform: none; pointer-events: auto; }
.cdx-popover__item {
  display: flex; align-items: center; gap: 10px; width: 100%; box-sizing: border-box;
  padding: 9px 11px; border-radius: var(--cdx-radius-sm); background: none; border: 0; cursor: pointer;
  font-family: var(--cdx-font); font-size: 13.5px; color: var(--cdx-text-muted); text-align: left;
  text-decoration: none; transition: background var(--cdx-dur) var(--cdx-ease), color var(--cdx-dur) var(--cdx-ease);
}
.cdx-popover__item svg { width: 16px; height: 16px; flex: none; }
.cdx-popover__item:hover { background: rgba(255,255,255,0.06); color: var(--cdx-text); }
.cdx-popover__item.danger { color: #e8a0a3; }
.cdx-popover__sep { height: 1px; background: var(--cdx-line); margin: 6px 4px; }

/* DRAWER — slides in from the right edge */
.cdx-drawer-scrim {
  position: fixed; inset: 0; z-index: 70; background: rgba(4,6,15,0.66);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity var(--cdx-dur) var(--cdx-ease);
}
.cdx-drawer-scrim.is-open { opacity: 1; pointer-events: auto; }
.cdx-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 71; width: 380px; max-width: 90vw;
  background: var(--cdx-surface); border-left: 1px solid var(--cdx-line-strong);
  box-shadow: -18px 0 50px rgba(0,0,0,0.55); padding: 24px; font-family: var(--cdx-font);
  transform: translateX(100%); transition: transform var(--cdx-dur) var(--cdx-ease);
  display: flex; flex-direction: column;
}
.cdx-drawer.is-open { transform: none; }
.cdx-drawer__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.cdx-drawer__title { font-weight: 500; font-size: 17px; color: var(--cdx-text); margin: 0; }
.cdx-drawer .x { background: none; border: 0; color: var(--cdx-text-faint); cursor: pointer; padding: 2px; line-height: 0; transition: color var(--cdx-dur) var(--cdx-ease); }
.cdx-drawer .x:hover { color: var(--cdx-text); }

/* ============================================================
   APP SHELL & SIDE-NAV — the product layout frame.
   A fixed side rail + top bar + scrolling content well. Compose:
   <div class="cdx-shell"><nav class="cdx-sidenav">…</nav>
     <div class="cdx-main"><header class="cdx-topbar">…</header>
       <div class="cdx-content">…</div></div></div>
   ============================================================ */
.cdx-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.cdx-sidenav {
  display: flex; flex-direction: column; gap: 4px; padding: 22px 16px;
  background: var(--cdx-surface-deep); border-right: 1px solid var(--cdx-line);
  position: sticky; top: 0; height: 100vh; box-sizing: border-box;
}
.cdx-sidenav__brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 22px; }
.cdx-sidenav__brand .cdx-mark { width: 26px; height: 26px; flex: none; }
.cdx-sidenav__section { font-family: var(--cdx-font); font-size: 10.5px; font-weight: 500; letter-spacing: var(--cdx-track-mid); text-transform: uppercase; color: var(--cdx-text-faint); padding: 16px 10px 8px; }
.cdx-navitem {
  display: flex; align-items: center; gap: 11px; padding: 10px 11px; border-radius: var(--cdx-radius-sm);
  font-family: var(--cdx-font); font-size: 13.5px; font-weight: 500; color: var(--cdx-text-muted);
  text-decoration: none; cursor: pointer; border: 0; background: none; width: 100%; box-sizing: border-box; text-align: left;
  transition: background var(--cdx-dur) var(--cdx-ease), color var(--cdx-dur) var(--cdx-ease);
}
.cdx-navitem svg { width: 17px; height: 17px; flex: none; opacity: 0.8; }
.cdx-navitem:hover { background: rgba(255,255,255,0.05); color: var(--cdx-text); }
.cdx-navitem.is-active { background: var(--cdx-amber-soft); color: var(--cdx-amber); }
.cdx-navitem.is-active svg { opacity: 1; }
.cdx-navitem .badge { margin-left: auto; font-size: 11px; font-weight: 500; background: rgba(255,255,255,0.08); color: var(--cdx-text-soft); padding: 2px 7px; border-radius: 3px; }
.cdx-sidenav__foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid var(--cdx-line); }

.cdx-main { display: flex; flex-direction: column; min-width: 0; }
.cdx-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 16px 28px; border-bottom: 1px solid var(--cdx-line);
  background: rgba(7,9,20,0.72); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.cdx-topbar__title { font-family: var(--cdx-font); font-weight: 500; font-size: 18px; letter-spacing: -0.01em; color: var(--cdx-text); margin: 0; }
.cdx-topbar__crumb { font-family: var(--cdx-font); font-size: 12px; color: var(--cdx-text-faint); margin: 0 0 2px; }
.cdx-topbar__actions { display: flex; align-items: center; gap: 12px; }
.cdx-content { padding: 28px; display: flex; flex-direction: column; gap: 22px; }

/* identity chip / avatar */
.cdx-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-family: var(--cdx-font); font-weight: 500; font-size: 13px; color: var(--cdx-on-amber);
  background: linear-gradient(150deg, var(--cdx-amber), var(--cdx-amber-deep)); cursor: pointer;
}

@media (max-width: 880px) {
  .cdx-shell { grid-template-columns: 1fr; }
  .cdx-sidenav { display: none; }
}
