/* Local fonts — no external requests */
@font-face { font-family: 'Funnel Display'; font-style: normal; font-weight: 300 800; src: url('../fonts/funnel-display-latin-wght-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 300; src: url('../fonts/jetbrains-mono-latin-300-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400; src: url('../fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500; src: url('../fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2'); }

:root {
  /* Ground + text */
  --bg: #080D13; --bg2: #111820; --bg3: #1A2230; --border: #232E3C;
  --text: #E8ECF1; --muted: #7A8BA0; --dim: #2E3B4A;
  /* Interaction: exactly one accent. P&L semantics: exactly one pair.
     One warning hue. Gold is reserved for PRO and nothing else. */
  --accent: #4EA8DE; --green: #34D399; --red: #F87171; --warn: #F59E0B; --gold: #FFD700;
  /* PRO fills — one gradient, defined once, so the header button and every
     upgrade gate are the same gold. Deliberately NOT re-declared per theme:
     --gold resolves to a brown in the light theme, which is right for gold
     text on cream but wrong for a filled button. --pro-ink is the label. */
  --pro-grad: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  --pro-grad-active: linear-gradient(135deg, #34D399 0%, #10B981 100%);
  --pro-ink: #1A1A2E;
  /* Benchmark hues are data colours — never used as chrome */
  --bm-sp500: #00A8E1; --bm-eurostoxx: #F5A623; --bm-nasdaq: #A855F7;
  --font-mono: 'JetBrains Mono', monospace; --font-display: 'Funnel Display', sans-serif;
  /* Radius scale — every surface picks one of these, no ad-hoc values */
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 10px; --card-radius: 12px; --r-pill: 999px;
}
[data-theme="light"] {
  --bg: #F0EDE6; --bg2: #F7F5F0; --bg3: #E8E4DC; --border: #D1CDC4;
  --text: #111827; --muted: #6B7280; --dim: #D1CDC4;
  --accent: #2563EB; --green: #16A34A; --red: #DC2626; --warn: #B45309; --gold: #B7791F;
}
* { margin:0; padding:0; box-sizing:border-box; }
html, body { width:100%; min-height:100vh; }
body { background:var(--bg); color:var(--text); font-family:var(--font-mono); font-size:13px; line-height:1.5; }

/* ── Accent top-line ───────────────────────────────────────────────────────── */
body::before { content:''; display:block; height:2px; background:var(--accent); opacity:0.7; position:fixed; top:0; left:0; right:0; z-index:100; }


/* ── Control language ───────────────────────────────────────────────────────
   Four idioms, and only four. Every control on every card is one of these:
     .btn            secondary action   (+ .btn--sm, .btn--icon, .btn--inherit)
     .seg / .seg-btn segmented group    — mutually exclusive modes
     .select         native <select>    (+ .select--lg)
     .btn--primary   the one commit action on a card
   Legacy class names are aliased onto these recipes rather than restyled
   per card, so markup keeps working and the palette of parts stays fixed. */
.btn,
.btn-refresh, .btn-icon, .btn-export, .bm-dropdown-btn, .btn-insight-toggle,
.grade-retake, .tax-download-btn, .stress-card-collapse, .banner-action-btn,
.today-cal-nav {
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  background:none; border:1px solid var(--border); border-radius:var(--r-sm);
  color:var(--muted); font-family:var(--font-mono); font-size:11px; font-weight:400;
  line-height:1.4; padding:5px 12px; white-space:nowrap; cursor:pointer;
  transition:border-color 0.15s, color 0.15s, background 0.15s;
}
.btn:hover,
.btn-refresh:hover, .btn-icon:hover, .btn-export:hover, .bm-dropdown-btn:hover,
.btn-insight-toggle:hover, .grade-retake:hover, .tax-download-btn:hover,
.stress-card-collapse:hover, .today-cal-nav:hover {
  border-color:var(--accent); color:var(--accent);
}
.btn:focus-visible, .btn-icon:focus-visible, .btn-refresh:focus-visible,
.seg-btn:focus-visible, .toggle-btn:focus-visible, .select:focus-visible {
  outline:2px solid var(--accent); outline-offset:1px;
}
.btn.active, .btn-insight-toggle.active {
  border-color:var(--accent); color:var(--accent);
  background:color-mix(in srgb, var(--accent) 10%, transparent);
}
.btn:disabled, .btn-icon:disabled, .today-cal-nav:disabled { opacity:0.5; cursor:not-allowed; }
/* Size + shape modifiers — the only permitted deviations */
.btn--sm, .btn-export, .bm-dropdown-btn, .stress-card-collapse, .banner-action-btn {
  font-size:10px; padding:4px 9px;
}
.btn--icon, .btn-icon, .btn-export, .btn-insight-toggle, .today-cal-nav { padding:5px 7px; gap:0; }
.btn--inherit, .banner-action-btn { border-color:currentColor; color:inherit; }
.btn--inherit:hover, .banner-action-btn:hover { border-color:currentColor; color:inherit; opacity:0.75; }

/* Segmented group — one recipe for every mode switch in the app */
.seg, .alloc-toggle { display:inline-flex; gap:2px; background:var(--bg3); border-radius:var(--r-sm); padding:2px; }
.seg-btn, .toggle-btn {
  display:inline-flex; align-items:center; justify-content:center;
  background:none; border:none; border-radius:var(--r-xs);
  color:var(--muted); font-family:var(--font-mono); font-size:10px; line-height:1;
  height:24px; padding:0 10px; white-space:nowrap; cursor:pointer;
  transition:background 0.15s, color 0.15s;
}
.seg-btn:hover, .toggle-btn:hover { color:var(--text); }
.seg-btn.active, .toggle-btn.active { background:var(--bg2); color:var(--text); font-weight:500; }

/* One select recipe (.select--lg is the form-field size used on the Tax tab) */
.select, .period-select, .tax-select {
  background:var(--bg3); border:1px solid var(--border); border-radius:var(--r-sm);
  color:var(--text); font-family:var(--font-mono); font-size:11px;
  padding:5px 10px; cursor:pointer; transition:border-color 0.15s, box-shadow 0.15s;
}
.select:hover, .period-select:hover, .tax-select:hover { border-color:var(--accent); }
.select:focus, .period-select:focus, .tax-select:focus {
  outline:none; border-color:var(--accent);
  box-shadow:0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}
.select--lg, .tax-select {
  font-size:12px; padding:8px 28px 8px 12px; min-width:180px;
  appearance:none; -webkit-appearance:none;
}

/* One primary. Solid accent, never a gradient. */
.btn--primary, .grade-submit-btn, .tax-generate-btn {
  display:inline-flex; align-items:center; justify-content:center;
  background:var(--accent); color:var(--bg); border:none; border-radius:var(--r-sm);
  font-family:var(--font-display); font-weight:700; font-size:13px;
  padding:10px 24px; cursor:pointer; letter-spacing:0.02em; transition:filter 0.15s;
}
.btn--primary:hover, .grade-submit-btn:hover, .tax-generate-btn:hover { filter:brightness(1.12); }
.btn--primary:disabled, .tax-generate-btn:disabled { opacity:0.5; cursor:not-allowed; filter:none; }

.header { display:flex; flex-direction:column; border-bottom:1px solid var(--border); background:var(--bg2); position:sticky; top:2px; z-index:10; }
.header-row { display:flex; align-items:center; justify-content:space-between; padding:14px 32px; }

/* ── Tab bar ────────────────────────────────────────────────────────────────── */
.tab-bar { display:flex; gap:0; padding:0 32px; }
.tab-btn { background:none; border:none; border-bottom:2px solid transparent; color:var(--muted); font-family:var(--font-mono); font-size:11px; padding:8px 16px 10px; cursor:pointer; transition:all 0.15s; letter-spacing:0.04em; }
.tab-btn:hover { color:var(--text); }
.tab-btn.active { color:var(--text); font-weight:500; border-bottom-color:var(--accent); }

/* ── Tab panes ──────────────────────────────────────────────────────────────── */
.tab-pane { display:none; flex-direction:column; gap:20px; }
.tab-pane.active { display:flex; }

/* ── Insight collapsible cards ────────────────────────────────────────────────
   One chevron idiom, whole header row is the target, and a collapsed card is
   never a blank bar — it carries its own headline figure. */
.insight-collapsible .insight-collapsible-body { overflow:hidden; transition:max-height 0.3s ease, opacity 0.2s ease; }
.insight-collapsible.collapsed .insight-collapsible-body { max-height:0 !important; opacity:0; }
.insight-collapsible:not(.collapsed) .insight-collapsible-body { max-height:none; opacity:1; }
.insight-collapsible.collapsed .card-header { margin-bottom:0; }
.insight-head { cursor:pointer; user-select:none; border-radius:var(--r-sm); transition:color 0.15s; }
.insight-head:focus-visible { outline:2px solid var(--accent); outline-offset:4px; }
.insight-summary { flex:1; min-width:0; font-family:var(--font-mono); font-size:11px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.insight-chevron { flex-shrink:0; color:var(--muted); font-size:11px; line-height:1; transition:transform 0.2s, color 0.15s; }
.insight-head:hover .insight-chevron, .insight-head:hover .insight-summary { color:var(--text); }
.insight-collapsible:not(.collapsed) .insight-chevron { transform:rotate(90deg); }
.logo { display:flex; align-items:center; gap:8px; }
.logo-img { width:30px; height:30px; object-fit:contain; display:block; }
.logo-text { font-family:var(--font-display); font-weight:700; font-size:23px; letter-spacing:-0.015em; }
.header-center { display:flex; gap:28px; }
.stat { text-align:center; }
.stat-label { font-size:10px; color:var(--muted); text-transform:uppercase; letter-spacing:0.06em; }
.stat-value { font-family:var(--font-display); font-size:18px; font-weight:700; margin-top:2px; }
.positive { color:var(--green); }
.negative { color:var(--red); }
.header-right { display:flex; align-items:center; gap:12px; }

.perf-controls { display:flex; align-items:center; justify-content:flex-end; gap:8px; flex-wrap:wrap; }
#performanceChart { cursor: crosshair; }
/* Overlays menu — benchmarks + trade markers, on the chart they affect */
.bm-dropdown-wrap { position:relative; }
.bm-dropdown-btn svg { width:8px; height:8px; transition:transform 0.15s; }
.bm-dropdown-wrap.open .bm-dropdown-btn svg { transform:rotate(180deg); }
.bm-dropdown-menu { display:none; position:absolute; top:calc(100% + 4px); right:0; background:var(--bg2); border:1px solid var(--border); border-radius:6px; padding:4px 0; min-width:160px; z-index:20; box-shadow:0 4px 12px rgba(0,0,0,0.4); }
.bm-dropdown-wrap.open .bm-dropdown-menu { display:block; }
.bm-dropdown-item { display:flex; align-items:center; gap:8px; padding:6px 12px; cursor:pointer; transition:background 0.1s; font-size:10px; color:var(--muted); white-space:nowrap; }
.bm-dropdown-item:hover { background:var(--bg3); }
.bm-dropdown-item .bm-check { width:14px; height:14px; border:1px solid var(--border); border-radius:3px; display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:all 0.15s; }
.bm-dropdown-item.active .bm-check { border-color:currentColor; background:currentColor; }
.bm-dropdown-item.active .bm-check::after { content:'✓'; font-size:9px; color:var(--bg); }
.bm-dropdown-item .bm-swatch { width:16px; height:2px; flex-shrink:0; }
.bm-dropdown-sep { height:1px; background:var(--border); margin:4px 0; }
.bm-dropdown-item[data-benchmark="sp500"] { color:var(--bm-sp500); }
.bm-dropdown-item[data-benchmark="eurostoxx"] { color:var(--bm-eurostoxx); }
.bm-dropdown-item[data-benchmark="nasdaq"] { color:var(--bm-nasdaq); }
.btn-refresh { position:relative; padding-right:16px; }
.refresh-glyph { line-height:1; }
/* Reserve the wider label's width so the header does not shift on 'Syncing…' */
.refresh-label { display:inline-block; min-width:56px; text-align:left; }

/* Freshness light on the Refresh button: green = fresh, red = stale, pulsing = syncing */
.status-dot { width:6px; height:6px; border-radius:50%; background:var(--dim); position:absolute; top:5px; right:5px; transition:background 0.3s, box-shadow 0.3s; }
.status-dot.fresh { background:var(--green); box-shadow:0 0 4px var(--green); }
.status-dot.stale { background:var(--red); box-shadow:0 0 4px var(--red); }
.status-dot.loading { background:var(--accent); animation:pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ── Skeleton shimmer for late-loading widgets ────────────────────────────── */
.skeleton { position:relative; overflow:hidden; background:var(--bg3); border-radius:8px; min-height:80px; }
.skeleton > * { visibility:hidden; }
@media (prefers-reduced-motion: no-preference) {
  .skeleton::after { content:''; position:absolute; inset:0; background:linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 6%, transparent), transparent); animation:shimmer 1.4s infinite; }
  @keyframes shimmer { from { transform:translateX(-100%); } to { transform:translateX(100%); } }
}
@keyframes spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }

/* ── Refreshing state ───────────────────────────────────────────────────────
   A sync takes seconds and does not blank the screen, so the old cue was a 6px
   dot no one was looking at. Three signals now, all driven by body.is-refreshing:
   the accent hairline becomes an indeterminate bar, the Refresh button says what
   it is doing, and a shimmer sweeps the cards whose numbers are about to change
   while the figures themselves sit back at reduced opacity. Content stays
   readable throughout — this is "these figures are being replaced", not "there
   is nothing here yet" (that is .skeleton, above). */
body.is-refreshing .btn-refresh { border-color:var(--accent); color:var(--accent); cursor:progress; }
/* :disabled must not grey out the one control that is reporting progress */
.btn-refresh:disabled { opacity:1; cursor:progress; }

/* The data recedes while it is being replaced. Static, not pulsing: a sync can
   run 20s+ and a blinking chart reads as broken rather than busy. Card headers
   and their controls keep full contrast — they still work. */
body.is-refreshing #headerStats .stat-value,
body.is-refreshing #headerStats .stat-sub,
body.is-refreshing .tab-pane.active .chart-wrap,
body.is-refreshing .tab-pane.active .positions-table tbody,
body.is-refreshing .tab-pane.active .perf-footline,
body.is-refreshing .tab-pane.active .alloc-viz,
body.is-refreshing .tab-pane.active .stat-value {
  opacity:0.55;
}
#headerStats .stat-value, #headerStats .stat-sub,
.tab-pane .chart-wrap, .positions-table tbody, .perf-footline, .alloc-viz, .stat-value {
  transition:opacity 0.25s ease;
}

@media (prefers-reduced-motion: no-preference) {
  /* The 2px accent hairline under the window chrome becomes the progress bar */
  body.is-refreshing::before {
    background:linear-gradient(90deg, transparent 0%, var(--accent) 45%, var(--accent) 55%, transparent 100%);
    background-size:45% 100%;
    background-repeat:no-repeat;
    opacity:1;
    animation:refresh-bar 1.15s ease-in-out infinite;
  }
  @keyframes refresh-bar { from { background-position:-45% 0; } to { background-position:145% 0; } }

  body.is-refreshing .refresh-glyph { display:inline-block; animation:spin 0.9s linear infinite; }

  /* Shimmer sweep across the data surfaces. Painted as a background layer on the
     element itself rather than an ::after overlay, so nothing needs a stacking
     context and no absolutely-positioned child (chart reset, dropdown menus)
     moves a pixel. */
  body.is-refreshing #headerStats,
  body.is-refreshing .tab-pane.active .card {
    background-image:linear-gradient(
      100deg,
      transparent 0%,
      color-mix(in srgb, var(--text) 8%, transparent) 45%,
      color-mix(in srgb, var(--text) 8%, transparent) 55%,
      transparent 100%);
    background-size:220% 100%;
    background-repeat:no-repeat;
    border-radius:var(--card-radius);
    animation:refresh-sweep 1.5s linear infinite;
  }
  @keyframes refresh-sweep { from { background-position:-120% 0; } to { background-position:220% 0; } }
}

.loading-screen { display:flex; flex-direction:column; align-items:center; justify-content:center; min-height:60vh; gap:16px; }
.loading-spinner { width:40px; height:40px; border:2px solid var(--border); border-top-color:var(--accent); border-radius:50%; animation:spin 0.8s linear infinite; }
/* Error state: the sync failed and there is nothing cached to fall back on.
   The spinner and progress bar go — a spinner that never stops reads as a hang,
   not as a message — leaving the reason and the warning hue. */
.loading-screen--error .loading-spinner,
.loading-screen--error .progress-bar-wrap,
.loading-screen--error .progress-label { display:none; }
.loading-screen--error #loadingText { color:var(--warn); max-width:46ch; text-align:center; }

/* Cards hidden behind the "no positions" zero state. A class, not inline styles,
   so one classList.remove puts the whole dashboard back. */
#mainContent.zero-state .card { display:none; }

.main { padding:24px 28px; display:flex; flex-direction:column; gap:20px; }

.grid-top { display:grid; grid-template-columns:2fr 1fr; gap:20px; }
.card { background:var(--bg2); border:none; border-radius:12px; padding:24px; }
.card-header { margin-bottom:20px; display:flex; align-items:center; justify-content:space-between; gap:12px; }
.card-title { font-family:var(--font-display); font-size:14px; font-weight:700; }
.card-subtitle { font-size:11px; color:var(--muted); flex:1; }
.card-subtitle.positive { color:var(--green); }
.card-subtitle.negative { color:var(--red); }

.chart-wrap { height:340px; position:relative; }

/* ── Allocation card: segmented bar + ranked rows + drill-down ─────────────── */
.alloc-viz { display:flex; flex-direction:column; gap:14px; }
.alloc-stackbar { display:flex; height:14px; border-radius:7px; overflow:hidden; gap:2px; background:var(--bg3); }
.alloc-seg { display:block; height:100%; min-width:3px; transition:width 0.3s ease; }
.alloc-rows { display:flex; flex-direction:column; gap:7px; max-height:300px; overflow-y:auto; }
.alloc-row { display:grid; grid-template-columns:8px 1fr 80px 44px 10px; align-items:center; gap:10px; font-size:11px; }
.alloc-row-name { color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.alloc-row-bar-wrap { height:5px; background:var(--bg3); border-radius:3px; overflow:hidden; }
.alloc-row-bar { display:block; height:100%; border-radius:3px; }
.alloc-row-pct { color:var(--muted); text-align:right; font-family:var(--font-mono); }
.alloc-row-chev { color:var(--dim); text-align:right; }
.alloc-row--drillable { cursor:pointer; }
.alloc-row--drillable:hover .alloc-row-name { color:var(--accent); }
.alloc-row--drillable:hover .alloc-row-chev { color:var(--accent); }
.alloc-drill-head { display:flex; align-items:center; gap:10px; }
.alloc-drill-title { font-family:var(--font-display); font-weight:700; font-size:12px; }
.alloc-callout { border-left:2px solid var(--accent); padding:8px 12px; font-size:11px; color:var(--muted); cursor:pointer; background:color-mix(in srgb, var(--accent) 6%, transparent); border-radius:0 6px 6px 0; transition:color 0.15s; }
.alloc-callout:hover { color:var(--text); }
/* Performance metrics: one quiet line under the chart instead of five cards
   behind a lightbulb toggle, with a single info popover instead of four */
.perf-footline { display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-family:var(--font-mono); font-size:11px; color:var(--muted); border-top:1px solid var(--border); margin-top:14px; padding-top:12px; }
.pf-item { white-space:nowrap; }
/* Colour key for the daily-mode benchmark figures — same 16×2 bar as the
   Overlays menu swatch, so the two read as the same legend. */
.pf-swatch { display:inline-block; width:16px; height:2px; vertical-align:middle; margin-right:5px; flex-shrink:0; }
.pf-item b { color:var(--text); font-weight:600; }
.pf-item b.positive { color:var(--green); }
.pf-item b.negative { color:var(--red); }
.pf-sep { color:var(--dim); }
.pf-note { font-style:italic; opacity:0.75; }
/* Each figure explains itself on hover */
.pf-item[data-tip] { cursor:help; transition:color 0.15s; }
.pf-item[data-tip]:hover { color:var(--text); }
/* Reset-zoom lives inside the plot, and only while a zoom is active */
.chart-reset { position:absolute; top:6px; right:8px; z-index:4; background:color-mix(in srgb, var(--bg2) 88%, transparent); }
.legend-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.positions-table { width:100%; border-collapse:collapse; font-size:12px; }
.positions-table th { text-align:left; color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:0.06em; padding:8px 12px; border-bottom:1px solid var(--border); }
.positions-table td { padding:10px 12px; border-bottom:1px solid var(--bg3); }
.positions-table tr:last-child td { border-bottom:none; }
.positions-table tr:hover td { background:var(--bg3); }
.td-name { font-family:var(--font-display); font-weight:600; }
.td-currency { color:var(--muted); }
.td-value { font-weight:600; }
.td-vol { font-size: 11px; letter-spacing: 0.02em; color: var(--muted); }

/* ── Positions table 2.0 ────────────────────────────────────────────────────── */
#positionsTabToggle { margin-left:auto; }
.pos-chip { width:26px; height:26px; border-radius:7px; display:inline-flex; align-items:center; justify-content:center; font-family:var(--font-display); font-weight:700; font-size:10px; letter-spacing:0.02em; margin-right:10px; flex-shrink:0; }
#positionsBody .td-name { display:flex; align-items:center; }
.pos-name-wrap { min-width:0; display:inline-block; }
.pos-name { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pos-sub { display:block; font-size:10px; font-weight:400; color:var(--muted); font-family:var(--font-mono); margin-top:1px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.td-weight { white-space:nowrap; }
.weight-pct { display:block; font-size:12px; }
.weight-bar-wrap { display:block; width:56px; height:4px; background:var(--bg3); border-radius:2px; margin-top:3px; overflow:hidden; }
.weight-bar { display:block; height:100%; border-radius:2px; background:var(--accent); }
.td-spark .pos-spark { display:block; }
.spark-none { color:var(--dim); }
.pl-pill { display:inline-block; padding:2px 8px; border-radius:999px; font-weight:600; font-size:11px; }
.pl-pill.positive { color:var(--green); background:color-mix(in srgb, var(--green) 12%, transparent); }
.pl-pill.negative { color:var(--red); background:color-mix(in srgb, var(--red) 12%, transparent); }

/* Expanded row + in-place detail row */
tr.pos-row--expanded td { background:var(--bg3); }
tr.pos-row--expanded td:first-child { box-shadow:inset 3px 0 0 var(--accent); }
.pos-detail-row > td { padding:0; }
/* Detail rows are not hoverable rows — beat .positions-table tr:hover td */
.positions-table tr.pos-detail-row td, .positions-table tr.pos-detail-row:hover td { background:transparent; cursor:default; }
.pos-detail { position:relative; padding:18px 20px; background:var(--bg2); border-bottom:1px solid var(--border); }
/* Dismiss control, pinned top-right of the expanded row */
.pos-detail-close { position:absolute; top:10px; right:12px; z-index:2; width:24px; height:24px; display:flex; align-items:center; justify-content:center; background:none; border:none; border-radius:5px; color:var(--muted); font-size:18px; line-height:1; cursor:pointer; transition:color 0.15s, background 0.15s; }
.pos-detail-close:hover { color:var(--text); background:var(--bg3); }
.pos-detail-close:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
/* Keep the stat grid clear of the close button */
.pos-detail-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(130px, 1fr)); gap:14px; margin-bottom:14px; padding-right:28px; }
.pos-detail-label { font-size:9px; text-transform:uppercase; letter-spacing:0.08em; color:var(--muted); margin-bottom:4px; }
.pos-detail-value { font-family:var(--font-display); font-size:16px; font-weight:700; }
.pos-detail-actions { display:flex; gap:8px; margin-bottom:12px; }
.pos-detail-chart { height:220px; position:relative; margin-top:8px; }

/* CSV export button */
.btn-export { flex-shrink: 0; margin-left: auto; opacity: 0.8; }
.btn-export:hover { opacity: 1; }
.btn-export svg { display: block; }
.btn-export--locked { opacity: 0.45; }
.btn-export--locked:hover { opacity: 1; color: var(--gold); border-color: var(--gold); }

::-webkit-scrollbar { width:4px; } ::-webkit-scrollbar-track { background:var(--bg); } ::-webkit-scrollbar-thumb { background:var(--border); border-radius:2px; }


/* Movers, as chips on the card they link into */
.movers-chips { display:flex; align-items:center; gap:6px; flex-wrap:wrap; min-width:0; margin:-6px 0 14px; }
.movers-chips:empty { display:none; }
.movers-chips-label { font-size:9px; text-transform:uppercase; letter-spacing:0.07em; color:var(--muted); flex-shrink:0; }
.mover-chip { display:inline-flex; align-items:center; gap:5px; background:var(--bg3); border:none; border-radius:var(--r-pill); padding:3px 10px; font-family:var(--font-mono); font-size:10px; color:var(--muted); cursor:pointer; white-space:nowrap; transition:background 0.15s, color 0.15s; }
.mover-chip:hover { background:var(--border); color:var(--text); }
.mover-chip b { font-weight:600; }

.progress-bar-wrap { width:260px; height:4px; background:var(--border); border-radius:2px; margin:12px auto 6px; overflow:hidden; }
.progress-bar { height:100%; width:0%; background:var(--accent); border-radius:2px; transition:width 0.3s ease; }
.progress-label { font-size:11px; color:var(--muted); font-family:var(--font-mono); margin:0; text-align:center; }

.stat[data-chartmode]:hover { background: color-mix(in srgb, var(--bg3) 40%, transparent); border-radius: 6px; }
.stat[data-chartmode]:hover .stat-label::after { content: ' ↗'; opacity: 0.5; }
#statPositions:hover { background: color-mix(in srgb, var(--bg3) 40%, transparent); border-radius: 6px; }
#statPositions:hover .stat-label::after { content: ' ↻'; opacity: 0.5; }


/* Secondary line under a header stat (cash %, daily %) — always visible */
.stat-sub { font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin-top: 2px; letter-spacing: 0.02em; }
.stat-sub.positive { color: var(--green); opacity: 0.85; }
.stat-sub.negative { color: var(--red); opacity: 0.85; }

/* Sortable positions table headers */
#positionsTable thead th,
#watchlistTable thead th { cursor: pointer; user-select: none; white-space: nowrap; }
#positionsTable thead th:hover,
#watchlistTable thead th:hover { color: var(--text); }
#positionsTable thead th.sort-active,
#watchlistTable thead th.sort-active { color: var(--accent); }

/* Privacy mode — eye button + sensitive value masking */
.btn-icon.active { border-color: var(--muted); color: var(--muted); opacity: 0.5; }
.btn-icon.active svg { opacity: 0.5; }

/* Sensitive values: blurred by default in privacy mode, revealed on hover of their parent */
body.privacy-mode .sensitive {
  filter: blur(6px);
  user-select: none;
  transition: filter 0.2s;
}
body.privacy-mode .stat:hover .sensitive,
body.privacy-mode tr:hover .sensitive {
  filter: blur(0);
}

/* TWR stat — tooltip handled via JS floating div to escape sticky stacking context */
.stat--twr { position: relative; cursor: default; }
.perf-chart-wrap { position: relative; }

/* ── More Info / Portfolio Insights card ──────────────────────── */
/* Lives inside the Pulse card now — the card supplies the padding */
.more-info-content { padding: 0; }
.more-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.more-info-stat {
  background: var(--bg3);
  border: none;
  border-radius: 10px;
  padding: 14px 16px;
}
.more-info-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}
.more-info-stat-value {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}
.more-info-stat-sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}
.more-info-note {
  font-size: 10px;
  color: var(--muted);
  margin-top: 14px;
  line-height: 1.6;
  opacity: 0.7;
}

/* ── More info stat custom tooltip ────────────────────────────── */
.more-info-stat--tip {
  position: relative;
  cursor: default;
}

/* ── Clickable insight stats with chart expand ──────────────────── */
.more-info-stat--clickable { cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.more-info-stat--clickable:hover { border-color: var(--accent); }
.more-info-stat--clickable .more-info-stat-label::after { content: ' ▸'; font-size: 9px; opacity: 0.5; }
.more-info-stat--active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.more-info-stat--active .more-info-stat-label::after { content: ' ▾'; font-size: 9px; opacity: 0.8; }

.more-info-chart-wrap { height: 220px; padding: 12px 0 4px; }

/* ── Footer ─────────────────────────────────────────────────────── */
.dashboard-footer {
  text-align: center;
  padding: 12px 28px;
  color: var(--dim);
  font-size: 10px;
  border-top: none;
  margin-top: 0;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.footer-link {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}
.footer-link:hover { color: var(--text); }

.portfolio-warning { display:flex; align-items:center; gap:12px; background: color-mix(in srgb, var(--warn) 12%, var(--bg2)); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); border-radius: var(--r-md); color: var(--warn); font-size: 11px; padding: 8px 16px; line-height: 1.5; margin-bottom: 4px; }
.banner-action-btn { margin-left:auto; flex-shrink:0; }

/* Review ask — same banner geometry as the staleness warning, accent instead
   of warn: this is an invitation, not a problem. Shown once, then retired. */
.review-prompt { display:flex; align-items:center; gap:12px; background: color-mix(in srgb, var(--accent) 8%, var(--bg2)); border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent); border-radius: var(--r-md); color: var(--text); font-size: 11px; padding: 8px 16px; line-height: 1.5; margin-bottom: 4px; }
.review-prompt-text { flex:1; }
.review-prompt .btn { flex-shrink:0; text-decoration:none; }

/* ── Portfolio Pulse ─────────────────────────────────────────────── */
.pulse-list { display:flex; flex-direction:column; gap:10px; margin-top:16px; }
.pulse-row { display:flex; align-items:flex-start; gap:12px; background:var(--bg3); border-radius:8px; padding:12px 14px; }
.pulse-stripe { width:3px; align-self:stretch; border-radius:2px; flex-shrink:0; background:var(--border); }
.pulse-row--warn .pulse-stripe { background:var(--warn); }
.pulse-row--info .pulse-stripe { background:var(--accent); }
.pulse-row--good .pulse-stripe { background:var(--green); }
.pulse-text { flex:1; min-width:0; }
.pulse-title { font-family:var(--font-display); font-weight:700; font-size:13px; }
.pulse-body { color:var(--muted); font-size:11px; line-height:1.55; margin-top:2px; }
.pulse-action { background:none; border:none; color:var(--accent); font-family:var(--font-mono); font-size:11px; cursor:pointer; padding:0; margin-left:auto; white-space:nowrap; align-self:center; flex-shrink:0; }
.pulse-action:hover { text-decoration:underline; }

/* ── Dividends tab ──────────────────────────────────────────────── */
.div-next-estimate { border-top:1px solid var(--border); margin-top:14px; padding-top:12px; }
.div-next-head { font-size:10px; color:var(--muted); text-transform:uppercase; letter-spacing:0.06em; margin-bottom:8px; opacity:0.8; }
.div-next-row { display:flex; align-items:baseline; gap:10px; padding:5px 0; font-size:11px; border-bottom:1px solid var(--bg3); }
.div-next-row:last-child { border-bottom:none; }
.div-next-name { font-family:var(--font-display); font-weight:600; color:var(--text); flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.div-next-date { color:var(--muted); white-space:nowrap; font-family:var(--font-mono); }
.div-next-amt { font-weight:600; color:var(--green); white-space:nowrap; font-family:var(--font-mono); }

/* ── Correlation Matrix ─────────────────────────────────────────── */
.correlation-wrap { overflow-x: auto; padding: 8px 0 16px; }
/* Table stretches to fill the card; fixed layout so all N data columns share equal width */
.correlation-table { border-collapse: collapse; font-size: 10px; font-family: var(--font-mono); width: 100%; table-layout: fixed; }
/* Base header styles */
.correlation-table th { color: var(--muted); font-weight: 500; font-size: 9px; letter-spacing: 0.04em; padding: 0; }
/* Column header cells: -45° diagonal text — standard heatmap pattern, far more legible than vertical */
.correlation-table th.col-header-cell { padding: 0 2px; vertical-align: bottom; overflow: visible; }
.correlation-table .col-label-outer { position: relative; height: 110px; }
.correlation-table .col-label-text { position: absolute; bottom: 8px; left: 50%; transform: rotate(-45deg); transform-origin: 0% 100%; white-space: nowrap; font-size: 10px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
/* Row-label column: fixed width so data columns get all the remaining space */
.correlation-table th.row-label { text-align: right; vertical-align: middle; padding-right: 10px; width: 120px; min-width: 80px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10px; font-weight: 600; color: var(--muted); }
/* Data cells expand to fill their column */
.correlation-table td { height: 38px; text-align: center; font-size: 10px; font-weight: 600; border: 1px solid rgba(0,0,0,0.18); cursor: default; transition: opacity 0.15s; position: relative; }
.correlation-table td:hover { opacity: 0.82; outline: 2px solid var(--text); outline-offset: -2px; z-index: 1; }
.correlation-table td.corr-diag { opacity: 0.5; }
.floating-tip { position: fixed; z-index: 9999; display: none; max-width: 280px; padding: 10px 14px; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; white-space: normal; text-align: left; text-transform: none; letter-spacing: 0; font-family: var(--font-mono); font-size: 11px; font-weight: 400; line-height: 1.6; color: var(--muted); pointer-events: none; box-shadow: 0 6px 24px #00000088; }
[data-theme="light"] .floating-tip { box-shadow: 0 6px 24px rgba(0,0,0,0.18); }

.corr-tooltip { position: fixed; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; font-size: 11px; font-family: var(--font-mono); color: var(--text); pointer-events: none; z-index: 1000; white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,0.5); display: none; line-height: 1.6; }
/* Info tooltip for the title — wraps prose, wider than cell tooltips */
.corr-tooltip.corr-tooltip--info { white-space: normal; max-width: 300px; }
/* Make the card title the hover target; padding enlarges the hit area */
#corrInfoIcon { cursor: default; padding: 4px 6px; margin: -4px -6px; border-radius: 4px; transition: color 0.15s; }
#corrInfoIcon:hover { color: var(--text); }
/* WAC + PCA stat boxes: stretch so both match height */
.corr-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; align-items: stretch; }
/* Pair extremes rows inside WAC box: icon · value · names */
.corr-extreme-row { display: flex; align-items: baseline; gap: 8px; margin-top: 7px; font-family: var(--font-mono); }
.corr-extreme-icon { flex: 0 0 auto; font-size: 13px; color: var(--muted); opacity: 0.7; }
.corr-extreme-rho { flex: 0 0 auto; font-size: 16px; font-weight: 700; font-family: var(--font-display); }
.corr-extreme-names { flex: 1 1 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) { .corr-stats-grid { grid-template-columns: 1fr; } }
/* PCA loading bars */
.pca-loadings-header { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 10px; margin-bottom: 4px; opacity: 0.7; }
/* Grid: name col = widest name across all rows (max-content), bar fills rest, value fixed */
.pca-loadings { display: grid; grid-template-columns: max-content 1fr 36px; column-gap: 8px; row-gap: 5px; align-items: center; }
/* display:contents makes children direct grid items — every bar snaps to the same column */
.pca-loading-row { display: contents; }
.pca-loading-name { white-space: nowrap; font-size: 10px; font-family: var(--font-mono); color: var(--muted); }
.pca-loading-bar-outer { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.pca-loading-bar-inner { display: block; height: 100%; background: var(--muted); border-radius: 3px; }
.pca-loading-val { text-align: right; font-size: 9px; font-family: var(--font-mono); color: var(--muted); }

/* ── Portfolio Grade / Rate My Portfolio ───────────── */
.grade-survey { padding: 16px 20px 20px; }
.grade-survey-intro { font-size: 12px; color: var(--muted); line-height: 1.6; margin-bottom: 20px; }
.grade-sliders { display: flex; flex-direction: column; gap: 20px; }

.grade-slider-row { background: var(--bg3); border: none; border-radius: 10px; padding: 14px 18px 12px; }
.grade-slider-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.grade-slider-label { font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--text); }
.grade-slider-value { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--accent); min-width: 28px; text-align: right; }
.grade-slider-anchors { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-bottom: 8px; letter-spacing: 0.03em; }
.grade-slider-desc { font-size: 11px; color: var(--muted); margin-top: 6px; min-height: 16px; line-height: 1.5; }

.grade-range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; background: var(--border); border-radius: 3px; outline: none; cursor: pointer; }
.grade-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg2); cursor: pointer; transition: transform 0.15s; }
.grade-range::-webkit-slider-thumb:hover { transform: scale(1.2); }
.grade-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg2); cursor: pointer; }
.grade-range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; }

