/* ============================================================================
   Cereion Capital — Public Dashboard "Evergreen Control Room"
   Fonts: Pretendard (self-hosted, fonts/fonts.css) + Noto Serif KR (Google).
   Tokens: Design System "Evergreen" (--cds-*). Light default, dark override.
   Legacy component classes (app.js-generated) are aliased onto --cds-* below.
   ==========================================================================*/

/* ---------------------------------------------------------------------------
   1. TOKENS — Evergreen (--cds-*)
   ------------------------------------------------------------------------- */
:root {
  /* Brand scale (theme-invariant) */
  --cds-green-950: #06231b;
  --cds-green-900: #0b3b2c;
  --cds-green-800: #10513c;
  --cds-green-700: #1a6a4e;
  --cds-green-600: #247d5c;
  --cds-green-500: #2e9268;
  --cds-green-300: #7cc3a2;
  --cds-green-100: #d7eae0;
  --cds-cream-25: #fbf9f4;
  --cds-cream-50: #f7f3ea;
  --cds-cream-100: #f0e9da;
  --cds-cream-200: #e4dac4;
  --cds-gold-600: #a8862f;
  --cds-gold-500: #c3a24e;
  --cds-gold-300: #dec98f;

  /* Semantic (light defaults) */
  --cds-bg: var(--cds-cream-25);
  --cds-bg-2: var(--cds-cream-50);
  --cds-surface: #ffffff;
  --cds-raised: #ffffff;
  --cds-inverse: var(--cds-green-900);
  --cds-ink: #14231d;
  --cds-ink-muted: #5b6b62;
  --cds-ink-faint: #8b968e;
  --cds-line: #e3dece;
  --cds-line-soft: #efeadb;
  --cds-accent: var(--cds-green-700);
  --cds-accent-gold: var(--cds-gold-600);
  --cds-gain: #1f8a5d;
  --cds-loss: #c05b4d;
  --cds-warn: #a8862f;
  --cds-info: #2f6d84;
  --cds-plum: #7b5670;
  --cds-glass: rgb(255 255 255 / 74%);

  /* Shape & motion (theme-invariant) */
  --cds-r-lg: 20px;
  --cds-r-md: 14px;
  --cds-r-sm: 10px;
  --cds-r-pill: 999px;
  --cds-shadow: 0 18px 40px -18px rgb(6 35 27 / 25%);
  --cds-shadow-soft: 0 8px 24px -14px rgb(6 35 27 / 18%);
  --cds-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --cds-dur-fast: 150ms;
  --cds-dur: 300ms;
  --cds-dur-slow: 600ms;
  --cds-dur-draw: 1100ms;

  /* Typography (theme-invariant) */
  --cds-font-sans: "Pretendard Variable", Pretendard, -apple-system,
    "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --cds-font-display: "Noto Serif KR", "Nanum Myeongjo", Georgia, serif;

  /* Legacy aliases -> cds (used by app.js-generated components) */
  --bg: var(--cds-bg);
  --bg-2: var(--cds-bg-2);
  --surface: var(--cds-surface);
  --surface-raised: var(--cds-raised);
  --surface-warm: color-mix(in srgb, var(--cds-gold-500) 9%, var(--cds-surface));
  --glass: var(--cds-glass);
  --ink: var(--cds-ink);
  --ink-muted: var(--cds-ink-muted);
  --ink-faint: var(--cds-ink-faint);
  --line: var(--cds-line);
  --line-soft: var(--cds-line-soft);
  --amber: var(--cds-accent-gold);
  --cyan: var(--cds-accent);
  --green: var(--cds-gain);
  --red: var(--cds-loss);
  --plum: var(--cds-plum);
  --radius: var(--cds-r-md);
  --radius-sm: var(--cds-r-sm);
  --shadow: var(--cds-shadow);
  --shadow-soft: var(--cds-shadow-soft);

  /* Layout */
  --nav-h: 64px;

  color-scheme: light;
  font-family: var(--cds-font-sans);
}

/* Dark tokens — applied both to system-dark (no explicit theme) and explicit dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --cds-bg: #0a1410;
    --cds-bg-2: #0e1a14;
    --cds-surface: #12241c;
    --cds-raised: #183024;
    --cds-ink: #f2efe6;
    --cds-ink-muted: #a8b5ac;
    --cds-ink-faint: #74807a;
    --cds-line: #24382e;
    --cds-line-soft: #1c2e24;
    --cds-accent: var(--cds-green-300);
    --cds-accent-gold: var(--cds-gold-500);
    --cds-gain: #58c393;
    --cds-loss: #e39387;
    --cds-warn: #dec98f;
    --cds-info: #7fb4c9;
    --cds-plum: #b795c0;
    --cds-glass: rgb(18 36 28 / 66%);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --cds-bg: #0a1410;
  --cds-bg-2: #0e1a14;
  --cds-surface: #12241c;
  --cds-raised: #183024;
  --cds-ink: #f2efe6;
  --cds-ink-muted: #a8b5ac;
  --cds-ink-faint: #74807a;
  --cds-line: #24382e;
  --cds-line-soft: #1c2e24;
  --cds-accent: var(--cds-green-300);
  --cds-accent-gold: var(--cds-gold-500);
  --cds-gain: #58c393;
  --cds-loss: #e39387;
  --cds-warn: #dec98f;
  --cds-info: #7fb4c9;
  --cds-plum: #b795c0;
  --cds-glass: rgb(18 36 28 / 66%);
  color-scheme: dark;
}

:root[data-theme="light"] {
  color-scheme: light;
}

/* ---------------------------------------------------------------------------
   2. BASE / RESET
   ------------------------------------------------------------------------- */
* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--cds-bg);
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--cds-bg);
  color: var(--cds-ink);
  font-family: var(--cds-font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizelegibility;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
img { max-width: 100%; }

[data-cds-numeric],
.tabular { font-variant-numeric: tabular-nums; }

h1, h2, h3, h4, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; line-height: 1.16; }

