/* ==========================================================================
   BigMoney — main.css
   "Obsidian, Forest Green & Warm Sovereign Gold"
   Zero external resources (strict CSP: style-src 'self', font-src 'self').
   ========================================================================== */

/* ---------- Self-hosted fonts ---------- */
@font-face{font-family:'Plus Jakarta Sans';font-style:normal;font-weight:200 800;font-display:swap;src:url('/fonts/plus-jakarta-sans-latin-variable.woff2') format('woff2');}
@font-face{font-family:'Instrument Serif';font-style:normal;font-weight:400;font-display:swap;src:url('/fonts/instrument-serif-latin-400-normal.woff2') format('woff2');}
@font-face{font-family:'Instrument Serif';font-style:italic;font-weight:400;font-display:swap;src:url('/fonts/instrument-serif-latin-400-italic.woff2') format('woff2');}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:100 800;font-display:swap;src:url('/fonts/jetbrains-mono-latin-variable.woff2') format('woff2');}

/* ---------- Design tokens ---------- */
:root {
  --bg-canvas: #07120E;
  --bg-surface-1: #0C1C16;
  --bg-surface-2: #11261E;
  --bg-surface-3: #173328;
  --forest-surface: #143326;
  --forest-strong: #1B4332;
  --accent-gold: #D4AF37;
  --accent-gold-bright: #F3E5AB;
  --accent-gold-soft: #C5A028;
  --accent-green: #34D399;
  --accent-red: #F87171;
  --accent-amber: #FBBF24;
  --accent-blue: #60A5FA;
  --text-primary: #FAF7F0;
  --text-secondary: #C8D3CC;
  --text-muted: #889990;
  --border-subtle: rgba(212, 175, 55, 0.14);
  --border-strong: rgba(212, 175, 55, 0.32);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-1: 0 1px 0 rgba(243, 229, 171, 0.06) inset, 0 12px 32px rgba(2, 8, 6, 0.55);
  --font-scale: 1;
  --density: 1;

  /* Derived scales */
  --s-1: calc(4px * var(--density));
  --s-2: calc(8px * var(--density));
  --s-3: calc(12px * var(--density));
  --s-4: calc(16px * var(--density));
  --s-5: calc(24px * var(--density));
  --s-6: calc(32px * var(--density));
  --s-7: calc(48px * var(--density));
  --s-8: calc(64px * var(--density));

  --font-ui: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.45rem;
  --fs-2xl: 1.85rem;
  --fs-3xl: 2.45rem;

  --content-max: 1440px;
  --topbar-h: 128px;
  --nav-h: 48px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 150ms;
  --t-med: 200ms;
  --t-slow: 420ms;

  --surface-sheen: linear-gradient(180deg, rgba(243, 229, 171, 0.045), rgba(255, 255, 255, 0) 42%);
  --gold-ink: #120E04;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: calc(16px * var(--font-scale));
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  color-scheme: dark;
  background: var(--bg-canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: 1.55;
  font-weight: 400;
  color: var(--text-primary);
  background:
    radial-gradient(1200px 580px at 14% -6%, rgba(27, 67, 50, 0.45), transparent 64%),
    radial-gradient(920px 480px at 96% 2%, rgba(212, 175, 55, 0.12), transparent 60%),
    radial-gradient(760px 420px at 50% 100%, rgba(16, 185, 129, 0.08), transparent 65%),
    var(--bg-canvas);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-gold); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, canvas, svg { display: block; max-width: 100%; }
table { border-collapse: collapse; border-spacing: 0; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: rgba(250, 204, 21, 0.28); color: var(--text-primary); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--s-3); top: -100px;
  z-index: 100;
  padding: var(--s-2) var(--s-3);
  background: var(--accent-gold); color: var(--gold-ink);
  border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { top: var(--s-3); text-decoration: none; }

/* ---------- Typography ---------- */
.num, .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 0;
  letter-spacing: -0.01em;
}
.num.is-pos, .is-pos { color: var(--accent-green); }
.num.is-neg, .is-neg { color: var(--accent-red); }
.is-flat { color: var(--text-secondary); }
.is-gold { color: var(--accent-gold); }
.is-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.eyebrow {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.2;
  color: var(--accent-gold-soft);
  letter-spacing: 0.005em;
}

h2.widget-title {
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.25;
  margin-top: var(--s-1);
}
h3.block-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.008em;
  line-height: 1.3;
}
h4.sub-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}
.lede { color: var(--text-secondary); font-size: var(--fs-md); max-width: 72ch; }
.small { font-size: var(--fs-sm); }
.tiny { font-size: var(--fs-xs); }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: clamp(12px, 2.5vw, 32px);
}

main#main {
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
  padding-block: var(--s-5) var(--s-8);
}

section.widget {
  scroll-margin-top: calc(var(--topbar-h) + var(--nav-h) + var(--s-4));
  background: var(--surface-sheen), var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: clamp(16px, 2.2vw, 32px);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

section#widget-overview {
  scroll-margin-top: calc(var(--topbar-h) + var(--nav-h) + var(--s-4));
}

.widget-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-3) var(--s-5);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
}
.widget-head .head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.widget-head .head-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
  color: var(--text-secondary); font-size: var(--fs-sm);
}
.widget-head .lede { margin-top: var(--s-2); }

.block { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.block-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-2) var(--s-4);
}
.block-head .block-note { color: var(--text-muted); font-size: var(--fs-sm); }

.grid { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
.grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
.stack { display: flex; flex-direction: column; gap: var(--s-3); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4); }
.divider { height: 1px; background: var(--border-subtle); border: 0; margin: 0; }

@media (min-width: 900px) {
  .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .span-2 { grid-column: span 2; }
}

/* ---------- Top bar ---------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(7, 18, 14, 0.88);
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  border-bottom: 1px solid var(--border-strong);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.45);
}
.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3) var(--s-4);
  padding-block: var(--s-3);
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  margin-right: auto;
}
.brand-crest {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 22%, rgba(243, 229, 171, 0.24), transparent 62%),
    linear-gradient(135deg, #071510 0%, #0E291F 48%, #06120D 100%);
  border: 1.5px solid var(--accent-gold);
  color: var(--accent-gold-bright);
  box-shadow:
    inset 0 0 0 2px #071510,
    inset 0 0 0 3px rgba(212, 175, 55, 0.42),
    0 0 20px rgba(212, 175, 55, 0.26);
  flex-shrink: 0;
}
.brand-crest-svg {
  width: 46px;
  height: 46px;
}
.brand-title-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 14px 6px;
  border-radius: 8px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 175, 55, 0.14), transparent 70%),
    linear-gradient(125deg, rgba(11, 31, 23, 0.92) 0%, rgba(7, 21, 16, 0.96) 52%, rgba(16, 43, 32, 0.9) 100%);
  border: 1.5px solid rgba(212, 175, 55, 0.68);
  box-shadow:
    inset 0 0 0 2px #07130E,
    inset 0 0 0 3px rgba(212, 175, 55, 0.32),
    0 4px 18px rgba(0, 0, 0, 0.48);
}
.brand-deco-crown {
  width: 100%;
  max-width: 240px;
  height: 16px;
  color: var(--accent-gold);
  line-height: 0;
  margin-bottom: -2px;
}
.brand-deco-crown-svg {
  width: 100%;
  height: 100%;
}
.brand-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.06em;
  font-family: var(--font-serif);
  font-size: 2.65rem;
  line-height: 0.94;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  filter: drop-shadow(0 2px 0 #140F03) drop-shadow(0 3px 10px rgba(0, 0, 0, 0.65));
}
.brand-wordmark .brand-wing {
  font-size: 0.42em;
  color: var(--accent-gold);
  opacity: 0.9;
  padding-inline: 0.22em;
}
.brand-wordmark .brand-big,
.brand-wordmark .brand-money {
  font-family: var(--font-serif);
  font-style: normal;
  font-weight: 700;
  font-size: inherit;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #FFF7D6 0%, #F1D78A 28%, #D4AF37 55%, #9B7419 82%, #E5C467 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-wordmark .brand-hyphen {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--accent-gold);
  padding-inline: 0.04em;
}
.brand-sub-emblem {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-gold-bright);
  font-weight: 600;
  opacity: 0.95;
}
.brand-est {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-gold);
  font-weight: 700;
  letter-spacing: 0.22em;
}
.brand-est::before,
.brand-est::after {
  content: "";
  display: inline-block;
  width: 22px;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
}
.brand-sub-sep {
  color: var(--accent-gold);
  opacity: 0.7;
}
.session-label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  padding: 4px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-surface-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 44ch;
}
.topbar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}
.topbar-controls .control { display: flex; flex-direction: column; gap: 2px; }
.topbar-controls .control-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  font-weight: 600;
  padding-left: 2px;
}

#pipeline-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
  padding-block: 6px var(--s-2);
  border-top: 1px solid var(--border-subtle);
}
.pipeline-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pipeline-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.01em;
  padding: 3px 8px 3px 6px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  white-space: nowrap;
}
.pipeline-chip .agent-no {
  display: inline-grid; place-items: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--forest-strong); color: var(--text-primary);
  font-weight: 700; font-size: 0.6rem;
}
.pipeline-chip .agent-ms { color: var(--text-muted); }
.pipeline-chip.status-COMPLETED .agent-no { background: var(--forest-strong); }
.pipeline-chip.status-FAILED .agent-no { background: rgba(248, 113, 113, 0.35); }
.pipeline-chip.status-RUNNING .agent-no { background: rgba(250, 204, 21, 0.3); }
.pipeline-live { font-size: var(--fs-xs); color: var(--text-muted); margin-left: auto; font-family: var(--font-mono); }

/* ---------- Section navigator ---------- */
#section-nav {
  position: sticky;
  top: var(--topbar-h);
  z-index: 30;
  background: rgba(9, 10, 12, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}
#section-nav ul {
  list-style: none;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-block: 4px;
}
#section-nav ul::-webkit-scrollbar { display: none; }
#section-nav li { flex: 0 0 auto; }
#section-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
#section-nav a .nav-index {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-muted);
}
#section-nav a:hover { color: var(--text-primary); background: var(--bg-surface-2); text-decoration: none; }
#section-nav a.is-active { color: var(--accent-gold); background: rgba(250, 204, 21, 0.06); }
#section-nav a.is-active .nav-index { color: var(--accent-gold-soft); }
#section-nav a.is-active::after {
  content: "";
  position: absolute; left: 14px; right: 14px; bottom: 2px;
  height: 2px; border-radius: 2px;
  background: var(--accent-gold);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 var(--s-4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-sheen), var(--bg-surface-2);
  color: var(--text-primary);
  font-weight: 600;
  font-size: var(--fs-sm);
  letter-spacing: 0.005em;
  white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), color var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
