:root {
    /* ===================================================================
       Design-system tokens — silver / gold / black / white.
       Source of truth: Documents/DESIGN_SYSTEM.md §2.  Use the ROLE name
       when building, not the raw hex.  Light-mode values live here; the
       dark-mode values are wired (dormant) in :root[data-theme="dark"]
       below, so a future theme toggle re-skins everything with no new CSS.
       =================================================================== */

    /* Neutrals — backgrounds & text */
    --bg-base: #ffffff;        /* page background */
    --bg-sunken: #f7f6f3;      /* page behind cards — warm porcelain (2026-07-14 remake) */
    --bg-raised: #ffffff;      /* card / panel surface */
    --bg-raised-alt: #f4f4f3;  /* nested / inset surface */
    --text-primary: #131316;   /* headlines, key numbers */
    --text-secondary: #6c6f75; /* body, labels */
    --text-tertiary: #9a9da3;  /* hints, captions */
    --border-hairline: #ededee;/* default separators */
    --border-strong: #e0e0e2;  /* hover / emphasis edges */

    /* Silver — Free tier accent (kept close to neutral) */
    --silver-tint: #eeeff1;    /* Free badge bg, subtle fills */
    --silver-line: #c7c9ce;    /* Free card border, outline buttons */
    --silver-core: #b8bbc1;    /* solid silver fill (sparingly) */
    --silver-deep: #5a5d63;    /* text on silver tints */
    --silver-on-dark: #c7c9ce; /* silver text/label on black bg */

    /* Gold — Premium tier accent (the only saturated chrome color) */
    --gold-tint: #f6eccb;      /* Premium badge bg */
    --gold-line: #e3cf8a;      /* Premium card border */
    --gold-core: #d9b85c;      /* primary button fill, key accent */
    --gold-strong: #8a6b14;    /* gold text/icon on light bg (also Pro marker) */
    --gold-deep: #4a370a;      /* text on gold fills */
    --gold-on-dark: #e9d7a0;   /* gold text/label on black/deep-gold bg */

    /* Functional — data only (gain / loss); never on buttons or chrome */
    --gain: #1e9e6a;
    --gain-tint: #e4f4ec;
    --loss: #d14343;
    --loss-tint: #fbeaea;

    /* Redesign-only tokens for the INTERNAL admin tool (Admin-Analytics-Redesign-Spec
       §2.2): a loosened gold accent marking active nav/tab/the conversion KPI/the hero
       line; chart gridlines; card density.  Justified deviation from the "one gold CTA
       per view" rule — the admin has no conversion CTA competing. */
    --adm-accent: var(--gold-strong);   /* #8a6b14 on light */
    --adm-grid: var(--border-hairline); /* chart gridlines */
    --adm-pad: 18px;                    /* default card density (24px = comfortable) */

    /* Derived / app-specific, kept on-palette */
    --focus-ring: rgba(19, 19, 22, 0.14);      /* neutral keyboard-focus ring */
    --hover-surface: rgba(19, 19, 22, 0.04);   /* faint neutral row/link/icon hover */
    --overlay-scrim: rgba(19, 19, 22, 0.45);   /* modal backdrop */
    --menu-shadow: 0 10px 30px rgba(17, 19, 22, 0.12); /* the one soft shadow: menus/modals only */

    /* Radius scale (DESIGN_SYSTEM.md §5) */
    --radius-sm: 8px;     /* buttons, badges, inputs */
    --radius-md: 12px;    /* inner panels */
    --radius-lg: 16px;    /* cards */
    --radius-pill: 999px; /* pills, toggles */

    /* ----------------------------------------------------------------
       2026-07-14 UI remake tokens (Tasks/UI-Remake-2026-07-14-Direction.md).
       Two typographic voices: --font-ui carries prose and headlines,
       --font-data carries every ticker, price, eyebrow, and badge (the
       ledger/terminal voice).  --foil is the ONE sanctioned metallic
       gradient — shared by the brand-mark dot, the nav token chip, and
       the single .btn-cta per view; everything else stays matte
       (DESIGN_SYSTEM §5 exception, recorded there).
       ---------------------------------------------------------------- */
    --font-ui: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, sans-serif;
    --font-data: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo,
                 Consolas, monospace;
    --foil: linear-gradient(160deg, #e9d18c 0%, #d9b85c 46%, #c7a23e 100%);
    --foil-sheen: rgba(255, 255, 255, 0.55);   /* the moving highlight */
    --page-wash: rgba(217, 184, 92, 0.05);     /* warm light at the page top */
    --lift-shadow: 0 8px 24px rgba(19, 19, 22, 0.06); /* interactive hover lift */

    /* Layout width tokens — flexible full-width layout (see UI_Flexible_Width_Fix). */
    --page-gutter: 32px;     /* consistent edge gutter around all content */
    --content-max: 1600px;   /* wide cap for legacy content / admin pages */
    --nav-max: 1200px;       /* top-nav inner cap (Navigation_Redesign §2) */
    --shell-max: 1120px;     /* content column on the three destinations (§3) */
    --form-max: 760px;       /* readable cap for single-column input rows */
    --auth-max: 440px;       /* narrow cap for login / register / account */

    /* ----------------------------------------------------------------
       Back-compat aliases: the legacy token names used throughout this
       file now resolve to the new roles, so existing `var(--old)` rules
       re-skin automatically.  Generic accents map to NEUTRALS — gold is
       reserved for the primary CTA + the Premium tier, applied
       explicitly (not through these aliases).
       ---------------------------------------------------------------- */
    --card-bg: var(--bg-raised);
    --panel-bg: var(--bg-raised-alt);
    --surface: var(--bg-raised);
    --border: var(--border-hairline);
    --text: var(--text-primary);
    --muted: var(--text-secondary);
    --accent: var(--text-primary);
    --accent-dark: var(--text-primary);
    --positive: var(--gain);
    --negative: var(--loss);
    --neutral: var(--text-secondary);
    --shadow: none;   /* heavy static-card shadow removed (hairline borders instead) */
}

/* Dark mode — DORMANT.  Values per DESIGN_SYSTEM.md §2/§8 so a future toggle
   that sets <html data-theme="dark"> themes the whole app with no extra CSS.
   No prefers-color-scheme hook on purpose: light mode is the only active theme
   today.  The aliases above resolve dynamically, so they need no redefining
   here.  Silver/gold tints+lines are derived for dark (the spec only enumerates
   on-dark *text* variants); fills (gold-core) and text-on-gold (gold-deep) are
   unchanged because the gold fill itself is unchanged. */
:root[data-theme="dark"] {
    --bg-base: #131316;
    --bg-sunken: #0e0e10;
    --bg-raised: #1b1b1f;
    --bg-raised-alt: #232327;
    --text-primary: #f4f4f6;
    --text-secondary: #a9acb2;
    --text-tertiary: #74777d;
    --border-hairline: #26262a;
    --border-strong: #3a3c42;

    --silver-tint: #232327;
    --silver-line: #3a3c42;
    --silver-core: #4a4d54;
    --silver-deep: #c7c9ce;   /* text on (now dark) silver tint → light */
    --silver-on-dark: #c7c9ce;

    --gold-tint: #2e2713;
    --gold-line: #5a4a1c;
    --gold-core: #d9b85c;     /* fills unchanged */
    --gold-strong: #e9d7a0;   /* gold text now sits on dark → light variant */
    --gold-deep: #4a370a;     /* still text on the (unchanged) gold-core fill */
    --gold-on-dark: #e9d7a0;

    --gain: #3dbf88;
    --gain-tint: #10301f;
    --loss: #e86a6a;
    --loss-tint: #3a1717;

    /* Saturated gold text vibrates on black -> use the on-dark gold for the accent. */
    --adm-accent: var(--gold-on-dark);

    --focus-ring: rgba(244, 244, 246, 0.22);
    --hover-surface: rgba(244, 244, 246, 0.06);
    --overlay-scrim: rgba(0, 0, 0, 0.55);

    /* 2026-07-14 remake: no warm wash on near-black (it reads as a stain);
       hover lift needs a deeper shadow to register on dark surfaces. */
    --page-wash: transparent;
    --lift-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ===================================================================
   Self-hosted faces (2026-07-14 remake) — latin subsets in static/fonts/.
   Schibsted Grotesk is a variable file (one request covers 400–900);
   IBM Plex Mono ships the three weights the data voice actually uses.
   font-display: swap keeps first paint on the system fallback.
   =================================================================== */
@font-face {
    font-family: "Schibsted Grotesk";
    src: url("fonts/schibsted-grotesk-latin-var.woff2") format("woff2");
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "IBM Plex Mono";
    src: url("fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "IBM Plex Mono";
    src: url("fonts/ibm-plex-mono-latin-500.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "IBM Plex Mono";
    src: url("fonts/ibm-plex-mono-latin-600.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-ui);
    color: var(--text);
    /* Warm porcelain field with a faint morning-light wash at the top
       (--page-wash is transparent in dark mode). */
    background:
        radial-gradient(1100px 460px at 50% -160px, var(--page-wash), transparent 60%),
        var(--bg-sunken);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;        /* center each card as a column */
    padding: var(--page-gutter);
}

.card {
    width: 100%;
    max-width: var(--content-max);
    padding: 32px;
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-lg);
    background: var(--bg-raised);
}

.eyebrow {
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1.05;
}

.description {
    margin: 14px 0 28px;
    max-width: 60ch;
    color: var(--muted);
    line-height: 1.6;
}

.predict-form label,
.metrics h3,
.results-label {
    display: block;
    font-weight: 600;
}

.input-row {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    max-width: var(--form-max);   /* keep text inputs readable on wide cards */
}

input {
    flex: 1;
    padding: 15px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--bg-raised);
}

input:focus {
    outline: 3px solid var(--focus-ring);
    border-color: var(--text-primary);
}

/* Everyday/primary actions are SILVER, not gold.  Gold is reserved for the single
   conversion CTA per view (.btn-cta) + Premium markers — see DESIGN_SYSTEM §6/§7.
   Buttons that set their own background (nav menu/icon, close-btn, .rec-tab) override
   this base, so they're unaffected. */
button {
    padding: 15px 22px;
    border: 0;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--silver-core);
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.78;
    cursor: wait;
}

.hint,
.panel-note,
.summary,
.data-note {
    color: var(--muted);
    line-height: 1.55;
}

.hint {
    margin: 10px 0 0;
    font-size: 0.92rem;
}

.panel {
    margin-top: 22px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--panel-bg);
}

.hidden {
    display: none;
}

.status-row,
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.status-title {
    font-weight: 600;
}

.progress-track {
    height: 12px;
    margin-top: 14px;
    border-radius: var(--radius-pill);
    background: var(--bg-raised-alt);
    overflow: hidden;
}

.progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--text-primary);
    transition: width 0.22s ease;
}

.panel-note,
.data-note {
    margin-bottom: 0;
}

.panel-error {
    border-color: var(--loss);
    background: var(--loss-tint);
    color: var(--loss);
    font-weight: 600;
}

.results-label {
    margin: 0 0 8px;
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.results-header h2 {
    margin: 0;
    font-size: 1.7rem;
}

.summary {
    margin: 10px 0 0;
}

.outlook-badge {
    padding: 10px 14px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    white-space: nowrap;
}

.outlook-positive {
    background: var(--gain-tint);
    color: var(--positive);
}

.outlook-negative {
    background: var(--loss-tint);
    color: var(--negative);
}

.outlook-neutral {
    background: var(--silver-tint);
    color: var(--neutral);
}

.results-grid,
.metrics-grid {
    display: grid;
    gap: 12px;
}

.results-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 20px;
}

.metrics-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 12px;
}

.result-box,
.metric-box {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-raised);
}

.box-label,
.metric-label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.88rem;
}

.result-box strong,
.metric-box strong {
    font-size: 1.08rem;
}

.metrics {
    margin-top: 22px;
}

.metrics h3 {
    margin: 0;
}

.value-positive {
    color: var(--positive);
}

.value-negative {
    color: var(--negative);
}

.value-neutral {
    color: var(--neutral);
}

/* Tabular (monospaced) figures everywhere prices, percentages, and deltas
   appear, so columns align and values don't jitter on update (DESIGN_SYSTEM
   §3).  Purely a numeric-rendering hint — no layout/structure change. */
.result-box strong,
.metric-box strong,
.compare-stat strong,
.mini-metrics strong,
.shared-close strong,
.hype-pillar-box strong,
.perf-card-accuracy,
.perf-row,
.data-table td,
.baseline-table td,
.market-index-change,
.rec-score-badge,
.valuation-label-badge,
.valuation-mini-badge {
    font-variant-numeric: tabular-nums;
}

@media (max-width: 700px) {
    .results-grid,
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .card {
        padding: 24px;
    }

    .input-row,
    .results-header {
        flex-direction: column;
        align-items: stretch;
    }

    button {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .results-grid,
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Navigation bar
   ========================================================================== */

/* Navigation redesign (Tasks/Navigation_Redesign.md §2): brand mark + three
   pill tabs + icon cluster on a 64px sticky bar capped at --nav-max. */

.main-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: var(--nav-max);
    margin: 0 auto;
    padding: 0 var(--page-gutter);
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.nav-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.01em;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}

/* 26px rounded square holding the 8px gold dot. */
.nav-brand-mark {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    background: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.nav-brand-mark::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: var(--radius-pill);
    background: var(--gold-core);
}

.nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease;
}