.shell {
  width: min(1200px, calc(100% - 48px));
  margin-inline: auto;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cds-accent-gold);
  font-family: var(--cds-font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h2 {
  font-family: var(--cds-font-display);
  font-size: clamp(1.5rem, 3.2vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  transform: translateY(-160%);
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--cds-ink);
  color: var(--cds-bg);
  transition: transform var(--cds-dur) var(--cds-ease);
}
.skip-link:focus { transform: none; }

button:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
a:focus-visible {
  outline: 2px solid var(--cds-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------------------------------------------------------------------------
   3. TOPBAR / NAV
   ------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--cds-line-soft);
  background: var(--cds-glass);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
}

.topbar-inner {
  min-height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.wordmark {
  display: flex;
  min-width: 0;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.wordmark-name {
  font-family: var(--cds-font-display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.wordmark-sub {
  overflow: hidden;
  color: var(--cds-ink-faint);
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-menu {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.nav-link {
  position: relative;
  padding: 8px 12px;
  color: var(--cds-ink-muted);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--cds-dur) var(--cds-ease);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 2px;
  background: var(--cds-accent-gold);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--cds-dur) var(--cds-ease);
}

.nav-link:hover { color: var(--cds-ink); }
.nav-link:hover::after,
.nav-link.active::after { transform: scaleX(1); }
.nav-link.active { color: var(--cds-ink); }

.topbar-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.sync-state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-pill);
  background: var(--cds-surface);
  color: var(--cds-ink-muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--cds-ink-faint);
  transition: background var(--cds-dur) var(--cds-ease), box-shadow var(--cds-dur) var(--cds-ease);
}

.sync-state.connected .status-dot {
  background: var(--cds-gain);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--cds-gain) 20%, transparent);
}
.sync-state.updating .status-dot {
  background: var(--cds-warn);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--cds-warn) 20%, transparent);
}
.sync-state.error .status-dot {
  background: var(--cds-loss);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--cds-loss) 20%, transparent);
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-sm);
  background: var(--cds-surface);
  cursor: pointer;
  transition: border-color var(--cds-dur) var(--cds-ease), transform var(--cds-dur) var(--cds-ease);
}
.icon-button:hover {
  border-color: var(--cds-accent);
  transform: translateY(-1px);
}

/* Sync banner (role=alert) */
.sync-banner {
  margin: 14px auto 0;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--cds-loss) 45%, var(--cds-line));
  border-radius: var(--cds-r-sm);
  background: color-mix(in srgb, var(--cds-loss) 10%, var(--cds-surface));
  color: var(--cds-ink);
  font-size: 0.82rem;
}

/* ---------------------------------------------------------------------------
   4. HERO (deep green — both themes)
   ------------------------------------------------------------------------- */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 85vh;
  padding-block: clamp(64px, 12vh, 120px);
  overflow: hidden;
  background: linear-gradient(155deg, var(--cds-green-900) 0%, var(--cds-green-950) 100%);
  color: #f4f1e8;
  scroll-margin-top: var(--nav-h);
}

.hero-mesh {
  position: absolute;
  inset: -6% -6% -6% -6%;
  z-index: 0;
  pointer-events: none;
  will-change: transform;
}
.hero-mesh svg { width: 100%; height: 100%; display: block; }

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-eyebrow { color: var(--cds-gold-300); }

.hero-title {
  margin: 0 0 20px;
  font-family: var(--cds-font-display);
  font-weight: 700;
  font-size: clamp(40px, 6.4vw, 76px);
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: #f7f4ec;
}

.hero-line {
  display: block;
  overflow: hidden;
}
.hero-line-inner {
  display: block;
  transform: translateY(0);
}

.hero-lede {
  max-width: 46ch;
  margin: 0 0 30px;
  color: rgb(244 241 232 / 82%);
  font-size: clamp(0.95rem, 1.6vw, 1.12rem);
  line-height: 1.6;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid rgb(244 241 232 / 20%);
  border-radius: var(--cds-r-pill);
  background: rgb(255 255 255 / 6%);
  backdrop-filter: blur(8px);
}
.chip-label {
  display: block;
  color: rgb(244 241 232 / 62%);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.chip > strong {
  color: #f7f4ec;
  font-size: 0.92rem;
  font-weight: 700;
}
.chip .badge { color: #f7f4ec; }

.hero-asof {
  margin: 0;
  color: rgb(244 241 232 / 60%);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.scroll-indicator {
  position: absolute;
  left: 50%;
  bottom: 26px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  color: rgb(244 241 232 / 58%);
  text-decoration: none;
}
.scroll-indicator-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.24em;
}
.scroll-indicator-arrow {
  width: 10px;
  height: 10px;
  border-right: 1.5px solid currentcolor;
  border-bottom: 1.5px solid currentcolor;
  transform: rotate(45deg);
}

/* ---------------------------------------------------------------------------
   5. TICKER (marquee)
   ------------------------------------------------------------------------- */
.ticker {
  border-block: 1px solid color-mix(in srgb, var(--cds-accent-gold) 40%, var(--cds-line));
  background: var(--cds-bg-2);
  overflow: hidden;
}
.ticker-viewport { overflow: hidden; }
.ticker-track {
  display: flex;
  width: max-content;
}
.ticker-group {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 28px;
  color: var(--cds-ink-muted);
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ticker-item::after {
  content: "";
  width: 4px;
  height: 4px;
  margin-left: 20px;
  border-radius: 50%;
  background: var(--cds-accent-gold);
  opacity: 0.5;
}
.ticker-item.up { color: var(--cds-gain); }
.ticker-item.down { color: var(--cds-loss); }

/* ---------------------------------------------------------------------------
   6. SECTION SCAFFOLDING
   ------------------------------------------------------------------------- */
.section {
  padding-block: clamp(64px, 9vw, 120px);
  scroll-margin-top: var(--nav-h);
}
.metrics { background: var(--cds-bg); }
.positions-section { background: var(--cds-bg-2); }
.team-section { background: var(--cds-bg); }
.conversation-section { background: var(--cds-bg-2); }
.operations-section { background: var(--cds-bg); }
.token-section { background: var(--cds-bg-2); }

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}
.section-note {
  margin: 0;
  max-width: 340px;
  color: var(--cds-ink-faint);
  font-size: 0.8rem;
  text-align: right;
}
.as-of {
  margin: 0;
  color: var(--cds-ink-faint);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.empty-copy {
  margin: 0;
  color: var(--cds-ink-faint);
  font-size: 0.86rem;
}

/* ---------------------------------------------------------------------------
   7. PERFORMANCE / METRICS
   ------------------------------------------------------------------------- */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.metric {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 138px;
  padding: 22px 24px;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-md);
  background: var(--cds-surface);
  transition: border-color var(--cds-dur) var(--cds-ease), transform var(--cds-dur) var(--cds-ease), box-shadow var(--cds-dur) var(--cds-ease);
}
.metric:hover {
  border-color: color-mix(in srgb, var(--cds-accent) 45%, var(--cds-line));
  transform: translateY(-4px);
  box-shadow: var(--cds-shadow-soft);
}
.metric.emphasis {
  border-top: 2px solid var(--cds-accent-gold);
  background: linear-gradient(160deg, var(--surface-warm), var(--cds-surface));
}
.metric-label {
  display: block;
  color: var(--cds-ink-faint);
  font-size: 0.74rem;
  font-weight: 600;
}
.metric-value {
  margin: 10px 0 6px;
  min-height: 1.1em;
  font-family: var(--cds-font-display);
  font-size: clamp(1.9rem, 3vw, 2.7rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}
.metric-meta {
  margin-top: 4px;
  color: var(--cds-ink-muted);
  font-size: 0.78rem;
}
.label {
  display: block;
  color: var(--cds-ink-faint);
  font-size: 0.74rem;
  font-weight: 600;
}
.positive { color: var(--cds-gain) !important; }
.negative { color: var(--cds-loss) !important; }

.progress {
  width: 100%;
  height: 6px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--cds-line-soft);
}
.progress > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--cds-gain), var(--cds-accent));
  transition: width 480ms var(--cds-ease);
}
.progress > span[data-level="1"] { width: 10%; }
.progress > span[data-level="2"] { width: 20%; }
.progress > span[data-level="3"] { width: 30%; }
.progress > span[data-level="4"] { width: 40%; }
.progress > span[data-level="5"] { width: 50%; }
.progress > span[data-level="6"] { width: 60%; }
.progress > span[data-level="7"] { width: 70%; }
.progress > span[data-level="8"] { width: 80%; }
.progress > span[data-level="9"] { width: 90%; }
.progress > span[data-level="10"] { width: 100%; }