.btn:hover { background: var(--surface-sheen), var(--bg-surface-3); border-color: rgba(255, 255, 255, 0.22); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(180deg, #FFE16A, var(--accent-gold) 55%, var(--accent-gold-soft));
  color: var(--gold-ink);
  border-color: rgba(0, 0, 0, 0.25);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 6px 16px rgba(250, 204, 21, 0.12);
}
.btn-primary:hover { filter: brightness(1.04); border-color: rgba(0, 0, 0, 0.3); background: linear-gradient(180deg, #FFE16A, var(--accent-gold) 55%, var(--accent-gold-soft)); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--bg-surface-2); }
.btn-forest {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)), var(--forest-strong);
  border-color: rgba(255, 255, 255, 0.1);
}
.btn-forest:hover { background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)), var(--forest-strong); }
.btn-danger { color: var(--accent-red); }
.btn-sm { min-height: 32px; padding: 0 var(--s-3); font-size: var(--fs-xs); }
.btn-xs { min-height: 26px; padding: 0 10px; font-size: 0.7rem; border-radius: 6px; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon svg { width: 18px; height: 18px; }
.btn svg { flex: 0 0 auto; }
.btn .btn-spinner { width: 14px; height: 14px; border-width: 2px; }

.link-btn {
  background: none; border: 0; padding: 0;
  color: var(--accent-gold); font-weight: 600; font-size: var(--fs-sm);
}
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.field .hint { font-size: var(--fs-xs); color: var(--text-muted); }

.input, .select, .textarea,
input[type="text"], input[type="number"], input[type="search"], input[type="email"], input[type="password"],
input[type="date"], input[type="tel"], input[type="url"], select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-2);
  color: var(--text-primary);
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:hover, select:hover, textarea:hover { border-color: rgba(255, 255, 255, 0.22); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 1px;
  border-color: var(--border-strong);
}
input[type="number"] { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
input.ticker-input { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em; }
input.ticker-input::placeholder { text-transform: none; letter-spacing: 0; }
textarea { resize: vertical; min-height: 92px; line-height: 1.5; font-family: var(--font-mono); font-size: var(--fs-sm); }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  cursor: pointer;
}
.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute; right: 14px; top: 50%;
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--text-secondary);
  border-bottom: 1.5px solid var(--text-secondary);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.select-compact select { min-height: 36px; font-size: var(--fs-sm); padding-block: 6px; }

input[type="color"] {
  width: 44px; height: 36px; padding: 2px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--bg-surface-2); cursor: pointer;
}
input[type="range"] { width: 100%; accent-color: var(--accent-gold); }
input[type="radio"], input[type="checkbox"] { accent-color: var(--accent-gold); width: 16px; height: 16px; margin: 0; }

.inline-form {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-2) var(--s-3);
}
.inline-form .field { flex: 1 1 200px; }
.inline-form .btn { flex: 0 0 auto; }

.inline-error {
  color: var(--accent-red);
  font-size: var(--fs-sm);
  display: flex; align-items: center; gap: 8px;
}
.inline-error svg { width: 16px; height: 16px; }

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  gap: 2px;
  margin: 0;
}
.segmented legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.segmented label {
  display: inline-flex; align-items: center;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.segmented label:hover { color: var(--text-primary); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span,
.segmented label.is-checked { color: var(--gold-ink); }
.segmented label.is-checked { background: var(--accent-gold); }
.segmented label:focus-within { outline: 2px solid var(--accent-gold); outline-offset: 1px; }

.preset-row { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* ---------- Cards & surfaces ---------- */
.card {
  background: var(--surface-sheen), var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 4px 14px rgba(0, 0, 0, 0.22);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-width: 0;
  transition: border-color var(--t-med) var(--ease), transform var(--t-med) var(--ease), background-color var(--t-med) var(--ease);
}
.card.is-interactive:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.card-forest { background: var(--surface-sheen), var(--forest-surface); }
.card-flat { background: var(--bg-surface-2); box-shadow: none; }
.card-title { font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.005em; line-height: 1.3; }
.card-sub { color: var(--text-secondary); font-size: var(--fs-sm); }
.card-body { color: var(--text-secondary); font-size: var(--fs-sm); line-height: 1.55; }
.card-foot { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); font-size: var(--fs-xs); color: var(--text-muted); }

.callout {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius-md);
  background: var(--forest-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}
.callout strong { color: var(--text-primary); }

.empty-state {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2);
  padding: var(--s-5);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  background: rgba(255, 255, 255, 0.015);
  grid-column: 1 / -1; /* fill the row when placed inside a grid */
  width: 100%;
}
.empty-state strong { color: var(--text-primary); }
.skeleton-row { grid-column: 1 / -1; }

.skeleton-row { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.skeleton {
  height: 14px; border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-surface-2), var(--bg-surface-3), var(--bg-surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}
.skeleton.w-60 { width: 60%; }
.skeleton.w-80 { width: 80%; }
.skeleton.w-40 { width: 40%; }
.skeleton.tall { height: 72px; }

/* ---------- Chips & badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-3);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.2;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.chip-gold { color: var(--accent-gold); background: rgba(250, 204, 21, 0.1); }
.chip-green { color: var(--accent-green); background: rgba(52, 211, 153, 0.1); }
.chip-red { color: var(--accent-red); background: rgba(248, 113, 113, 0.1); }
.chip-amber { color: var(--accent-amber); background: rgba(251, 191, 36, 0.1); }
.chip-blue { color: var(--accent-blue); background: rgba(96, 165, 250, 0.1); }
.chip-forest { color: #9FE3C4; background: var(--forest-surface); }
.chip-muted { color: var(--text-muted); }
.chip-solid { color: var(--gold-ink); background: var(--accent-gold); border-color: transparent; font-weight: 700; }
.chip-source { text-transform: none; }
.chip-source[data-source^="LIVE_"] { color: var(--accent-green); background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.25); }
.chip-source[data-source="DETERMINISTIC_FALLBACK"] { color: var(--accent-amber); background: rgba(251, 191, 36, 0.08); }
.chip-source[data-source="CLIENT_FALLBACK_SYNTHESIS"] { color: var(--accent-red); background: rgba(248, 113, 113, 0.1); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.multi-source-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 4px;
}
@media (min-width: 720px) {
  .multi-source-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.ms-feed-pill {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  min-width: 0;
}
.ms-feed-pill.is-live {
  border-color: rgba(52, 211, 153, 0.28);
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.07), rgba(15, 22, 19, 0.85));
}
.ms-feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.ms-feed-name {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ms-feed-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  flex: 0 0 auto;
}
.ms-feed-pill.is-live .ms-feed-dot {
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.7);
}
.ms-feed-role {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-rank {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent-gold); /* every Priority Action Plan step number sits on gold (owner request) */
  color: var(--gold-ink);
  font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-sm);
  flex: 0 0 auto;
}
.badge-rank.is-top { background: var(--accent-gold); color: var(--gold-ink); }