.grade-submit-btn { display: flex; width: 100%; max-width: 320px; margin: 24px auto 0; }

/* Results */
.grade-results { padding: 20px; }

/* Top row: left narrative + right metrics */
.grade-top-row { display: flex; gap: 24px; margin-bottom: 24px; }
.grade-left-col { flex: 1; min-width: 0; }
.grade-letter-row { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 16px; }
.grade-letter-wrap { flex-shrink: 0; text-align: center; }
.grade-letter { font-family: var(--font-display); font-size: 72px; font-weight: 800; line-height: 1; }
.grade-letter-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }

.grade-text-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0; }
.grade-narrative-section { font-size: 12px; color: var(--muted); line-height: 1.7; }
.grade-narrative-section strong { color: var(--text); font-weight: 600; }
.grade-improvements { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

/* Right column: key metric boxes — 4 columns × 2 rows */
.grade-metrics-col { flex-shrink: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; align-self: flex-start; width: 380px; }
.grade-metric-box { background: var(--bg3); border: none; border-radius: 8px; padding: 10px 8px; text-align: center; }
.grade-metric-value { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.grade-metric-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-top: 3px; }

/* Sub-grades */
.grade-subs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 20px; }
.grade-sub { background: var(--bg3); border: none; border-radius: 8px; padding: 12px 14px; position: relative; }
.grade-sub-name { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }
.grade-sub-letter { font-family: var(--font-display); font-size: 24px; font-weight: 700; }
.grade-sub-bar { height: 4px; background: var(--border); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.grade-sub-bar-inner { height: 100%; border-radius: 2px; transition: width 0.6s ease; }
.grade-sub-detail { font-size: 10px; color: var(--muted); margin-top: 6px; line-height: 1.5; }

.grade-retake { margin-top: 4px; }
.grade-reveal { text-align: center; padding: 20px 0 16px; }
.grade-teaser { font-size: 12px; color: var(--muted); line-height: 1.6; max-width: 420px; margin: 12px auto 0; }
.grade-gate-wrap { min-height: 200px; overflow: hidden; border-radius: 8px; }

/* Grade color helpers — smooth green → yellow → orange → red */
.grade-a-plus, .grade-a { color: #2ACA69; }
.grade-a-minus { color: #5CD87A; }
.grade-b-plus  { color: #8BE06A; }
.grade-b       { color: #B8E04A; }
.grade-b-minus { color: #D4D63A; }
.grade-c-plus  { color: #E8C832; }
.grade-c       { color: #FFB82E; }
.grade-c-minus { color: #F9972A; }
.grade-d-plus  { color: #F97316; }
.grade-d       { color: #F45D45; }
.grade-d-minus, .grade-f { color: #E05252; }

/* ── Stress Test ───────────────────────────────────── */
/* ── Value at Risk card ── */
.var-card { background: var(--bg3); border: none; border-radius: 8px; padding: 16px 20px; margin: 16px 20px 20px; }
.var-title-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.var-title { font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--text); }
.var-subtitle { font-size: 10px; color: var(--muted); font-family: var(--font-mono); }
.var-controls { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.var-toggle-group { display: flex; align-items: center; gap: 6px; }
.var-toggle-label { font-size: 10px; color: var(--muted); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; margin-right: 4px; }
.var-result { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.var-result-pct { font-family: var(--font-display); font-size: 26px; font-weight: 800; color: var(--red); letter-spacing: -0.02em; }
.var-result-desc { font-size: 11px; color: var(--muted); line-height: 1.5; }

.stress-results { padding: 16px 20px 20px; }
.stress-heading { font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 16px; }
.stress-section-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 12px; font-family: var(--font-mono); }
.stress-section-title:not(:first-child) { margin-top: 24px; }

.stress-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 900px) { .stress-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .stress-grid { grid-template-columns: 1fr; } }

.stress-card { background: var(--bg3); border: none; border-radius: 10px; overflow: hidden; transition: background 0.2s; cursor: pointer; }
.stress-card:hover { background: var(--bg3); }
.stress-card.expanded { grid-column: 1 / -1; cursor: default; }
.stress-card.expanded:hover { border-color: var(--border); }

.stress-card-header { padding: 14px 16px 12px; }
.stress-card-title { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.stress-badge { font-size: 9px; font-family: var(--font-mono); font-weight: 600; padding: 2px 6px; border-radius: 3px; letter-spacing: 0.04em; text-transform: uppercase; }
.stress-badge--historical { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.stress-badge--hypothetical { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.stress-card-period { font-size: 10px; color: var(--muted); margin-top: 3px; font-family: var(--font-mono); }

.stress-card-impact { padding: 0 16px 14px; display: flex; align-items: baseline; gap: 12px; }
.stress-impact-pct { font-family: var(--font-display); font-size: 28px; font-weight: 800; }
.stress-impact-eur { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }

.stress-card-bar { height: 3px; background: var(--border); }
.stress-card-bar-inner { height: 100%; transition: width 0.6s ease; }

/* Expanded detail view */
.stress-detail { padding: 0 16px 16px; display: none; }
.stress-card.expanded .stress-detail { display: block; }

.stress-detail-section { margin-top: 14px; }
.stress-detail-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 8px; font-family: var(--font-mono); }

.stress-positions { display: flex; flex-direction: column; gap: 6px; }
.stress-pos-row { display: flex; align-items: center; gap: 8px; font-size: 11px; font-family: var(--font-mono); }
.stress-pos-name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 180px; min-width: 180px; flex-shrink: 0; }
.stress-pos-pct { white-space: nowrap; font-weight: 600; flex-shrink: 0; }
.stress-pos-eur { white-space: nowrap; color: var(--muted); flex-shrink: 0; }
.stress-pos-source { white-space: nowrap; font-size: 9px; text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0; }
.stress-pos-source--actual { color: var(--green); }
.stress-pos-source--estimated { color: var(--muted); }
.stress-pos-bar-wrap { width: 80px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; flex-shrink: 0; }
.stress-pos-bar { height: 100%; border-radius: 2px; }

.stress-mitigations { display: flex; flex-direction: column; gap: 8px; }
.stress-mitigation { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 11px; color: var(--muted); line-height: 1.6; }
.stress-mitigation--positive { border-color: color-mix(in srgb, var(--green) 50%, transparent); }
.stress-mitigation--negative { border-color: color-mix(in srgb, var(--red) 50%, transparent); }

.stress-card-collapse { display: none; margin: 0 16px 12px; }
.stress-card.expanded .stress-card-collapse { display: inline-flex; }

/* Impact color scale */
.stress-impact--mild { color: #E8C832; }
.stress-impact--moderate { color: #F97316; }
.stress-impact--severe { color: #F45D45; }
.stress-impact--extreme { color: #E05252; }
.stress-impact--positive { color: #2ACA69; }

/* ── Individual stock chart ─────────────────────── */
.stock-chart-meta { font-size: 12px; color: var(--muted); font-family: var(--font-mono); flex: 1; }
.stock-chart-blur-wrap { filter: blur(2px); pointer-events: none; user-select: none; }
.corr-blur-wrap { filter: blur(2px); pointer-events: none; user-select: none; overflow: hidden; }
.pro-placeholder-box { height: 260px; overflow: hidden; position: relative; }

/* ── Pro button (header) ────────────────────────── */
/* PRO inline badge (next to card titles) */
.pro-badge { display: inline-block; background: color-mix(in srgb, var(--gold) 12%, transparent); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); color: var(--gold); font-family: var(--font-display); font-weight: 700; font-size: 9px; padding: 1px 5px; border-radius: var(--r-xs); margin-left: 8px; vertical-align: middle; letter-spacing: 0.06em; }

/* PRO button — the one filled control in the header, because it is the one
   control that sells something. Deliberately louder than the .btn chrome
   recipe next to it; the gradients are literal rather than tokenised so the
   gold reads as gold in the light theme too, where --gold resolves to a
   brown that all but disappears at 55% on the cream ground.
   Locked = gold (an invitation), active = the same shape in green (a status).
   Dark text on both: min contrast 6.7:1 across either gradient. */
.btn-pro { background: var(--pro-grad); border: 1px solid transparent; color: var(--pro-ink); font-family: var(--font-display); font-weight: 700; font-size: 13px; padding: 5px 16px; border-radius: var(--r-sm); cursor: pointer; letter-spacing: 0.04em; transition: filter 0.2s, box-shadow 0.2s; position: relative; overflow: hidden; z-index: 0; }
/* A specular highlight crosses the gold button once a minute — enough to catch
   the eye on a dashboard someone leaves open, not enough to nag. Only while
   locked: once PRO is active the button is a status and holds still.
   Animates transform only, so it stays on the compositor and never lays out.
   z-index -1 (against the button's own z-index:0 stacking context) puts the
   highlight above the gradient but *under* the label, so the text stays fully
   legible as the sweep crosses it. */
.btn-pro:not(.pro-active)::after {
  content: ''; position: absolute; top: -50%; bottom: -50%; left: 0; width: 40%; z-index: -1;
  background: linear-gradient(100deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%);
  transform: translateX(-250%) skewX(-18deg);
  animation: proShimmer 60s linear infinite;
  pointer-events: none;
}
@keyframes proShimmer {
  0%, 0.6% { transform: translateX(-250%) skewX(-18deg); }
  3.1%     { transform: translateX(400%)  skewX(-18deg); }
  100%     { transform: translateX(400%)  skewX(-18deg); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-pro:not(.pro-active)::after { animation: none; opacity: 0; }
}
.btn-pro:hover { filter: brightness(1.15); box-shadow: 0 2px 10px color-mix(in srgb, #FFA500 35%, transparent); }
.btn-pro.pro-active { background: var(--pro-grad-active); color: var(--pro-ink); }
.btn-pro.pro-active:hover { filter: brightness(1.12); box-shadow: 0 2px 10px color-mix(in srgb, #10B981 35%, transparent); }
.btn-pro:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Pro overlay (locks features) ───────────────── */
.pro-overlay { position: absolute; inset: 0; z-index: 5; background: rgba(10, 17, 26, 0.88); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; border-radius: 10px; }
[data-theme="light"] .pro-overlay { background: rgba(240, 237, 230, 0.88); }
.pro-overlay-content { text-align: center; padding: 32px 24px; max-width: 360px; }
.pro-overlay-icon { margin-bottom: 12px; color: var(--gold); }
.pro-overlay-icon svg { width: 32px; height: 32px; stroke: var(--gold); }
.pro-overlay-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--text); margin-bottom: 6px; }
.pro-overlay-text { font-size: 12px; color: var(--muted); margin-bottom: 18px; line-height: 1.5; white-space: nowrap; }
.pro-overlay-btn { display: block; width: 100%; padding: 10px 0; border: none; border-radius: 6px; font-family: var(--font-display); font-weight: 600; font-size: 13px; cursor: pointer; transition: all 0.2s; margin-bottom: 8px; }
.pro-overlay-btn:first-of-type { background: var(--pro-grad); color: var(--pro-ink); }
.pro-overlay-btn:first-of-type:hover { filter: brightness(1.15); box-shadow: 0 2px 10px color-mix(in srgb, #FFA500 35%, transparent); }
.pro-overlay-btn--key { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.pro-overlay-btn--key:hover { border-color: var(--accent); color: var(--accent); }

/* ── Pro license modal ──────────────────────────── */
.pro-modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; }
.pro-modal { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; width: 420px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.pro-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.pro-modal-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--text); }
.pro-modal-close { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; padding: 0 4px; transition: color 0.2s; }
.pro-modal-close:hover { color: var(--text); }
.pro-modal-body { padding: 20px; }
.pro-modal-text { font-size: 12px; color: var(--muted); line-height: 1.6; margin-bottom: 14px; }
.pro-modal-input { width: 100%; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-family: var(--font-mono); font-size: 12px; outline: none; transition: border-color 0.2s; }
.pro-modal-input:focus { border-color: var(--accent); }
.pro-modal-msg { font-size: 11px; margin-top: 8px; min-height: 16px; }
.pro-modal-msg.error { color: var(--red); }
.pro-modal-msg.success { color: var(--green); }
.pro-modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); }
.pro-modal-btn { padding: 8px 18px; border-radius: 6px; font-family: var(--font-display); font-weight: 600; font-size: 12px; cursor: pointer; transition: all 0.2s; border: none; }
.pro-modal-btn--secondary { background: var(--bg3); color: var(--muted); }
.pro-modal-btn--secondary:hover { color: var(--text); }
.pro-modal-btn--primary { background: var(--pro-grad); color: var(--pro-ink); }
.pro-modal-btn--primary:hover { filter: brightness(1.15); box-shadow: 0 2px 10px color-mix(in srgb, #FFA500 35%, transparent); }
.pro-modal-btn--primary:disabled { opacity: 0.6; cursor: not-allowed; }
/* ── Tax Report Interactive ───────────────────────────────────────────────── */

.tax-selector-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 0 24px;
  margin-bottom: 16px;
}

.tax-selector-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.tax-selector-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.tax-selector-group::after {
  content: '';
  position: absolute;
  right: 12px;
  bottom: 14px;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
  pointer-events: none;
}

.tax-select option {
  background: var(--bg2);
  color: var(--text);
}

.tax-info-box {
  background: var(--bg3);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 24px 16px;
}

.tax-generate-btn { margin: 0 24px 20px; }

.tax-summary-cards {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 24px;
  margin-bottom: 20px;
}

.tax-summary-card {
  background: var(--bg3);
  border-left: 2px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  flex: 1;
  min-width: 150px;
}

.tax-summary-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}

.tax-summary-value {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.tax-preview-wrap {
  padding: 0 24px;
}

.tax-preview-wrap .positions-table {
  margin-bottom: 0;
}

.tax-download-row {
  display: flex;
  justify-content: flex-end;
  padding: 16px 24px 0;
}

.tax-download-btn { padding: 8px 16px; }

.tax-disclaimer {
  font-size: 10px;
  color: var(--muted);
  padding: 12px 24px 20px;
  opacity: 0.6;
  line-height: 1.6;
}

.tax-persistent-disclaimer {
  font-size: 10px;
  color: var(--muted);
  padding: 0 24px 16px;
  opacity: 0.5;
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
}

.tax-empty-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--muted);
  font-size: 13px;
}

.tax-form-ref {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

.tax-section-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  padding: 16px 24px 4px;
  letter-spacing: -0.01em;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.tax-section-subtitle {
  font-size: 10px;
  color: var(--muted);
  padding: 0 24px 8px;
  line-height: 1.4;
}

.tax-notes {
  padding: 12px 24px 4px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.tax-note {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 6px;
  padding-left: 10px;
  border-left: 2px solid var(--border);
}

.tax-total-row td {
  font-weight: 700;
  border-top: 2px solid var(--border);
}

.tax-blur-wrap {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
  padding-bottom: 24px;
}

/* ── Stress test 6-month projection chart ─────────────────────────────────── */
.stress-chart-section { margin-top: 4px; }
.stress-chart-wrap {
  height: 320px;
  position: relative;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 6px 6px;
  margin-top: 6px;
  overflow: hidden;
}

/* ── Pro status modal ─────────────────────────────────────────────────── */
.pro-status-grid { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.pro-status-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pro-status-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; flex-shrink: 0; }
.pro-status-val { font-family: var(--font-display); font-size: 13px; font-weight: 600; text-align: right; }
.pro-status-active { color: var(--green); }

/* ── Today tab ──────────────────────────────────────────────────────── */
.today-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.today-status-inline {
  display: flex; align-items: center; gap: 10px;
  font-size: 10px; color: var(--muted); white-space: nowrap;
}
.today-date-picker-wrap {
  position: relative;
}
.today-date-btn {
  min-width: 0;
  max-width: 200px;
  text-align: left;
  padding-right: 22px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.today-date-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.today-date-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  min-width: 232px;
  padding: 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.today-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.today-cal-title-row {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.today-cal-month {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}
.today-cal-year-select {
  min-width: 72px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
}
.today-cal-nav { flex-shrink: 0; width: 28px; height: 28px; padding: 0; font-size: 16px; line-height: 1; }
.today-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
  font-size: 9px;
  font-weight: 600;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}
.today-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.today-cal-cell--pad {
  aspect-ratio: 1;
  min-height: 28px;
}
.today-cal-day {
  aspect-ratio: 1;
  min-height: 28px;
  min-width: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: var(--bg3);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
}
.today-cal-day:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.today-cal-day.is-selected {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.today-cal-day:disabled {
  background: transparent;
  color: var(--dim);
  opacity: 0.35;
  cursor: default;
}
.today-status-inline .today-market-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.today-status-inline .today-market-dot.open { background: var(--green); box-shadow: 0 0 5px var(--green); }
.today-status-inline .today-market-dot.closed { background: var(--muted); }
.today-status-inline .today-sep { color: var(--dim); }

/* Day total — the one number the tab is about, promoted into the header
   slot the old restating subtitles were using */
.today-total { display: flex; align-items: baseline; gap: 8px; margin-right: auto; }
.today-total-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.today-total-value { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.today-total-pct { font-family: var(--font-mono); font-size: 11px; opacity: 0.8; }
.today-view { min-width: 0; }

#todayTable thead th { cursor: pointer; user-select: none; white-space: nowrap; }
#todayTable thead th:hover { color: var(--text); }
#todayTable thead th.sort-active { color: var(--accent); }

.today-stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px; padding: 16px 20px;
}
.today-stats-item { display: flex; flex-direction: column; gap: 2px; }
.today-stats-item .ts-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.today-stats-item .ts-value { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.today-stats-item .ts-detail { font-size: 11px; color: var(--muted); }

/* ── Watchlist tab ───────────────────────────────────────────────────── */
#watchlistEmpty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
#watchlistEmpty .wl-empty-icon { font-size: 32px; margin-bottom: 12px; }
#watchlistEmpty .wl-empty-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
#watchlistEmpty .wl-empty-desc { font-size: 12px; line-height: 1.6; }
#watchlistTable .wl-star { color: var(--accent); margin-right: 6px; font-size: 10px; }
#watchlistTable td.positive { color: var(--green); }
#watchlistTable td.negative { color: var(--red); }
.wl-chart-return { padding: 4px 20px 8px; font-family: var(--font-display); }
.wl-chart-return .wl-ret-value { font-size: 28px; font-weight: 700; }
.wl-chart-return .wl-ret-label { font-size: 11px; color: var(--muted); margin-left: 8px; }

/* ── Portfolio Heatmap (treemap) ──────────────────────────────────────── */
.shm-container { padding: 0; overflow: hidden; }
.shm-block {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2px; margin: 0; border-radius: 0; font: inherit; overflow: hidden; cursor: pointer;
  border: 1px solid var(--bg2);
  transition: filter 0.15s;
}
.shm-block:hover { filter: brightness(1.3); z-index: 2; }
.shm-block:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; z-index: 2; }
.shb-name {
  font-size: 9px; color: var(--text); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 100%; line-height: 1.2; text-align: center;
}
.shb-pct { font-size: 12px; font-weight: 700; color: #fff; white-space: nowrap; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
[data-theme="light"] .shb-pct { color: #111827; text-shadow: none; }
.shm-group-label {
  position: absolute; display: flex; align-items: center; height: 16px;
  padding: 0 5px; font-size: 9px; font-weight: 600;
  color: var(--text); text-transform: uppercase; letter-spacing: 0.04em;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  white-space: nowrap; overflow: hidden; z-index: 4;
  pointer-events: none;
}
.shm-group-border {
  position: absolute; border: 1.5px solid var(--bg); border-radius: 1px;
  pointer-events: none; z-index: 3;
}
.shm-tooltip {
  position: absolute; display: none; z-index: 9999;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; font-size: 11px; color: var(--text); line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5); pointer-events: none;
  white-space: nowrap;
}

/* ── Watchlist vs Portfolio Comparison ────────────────────────────────── */
.wl-comparison-stats {
  display: flex; gap: 24px; padding: 10px 20px 14px; flex-wrap: wrap;
}
.wl-comp-item { display: flex; flex-direction: column; gap: 2px; }
.wl-comp-item .wl-comp-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.wl-comp-item .wl-comp-value { font-family: var(--font-display); font-size: 16px; font-weight: 700; }

/* ── Watchlist table: Corr. + Signal columns ─────────────────────────── */
#watchlistTable .signal-bullish { color: var(--green); }
#watchlistTable .signal-bearish { color: var(--red); }
#watchlistTable .signal-neutral { color: var(--muted); }
#watchlistTable .corr-high { color: var(--accent); }
#watchlistTable .corr-low { color: var(--muted); }

/* ── Header tooltip ──────────────────────────────────────────────────── */
.th-with-tip {
  position: relative; cursor: help;
  border-bottom: 1px dotted var(--muted);
}

/* Today: observed portfolio pulse and live contribution ranking. */
.today-live-grid { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); border-top:1px solid var(--border); margin-top:20px; padding-top:20px; gap:24px; }
.today-live-grid[hidden] { display:none; }
.today-live-panel { min-width:0; }
.today-live-panel + .today-live-panel { border-left:1px solid var(--border); padding-left:24px; }
.today-live-head { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px; min-height:30px; margin-bottom:12px; }
.today-live-head h3 { font:600 16px var(--font-display); margin:0; }
.today-live-status { font-size:10px; color:var(--muted); }
.today-live-status[data-state="connected"] { color:var(--green); }
.today-live-summary { display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; min-height:46px; }
.today-live-total { font:600 30px var(--font-display); font-variant-numeric:tabular-nums; }
.today-live-caption { color:var(--muted); font-size:10px; margin:0 0 8px; }
.today-live-chart { height:240px; position:relative; }
.today-live-empty { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; text-align:center; padding:24px; color:var(--muted); font-size:11px; background:var(--bg2); }
.today-live-empty[hidden] { display:none; }
.today-live-footer { color:var(--muted); font-size:10px; min-height:30px; margin-top:10px; }
.today-live-contributors { position:relative; min-height:0; transition:height 400ms; }
.today-live-row { position:absolute; inset:0 0 auto; width:100%; height:43px; display:grid; grid-template-columns:minmax(80px,1fr) minmax(60px,1.2fr) 82px; gap:10px; align-items:center; padding:4px 0; text-align:left; border:0; background:none; color:var(--text); font:11px var(--font-mono); cursor:pointer; transition:transform 700ms ease; }
.today-live-row:hover { background:var(--bg3); }
.today-live-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.today-live-track { position:relative; height:20px; background:color-mix(in srgb,var(--bg3) 60%,transparent); }
.today-live-track::before { content:''; position:absolute; left:50%; top:0; bottom:0; width:1px; background:var(--muted); opacity:.5; }
.today-live-bar { position:absolute; top:4px; height:12px; border-radius:2px; transition:left 900ms ease,width 900ms ease,background-color 900ms; }
.today-live-value { text-align:right; font-variant-numeric:tabular-nums; }
.today-live-event { border-left:2px solid var(--accent); background:var(--bg3); padding:10px 12px; margin-top:12px; min-height:48px; font-size:10px; }
.today-live-empty-inline { color:var(--muted); padding:48px 12px; font-size:11px; text-align:center; }
@media(max-width:900px) { .today-live-grid { grid-template-columns:1fr; } .today-live-panel + .today-live-panel { border-left:0; border-top:1px solid var(--border); padding-left:0; padding-top:20px; } }
@media(prefers-reduced-motion:reduce) { .today-live-row,.today-live-bar,.today-live-contributors { transition:none; } }

/* Simulated performance: a compact plan beside the portfolio projection. */
.tab-bar { flex-wrap:wrap; }
.sim-card { min-width:0; }
.sim-intro { color:var(--muted); font-size:12px; margin-top:6px; }
.sim-layout { display:grid; grid-template-columns:280px minmax(0,1fr); gap:32px; }
.sim-inputs { border-right:1px solid var(--border); padding-right:24px; min-width:0; }
.sim-start-label,.sim-caption { color:var(--muted); font-size:11px; }
.sim-caption { margin:8px 0; line-height:1.6; }
.sim-start { font:600 28px var(--font-display); font-variant-numeric:tabular-nums; }
.sim-label { display:block; margin:18px 0 7px; font-size:11px; }
.sim-input { display:block; width:100%; min-width:0; border:1px solid var(--border); border-radius:var(--r-sm); background:var(--bg3); color:var(--text); font:12px var(--font-mono); padding:9px 10px; }
.sim-input:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.sim-presets { display:flex; flex-wrap:wrap; gap:5px; margin-top:8px; }
.sim-presets button { border:1px solid var(--border); background:var(--bg3); color:var(--muted); border-radius:var(--r-sm); font:10px var(--font-mono); padding:6px 7px; cursor:pointer; }
.sim-presets button[aria-pressed="true"] { border-color:var(--accent); color:var(--text); }
.sim-allocation-head { display:flex; justify-content:space-between; gap:10px; margin:24px 0 10px; font-size:11px; }
.sim-allocation-actions { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:12px; }
.sim-allocation-row { display:grid; grid-template-columns:minmax(0,1fr) 70px 10px; gap:6px; align-items:center; margin:8px 0; }
.sim-allocation-row label { display:flex; align-items:center; gap:7px; min-width:0; font-size:11px; }
.sim-allocation-row label span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sim-allocation-row input[type="checkbox"] { accent-color:var(--accent); flex-shrink:0; }
.sim-allocation-row .sim-input { padding:6px; text-align:right; }
.sim-run { width:100%; margin-top:12px; border-color:var(--accent); }
.sim-status { font-size:11px; color:var(--muted); margin:10px 0; line-height:1.6; overflow-wrap:anywhere; }
.sim-status[data-error="true"] { color:var(--red); }
.sim-output { min-width:0; }
.sim-result-head { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.sim-result-head h3 { font:600 22px var(--font-display); margin-top:5px; }
.sim-horizon-label { display:flex; align-items:center; gap:10px; font-size:11px; color:var(--muted); }
.sim-horizon-label select { width:auto; }
.sim-stale { background:var(--bg3); color:var(--warn); padding:10px 12px; margin-top:14px; font-size:11px; }
.sim-chart-wrap { height:340px; position:relative; margin:20px 0 10px; }
.sim-empty { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; text-align:center; padding:24px; color:var(--muted); background:var(--bg2); font-size:12px; }
.sim-legend { display:flex; flex-wrap:wrap; gap:16px; font-size:10px; color:var(--muted); }
.sim-legend span { display:flex; align-items:center; gap:6px; }
.sim-legend i { display:inline-block; width:20px; height:3px; background:var(--accent); }
.sim-legend .sim-legend-band { height:10px; opacity:.2; }
.sim-legend .sim-legend-baseline { height:0; background:none; border-top:2px dashed var(--muted); }
.sim-table-wrap { overflow-x:auto; margin-top:24px; }
.sim-table { width:100%; font-variant-numeric:tabular-nums; }
.sim-table caption { text-align:left; color:var(--muted); font-size:11px; padding-bottom:12px; }
.sim-table th { text-transform:none; letter-spacing:0; white-space:normal; }
.sim-table td { white-space:nowrap; font-size:11px; }
.sim-table td:not(:first-child),.sim-table th:not(:first-child) { text-align:right; }
.sim-table tr[data-selected="true"] { background:var(--bg3); }
.sim-assumptions { margin-top:24px; border-top:1px solid var(--border); padding-top:16px; font-size:11px; }
.sim-assumptions summary { cursor:pointer; color:var(--text); }
.sim-assumptions p { max-width:100ch; color:var(--muted); line-height:1.7; margin:12px 0; }
.sim-coverage { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 24px; }
.sim-coverage-row { min-width:0; border-top:1px solid var(--border); padding-top:12px; }
.sim-coverage-row label { display:block; margin-bottom:8px; overflow-wrap:anywhere; }
.sim-coverage-row .sim-input { font-size:11px; }
.sim-preview { position:relative; min-height:260px; color:var(--accent); }
.sim-preview p { color:var(--muted); font-size:11px; }
.sim-preview svg { display:block; width:100%; height:220px; }
#tabSimulation [hidden] { display:none!important; }
@media(max-width:1050px) { .sim-layout { grid-template-columns:240px minmax(0,1fr); gap:20px; } .sim-inputs { padding-right:20px; } }
@media(max-width:760px) { .sim-layout { grid-template-columns:minmax(0,1fr); } .sim-inputs { border-right:0; border-bottom:1px solid var(--border); padding:0 0 20px; } .sim-coverage { grid-template-columns:minmax(0,1fr); } .sim-chart-wrap { height:280px; } }