.metric-chart {
  margin-top: 16px;
  min-height: 0;
  justify-content: flex-start;
  padding: 26px;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.panel-heading h2 { font-size: 1.4rem; }
.panel-heading strong,
.panel-heading time {
  color: var(--cds-ink-muted);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.chart-wrap {
  position: relative;
  min-height: 230px;
  margin-top: 18px;
}
.chart-wrap svg { display: block; width: 100%; height: 230px; }
.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--cds-ink-faint);
  font-size: 0.86rem;
}
.chart-grid { stroke: var(--cds-line-soft); stroke-width: 1; }
.chart-baseline { stroke: var(--cds-ink-faint); stroke-dasharray: 4 6; stroke-width: 1; }
.chart-line {
  fill: none;
  stroke: var(--cds-accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}
.chart-area { fill: color-mix(in srgb, var(--cds-accent) 14%, transparent); }
.chart-point { fill: var(--cds-accent); stroke: var(--cds-surface); stroke-width: 2; }
.chart-label { fill: var(--cds-ink-faint); font-size: 11px; }

/* ---------------------------------------------------------------------------
   8. POSITIONS & TRADES
   ------------------------------------------------------------------------- */
.today-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-bottom: 20px;
  padding: 18px 22px;
  border: 1px solid color-mix(in srgb, var(--cds-accent) 30%, var(--cds-line));
  border-radius: var(--cds-r-md);
  background: linear-gradient(120deg, color-mix(in srgb, var(--cds-accent) 12%, var(--cds-surface)), var(--cds-surface));
}
.today-summary-tag {
  flex: 0 0 auto;
  padding: 4px 12px;
  border-radius: var(--cds-r-pill);
  background: color-mix(in srgb, var(--cds-accent) 20%, transparent);
  color: var(--cds-accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.today-summary-text {
  flex: 1 1 300px;
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.5;
}
.today-summary-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.today-summary-stats:empty { display: none; }
.summary-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 11px;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-pill);
  background: var(--cds-surface);
  color: var(--cds-ink-muted);
  font-size: 0.72rem;
}
.summary-stat strong { color: var(--cds-ink); font-size: 0.86rem; font-variant-numeric: tabular-nums; }

.term-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.term-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border: 1px solid var(--cds-line-soft);
  border-radius: var(--cds-r-pill);
  background: var(--cds-surface);
  color: var(--cds-ink-muted);
  font-size: 0.72rem;
}

.positions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.position-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-md);
  background: var(--cds-surface);
  transition: border-color var(--cds-dur) var(--cds-ease), transform var(--cds-dur) var(--cds-ease), box-shadow var(--cds-dur) var(--cds-ease);
}
.position-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--cds-accent) 40%, var(--cds-line));
  box-shadow: var(--cds-shadow-soft);
}
.position-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.position-symbol { font-size: 1.14rem; font-weight: 720; font-variant-numeric: tabular-nums; }
.dir-badge {
  padding: 2px 10px;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-pill);
  font-size: 0.72rem;
  font-weight: 700;
}
.dir-badge.spot {
  border-color: color-mix(in srgb, var(--cds-info) 45%, var(--cds-line));
  background: color-mix(in srgb, var(--cds-info) 12%, transparent);
  color: var(--cds-info);
}
.dir-badge.long {
  border-color: color-mix(in srgb, var(--cds-gain) 45%, var(--cds-line));
  background: color-mix(in srgb, var(--cds-gain) 12%, transparent);
  color: var(--cds-gain);
}
.dir-badge.short {
  border-color: color-mix(in srgb, var(--cds-loss) 45%, var(--cds-line));
  background: color-mix(in srgb, var(--cds-loss) 12%, transparent);
  color: var(--cds-loss);
}
.position-price {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.02rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.price-from { color: var(--cds-ink-muted); }
.price-arrow { color: var(--cds-ink-faint); }
.price-to { color: var(--cds-ink); }
.pnl-badge {
  display: inline-flex;
  align-self: flex-start;
  align-items: baseline;
  gap: 4px;
  padding: 5px 12px;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-pill);
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pnl-badge.gain {
  border-color: color-mix(in srgb, var(--cds-gain) 45%, var(--cds-line));
  background: color-mix(in srgb, var(--cds-gain) 10%, transparent);
  color: var(--cds-gain);
}
.pnl-badge.loss {
  border-color: color-mix(in srgb, var(--cds-loss) 45%, var(--cds-line));
  background: color-mix(in srgb, var(--cds-loss) 10%, transparent);
  color: var(--cds-loss);
}
.pnl-badge.flat { color: var(--cds-ink-muted); }
.pnl-badge.sm { padding: 3px 9px; font-size: 0.78rem; }

.position-meta { display: grid; gap: 6px; margin-top: 2px; }
.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 0.78rem; }
.meta-label { display: inline-flex; align-items: center; color: var(--cds-ink-faint); }
.meta-val { color: var(--cds-ink); font-variant-numeric: tabular-nums; text-align: right; }
.lev-badge {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid color-mix(in srgb, var(--cds-warn) 45%, var(--cds-line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--cds-warn) 16%, transparent);
  color: var(--cds-warn);
  font-size: 0.74rem;
  font-weight: 700;
}
.stale-badge {
  padding: 3px 10px;
  border: 1px solid color-mix(in srgb, var(--cds-warn) 55%, var(--cds-line));
  border-radius: var(--cds-r-pill);
  color: var(--cds-warn);
  font-size: 0.72rem;
  font-weight: 650;
}
.stale-badge.sm { padding: 2px 9px; font-size: 0.66rem; }

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 40px 18px;
  border: 1px dashed var(--cds-line);
  border-radius: var(--cds-r-md);
  background: var(--cds-surface);
  color: var(--cds-ink-muted);
  text-align: center;
}
.empty-state strong { color: var(--cds-ink); font-size: 1rem; }
.empty-state span { color: var(--cds-ink-faint); font-size: 0.82rem; }
.positions-empty { color: var(--cds-ink-faint); }