.signal-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-3);
}
.signal-badge .score { font-size: var(--fs-md); }
.signal-STRONG_ACCUMULATE { color: var(--accent-green); background: rgba(52, 211, 153, 0.12); }
.signal-ACCUMULATE { color: #86EFAC; background: rgba(52, 211, 153, 0.08); }
.signal-HOLD { color: var(--accent-amber); background: rgba(251, 191, 36, 0.1); }
.signal-REDUCE { color: var(--accent-red); background: rgba(248, 113, 113, 0.12); }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; font-family: var(--font-mono);
}
.status-BULLISH, .status-PASS, .status-CLEAR, .status-ADEQUATE, .status-POSITIVE, .status-COMPLETED, .status-BALANCED, .status-ACCUMULATION, .status-INVEST { color: var(--accent-green); background: rgba(52, 211, 153, 0.12); }
.status-NEUTRAL, .status-HOLD, .status-MIXED, .status-EXCESS, .status-RISK_AUTO_REINVEST, .status-REFINANCE { color: var(--accent-amber); background: rgba(251, 191, 36, 0.12); }
.status-BEARISH, .status-FAIL, .status-BLOCKED_30D_WINDOW, .status-UNDERFUNDED, .status-NEGATIVE, .status-FAILED, .status-CONCENTRATED, .status-DISTRIBUTION, .status-PAY_DOWN, .status-TRIM { color: var(--accent-red); background: rgba(248, 113, 113, 0.12); }
.status-ADD { color: var(--accent-blue); background: rgba(96, 165, 250, 0.12); }
/* Symmetric model-signal scale (spec §3) + honest unknown states */
.signal-STRONG_BULLISH { color: var(--accent-green); background: rgba(52, 211, 153, 0.12); }
.signal-BULLISH { color: #86EFAC; background: rgba(52, 211, 153, 0.08); }
.signal-NEUTRAL { color: var(--accent-amber); background: rgba(251, 191, 36, 0.1); }
.signal-BEARISH { color: #FCA5A5; background: rgba(248, 113, 113, 0.08); }
.signal-STRONG_BEARISH { color: var(--accent-red); background: rgba(248, 113, 113, 0.12); }
.signal-NOT_RATED { color: var(--text-muted); background: var(--bg-surface-3); }
.status-STRONG_BULLISH, .status-BELOW_THRESHOLD, .status-WITHIN_BAND, .status-ELIGIBLE_NOW, .status-ON_TRACK, .status-LIKELY_ELIGIBLE { color: var(--accent-green); background: rgba(52, 211, 153, 0.12); }
.status-STRONG_BEARISH, .status-NOT_ELIGIBLE { color: var(--accent-red); background: rgba(248, 113, 113, 0.12); }
.status-NOT_RATED, .status-INFO, .status-PENDING, .status-NEEDS_INPUT, .status-UNKNOWN, .status-NO_HOLDINGS, .status-NOT_QUANTIFIED { color: var(--text-muted); background: var(--bg-surface-3); }
.status-CHECK_ELIGIBILITY, .status-ABOVE_TARGET, .status-BELOW_TARGET, .status-MODERATE_GAP, .status-NEEDS_TOP_UP, .status-PARTIAL, .status-STATE_NOT_MODELED { color: var(--accent-amber); background: rgba(251, 191, 36, 0.12); }
.ticker-pill.is-unavailable { opacity: 0.55; }
.ticker-pill.is-unavailable .pill-main { cursor: not-allowed; }

.cat-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 6px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; font-family: var(--font-mono);
  background: var(--bg-surface-3); color: var(--text-secondary);
}
.cat-TAX { color: var(--accent-gold); background: rgba(250, 204, 21, 0.12); }
.cat-PORTFOLIO { color: var(--accent-green); background: rgba(52, 211, 153, 0.12); }
.cat-CASH_FLOW { color: var(--accent-blue); background: rgba(96, 165, 250, 0.12); }
.cat-RISK { color: var(--accent-red); background: rgba(248, 113, 113, 0.12); }
.cat-MACRO { color: var(--accent-amber); background: rgba(251, 191, 36, 0.12); }
.cat-ALLOCATION { color: #9FE3C4; background: var(--forest-surface); }

.urgency-IMMEDIATE { color: var(--accent-red); }
.urgency-THIS_WEEK { color: var(--accent-amber); }
.urgency-THIS_QUARTER { color: var(--accent-blue); }
.urgency-TIME_SENSITIVE { color: var(--accent-amber); }
.urgency-THIS_TAX_YEAR { color: var(--accent-blue); }
.urgency-ONGOING { color: var(--text-muted); }

/* ---------- Progress bars ---------- */
.bar {
  position: relative;
  width: 100%; height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.bar-fill {
  height: 100%; width: 0;
  border-radius: 999px;
  background: var(--accent-gold);
  transition: width var(--t-slow) var(--ease);
}
.bar-fill.is-green { background: var(--accent-green); }
.bar-fill.is-red { background: var(--accent-red); }
.bar-fill.is-blue { background: var(--accent-blue); }
.bar-fill.is-amber { background: var(--accent-amber); }
.bar-fill.is-forest { background: #2F8F65; }
.bar.is-thick { height: 12px; }
.bar.is-thin { height: 5px; }
.bar-marker {
  position: absolute; top: -3px; width: 2px; height: calc(100% + 6px);
  background: var(--text-primary); opacity: 0.8;
}
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.bar-row .bar { grid-column: 1 / -1; }
.bar-row .bar-label { font-size: var(--fs-sm); color: var(--text-secondary); }
.bar-row .bar-value { font-size: var(--fs-sm); }

/* ---------- KPI tiles ---------- */
.kpi-strip { display: grid; gap: var(--s-3); grid-template-columns: 1fr; }
@media (min-width: 640px) { .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kpi-strip { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.kpi-tile {
  display: flex; flex-direction: column; gap: 6px;
  padding: var(--s-4) var(--s-4) var(--s-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface-sheen), var(--bg-surface-1);
  box-shadow: var(--shadow-1);
  color: var(--text-primary);
  min-width: 0;
  transition: border-color var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}
.kpi-tile:hover { text-decoration: none; border-color: var(--border-strong); transform: translateY(-1px); }
.kpi-tile .kpi-label {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.kpi-tile .kpi-label svg { width: 14px; height: 14px; color: var(--text-muted); }
.kpi-tile .kpi-value { font-size: 1.55rem; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-tile .kpi-sub { font-size: var(--fs-xs); color: var(--text-secondary); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; min-height: 1.3em; }
.kpi-tile .kpi-sub .num { font-size: var(--fs-xs); }
.kpi-tile.is-gold .kpi-value { color: var(--accent-gold); }

/* ---------- Ticker pills & technicals header ---------- */
.ticker-pill-bar {
  display: flex; flex-wrap: wrap; gap: var(--s-2);
}
.ticker-pill {
  display: inline-flex; align-items: stretch;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  overflow: hidden;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.ticker-pill:hover { border-color: var(--border-strong); }
.ticker-pill.is-active { background: var(--forest-surface); border-color: rgba(52, 211, 153, 0.25); }
.ticker-pill .pill-main {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 10px 7px 14px;
  background: none; border: 0; color: var(--text-primary);
}
.ticker-pill .pill-sym { font-family: var(--font-mono); font-weight: 700; font-size: var(--fs-sm); letter-spacing: 0.02em; }
.ticker-pill.is-active .pill-sym { color: var(--accent-gold); }
.ticker-pill .pill-price { font-size: var(--fs-sm); color: var(--text-secondary); }
.ticker-pill .pill-chg { font-size: var(--fs-xs); }
.ticker-pill .pill-remove {
  display: inline-grid; place-items: center;
  width: 30px; border: 0; border-left: 1px solid var(--border-subtle);
  background: none; color: var(--text-muted);
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.ticker-pill .pill-remove:hover { color: var(--accent-red); background: rgba(248, 113, 113, 0.08); }
.ticker-pill .pill-remove svg { width: 12px; height: 12px; }
.ticker-pill .pill-remove:disabled { opacity: 0.35; cursor: not-allowed; }

.tech-header {
  display: grid; gap: var(--s-4);
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 1100px) { .tech-header { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); } }
.tech-identity { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.tech-identity .tech-ticker { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--accent-gold); letter-spacing: 0.08em; }
.tech-identity .tech-name { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.tech-identity .tech-sector { color: var(--text-secondary); font-size: var(--fs-sm); }
.tech-price-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-2) var(--s-3); margin-top: var(--s-1); }
.tech-price-row .tech-price { font-size: var(--fs-3xl); font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.tech-price-row .tech-change { font-size: var(--fs-lg); font-weight: 600; }
.tech-price-row .tech-prev { font-size: var(--fs-xs); color: var(--text-muted); }

.range-52 { display: flex; flex-direction: column; gap: 6px; }
.range-52 .range-labels { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--text-muted); }
.range-52 .range-track { position: relative; height: 6px; border-radius: 999px; background: linear-gradient(90deg, rgba(248,113,113,0.5), rgba(255,255,255,0.08) 50%, rgba(52,211,153,0.5)); }
.range-52 .range-thumb { position: absolute; top: -4px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent-gold); border: 2px solid var(--bg-surface-1); transform: translateX(-50%); transition: left var(--t-slow) var(--ease); }

.tech-context { display: flex; flex-direction: column; gap: var(--s-3); }
.ms-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
@media (min-width: 640px) { .ms-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ms-cell {
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--bg-surface-2); border: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.ms-cell .ms-label { font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.ms-cell .ms-value { font-size: var(--fs-md); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-cell .ms-note { font-size: var(--fs-xs); color: var(--text-secondary); }
.stars { color: var(--accent-gold); letter-spacing: 1px; }
.stars .off { color: var(--text-muted); }

.regime-strip { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); font-size: var(--fs-sm); color: var(--text-secondary); }
.regime-strip .k { color: var(--text-muted); }

/* ---------- Charts ---------- */
.chart-card {
  display: flex; flex-direction: column; gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface-sheen), var(--bg-surface-2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 4px 14px rgba(0, 0, 0, 0.22);
  min-width: 0;
}
.chart-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s-2) var(--s-4); }
.chart-head .chart-title { font-size: var(--fs-md); font-weight: 600; }
.chart-head .chart-sub { font-size: var(--fs-xs); color: var(--text-muted); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--fs-xs); color: var(--text-secondary); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.legend-swatch { width: 14px; height: 3px; border-radius: 2px; background: currentColor; flex: 0 0 auto; }
.legend-swatch.is-box { height: 10px; border-radius: 2px; opacity: 0.6; }
.legend-swatch.is-dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px); }
.legend-swatch.is-candle { width: 8px; height: 12px; border-radius: 1px; }
.chart-wrap { position: relative; width: 100%; min-width: 0; }
.chart-wrap canvas {
  display: block; width: 100%; height: var(--chart-h, 360px);
  border-radius: var(--radius-sm);
  touch-action: pan-y;
}
.chart-wrap.price { --chart-h: 460px; }
.chart-wrap.oscillator { --chart-h: 280px; }
.chart-wrap.horizons { --chart-h: 320px; }
.chart-wrap.weights { --chart-h: 320px; }
@media (max-width: 700px) {
  .chart-wrap.price { --chart-h: 360px; }
  .chart-wrap.oscillator { --chart-h: 240px; }
  .chart-wrap.horizons { --chart-h: 260px; }
}
.chart-tooltip {
  position: absolute; left: 0; top: 0;
  z-index: 5;
  pointer-events: none;
  min-width: 170px; max-width: 280px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(17, 20, 24, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.chart-tooltip .tt-title { font-weight: 700; color: var(--text-primary); margin-bottom: 6px; font-family: var(--font-mono); font-size: 0.72rem; }
.chart-tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; line-height: 1.5; }
.chart-tooltip .tt-row .tt-k { display: inline-flex; align-items: center; gap: 6px; }
.chart-tooltip .tt-row .tt-k .sw { width: 8px; height: 8px; border-radius: 2px; }
.chart-tooltip .tt-row .tt-v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-primary); }
.chart-footnote { font-size: var(--fs-xs); color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }

/* ---------- Tables ---------- */
.table-scroll {
  position: relative;
  width: 100%;
  overflow: auto;
  max-height: 520px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
}
.data-table {
  width: 100%;
  font-size: var(--fs-sm);
  min-width: 560px;
}
.data-table caption {
  caption-side: top;
  text-align: left;
  padding: 10px 14px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  background: var(--bg-surface-2);
  position: sticky; top: 0; z-index: 3;
}
.data-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-surface-3);
  color: var(--text-secondary);
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.data-table.has-caption thead th { top: 37px; }
.data-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
  color: var(--text-primary);
}
.data-table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.018); }
.data-table tbody tr:hover td { background: rgba(250, 204, 21, 0.035); }
.data-table th.num, .data-table td.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.data-table td.muted { color: var(--text-secondary); }
.data-table td .cell-sub { display: block; font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; font-family: var(--font-ui); }
.data-table td.wrap { min-width: 240px; white-space: normal; color: var(--text-secondary); }
.data-table tfoot td {
  padding: 10px 14px;
  background: var(--bg-surface-3);
  border-top: 1px solid var(--border-strong);
  font-weight: 600;
  position: sticky; bottom: 0;
}
.table-footnote { font-size: var(--fs-xs); color: var(--text-muted); padding-top: 6px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.heat-table td { text-align: center; font-family: var(--font-mono); font-size: var(--fs-xs); padding: 6px 8px; min-width: 52px; }
.heat-table th { font-family: var(--font-mono); font-size: 0.7rem; }
.heat-table .heat-cell { border-radius: 4px; padding: 4px 6px; display: inline-block; min-width: 48px; color: var(--text-primary); }
.heat-table .is-diag { color: var(--text-muted); }

/* ---------- Details / collapsibles ---------- */
details.panel {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  overflow: hidden;
}
details.panel > summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; gap: var(--s-3);
  padding: 12px var(--s-4);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  transition: background-color var(--t-fast) var(--ease);
  user-select: none;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary:hover { background: var(--bg-surface-3); }
details.panel > summary::before {
  content: "";
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--text-secondary);
  border-bottom: 1.5px solid var(--text-secondary);
  transform: rotate(-45deg);
  transition: transform var(--t-fast) var(--ease);
  flex: 0 0 auto;
  margin-left: 2px;
}
details.panel[open] > summary::before { transform: rotate(45deg); }
details.panel[open] > summary { border-bottom: 1px solid var(--border-subtle); }
details.panel > summary .summary-meta { margin-left: auto; display: inline-flex; gap: 8px; align-items: center; font-weight: 500; color: var(--text-muted); font-size: var(--fs-xs); }
details.panel > .panel-body { padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }
details.panel > .panel-body.is-flush { padding: 0; }

