/* =====================================================================
   MEFIN — design system stylesheet (visual source of truth)
   Built on the existing MEFIN Design System: Stargazer (SW 9138),
   Iron Ore (SW 7069), MEFIN gold, Mist, Montserrat.
   Layout concept: one dark "instrument" surface per screen holds the
   answer (Safe to Spend + trajectory); everything else is calm paper.
   ===================================================================== */

/* ---------- 1. Tokens: light theme on bare :root ---------- */
:root {
  /* Brand constants (identical in both themes) */
  --yellow: #D2AB55;          /* MEFIN gold — fills, marks, the one action */
  --stargazer: #25405d;       /* SW 9138 as sampled from the brand sheet */
  --steel: #9fb6cf;           /* silver-blue of the mark's F, for lines on dark */
  --steel-deep: #395272;      /* the F stroke on light */
  --iron: #23292e;            /* SW 7069 */
  --mist: #b9c0cb;

  /* Theme surfaces */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --line: #dde2e8;
  --line-strong: #c3cbd5;
  --ink: #1f262c;
  --ink-2: #505b67;
  --ink-3: #6b7683;
  --gold-ink: #7A5F1E;        /* gold as text on light grounds (≥4.5:1) */
  --gold-soft: #F6ECD2;
  --pos: #23704f;             /* income; always with a leading + */
  --pos-soft: #e3f1ea;
  --caution: #9a4a06;         /* authoritative adverse conditions only (shortfall, pressure, Urgent) — never protection status; always with icon + words */
  --caution-mark: #d9791f;
  --caution-soft: #fcecdc;
  --protect: #395272;         /* Protected in Safe fill */
  --protect-soft: #dfe7f1;
  --focus: #25405d;
  --scrim: rgba(12, 20, 28, .48);
  --shadow-1: 0 1px 2px rgba(31,38,44,.05), 0 8px 24px rgba(31,38,44,.06);
  --shadow-2: 0 2px 6px rgba(12,29,39,.10), 0 28px 60px rgba(12,29,39,.20);

  /* Instrument surface (always dark, both themes) */
  --inst-bg: #0e1f2b;
  --inst-bg-2: #15293a;
  --inst-line: #274057;
  --inst-ink: #f3f5f8;
  --inst-ink-2: #b9c3cf;
  --inst-ink-3: #8795a6;
  --inst-pos: #7fd0ad;
  --inst-caution: #f4a653;

  /* Type */
  --font: "Montserrat", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --fs-display-xl: clamp(40px, 6vw, 64px);
  --fs-display-l: clamp(30px, 4.2vw, 44px);
  --fs-display-m: clamp(22px, 2.6vw, 29px);
  --fs-statement: clamp(18px, 2vw, 22px);
  --fs-lead: 18px;
  --fs-body: 15px;
  --fs-sm: 13.5px;
  --fs-xs: 12px;
  --fs-label: 11.5px;
  --fs-fig-xl: clamp(44px, 5.4vw, 60px);
  --fs-fig-l: clamp(26px, 3vw, 32px);
  --fs-fig-m: 17px;

  /* Space (4px base) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px;
  --s8: 32px; --s10: 40px; --s12: 48px; --s16: 64px; --s24: 96px; --s36: 144px;

  /* Radius — restrained; pills only for actions and segmented controls */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-xl: 22px; --r-pill: 999px;

  --tap: 44px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

/* ---------- 2. Dark theme ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1419; --surface: #161d24; --surface-2: #1c252e; --line: #29333d; --line-strong: #3a4653;
    --ink: #eef1f4; --ink-2: #b3bdc8; --ink-3: #8f9aa7;
    --gold-ink: #D2AB55; --gold-soft: #2e2605; --pos: #7fd0ad; --pos-soft: #14271f;
    --caution: #f4a653; --caution-mark: #f4a653; --caution-soft: #2e200f;
    --protect: #9fb6cf; --protect-soft: #1f2c3a; --focus: #D2AB55; --scrim: rgba(0,0,0,.62);
    --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
    --shadow-2: 0 2px 6px rgba(0,0,0,.5), 0 28px 60px rgba(0,0,0,.55);
    --inst-bg: #0b1822; --inst-bg-2: #122333; --inst-line: #22384c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1419; --surface: #161d24; --surface-2: #1c252e; --line: #29333d; --line-strong: #3a4653;
  --ink: #eef1f4; --ink-2: #b3bdc8; --ink-3: #8f9aa7;
  --gold-ink: #D2AB55; --gold-soft: #2e2605; --pos: #7fd0ad; --pos-soft: #14271f;
  --caution: #f4a653; --caution-mark: #f4a653; --caution-soft: #2e200f;
  --protect: #9fb6cf; --protect-soft: #1f2c3a; --focus: #D2AB55; --scrim: rgba(0,0,0,.62);
  --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28);
  --shadow-2: 0 2px 6px rgba(0,0,0,.5), 0 28px 60px rgba(0,0,0,.55);
  --inst-bg: #0b1822; --inst-bg-2: #122333; --inst-line: #22384c;
  color-scheme: dark;
}

/* The instrument scope: any component placed inside inherits dark tokens */
.instrument, .on-brand {
  --bg: var(--inst-bg); --surface: var(--inst-bg-2); --surface-2: #1a3145;
  --line: var(--inst-line); --line-strong: #37536d;
  --ink: var(--inst-ink); --ink-2: var(--inst-ink-2); --ink-3: var(--inst-ink-3);
  --gold-ink: var(--yellow); --gold-soft: rgba(210,171,85,.12);
  --pos: var(--inst-pos); --pos-soft: rgba(127,208,173,.12);
  --caution: var(--inst-caution); --caution-mark: var(--inst-caution); --caution-soft: rgba(244,166,83,.13);
  --protect: var(--steel); --protect-soft: rgba(159,182,207,.16);
  --focus: var(--yellow);
  color-scheme: dark;
  background: var(--inst-bg); color: var(--inst-ink);
}

/* ---------- 3. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: var(--fs-body); line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.num, .fig, .amt, table { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.i-sm { width: 15px; height: 15px; }

/* ---------- 4. Type roles ---------- */
.t-display-xl { font-size: var(--fs-display-xl); font-weight: 700; letter-spacing: -0.03em; line-height: 1.04; }
.t-display-l { font-size: var(--fs-display-l); font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; }
.t-display-m { font-size: var(--fs-display-m); font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
.t-statement { font-size: var(--fs-statement); font-weight: 500; letter-spacing: -0.01em; line-height: 1.45; }
.t-lead { font-size: var(--fs-lead); line-height: 1.6; color: var(--ink-2); }
.t-sm { font-size: var(--fs-sm); line-height: 1.55; }
.t-xs { font-size: var(--fs-xs); line-height: 1.5; }
.t-muted { color: var(--ink-2); }
.t-faint { color: var(--ink-3); }
.t-label, .label { font-size: var(--fs-label); font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-2); line-height: 1.3; }
.t-rail { font-size: 12.5px; font-weight: 600; letter-spacing: .32em; text-transform: uppercase; }
.fig-xl { font-size: var(--fs-fig-xl); font-weight: 700; letter-spacing: -0.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.fig-l { font-size: var(--fs-fig-l); font-weight: 700; letter-spacing: -0.025em; line-height: 1.08; font-variant-numeric: tabular-nums; }
.fig-m { font-size: var(--fs-fig-m); font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.caution { color: var(--caution); }
.gold { color: var(--gold-ink); }

/* ---------- 5. Brand lockup (type-only stand-in; see handoff) ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { height: 30px; display: block; flex: none; }
.brand-mark svg { height: 100%; width: auto; display: block; }
/* Wordmark only (no icon): Split Weight — ME Light 300, FIN ExtraBold 800, +0.02em, one color */
.brand-word { font-weight: 300; letter-spacing: .02em; font-size: 20px; line-height: 1; }
.brand-word .fin { font-weight: 800; }

/* ---------- 6. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: var(--r-pill);
  border: 1px solid transparent; background: transparent; color: var(--ink);
  font-weight: 600; font-size: 14px; letter-spacing: .01em; cursor: pointer; text-decoration: none;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--yellow); color: var(--iron); }
.btn-primary:hover { background: #E0BF78; }
.btn-secondary { border-color: var(--line-strong); background: var(--surface); }
.btn-secondary:hover { border-color: var(--ink-3); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-quiet-caution { color: var(--caution); }
.btn-quiet-caution:hover { background: var(--caution-soft); }
.btn-sm { min-height: 34px; padding: 0 13px; font-size: 13px; }
.btn-lg { min-height: 52px; padding: 0 26px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: var(--tap); padding: 0; }
.link { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; background: none; border: 0; padding: 0; cursor: pointer; }
.link:hover { text-decoration-color: currentColor; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13.5px; color: var(--ink); text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; }
.link-arrow:hover { color: var(--gold-ink); }

/* ---------- 7. Forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 13px; font-weight: 600; color: var(--ink); }
.field .hint { font-size: 12.5px; color: var(--ink-2); }
.field .error-text { font-size: 12.5px; color: var(--caution); display: flex; gap: 6px; align-items: center; font-weight: 600; }
.input, .select {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: 15px; transition: border-color .15s;
}
.input:hover, .select:hover { border-color: var(--ink-3); }
.input:focus, .select:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.input[aria-invalid="true"] { border-color: var(--caution-mark); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.input-money { position: relative; }
.input-money::before { content: "$"; position: absolute; left: 14px; bottom: calc(var(--tap) / 2); transform: translateY(50%); color: var(--ink-2); font-weight: 600; pointer-events: none; }
.input-money .input { padding-left: 28px; font-variant-numeric: tabular-nums; font-weight: 600; }
.input-hero { font-size: clamp(40px, 9vw, 56px); font-weight: 700; letter-spacing: -0.03em; border: 0; border-bottom: 2px solid var(--line-strong); border-radius: 0; background: transparent; padding: 4px 0 4px 34px; min-height: 0; }
.input-hero:focus { outline: none; border-bottom-color: var(--yellow); }
.input-money-hero::before { font-size: clamp(28px, 6vw, 36px); left: 0; bottom: 50%; font-weight: 600; }
.row-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s4); }

/* Segmented control — the only pill group besides actions */
.seg { justify-self: start; align-self: start; display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { min-height: 36px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink-2); font-weight: 600; font-size: 13px; cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"], .seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.instrument .seg button[aria-pressed="true"] { background: var(--ink); color: var(--iron); }

/* Choice tiles (radio cards) */
.choices { display: grid; gap: var(--s2); }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); cursor: pointer; }
.choice:hover { border-color: var(--ink-3); }
.choice input { margin-top: 3px; accent-color: var(--stargazer); width: 18px; height: 18px; }
.choice:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice strong { display: block; font-size: 14.5px; }
.choice span { font-size: 13px; color: var(--ink-2); }

/* ---------- 8. Surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-pad { padding: var(--s6); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s5) var(--s6) 0; flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.instrument-panel { border-radius: var(--r-xl); padding: clamp(20px, 3vw, 32px); position: relative; overflow: hidden; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- 9. Metrics ---------- */
.metric { display: grid; gap: 6px; align-content: start; min-width: 0; }
.metric .label { display: flex; align-items: center; gap: 6px; }
.metric-sub { font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s5) var(--s6); }

/* ---------- 10. Status ---------- */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; line-height: 1.3; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.status-ok { color: var(--pos); }
.status-caution { color: var(--caution); }
.status-info { color: var(--ink-2); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tag-rec { background: var(--gold-soft); color: var(--gold-ink); }
.tag-pos { background: var(--pos-soft); color: var(--pos); }
.tag-caution { background: var(--caution-soft); color: var(--caution); }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2); font-size: 13.5px; line-height: 1.5; }
.notice .i { margin-top: 2px; }
.notice-caution { background: var(--caution-soft); }
.notice-caution > .i { color: var(--caution); }
.notice-success { background: var(--pos-soft); }
.notice-success > .i { color: var(--pos); }