.trades-title { margin-bottom: 14px; font-size: 1.2rem; font-family: var(--cds-font-display); font-weight: 600; }
.trades-list {
  margin: 0;
  padding: 0;
  max-height: 460px;
  overflow-y: auto;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-md);
  background: var(--cds-surface);
  list-style: none;
}
.trade-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--cds-line-soft);
}
.trade-item:last-child { border-bottom: 0; }
.trade-item[data-dir="warn"] { background: color-mix(in srgb, var(--cds-loss) 6%, transparent); }
.trade-icon {
  flex: 0 0 26px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 8px;
  background: var(--cds-raised);
  border: 1px solid var(--cds-line-soft);
  color: var(--cds-ink-muted);
  font-size: 0.8rem;
  font-weight: 700;
}
.trade-item[data-dir="up"] .trade-icon {
  background: color-mix(in srgb, var(--cds-gain) 12%, var(--cds-raised));
  color: var(--cds-gain);
}
.trade-item[data-dir="down"] .trade-icon {
  background: color-mix(in srgb, var(--cds-loss) 12%, var(--cds-raised));
  color: var(--cds-loss);
}
.trade-item[data-dir="warn"] .trade-icon {
  border: 1px solid var(--cds-loss);
  background: color-mix(in srgb, var(--cds-loss) 20%, var(--cds-raised));
  color: var(--cds-loss);
}
.trade-body { flex: 1 1 auto; min-width: 0; }
.trade-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.trade-action { font-size: 0.84rem; font-weight: 700; }
.trade-action.dir-up { color: var(--cds-gain); }
.trade-action.dir-down,
.trade-action.dir-warn { color: var(--cds-loss); }
.trade-action.dir-neutral { color: var(--cds-ink-muted); }
.trade-symbol { font-size: 0.82rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.trade-market {
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--cds-raised);
  color: var(--cds-ink-faint);
  font-size: 0.66rem;
  font-weight: 650;
}
.trade-detail { margin-top: 3px; }
.trade-qtyprice { color: var(--cds-ink-muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.trade-right { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.trade-time-wrap { display: flex; flex-direction: column; align-items: flex-end; }
.trade-time { color: var(--cds-ink-faint); font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.trade-abs { color: var(--cds-ink-faint); font-size: 0.64rem; opacity: 0.8; }

/* ---------------------------------------------------------------------------
   9. WORK PROGRAM
   ------------------------------------------------------------------------- */
.program-window {
  margin: 0;
  color: var(--cds-ink-faint);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.program-phase-line {
  display: grid;
  grid-template-columns: minmax(190px, .65fr) minmax(0, 1.35fr);
  gap: 18px;
  align-items: baseline;
  margin-bottom: 20px;
  padding: 14px 0;
  border-block: 1px solid var(--cds-line-soft);
}
.program-phase-line strong { font-size: 0.96rem; }
.program-phase-line span { color: var(--cds-ink-muted); font-size: 0.84rem; }

.program-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.program-card {
  --accent: var(--cds-accent);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-md);
  background: var(--cds-surface);
  transition: border-color var(--cds-dur) var(--cds-ease), transform var(--cds-dur) var(--cds-ease), box-shadow var(--cds-dur) var(--cds-ease);
}
.program-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--cds-line));
  box-shadow: 0 14px 32px color-mix(in srgb, var(--accent) 16%, transparent);
}
.program-card-head { display: flex; align-items: center; gap: 10px; }
.program-avatar {
  flex: 0 0 38px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--cds-line));
  border-radius: 11px;
  background: color-mix(in srgb, var(--accent) 16%, var(--cds-surface));
  color: var(--accent);
  font-size: 1.1rem;
}
.program-card-id { min-width: 0; }
.program-card-id strong { display: block; font-size: 0.9rem; }
.program-card-id span { display: block; margin-top: 2px; color: var(--cds-ink-faint); font-size: 0.7rem; }
.program-card-task { margin: 0; }
.program-card-tasklabel {
  display: block;
  margin-bottom: 4px;
  color: var(--cds-ink-faint);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.program-card-tasktext { margin: 0; font-size: 0.82rem; line-height: 1.5; }
.program-card-status {
  align-self: flex-start;
  padding: 3px 10px;
  border: 1px solid color-mix(in srgb, var(--cds-accent) 40%, var(--cds-line));
  border-radius: var(--cds-r-pill);
  background: color-mix(in srgb, var(--cds-accent) 10%, transparent);
  color: var(--cds-accent);
  font-size: 0.68rem;
  font-weight: 650;
}
.program-card-status[data-status*="blocked"],
.program-card-status[data-status*="waiting"] {
  border-color: color-mix(in srgb, var(--cds-warn) 45%, var(--cds-line));
  background: color-mix(in srgb, var(--cds-warn) 10%, transparent);
  color: var(--cds-warn);
}

.program-details {
  margin-bottom: 8px;
  border: 1px solid var(--cds-line-soft);
  border-radius: var(--cds-r-sm);
  background: var(--cds-surface);
}
.program-details > summary {
  padding: 12px 16px;
  color: var(--cds-ink-muted);
  font-size: 0.82rem;
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}
.program-details > summary::-webkit-details-marker { display: none; }
.program-details > summary::before { content: "▸ "; color: var(--cds-ink-faint); }
.program-details[open] > summary::before { content: "▾ "; }
.program-details .details-close { display: none; }
.program-details[open] .details-open { display: none; }
.program-details[open] .details-close { display: inline; }
.program-details .program-table { padding: 0 16px 14px; border-bottom: 0; }

.program-table { border-bottom: 1px solid var(--cds-line-soft); }
.program-row {
  display: grid;
  grid-template-columns: minmax(130px, .55fr) repeat(3, minmax(0, 1fr));
  min-width: 0;
  border-top: 1px solid var(--cds-line-soft);
}
.program-row > div {
  min-width: 0;
  padding: 14px 13px;
  border-left: 1px solid var(--cds-line-soft);
  overflow-wrap: anywhere;
}
.program-row > div:first-child { padding-left: 0; border-left: 0; }
.program-header { color: var(--cds-ink-faint); font-size: 0.7rem; font-weight: 700; }
.program-person strong,
.program-person span { display: block; }
.program-person strong { font-size: 0.88rem; }
.program-person span { margin-top: 3px; color: var(--cds-ink-faint); font-size: 0.7rem; }
.program-task,
.program-next p { margin: 0; font-size: 0.79rem; line-height: 1.5; }
.program-next p + p { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--cds-line-soft); }
.program-status {
  display: block;
  margin-top: 8px;
  padding-left: 8px;
  border-left: 2px solid var(--cds-accent);
  color: var(--cds-ink-muted);
  font-size: 0.68rem;
  font-weight: 650;
}
.program-status[data-status*="blocked"],
.program-status[data-status*="waiting"] { border-left-color: var(--cds-warn); }