.step-no {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--forest-strong); color: var(--text-primary);
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700;
  flex: 0 0 auto;
}

/* Phase step headers */
.phase-step {
  display: flex; flex-direction: column; gap: var(--s-3);
  padding-top: var(--s-4);
  border-top: 1px solid var(--border-subtle);
}
.phase-step-head { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.phase-step-head .step-kicker { font-family: var(--font-serif); font-style: italic; color: var(--accent-gold-soft); font-size: 1.05rem; }
.phase-step-head h3 { font-size: var(--fs-lg); font-weight: 600; }
.phase-step-head .step-note { color: var(--text-muted); font-size: var(--fs-sm); margin-left: auto; }

.kv-list { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 16px; font-size: var(--fs-sm); }
.kv-list dt { color: var(--text-muted); white-space: nowrap; }
.kv-list dd { color: var(--text-primary); min-width: 0; }

.metric-card .metric-reading { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text-primary); word-break: break-word; }
.metric-card .metric-score { display: flex; align-items: center; gap: 10px; font-size: var(--fs-xs); color: var(--text-muted); }

.cot-numbers { border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); overflow: hidden; }
.cot-numbers table { width: 100%; font-size: var(--fs-xs); }
.cot-numbers td { padding: 6px 10px; border-bottom: 1px solid var(--border-subtle); }
.cot-numbers td:last-child { text-align: right; font-family: var(--font-mono); color: var(--text-primary); }
.cot-numbers tr:last-child td { border-bottom: 0; }
.cot-numbers td:first-child { color: var(--text-secondary); }

.react-row { display: grid; gap: var(--s-2); grid-template-columns: 1fr; }
@media (min-width: 900px) { .react-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.react-cell { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-surface-2); border: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 4px; }
.react-cell .react-k { font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-gold-soft); font-weight: 700; }
.react-cell .react-v { font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.5; }

/* Elliott & Fibonacci strips */
.rule-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2); border: 1px solid var(--border-subtle);
  font-size: var(--fs-sm);
}
.rule-chip .rule-name { color: var(--text-secondary); }
.fib-levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }
.fib-level {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle); background: var(--bg-surface-2);
  font-size: var(--fs-xs);
}
.fib-level .fib-ratio { color: var(--text-muted); font-family: var(--font-mono); }
.fib-level .fib-price { font-size: var(--fs-sm); font-weight: 600; }
.fib-level.is-bracket { background: rgba(250, 204, 21, 0.08); border-color: rgba(250, 204, 21, 0.3); }
.fib-level.is-golden { background: var(--forest-surface); }
.fib-level.is-golden .fib-ratio { color: #9FE3C4; }

/* Ones to watch */
.watch-card .watch-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.watch-card .watch-sym { font-family: var(--font-mono); font-weight: 700; color: var(--accent-gold); font-size: var(--fs-md); }
.watch-card .watch-name { font-size: var(--fs-sm); color: var(--text-secondary); }

/* Action matrix */
.action-card { gap: var(--s-3); }
.action-card .action-top { display: flex; align-items: flex-start; gap: var(--s-3); }
.action-card .action-title { font-size: var(--fs-md); font-weight: 600; line-height: 1.3; }
.action-card .action-impact { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.action-card .action-impact-label { font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }

/* Loading banners */
.loading-banner {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 12px var(--s-4);
  border-radius: var(--radius-md);
  background: var(--forest-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: var(--fs-sm);
}
.loading-banner .loading-text { flex: 1 1 auto; }
.loading-banner .loading-elapsed { font-family: var(--font-mono); color: var(--text-muted); font-size: var(--fs-xs); }
.spinner {
  width: 20px; height: 20px; flex: 0 0 auto;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent-gold);
  animation: spin 0.9s linear infinite;
}
.spinner.is-sm { width: 14px; height: 14px; border-width: 2px; }
.btn-spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.2); border-top-color: currentColor;
  animation: spin 0.9s linear infinite;
}

.boot-banner {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 12px var(--s-4);
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}
.boot-banner.is-error { background: rgba(248, 113, 113, 0.06); color: var(--text-primary); }
.boot-banner .btn { margin-left: auto; }