.nav-link:hover {
    background: var(--bg-sunken);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--bg-raised-alt);
    color: var(--text-primary);
    font-weight: 600;
}

/* §10: below ~900px drop the wordmark before dropping tabs. */
@media (max-width: 900px) {
    .nav-brand-word {
        display: none;
    }
    .nav-inner {
        gap: 14px;
    }
}

@media (max-width: 560px) {
    .nav-inner {
        padding: 0 12px;
        gap: 8px;
    }
    .nav-link {
        padding: 7px 10px;
        font-size: 13px;
    }
}

/* ==========================================================================
   Data tables (watchlist, predictions)
   ========================================================================== */

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    white-space: nowrap;
}

.data-table thead th {
    font-weight: 600;
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 2px solid var(--border);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.12s ease;
}

.data-table tbody tr:hover {
    background: var(--hover-surface);
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.action-cell {
    display: flex;
    gap: 6px;
}

/* ==========================================================================
   Buttons – variants
   ========================================================================== */

.btn-small {
    padding: 6px 12px;
    border: 0;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-primary);
    transition: opacity 0.15s ease;
}

.btn-small:hover:not(:disabled) {
    opacity: 0.88;
}

.btn-small:disabled {
    opacity: 0.6;
    cursor: wait;
}

.btn-primary {
    background: var(--silver-core);
    color: var(--text-primary);
}

/* The single GOLD conversion CTA per view — gold is reserved for this (sign-up
   today; a future "Upgrade to Premium" button reuses the same class).  Inherits
   padding/radius/weight/hover from the base `button`; only recolors to gold.
   DESIGN_SYSTEM §6/§7: one gold call-to-action per view. */
.btn-cta {
    background: var(--gold-core);
    color: var(--gold-deep);
}

/* Destructive action.  Neutral silver, NOT red (DESIGN_SYSTEM keeps green/red
   for live data only).  A lighter fill than the silver-core primary so it stays
   visibly quieter than — and distinct from — the main action next to it. */
.btn-danger {
    background: var(--silver-tint);
    color: var(--text-primary);
}

.btn-secondary {
    padding: 12px 20px;
    border: 1px solid var(--silver-line);
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 600;
    color: var(--text-primary);
    background: transparent;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--silver-tint);
    color: var(--text-primary);
}

.btn-secondary:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* ==========================================================================
   Badges (owned, direction, status, result)
   ========================================================================== */

.badge-btn {
    padding: 5px 10px;
    border: 0;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.badge-btn:hover {
    opacity: 0.85;
}

.badge-owned {
    background: var(--gain-tint);
    color: var(--positive);
}

.badge-not-owned {
    background: var(--silver-tint);
    color: var(--muted);
}

.dir-badge,
.status-badge,
.result-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-up {
    background: var(--gain-tint);
    color: var(--positive);
}

.badge-down {
    background: var(--loss-tint);
    color: var(--negative);
}

.badge-neutral {
    background: var(--silver-tint);
    color: var(--neutral);
}

.badge-pending {
    background: var(--silver-tint);
    color: var(--silver-deep);
}

.badge-completed {
    background: var(--gain-tint);
    color: var(--positive);
}

.badge-correct {
    background: var(--gain-tint);
    color: var(--positive);
}

.badge-incorrect {
    background: var(--loss-tint);
    color: var(--negative);
}

/* ==========================================================================
   Overlay (prediction result pop-up on watchlist page)
   ========================================================================== */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--overlay-scrim);
    backdrop-filter: blur(4px);
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    width: min(560px, 92vw);
    max-height: 85vh;
    overflow-y: auto;
}

.overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.overlay-header h3 {
    margin: 0;
}

.close-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    font-size: 1.4rem;
    line-height: 1;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease;
}

.close-btn:hover {
    background: var(--hover-surface);
}

/* ==========================================================================
   Feedback panels
   ========================================================================== */

.panel-success {
    border-color: var(--gain);
    background: var(--gain-tint);
    color: var(--positive);
    font-weight: 600;
}

/* Flash banners: a content-width column above the page card so messages line
   up with the cards and stack cleanly.  Reuses .panel + .panel-success/error. */
.flash-stack {
    width: 100%;
    max-width: var(--content-max);   /* keep aligned with .card */
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.flash-stack .panel {
    margin-top: 0;
}

/* ==========================================================================
   Empty state
   ========================================================================== */

.empty-state {
    padding: 20px 0;
    color: var(--muted);
    text-align: center;
    font-size: 0.95rem;
}

/* ==========================================================================
   Filters
   ========================================================================== */

.filter-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.filter-select,
.filter-input {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--bg-raised);
}

.filter-select:focus,
.filter-input:focus {
    outline: 3px solid var(--focus-ring);
    border-color: var(--accent);
}

/* ==========================================================================
   Evaluate row
   ========================================================================== */

.evaluate-row {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==========================================================================
   Performance grid override
   ========================================================================== */

.perf-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

@media (max-width: 700px) {
    .perf-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 520px) {
    .perf-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================================
   Saved-note on predict page
   ========================================================================== */

.saved-note {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: var(--gain-tint);
    color: var(--positive);
    font-weight: 600;
    font-size: 0.92rem;
}

.saved-note a {
    color: var(--positive);
}

/* ==========================================================================
   Link styling inside descriptions
   ========================================================================== */

.description a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.description a:hover {
    color: var(--accent-dark);
}

/* ==========================================================================
   Form select (model selector on predict page)
   ========================================================================== */

.form-field {
    margin-bottom: 16px;
}

.form-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-select {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: var(--bg-raised);
    cursor: pointer;
    appearance: auto;
}

.form-select:focus {
    outline: 3px solid var(--focus-ring);
    border-color: var(--accent);
}

/* ==========================================================================
   Section header (heading + inline control, e.g. watchlist + model select)
   ========================================================================== */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

/* ==========================================================================
   Model badges (predictions table)
   ========================================================================== */

.model-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Model badges are categorical identifiers, not data — neutralized to one
   quiet silver pill (the model name text distinguishes them) so they don't
   reintroduce a rainbow palette the design system doesn't define. */
.badge-model1,
.badge-model11,
.badge-model2,
.badge-model21,
.badge-model3,
.badge-model4,
.badge-model5 {
    background: var(--silver-tint);
    color: var(--silver-deep);
}

/* ==========================================================================
   Performance comparison cards (predictions page – one card per model)
   ========================================================================== */

/* The strip stacks a horizon toggle above the cards grid (accuracy-strip.js
   builds both inside #perf-container). */
.perf-comparison {
    display: block;
}

.perf-horizon-seg {
    margin: 0 0 14px;
}

.perf-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.perf-card {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-raised);
}

.perf-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.perf-card-header h4 {
    margin: 0;
    font-size: 1.08rem;
}

.perf-card-accuracy {
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.88rem;
    font-weight: 600;
    background: var(--silver-tint);
    color: var(--accent);
}

/* "Not yet scored": a model with predictions but none completed yet.  Muted
   (overrides the blue accuracy pill) so it reads as an unscored state, not a
   real — and misleadingly low — 0.0% accuracy figure (Code_Review.md #7). */
.perf-card-unscored {
    background: var(--silver-tint);
    color: var(--muted);
    font-weight: 600;
}

.perf-card-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.perf-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid var(--border-hairline);
    font-size: 0.9rem;
}

.perf-row:last-child {
    border-bottom: none;
}

.perf-row span {
    color: var(--muted);
}

@media (max-width: 520px) {
    .perf-cards {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Comparison layout (predict page – side by side models)
   ========================================================================== */

.shared-close {
    text-align: right;
}

.shared-close .box-label {
    margin-bottom: 4px;
}

.shared-close strong {
    font-size: 1.3rem;
}

.comparison-grid {
    display: grid;
    /* minmax(0, 1fr) keeps each column locked to a third of the parent --
       without the 0 minimum, an unbreakable inline (e.g. a long ensemble
       metric label) makes one column wider than 1fr and pushes the others
       outside the card. */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.model-column {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-raised);
}

.model-column-header {
    margin-bottom: 14px;
}

.model-column-header h3 {
    margin: 0;
    font-size: 1.15rem;
}

.model-subtitle {
    font-size: 0.82rem;
    color: var(--muted);
}

.model-column .outlook-badge {
    display: inline-block;
    margin-bottom: 8px;
}

.compare-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.compare-stat {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--panel-bg);
}

.compare-stat .box-label {
    margin-bottom: 4px;
}

.compare-stat strong {
    font-size: 1.05rem;
}

.mini-metrics {
    display: grid;
    /* Same minmax(0, 1fr) trick as the comparison grid: stops a long
       value (e.g. the Model 3 sentiment cell) from blowing out the
       column width and forcing the parent card to scroll. */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
    margin-top: 14px;
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--panel-bg);
    font-size: 0.88rem;
}

.mini-metrics div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    min-width: 0;
}

.mini-metrics strong {
    font-size: 0.9rem;
    /* Keep the value on a single line; ellipsis if the column is too
       narrow, so we never wrap into the next row of the metric grid. */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-metrics .metric-label {
    margin-bottom: 0;
    font-size: 0.82rem;
}

/* Model-vs-baselines comparison (collapsible, under the mini-metrics). */
.baseline-compare {
    margin-top: 10px;
}

.baseline-details summary {
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--muted);
    padding: 4px 0;
    user-select: none;
}

.baseline-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 0.8rem;
}

.baseline-table th,
.baseline-table td {
    padding: 4px 6px;
    text-align: right;
    white-space: nowrap;
}

.baseline-table th[scope="row"],
.baseline-table thead th:first-child {
    text-align: left;
    font-weight: 500;
}

.baseline-table thead th {
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-weight: 600;
}

.baseline-table .baseline-model-row {
    font-weight: 600;
    background: var(--panel-bg);
}

.baseline-base-rate {
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--muted);
}

.model-column .data-note {
    margin-top: 10px;
    font-size: 0.82rem;
}

.model-column .panel-error {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 0.88rem;
}

/* ==========================================================================
   Hype Check (Pro) card – valuation page
   ========================================================================== */

.hype-card {
    margin-top: 1rem;
}

.hype-premium-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--gold-tint);
    color: var(--gold-strong);
    padding: 0.12rem 0.45rem;
    border-radius: var(--radius-sm);
    margin-left: 0.45rem;
    vertical-align: middle;
}

.hype-locked {
    color: var(--muted);
    padding: 0.4rem 0;
}

.hype-pillars {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.5rem;
    margin: 0.85rem 0;
}

.hype-pillar-box {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.55rem 0.65rem;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.hype-pillar-box strong {
    font-size: 1.15rem;
    color: var(--text);
}

.hype-disclaimer {
    font-style: italic;
    color: var(--muted);
    margin-top: 0.6rem;
}

/* Drop to 1 column on tablets/phones — 3 narrow columns get cramped. */
@media (max-width: 960px) {
    .comparison-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .shared-close {
        text-align: left;
    }
}

/* ==========================================================================
   Accordion (predictions page – grouped by ticker)
   ========================================================================== */

.accordion-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.accordion-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-raised);
}

.accordion-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: none;
    border-radius: 0;
    background: var(--bg-raised);
    color: var(--text);
    font-size: 0.94rem;
    font-weight: 400;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}

.accordion-header:hover {
    background: var(--hover-surface);
}

.accordion-chevron {
    font-size: 0.7rem;
    color: var(--muted);
    flex-shrink: 0;
    width: 14px;
    text-align: center;
}

.accordion-ticker {
    font-size: 1.02rem;
}

.accordion-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.accordion-meta {
    margin-left: auto;
    font-size: 0.82rem;
    color: var(--muted);
    white-space: nowrap;
}

.accordion-body {
    display: none;
    border-top: 1px solid var(--border);
    padding: 4px 0;
}

.accordion-item.open .accordion-body {
    display: block;
}

.accordion-body .data-table {
    font-size: 0.86rem;
}

.accordion-body .data-table th {
    font-size: 0.76rem;
}

@media (max-width: 640px) {
    .accordion-header {
        flex-wrap: wrap;
    }

    .accordion-meta {
        width: 100%;
        margin-left: 24px;
        margin-top: 2px;
    }
}

/* ==========================================================================
   Run-All progress panel (watchlist page)
   ========================================================================== */

.section-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.run-all-panel {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--panel-bg);
}

.run-all-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.94rem;
}

.run-all-counter {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 400;
}

.run-all-log {
    margin-top: 12px;
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.run-all-log-entry {
    font-size: 0.88rem;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-hairline);
}

.run-all-log-entry:last-child {
    border-bottom: none;
}

.log-success {
    color: var(--positive);
    font-weight: 600;
}

.log-fail {
    color: var(--negative);
    font-weight: 600;
}

.log-skip {
    color: var(--muted);
    font-weight: 600;
}

.value-muted {
    color: var(--muted);
}

/* ==========================================================================
   Recommendations page
   ========================================================================== */