.strategy-board { margin-top: 30px; }
.strategy-board-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.strategy-board-heading h3 { font-size: 1rem; }
.strategy-board-heading span { color: var(--cds-ink-faint); font-size: 0.72rem; }
.strategy-row {
  display: grid;
  grid-template-columns: minmax(190px, .8fr) minmax(180px, 1fr) minmax(150px, .65fr);
  gap: 14px;
  align-items: center;
  padding: 11px 0;
  border-top: 1px solid var(--cds-line-soft);
}
.strategy-identity strong,
.strategy-identity span { display: block; }
.strategy-identity strong { font-size: 0.82rem; }
.strategy-identity span,
.strategy-evidence { color: var(--cds-ink-faint); font-size: 0.7rem; }
.strategy-stage {
  color: var(--cds-warn);
  font-size: 0.68rem;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: right;
}
.strategy-stage[data-status="eligible_for_canary_review"] { color: var(--cds-gain); }

/* ---------------------------------------------------------------------------
   10. TEAM + AVATAR
   ------------------------------------------------------------------------- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}
.team-card {
  --accent: var(--cds-accent);
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px 20px 20px;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-lg);
  background: var(--cds-surface);
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--cds-dur) var(--cds-ease), transform var(--cds-dur) var(--cds-ease), box-shadow var(--cds-dur) var(--cds-ease);
}
.team-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.85;
}
.team-card:hover,
.team-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--cds-line));
  transform: translateY(-5px);
  box-shadow: 0 20px 44px color-mix(in srgb, var(--accent) 18%, transparent);
}
.avatar-wrap { width: 96px; margin: 4px auto 8px; }
.card-head { text-align: center; }
.card-name { font-family: var(--cds-font-display); font-size: 1.22rem; font-weight: 700; }
.card-title { margin: 3px 0 0; color: var(--cds-ink-muted); font-size: 0.75rem; }
.card-persona {
  margin: 14px 0 0;
  color: var(--cds-ink-muted);
  font-size: 0.78rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-summary {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--cds-line-soft);
  font-size: 0.8rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 16px; }
.stat { min-width: 0; padding: 8px 6px; border-radius: var(--cds-r-sm); background: var(--cds-raised); border: 1px solid var(--cds-line-soft); text-align: center; }
.stat-value { display: block; font-size: 0.98rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { display: block; margin-top: 2px; color: var(--cds-ink-faint); font-size: 0.64rem; }
.expr-badge {
  --accent: var(--cds-accent);
  align-self: center;
  display: inline-flex;
  align-items: center;
  margin-top: 16px;
  padding: 3px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--cds-line));
  border-radius: var(--cds-r-pill);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 650;
}
.expr-badge[data-expr="cautious"] { --accent: var(--cds-warn); }
.expr-badge[data-expr="alert"] { --accent: var(--cds-loss); }
.expr-badge[data-expr="reflective"] { --accent: var(--cds-plum); }

.avatar {
  --intensity: .25;
  --accent: var(--cds-accent);
  --glow-color: var(--accent);
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.avatar .glow { fill: var(--glow-color); opacity: calc(.16 + var(--intensity) * .5); transition: opacity .5s ease, fill .5s ease; }
.avatar .motif * { stroke: var(--accent); fill: none; }
.avatar.expr-cautious { --glow-color: var(--cds-warn); }
.avatar.expr-alert { --glow-color: var(--cds-loss); }
.avatar.expr-reflective { --glow-color: var(--cds-plum); }
.avatar .eyes-open,
.avatar .eyes-soft,
.avatar .brow,
.avatar .m-open,
.avatar .alert-ring { display: none; }
.avatar .alert-ring { fill: none; stroke: var(--glow-color); }
.avatar .eyes-line { display: block; }
.avatar.expr-focused .eyes-line,
.avatar.expr-alert .eyes-line,
.avatar.expr-reflective .eyes-line { display: none; }
.avatar.expr-focused .eyes-open,
.avatar.expr-alert .eyes-open { display: block; }
.avatar.expr-reflective .eyes-soft { display: block; }
.avatar.expr-cautious .brow,
.avatar.expr-alert .brow { display: block; }
.avatar.expr-debating .m-open,
.avatar.expr-alert .m-open { display: block; }
.avatar.expr-alert .alert-ring { display: block; opacity: calc(.35 + var(--intensity) * .5); }

/* ---------------------------------------------------------------------------
   11. OFFICE / CONVERSATION
   ------------------------------------------------------------------------- */
.conversation-panel {
  padding: 26px;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-lg);
  background: var(--cds-surface);
  box-shadow: var(--cds-shadow-soft);
}
.conversation-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.conv-tab {
  max-width: 240px;
  padding: 6px 13px;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-pill);
  background: var(--cds-raised);
  color: var(--cds-ink-muted);
  font-size: 0.76rem;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-tab.active {
  border-color: var(--cds-accent);
  background: color-mix(in srgb, var(--cds-accent) 14%, var(--cds-surface));
  color: var(--cds-ink);
}
.conversation-topic { margin: 0 0 4px; font-size: 0.98rem; font-weight: 650; }
.conversation-topic:empty { display: none; }
.simulation-note {
  margin: 12px 0 16px;
  padding-left: 12px;
  border-left: 2px solid var(--cds-plum);
  color: var(--cds-ink-faint);
  font-size: 0.74rem;
}
.conversation-lines { display: grid; gap: 12px; }
.conv-line { display: flex; gap: 12px; align-items: flex-start; }
.conv-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 11px;
  border: 1px solid color-mix(in srgb, var(--accent, var(--cds-accent)) 45%, var(--cds-line));
  background: color-mix(in srgb, var(--accent, var(--cds-accent)) 20%, var(--cds-surface));
  color: var(--accent, var(--cds-accent));
  font-size: 1.05rem;
  font-weight: 700;
}
.conv-body { min-width: 0; flex: 1 1 auto; }
.conv-name { display: block; margin-bottom: 3px; color: var(--cds-ink-muted); font-size: 0.72rem; font-weight: 700; }
.conv-bubble {
  margin: 0;
  padding: 11px 14px;
  border: 1px solid var(--cds-line-soft);
  border-radius: 3px 14px 14px 14px;
  background: var(--cds-raised);
  font-size: 0.87rem;
  line-height: 1.55;
}