/* Net worth */
.headline-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .headline-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.headline-cell { display: flex; flex-direction: column; gap: 4px; padding: var(--s-3) var(--s-4); border-radius: var(--radius-md); background: var(--bg-surface-2); border: 1px solid var(--border-subtle); min-width: 0; }
.headline-cell .h-label { font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.headline-cell .h-value { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.headline-cell.is-primary { background: var(--surface-sheen), var(--forest-surface); }
.headline-cell.is-primary .h-value { color: var(--accent-gold); font-size: 1.6rem; }

.stacked-bar {
  display: flex; width: 100%; height: 28px;
  border-radius: 8px; overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}
.stacked-seg {
  height: 100%; width: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700; color: var(--gold-ink);
  overflow: hidden; white-space: nowrap;
  transition: width var(--t-slow) var(--ease);
  border-right: 1px solid rgba(0, 0, 0, 0.35);
}
.stacked-seg:last-child { border-right: 0; }
.ac-US_GROWTH_EQUITY { background: var(--accent-gold); }
.ac-US_CORE_EQUITY { background: #2F8F65; color: var(--text-primary); }
.ac-INTERNATIONAL_EQUITY { background: var(--accent-blue); color: #0B1220; }
.ac-FIXED_INCOME_CASH { background: #9AA3AE; color: #0B0D10; }
.ac-ALTERNATIVES { background: var(--accent-amber); }
.ac-other { background: var(--bg-surface-3); color: var(--text-primary); }
.alloc-legend { display: grid; gap: 12px 24px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); font-size: var(--fs-sm); }
.alloc-legend > :not(.legend-line) { grid-column: 1 / -1; } /* coverage / basis notes use the full width */
.alloc-legend .legend-line { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; grid-template-areas: "sw label pct" ". detail detail";
  align-items: baseline; column-gap: 8px; row-gap: 2px; color: var(--text-secondary); }
.alloc-legend .legend-line .sw { grid-area: sw; width: 10px; height: 10px; border-radius: 3px; align-self: center; }
.alloc-legend .legend-line .legend-label { grid-area: label; overflow-wrap: normal; word-break: normal; }
.alloc-legend .legend-line .legend-pct { grid-area: pct; color: var(--text-primary); white-space: nowrap; }
.alloc-legend .legend-line .legend-detail { grid-area: detail; color: var(--text-muted); font-size: var(--fs-xs); }

.drift-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); font-size: var(--fs-sm); }
.drift-item:last-child { border-bottom: 0; }
.drift-item .drift-sub { grid-column: 1 / -1; font-size: var(--fs-xs); color: var(--text-muted); }

.bucket-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 110px 56px; gap: 10px; align-items: center; font-size: var(--fs-sm); }
@media (max-width: 640px) { .bucket-row { grid-template-columns: 1fr 70px 50px; } .bucket-row .bar { grid-column: 1 / -1; } }
.bucket-row .bucket-label { color: var(--text-secondary); }

/* Tax */
.rate-grid { display: grid; gap: var(--s-2); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .rate-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .rate-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.rate-cell { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg-surface-2); border: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 2px; }
.rate-cell .rate-label { font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.rate-cell .rate-value { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.02em; }
.rate-cell.is-key { background: var(--surface-sheen), var(--forest-surface); }
.rate-cell.is-key .rate-value { color: var(--accent-gold); }

.compare-grid { display: grid; gap: var(--s-2); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.compare-cell { padding: 12px; border-radius: var(--radius-sm); background: var(--bg-surface-2); border: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 4px; }
.compare-cell .c-label { font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.compare-cell .c-value { font-size: var(--fs-lg); font-weight: 600; }
.compare-cell .c-sub { font-size: var(--fs-xs); color: var(--text-secondary); }
.compare-cell.is-win { background: var(--surface-sheen), var(--forest-surface); }

.shelter-card .shelter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.shelter-card .shelter-nums { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--text-muted); }

.strategy-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s-3); align-items: start; padding: var(--s-3) 0; border-bottom: 1px solid var(--border-subtle); }
.strategy-item:last-child { border-bottom: 0; }
.strategy-item .strategy-title { font-weight: 600; }
.strategy-item .strategy-summary { color: var(--text-secondary); font-size: var(--fs-sm); margin-top: 2px; }
.strategy-item .strategy-val { text-align: right; }
.strategy-item .strategy-val .num { font-size: var(--fs-lg); font-weight: 600; color: var(--accent-green); }
.strategy-item .strategy-val .conf { font-size: var(--fs-xs); color: var(--text-muted); }
@media (max-width: 600px) {
  /* Phones: give the text the full row and put the dollar value underneath (no squeezed middle column). */
  .strategy-item { grid-template-columns: auto minmax(0, 1fr); }
  .strategy-item .strategy-val { grid-column: 1 / -1; text-align: left; }
}

/* Macro */
.regime-grid { display: grid; gap: var(--s-3); grid-template-columns: 1fr; }
@media (min-width: 900px) { .regime-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.catalyst-card .cat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.catalyst-card .cat-headline { font-size: var(--fs-md); font-weight: 600; line-height: 1.35; }
.catalyst-card .impact { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 700; }
.catalyst-card .impact svg { width: 16px; height: 16px; }
.pub-badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 6px; background: var(--bg-surface-3); border: 1px solid var(--border-subtle); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.02em; color: var(--text-secondary); }
.pub-badge.is-live { color: var(--accent-gold); }
.ticker-mini { display: inline-flex; padding: 1px 7px; border-radius: 5px; background: var(--forest-surface); color: #9FE3C4; font-family: var(--font-mono); font-size: 0.68rem; font-weight: 600; }

/* Phase 2 */
.p2-controls { display: grid; gap: var(--s-3); grid-template-columns: 1fr; }
@media (min-width: 900px) { .p2-controls { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.p2-side { display: flex; flex-direction: column; gap: var(--s-3); }
.counter { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted); }
.counter.is-over { color: var(--accent-red); }
.p2-kpis { display: grid; gap: var(--s-2); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .p2-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .p2-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.verify-row { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.next-steps { list-style: none; display: flex; flex-direction: column; gap: 8px; counter-reset: step; }
.next-steps li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg-surface-2); border: 1px solid var(--border-subtle); font-size: var(--fs-sm); color: var(--text-secondary); }
.next-steps li .step-no { margin-top: 1px; }

/* ---------- Dialogs ---------- */
dialog {
  border: 0; padding: 0; margin: auto;
  background: transparent; color: var(--text-primary);
  max-width: min(960px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  width: 100%;
}
dialog::backdrop { background: rgba(4, 5, 7, 0.72); backdrop-filter: blur(5px); }
dialog[open] { animation: dialog-in 220ms var(--ease); }
.modal-card {
  display: flex; flex-direction: column;
  max-height: calc(100vh - 24px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  background: var(--surface-sheen), var(--bg-surface-1);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.modal-card.is-narrow { max-width: 560px; margin: 0 auto; }
.modal-card.is-medium { max-width: 720px; margin: 0 auto; }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border-subtle);
}
.modal-head h2 { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.01em; }
.modal-head .modal-sub { color: var(--text-secondary); font-size: var(--fs-sm); margin-top: 2px; }
.modal-body { padding: var(--s-5); overflow: auto; display: flex; flex-direction: column; gap: var(--s-4); }
.modal-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}
.modal-foot .foot-note { margin-right: auto; font-size: var(--fs-xs); color: var(--text-muted); }
.form-grid { display: grid; gap: var(--s-3); grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .span-2 { grid-column: span 2; } }

.theme-presets { display: grid; gap: var(--s-2); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .theme-presets { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.preset-card {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.preset-card:hover { border-color: var(--border-strong); }
.preset-card input { position: absolute; opacity: 0; pointer-events: none; }
.preset-card.is-checked { border-color: var(--accent-gold); background: var(--bg-surface-3); }
.preset-card:focus-within { outline: 2px solid var(--accent-gold); outline-offset: 2px; }
.preset-swatches { display: flex; gap: 4px; height: 26px; border-radius: 6px; overflow: hidden; }
.preset-swatches span { flex: 1; }
.preset-name { font-size: var(--fs-xs); font-weight: 600; }
.preset-desc { font-size: 0.68rem; color: var(--text-muted); }
.color-grid { display: grid; gap: var(--s-2); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.color-field { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); background: var(--bg-surface-2); }
.color-field label { display: flex; flex-direction: column; gap: 1px; font-size: var(--fs-xs); color: var(--text-secondary); }
.color-field label .tok { font-family: var(--font-mono); color: var(--text-muted); font-size: 0.66rem; }
.range-field { display: flex; align-items: center; gap: var(--s-3); }
.range-field output { font-family: var(--font-mono); font-size: var(--fs-sm); min-width: 4ch; text-align: right; }
.theme-preview-text { padding: var(--s-3) var(--s-4); border-radius: var(--radius-sm); background: var(--bg-surface-2); border: 1px solid var(--border-subtle); color: var(--text-secondary); font-size: var(--fs-sm); }

.bs-account-row { display: grid; gap: var(--s-2); grid-template-columns: 1fr; padding: var(--s-3); border-radius: var(--radius-md); border: 1px solid var(--border-subtle); background: var(--bg-surface-2); }
@media (min-width: 640px) { .bs-account-row { grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); align-items: end; } }
.bs-account-row.is-529 { background: var(--surface-sheen), var(--forest-surface); }
.bs-account-row .acct-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bs-account-row .acct-name strong { font-size: var(--fs-sm); }
.bs-account-row .acct-name .acct-inst { font-size: var(--fs-xs); color: var(--text-secondary); font-family: var(--font-mono); }
.bs-account-row .field label { font-size: 0.64rem; }

.xai-section { display: flex; flex-direction: column; gap: 8px; }
.xai-section h3 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-gold-soft); font-weight: 700; }
.xai-chain { padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; counter-reset: chain; }
.xai-chain li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; font-size: var(--fs-sm); color: var(--text-secondary); line-height: 1.55; }
.xai-chain li::before { counter-increment: chain; content: counter(chain); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--forest-strong); color: var(--text-primary); font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700; }
.xai-sources { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.xai-sources li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; font-size: var(--fs-sm); color: var(--text-secondary); }
.xai-sources li .src-date { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted); margin-left: auto; }
.xai-assumptions { padding-left: 18px; color: var(--text-secondary); font-size: var(--fs-sm); display: flex; flex-direction: column; gap: 4px; }

/* ---------- Toasts ---------- */
#toast-region {
  position: fixed; right: 16px; bottom: 16px; z-index: 90;
  display: flex; flex-direction: column; gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start;
  padding: 12px 12px 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: rgba(23, 27, 33, 0.97);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  animation: toast-in 220ms var(--ease);
}
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease); }
.toast .toast-icon { width: 18px; height: 18px; margin-top: 1px; }
.toast-success .toast-icon { color: var(--accent-green); }
.toast-error .toast-icon { color: var(--accent-red); }
.toast-info .toast-icon { color: var(--accent-blue); }
.toast .toast-close { background: none; border: 0; color: var(--text-muted); padding: 2px; border-radius: 4px; display: grid; place-items: center; }
.toast .toast-close:hover { color: var(--text-primary); background: var(--bg-surface-3); }
.toast .toast-close svg { width: 14px; height: 14px; }

/* ---------- Footer ---------- */
#app-footer {
  padding-block: var(--s-5) var(--s-7);
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: var(--fs-xs);
}
#app-footer .footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); }

/* ---------- Icons ---------- */
.icon { width: 16px; height: 16px; flex: 0 0 auto; }
.icon-sm { width: 14px; height: 14px; }

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.fade-in { animation: fade-in 260ms var(--ease); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .spinner, .btn-spinner { animation: none; border-top-color: var(--accent-gold); opacity: 0.8; }
  .skeleton { animation: none; }
}

/* ---------- Responsive refinements ---------- */
@media (max-width: 900px) {
  .brand-wordmark { font-size: 1.35rem; }
  .brand-wordmark .brand-big { font-size: 1.55rem; }
  .session-label { display: none; }
  .topbar-controls { width: 100%; }
  .topbar-controls .control { flex: 1 1 140px; }
  .topbar-controls .btn-text-hide { display: none; }
  .pipeline-live { margin-left: 0; width: 100%; }
  .tech-price-row .tech-price { font-size: 1.9rem; }
  .kpi-tile .kpi-value { font-size: 1.35rem; }
}
@media (max-width: 640px) {
  .compare-grid { grid-template-columns: 1fr; }
  .modal-head, .modal-body, .modal-foot { padding-inline: var(--s-4); }
  .widget-head { align-items: flex-start; }
  section.widget { border-radius: var(--radius-md); }
  .pipeline-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
  .pipeline-chip { flex: 0 0 auto; }
}

/* ========================================================================== */
/* BigMoney v2.0 — 6-Tab Workspace, Vault Auth, ADK, Spreadsheet & Simulators */
/* ========================================================================== */

.vault-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.vault-badge-btn:hover {
  border-color: var(--accent-gold);
  background: var(--bg-surface-3);
  color: var(--text-primary);
}
.vault-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-gold);
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.55);
  flex: 0 0 auto;
}
.vault-dot.is-auth {
  background: var(--accent-green);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.65);
}

.workspace-tab-panel {
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
  animation: fade-in 200ms var(--ease);
}
.workspace-tab-panel[hidden] {
  display: none !important;
}