/* ---------- 11. Lists & rows ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px 14px; padding: 14px var(--s6); border-top: 1px solid var(--line); min-height: 60px; }
.list > .row:first-child, .list > li:first-child > .row { border-top: 0; }
.row-link { text-decoration: none; color: inherit; cursor: pointer; transition: background .12s; }
.row-link:hover { background: var(--surface-2); }
.row-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); }
.row-icon.in { background: var(--pos-soft); color: var(--pos); }
.row-icon.warn { background: var(--caution-soft); color: var(--caution); }
.row-date { width: 44px; text-align: center; line-height: 1.05; }
.row-date b { display: block; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.row-date span { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.row-main { min-width: 0; }
.row-title { font-weight: 600; font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere; }
.row-sub { font-size: 12.5px; color: var(--ink-2); line-height: 1.4; margin-top: 2px; }
.row-end { text-align: right; display: grid; gap: 2px; justify-items: end; }
.amt { font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt.in { color: var(--pos); }
.amt-sub { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.list-group-label { padding: 18px var(--s6) 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
/* Related transaction (refund linked to its purchase) */
.row-related { position: relative; background: var(--surface-2); border-top: 0; margin: 0 var(--s4) 10px; border-radius: var(--r-md); padding: 12px 14px; min-height: 0; }
.row-related::before { content: ""; position: absolute; left: 26px; top: -10px; height: 10px; border-left: 1.5px dashed var(--line-strong); }