/* ---------------------------------------------------------------------------
   12. REPORTS
   ------------------------------------------------------------------------- */
.report-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.report-tab {
  padding: 7px 15px;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-pill);
  background: var(--cds-surface);
  color: var(--cds-ink-muted);
  font-size: 0.78rem;
  cursor: pointer;
}
.report-tab.active {
  border-color: var(--cds-accent-gold);
  background: color-mix(in srgb, var(--cds-accent-gold) 14%, var(--cds-surface));
  color: var(--cds-ink);
}
.report-list { display: grid; gap: 10px; }
.report-card {
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-md);
  background: var(--cds-surface);
  overflow: hidden;
  transition: border-color var(--cds-dur) var(--cds-ease), transform var(--cds-dur) var(--cds-ease), box-shadow var(--cds-dur) var(--cds-ease);
}
.report-card:hover { transform: translateY(-2px); box-shadow: var(--cds-shadow-soft); }
.report-card.open { border-color: color-mix(in srgb, var(--cds-accent-gold) 40%, var(--cds-line)); }
.report-toggle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.report-meta { min-width: 0; }
.report-date { display: block; margin-bottom: 4px; color: var(--cds-ink-faint); font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.report-title { font-size: 1rem; font-weight: 680; }
.report-excerpt { margin: 6px 0 0; color: var(--cds-ink-muted); font-size: 0.82rem; }
.report-summary { display: grid; gap: 4px; margin-top: 8px; }
.report-summary-line {
  position: relative;
  padding-left: 15px;
  color: var(--cds-ink-muted);
  font-size: 0.8rem;
  line-height: 1.45;
}
.report-summary-line::before {
  content: "";
  position: absolute;
  top: 0.6em;
  left: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cds-accent-gold);
}
.report-chevron { flex: 0 0 auto; color: var(--cds-ink-faint); transition: transform var(--cds-dur) var(--cds-ease); }
.report-card.open .report-chevron { transform: rotate(90deg); color: var(--cds-accent-gold); }
.report-body { padding: 0 18px 18px; font-size: 0.87rem; line-height: 1.62; }
.report-body h3,
.report-body h4,
.report-body h5 { margin: 16px 0 6px; font-size: 0.98rem; }
.report-body p { margin: 10px 0; }
.report-body ul,
.report-body ol { margin: 10px 0; padding-left: 22px; }
.report-body li { margin: 4px 0; }
.report-body code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--cds-raised);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.85em;
}
.report-body pre { overflow-x: auto; padding: 12px 14px; border-radius: var(--cds-r-sm); background: var(--cds-raised); }
.report-body pre code { padding: 0; background: none; }
.md-table-wrap { overflow-x: auto; margin: 12px 0; }
.md-table-wrap table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
.md-table-wrap th,
.md-table-wrap td { padding: 7px 11px; border: 1px solid var(--cds-line); text-align: left; }
.md-table-wrap th { background: var(--cds-raised); font-weight: 700; }

/* ---------------------------------------------------------------------------
   13. OPERATIONS
   ------------------------------------------------------------------------- */