.workspace-intro-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--surface-sheen), var(--forest-surface);
}
.workspace-title {
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.workspace-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

/* Reference-library response card */
.adk-form {
  display: grid;
  gap: var(--s-3);
  grid-template-columns: 1fr;
  align-items: end;
}
@media (min-width: 900px) {
  .adk-form {
    grid-template-columns: minmax(0, 2.4fr) minmax(180px, 0.9fr) auto;
  }
}
.adk-presets {
  margin-top: -4px;
}
.adk-response-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-2);
}
.adk-response-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}
.adk-answer-text {
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--text-primary);
}
.adk-checklist {
  list-style: none;
  display: grid;
  gap: var(--s-2);
  grid-template-columns: 1fr;
  padding-left: 0;
}
@media (min-width: 900px) {
  .adk-checklist {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.adk-checklist li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

/* Holistic Financial Spreadsheet Editor */
.sheet-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
}
.sheet-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sheet-tab-btn {
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.sheet-tab-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.sheet-tab-btn.is-active {
  background: var(--forest-strong);
  border-color: var(--accent-gold);
  color: var(--text-primary);
}
.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.sheet-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  font-size: var(--fs-sm);
}
.sheet-active-title {
  font-weight: 600;
  color: var(--accent-gold-soft);
}
.sheet-grid-wrap {
  max-height: 540px;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg-surface-1);
}
.sheet-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-surface-3);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.sheet-table td {
  padding: 6px 8px;
  vertical-align: middle;
}
.sheet-cell-input,
.sheet-cell-select {
  width: 100%;
  min-width: 105px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--text-primary);
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
}
.sheet-cell-input.is-text {
  font-family: var(--font-ui);
  min-width: 150px;
}
.sheet-cell-input:focus,
.sheet-cell-select:focus {
  outline: none;
  border-color: var(--accent-gold);
  background: var(--bg-surface-3);
}
.sheet-cell-readonly {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  padding: 4px 6px;
}
.sheet-row-num {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
  width: 36px;
}
.sheet-cell-input.is-invalid { border-color: var(--accent-red); }
.sheet-cell-readonly.is-muted { font-style: italic; opacity: 0.8; }
.sheet-empty {
  padding: 14px 10px;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
}
.btn.is-armed {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

/* Legal IRC Tax Loophole Cards */
.loophole-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  justify-content: space-between;
}
.loophole-code {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-gold);
  font-weight: 600;
}
.loophole-savings {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent-green);
}
.loophole-steps {
  padding-left: 18px;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.loophole-guardrail {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(250, 204, 21, 0.06);
  border: 1px solid rgba(250, 204, 21, 0.22);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

/* What-If Simulator */
.what-if-form {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
}
.what-if-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 900px) {
  .what-if-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1280px) {
  .what-if-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

/* ===================================================================== */
/* Multi-Lens Stock Analysis Engine (5 Orthogonal Methodologies)         */
/* ===================================================================== */
.lens-command-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  align-items: flex-start;
  justify-content: space-between;
  margin-top: var(--s-3);
}
.lens-command-row .inline-form {
  flex: 1 1 420px;
}
.lens-horizon-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  min-width: 320px;
}
.lens-horizon-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-gold);
}
.lens-convergence-banner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-4);
  padding: var(--s-4);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.07), rgba(212, 175, 55, 0.07));
  border: 1px solid rgba(212, 175, 55, 0.28);
}
@media (min-width: 1080px) {
  .lens-convergence-banner {
    grid-template-columns: 1.25fr 1fr;
    align-items: stretch;
  }
}
.lens-conv-left {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  justify-content: space-between;
}
.lens-conv-headline {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.lens-playbook-box {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.55);
  border-left: 3px solid var(--accent-gold);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.trade-blueprint-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
}
.trade-blueprint-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}
@media (min-width: 640px) {
  .trade-blueprint-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.trade-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
}
.trade-cell-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.trade-cell-val {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 700;
}
.lens-scorecard-grid .lens-card {
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--s-2);
}
.lens-scorecard-grid .lens-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-gold);
}
.lens-scorecard-grid .lens-card.is-selected {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 1px var(--accent-gold);
}
.lens-subtabs {
  margin-top: var(--s-2);
  margin-bottom: var(--s-2);
}
.chart-controls-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.piotroski-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  margin-top: 6px;
}
.piotroski-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 5px;
  background: var(--bg-surface-2);
  font-size: var(--fs-xs);
}
.orderflow-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
}
@media (min-width: 960px) {
  .orderflow-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* ==========================================================================
   Phase 3 — "Feel Like a Million Bucks" Salute, Plain-English Callouts,
   Under-the-Hood Analyst Proof Drawers & 10 GB Storage Cap Guardrail
   ========================================================================== */

.btn-gold-outline {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.18), rgba(20, 51, 38, 0.85));
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold-bright);
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(212, 175, 55, 0.16);
}
.btn-gold-outline:hover {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.30), rgba(27, 67, 50, 0.95));
  border-color: var(--accent-gold-bright);
}

.btn-proof-toggle {
  background: rgba(17, 38, 30, 0.9);
  border: 1px dashed rgba(212, 175, 55, 0.45);
  color: var(--accent-gold-bright);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.btn-proof-toggle.is-active {
  background: rgba(212, 175, 55, 0.22);
  border-style: solid;
  border-color: var(--accent-gold);
  color: #FFFDF7;
}

.head-actions-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

/* 10.0 GB Storage Cap Warning Banner */
.storage-cap-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3) var(--s-4);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(180, 83, 9, 0.32), rgba(120, 53, 15, 0.45));
  border: 1.5px solid var(--accent-amber);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.storage-cap-banner-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 82ch;
}
.storage-cap-badge {
  display: inline-block;
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.22);
  color: #FDE68A;
  border: 1px solid rgba(251, 191, 36, 0.5);
}
.storage-cap-text {
  font-size: var(--fs-sm);
  color: var(--text-primary);
  margin: 0;
}

/* Sample-data notice (contract C-H) — persistent on every tab while the demo household is loaded */
.sample-data-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-4);
  padding: 10px 16px;
  margin-bottom: var(--s-3);
  border-radius: var(--radius-md);
  background: rgba(251, 191, 36, 0.08);
  border: 1.5px dashed var(--accent-amber);
}
.sample-data-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--gold-ink, #1a1300);
  background: var(--accent-amber);
}
.sample-data-text { margin: 0; flex: 1 1 320px; font-size: var(--fs-sm); color: var(--text-primary); }

/* Data-integrity helpers: unavailable values, low-reliability model values, provenance notes */
.value-unavailable { color: var(--text-muted); font-style: italic; }
.is-low-reliability { opacity: 0.6; }
.integrity-note {
  margin: 0;
  padding: 6px 10px;
  border-left: 3px solid var(--accent-amber);
  background: rgba(251, 191, 36, 0.06);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  border-radius: 4px;
}
.integrity-note.is-error { border-left-color: var(--accent-red); background: rgba(248, 113, 113, 0.06); }
.source-list { margin: 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: 6px; }
.source-list a { color: var(--accent-gold); }

/* "Feel Like a Million Bucks" Daily Wealth Salute Banner */
.wealth-salute-banner {
  position: relative;
  overflow: hidden;
  padding: clamp(20px, 2.8vw, 36px);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(900px 320px at 8% 0%, rgba(212, 175, 55, 0.20), transparent 65%),
    radial-gradient(700px 300px at 95% 100%, rgba(52, 211, 153, 0.14), transparent 65%),
    linear-gradient(145deg, #0D241B 0%, #091812 52%, #132C21 100%);
  border: 1.5px solid rgba(212, 175, 55, 0.48);
  box-shadow:
    0 1px 0 rgba(243, 229, 171, 0.22) inset,
    0 18px 42px rgba(2, 8, 5, 0.65);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.wealth-salute-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
}
.wealth-salute-copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 76ch;
}
.wealth-salute-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.salute-tier-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #F3E5AB, #D4AF37);
  color: #120E04;
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.35);
}
.salute-score-pill {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: #A7F3D0;
}
.wealth-salute-headline {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 2.7vw, 2.5rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.005em;
  color: #FFFDF7;
  margin: 0;
}
.wealth-salute-sub {
  font-size: var(--fs-md);
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}
.wealth-salute-cta-col {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.salute-wins-grid {
  margin-top: 4px;
}
.salute-win-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(243, 229, 171, 0.07), rgba(12, 28, 22, 0.88));
  border: 1px solid rgba(212, 175, 55, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.salute-win-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-gold-bright);
}
.salute-win-metric {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent-green);
}
.salute-win-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-primary);
}
.salute-win-body {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  line-height: 1.48;
}
.wealth-affirmation {
  margin: 0;
  padding: 10px 16px;
  border-left: 3px solid var(--accent-gold);
  background: rgba(7, 18, 14, 0.55);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.12rem;
  color: var(--accent-gold-bright);
}

/* Plain-English Guidance Callout Box */
.plain-english-callout {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(20, 51, 38, 0.78), rgba(12, 28, 22, 0.92));
  border: 1px solid rgba(52, 211, 153, 0.34);
  border-left: 4px solid var(--accent-gold);
}
.plain-english-kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-gold-bright);
}
.plain-english-headline {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-primary);
}
.plain-english-body {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.58;
}

/* Under-the-Hood Analyst Proof & Math Drawer */
.btn-under-hood {
  background: rgba(20, 51, 38, 0.72);
  border: 1px solid rgba(212, 175, 55, 0.38);
  color: var(--accent-gold-bright);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
}
.btn-under-hood:hover {
  background: rgba(212, 175, 55, 0.20);
  border-color: var(--accent-gold);
}
.under-hood-drawer {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(6, 15, 11, 0.82);
  border: 1px dashed rgba(212, 175, 55, 0.42);
  margin-top: 6px;
}
.under-hood-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.18);
}
.under-hood-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-gold);
}

/* Reference-library result card & further-reading links */
.grounded-citation-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
}
.grounded-citation-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.grounded-citation-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--accent-gold-bright);
}
.grounded-uri-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-green);
  word-break: break-all;
}

/* Wealth Salute Grid, Momentum Crest & Under-the-Hood Aliases */
.wealth-salute-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-4);
  align-items: center;
}
@media (max-width: 960px) {
  .wealth-salute-top {
    grid-template-columns: 1fr;
  }
}
.wealth-salute-subheadline {
  font-size: var(--fs-md);
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}
.wealth-momentum-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, rgba(212, 175, 55, 0.16), rgba(10, 26, 19, 0.92));
  border: 1px solid rgba(212, 175, 55, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  min-width: 240px;
}
.wealth-momentum-score {
  font-family: var(--font-serif);
  font-size: 2.05rem;
  font-weight: 700;
  line-height: 1.05;
  color: var(--accent-gold-bright);
}
.wealth-momentum-tier {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-green);
}
.reasons-proud-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-3);
  margin-top: 6px;
}
@media (max-width: 1200px) {
  .reasons-proud-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 680px) {
  .reasons-proud-grid {
    grid-template-columns: 1fr;
  }
}
.proud-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* uniform card height, text stacked comfortably from the top */
  gap: 8px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(243, 229, 171, 0.08), rgba(12, 28, 22, 0.90));
  border: 1px solid rgba(212, 175, 55, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.proud-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-gold-bright);
}
.proud-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.proud-metric {
  font-family: var(--font-mono);
  font-size: 1.38rem;
  font-weight: 700;
  color: var(--accent-green);
}
.proud-why {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  line-height: 1.48;
  margin: 0;
}
.pe-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-gold-bright);
}
.pe-text {
  font-size: var(--fs-sm);
  color: var(--text-primary);
  line-height: 1.58;
}
.btn-under-the-hood {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(20, 51, 38, 0.78);
  border: 1px solid rgba(212, 175, 55, 0.42);
  color: var(--accent-gold-bright);
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.btn-under-the-hood:hover {
  background: rgba(212, 175, 55, 0.22);
  border-color: var(--accent-gold);
}
.under-the-hood-drawer {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(6, 15, 11, 0.86);
  border: 1px dashed rgba(212, 175, 55, 0.42);
  margin-top: 6px;
}
.under-the-hood-drawer[hidden] {
  display: none !important;
}

/* ========================================================================== */
/* --- Legal & disclaimers ---                                                */
/* Fixed footer banner, inline .legal-note notices, the blocking Terms-of-Use */
/* acknowledgment dialog and the static /legal.html page. Self-contained;     */
/* --legal-bar-h is measured by app.js (syncLegalFooterOffset).               */
/* ========================================================================== */
body.has-legal-footer { padding-bottom: var(--legal-bar-h, 64px); }
html { scroll-padding-bottom: calc(var(--legal-bar-h, 0px) + 12px); }
body.has-legal-footer #toast-region { bottom: calc(var(--legal-bar-h, 64px) + 12px); }

.legal-footer-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 35;
  background: rgba(7, 18, 14, 0.95);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-strong);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.45);
}
.legal-footer-text {
  margin: 0 auto;
  max-width: var(--content-max);
  padding: 7px clamp(12px, 2.5vw, 32px) calc(7px + env(safe-area-inset-bottom, 0px));
  font-size: var(--fs-xs);
  line-height: 1.45;
  color: var(--text-secondary);
  text-align: center;
}
.legal-footer-link {
  color: var(--accent-gold);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.legal-note {
  margin: 0;
  max-width: 100ch;
  padding: 2px 0 2px 10px;
  border-left: 2px solid var(--border-strong);
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--text-muted);
}
.widget-head .legal-note { margin-top: var(--s-2); }
.chart-card .legal-note { margin-top: var(--s-2); }
.adk-response-card .legal-note { margin-top: var(--s-1); }
.legal-note-attached { margin-top: calc(-1 * var(--s-5)); }

