/* ===== StockScanner24 design system — modern banking ===== */
:root {
    --navy: #0B3C5D;
    --navy-deep: #071E33;
    --navy-soft: #123F63;
    --gold: #C9A227;
    --gold-soft: #F3E9C6;
    --bg: #F4F6FA;
    --surface: #FFFFFF;
    --surface-2: #F9FAFC;
    --line: #E4E7EC;
    --line-strong: #D0D5DD;
    --text: #101828;
    --text-2: #475467;
    --text-3: #667085; /* helper text: 4.97:1 on white (WCAG AA) */
    --ink-faint: #98A2B3; /* decorative only: dots, connectors, icon tints - never running text */
    --success: #107C10;
    --success-bg: #E6F4EA;
    --danger: #B42318;
    --danger-bg: #FDECEA;
    --warning: #B54708;
    --warning-bg: #FFF4E5;
    --info: #0B3C5D;
    --info-bg: #E8F0F7;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
    --shadow-lg: 0 12px 32px rgba(7, 30, 51, 0.16);
    --sidebar: 248px;
    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.sub { color: var(--text-2); }
.pos { color: var(--success); }
.neg { color: var(--danger); }
.strong { font-weight: 700; }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.flex { display: flex; align-items: center; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 4px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ---------- boot ---------- */
.boot { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: var(--navy-deep); color: #fff; }
.boot-logo { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }
.boot-logo span { color: var(--gold); }
.boot-bar { width: 200px; height: 4px; background: rgba(255,255,255,0.15); border-radius: 99px; overflow: hidden; }
.boot-bar div { width: 40%; height: 100%; background: var(--gold); animation: boot 1.2s infinite ease-in-out; }
@keyframes boot { 0% { transform: translateX(-100%);} 100% { transform: translateX(350%);} }
.boot-text { font-size: 12px; opacity: 0.7; }
/* "Cannot reach the API" state (MainLayout): branded, with Retry and automatic retry */
.boot-error { padding: 24px; text-align: center; }
.boot-error .brand-mark.lg { width: 56px; height: 56px; border-radius: 14px; }
.boot-error .boot-logo { font-size: 26px; }
.boot-error .boot-title { font-size: 18px; font-weight: 700; margin-top: 8px; }
.boot-error .boot-msg { max-width: 520px; color: rgba(255,255,255,0.8); line-height: 1.5; font-size: 14px; }
.boot-error .boot-text { max-width: 520px; line-height: 1.5; }
#blazor-error-ui { background: var(--danger); color: #fff; bottom: 0; display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
#blazor-error-ui a { color: #fff; text-decoration: underline; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--navy-deep); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 22px 20px 16px; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--navy); display: grid; place-items: center; }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; }
.brand-name span { color: var(--gold); }
.brand-tag { font-size: 10px; color: rgba(255,255,255,0.5); letter-spacing: 0.08em; text-transform: uppercase; }
.team-switch { margin: 4px 14px 14px; position: relative; }
.team-btn { width: 100%; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 9px 10px; color: #fff; cursor: pointer; text-align: left; font-family: inherit; }
.team-btn:hover { background: rgba(255,255,255,0.1); }
.team-btn svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }
.team-menu-item svg { width: 16px; height: 16px; }
.menu-item svg { width: 16px; height: 16px; }
.search-item svg, .list-item > svg { width: 16px; height: 16px; color: var(--ink-faint); flex-shrink: 0; }
.alert svg, .empty > svg { flex-shrink: 0; }
.alert svg { width: 18px; height: 18px; }
.card-head h2 svg, .kpi .label svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.page-head h1 > svg { width: 22px; height: 22px; vertical-align: -3px; margin-right: 6px; flex: 0 0 auto; }
.team-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.team-btn .name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.team-btn .org { font-size: 11px; color: rgba(255,255,255,0.55); }
.team-menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; color: var(--text); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.team-menu-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.team-menu-item:hover, .team-menu-item.active { background: var(--info-bg); }
.team-menu-item .badge { margin-left: auto; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.nav-section { padding: 14px 12px 6px; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255,255,255,0.4); }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: rgba(255,255,255,0.78); font-weight: 500; font-size: 13.5px; }
.nav-link:hover { background: rgba(255,255,255,0.07); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--navy); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav-link svg { width: 18px; height: 18px; opacity: 0.9; }
.nav-link .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 11px; color: rgba(255,255,255,0.45); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.env-badge { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10.5px; color: rgba(255,255,255,0.6); background: rgba(201,162,39,0.14); border: 1px solid rgba(201,162,39,0.35); padding: 2px 9px; border-radius: 999px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.must-change-password { border-radius: 0; justify-content: center; margin: 0; }
.must-change-password a { color: inherit; font-weight: 600; text-decoration: underline; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-on { background: #34C759; box-shadow: 0 0 0 3px rgba(52,199,89,0.2); }
.dot-off { background: #FF453A; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 40; height: 60px; background: rgba(255,255,255,0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 16px; padding: 0 28px; }
.search { position: relative; flex: 1; max-width: 460px; }
.search input { width: 100%; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 12px 0 38px; font: inherit; font-size: 13.5px; color: var(--text); outline: none; }
.search input:focus { border-color: var(--navy); background: #fff; box-shadow: 0 0 0 3px rgba(11,60,93,0.12); }
.search svg { position: absolute; left: 12px; top: 11px; width: 16px; height: 16px; color: var(--ink-faint); }
.search-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; max-height: 380px; overflow: auto; }
.search-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.search-item:hover { background: var(--info-bg); }
.search-item .sym { font-family: var(--mono); font-weight: 600; min-width: 64px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { border-color: var(--line-strong); color: var(--navy); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; flex-shrink: 0; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.gold { background: var(--gold); color: var(--navy-deep); }
.user-menu { position: relative; }
.user-menu .menu { position: absolute; right: 0; top: calc(100% + 8px); width: 240px; background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); padding: 8px; z-index: 60; }
.menu-head { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; color: var(--text); font-size: 13.5px; width: 100%; background: none; border: 0; font-family: inherit; text-align: left; }
.menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-item.danger { color: var(--danger); }

.content { padding: 24px 28px 40px; display: flex; flex-direction: column; gap: 20px; overflow-x: hidden; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .title { display: flex; flex-direction: column; gap: 4px; }
.page-head .crumbs { font-size: 12px; color: var(--text-3); }
.page-head .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; max-width: 100%; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; max-width: 100%; }
.card-head h2 { font-size: 14px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-2); }
.grid { display: grid; gap: 16px; }
/* a grid/flex child may never be widened by its min-content (wide tables scroll inside .table-wrap instead) */
.grid > *, .stack > *, .card, .card > *, .list-item > * { min-width: 0; }
/* hidden on tablets and phones (secondary table columns) */
@media (max-width: 1100px) { .hide-md { display: none !important; } }
/* hidden on laptops and projectors (tertiary table columns: exchange, low/high targets, offer price, first trading day...) so the differentiating columns never scroll out of view at 1200-1600px; they return on 1680px+ screens */
@media (max-width: 1650px) { .hide-lg { display: none !important; } }
/* shown only while .hide-lg columns are hidden: carries the Help icon of a hidden column on a neighbouring header */
.show-lg { display: none; }
@media (max-width: 1650px) { .show-lg { display: inline !important; } }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; }

.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden; }
.kpi .label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.kpi .value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; font-family: var(--mono); }
.kpi .hint { font-size: 11px; color: var(--text-3); }
.kpi .kpi-icon { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--info-bg); color: var(--navy); }
.kpi .kpi-icon svg { width: 18px; height: 18px; }
.kpi.accent { background: linear-gradient(135deg, var(--navy-deep), var(--navy)); color: #fff; border-color: transparent; }
.kpi.accent .label, .kpi.accent .hint { color: rgba(255,255,255,0.7); }
.kpi.accent .kpi-icon { background: rgba(255,255,255,0.12); color: var(--gold); }
.kpi.warn .kpi-icon { background: var(--warning-bg); color: var(--warning); }
.kpi.good .kpi-icon { background: var(--success-bg); color: var(--success); }

/* ---------- pills / badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; line-height: 18px; }
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-warning { background: var(--warning-bg); color: var(--warning); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-neutral { background: #EEF1F5; color: var(--text-2); }
.pill-muted { background: #F2F4F7; color: #475467; }
.pill-gold { background: var(--gold-soft); color: #7A5C00; }
.pill-xs { padding: 0 6px; font-size: 10px; line-height: 16px; letter-spacing: 0.04em; text-transform: uppercase; }
/* suffix inside a status pill ("Expected listing · 14 Sep"): an element so Razor can never trim the separating space */
.pill .sfx { margin-left: 4px; font-weight: 500; }
/* Icons inside pills (lock-up countdowns, portfolio badges) size with the pill; the icon SVGs carry no width of their own. */
.pill svg { width: 12px; height: 12px; flex: 0 0 auto; }
/* ticker with TBA / Demo pills (SymbolBadge) */
.symbol-badge { display: inline-flex; align-items: center; gap: 6px; }
.symbol-badge a.sym { color: var(--navy); text-decoration: none; }
.symbol-badge a.sym:hover { text-decoration: underline; }
/* today's briefing */
.briefing { list-style: none; margin: 0; padding: 0; }
.briefing li { display: flex; align-items: flex-start; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.briefing li:last-child { border-bottom: 0; }
.briefing .dot { flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--ink-faint); }
.briefing .dot.Urgent { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.briefing .dot.Notice { background: var(--navy); }
.briefing .dot.Info { background: var(--ink-faint); }
.briefing .ico { flex-shrink: 0; color: var(--ink-faint); display: inline-flex; margin-top: 2px; }
.briefing .ico svg { width: 15px; height: 15px; }
.briefing a { color: var(--text); text-decoration: none; }
.briefing a:hover { color: var(--navy); text-decoration: underline; }
.briefing .quiet { color: var(--text-2); }
.kpi .foot { font-size: 11px; color: var(--text-3); border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 2px; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: var(--navy-deep); font-size: 11px; font-weight: 700; }
.heat { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-weight: 600; font-size: 12px; }
.heat::before { content: ''; width: 8px; height: 8px; border-radius: 50%; }
.heat-hot::before { background: #E4572E; box-shadow: 0 0 0 3px rgba(228,87,46,0.18); }
.heat-warm::before { background: var(--gold); }
.heat-cool::before { background: var(--ink-faint); }
.sym { font-family: var(--mono); font-weight: 700; letter-spacing: 0.01em; }
.meter { height: 6px; background: #EEF1F5; border-radius: 99px; overflow: hidden; }
.meter > div { height: 100%; border-radius: 99px; background: var(--navy); }
.meter.gold > div { background: var(--gold); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.row-link { cursor: pointer; }
.tbl tr.row-link:hover td { background: #F7F9FC; }
.tbl th.right, .tbl td.right { text-align: right; }
.tbl .primary { font-weight: 600; color: var(--text); }
.tbl .secondary { font-size: 12px; color: var(--text-3); }
/* company-name cells: one line with an ellipsis (the full name sits in the title attribute) so a long name never widens the table */
.tbl td.name-cell { max-width: 240px; }
.tbl .name-cell .n { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl td.src-cell { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* pricing pills (outcome + upsized) wrap onto two lines instead of widening the column */
.tbl .pills-end { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; max-width: 130px; }
/* the watch star stays in view while a wide table (screener, Recent IPOs) scrolls inside its wrap */
.tbl th.sticky-end, .tbl td.sticky-end { position: sticky; right: 0; background: var(--surface); box-shadow: -6px 0 8px -6px rgba(11, 60, 93, 0.12); }
.tbl th.sticky-end { background: var(--surface-2); }
.tbl tr.row-link:hover td.sticky-end { background: #F7F9FC; }
.tbl.compact th, .tbl.compact td { padding: 8px 10px; }
.tbl.compact td.name-cell { max-width: 220px; }
/* the screener carries ten differentiating columns; a 200px name (full name in the tooltip) keeps them all inside a 1440px window */
.tbl.screener td.name-cell { max-width: 200px; }
.tbl.screener th, .tbl.screener td { padding-left: 8px; padding-right: 8px; }
.tbl.screener .change-line { flex-wrap: wrap; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item.link { cursor: pointer; }
.list-item.link:hover { background: #F7F9FC; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; font-size: 13.5px; }
.list-item .meta { font-size: 12px; color: var(--text-3); }
/* "What to do: ..." under an alert (Contracts/AlertGuidance): readable body size, one line on the dashboard card */
.list-item .meta.next-step { font-size: 13px; color: var(--text-2); margin-top: 3px; line-height: 1.45; }
.list-item .meta.next-step b { font-weight: 600; color: var(--text); }
.list-item .meta.next-step.clamp-1 { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.rule-pill:hover { text-decoration: none; background: #E4E7EC; }
.tbl tr.hit td { background: var(--gold-soft); box-shadow: inset 3px 0 0 var(--gold); }
.field .help.example { font-style: italic; color: var(--text-2); }
.toast .b .next-step { color: var(--text); }
.list-item.unread { background: #FBF9F1; }
.sev-bar { width: 4px; align-self: stretch; border-radius: 4px; background: var(--line-strong); }
.sev-Critical { background: var(--danger); }
.sev-Urgent { background: var(--warning); }
.sev-Notice { background: var(--navy); }
.sev-Info { background: var(--ink-faint); }
.date-block { width: 46px; text-align: center; border-radius: 9px; background: var(--info-bg); color: var(--navy); padding: 6px 0; line-height: 1.1; flex-shrink: 0; }
.date-block .d { font-size: 17px; font-weight: 800; font-family: var(--mono); }
.date-block .m { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.date-block.hot { background: #FDE9E3; color: #B23A1A; }
.date-block.today { background: var(--navy); color: #fff; }

/* ---------- forms & buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-strong); background: #fff; color: var(--text); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--navy); color: var(--navy); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-soft); color: #fff; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy-deep); }
.btn-gold:hover { background: #d8b23a; color: var(--navy-deep); }
.btn-danger { color: var(--danger); border-color: #F3B5AE; }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .help { font-size: 12px; color: var(--text-3); }
.input, .select, .textarea { width: 100%; height: 38px; border-radius: 9px; border: 1px solid var(--line-strong); background: #fff; padding: 0 12px; font: inherit; font-size: 13.5px; color: var(--text); outline: none; }
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(11,60,93,0.12); }
.input.sm, .select.sm { height: 32px; font-size: 13px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--navy); }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .input, .toolbar .select { width: auto; min-width: 140px; }
.segment { display: inline-flex; flex-wrap: wrap; max-width: 100%; background: #EEF1F5; border-radius: 9px; padding: 3px; }
.segment button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.segment button.active { background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.alert { padding: 12px 14px; border-radius: 10px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.alert-danger { background: var(--danger-bg); color: var(--danger); }
.validation-errors { display: flex; flex-direction: column; gap: 4px; }
.validation-message { font-size: 12px; color: var(--danger); }
ul.validation-errors:empty { display: none; }
.alert-info { background: var(--info-bg); color: var(--navy); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-success { background: var(--success-bg); color: var(--success); }

/* ---------- empty / loading ---------- */
.empty { padding: 40px 20px; text-align: center; color: var(--text-3); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.empty svg { width: 36px; height: 36px; opacity: 0.4; }
.empty .t { font-weight: 600; color: var(--text-2); }
.skeleton { background: linear-gradient(90deg, #EEF1F5 25%, #F7F9FC 50%, #EEF1F5 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; height: 14px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(11,60,93,0.2); border-top-color: var(--navy); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; width: 340px; max-width: calc(100vw - 24px); max-height: 70vh; overflow: hidden; }
.toast { background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); padding: 12px 14px; border-left: 4px solid var(--navy); display: flex; gap: 10px; align-items: flex-start; animation: rise 0.25s ease-out; }
.toast.urgent { border-left-color: var(--warning); }
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
.toast .t { font-weight: 700; font-size: 13px; }
.toast .b { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.toast .x { margin-left: auto; cursor: pointer; color: var(--ink-faint); border: 0; background: none; font-size: 16px; line-height: 1; flex-shrink: 0; }
.toast .x:hover, .toast .x:focus-visible { color: var(--text); }
.toasts .dismiss-all { align-self: flex-end; border: 0; background: rgba(255,255,255,0.92); color: var(--navy); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 4px 10px; border-radius: 999px; box-shadow: var(--shadow); }
.toasts .dismiss-all:hover { text-decoration: underline; }
.toast .b { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.toast.summary { border-left-color: var(--gold); }
@media (max-width: 480px) { .toasts { left: 12px; right: 12px; bottom: 12px; width: auto; } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(7,30,51,0.5); backdrop-filter: blur(2px); z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); max-height: 90vh; overflow: auto; }
.modal:has(.pf-kinds), .modal:has(.pf-fields) { max-width: 760px; }
.modal .card-head { position: sticky; top: 0; background: #fff; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: radial-gradient(1200px 600px at -10% -10%, #164B73 0%, var(--navy-deep) 55%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h1 { font-size: 36px; line-height: 1.15; letter-spacing: -0.02em; max-width: 520px; }
.auth-side h1 span { color: var(--gold); }
.auth-side p { color: rgba(255,255,255,0.7); max-width: 460px; line-height: 1.6; font-size: 15px; }
.auth-points { display: grid; gap: 14px; margin-top: 32px; }
.auth-point { display: flex; gap: 12px; align-items: flex-start; }
.auth-point .ic { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,0.08); display: grid; place-items: center; color: var(--gold); flex-shrink: 0; }
.auth-point .ic svg { width: 16px; height: 16px; }
.auth-point b { display: block; font-size: 13.5px; }
.auth-point span { font-size: 12.5px; color: rgba(255,255,255,0.6); }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 18px; }
.auth-card h2 { font-size: 24px; }
.auth-foot { font-size: 12px; color: rgba(255,255,255,0.4); }

/* ---------- chart ---------- */
.chart-box { position: relative; height: 320px; }
.chart-box.sm { height: 220px; }

/* ---------- analysis ---------- */
.analysis-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.analysis-block { padding: 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.analysis-block h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 8px; }
.analysis-block.bull { border-color: #BFE3C6; background: #F1FAF3; }
.analysis-block.bear { border-color: #F3C4BE; background: #FDF3F2; }
.analysis-block p, .analysis-block li { font-size: 13px; line-height: 1.55; color: var(--text); white-space: pre-line; }
.conviction { display: flex; align-items: center; gap: 14px; }
.conviction .ring { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-weight: 800; font-size: 18px; color: var(--navy); background: conic-gradient(var(--gold) calc(var(--v) * 1%), #EEF1F5 0); }
.conviction .ring span { width: 50px; height: 50px; border-radius: 50%; background: #fff; display: grid; place-items: center; }

/* ---------- calendar strip ---------- */
.cal-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-day { border-radius: 9px; border: 1px solid var(--line); padding: 8px 6px; text-align: center; min-height: 64px; background: #fff; }
.cal-day .dow { font-size: 10px; text-transform: uppercase; color: var(--text-3); letter-spacing: 0.06em; }
.cal-day .dn { font-family: var(--mono); font-weight: 700; font-size: 14px; }
.cal-day .cnt { margin-top: 4px; font-size: 11px; color: var(--navy); font-weight: 600; }
.cal-day.has { background: var(--info-bg); border-color: #C8D9E8; }
.cal-day.today { outline: 2px solid var(--gold); outline-offset: -2px; }
.cal-day.wknd { opacity: 0.55; }

/* ---------- misc ---------- */
.rec-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: #EEF1F5; }
.rec-bar div { height: 100%; }
/* 0-100 score with a small bar underneath (quality, conviction) */
.score { display: inline-flex; flex-direction: column; gap: 3px; min-width: 44px; }
.score .n { font-family: var(--mono); font-weight: 700; font-size: 13px; line-height: 1; }
.score .bar { height: 4px; border-radius: 99px; background: #EEF1F5; overflow: hidden; }
.score .bar i { display: block; height: 100%; border-radius: 99px; }
.score.good .bar i { background: var(--success); }
.score.mid .bar i { background: var(--gold); }
.score.weak .bar i { background: var(--danger); }
.score.na .n { color: var(--text-3); font-weight: 500; }
.fund-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 16px; }
.fund-grid .k { color: var(--text-3); font-size: 12px; }
.fund-grid .v { font-weight: 600; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.fund-grid .e { font-size: 12px; color: var(--text-3); line-height: 1.35; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--text-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line); }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 16px; font-size: 13px; }
.kv .k { color: var(--text-3); font-size: 12px; }
.kv .v { font-weight: 600; }
/* Valuation block on the deal card: a 2 x 3 grid of key figures, each with a one-line hint under the value. */
.kv.kv-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.valuation .kv .v { font-size: 16px; }
.valuation .kv .hint { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: grid; grid-template-columns: 18px 1fr; gap: 12px; padding-bottom: 14px; position: relative; }
.tl-item::before { content: ''; position: absolute; left: 8px; top: 14px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--info-bg); border: 2px solid var(--navy); display: grid; place-items: center; }
.tl-item .t { font-size: 13px; font-weight: 600; }
.tl-item .m { font-size: 12px; color: var(--text-3); }
.tl-dot.up { background: var(--success-bg); border-color: var(--success); }
.tl-dot.down { background: var(--danger-bg); border-color: var(--danger); }
.tl-dot.new { background: var(--info-bg); border-color: var(--info); }
.tl-dot.flat { background: #EEF1F5; border-color: var(--ink-faint); }
.tip { display: inline-flex; align-items: center; color: var(--text-3); cursor: help; vertical-align: middle; }
.tip svg { width: 14px; height: 14px; }
.tip:hover { color: var(--navy); }
.target-move { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12.5px; white-space: nowrap; }
.target-move .arrow { color: var(--ink-faint); margin: 0 4px; }
.consensus-compare { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.consensus-compare > div { background: #F7F9FC; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.consensus-compare .k { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; display: flex; align-items: center; gap: 4px; }
.consensus-compare .v { font-family: var(--mono); font-size: 18px; font-weight: 700; margin-top: 2px; }
.consensus-compare .s { font-size: 12px; color: var(--text-2); }
.consensus-compare > div.weighted { background: var(--gold-soft); border-color: #E6D28A; }
.note { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.note .who { font-size: 12px; color: var(--text-2); display: flex; justify-content: space-between; margin-bottom: 4px; }
.note .body { font-size: 13px; white-space: pre-line; }
.color-swatch { width: 26px; height: 26px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.color-swatch.active { border-color: var(--text); }
code.token { font-family: var(--mono); font-size: 11px; background: #F2F4F7; padding: 2px 6px; border-radius: 4px; word-break: break-all; }

/* ---------- responsive ---------- */
/* every collapsed track uses minmax(0, 1fr): a bare 1fr means minmax(auto, 1fr), which lets a wide table widen the column and the page */
@media (max-width: 1200px) {
    .grid-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1100px) {
    .grid-4, .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3, .kv.kv-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .analysis-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 90; transform: translateX(-100%); transition: transform 0.2s; }
    .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
    .menu-toggle { display: grid !important; }
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .auth { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: minmax(0, 1fr); }
    .kv, .kv.kv-3, .fund-grid, .consensus-compare { grid-template-columns: minmax(0, 1fr); }
    .cal-strip { grid-template-columns: repeat(7, minmax(0, 1fr)); }
    .page-head { align-items: flex-start; }
}
.menu-toggle { display: none; }

/* ---------- Sortable tables (Recent IPOs) ---------- */
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--navy); }
.tbl th.sortable.sorted { color: var(--navy); }
.tbl th.sortable .sort-arrow { display: inline-block; margin-left: 4px; font-size: 9px; }
.range-bar { position: relative; height: 6px; background: #EEF1F5; border-radius: 99px; min-width: 90px; }
.range-bar > i { position: absolute; top: -3px; width: 12px; height: 12px; border-radius: 50%; background: var(--navy); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); transform: translateX(-50%); }
.range-bar > b { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--gold); transform: translateX(-50%); }

/* ===== Help popovers and glossary (Components/Help.razor, Pages/Help.razor) ===== */
.help { display: inline-flex; align-items: center; vertical-align: middle; }
.help-btn { width: 16px; height: 16px; margin-left: 4px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-3); cursor: pointer; display: inline-grid; place-items: center; vertical-align: middle; line-height: 0; }
.help-btn svg { width: 15px; height: 15px; }
.help-btn.sm { width: 14px; height: 14px; margin-left: 3px; }
.help-btn.sm svg { width: 13px; height: 13px; }
.help-btn:hover, .help-btn[aria-expanded="true"] { color: var(--navy); }
.help-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.kpi.accent .help-btn { color: rgba(255,255,255,0.7); }
.kpi.accent .help-btn:hover, .kpi.accent .help-btn[aria-expanded="true"] { color: #fff; }
.help-pop { position: fixed; z-index: 80; width: max-content; max-width: 280px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 12px 14px; text-align: left; font-family: var(--font); font-size: 13px; font-weight: 400; line-height: 1.45; color: var(--text-2); text-transform: none; letter-spacing: normal; white-space: normal; cursor: default; }
.help-pop::before { content: ''; position: absolute; top: -6px; left: var(--arrow-x, 18px); width: 10px; height: 10px; margin-left: -5px; background: var(--surface); border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg); }
.help-pop.up::before { top: auto; bottom: -6px; transform: rotate(225deg); }
.help-pop h4 { font-size: 13px; color: var(--navy); margin-bottom: 4px; }
.help-pop p { margin: 0; }
.help-pop .why { margin-top: 6px; color: var(--text-2); }
.help-pop .why b { color: var(--text); font-weight: 600; }
.help-pop a.more { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 600; }
.glossary-topics { display: flex; flex-wrap: wrap; gap: 8px; }
.glossary-topics a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--navy); }
.glossary-topics a:hover { border-color: var(--navy); text-decoration: none; }
.glossary-topics a .badge { background: var(--info-bg); color: var(--navy); }
.glossary-section { scroll-margin-top: 76px; }
.glossary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.term { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; scroll-margin-top: 76px; }
.term h3 { font-size: 14px; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.term h3 .key { font-family: var(--mono); font-weight: 500; font-size: 11px; color: var(--text-3); }
.term .def { color: var(--text); font-size: 13px; line-height: 1.5; }
.term .why { color: var(--text-2); font-size: 12.5px; line-height: 1.5; }
.term .why b { color: var(--text); font-weight: 600; }
.term:target, .term.hit { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.legend-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Analyst firm table: a firm whose latest call is older than Scanner:AnalystViewMaxAgeDays is listed but greyed out. */
.tbl tr.stale td { color: var(--text-3); }
.tbl tr.stale td .primary, .tbl tr.stale td .num { color: var(--text-3); }

/* Inline field errors (e.g. a rejected ticker in the watchlist add box): red, small, under the input. */
.field .error { font-size: 12px; color: var(--danger); }
.input[aria-invalid="true"] { border-color: var(--danger); }

/* IPO window card (Recent IPOs): summary sentence, five-segment pricing-vs-range bar in the PricingPill colours, three small figures. */
.temp-summary { margin: 0 0 14px; font-size: 14px; color: var(--text); }
.temp-grid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 1200px) { .temp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .temp-grid { grid-template-columns: minmax(0, 1fr); } }
.temp-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; margin-top: 8px; background: #EEF1F5; }
.temp-bar .seg { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; min-width: 18px; font-family: var(--mono); }
.temp-bar .seg span { padding: 0 4px; }
.s-above { background: var(--success); }
.s-top { background: var(--navy); }
.s-within { background: #98A2B3; }
.s-bottom { background: var(--warning); }
.s-below { background: var(--danger); }
.temp-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.temp-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: 0; }
.temp-fig .value { font-family: var(--mono); font-weight: 800; font-size: 22px; letter-spacing: -0.02em; margin: 4px 0 2px; }
.temp-fig .value .of { font-size: 12px; font-weight: 500; color: var(--text-3); font-family: var(--font); margin-left: 4px; letter-spacing: 0; }
.cal-day .cnt-size { font-size: 10px; color: var(--text-3); font-family: var(--mono); margin-top: 1px; }

/* ---------- dashboard: story sub-heading and pipeline funnel ---------- */
.page-head .story { font-size: 13px; color: var(--text-3); margin-top: 2px; }
/* six outcome tiles in one row from 1280px (the content column is ~960px there; 170px tracks would leave one tile alone on a second row) */
@media (min-width: 1201px) { .grid-kpi { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); } }
@media (max-width: 600px) { .page-head .story { display: none; } }
.funnel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; padding: 14px 18px; min-width: 0; }
.funnel .stage { display: inline-flex; flex-direction: column; gap: 2px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: inherit; text-decoration: none; min-width: 0; position: relative; }
.funnel .stage:hover { border-color: var(--navy); box-shadow: var(--shadow); }
.funnel .stage .st { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.funnel .stage .st .count { font-family: var(--mono); font-weight: 800; font-size: 18px; color: var(--navy); letter-spacing: -0.02em; }
.funnel .stage .sz { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.funnel .stage .added { position: absolute; top: -8px; right: -4px; }
.funnel .arrow { color: var(--ink-faint); font-size: 14px; flex-shrink: 0; }
.funnel-pulled { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 0 18px 12px; font-size: 12px; color: var(--text-3); }
.funnel-pulled a { color: var(--text-2); text-decoration: none; }
.funnel-pulled a:hover { text-decoration: underline; }

/* ---------- portfolios ---------- */
.pf-card { cursor: pointer; transition: box-shadow .15s ease, transform .15s ease; }
.pf-card:hover { box-shadow: 0 6px 18px rgba(12, 27, 51, 0.10); transform: translateY(-1px); }
.pf-card .card-body { padding-top: 12px; }
.pf-hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pf-ret { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; font-family: var(--mono); line-height: 1.1; }
.pf-spark { width: 160px; height: 48px; flex: 0 0 auto; }
.pf-spark svg, .pf-mini svg, .pf-chart svg { width: 100%; height: 100%; display: block; }
.pf-mini { width: 72px; height: 28px; flex: 0 0 auto; margin-right: 10px; }
.pf-desc { margin: 10px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pf-top { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pf-chip { display: inline-flex; gap: 6px; align-items: center; padding: 3px 8px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; font-family: var(--mono); }
.pf-chart { width: 100%; height: 150px; }
.pf-conv { display: flex; align-items: center; gap: 8px; min-width: 90px; }
.pf-conv .meter { flex: 1; }
.pf-detail td { background: var(--surface-2); }
.pf-thesis { display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 6px 46px; font-size: 13px; line-height: 1.55; }
.pf-thesis p { margin: 4px 0 0; color: var(--text-2); }
.pf-rules { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.pf-kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pf-kind { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.pf-kind .ico svg { width: 18px; height: 18px; color: var(--navy); }
.pf-kind.on { border-color: var(--navy); box-shadow: 0 0 0 2px rgba(20, 45, 92, 0.15); background: var(--info-bg); }
.pf-kind:disabled { opacity: .55; cursor: not-allowed; }
.pf-fields .field label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.pf-kv > div { display: flex; flex-direction: column; gap: 2px; }
.pf-kv .muted { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
@media (max-width: 720px) { .pf-kinds, .pf-kv { grid-template-columns: 1fr; } .pf-thesis { padding-left: 8px; } .pf-spark { width: 110px; } }

/* Aftermarket outlook: the driver lists on the listing page */
.drivers { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.drivers li { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.drivers .pts { min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; flex: none; }

/* ---------- structured AI analysis: bottom line, tagged catalysts and risks ---------- */
.takeaways { padding: 12px 14px; border-radius: 10px; background: var(--gold-soft); border: 1px solid #E8D9A0; }
.takeaways ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.takeaways li { display: flex; gap: 8px; align-items: baseline; font-size: 13.5px; line-height: 1.5; font-weight: 500; color: var(--text); }
.takeaways .mark { color: #7A5C00; font-size: 10px; flex: none; }
.signals { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.signals li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 3px 8px; align-items: start; font-size: 13px; line-height: 1.5; white-space: normal; }
.signals li.hi .txt { font-weight: 600; }
.signals .dir { font-size: 11px; line-height: 20px; text-align: center; }
.signals .dir.either, .signals .dir.warn { color: var(--warning); }
.signals .tags { grid-column: 2; display: flex; gap: 6px; flex-wrap: wrap; }
.datagaps { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.datagaps ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; }
.datagaps li { font-size: 12px; color: var(--text-3); line-height: 1.45; white-space: normal; }
.datagaps .k svg { width: 12px; height: 12px; vertical-align: -2px; margin-right: 3px; }

/* ---------- inline symbol picker (add a position) ---------- */
.picker { position: relative; }
.picker-menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(16, 24, 40, 0.12); max-height: 240px; overflow: auto; }
.picker-item { display: flex; gap: 10px; align-items: center; padding: 8px 12px; cursor: pointer; font-size: 13px; }
.picker-item:hover { background: var(--surface-2); }
.picker-item .sym { font-family: var(--mono, ui-monospace, monospace); font-weight: 700; min-width: 70px; }
.picker-item .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Theme scout ---- */
.th-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.th-counts div { display: flex; flex-direction: column; background: #F6F8FB; border-radius: 8px; padding: 6px 8px; }
.th-counts b { font-family: var(--mono); font-size: 16px; color: var(--navy); }
.th-counts span { font-size: 11px; color: var(--text-3); }
.th-thesis { cursor: pointer; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 900px; }
.th-thesis.open { display: block; cursor: default; }
.th-top { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .th-top { grid-template-columns: minmax(0, 1fr); } }
.th-note { font-size: 14px; line-height: 1.6; margin: 0 0 10px; }
.th-sources-note { border-top: 1px solid var(--line); padding-top: 8px; }
.th-chain { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.th-seg { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 10px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font: inherit; }
.th-seg:hover { border-color: var(--navy); }
.th-seg.on { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); background: #F6F8FB; }
.th-seg-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.th-seg-n { font-family: var(--mono); font-weight: 700; color: var(--navy); }
.th-seg-top { grid-column: 1 / -1; font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-table .th-row { cursor: pointer; }
.th-table .th-row.open td { background: #F6F8FB; }
.th-table .th-row.muted td { opacity: .6; }
.th-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.th-tags:empty { display: none; }
.th-detail td { background: #FAFBFD; padding: 12px 14px 16px; }
.th-detail-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 860px) { .th-detail-grid { grid-template-columns: minmax(0, 1fr); } }
.th-src { margin: 4px 0 0; padding-left: 16px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.th-dossier { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; max-width: 980px; }
.th-dossier-sec { margin-top: 8px; }
.th-dossier-h { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--navy); }
.th-dossier-sec p { margin: 2px 0; line-height: 1.55; }
.th-name .mono { margin-left: 6px; color: var(--text-2); }

/* ---- Where it trades ---- */
.tl-table td, .tl-table th { padding-top: 6px; padding-bottom: 6px; }
.tl-table tr.tl-this td { background: #F6F8FB; }
.tl-compact .tl-table { font-size: 12.5px; margin-top: 4px; }
.tl-card > summary { cursor: pointer; list-style: none; }
.tl-card > summary::-webkit-details-marker { display: none; }

/* ---- Ask Claude ---- */
.ask-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--navy); color: var(--gold); display: inline-grid; place-items: center; flex-shrink: 0; }
.ask-mark svg { width: 16px; height: 16px; }
.ask-mark.sm { width: 22px; height: 22px; border-radius: 6px; vertical-align: -5px; margin-right: 6px; }
.ask-mark.sm svg { width: 13px; height: 13px; margin: 0; }
.ask-mark.lg { width: 44px; height: 44px; border-radius: 12px; }
.ask-mark.lg svg { width: 24px; height: 24px; }
h1 .ask-mark { vertical-align: -6px; margin-right: 6px; }
.ask-card { border-top: 3px solid var(--gold); }
.ask-suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
.ask-suggestions.stacked { flex-direction: column; align-items: stretch; }
.ask-chip { border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--navy); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 12.5px; font-weight: 500; text-align: left; cursor: pointer; line-height: 1.35; }
.ask-chip:hover:not(:disabled) { border-color: var(--navy); background: var(--info-bg); }
.ask-chip:disabled { opacity: .55; cursor: not-allowed; }
.ask-thread-list { display: flex; flex-direction: column; gap: 2px; }
.ask-thread-row { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; border: 0; background: transparent; padding: 7px 8px; margin: 0 -8px; border-radius: 8px; font: inherit; cursor: pointer; color: var(--text); }
.ask-thread-row:hover { background: var(--surface-2); }
.ask-thread-row .title { font-size: 13px; font-weight: 600; line-height: 1.35; }
.ask-live { display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; color: var(--warning); font-weight: 600; font-size: 11px; }
.ask-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: ask-pulse 1.2s infinite ease-in-out; }
@keyframes ask-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* side panel */
.drawer-bg { position: fixed; inset: 0; background: rgba(7,30,51,0.35); z-index: 90; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: #fff; z-index: 91; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: drawer-in .18s ease-out; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drawer-sub { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.drawer-sub .select { flex: 1; min-width: 0; }
.select-sm, .input-sm { height: 32px; font-size: 12.5px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* conversation */
.ask-convo { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.ask-scroll { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.ask-convo.compact .ask-scroll { padding: 16px; }
.ask-intro { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 20px 8px; max-width: 560px; margin: 0 auto; }
.ask-intro-title { font-size: 17px; font-weight: 700; color: var(--navy-deep); }
.ask-intro .ask-suggestions { justify-content: center; margin-top: 6px; }
.ask-q, .ask-a { display: flex; gap: 12px; align-items: flex-start; }
.ask-who { font-size: 12px; color: var(--text-3); margin-bottom: 3px; }
.ask-who b { color: var(--text); }
.ask-q-body { white-space: pre-wrap; font-size: 14px; line-height: 1.5; background: var(--info-bg); border-radius: 4px 12px 12px 12px; padding: 9px 12px; display: inline-block; max-width: 100%; }
.ask-activity { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 8px; padding: 7px 10px; margin: 2px 0 8px; }
.ask-activity .spinner { width: 14px; height: 14px; flex-shrink: 0; }
.ask-error { align-items: center; margin-top: 6px; }
.ask-error .btn { margin-left: auto; }
.ask-sources { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.ask-sources details summary { cursor: pointer; color: var(--navy); margin-top: 6px; }
.ask-source-list { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; }
.ask-source-list li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; line-height: 1.4; }
.ask-source-list.plain li { padding-left: 2px; }
.ask-source-list a { font-weight: 500; overflow-wrap: anywhere; }
.cite { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 5px; background: var(--gold-soft); color: #7A5C00; font-size: 10.5px; font-weight: 700; line-height: 1; vertical-align: 2px; margin: 0 1px; text-decoration: none; font-family: var(--font); }
a.cite:hover { background: var(--gold); color: var(--navy-deep); text-decoration: none; }
.cite.muted { background: #F2F4F7; color: var(--text-3); }
.ask-foot { display: flex; align-items: center; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.ask-foot .btn-sm { height: 28px; padding: 0 8px; }
.ask-composer { border-top: 1px solid var(--line); padding: 12px 16px; background: #fff; }
.ask-input { height: auto; min-height: 56px; padding: 10px 12px; line-height: 1.45; resize: vertical; }
.ask-composer-bar { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.segment-sm button { padding: 5px 10px; font-size: 12px; }
.ask-disabled { display: flex; align-items: center; gap: 8px; }
.ask-disabled svg { width: 14px; height: 14px; }
.ask-context { white-space: pre-wrap; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 60vh; overflow: auto; margin: 0; }
.modal:has(.ask-context) { max-width: 820px; }

/* answer text */
.md { font-size: 14px; line-height: 1.6; color: var(--text); overflow-wrap: anywhere; }
.md p { margin: 0 0 10px; }
.md p:last-child, .md ul:last-child, .md ol:last-child { margin-bottom: 0; }
.md h3 { font-size: 14.5px; margin: 16px 0 6px; color: var(--navy-deep); }
.md h4 { font-size: 13px; margin: 14px 0 4px; color: var(--navy); text-transform: uppercase; letter-spacing: .03em; }
.md h3:first-child, .md h4:first-child { margin-top: 0; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 20px; }
.md li { margin: 3px 0; }
.md li.sub { margin-left: 18px; list-style-type: circle; }
.md strong { font-weight: 700; color: var(--navy-deep); }
.md code { font-family: var(--mono); font-size: 12px; background: #F2F4F7; padding: 1px 5px; border-radius: 4px; }
.md blockquote { margin: 0 0 10px; padding: 6px 12px; border-left: 3px solid var(--gold); color: var(--text-2); background: var(--surface-2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.md .table-wrap { margin: 4px 0 12px; }
.md-table { font-size: 12.5px; }
.md-table th, .md-table td { padding: 6px 10px; }
.md-caret { display: inline-block; width: 7px; height: 15px; background: var(--gold); vertical-align: -2px; margin-left: 2px; animation: ask-pulse 1s infinite; }

/* Ask page */
.ask-page { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.ask-threads { position: sticky; top: 76px; max-height: calc(100vh - 100px); display: flex; flex-direction: column; }
.ask-threads .list { overflow-y: auto; }
.ask-filter { padding: 8px 12px; border-bottom: 1px solid var(--line); }
.ask-thread-item.active { background: var(--info-bg); box-shadow: inset 3px 0 0 var(--navy); }
.ask-main { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 520px; }
.ask-main .card-head h2 { max-width: 100%; }
@media (max-width: 960px) {
    .ask-page { grid-template-columns: minmax(0, 1fr); }
    .ask-threads { position: static; max-height: 320px; }
    .ask-main { height: auto; min-height: 70vh; }
}
@media (max-width: 640px) {
    .drawer { width: 100vw; }
    .ask-scroll { padding: 14px 12px; }
    .ask-composer { padding: 10px 12px; }
}

/* ---- Correct the record ---- */
.corr-banner { align-items: center; margin-bottom: 16px; }
.corr-banner .btn { margin-left: auto; flex-shrink: 0; }
.corr-claude { align-items: flex-start; }
.corr-claude .ask-mark.sm { margin: 1px 4px 0 0; }
.corr-current { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.corr-details > summary { cursor: pointer; color: var(--navy); }
.modal:has(.corr-current) { max-width: 640px; }