.operations-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.ops-card {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-md);
  background: var(--cds-surface);
}
.ops-card .label { margin-bottom: 12px; }
.scan-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.scan-status,
.job-status {
  padding: 3px 10px;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-pill);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
}
.scan-status[data-status="ok"],
.scan-status[data-status="ready"],
.job-status[data-status="ok"],
.job-status[data-status="done"],
.job-status[data-status="success"],
.job-status[data-status="completed"] {
  border-color: color-mix(in srgb, var(--cds-gain) 50%, var(--cds-line));
  color: var(--cds-gain);
}
.scan-status[data-status="error"],
.scan-status[data-status="failed"],
.job-status[data-status="error"],
.job-status[data-status="failed"] {
  border-color: color-mix(in srgb, var(--cds-loss) 50%, var(--cds-line));
  color: var(--cds-loss);
}
.scan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.scan-cell { padding: 8px; border-radius: var(--cds-r-sm); background: var(--cds-raised); text-align: center; }
.scan-cell strong { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.scan-cell span { display: block; margin-top: 2px; color: var(--cds-ink-faint); font-size: 0.68rem; }
.scan-time { margin: 0; color: var(--cds-ink-faint); font-size: 0.76rem; font-variant-numeric: tabular-nums; }
.scan-edge,
.paper-reason { margin: 8px 0 0; color: var(--cds-ink-muted); font-size: 0.76rem; }
.paper-state { margin-bottom: 10px; }
.paper-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.blocker-checklist { display: grid; gap: 12px; }
.checklist-summary { display: grid; gap: 6px; }
.checklist-summary .progress { margin-top: 0; }
.checklist-count { margin: 0; color: var(--cds-ink-muted); font-size: 0.74rem; font-variant-numeric: tabular-nums; }
.checklist { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.checklist-item { display: flex; align-items: flex-start; gap: 9px; font-size: 0.8rem; line-height: 1.4; }
.check-mark {
  flex: 0 0 20px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid var(--cds-line);
  border-radius: 50%;
  background: var(--cds-raised);
  color: var(--cds-ink-faint);
  font-size: 0.72rem;
  font-weight: 800;
}
.checklist-item[data-met="true"] .check-mark {
  border-color: color-mix(in srgb, var(--cds-gain) 50%, var(--cds-line));
  background: color-mix(in srgb, var(--cds-gain) 12%, transparent);
  color: var(--cds-gain);
}
.checklist-item[data-met="false"] .check-mark {
  border-color: color-mix(in srgb, var(--cds-loss) 40%, var(--cds-line));
  color: var(--cds-loss);
}
.check-label { color: var(--cds-ink); }
.checklist-item[data-met="true"] .check-label { color: var(--cds-ink-muted); }
.check-note { color: var(--cds-ink-faint); font-size: 0.72rem; font-variant-numeric: tabular-nums; }

#blockerList[hidden] { display: none !important; }
.jobs-timeline { margin: 0; padding: 0; list-style: none; }
.job-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--cds-line-soft);
}
.job-item:last-child { border-bottom: 0; }
.job-name { flex: 1 1 auto; min-width: 0; overflow: hidden; font-size: 0.82rem; text-overflow: ellipsis; white-space: nowrap; }
.job-time { flex: 0 0 auto; color: var(--cds-ink-faint); font-size: 0.72rem; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   14. CRN TOKEN
   ------------------------------------------------------------------------- */
.token-card {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  padding: 28px;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-lg);
  background: var(--cds-surface);
  box-shadow: var(--cds-shadow-soft);
}
.token-logo {
  display: block;
  width: 160px;
  height: 160px;
  border: 1px solid var(--cds-line);
  border-radius: 28px;
  object-fit: cover;
  box-shadow: var(--cds-shadow-soft);
}
.token-copy { min-width: 0; }
.token-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.token-heading h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); letter-spacing: 0.01em; }
.token-heading h2 span { margin-left: 6px; color: var(--cds-accent); font-size: 0.72em; }
.token-facts {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(220px, 1.4fr);
  gap: 12px;
  margin: 20px 0;
}
.token-facts > div {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--cds-line-soft);
  border-radius: var(--cds-r-sm);
  background: var(--cds-raised);
}
.token-facts dt { color: var(--cds-ink-faint); font-size: 0.68rem; font-weight: 600; }
.token-facts dd { margin: 3px 0 0; font-size: 0.82rem; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.token-facts dd span { color: var(--cds-ink-faint); font-size: 0.72rem; }
.token-links { display: flex; flex-wrap: wrap; gap: 8px; }
.token-links a {
  padding: 7px 12px;
  border: 1px solid var(--cds-line);
  border-radius: 8px;
  color: var(--cds-accent);
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
  transition: border-color var(--cds-dur) var(--cds-ease);
}
.token-links a:hover { border-color: var(--cds-accent); }
.token-disclosure { margin: 14px 0 0; color: var(--cds-ink-faint); font-size: 0.7rem; }
.token-custody { margin: 6px 0 0; color: var(--cds-accent-gold); font-size: 0.7rem; font-weight: 700; line-height: 1.55; }

/* ---------------------------------------------------------------------------
   15. FOOTER (deep green inverse — both themes)
   ------------------------------------------------------------------------- */
.site-footer {
  background: linear-gradient(160deg, var(--cds-green-900), var(--cds-green-950));
  color: #f4f1e8;
}
.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: 32px 48px;
  padding-block: clamp(48px, 7vw, 84px);
}
.footer-wordmark {
  margin: 0 0 8px;
  font-family: var(--cds-font-display);
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #f7f4ec;
}
.footer-tagline { margin: 0 0 16px; color: rgb(244 241 232 / 66%); font-size: 0.82rem; }
.footer-social {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid rgb(244 241 232 / 26%);
  border-radius: var(--cds-r-pill);
  color: #f7f4ec;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  transition: border-color var(--cds-dur) var(--cds-ease);
}
.footer-social:hover { border-color: var(--cds-gold-300); }
.footer-notes { display: grid; gap: 8px; align-content: start; color: rgb(244 241 232 / 60%); font-size: 0.74rem; line-height: 1.55; }
.footer-notes p { margin: 0; }
.footer-notes p:empty { display: none; }
.footer-copy { margin-top: 6px !important; color: rgb(244 241 232 / 45%); }

/* ---------------------------------------------------------------------------
   16. DRAWER / DIALOG
   ------------------------------------------------------------------------- */
.drawer-veil {
  position: fixed;
  inset: 0;
  z-index: 49;
  visibility: hidden;
  background: rgb(4 12 9 / 62%);
  opacity: 0;
  backdrop-filter: blur(2px);
  transition: opacity var(--cds-dur) var(--cds-ease), visibility 0s linear var(--cds-dur);
}
.drawer {
  --accent: var(--cds-accent);
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 50;
  width: min(480px, 100%);
  height: 100dvh;
  overflow-y: auto;
  padding: 22px 26px 44px;
  border-left: 1px solid var(--cds-line);
  background: var(--cds-surface);
  box-shadow: var(--cds-shadow);
  transform: translateX(102%);
  visibility: hidden;
  transition: transform var(--cds-dur-slow) var(--cds-ease), visibility 0s linear var(--cds-dur-slow);
}
body.drawer-open { overflow: hidden; }
body.drawer-open .drawer-veil { visibility: visible; opacity: 1; transition-delay: 0s; }
body.drawer-open .drawer { visibility: visible; transform: none; transition-delay: 0s; }
.drawer-close { position: sticky; top: 0; z-index: 1; float: right; background: var(--cds-raised); font-size: 1.3rem; }
.detail-head {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  clear: both;
  padding-top: 8px;
}
.detail-avatar { width: 108px; }
.detail-name { margin: 0; font-family: var(--cds-font-display); font-size: 1.5rem; }
.detail-title { margin: 4px 0 8px; color: var(--cds-ink-muted); font-size: 0.8rem; }
.detail-quote {
  margin: 20px 0 0;
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--cds-raised);
  font-size: 0.9rem;
  line-height: 1.6;
}
.detail-work { margin-top: 18px; padding: 14px 16px; border-block: 1px solid var(--cds-line); }
.detail-work strong,
.detail-section h3 {
  display: block;
  margin: 0 0 6px;
  color: var(--cds-ink-faint);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.detail-work p,
.detail-section p { margin: 0; font-size: 0.85rem; line-height: 1.6; }
.detail-section { margin-top: 18px; }
.detail-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.detail-stat { min-width: 0; padding: 10px 12px; border: 1px solid var(--cds-line-soft); border-radius: var(--cds-r-sm); background: var(--cds-raised); }
.detail-stat strong,
.detail-stat span { display: block; overflow-wrap: anywhere; }
.detail-stat strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.detail-stat span { color: var(--cds-ink-faint); font-size: 0.68rem; }

/* ---------------------------------------------------------------------------
   17. TERM TOOLTIP (CSS-only, tap-toggle via .tip-open)
   ------------------------------------------------------------------------- */
.term {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  margin-left: 5px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--cds-ink-faint);
  font-size: 0.7rem;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
}
.term:hover,
.term:focus-visible,
.term.tip-open { color: var(--cds-accent); }
.term::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 25;
  width: max-content;
  max-width: 220px;
  padding: 8px 10px;
  border: 1px solid var(--cds-line);
  border-radius: 8px;
  background: var(--cds-raised);
  box-shadow: var(--cds-shadow-soft);
  color: var(--cds-ink);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px);
  transition: opacity var(--cds-dur-fast) var(--cds-ease), transform var(--cds-dur-fast) var(--cds-ease);
}
.term:hover::after,
.term:focus-visible::after,
.term.tip-open::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ---------------------------------------------------------------------------
   18. BADGES / CHIP HELPERS
   ------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 11px;
  border: 1px solid var(--cds-line);
  border-radius: var(--cds-r-pill);
  font-size: 0.78rem;
  font-weight: 700;
}
.badge.paper,
.badge.shadow {
  border-color: color-mix(in srgb, var(--cds-info) 55%, var(--cds-line));
  color: var(--cds-info);
}
.badge.live {
  border-color: color-mix(in srgb, var(--cds-loss) 60%, var(--cds-line));
  color: var(--cds-loss);
}
.badge.prop {
  border-color: color-mix(in srgb, var(--cds-accent) 55%, var(--cds-line));
  color: var(--cds-accent);
}