.legal-accept-dialog .modal-card { max-width: 700px; }
/* Title is a programmatic focus target only (tabindex="-1", not tabbable): no focus ring. */
.legal-accept-dialog #legal-accept-title:focus,
.legal-accept-dialog #legal-accept-title:focus-visible { outline: none; }
.legal-accept-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.legal-accept-points li {
  padding: 10px 12px 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-gold);
  background: var(--bg-surface-2);
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--text-secondary);
}
.legal-accept-points li strong { color: var(--text-primary); }
.legal-accept-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--accent-gold);
  background: var(--forest-surface);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
}
.legal-accept-check input { width: 18px; height: 18px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--accent-gold); }
.legal-accept-check a, .legal-accept-dialog .modal-body a { text-decoration: underline; text-underline-offset: 2px; }

/* Static Terms of Use & Disclosures page (frontend/legal.html) */
.legal-page-header {
  border-bottom: 1px solid var(--border-strong);
  background: rgba(7, 18, 14, 0.9);
}
.legal-page-header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); padding-block: var(--s-3); }
.legal-home-link:hover { text-decoration: none; }
.legal-wordmark { font-size: 1.7rem; }
.legal-wordmark .brand-big { font-size: 1.95rem; }
.legal-doc { max-width: 940px; padding-block: var(--s-6) var(--s-8); }
.legal-article { display: flex; flex-direction: column; gap: var(--s-5); }
.legal-doc-head { display: flex; flex-direction: column; gap: var(--s-2); }
.legal-title { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.012em; line-height: 1.2; }
.legal-meta { color: var(--text-muted); font-size: var(--fs-sm); }
.legal-summary {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent-gold);
  background: var(--surface-sheen), var(--bg-surface-1);
  color: var(--text-primary);
  font-weight: 600;
}
.legal-toc {
  padding: var(--s-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
}
.legal-toc-title { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-gold-soft); margin-bottom: var(--s-2); }
.legal-toc-list { list-style: none; margin: 0; padding: 0; columns: 2 300px; column-gap: var(--s-5); font-size: var(--fs-sm); }
.legal-toc-list li { break-inside: avoid; padding: 3px 0; }
.legal-section {
  scroll-margin-top: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding-top: var(--s-4);
  border-top: 1px solid var(--border-subtle);
}
.legal-section-title { font-size: var(--fs-lg); font-weight: 600; line-height: 1.35; }
.legal-section p { color: var(--text-secondary); line-height: 1.7; max-width: 82ch; }
.legal-section a { text-decoration: underline; text-underline-offset: 2px; }
.legal-page-footer { border-top: 1px solid var(--border-subtle); padding-block: var(--s-5) var(--s-7); color: var(--text-muted); font-size: var(--fs-xs); }
.legal-page-footer-inner { display: flex; flex-direction: column; gap: var(--s-2); }

@media print {
  .legal-footer-banner { position: static; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  body.has-legal-footer { padding-bottom: 0; }
  .legal-page-header .legal-back-link { display: none; }
}
/* --- end Legal & disclaimers --- */


/* Tab 2 analysis window (6M · 1Y · 3Y · 5Y · 10Y) — compact control at the top right of the price chart card */
.analysis-window-box { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; max-width: 360px; }
.analysis-window-box .control { display: inline-flex; align-items: center; justify-content: flex-end; gap: 10px; margin: 0; }
.analysis-window-box .control-label { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); white-space: nowrap; }
.analysis-window-basis { margin: 0; text-align: right; }
.analysis-window-basis:empty { display: none; }
.price-chart-head { align-items: flex-start; }
.price-chart-head .chart-head-text { flex: 1 1 320px; min-width: 0; }
.price-chart-head .analysis-window-box { flex: 0 1 auto; margin-left: auto; }
.price-chart-head .chart-controls-wrap { flex: 1 1 100%; }
.integrity-inline { color: var(--accent-amber); }
.card.is-selected-window { border-color: var(--accent-gold); box-shadow: inset 0 0 0 1px var(--accent-gold); }

/* =====================================================================
   Responsive & containment layer
   - Text containment everywhere: flex/grid children may shrink, long tokens wrap inside their widget.
   - Tablet (≤900px) and phone (≤640px / ≤480px) layouts: single column, compact header, 44px touch
     targets, 16px form text (no iOS zoom), full-screen dialogs, scrollable tables, no page-level h-scroll.
   ===================================================================== */
html, body { max-width: 100%; overflow-x: clip; }
:where(.grid, .grid-2, .grid-3, .grid-4, .grid-5, .grid-6, .stack, .row, .row-between, .chip-row, .preset-row,
  .headline-grid, .kpi-strip, .ms-grid, .rate-grid, .orderflow-grid, .compare-grid, .regime-grid, .regime-strip,
  .p2-controls, .p2-kpis, .react-row, .tech-header, .form-grid, .widget-head, .head-text, .head-actions-col,
  .lens-command-row, .wealth-salute-top, .wealth-salute-copy, .wealth-salute-badges, .wealth-salute-cta-col,
  .topbar-inner, .topbar-controls, .brand, .modal-head, .modal-foot, .modal-body, .sheet-toolbar, .sheet-actions,
  .phase-step, .phase-step-head, .tech-identity, .tech-context, .tech-price-row, .block, .block-head, .card, .widget,
  .ticker-form, .input-with-button, .lens-horizon-box, .analysis-window-box) > * { min-width: 0; }
:where(.widget, .card, .block, .modal-card, .plain-english-callout, .integrity-note, .wealth-salute-banner,
  .tech-header, .phase-step, .lens-section-panel, .under-the-hood-drawer, .under-hood-drawer, .legal-footer-text,
  .sample-data-banner, .storage-cap-banner, .boot-banner, #toast-region) { overflow-wrap: break-word; }
:where(.data-table) th, :where(.data-table) td { overflow-wrap: break-word; }
.chip { white-space: normal; max-width: 100%; text-align: left; }
.kv-list { grid-template-columns: fit-content(52%) minmax(0, 1fr); }
.kv-list dt { white-space: normal; }
.wealth-salute-top { grid-template-columns: minmax(0, 1fr) auto; }
.lens-horizon-box { min-width: 0; flex: 1 1 320px; }
.brand-title-group { min-width: 0; }
.widget-title { font-size: clamp(1.2rem, 0.95rem + 1.1vw, 1.65rem); }

/* Ticker lookup: input and button on one row, equal heights, vertically centred at every width. */
.ticker-form { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 420px; }
.ticker-form .hint { font-size: var(--fs-xs); color: var(--text-muted); }
.input-with-button { display: flex; align-items: stretch; gap: var(--s-2); min-width: 0; }
.input-with-button > input { flex: 1 1 auto; min-width: 0; min-height: 44px; margin: 0; }
.input-with-button > .btn { flex: 0 0 auto; min-height: 44px; margin: 0; align-self: stretch; }

@media (max-width: 900px) {
  input[type="text"], input[type="number"], input[type="search"], input[type="email"], input[type="password"],
  input[type="date"], select, textarea, .sheet-cell-input, .sheet-cell-select, .select-compact select { font-size: 16px; }
  .btn, .btn-sm, .btn-xs { min-height: 44px; }
  .btn-xs { padding: 0 12px; font-size: 0.78rem; }
  #section-nav a { height: 44px; }
  #section-nav ul { scroll-snap-type: x proximity; scroll-padding-inline: 12px; }
  #section-nav li { scroll-snap-align: start; }
  .widget-head { flex-direction: column; align-items: stretch; }
  .widget-head .head-actions-col { width: 100%; align-items: stretch; }
  .phase-step-head .step-note { margin-left: 0; }
  .lens-command-row { flex-direction: column; align-items: stretch; }
  .lens-command-row .ticker-form, .lens-horizon-box { flex: 1 1 auto; width: 100%; }
  .wealth-salute-top { grid-template-columns: minmax(0, 1fr); }
  .compare-grid { grid-template-columns: minmax(0, 1fr); }
  .pipeline-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .pipeline-chips::-webkit-scrollbar { display: none; }
  .data-table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-scroll .data-table { display: table; }
}

@media (max-width: 640px) {
  #topbar { position: static; }
  #section-nav { top: 0; }
  .brand-sub-emblem { display: none; }
  .brand { gap: 10px; margin-right: 0; width: 100%; }
  .brand-crest { width: 40px; height: 40px; border-radius: 11px; }
  .brand-crest-svg { width: 26px; height: 26px; }
  .vault-badge-btn { margin-left: auto; max-width: 52vw; }
  .topbar-inner { gap: 10px; padding-block: 10px; }
  .topbar-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 8px; }
  .topbar-controls .control, .topbar-controls .select-wrap, .topbar-controls select { width: 100%; }
  .topbar-controls .btn { width: 100%; justify-content: center; padding-inline: 10px; }
  .topbar-controls #btn-run-analysis { grid-column: 1 / -1; }
  .pipeline-live { margin-left: 0; }
  main#main { gap: var(--s-4); padding-block: var(--s-3) var(--s-6); }
  .widget { padding: 16px 12px; border-radius: var(--radius-md); gap: var(--s-4); }
  .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: minmax(0, 1fr); }
  dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; }
  dialog > .modal-card, dialog .modal-card.is-narrow, dialog .modal-card.is-medium {
    max-width: none; width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; margin: 0;
  }
  .modal-head, .modal-foot { padding-inline: var(--s-4); }
  .modal-body { padding: var(--s-4); flex: 1 1 auto; }
  .modal-foot .btn { flex: 1 1 auto; justify-content: center; }
  .sheet-actions .btn { flex: 1 1 calc(50% - 8px); justify-content: center; }
}