/* ---------- 12. Protected in Safe (protected / unprotected bar) ---------- */
.prot { display: grid; gap: 8px; }
.prot-bar { position: relative; height: 10px; border-radius: 3px; overflow: hidden; display: flex; gap: 2px; background: transparent; }
.prot-bar .p { background: var(--protect); height: 100%; border-radius: 3px 0 0 3px; }
.prot-bar .u { flex: 1; height: 100%; border-radius: 0 3px 3px 0; background: repeating-linear-gradient(135deg, var(--line-strong) 0 2px, transparent 2px 6px); box-shadow: inset 0 0 0 1px var(--line-strong); }
.prot-bar .p:only-child { border-radius: 3px; flex: 1; }
.prot-bar.is-full .u { display: none; }
.prot-bar.is-full .p { border-radius: 3px; }
.prot-bar.is-none .p { display: none; }
.prot-bar.is-none .u { border-radius: 3px; }
.prot-bar.income .p { background: var(--pos); }
.prot-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--ink-2); }
.prot-legend b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.key { display: inline-flex; align-items: center; gap: 6px; }
.key i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.key-p { background: var(--protect); }
.key-pi { background: var(--pos); }
.key-u { background: repeating-linear-gradient(135deg, var(--line-strong) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* ---------- 13. Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button, .tabs a { min-height: 44px; padding: 0 14px; border: 0; background: none; font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.tabs [aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .count { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }

/* ---------- 14. Scenario controls ---------- */
.scenario { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.scenario .seg { background: rgba(255,255,255,.04); }
.scenario-active { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); background: var(--gold-soft); border-radius: var(--r-pill); padding: 6px 6px 6px 12px; font-weight: 600; }
.scenario-active button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: transparent; color: inherit; display: grid; place-items: center; cursor: pointer; }
.scenario-active button:hover { background: rgba(255,255,255,.1); }

/* ---------- 15. Trajectory chart ---------- */
.traj { position: relative; }
.traj-svg { display: block; width: 100%; overflow: visible; touch-action: pan-y; }
.traj-svg:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 8px; }
.traj .gridline { stroke: var(--line); stroke-width: 1; }
.traj .axis-text { fill: var(--ink-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.traj .floor { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 4; }
.traj .floor-text { fill: var(--ink-2); font-size: 11px; font-weight: 600; font-family: var(--font); }
.traj .line { fill: none; stroke: var(--protect); stroke-width: 2.25; stroke-linejoin: round; }
.traj .line-compare { fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 4 4; }
.traj .area { fill: var(--protect); opacity: .10; }
.traj .short-area { fill: url(#hatch); }
.traj .short-line { fill: none; stroke: var(--caution-mark); stroke-width: 2.25; }
.traj .ev-dot { stroke: var(--bg); stroke-width: 2; }
.traj .ev-dot.in { fill: var(--pos); }
.traj .ev-dot.out { fill: var(--ink-2); }
.traj .ev-dot.big { fill: var(--ink); }
.traj .ann-text { fill: var(--ink); font-size: 11.5px; font-weight: 600; font-family: var(--font); }
.traj .ann-sub { fill: var(--ink-2); font-size: 11px; font-family: var(--font); }
.traj .today-line { stroke: var(--yellow); stroke-width: 1.5; }
.traj .today-text { fill: var(--gold-ink); font-size: 10.5px; font-weight: 700; letter-spacing: .1em; font-family: var(--font); }
.traj .cross { stroke: var(--ink-2); stroke-width: 1; }
.traj .cursor { fill: var(--yellow); stroke: var(--bg); stroke-width: 3; }
.traj .hit { fill: transparent; cursor: crosshair; }
.readout { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 20px; flex-wrap: wrap; min-height: 58px; padding: 10px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.readout-date { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.readout-bal { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.readout-bal small { font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; margin-left: 6px; }
.readout-events { display: grid; gap: 2px; font-size: 13px; min-width: 0; }
.readout-events div { display: flex; gap: 16px; justify-content: space-between; }
.readout-events span:first-child { color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; }
.readout-events .amt { font-size: 13px; }
.traj-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--ink-2); margin-top: 10px; }
.traj-legend .sw { display: inline-block; width: 18px; height: 0; border-top: 2.25px solid var(--protect); vertical-align: middle; margin-right: 6px; }
.traj-legend .sw.floor { border-top: 1px dashed var(--ink-2); }
.traj-legend .sw.short { border-top-color: var(--caution-mark); }
.traj-legend .sw.cmp { border-top: 1.5px dashed var(--ink-3); }

/* ---------- 16. Sheet / modal ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: var(--scrim); z-index: 80; display: flex; justify-content: flex-end; }
.sheet { background: var(--bg); width: min(560px, 100%); height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-2); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; padding-top: calc(18px + env(safe-area-inset-top, 0px)); border-bottom: 1px solid var(--line); background: var(--surface); }
.sheet-head h2 { font-size: 18px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 24px; display: grid; gap: 22px; align-content: start; }
.sheet-foot { padding: 14px 24px; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--surface); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.stepper { display: flex; gap: 6px; }
.stepper i { height: 3px; flex: 1; border-radius: 2px; background: var(--line-strong); }
.stepper i.on { background: var(--ink); }

/* ---------- 17. Feedback states ---------- */
.skel { background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: skel 1.4s linear infinite; border-radius: 6px; }
@keyframes skel { to { background-position: -200% 0; } }
.empty { display: grid; justify-items: start; gap: 10px; padding: var(--s8) var(--s6); }
.empty h3 { font-size: 16px; }
.empty p { color: var(--ink-2); font-size: 14px; max-width: 42ch; }
.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--iron); color: #fff; padding: 12px 16px; border-radius: var(--r-md); font-size: 14px; font-weight: 500; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow-2); z-index: 100; max-width: calc(100% - 32px); }
.toast .i { color: var(--yellow); }
.toast .link { color: #fff; }

/* ---------- 18. Utility ---------- */
.stack { display: grid; gap: var(--s4); }
.stack-lg { display: grid; gap: var(--s6); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.min0 { min-width: 0; }
.hide-mobile { }
@media (max-width: 720px) { .hide-mobile { display: none !important; } }
@media (min-width: 721px) { .show-mobile { display: none !important; } }
.sample-flag { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }

[hidden] { display: none !important; }
.brand-mark:empty { display: none; }

/* ---------- 19. Attention ----------
   Two separate server fields, never merged:
   SEVERITY  (.tier-*): info (shown as "On track") · upcoming · review · urgent
   LIFECYCLE (.lifecycle): open (no label) · acknowledged · resolved · superseded
   Each severity differs by icon + word + form, never colour alone. */
.tier { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; line-height: 1; padding: 5px 8px 5px 6px; border-radius: var(--r-sm); white-space: nowrap; }
.tier .i { width: 14px; height: 14px; stroke-width: 2; }
.tier-info { color: var(--pos); background: var(--pos-soft); }
.tier-upcoming { color: var(--ink-2); background: var(--surface-2); }
.tier-review { color: var(--gold-ink); background: var(--gold-soft); }
.tier-urgent { color: #fff; background: var(--caution); }
.instrument .tier-urgent, :root[data-theme="dark"] .tier-urgent { color: var(--iron); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tier-urgent { color: var(--iron); } }
.tier-muted { opacity: .55; }
.lifecycle { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 3px 8px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); white-space: nowrap; }
.lifecycle .i { width: 13px; height: 13px; }
.attn-closed .attn-headline { font-size: 14.5px; color: var(--ink-2); font-weight: 500; }

.attn { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 20px; padding: 18px var(--s6); border-top: 1px solid var(--line); align-items: start; }
.list > .attn:first-child { border-top: 0; }
.attn-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.attn-name { font-weight: 700; font-size: 15px; }
.attn-due { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.attn-headline { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin-top: 8px; line-height: 1.35; }
.attn-urgent .attn-headline { color: var(--caution); }
.attn-why { font-size: 13.5px; color: var(--ink-2); margin-top: 4px; max-width: 64ch; }
.attn-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.attn-facts b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.attn-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.attn-compact { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; padding: 14px var(--s6); border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.attn-compact:hover { background: var(--surface-2); }
.attn-compact .attn-headline { margin: 0; font-size: 14px; }
.attn-compact .attn-name { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.attn-count { display: inline-flex; align-items: baseline; gap: 8px; }
.attn-count b { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.caught-up { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; padding: 18px var(--s6); align-items: center; }
.caught-up .row-icon { grid-row: span 2; }
@media (max-width: 720px) {
  .attn { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .attn-actions { justify-content: flex-start; }
  .attn-compact { grid-template-columns: minmax(0, 1fr) auto; padding: 14px 16px; }
  .attn-compact .tier { grid-column: 1 / -1; justify-self: start; }
}
.bell { position: relative; }
.bell .badge { position: absolute; top: 5px; right: 4px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--yellow); color: var(--iron); font-size: 10.5px; font-weight: 800; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--bg); }
.traj .ev-ring { fill: none; stroke-width: 2; }
.traj .ev-ring.review { stroke: var(--yellow); }
.traj .ev-ring.urgent { stroke: var(--caution-mark); }
.readout .tier { font-size: 10px; padding: 3px 6px; margin-left: 6px; vertical-align: 1px; }
.focus-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px 10px 16px; border-radius: 12px; background: rgba(210,171,85,.08); border: 1px solid rgba(210,171,85,.25); font-size: 13.5px; }

/* ---------- 20. Funding options (Choose) — shared by app and marketing mocks ---------- */
.option { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); padding: 18px 20px; display: grid; gap: 10px; }
.option-rec { border-color: var(--gold-ink); box-shadow: inset 0 0 0 1px var(--gold-ink); }
.option-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.option-name { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 16px; }
.option p { font-size: 14px; color: var(--ink-2); }
.delta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; padding-top: 10px; border-top: 1px solid var(--line); }
.delta .fig-m { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.delta .was { color: var(--ink-3); font-weight: 500; text-decoration: line-through; text-decoration-thickness: 1px; }