/* ---------------------------------------------------------------------------
   19. MOTION SYSTEM (all gated so JS-less page stays fully visible)
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  /* Scroll reveal — only hidden once JS marks the document ready */
  html.js-enabled [data-reveal] {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 700ms var(--cds-ease), transform 700ms var(--cds-ease);
    will-change: opacity, transform;
  }
  html.js-enabled [data-reveal].revealed { opacity: 1; transform: none; }

  /* Staggered children (JS sets per-child transition-delay) */
  html.js-enabled [data-reveal-stagger] > * {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 640ms var(--cds-ease), transform 640ms var(--cds-ease);
  }
  html.js-enabled [data-reveal-stagger].revealed > * { opacity: 1; transform: none; }

  /* Hero title line mask — animates on load once JS marks ready */
  html.js-enabled .hero-line-inner {
    transform: translateY(110%);
    animation: hero-line-up 760ms var(--cds-ease) forwards;
    animation-delay: calc(var(--line-i, 0) * 130ms + 180ms);
  }
  @keyframes hero-line-up {
    from { transform: translateY(110%); }
    to { transform: translateY(0); }
  }

  /* Ticker marquee (two identical groups; -50% = one full group) */
  .ticker-track { animation: marquee 38s linear infinite; }
  .ticker:hover .ticker-track { animation-play-state: paused; }
  @keyframes marquee { to { transform: translateX(-50%); } }

  /* Scroll indicator bob */
  .scroll-indicator-arrow { animation: scroll-bob 1.8s ease-in-out infinite; }
  @keyframes scroll-bob {
    0%, 100% { transform: rotate(45deg) translate(0, 0); }
    50% { transform: rotate(45deg) translate(3px, 3px); }
  }

  /* Sync dot pulse */
  .sync-state.connected .status-dot { animation: pulse-dot 2.4s ease-in-out infinite; }
  @keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--cds-gain) 22%, transparent); }
    50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--cds-gain) 8%, transparent); }
  }

  /* Team card entrance (app.js adds .enter with --stagger) */
  .team-card.enter {
    opacity: 0;
    animation: card-in 520ms var(--cds-ease) forwards;
    animation-delay: var(--stagger, 0ms);
  }
  @keyframes card-in {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
  }

  /* Position pnl pulse */
  .position-card .pnl-badge.gain { animation: pulse-gain 2.6s ease-in-out infinite; }
  .position-card .pnl-badge.loss { animation: pulse-loss 2.6s ease-in-out infinite; }
  @keyframes pulse-gain {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--cds-gain) 22%, transparent); }
    50% { box-shadow: 0 0 11px 1px color-mix(in srgb, var(--cds-gain) 30%, transparent); }
  }
  @keyframes pulse-loss {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--cds-loss) 22%, transparent); }
    50% { box-shadow: 0 0 11px 1px color-mix(in srgb, var(--cds-loss) 30%, transparent); }
  }
}

/* ---------------------------------------------------------------------------
   20. RESPONSIVE
   ------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-menu { gap: 2px; }
  .nav-link { padding: 8px 8px; font-size: 0.8rem; }
}

@media (max-width: 900px) {
  .shell { width: min(1200px, calc(100% - 36px)); }
  .operations-grid { grid-template-columns: 1fr; }
  .section-heading { flex-direction: column; align-items: flex-start; gap: 10px; }
  .section-note { text-align: left; max-width: none; }
  .program-window { text-align: left; }
  .program-phase-line { grid-template-columns: 1fr; gap: 6px; }
  .program-row { grid-template-columns: minmax(120px, .5fr) repeat(3, minmax(0, 1fr)); }
  .token-card { grid-template-columns: 110px minmax(0, 1fr); gap: 20px; }
  .token-logo { width: 110px; height: 110px; border-radius: 22px; }
  .token-facts { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .token-contract-row { grid-column: 1 / -1; }
  .footer-inner { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .shell { width: calc(100% - 28px); }
  .wordmark-sub { display: none; }

  /* Nav becomes a horizontal scroll strip of chips */
  .topbar-inner { flex-wrap: wrap; gap: 10px 14px; }
  .nav-menu {
    order: 3;
    flex: 1 0 100%;
    justify-content: flex-start;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .nav-menu::-webkit-scrollbar { display: none; }
  .nav-link { flex: 0 0 auto; }

  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-value { font-size: clamp(1.6rem, 8vw, 2.1rem); }
  .positions-grid,
  .program-cards { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: 1fr; }

  .program-header { display: none; }
  .program-row { grid-template-columns: 1fr; padding: 12px 0; }
  .program-row > div,
  .program-row > div:first-child { position: relative; padding: 8px 0 8px 92px; border: 0; }
  .program-row > div::before {
    content: attr(data-label);
    position: absolute;
    top: 9px;
    left: 0;
    width: 80px;
    color: var(--cds-ink-faint);
    font-size: 0.68rem;
    font-weight: 700;
  }
  .strategy-row { grid-template-columns: 1fr; gap: 5px; }
  .strategy-stage { text-align: left; }

  .token-card { grid-template-columns: 1fr; text-align: left; }
  .token-facts { grid-template-columns: 1fr; }
  .token-contract-row { grid-column: auto; }

  .trade-item { align-items: flex-start; }
  .conversation-panel { padding: 18px; }
}

/* ---------------------------------------------------------------------------
   21. REDUCED MOTION — neutralise everything
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .hero-line-inner { transform: none !important; }
  [data-reveal],
  [data-reveal-stagger] > * { opacity: 1 !important; transform: none !important; }
}