.rec-filter-form {
    margin-top: 20px;
}

.rec-filter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    align-items: end;
}

.rec-filter-field label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 5px;
}

.rec-filter-field .filter-select {
    width: 100%;
}

.rec-filter-checkbox {
    display: flex;
    align-items: center;
}

.rec-filter-checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    margin-bottom: 0;
}

.rec-filter-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex: none;
    accent-color: var(--accent);
    cursor: pointer;
}

.rec-filter-actions {
    margin-top: 16px;
}

.rec-score-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
}

.rec-score-high {
    background: var(--gain-tint);
    color: var(--positive);
}

.rec-score-mid {
    background: var(--silver-tint);
    color: var(--neutral);
}

.rec-score-low {
    background: var(--loss-tint);
    color: var(--negative);
}

.rec-reasons-cell {
    white-space: normal;
    max-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.rec-reason-tag {
    display: block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    font-weight: 600;
    background: var(--silver-tint);
    color: var(--silver-deep);
    width: fit-content;
}

.rec-type-badge {
    display: inline-block;
    width: fit-content;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--silver-deep);
    background: var(--silver-tint);
}

/* Recommendation-type is categorical (not gain/loss), so both variants stay
   neutral silver; the label text carries the Pre-Bullrun / Breakout meaning. */
.rec-type-pre {
    background: var(--silver-tint);
}

.rec-type-breakout {
    background: var(--silver-tint);
}

.rec-reason-more {
    background: var(--silver-tint);
    color: var(--muted);
}

.rec-company-cell {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bottleneck-explanation-cell {
    min-width: 260px;
    max-width: 420px;
    white-space: normal;
    line-height: 1.45;
}

.rec-reasons-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.8;
    color: var(--text);
    font-size: 0.92rem;
}

.rec-reasons-list li {
    padding: 2px 0;
}

@keyframes rec-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.rec-news-section {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rec-news-item {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    transition: background 0.12s ease;
}

.rec-news-item:hover {
    background: var(--hover-surface);
}

.rec-news-title {
    font-size: 0.9rem;
    line-height: 1.4;
}

.rec-news-title a {
    color: var(--text);
    text-decoration: none;
}

.rec-news-title a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.rec-news-meta {
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--muted);
}

.rec-news-source {
    font-weight: 600;
}

/* ---------- Sentiment word (table score column) ---------- */

.sentiment-word {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: capitalize;
    vertical-align: middle;
    cursor: help;
}

.sentiment-word.sentiment-positive { color: var(--positive); }
.sentiment-word.sentiment-neutral  { color: var(--neutral); }
.sentiment-word.sentiment-negative { color: var(--negative); }

/* ---------- Sentiment badge (overlay & analysis section) ---------- */

.sentiment-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
}

.sentiment-badge-positive {
    background: var(--gain-tint);
    color: var(--positive);
}

.sentiment-badge-neutral {
    background: var(--silver-tint);
    color: var(--neutral);
}

.sentiment-badge-negative {
    background: var(--loss-tint);
    color: var(--negative);
}

/* ---------- Score breakdown (overlay) ---------- */

.score-breakdown {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--panel-bg);
    font-size: 0.88rem;
}

.score-part {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.score-part .box-label {
    margin-bottom: 0;
    font-size: 0.76rem;
}

.score-op {
    font-weight: 600;
    color: var(--muted);
    font-size: 1rem;
}

/* ---------- News analysis section (overlay) ---------- */

.news-analysis-section {
    margin: 0 0 8px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--panel-bg);
}

.news-summary {
    margin: 10px 0 0;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text);
}

.news-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.news-flag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
}

.flag-risk {
    background: var(--loss-tint);
    color: var(--negative);
}

.flag-catalyst {
    background: var(--gain-tint);
    color: var(--positive);
}

@media (max-width: 900px) {
    .rec-filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .rec-filter-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Recommendations tabs (Gainers / Sector Bottlenecks)
   ========================================================================== */

.rec-tabs {
    display: flex;
    gap: 4px;
    margin-top: 22px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--panel-bg);
    width: fit-content;
}

.rec-tab {
    padding: 9px 18px;
    border: 0;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.rec-tab:hover {
    color: var(--text);
    background: var(--hover-surface);
}

.rec-tab.active {
    color: var(--text-primary);
    background: var(--bg-raised);
}

.rec-pane {
    margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Tiered recommendations (Free / Premium / Pro)

   Each tier renders inside a `.rec-tier-section`.  The styling here is
   intentionally lightweight — the goal is *separation*, not redesign.

   The `.rec-tier-nav` pill row sits at the top of the results panel so
   all three tiers are visible at a glance even when the Free table is
   long enough to push later sections off-screen.
   -------------------------------------------------------------------------- */

.rec-tier-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 6px;
}

.rec-tier-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--panel-bg);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.rec-tier-pill:hover {
    background: var(--hover-surface);
    border-color: var(--border-strong);
    color: var(--accent-dark);
}

.rec-tier-pill[data-tier-link="premium"] .rec-tier-pill-label::before {
    content: "★ ";
    color: var(--gold-core);
}

.rec-tier-pill[data-tier-link="pro"] .rec-tier-pill-label::before {
    content: "♦ ";
    color: var(--gold-strong);
}

.rec-tier-pill-count {
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    background: var(--silver-tint);
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.rec-tier-section {
    margin-top: 22px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.rec-tier-section:first-of-type {
    border-top: 0;
    padding-top: 4px;
    margin-top: 8px;
}

.rec-tier-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.rec-tier-title {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
}

.rec-tier-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--silver-tint);
    color: var(--silver-deep);
}

.rec-tier-badge-premium {
    background: var(--gold-core);
    color: var(--gold-deep);
}

/* Pro has no color in DESIGN_SYSTEM.md (it defines Free=silver, Premium=gold
   only).  Given as a deeper gold/bronze so the paid ladder reads
   silver -> gold -> deep-gold.  Flagged for Rayan to confirm. */
.rec-tier-badge-pro {
    background: var(--gold-strong);
    color: var(--gold-on-dark);
}

.rec-tier-blurb {
    margin: 6px 0 10px;
}

.rec-tier-count {
    white-space: nowrap;
}

/* ---- Tiered-UI selector (segmented control) ---- */
.rec-view-switch {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin: 18px 0 20px;
    background: var(--bg-sunken);
    border: 1px solid var(--silver-line);
    border-radius: var(--radius-pill);
}
.rec-view-seg {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: var(--silver-deep);
    font: inherit;
    font-weight: 500;
    padding: 7px 16px;
    border-radius: var(--radius-pill);
    cursor: pointer;
}
.rec-view-seg:hover { background: var(--hover-surface); }
.rec-view-seg.active {
    background: var(--bg-raised);
    border-color: var(--silver-line);
    color: var(--text-strong, inherit);
    font-weight: 600;
}
.rec-view-seg:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.rec-view-seg-spark { color: var(--gold-strong); margin-left: 2px; }

/* ---- Free-view cross-sell (the only premium footprint on Free) ---- */
.rec-crosssell {
    display: block;
    width: 100%;
    margin-top: 18px;
    padding: 10px 14px;
    text-align: left;
    background: transparent;
    border: 1px solid var(--silver-line);
    border-radius: var(--radius-md);
    color: var(--silver-deep);
    font: inherit;
    cursor: pointer;
}
.rec-crosssell:hover { background: var(--hover-surface); }

/* ---- Premium showcase ---- */
.rec-showcase-aggregate { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.rec-showcase-metric { background: var(--bg-raised-alt); border: 1px solid var(--silver-line); border-radius: var(--radius-md); padding: 14px; }
.rec-showcase-metric-value { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.rec-showcase-metric-label { color: var(--silver-deep); font-size: 0.85rem; }
.rec-showcase-freepick { margin-top: 16px; border: 1px solid var(--gold-line); border-radius: var(--radius-md); padding: 16px; background: var(--gold-tint); }
.rec-showcase-freepick-tag { color: var(--gold-strong); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.rec-showcase-call { margin-top: 16px; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--silver-line); border-radius: var(--radius-md); }
/* These blocks set their own display, which would otherwise beat .hidden (equal
   specificity, later rule wins) — re-assert the hide, mirroring .overlay.hidden. */
.rec-showcase-freepick.hidden, .rec-showcase-call.hidden { display: none; }
.rec-showcase-call-result.gain { color: var(--gain); }
.rec-showcase-call-result.loss { color: var(--loss); }
.rec-showcase-cta { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 16px; background: var(--gold-tint); border: 1px solid var(--gold-line); border-radius: var(--radius-md); }
.rec-showcase-cta-text { font-weight: 600; }

/* ---- Pro coming-soon ---- */
.rec-pro-soon-list { color: var(--silver-deep); line-height: 1.8; }

/* Inline secondary button (smaller version of btn-secondary) */
.btn-secondary-small {
    padding: 6px 12px;
    border: 1px solid var(--silver-line);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-secondary-small:hover:not(:disabled) {
    background: var(--silver-tint);
    color: var(--text-primary);
}

.btn-secondary-small:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================================================
   Valuation Check
   ========================================================================== */

.valuation-card {
    max-width: var(--content-max);   /* inherits width: 100% from .card */
}

.valuation-form {
    margin-top: 20px;
}

.valuation-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

.valuation-results {
    margin-top: 24px;
}

.valuation-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.valuation-header-row h2 {
    margin: 0;
    font-size: 1.7rem;
}

.valuation-label-badge,
.valuation-mini-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
}

.valuation-label-good {
    background: var(--gain-tint);
    color: var(--positive);
}

.valuation-label-neutral {
    background: var(--silver-tint);
    color: var(--silver-deep);
}

.valuation-label-risk {
    background: var(--loss-tint);
    color: var(--negative);
}

.valuation-label-muted {
    background: var(--silver-tint);
    color: var(--muted);
}

.valuation-summary-grid,
.valuation-method-grid,
.valuation-exit-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.valuation-signal-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.valuation-signal-box {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-raised);
}

.valuation-list {
    margin: 8px 0 0;
    padding-left: 20px;
    line-height: 1.6;
}

.valuation-breakdown-panel .section-header h3,
#valuation-exit-panel h3,
#valuation-warning-panel h3 {
    margin: 0;
}

.valuation-cell {
    white-space: normal;
    min-width: 145px;
}

.valuation-cell-detail {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: flex-start;
}

.valuation-mini-note {
    font-size: 0.78rem;
    color: var(--muted);
}

@media (max-width: 760px) {
    .valuation-summary-grid,
    .valuation-method-grid,
    .valuation-exit-grid,
    .valuation-signal-row {
        grid-template-columns: 1fr;
    }
}

/* ---------------------------------------------------------------------------
   Accounts (Phase 2): nav account cluster + auth forms.
   Additive only -- reuses .card / .nav-link / global input+button styling.
   --------------------------------------------------------------------------- */

/* Brand left, tabs centered, icon cluster right (Navigation_Redesign §2):
   the cluster takes the remaining row width, centers the pill tabs inside
   it, and pushes the icons to the far edge. */
.nav-cluster {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 16px;
}

.nav-cluster .nav-links {
    margin: 0 auto;
}

/* Right-side icon cluster: token chip, notifications bell, help, account menu. */
.nav-icons {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* Icon button shared by the bell / help / avatar: a 36px hairline circle
   (§2), working as both an <a> and a <button>. */
.nav-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-pill);
    background: var(--bg-base);
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    flex: none;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

/* Scoped under .nav-icons so `transform: none` outweighs the global
   `button:hover:not(:disabled)` lift on the avatar toggle (a <button>). */
.nav-icons .nav-icon-btn:hover {
    background: var(--bg-sunken);
    color: var(--text-primary);
    border-color: var(--border-strong);
    transform: none;
}

.nav-icon-btn.active {
    background: var(--silver-tint);
    color: var(--text-primary);
}

/* The avatar toggle carries a caret beside the icon: slightly wider pill. */
.nav-avatar-toggle {
    width: auto;
    min-width: 36px;
    padding: 0 8px;
}

.nav-icon-btn svg {
    display: block;
}

/* Unread badge as a small corner dot on the bell (vs the inline pill it used to
   be on the old "Account" text link).  Reuses .nav-badge colours; the descendant
   selector keeps it winning over .nav-badge regardless of source order. */
.nav-icon-btn .nav-icon-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    margin-left: 0;
    transform: none;
    min-width: 17px;
    height: 17px;
    line-height: 13px;
    font-size: 10px;
    border: 2px solid var(--bg-base);   /* §2: white ring against the circle */
    pointer-events: none;
}

/* Account dropdown: the avatar toggle anchors an absolutely-positioned menu. */
.nav-avatar {
    position: relative;
}

.nav-avatar-caret {
    font-size: 0.7rem;
    line-height: 1;
}

.nav-avatar-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 120;
    min-width: 168px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--menu-shadow);
}

/* The HTML `hidden` attribute must win over the flex display above. */
.nav-avatar-menu[hidden] {
    display: none;
}