@media (max-width: 480px) {
  .input-with-button > .btn { padding-inline: 12px; }
  .headline-grid { grid-template-columns: minmax(0, 1fr); }
  .phase-step-head .step-kicker { font-size: 0.98rem; }
  .wealth-salute-headline { font-size: clamp(1.4rem, 7vw, 1.9rem); }
}
/* Buttons may wrap their label rather than spill out of narrow widgets; progress tracks clip their fills. */
.btn { max-width: 100%; }
.bar { overflow: hidden; }
@media (max-width: 900px) {
  .btn { white-space: normal; text-align: center; line-height: 1.25; padding-block: 6px; }
}
/* Phone header menu, compact legal bar, nav scroll cue, roomier stock header metrics */
.mobile-menu-btn { display: none; }
.tech-header .ms-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) {
  #section-nav ul { padding-inline-end: 28px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
}
@media (max-width: 640px) {
  .mobile-menu-btn { display: inline-flex; min-width: 72px; }
  .vault-badge-btn { margin-left: auto; }
  .topbar-controls:not(.is-open) { display: none; }
  .pipeline-chips { display: none; }
  .pipeline-live { font-size: 0.68rem; }
  .legal-footer-text { font-size: 0.68rem; line-height: 1.35; padding-top: 5px; padding-bottom: calc(5px + env(safe-area-inset-bottom, 0px)); }
  #section-nav a { padding: 0 12px; font-size: 0.82rem; }
}
@media (max-width: 900px) {
  /* Keep the account badge readable on small screens (truncated with an ellipsis; full text in the button title). */
  .vault-badge-btn .session-label { display: inline-block; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
}
/* Daily snapshot: copy first, actions underneath (no squeezed copy column beside a wide empty gap). */
.wealth-salute-top { grid-template-columns: minmax(0, 1fr); }
.wealth-salute-copy { max-width: 92ch; }
.wealth-salute-cta-col { justify-content: flex-start; }
.basis-list { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; color: var(--text-secondary); }
@media (max-width: 640px) {
  /* Brand row: the wordmark never shrinks; the account badge absorbs any shortage by truncating its label. */
  .brand-title-group { flex: 0 0 auto; }
  .vault-badge-btn { min-width: 0; flex: 0 1 auto; overflow: hidden; }
  .vault-badge-btn .session-label { flex: 0 1 auto; min-width: 0; }
  .mobile-menu-btn { flex: 0 0 auto; }
}

/* =====================================================================
   Owner layout fixes (Oct 11): full-row grid items, balanced stock header, one-row horizon cards
   ===================================================================== */
/* Items marked data-span (summary notes, model notes, check lists, methodology cards) fill the whole grid row
   instead of squeezing into the first column beside the cards. */
:is(.grid-2, .grid-3, .grid-4, .grid-5, .grid-6, .react-row) > [data-span] { grid-column: 1 / -1; }

/* Stock header: key technical readings as compact tiles under the range meter (left column); rows fill edge to edge. */
.tech-stats { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-1); }
.tech-stat { flex: 1 1 140px; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--bg-surface-2); border: 1px solid var(--border-subtle); }
.tech-stat-k { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.tech-stat-v { font-size: var(--fs-sm); font-weight: 600; color: var(--text-primary); }
@media (min-width: 1100px) {
  .tech-header { align-items: stretch; }
  .tech-context > .tech-dq { margin-top: auto; } /* data-quality checks line up with the bottom of the left column */
}

/* Multi-Horizon Trajectory: the five horizon cards share one row on computers, three per row on tablets. */
@media (min-width: 641px) and (max-width: 1099.98px) { .horizon-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .horizon-cards { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
/* Horizon cards: values never break mid-number (labels wrap instead); the selected-window flag rides on the card's top edge. */
.horizon-cards .kv-list { grid-template-columns: minmax(0, 1fr) auto; }
.horizon-cards .kv-list dd { white-space: nowrap; }
@media (min-width: 1100px) and (max-width: 1279.98px) { .horizon-cards .kv-list { column-gap: 10px; font-size: var(--fs-xs); } } /* five narrow cards: whole words fit */
.horizon-cards .card.is-selected-window { position: relative; }
.selected-window-flag {
  position: absolute; top: 0; left: 50%; transform: translate(-50%, -50%);
  padding: 2px 10px; border-radius: 999px; border: 1px solid var(--accent-gold); background: var(--bg-surface-1);
  color: var(--accent-gold); font-family: var(--font-mono); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.04em; line-height: 1.4;
  white-space: nowrap; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis;
}

@media (max-width: 640px) {
  /* Phones: the analysis-window control takes the full width under the chart title. */
  .price-chart-head .analysis-window-box { flex: 1 1 100%; max-width: none; align-items: stretch; }
  .price-chart-head .analysis-window-box .control { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
  .price-chart-head .analysis-window-box .select-wrap { flex: 1 1 auto; min-width: 0; }
  .price-chart-head .analysis-window-box select { width: 100%; }
  .price-chart-head .analysis-window-basis { text-align: left; }
}

/* =====================================================================
   Top bar polish (Oct 11): logo link, Big-Money wordmark, aligned pill and controls
   ===================================================================== */
/* The logo (crest + wordmark) is a link back to the Command Center. */
.brand-home { display: flex; align-items: center; gap: 14px; min-width: 0; color: inherit; text-decoration: none; border-radius: 14px; }
.brand-home:hover, .brand-home:focus { text-decoration: none; color: inherit; }
.brand-home:hover .brand-crest, .brand-home:hover .brand-title-group { border-color: var(--accent-gold-bright); box-shadow: inset 0 0 0 2px #07130E, inset 0 0 0 3px rgba(243, 229, 171, 0.55), 0 0 24px rgba(212, 175, 55, 0.38); }
.brand-home:focus-visible { outline: 2px solid var(--accent-gold); outline-offset: 4px; }
.brand-wordmark .brand-hyphen { font-family: var(--font-serif); font-weight: 700; color: var(--accent-gold); margin-inline: 0.02em; }

/* The account pill's bottom edge lines up with the bottom of the "Household Wealth Dashboard" line. */
@media (min-width: 641px) {
  .brand > .vault-badge-btn { align-self: flex-end; margin-bottom: var(--brand-pill-lift, 0.93rem); } /* bottom on the subtitle's letter baseline */
}

/* Run window / Residence state boxes are button height, and every control sits on the same bottom line. */
.topbar-controls { align-items: flex-end; }
.topbar-controls .select-compact select { min-height: 40px; }
@media (max-width: 900px) {
  .topbar-controls .select-compact select { min-height: 44px; }
}
@media (max-width: 640px) {
  .brand-home { flex: 0 0 auto; gap: 10px; }
}

/* Art Deco logo: responsive fixes — the plaque keeps its shape; the account pill truncates first. */
.brand-home { flex: 0 0 auto; }
.brand > .vault-badge-btn { min-width: 0; flex: 0 1 auto; overflow: hidden; }
.brand > .vault-badge-btn .session-label { min-width: 0; flex: 0 1 auto; }
.brand-sub-emblem { white-space: nowrap; }
.legal-wordmark .brand-big { font-size: inherit; }
@media (max-width: 900px) {
  .brand-wordmark .brand-big { font-size: inherit; } /* BIG and MONEY share one size */
  .brand-est, .brand-sub-sep { display: none; } /* shorter subtitle so the plaque fits tablets */
}
@media (max-width: 640px) {
  /* Phones: crest + plaque + account dot + Menu must fit 360-390 px without pushing Menu off-screen. */
  .brand, .brand-home { gap: 8px; }
  .brand-crest { width: 38px; height: 38px; }
  .brand-crest-svg { width: 30px; height: 30px; }
  .brand-wordmark { font-size: clamp(0.95rem, 4.6vw, 1.2rem); letter-spacing: 0.04em; }
  .brand-wordmark .brand-wing { display: none; }
  .brand-title-group { padding: 3px 8px 4px; }
  .brand-deco-crown { height: 12px; }
  .brand > .vault-badge-btn { min-width: 40px; }
  .mobile-menu-btn { min-width: 64px; }
}

/* Owner logo image (Oct 11): the cropped Art Deco emblem on green marble, framed in gold; links to the Command Center. */
.brand-logo-heading { margin: 0; line-height: 0; }
.brand-logo-img {
  display: block; height: 120px; width: auto; max-width: 100%;
  border: 2px solid var(--accent-gold); border-radius: 10px;
  box-shadow: 0 0 0 1px #07130E, 0 0 0 3px rgba(212, 175, 55, 0.45), 0 6px 22px rgba(0, 0, 0, 0.55);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.brand-home:hover .brand-logo-img {
  border-color: var(--accent-gold-bright);
  box-shadow: 0 0 0 1px #07130E, 0 0 0 3px rgba(243, 229, 171, 0.6), 0 0 26px rgba(212, 175, 55, 0.35);
}
@media (min-width: 641px) {
  .brand > .vault-badge-btn { margin-bottom: 0; } /* pill bottom sits on the logo frame's bottom edge */
}
@media (max-width: 900px) { .brand-logo-img { height: 90px; } }
@media (max-width: 640px) { .brand-logo-img { height: 60px; border-radius: 8px; } }
.legal-logo-img { display: block; height: 64px; width: auto; border: 2px solid var(--accent-gold); border-radius: 8px; box-shadow: 0 0 0 1px #07130E, 0 0 0 3px rgba(212, 175, 55, 0.4); }