.nav-menu-item {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

/* Scoped under .nav-icons so the logout <button> row doesn't inherit the global
   button hover lift (menu rows must not jitter on hover). */
.nav-icons .nav-menu-item:hover {
    background: var(--hover-surface);
    color: var(--accent);
    transform: none;
}

.nav-menu-form {
    margin: 0;
}

/* Subtle emphasis for the Register call-to-action in the guest account menu. */
.nav-menu-cta {
    color: var(--accent);
}

/* The admin-only tab reads like the other tabs, faintly tinted to mark a role. */
.nav-link-admin {
    color: var(--accent);
}

/* Auth pages: a narrower card with a single stacked column of fields. */
.auth-card {
    max-width: var(--auth-max);   /* inherits width: 100% from .card */
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 22px;
}

.auth-form label {
    font-weight: 600;
    margin-top: 8px;
}

.auth-form button {
    margin-top: 16px;
}

.auth-alt {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.account-details {
    margin: 24px 0 8px;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 10px 20px;
}

.account-details dt {
    font-weight: 600;
    color: var(--muted);
}

.account-details dd {
    margin: 0;
}

.account-tier {
    text-transform: capitalize;
}

/* ==========================================================================
   Saved watchlist list (per-account + guest session panel, Phase 6)
   Shared between the Account page (members) and the guest "Saved this
   session" panel on the recommendations page.
   ========================================================================== */

.account-watchlist-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.account-watchlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.account-watchlist-ticker {
    font-weight: 600;
}

.account-watchlist-company {
    flex: 1;
    color: var(--muted);
    font-size: 0.92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 640px) {
    /* Three short pill tabs + the icon cluster fit one row down to ~320px
       (verified via CDP device emulation); allow wrapping as the safety net
       instead of stacking the whole bar vertically. */
    .nav-cluster {
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-end;
    }
    .nav-links,
    .nav-icons {
        flex-wrap: wrap;
    }
}

/* ---------------------------------------------------------------------------
   Company-name / symbol typeahead (static/ticker-search.js)
   --------------------------------------------------------------------------- */
.ts-dropdown {
    position: absolute;
    z-index: 60;
    margin-top: 4px;
    max-height: 280px;
    overflow-y: auto;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--menu-shadow);
}

.ts-dropdown.hidden {
    display: none;
}

.ts-option {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 9px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-hairline);
}

.ts-option:last-child {
    border-bottom: none;
}

.ts-option.active {
    background: var(--silver-tint);
}

.ts-symbol {
    font-weight: 600;
    color: var(--text);
    flex: 0 0 auto;
}

.ts-name {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ts-exchange {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 0.78em;
    color: var(--muted);
}

/* ===========================================================================
   Phase 0 — Free content bundle
   (beginner market summary, /learn page, beginner risk guide, auth callouts)
   =========================================================================== */

/* Beginner market summary panel (Predict page) */
.market-summary {
    margin: 18px 0 0;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--panel-bg);
}

.market-summary-title {
    margin: 0;
    font-size: 1.05rem;
}

.market-summary-link {
    white-space: nowrap;
}

.market-summary-indices {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin: 10px 0 4px;
}

.market-index {
    display: flex;
    flex-direction: column;
    min-width: 88px;
}

.market-index-name {
    font-size: 0.78rem;
    color: var(--muted);
}

.market-index-change {
    font-weight: 600;
}

.market-index-up .market-index-change { color: var(--positive); }
.market-index-down .market-index-change { color: var(--negative); }
.market-index-flat .market-index-change { color: var(--muted); }

.market-summary-text {
    margin: 4px 0 0;
}

/* /learn page + beginner risk guide shared definition lists */
.learn-card {
    margin-bottom: 18px;
}

.learn-card h2 {
    margin: 0 0 6px;
    font-size: 1.3rem;
}

.learn-section {
    margin-top: 22px;
}

.learn-section h2 {
    margin: 0 0 6px;
    font-size: 1.2rem;
}

.learn-list {
    margin: 8px 0 0;
}

.learn-list dt {
    font-weight: 600;
    margin-top: 12px;
    color: var(--text);
}

.learn-list dd {
    margin: 2px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

/* Beginner risk guide collapsible (Valuation page) */
.beginner-guide {
    margin-top: 18px;
}

.beginner-guide > summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--accent);
}

.beginner-guide[open] > summary {
    margin-bottom: 6px;
}

/* "See how it works" callouts on the auth pages */
.auth-learn-callout {
    margin-top: 0;
}

/* ------------------------------------------------------------------ */
/* Phase 1 — structured watchlist fields (members, entitled)          */
/* ------------------------------------------------------------------ */
.watchlist-details {
    margin-top: 12px;
}

.watchlist-details > summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--accent);
}

.watchlist-details-grid,
.watchlist-edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.watchlist-details-grid label,
.watchlist-edit-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
}

.watchlist-details-grid select,
.watchlist-details-grid input,
.watchlist-edit-grid select,
.watchlist-edit-grid input,
.watchlist-edit-grid textarea {
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    color: var(--text);
    background: var(--bg-raised);
}

.watchlist-notes-label {
    grid-column: 1 / -1;
}

.watchlist-meta {
    margin-top: 4px;
    font-size: 0.82rem;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.wl-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: capitalize;
    border: 1px solid var(--border);
    color: var(--muted);
    background: var(--panel-bg);
}

.wl-status-holding {
    color: var(--positive);
    border-color: var(--positive);
}

.wl-status-closed {
    color: var(--muted);
}

.wl-status-watching {
    color: var(--silver-deep);
    border-color: var(--silver-line);
}

.watchlist-edit-row > td {
    background: var(--panel-bg);
}

.watchlist-edit-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

/* Phase 5: per-row valuation-alert config */
.watchlist-alert-row > td {
    background: var(--panel-bg);
}

.watchlist-alert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 12px;
    align-items: end;
}

.watchlist-alert-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
}

.watchlist-alert-grid select,
.watchlist-alert-grid input[type="number"] {
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    color: var(--text);
    background: var(--bg-raised);
}

.wl-alert-toggle {
    grid-column: 1 / -1;
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
    font-weight: 600;
    color: var(--text);
}

.wl-alert-toggle input {
    width: auto;
}

/* Phase 2: per-row deeper analysis panel */
.watchlist-analysis-row > td {
    background: var(--panel-bg);
}

.watchlist-analysis {
    padding: 6px 2px;
    font-size: 0.9rem;
    /* The shared `.data-table td` rule sets `white-space: nowrap`, which the cell
       passes down by inheritance. The analysis panel is prose inside a wrapping
       grid, so restore normal wrapping here (mirrors the other data-table prose
       cells). Without this the Valuation line does not wrap and overflows into
       the adjacent Bull Run column. */
    white-space: normal;
}

.wl-analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px 20px;
}

.wl-analysis-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wl-analysis-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

/* ===========================================================================
   Phase 4 — In-app notifications (Account page inbox + nav unread badge)
   =========================================================================== */

.notifications-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 10px;
    color: var(--text);
    font-size: 0.95rem;
}

.notifications-toggle input {
    width: auto;          /* override the full-width form-input default */
}

.notifications-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 6px;
}

.notifications-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-raised);
}

.notification-item.unread {
    border-left: 3px solid var(--accent);
    background: var(--panel-bg);
}

.notification-item.read {
    opacity: 0.65;
}

.notification-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notification-title {
    font-weight: 600;
    color: var(--text);
}

.notification-body {
    color: var(--muted);
    font-size: 0.9rem;
}

/* Small unread-count pill on the Account nav link. */
.nav-badge {
    display: inline-block;
    min-width: 18px;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: var(--radius-pill);
    background: var(--text-primary);
    color: var(--bg-base);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}

/* ===========================================================================
   Beginner "Index Shelf" -- the curated, no-search first tab on /recommendations
   =========================================================================== */
.index-shelf {
    margin-top: 18px;
}

.index-shelf-intro {
    margin-bottom: 18px;
}

.index-shelf-heading {
    margin: 0 0 6px;
    color: var(--text);
}

.index-shelf-framing {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.index-shelf-bucket {
    margin-top: 22px;
}

.index-shelf-bucket-title {
    margin: 0 0 4px;
    color: var(--text);
}

.index-shelf-bucket-blurb {
    margin: 0 0 12px;
}

.index-shelf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.index-shelf-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    background: var(--card-bg);
}

.index-shelf-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.index-shelf-ticker {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--accent-dark);
    letter-spacing: 0.02em;
}

.index-shelf-mer {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--silver-tint);
    color: var(--silver-deep);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.index-shelf-name {
    margin: 8px 0 10px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
}

.index-shelf-facts {
    margin: 0;
}

.index-shelf-facts dt {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.index-shelf-facts dd {
    margin: 2px 0 0;
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.4;
}

.index-shelf-fees-note {
    margin-top: 20px;
}

.index-shelf-disclaimer {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.82rem;
    font-style: italic;
}

/* ===== Price charts (shared component: full + sparkline) ===== */
/* Data-only gain/loss coloring via --gain/--loss; chrome via --silver-line/
   --text. All tokens have dark-mode overrides, so the chart re-skins itself. */
.sparkline { display: inline-flex; align-items: center; vertical-align: middle; }
.sparkline--empty { width: 84px; height: 26px; border-bottom: 1px dashed var(--silver-line); }
.spark-line { stroke: var(--silver-line); }
.spark-line.is-gain { stroke: var(--gain); }
.spark-line.is-loss { stroke: var(--loss); }

/* Watchlist "Trend" column: a small, right-most cell that holds the per-row
   sparkline (relocated out of the Company cell). The chart itself is a fixed
   84x26px in price-chart.js renderSpark, so the column only reserves room and
   right-aligns it against the Actions buttons. */
.watchlist-trend-th,
.watchlist-trend-cell {
    width: 96px;
    text-align: right;
    white-space: nowrap;
}
.watchlist-trend-cell .watchlist-spark { display: inline-flex; }

.price-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-raised);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-md);
    padding: 12px;
}
.price-chart-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.price-chart-title { font-weight: 600; color: var(--text); }
.price-chart-price { display: inline-flex; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; }
.price-chart-current { font-weight: 600; color: var(--text); }
.price-chart-delta.is-gain { color: var(--gain); }
.price-chart-delta.is-loss { color: var(--loss); }
.price-chart-delta.is-flat { color: var(--muted); }
.price-chart-stale { font-size: 0.75rem; color: var(--muted); }

.price-chart-plot { position: relative; width: 100%; min-height: 180px; }
.price-chart-plot--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.875rem;
}
.price-chart-line { stroke: var(--silver-line); }
.price-chart-line.is-gain { stroke: var(--gain); }
.price-chart-line.is-loss { stroke: var(--loss); }
.price-chart-area { fill: var(--bg-raised-alt); opacity: 0.5; }
.price-chart-area.is-gain { fill: var(--gain-tint); }
.price-chart-area.is-loss { fill: var(--loss-tint); }
.price-chart-cross { stroke: var(--silver-line); stroke-width: 1; }
.price-chart-dot { fill: var(--text); }
.price-chart-grid { stroke: var(--silver-line); stroke-width: 1; opacity: 0.35; }
.price-chart-axis-label {
    position: absolute;
    right: 4px;
    transform: translateY(-50%);
    font-size: 0.7rem;
    line-height: 1;
    color: var(--muted);
    background: var(--bg-raised);
    padding: 0 2px;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

.price-chart-tooltip {
    position: absolute;
    top: 4px;
    pointer-events: none;
    background: var(--bg-raised);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    font-size: 0.75rem;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.price-chart-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.price-chart-pill {
    border: 1px solid var(--silver-line);
    background: var(--bg-raised);
    color: var(--muted);
    border-radius: var(--radius-pill);
    padding: 2px 10px;
    font-size: 0.8125rem;
    cursor: pointer;
}
.price-chart-pill[aria-pressed="true"] {
    background: var(--bg-raised-alt);
    color: var(--text);
    border-color: var(--text);
    font-weight: 600;
}
.price-chart-pill:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---------------------------------------------------------------------------
   Monthly Token System -- nav ⚡ chip + the Account-page Tokens card.
   --------------------------------------------------------------------------- */
/* Gold-tint pill (Navigation_Redesign §2): one of the few sanctioned gold
   chrome accents.  Text sits on the tint in gold/strong. */
.nav-token-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: var(--radius-pill, 999px);
    border: 1px solid var(--gold-line);
    background: var(--gold-tint);
    color: var(--gold-strong);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
    line-height: 1;
    flex: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.nav-token-chip:hover { border-color: var(--gold-core); }
.nav-token-chip:focus-visible { outline: 2px solid var(--focus-ring, #3b82f6); outline-offset: 2px; }
.nav-token-bolt { color: var(--gold-strong); font-size: 0.95rem; }
.nav-token-chip-unlimited .nav-token-count { font-size: 1rem; line-height: 1; }
.nav-token-chip-empty {
    border-color: var(--loss, #c0392b);
    color: var(--loss, #c0392b);
    background: var(--loss-tint);
}
.nav-token-chip-empty .nav-token-bolt { color: var(--loss, #c0392b); }

.tokens-balance-row { margin: 12px 0 4px; }
.tokens-balance { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tokens-balance-bolt { color: var(--gold-strong, var(--accent, #c79a3a)); font-size: 1.4rem; }
.tokens-balance-value {
    font-size: 1.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary, #1a1a1a);
}
.tokens-balance-label { color: var(--text-secondary, #666); font-size: 0.9rem; }
.tokens-recent-heading { font-size: 0.85rem; margin: 16px 0 6px; color: var(--text-secondary, #666); }
.tokens-recent-list { list-style: none; margin: 0; padding: 0; }
.tokens-recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-top: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
    font-size: 0.88rem;
}
.tokens-recent-reason { color: var(--text-primary, #1a1a1a); }
.tokens-recent-delta { font-variant-numeric: tabular-nums; font-weight: 600; }
.tokens-credit { color: var(--gain, #1e8e4e); }
.tokens-debit { color: var(--text-secondary, #888); }

/* Inline "⚡ 1 token" cost hint next to the Predict / Valuation buttons. */
.token-cost-hint {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: var(--radius-pill, 999px);
    background: var(--hover-surface, rgba(0, 0, 0, 0.05));
    color: var(--text-secondary, #666);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ===========================================================================
   Hidden /admin console (Tasks/Admin-Page-Spec.md).  Uses the shared design
   tokens so it re-skins with the rest of the app (light + dark).
   =========================================================================== */
.admin-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.admin-head h1 { margin: 0; }
.admin-head-actions { display: flex; align-items: center; gap: 8px; }

.admin-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}
.admin-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 14px;
    margin-bottom: -1px;
    font: inherit;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
}
.admin-tab:hover { color: var(--text-primary); }
.admin-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--gold-core);
}

.admin-filters { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}
.admin-table th,
.admin-table td {
    text-align: left;
    border-bottom: 1px solid var(--border-hairline);
}
.admin-table td { padding: 10px 12px; white-space: nowrap; }
.admin-table th {
    padding: 9px 12px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.admin-table tbody tr:hover { background: var(--bg-raised-alt); }

.admin-pager {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}

.admin-drawer-row td { background: var(--bg-raised-alt); }
.admin-drawer {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 18px;
    padding: 6px 2px;
}
.admin-drawer-group { display: flex; flex-direction: column; gap: 4px; }
.admin-drawer-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.admin-drawer-group input,
.admin-drawer-group select { max-width: 160px; }
.admin-drawer-group input + button,
.admin-drawer-group select + button,
.admin-drawer-group label + button { margin-top: 2px; }

/* ---------------------------------------------------------------------------
   Admin Analytics — hand-rolled-SVG chart chrome (bars / donut / legend / line)
   + the 6-colour categorical palette, reused by the redesigned controller
   (static/admin-analytics.js).  The KPI strip / shell / page grid now live in the
   .adm-* block below; these rules are kept here so chart colours never hard-code
   in JS and stay themeable / dark-mode-safe.
--------------------------------------------------------------------------- */
.analytics-chart { min-height: 150px; }
.analytics-chart svg { display: block; max-width: 100%; height: auto; }
.analytics-empty { color: var(--text-secondary); font-size: 0.85rem; padding: 10px 0; }

/* Horizontal bar list (spend-by-feature etc.) */
.analytics-bar-row {
    display: grid;
    grid-template-columns: 110px 1fr 48px;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
    font-size: 0.82rem;
}
.analytics-bar-track {
    background: var(--bg-sunken);
    border-radius: var(--radius-pill, 999px);
    height: 10px;
    overflow: hidden;
}
.analytics-bar-fill { height: 100%; background: var(--gold-core); border-radius: inherit; }
.analytics-bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-secondary); }

/* Donut + legend */
.analytics-donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
/* Donut slices are stroked rings; keep them rings even if `fill` is ever re-added
   to the .analytics-seg-* palette (this selector outranks the single-class palette). */
.analytics-donut-wrap circle { fill: none; }
.analytics-legend { display: flex; flex-direction: column; gap: 5px; font-size: 0.82rem; }
.analytics-legend-item { display: flex; align-items: center; gap: 6px; }
.analytics-legend-swatch { width: 11px; height: 11px; border-radius: 2px; flex: 0 0 auto; }

/* Line chart axis/series chrome */
.analytics-line-axis { stroke: var(--border); stroke-width: 1; }
.analytics-line-granted { fill: none; stroke: var(--gain); stroke-width: 2; }
.analytics-line-spent { fill: none; stroke: var(--loss); stroke-width: 2; }

/* Categorical palette for donuts (6-colour cycle). Donut rings are stroked, so
   colour via `stroke` (NOT `fill` — a stylesheet `fill` overrides the inline
   `fill:none` and turns each ring into a solid disc). `background` colours the
   legend swatch spans. */
.analytics-seg-0 { stroke: #6b7cff; background: #6b7cff; }
.analytics-seg-1 { stroke: #34c2a0; background: #34c2a0; }
.analytics-seg-2 { stroke: #e0a33e; background: #e0a33e; }
.analytics-seg-3 { stroke: #d36b86; background: #d36b86; }
.analytics-seg-4 { stroke: #8a8f98; background: #8a8f98; }
.analytics-seg-5 { stroke: #7a5cd0; background: #7a5cd0; }

.analytics-table-wrap { overflow-x: auto; }

/* ===========================================================================
   Admin console + analytics — VISUAL REDESIGN (Admin-Analytics-Redesign-Spec.md).
   Token-based only (no raw hex except the reused .analytics-seg-* palette), so the
   admin-only dark-mode toggle (data-theme="dark") re-skins it with zero extra CSS.
   --adm-accent / --adm-grid / --adm-pad are defined in both :root blocks above.
   =========================================================================== */

/* ---- Shell (topbar band; bleeds to the admin card edges) ---------------- */
.adm-shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px 20px;
    flex-wrap: wrap;
    margin: -32px -32px 24px;            /* cancel the .card 32px padding -> edge-to-edge */
    padding: 11px 28px;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-hairline);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.adm-brand { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.adm-brand-id { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.adm-brand-mark {
    width: 22px; height: 22px; border-radius: 6px;
    background: var(--gold-core); flex: 0 0 auto;
}
.adm-brand-sub { color: var(--text-tertiary); font-weight: 500; }

.adm-nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.adm-nav-item {
    padding: 7px 13px; border-radius: var(--radius-sm);
    font-size: 0.88rem; font-weight: 600; line-height: 1;
    color: var(--text-secondary); text-decoration: none;
    background: none; border: none; cursor: pointer; font-family: inherit;
}
.adm-nav-item:hover { background: var(--hover-surface); color: var(--text-primary); }
.adm-nav-item--active { background: var(--silver-tint); color: var(--adm-accent); }

.adm-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Segmented toggle — base for the theme toggle AND the range control */
.adm-seg {
    display: inline-flex; align-items: center; gap: 2px;
    background: var(--bg-raised-alt);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-sm);
    padding: 3px;
}
.adm-seg-btn {
    border: none; background: none; cursor: pointer; font-family: inherit;
    border-radius: 6px; padding: 5px 10px;
    font-size: 0.78rem; font-weight: 600; color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.adm-seg-btn.is-active {
    background: var(--bg-base); color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.adm-seg--range { border-radius: 10px; }
.adm-seg--range .adm-seg-btn { border-radius: 7px; padding: 6px 12px; font-size: 0.8rem; }
.adm-seg--range .adm-seg-btn.is-active {
    background: var(--bg-raised); color: var(--adm-accent);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.adm-lock {
    border: 1px solid var(--silver-line); background: none; cursor: pointer;
    color: var(--text-secondary); font-family: inherit;
    border-radius: var(--radius-sm); padding: 6px 12px;
    font-size: 0.8rem; font-weight: 600; text-decoration: none;
    display: inline-flex; align-items: center;
}
.adm-lock:hover { color: var(--text-primary); border-color: var(--border-strong); }
.adm-lock-form { margin: 0; display: inline-flex; }

/* ---- Page header + range ------------------------------------------------ */
.adm-page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
}
.adm-page-head h1 { margin: 0; font-size: 1.75rem; font-weight: 600; letter-spacing: -0.015em; }
.adm-subtitle { margin: 4px 0 0; font-size: 0.92rem; color: var(--text-secondary); }

/* ---- KPI strip (main: label+delta / value / sparkline) ------------------ */
.adm-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
    gap: 12px; margin-bottom: 16px;
}
.adm-kpi {
    background: var(--bg-raised);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}
.adm-kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.adm-kpi-label { font-size: 0.76rem; font-weight: 500; color: var(--text-secondary); }
.adm-kpi-delta {
    display: inline-flex; align-items: center; gap: 2px;
    font-size: 0.74rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.adm-kpi-delta.is-gain { color: var(--gain); }
.adm-kpi-delta.is-loss { color: var(--loss); }
.adm-kpi-value {
    font-size: 1.7rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.1;
    font-variant-numeric: tabular-nums; color: var(--text-primary); margin-top: 6px;
}
.adm-kpi-value--gold { color: var(--adm-accent); }
.adm-spark { display: block; width: 100%; height: 30px; margin-top: 8px; }
.adm-spark svg { display: block; width: 100%; height: 30px; }

/* ---- Small KPI strip (engagement / ops) --------------------------------- */
.adm-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px; margin-bottom: 18px;
}
.adm-stat {
    background: var(--bg-raised);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-md);
    padding: 13px 15px;
}
.adm-stat-value { font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.adm-stat-label { font-size: 0.76rem; color: var(--text-secondary); margin-top: 2px; }

/* ---- Hero chart + hover tooltip ----------------------------------------- */
.adm-hero {
    position: relative;
    background: var(--bg-raised);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-lg);
    padding: var(--adm-pad); margin-bottom: 18px;
}
.adm-hero-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.adm-hero-title { font-size: 0.98rem; font-weight: 600; }
.adm-hero-hint { font-size: 0.76rem; color: var(--text-tertiary); }
.adm-hero svg { display: block; width: 100%; height: auto; }

.adm-tip {
    position: absolute; pointer-events: none; z-index: 5;
    background: var(--text-primary); color: var(--bg-raised);
    padding: 5px 9px; border-radius: 7px;
    font-size: 0.69rem; font-weight: 600; font-variant-numeric: tabular-nums;
    box-shadow: var(--menu-shadow); white-space: nowrap;
    transform: translate(-50%, -120%);
}
.adm-tip[hidden] { display: none; }

/* ---- Section blocks / cards --------------------------------------------- */
.adm-blocks {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px; margin-bottom: 16px;
}
.adm-block {
    position: relative;
    background: var(--bg-raised);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-lg);
    padding: var(--adm-pad);
}
.adm-block-title { margin: 0 0 12px; font-size: 0.92rem; font-weight: 600; }
.adm-card {
    background: var(--bg-raised);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-lg);
    padding: var(--adm-pad); margin-bottom: 16px;
}

/* Stat rows (Active-users block) */
.adm-statrow {
    display: flex; align-items: center; justify-content: space-between;
    padding: 9px 0; border-bottom: 1px solid var(--border-hairline);
}
.adm-statrow:last-child { border-bottom: none; }
.adm-statrow-label { font-size: 0.88rem; color: var(--text-secondary); }
.adm-statrow-value { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.adm-caption { font-size: 0.76rem; font-style: italic; color: var(--text-tertiary); margin: 0 0 10px; }

/* ---- Pills + table cell tones (with the shared .admin-table) ------------ */
.adm-pill {
    display: inline-block; border-radius: var(--radius-pill);
    padding: 2px 9px; font-size: 0.72rem; font-weight: 600; text-transform: capitalize;
}
.adm-pill.pill-free { background: var(--silver-tint); color: var(--silver-deep); }
.adm-pill.pill-paid { background: var(--gold-tint); color: var(--gold-strong); }
.adm-pill.pill-ok { background: var(--gain-tint); color: var(--gain); }
.adm-pill.pill-warn { background: var(--loss-tint); color: var(--loss); }

.admin-table td.num, .admin-table th.num { text-align: right; }
.admin-table td.t-muted { color: var(--text-secondary); }
.admin-table td.t-gain { color: var(--gain); font-weight: 600; }
.admin-table td.t-loss { color: var(--loss); font-weight: 600; }
.admin-table td.t-accent { color: var(--adm-accent); font-weight: 600; }
.admin-table td.t-strong { font-weight: 600; }

/* ---- Manage drawer action buttons (quiet silver, §8) -------------------- */
.adm-drawer-btn {
    border: none; cursor: pointer; font-family: inherit;
    background: var(--silver-tint); color: var(--text-primary);
    border-radius: 7px; padding: 7px 13px; font-size: 0.82rem; font-weight: 600;
}
.adm-drawer-btn:hover { background: var(--border-strong); }

/* ---- Login card (§11) --------------------------------------------------- */
.adm-login-wrap { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.adm-login-card {
    width: 100%; max-width: 420px;
    background: var(--bg-raised);
    border: 1px solid var(--border-hairline);
    border-radius: 16px; padding: 34px;
    box-shadow: var(--menu-shadow);
}
.adm-login-card h1 { margin: 6px 0; font-size: 2rem; font-weight: 600; }
.adm-login-sub { margin: 0 0 18px; color: var(--text-secondary); font-size: 0.9rem; }
.adm-login-card label { display: block; font-size: 0.82rem; font-weight: 600; margin: 12px 0 5px; }
.adm-login-card input {
    width: 100%; border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); padding: 12px 14px; font: inherit;
    background: var(--bg-raised); color: var(--text-primary);
}
.adm-btn-gold {
    border: none; cursor: pointer; font: inherit; font-weight: 600;
    background: var(--gold-core); color: var(--gold-deep);
    border-radius: var(--radius-sm); padding: 11px 20px;
}
.adm-btn-gold:hover { filter: brightness(0.97); }
.adm-btn-gold--full { width: 100%; margin-top: 18px; padding: 12px 20px; }

/* ---- Responsive (§13) --------------------------------------------------- */
@media (max-width: 860px) {
    .adm-shell { margin: -24px -20px 18px; padding: 10px 16px; }
}
@media (max-width: 640px) {
    .adm-page-head { align-items: flex-start; }
    .adm-kpi-value { font-size: 1.5rem; }
}

/* ==========================================================================
   Capital-Allocation Planner (/planner) — guided three-step flow
   (Tasks/design_handoff_planner_3a: Amount -> Your situation -> Your plan).
   Tokens only — no raw color; dark mode re-skins for free.
   ========================================================================== */

/* Shared shell: one centered card, deliberately narrower than --content-max. */
.planner-card--guided {
    max-width: 980px;
    padding: 40px 48px 48px;
    box-sizing: border-box;
}

/* --- Step indicator ----------------------------------------------------- */
.planner-steps-nav {
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 40px;
}
.planner-steps-nav button:hover:not(:disabled) { transform: none; }
.planner-step-dot {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; padding: 0; flex: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--bg-raised); color: var(--text-secondary);
    font-size: 0.88rem; font-weight: 600;
}
.planner-step-dot[aria-current="step"] {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: var(--bg-raised-alt);
}
.planner-step-label {
    padding: 0 0 0 8px; border: 0; background: none;
    font: inherit; font-size: 0.92rem; font-weight: 600;
    color: var(--text-tertiary); cursor: pointer;
}
.planner-step-label-active { color: var(--text-primary); }
.planner-step-connector {
    width: 56px; height: 1px; flex: none;
    background: var(--border-strong); margin: 0 10px;
}
.planner-step-dot:not([aria-current="step"]):not(.planner-step-locked):hover,
.planner-step-label:not(.planner-step-label-active):not(.planner-step-locked):hover {
    color: var(--text-primary);
}
/* Dot 3 before a plan exists: inert, default cursor, no hover invitation. */
.planner-step-locked, .planner-step-locked:hover { cursor: default; }

/* --- Steps (display-toggled containers) --------------------------------- */
.planner-step h1 {
    margin: 0 0 10px;
    font-size: 2.5rem; line-height: 1.05; font-weight: 700;
}
.planner-step h1:focus { outline: none; }
.planner-step-sub { margin: 0 0 30px; color: var(--text-secondary); line-height: 1.6; }

/* --- Step 1: the one-question amount screen ------------------------------ */
.planner-step-intro { text-align: center; }
.planner-step-intro .planner-step-sub {
    max-width: 52ch; margin-left: auto; margin-right: auto;
}
.planner-hero-input {
    display: inline-flex; align-items: center; gap: 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 14px 22px;
    background: var(--bg-raised);
}
.planner-hero-input:focus-within { outline: 3px solid var(--focus-ring); }
.planner-hero-prefix { font-size: 1.8rem; color: var(--text-tertiary); font-weight: 600; }
.planner-hero-suffix { font-size: 0.92rem; color: var(--text-tertiary); font-weight: 600; }
.planner-hero-input input {
    flex: none; width: 220px; padding: 0;
    border: 0; outline: none; border-radius: 0;
    font: inherit; font-size: 2.1rem; font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary); background: transparent;
}
.planner-hero-input input::-webkit-outer-spin-button,
.planner-hero-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.planner-inline-hint { margin: 10px 0 0; font-size: 0.85rem; color: var(--text-tertiary); }
.planner-presets {
    display: flex; justify-content: center; flex-wrap: wrap;
    gap: 8px; margin: 14px 0 32px;
}
.planner-preset-chip {
    padding: 5px 12px;
    font-size: 0.85rem; font-weight: 600;
    background: var(--silver-tint); color: var(--silver-deep);
    border: 1px solid var(--silver-line);
    border-radius: var(--radius-pill);
}
.planner-segments-row {
    display: flex; justify-content: center; flex-wrap: wrap;
    gap: 24px 40px; margin-bottom: 36px;
}
.planner-segment-group { text-align: left; }
.planner-segment-title {
    display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px;
}
.planner-segmented {
    display: inline-flex;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.planner-segmented-option {
    padding: 9px 14px; border: 0; border-radius: 0;
    background: var(--bg-raised); color: var(--text-secondary);
    font: inherit; font-size: 0.88rem; font-weight: 600;
}
.planner-segmented-option + .planner-segmented-option {
    border-left: 1px solid var(--border-strong);
}
.planner-segmented-option:hover:not(:disabled) {
    transform: none;
    background: var(--hover-surface);
}
.planner-segmented-selected,
.planner-segmented-selected:hover:not(:disabled) {
    background: var(--silver-tint); color: var(--text-primary);
}
.planner-step-ctas {
    display: flex; align-items: center; justify-content: center;
    gap: 14px; margin-top: 26px; flex-wrap: wrap;
}
.planner-step-ctas .btn-cta { padding: 15px 30px; font-size: 1rem; }
.planner-step-intro .planner-step-ctas { margin-top: 0; }
.planner-step-intro .btn-cta { padding: 15px 34px; font-size: 1.05rem; }
.planner-text-link {
    padding: 0; border: 0; background: none;
    font: inherit; font-weight: 600;
    color: var(--text-secondary); text-decoration: underline;
    cursor: pointer;
}
.planner-text-link:hover:not(:disabled) { transform: none; color: var(--silver-deep); }
.planner-note-line { margin: 22px 0 0; font-size: 0.85rem; color: var(--text-tertiary); }
.planner-note-link {
    padding: 0; border: 0; background: none;
    font: inherit; color: inherit;
    text-decoration: underline; cursor: pointer;
}
.planner-note-link:hover:not(:disabled) { transform: none; color: var(--silver-deep); }
.planner-note-panel { margin-top: 12px; text-align: left; }

/* --- Step 2: the situation checklist ------------------------------------- */
.planner-step-situation { max-width: 560px; margin-left: auto; margin-right: auto; }
.planner-step-heading { text-align: center; }
.planner-step-situation h1 { font-size: 2rem; line-height: 1.1; margin-bottom: 8px; }
.planner-step-situation .planner-step-sub { margin-bottom: 24px; }
.planner-toggle {
    display: flex; align-items: center; gap: 8px;
    margin: 0; padding: 10px 0;
    font-size: 0.95rem; font-weight: 500; cursor: pointer;
}
.planner-toggle input { flex: none; width: auto; padding: 0; }
.planner-reveal { padding: 2px 0 10px 26px; }
.planner-pair { display: flex; gap: 8px; }
.planner-pair > * { flex: 1; min-width: 0; }
.planner-pair > .planner-pair-wide { flex: 1.2; }
.planner-compact-field label {
    display: block; font-size: 0.78rem; font-weight: 600;
    margin-bottom: 4px; color: var(--text-secondary);
}
.planner-compact-field input,
.planner-compact-field select {
    width: 100%; box-sizing: border-box;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 9px 10px; font: inherit; font-size: 0.92rem;
    background: var(--bg-raised); color: var(--text-primary);
}
.planner-reveal-hint {
    margin: 6px 0 0; font-size: 0.82rem;
    color: var(--text-tertiary); line-height: 1.5;
}
.planner-room-accordion {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; margin-top: 12px; padding: 10px 12px;
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-sm);
    background: var(--bg-raised-alt);
    font: inherit; font-size: 0.88rem; font-weight: 600;
    color: var(--text-primary); text-align: left; cursor: pointer;
}
.planner-room-accordion:hover:not(:disabled) {
    transform: none;
    border-color: var(--border-strong);
}
.planner-room-caret { color: var(--text-tertiary); }
.planner-room-pill {
    display: inline-block; margin-left: 4px; padding: 0 6px;
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-pill);
    background: var(--bg-raised); color: var(--text-tertiary);
    font-size: 0.68rem; font-weight: 500;
}
.planner-room-panel { padding: 10px 2px 0; }
.planner-room-band { margin-top: 8px; }
.planner-room-experience { margin-top: 10px; }
.planner-connect-teaser { margin-top: 16px; padding: 12px 14px; }
.planner-connect-copy { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }
.planner-connect-copy strong { color: var(--text-primary); }

/* --- Step 3: the plan, visual first -------------------------------------- */
.planner-plan-header {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
}
.planner-step-plan h1 { margin: 0; font-size: 1.7rem; line-height: 1.1; }
.planner-plan-sub {
    margin: 8px 0 0; color: var(--text-secondary);
    line-height: 1.6; max-width: 74ch;
}
.planner-quick-edit { display: inline-flex; align-items: center; gap: 8px; }
.planner-quick-input {
    display: inline-flex; align-items: center; gap: 6px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 8px 10px; background: var(--bg-raised);
    color: var(--text-tertiary); font-weight: 600; font-size: 0.9rem;
}
.planner-quick-input:focus-within { outline: 2px solid var(--focus-ring); }
.planner-quick-input input {
    flex: none; width: 110px; padding: 0;
    border: 0; outline: none; border-radius: 0;
    font: inherit; font-weight: 600; font-variant-numeric: tabular-nums;
    color: var(--text-primary); background: transparent;
}
.planner-quick-input input::-webkit-outer-spin-button,
.planner-quick-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.planner-quick-edit .btn-secondary { padding: 9px 14px; font-size: 0.9rem; }
.planner-quick-hint { margin: 6px 0 0; }
.planner-bar {
    display: flex; height: 44px; margin-top: 18px;
    border-radius: var(--radius-sm); overflow: hidden;
}
.planner-bar-seg { min-width: 4px; }
/* Neutral data-viz ramp assigned in render order (never gold): cash is
   always first in the served payload, so always the lightest. */
.planner-bar-seg:nth-child(1) { background: var(--silver-line); }
.planner-bar-seg:nth-child(2) { background: var(--text-tertiary); }
.planner-bar-seg:nth-child(3) { background: var(--silver-deep); }
.planner-bar-seg:nth-child(4) { background: var(--text-primary); }
.planner-bar-seg:nth-child(n+5) { background: var(--text-secondary); }
.planner-legend { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 12px; }
.planner-legend-item {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 0.92rem; color: var(--text-secondary);
}
.planner-legend-item strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.planner-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.planner-legend-item:nth-child(1) .planner-legend-dot { background: var(--silver-line); }
.planner-legend-item:nth-child(2) .planner-legend-dot { background: var(--text-tertiary); }
.planner-legend-item:nth-child(3) .planner-legend-dot { background: var(--silver-deep); }
.planner-legend-item:nth-child(4) .planner-legend-dot { background: var(--text-primary); }
.planner-legend-item:nth-child(n+5) .planner-legend-dot { background: var(--text-secondary); }
.planner-reasons { margin-top: 22px; }
.planner-reason-row {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 18px; padding: 13px 0;
    border-bottom: 1px solid var(--border-hairline);
}
.planner-reason-copy { min-width: 0; }
.planner-reason-copy strong { font-size: 1rem; }
.planner-reason-copy p {
    margin: 3px 0 0; font-size: 0.88rem;
    color: var(--text-secondary); line-height: 1.5; max-width: 60ch;
}
.planner-reason-amount {
    font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.planner-skipped { margin: 10px 0 0; font-size: 0.85rem; color: var(--text-tertiary); }
.planner-expander-btn {
    margin-top: 14px; padding: 0; border: 0; background: none;
    font: inherit; font-size: 0.92rem; font-weight: 600;
    color: var(--silver-deep);
    text-decoration: underline dotted; cursor: pointer;
}
.planner-expander-btn:hover:not(:disabled) { transform: none; color: var(--text-primary); }
.planner-math { margin-top: 8px; }
.planner-premium-panel {
    display: flex; align-items: center; justify-content: space-between;
    gap: 18px; flex-wrap: wrap;
    margin-top: 22px; padding: 18px;
    border: 1px solid var(--gold-line);
    border-radius: var(--radius-md);
    background: var(--bg-raised);
}
.planner-premium-copy { max-width: 52ch; }
.planner-premium-copy strong { font-size: 0.95rem; }
.planner-premium-copy .hint { margin: 6px 0 0; }
.planner-premium-panel .btn-cta { padding: 12px 22px; white-space: nowrap; }
.planner-premium-cta {
    display: inline-block; padding: 12px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600; text-decoration: none; white-space: nowrap;
}
.planner-premium-cta:hover { transform: translateY(-1px); }
.planner-plan-footer {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 14px; margin-top: 22px; flex-wrap: wrap;
}
.planner-adjust-link { font-size: 0.9rem; color: var(--text-primary); white-space: nowrap; }

/* --- Shared pieces kept from the previous planner ------------------------ */
.planner-actions { margin-top: 22px; }
.planner-waterfall { overflow-x: auto; }
.planner-steps-table { width: 100%; border-collapse: collapse; }
.planner-steps-table th,
.planner-steps-table td {
    text-align: left; padding: 10px 12px;
    border-bottom: 1px solid var(--border-hairline); vertical-align: top;
}
.planner-steps-table th {
    font-size: 0.78rem; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--text-secondary);
}
.planner-steps-table th:last-child,
.planner-steps-table td:last-child { text-align: right; }
.planner-step-amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.planner-step-note { margin: 4px 0 0; max-width: 520px; }
.planner-step-skipped { opacity: 0.55; }
.planner-shelf { margin-top: 22px; }
.planner-shelf-grid { margin-top: 12px; }
.planner-fund-box .hint { margin: 6px 0 0; }
.planner-disclaimer-footer { margin: 0; max-width: 88ch; line-height: 1.55; }
@media (max-width: 640px) {
    .planner-card--guided { padding: 24px; }
    /* Dots only on small screens; each dot keeps its aria-label. */
    .planner-step-label { display: none; }
    .planner-step-connector { width: 32px; }
    .planner-step h1 { font-size: 1.9rem; }
    .planner-step-situation h1 { font-size: 1.6rem; }
    .planner-step-plan h1 { font-size: 1.4rem; }
    .planner-hero-input input { font-size: 1.6rem; width: 150px; }
    .planner-segments-row { gap: 16px; }
    .planner-segment-group { width: 100%; }
    .planner-segmented { display: flex; }
    .planner-segmented-option { flex: 1; padding: 9px 6px; }
    .planner-pair { flex-direction: column; }
}
.planner-check-inline {
    display: flex; align-items: flex-start; gap: 8px;
    font-size: 0.88rem; margin: 10px 0 0; cursor: pointer;
}
.planner-check-inline input { flex: none; width: auto; margin-top: 3px; padding: 0; }
/* These planner blocks set their own display AFTER .hidden in the cascade
   (same trap as .planner-assumptions / .rec-showcase-*) -- re-assert the
   hide or e.g. the accepted-ToS row can never disappear. */
.planner-check-inline.hidden,
.planner-bar.hidden,
.planner-legend.hidden { display: none; }
.planner-basket { margin-top: 22px; }
.planner-advisor-note { margin-top: 10px; }
.planner-saved { margin-top: 22px; }
.planner-actions .hint { margin-left: 10px; }

/* The "Based on: ..." assumptions banner + shared badges.  Tokens only. */
.planner-soon-badge {
    display: inline-block;
    font-size: 0.7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
    background: var(--silver-tint); color: var(--silver-deep);
    padding: 0.12rem 0.45rem;
    border-radius: var(--radius-pill);
    margin-left: 0.45rem; vertical-align: middle;
}
.planner-autofill-hint {
    display: inline-block;
    margin-left: 6px; padding: 0 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg-raised-alt); color: var(--text-tertiary);
    font-size: 0.68rem; font-weight: 500;
    white-space: nowrap; vertical-align: middle;
}
.planner-assumptions {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin: 14px 0 4px; padding: 12px 14px;
}
/* .hidden is declared earlier in this sheet, so the display:flex above would
   win the cascade and leave an empty banner strip -- re-hide explicitly. */
.planner-assumptions.hidden { display: none; }
.planner-assumptions-lead,
.planner-assumptions-tail {
    font-size: 0.85rem; font-weight: 600; color: var(--text-secondary);
}
.planner-assumptions-tail { font-weight: 400; }
.planner-assumption {
    padding: 4px 10px;
    font-size: 0.82rem; font-weight: 600;
    background: var(--silver-tint); color: var(--silver-deep);
    border: 1px solid var(--silver-line);
    border-radius: var(--radius-pill);
}
.planner-assumption-link {
    padding: 0; border: 0; background: none;
    font: inherit; font-weight: 600;
    color: var(--text-primary); text-decoration: underline;
    cursor: pointer;
}
.planner-assumption-link:hover:not(:disabled) { transform: none; }

/* ===========================================================================
   Navigation redesign (Tasks/Navigation_Redesign.md): the three destination
   pages -- Analyze | Discover | Portfolio.  Token-only (no raw hex) so the
   admin dark theme keeps resolving if these classes ever render there.
   =========================================================================== */

/* "Numbers never jitter" (§3 / DESIGN_SYSTEM §3) — RETIRED as an app-wide
   body rule by the 2026-07-14 remake: Schibsted Grotesk implements tnum with
   fixed-width punctuation, which gaps prose commas and even decimals
   ("+0 . 38%").  Alignment now comes from the mono data voice instead — the
   remake layer at the end of this file moves every pure-numeric element to
   --font-data (inherently tabular) and switches tnum off for mixed cells. */

/* ---- Page shell: the §3 content column (1120px + 32px gutters). ---- */
.page-shell {
    width: 100%;
    max-width: calc(var(--shell-max) + 2 * var(--page-gutter));
    margin: 0 auto;
    padding: 36px var(--page-gutter) 96px;
}

/* Cards inside the shell use the spec's 24px padding (§4.2). */
.page-shell .card {
    padding: 24px;
}

.page-header {
    margin-bottom: 18px;
}

.page-header h1 {
    margin: 2px 0 4px;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.page-subline {
    margin: 0;
    max-width: 720px;
    font-size: 15px;
    color: var(--text-secondary);
}

/* ---- Shared compliance footer (§12). ---- */
.page-footer {
    border-top: 1px solid var(--border-hairline);
    background: var(--bg-sunken);
}

.page-footer-line {
    max-width: calc(var(--shell-max) + 2 * var(--page-gutter));
    margin: 0 auto;
    padding: 18px var(--page-gutter) 22px;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ---- Segmented sub-view toggle (§4.1). ---- */
.seg {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    margin: 4px 0 20px;
    background: var(--bg-raised-alt);
    border: 1px solid var(--border-hairline);
    border-radius: 10px;
}

.seg-btn {
    padding: 7px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.seg-btn:hover {
    color: var(--text-primary);
}

.seg-btn.active {
    background: var(--bg-base);
    border-color: var(--border-strong);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(19, 19, 22, 0.04);
}

/* ---- Analyze: shared ticker search (§5.1). ---- */
.analyze-search {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.analyze-search-form {
    flex: 1 1 320px;
    max-width: 640px;
    margin: 0;
}

.analyze-search-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
}

.analyze-search-row {
    display: flex;
    gap: 10px;
}

.analyze-search-row input {
    flex: 1;
    max-width: 560px;
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
}

.analyze-search-row input:focus {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(19, 19, 22, 0.06);
    outline: none;
}

.analyze-action-form {
    margin: 0;
}

.analyze-search-hint {
    margin: 8px 0 0;
}

/* Per-sub-view action scoping: only the active sub-view's action button and
   hint are visible (metered actions stay explicit). */
#analyze-root [data-for-subview] {
    display: none;
}

#analyze-root[data-active-subview="forecast"] button[data-for-subview="forecast"],
#analyze-root[data-active-subview="fair-value"] form[data-for-subview="fair-value"] {
    display: inline-flex;
}

#analyze-root[data-active-subview="forecast"] p[data-for-subview="forecast"],
#analyze-root[data-active-subview="fair-value"] p[data-for-subview="fair-value"] {
    display: block;
}

/* The horizon picker wrapper (a div, unlike the button/form/p rules above)
   shows only on the Forecast sub-view.  Its inner noise note deliberately
   carries NO data-for-subview so its .hidden toggle is never overridden by
   these display rules (the documented `.hidden` cascade trap). */
#analyze-root[data-active-subview="forecast"] div[data-for-subview="forecast"] {
    display: block;
}

.horizon-picker {
    margin-top: 10px;
}

.horizon-picker .seg {
    margin: 0;
}

/* .seg-btn was styled for anchors; native buttons need the UA chrome reset
   on the NON-active state only — the remake layer's ink active pill
   (background + inverted color) must keep winning for .active. */
.horizon-seg .seg-btn:not(.active) {
    background: none;
}

.horizon-seg .seg-btn {
    font-family: inherit;
    cursor: pointer;
}

.horizon-note {
    margin: 6px 0 0;
    max-width: 62ch;
}

.analyze-seg {
    margin-top: 16px;
}

/* ---- Analyze: ticker context line (§5.3). ---- */
.analyze-context-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.analyze-context-ticker {
    margin: 0;
    font-size: 19px;
    font-weight: 600;
}

.analyze-context-sep {
    color: var(--text-tertiary);
}

.analyze-context-price {
    font-size: 15px;
    font-weight: 600;
}

.analyze-context-note {
    font-size: 13px;
    color: var(--text-tertiary);
}

/* ---- Analyze: model cards (§5.3). ---- */
.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.model-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.model-card-top .model-column-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.model-card-top .model-subtitle {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.model-hero {
    display: block;
    font-size: 40px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.model-hero-label {
    margin: 2px 0 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.model-price-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border-hairline);
}

.model-price-row strong {
    font-size: 15px;
    font-weight: 600;
}

.model-details {
    margin-top: 10px;
}

.model-details summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}

.model-details[open] summary {
    margin-bottom: 8px;
}

.model-column .data-note {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Hero number inherits gain/loss/neutral ink from the value-tone classes. */
.model-hero.value-neutral {
    color: var(--text-primary);
}

/* ---- Analyze: markets strip as one slim card (§5.3.1). ---- */
.market-summary {
    margin: 0 0 16px;
    padding: 12px 20px;
    background: var(--bg-raised);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-md);
}

.market-summary .section-header {
    margin-bottom: 6px;
}

.market-summary-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

/* ---- Analyze: fair-value pair (§5.4). ---- */
.fv-pair {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin: 14px 0;
}

.fv-gauge-card {
    flex: 1.7 1 400px;
    min-width: min(400px, 100%);
    margin: 0;
}

.fv-pair .hype-card {
    flex: 1 1 280px;
    min-width: min(280px, 100%);
    margin: 0;
    border-color: var(--gold-line);
}

.fv-gauge-explainer {
    margin: 4px 0 0;
}

/* The gauge (§5.4.1): 6px silver track, band fixed at 20% -> 80%, JS-placed
   current-price marker with its label above and end labels below. */
.fv-gauge {
    position: relative;
    height: 84px;
    margin: 16px 0 4px;
}

.fv-gauge.hidden {
    display: none;   /* .hidden guard: this block declares its own layout */
}

.fv-gauge-track {
    position: absolute;
    left: 0;
    right: 0;
    top: 46px;
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--silver-tint);
}

.fv-gauge-band {
    position: absolute;
    left: 20%;
    width: 60%;
    top: 0;
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--silver-deep);
}

.fv-gauge-marker {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
}

.fv-gauge-marker.hidden {
    display: none;   /* .hidden guard: this block declares its own layout */
}

.fv-gauge-now {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.fv-gauge-tick {
    width: 1px;
    height: 14px;
    margin-top: 2px;
    background: var(--text-primary);
}

.fv-gauge-dot {
    width: 14px;
    height: 14px;
    margin-top: -4px;
    border-radius: var(--radius-pill);
    background: var(--bg-base);
    border: 2px solid var(--text-primary);
}

.fv-gauge-ends {
    position: absolute;
    left: 20%;
    right: 20%;
    top: 62px;
    display: flex;
    justify-content: space-between;
}

.fv-gauge-end {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.fv-exit-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-hairline);
}

.fv-exit-note {
    flex: 1;
    min-width: 160px;
    margin: 0;
}

/* Hype hero (§5.4.2): big score + quiet suffix. */
.hype-hero {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 4px 0 6px;
}

.hype-hero strong {
    font-size: 40px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.hype-hero-suffix {
    font-size: 15px;
    color: var(--text-tertiary);
}

/* "See the math" disclosure holding the full numeric breakdown. */
.fv-math summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

.fv-math[open] summary {
    margin-bottom: 12px;
}

/* Beginner's guide as a 3-column definition grid (§5.4.3). */
.beginner-guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px 20px;
}

.beginner-guide-item dt {
    font-weight: 600;
    margin-bottom: 4px;
}

.beginner-guide-item dd {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ---- Analyze: history (§5.5). ---- */
.history-heading {
    margin: 0 0 6px;
}

.history-hint {
    margin: 0 0 14px;
}

.history-table {
    min-width: 720px;
}

.history-table .num {
    text-align: right;
}

.history-footer {
    margin: 12px -18px -12px;
    padding: 10px 18px;
    background: var(--bg-sunken);
    border-top: 1px solid var(--border-hairline);
}

/* Table headers read sentence-case Label type (§4.5), not shouty caps. */
.data-table thead th {
    text-transform: none;
    letter-spacing: 0.02em;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ---- Discover: gainers/bottlenecks headers + tier control (§6.2). ---- */
.rec-gainers-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin: 2px 0 14px;
}

.rec-gainers-title {
    margin: 0 0 2px;
    font-size: 19px;
    font-weight: 600;
}

.rec-gainers-tagline {
    margin: 0;
    max-width: 560px;
}

/* Compact segmented (§4.1 compact variant) replacing the pill tier switch. */
.rec-view-switch {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: var(--bg-raised-alt);
    border: 1px solid var(--border-hairline);
    border-radius: 10px;
}

.rec-view-seg {
    padding: 5px 14px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.rec-view-seg:hover:not(.active) {
    color: var(--text-primary);
    transform: none;
}

.rec-view-seg.active {
    background: var(--bg-base);
    border-color: var(--border-strong);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(19, 19, 22, 0.04);
}

/* Upgrade footer (§6.2): quiet sunken band + the page's single gold CTA. */
.rec-upgrade-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin: 14px -18px -12px;
    padding: 12px 18px;
    background: var(--bg-sunken);
    border-top: 1px solid var(--border-hairline);
}

.rec-upgrade-footer.hidden {
    display: none;   /* .hidden guard: this block declares its own display */
}

.rec-upgrade-footer-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ---- Discover: index shelf heading row (§6.1). ---- */
.index-shelf-heading-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.index-shelf-pill {
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--silver-tint);
    color: var(--silver-deep);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.index-shelf-tagline {
    margin: 2px 0 8px;
}

/* ---- Discover: bottleneck theme cards (§6.3). ---- */
.bot-theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.bot-theme-card {
    background: var(--bg-raised);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-md);
    padding: 16px 18px;
}

.bot-theme-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.bot-theme-name {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.bot-theme-desc {
    margin: 4px 0 0;
}

.bot-theme-rows {
    margin-top: 10px;
}

.bot-theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--border-hairline);
}

.bot-theme-row:first-child {
    border-top: 0;
}

.bot-theme-stock {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bot-theme-ticker {
    font-size: 14px;
    font-weight: 600;
}

.bot-theme-company {
    font-size: 12px;
}

.bot-theme-role {
    font-size: 13px;
    color: var(--text-secondary);
}

.bot-theme-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex: none;
}

.bot-theme-final {
    font-size: 12px;
    white-space: nowrap;
}

/* ---- Portfolio: holdings header + inline panels (§7.1). ---- */
.section-header-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.watchlist-count {
    font-size: 13px;
    color: var(--text-tertiary);
}

.inline-panel {
    margin: 12px 0;
    border-radius: var(--radius-md);
}

.inline-panel ul {
    margin: 6px 0 0;
    padding-left: 0;
    list-style: none;
}

.inline-panel li {
    padding: 4px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.inline-panel-symbol {
    font-weight: 600;
    color: var(--text-primary);
}

/* The per-row cross-link to Analyze (§7.1) -- an <a> styled as a small
   secondary button (the delegation handler only listens for <button>s). */
.watchlist-analyze-link {
    display: inline-block;
    padding: 6px 10px;
    border: 1px solid var(--silver-line);
    border-radius: var(--radius-sm);
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.watchlist-analyze-link:hover {
    background: var(--bg-sunken);
    border-color: var(--border-strong);
}

/* ---- Small-screen fit (§10, verified at 390/320px via CDP emulation). ---- */

/* The segmented toggle never widens the page: worst case it scrolls inside
   its own box (same rule as tables-in-cards). */
.seg {
    max-width: 100%;
    overflow-x: auto;
}

/* Grid card minimums must never beat the viewport (index shelf = 260px min,
   bottleneck themes = 340px min). */
.index-shelf-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
}

.bot-theme-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
}

@media (max-width: 480px) {
    .page-shell {
        padding-left: 16px;
        padding-right: 16px;
    }
    .seg-btn {
        padding: 7px 12px;
        font-size: 13px;
    }
    /* Header button rows (watchlist controls) wrap instead of overflowing. */
    .section-header {
        flex-wrap: wrap;
    }
    .section-header-controls {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}

/* The page-shell + 24px card padding leave ~240px of column at 320px wide —
   tighter than the retired /planner page the 3a rules were tuned for.  Let
   the hero input flex and the segmented rows wrap instead of overflowing. */
@media (max-width: 400px) {
    .planner-hero-input {
        max-width: 100%;
        padding: 14px 16px;
    }
    .planner-hero-input input {
        flex: 1;
        width: auto;
        min-width: 0;
    }
    .planner-segmented {
        flex-wrap: wrap;
    }
}

/* ===========================================================================
   UI REMAKE 2026-07-14 — "the private desk"
   (Tasks/UI-Remake-2026-07-14-Direction.md.)  A presentation-only layer
   appended last so it wins ties against the rules it refines.  Token-only,
   except --foil (the one sanctioned metallic).  Deliberately declares NO
   `display` anywhere: blocks that can carry .hidden keep their guards.
   =========================================================================== */

/* The machined-silver button family: a light metal fill, hairline edge, and a
   faint top light.  The inset highlight is tokenized so dark mode keeps it
   subliminal instead of drawing a bright line. */
:root { --btn-highlight: rgba(255, 255, 255, 0.65); }
:root[data-theme="dark"] { --btn-highlight: rgba(255, 255, 255, 0.06); }

button {
    background: var(--silver-tint);
    border: 1px solid var(--silver-line);
    box-shadow: inset 0 1px 0 var(--btn-highlight);
    transition: transform 0.18s ease, opacity 0.18s ease,
                border-color 0.18s ease, background 0.18s ease;
}

button:hover:not(:disabled) {
    border-color: var(--silver-core);
}

button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.btn-primary {
    background: var(--silver-tint);
}

/* Destructive stays quieter than the action beside it: ghost, not filled. */
.btn-danger {
    background: transparent;
    border-color: var(--border-strong);
    box-shadow: none;
    color: var(--text-secondary);
}

.btn-danger:hover:not(:disabled) {
    color: var(--text-primary);
    background: var(--hover-surface);
}

/* --------------------------------------------------------------------------
   The foil signature.  Three gold objects share one metal: the brand-mark
   dot, the nav token chip, and the single .btn-cta per view.  The CTA also
   carries the light-sweep — the only moving highlight in the product.
   -------------------------------------------------------------------------- */
.btn-cta {
    position: relative;
    overflow: hidden;
    background: var(--foil);
    border: 1px solid var(--gold-line);
    color: var(--gold-deep);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-cta::after {
    content: "";
    position: absolute;
    top: -25%;
    bottom: -25%;
    left: 0;
    width: 34%;
    background: linear-gradient(105deg, transparent,
                                var(--foil-sheen), transparent);
    transform: translateX(-160%) skewX(-18deg);
    transition: transform 0.55s ease;
    pointer-events: none;
}

.btn-cta:hover::after,
.btn-cta:focus-visible::after {
    transform: translateX(340%) skewX(-18deg);
}

.btn-cta:hover:not(:disabled) {
    border-color: var(--gold-core);
}

.nav-brand-mark::after {
    background: var(--foil);
}

.nav-brand-mark {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
}

/* The RYCHEZT wordmark (renamed 2026-07-14, Rayan's request): a Times-style
   serif, distinct from both product voices — the engraved-nameplate moment.
   System serif stack, so no extra font download. */
.nav-brand-word {
    font-family: "Times New Roman", Times, Georgia, serif;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.06em;
}

/* Foil token chip — scoped so the zero-balance (loss-tinted) state keeps its
   own colors; the count speaks in the data voice. */
.nav-token-chip:not(.nav-token-chip-empty) {
    background: var(--foil);
    border-color: var(--gold-line);
    color: var(--gold-deep);
}

.nav-token-chip:not(.nav-token-chip-empty) .nav-token-bolt {
    color: var(--gold-deep);
}

.nav-token-chip:not(.nav-token-chip-empty):hover {
    border-color: var(--gold-strong);
}

.nav-token-count {
    font-family: var(--font-data);
    font-weight: 600;
}

.nav-token-chip:focus-visible {
    outline: 2px solid var(--gold-strong);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Ink navigation: frosted bar, decisive near-black active pills.
   -------------------------------------------------------------------------- */
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .main-nav {
        background: color-mix(in srgb, var(--bg-base) 78%, transparent);
        -webkit-backdrop-filter: blur(14px) saturate(1.5);
        backdrop-filter: blur(14px) saturate(1.5);
    }
}

.nav-link.active {
    background: var(--text-primary);
    color: var(--bg-base);
}

.nav-link.active:hover {
    background: var(--text-primary);
    color: var(--bg-base);
}

.seg-btn.active {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: var(--bg-base);
    box-shadow: none;
}

.seg-btn.active:hover {
    color: var(--bg-base);
}

.planner-segmented-selected,
.planner-segmented-selected:hover:not(:disabled) {
    background: var(--text-primary);
    color: var(--bg-base);
}

/* --------------------------------------------------------------------------
   The two typographic voices, applied.
   -------------------------------------------------------------------------- */
.eyebrow {
    font-family: var(--font-data);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.16em;
}

h1 {
    font-weight: 650;
    letter-spacing: -0.03em;
}

.page-header h1 {
    font-size: 30px;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.data-table thead th {
    font-family: var(--font-data);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.12em;
}

.dir-badge,
.status-badge,
.result-badge {
    font-family: var(--font-data);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.token-cost-hint {
    font-family: var(--font-data);
    font-size: 0.72rem;
    letter-spacing: 0.02em;
}

.analyze-context-ticker,
.analyze-context-price {
    font-family: var(--font-data);
    font-weight: 600;
}

input[data-ticker-search] {
    font-family: var(--font-data);
    font-weight: 500;
    letter-spacing: 0.04em;
}

#planner-amount,
#planner-amount-quick,
.planner-hero-prefix,
.planner-hero-suffix {
    font-family: var(--font-data);
}

#planner-amount,
#planner-amount-quick {
    font-weight: 500;
}

.page-footer-line {
    font-family: var(--font-data);
    font-size: 11px;
    letter-spacing: 0.02em;
}

/* --------------------------------------------------------------------------
   Detail floor: on-palette links, gold selection, visible keyboard focus.
   -------------------------------------------------------------------------- */
a {
    color: var(--text-primary);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

::selection {
    background: var(--gold-tint);
    color: var(--text-primary);
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
}

::placeholder {
    color: var(--text-tertiary);
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Interactive lift — only on cards that are already click/hover objects.
   Static surfaces stay flat (DESIGN_SYSTEM §5).
   -------------------------------------------------------------------------- */
.index-shelf-card,
.bot-theme-card {
    transition: transform 0.18s ease, box-shadow 0.18s ease,
                border-color 0.18s ease;
}

.index-shelf-card:hover,
.bot-theme-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--lift-shadow);
}

/* --------------------------------------------------------------------------
   One orchestrated motion: a quiet rise on the shell's children at load
   (and on sub-view sections when they re-appear).  Chrome never bounces.
   -------------------------------------------------------------------------- */
@keyframes remake-rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

.page-shell > * {
    animation: remake-rise 0.42s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.page-shell > :nth-child(1) { animation-delay: 0.03s; }
.page-shell > :nth-child(2) { animation-delay: 0.09s; }
.page-shell > :nth-child(3) { animation-delay: 0.15s; }
.page-shell > :nth-child(n+4) { animation-delay: 0.21s; }

/* Auth / legacy pages: the lone card rises without a stagger. */
.page > .card {
    animation: remake-rise 0.42s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --------------------------------------------------------------------------
   The data voice, applied to every pure-numeric element (remake follow-up).
   Schibsted Grotesk's tnum gives punctuation fixed digit widths — it gaps
   decimals ("+0 . 38%") — so alignment comes from the mono face instead:
   IBM Plex Mono is inherently tabular, making the tnum hints above harmless.
   Mixed-content cells (tables with names/emails, label badges, tooltips)
   stay in the UI face with the feature switched off.
   -------------------------------------------------------------------------- */
.result-box strong,
.metric-box strong,
.compare-stat strong,
.mini-metrics strong,
.shared-close strong,
.hype-pillar-box strong,
.perf-card-accuracy,
.market-index-change,
.rec-score-badge,
.rec-showcase-metric-value,
.price-chart-price,
.price-chart-axis-label,
.price-chart-tooltip,
.tokens-balance-value,
.tokens-recent-delta,
.analytics-bar-value,
.adm-kpi-delta,
.adm-kpi-value,
.adm-stat-value,
.adm-statrow-value,
.model-price-row strong,
.planner-legend-item strong,
.planner-reason-amount,
.planner-step-amount {
    font-family: var(--font-data);
}

.perf-row,
.data-table td,
.baseline-table td,
.valuation-label-badge,
.valuation-mini-badge,
.admin-table,
.adm-seg-btn,
.adm-tip {
    font-variant-numeric: normal;
}

/* --------------------------------------------------------------------------
   Remake follow-up: the recommendations tier selector joins the ink-pill
   language, and the last standalone numerics join the data voice.
   -------------------------------------------------------------------------- */
.rec-view-seg.active {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: var(--bg-base);
}

.rec-view-seg.active:hover {
    color: var(--bg-base);
}

.fv-gauge-now,
.fv-gauge-end,
#watchlist-body td:first-child > strong {
    font-family: var(--font-data);
}

.fv-gauge-now {
    font-weight: 600;
}

/* Native form controls join the palette: ink checks, no default blue. */
input[type="checkbox"],
input[type="radio"],
progress {
    accent-color: var(--text-primary);
}
