/* Saif TQ. Trading-desk look: deep navy and pearl-diver gold (the team's deck colours),
   cool paper, green and red kept only for money going up or down. */
:root {
  --bg: #F2F4F8;
  --surface: #FFFFFF;
  --surface-2: #F5F7FA;
  --ink: #0F1E33;
  --ink-2: #4B5870;
  --ink-3: #7A869B;
  --line: #DEE3EC;
  --line-strong: #C9D1DE;
  --gulf: #0F2747;          /* primary: navy */
  --gulf-ink: #FFFFFF;
  --gulf-soft: #E5EAF3;
  --gold: #C8A24A;          /* decorative gold */
  --sand: #9C7726;          /* gold that is readable as text */
  --sand-soft: #F7F0DE;
  --gain: #11764F;
  --gain-soft: #E1F2E9;
  --loss: #BE3249;
  --loss-soft: #FBE6E9;
  --warn: #93630C;
  --warn-soft: #FBF1D9;
  --rail-bg: #0F2747;
  --rail-ink: #C2CCDC;
  --rail-ink-strong: #FFFFFF;
  --rail-line: rgba(255,255,255,.09);
  --shadow: 0 1px 2px rgba(15,30,51,.05), 0 8px 24px rgba(15,30,51,.06);
  --radius: 12px;
  --radius-sm: 8px;
  --sans: "Schibsted Grotesk", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --rail: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1426; --surface: #0F1C33; --surface-2: #14243E; --ink: #E9EEF6; --ink-2: #A9B5C8; --ink-3: #7686A1; --line: #20304C; --line-strong: #2C3E5E;
    --gulf: #D4B262; --gulf-ink: #0A1426; --gulf-soft: #1D2B45; --gold: #D4B262; --sand: #DDBE72; --sand-soft: #2A2416;
    --gain: #4FC892; --gain-soft: #10302A; --loss: #F27D8E; --loss-soft: #3A1C25; --warn: #E3B858; --warn-soft: #33290F;
    --rail-bg: #081122; --shadow: 0 1px 2px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1426; --surface: #0F1C33; --surface-2: #14243E; --ink: #E9EEF6; --ink-2: #A9B5C8; --ink-3: #7686A1; --line: #20304C; --line-strong: #2C3E5E;
  --gulf: #D4B262; --gulf-ink: #0A1426; --gulf-soft: #1D2B45; --gold: #D4B262; --sand: #DDBE72; --sand-soft: #2A2416;
  --gain: #4FC892; --gain-soft: #10302A; --loss: #F27D8E; --loss-soft: #3A1C25; --warn: #E3B858; --warn-soft: #33290F;
  --rail-bg: #081122; --shadow: 0 1px 2px rgba(0,0,0,.35); color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--gulf); text-decoration: none; }
:root[data-theme="dark"] a, a:where(.dark) { color: var(--gulf); }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; }
h1 { font-size: 30px; letter-spacing: -0.025em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .8em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.boot { padding: 40px; color: var(--ink-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell: navy rail ---------- */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 14px 18px; background: var(--rail-bg); color: var(--rail-ink); }
.rail a { color: inherit; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 10px 22px; color: var(--ink); }
.brand img { width: 34px; height: 34px; }
.brand b { display: block; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.brand span { display: block; font-size: 12px; color: var(--ink-3); }
.rail .brand, .brand-light { color: var(--rail-ink-strong); position: relative; }
.rail .brand span, .brand-light span { color: #9FB0C8; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radius-sm); color: var(--ink); font-weight: 600; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.panel .nav a + a { border-top: 1px solid var(--line); border-radius: 0; }
.panel .nav svg { color: var(--sand); }
.rail .nav a { padding: 9px 12px; color: var(--rail-ink); font-weight: 500; border-radius: var(--radius-sm); border-top: 0; }
.rail .nav a:hover { background: rgba(255,255,255,.05); color: var(--rail-ink-strong); }
.rail .nav a[aria-current="page"] { background: rgba(200,162,74,.13); color: #F6E7BF; }
.rail .nav a[aria-current="page"]::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #C8A24A; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav .count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #C8A24A; color: #0F2747; font-size: 12px; font-weight: 700; text-align: center; }
.rail-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--rail-line); font-size: 13px; }
.rail-foot .who b { display: block; color: var(--rail-ink-strong); font-weight: 600; }
.rail-foot .who span { color: #8FA1BC; }
.rail-foot .links { display: flex; gap: 14px; margin-top: 8px; }
.rail .linkbtn { color: #E3C77E; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--gulf); cursor: pointer; font-size: 13px; }
.linkbtn:hover { text-decoration: underline; text-underline-offset: 3px; }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 32px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar .title-m { display: none; font-weight: 700; }
.search { position: relative; flex: 1; max-width: 440px; }
.search input[type=search] { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.search input[type=search]:focus { border-color: var(--line-strong); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 22%, transparent); }
.search svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--ink-3); }
.results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; max-height: 380px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 40px rgba(15,30,51,.14); padding: 4px; }
.results button { display: flex; width: 100%; gap: 10px; align-items: baseline; padding: 9px 12px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer; }
.results button:hover, .results button[aria-selected="true"] { background: var(--surface-2); }
.results .sym { font-weight: 700; min-width: 64px; }
.results .nm { color: var(--ink-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .mk { font-size: 12px; color: var(--ink-3); }
.results .hint { padding: 10px 12px; color: var(--ink-3); font-size: 13px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.data-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); white-space: nowrap; }
.data-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.data-pill.live { background: var(--gain-soft); color: var(--gain); }
.data-pill.live::before { animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.iconbtn { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; color: var(--ink-2); }
.iconbtn:hover { color: var(--ink); border-color: var(--line-strong); text-decoration: none; }
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn .dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); border: 2px solid var(--surface); }

.page { padding: 30px 32px 64px; max-width: 1240px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; margin-bottom: 24px; }
.page-head p { margin: 6px 0 0; color: var(--ink-2); max-width: 70ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.tabbar { display: none; }

/* ---------- building blocks ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.panel + .panel { margin-top: 16px; }
.grid > .panel + .panel, .grid > * + .panel { margin-top: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 14px; }
.panel-head .sub { color: var(--ink-3); font-size: 13px; }
.panel-head .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); font-size: 13px; }
.gain { color: var(--gain); }
.loss { color: var(--loss); }
.num { white-space: nowrap; }
.right { text-align: right; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background-color .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--gulf); border-color: var(--gulf); color: var(--gulf-ink); box-shadow: inset 0 -2px 0 rgba(200,162,74,.55); }
.btn.primary:hover { background: color-mix(in srgb, var(--gulf) 88%, #fff); }
.btn.ai { background: var(--sand-soft); border-color: color-mix(in srgb, var(--gold) 45%, transparent); color: var(--sand); }
.btn.ai:hover { background: color-mix(in srgb, var(--sand-soft) 70%, var(--gold) 15%); }
.btn.danger { color: var(--loss); }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .55; cursor: wait; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; cursor: pointer; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(15,30,51,.12); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .help { font-size: 12px; color: var(--ink-3); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gulf); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 22%, transparent); }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.form > * + * { margin-top: 16px; }
.error { color: var(--loss); font-size: 14px; }
.error:empty { display: none; }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.tag.us { background: var(--gulf-soft); color: var(--gulf); border-color: transparent; }
.tag.bh { background: #FBE8EA; color: #A3263A; border-color: transparent; }
.tag.ai { background: var(--sand-soft); color: var(--sand); border-color: transparent; }
.tag.good { background: var(--gain-soft); color: var(--gain); border-color: transparent; }
.tag.bad { background: var(--loss-soft); color: var(--loss); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

.empty { padding: 30px 12px; text-align: center; color: var(--ink-2); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; font-size: 16px; }
.empty .btn { margin-top: 14px; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 0 10px 9px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
th.r, td.r { text-align: right; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
.symcell b { display: block; font-weight: 700; }
.symcell span { color: var(--ink-3); font-size: 13px; display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Today: the navy board is the one bold thing ---------- */
.ledger { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 18px; overflow: hidden; }
.ledger > div { padding: 16px 20px; border-left: 1px solid var(--line); min-width: 0; }
.ledger > div:first-child { border-left: 0; }
.ledger .k { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.ledger .v { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger .s { font-size: 13px; margin-top: 2px; }

.ledger.hero { position: relative; grid-template-columns: minmax(0, 1.55fr) repeat(3, minmax(0, 1fr)); background: #0F2747; border: 0; border-top: 3px solid #C8A24A; color: #fff; margin-bottom: 22px;
}
.ledger.hero > div { padding: 22px 24px 20px; border-left-color: rgba(255,255,255,.1); }
.ledger.hero .k { color: #A9B9D0; }
.ledger.hero .v { font-size: 26px; color: #fff; }
.ledger.hero > div:first-child .v { font-size: 44px; letter-spacing: -0.035em; line-height: 1.05; margin-top: 6px; }
.ledger.hero .s, .ledger.hero .faint { color: #A9B9D0; }
.ledger.hero .gain { color: #5FD7A1; }
.ledger.hero .loss { color: #FF8C9B; }
.ledger.hero .lv.flash { background-color: rgba(200,162,74,.35); }
:root[data-theme="dark"] .ledger.hero { background-color: #13284A; }

.letter { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 30px 24px; }
.letter::before { content: ""; position: absolute; left: 0; top: 24px; bottom: 24px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.letter-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.letter-head h2 { font-family: var(--serif); font-size: 25px; font-weight: 600; letter-spacing: -0.01em; }
.letter-head .by { color: var(--ink-3); font-size: 13px; }
.letter-head .right { margin-left: auto; }
.prose { font-family: var(--serif); font-size: 17.5px; line-height: 1.65; max-width: 66ch; }
.prose p { margin: 0 0 .85em; }
.prose ul { margin: 0 0 .9em; padding-left: 1.2em; }
.prose li { margin: .25em 0; }
.prose li::marker { color: var(--gold); }
.prose strong { font-weight: 600; }
.prose em { color: var(--ink-2); font-size: .92em; }
.prose.small { font-size: 16px; }
.skeleton { display: grid; gap: 10px; }
.skeleton i { display: block; height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
.skeleton i:nth-child(3n) { width: 70%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.movers { display: grid; gap: 0; }
.mover { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 10px 6px; margin: 0 -6px; border-bottom: 1px solid var(--line); border-radius: 6px; color: var(--ink); }
.mover:last-child { border-bottom: 0; }
.mover:hover { text-decoration: none; background: var(--surface-2); }
.bar-pct { display: inline-block; min-width: 70px; text-align: right; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.bar-pct.gain { background: var(--gain-soft); }
.bar-pct.loss { background: var(--loss-soft); }

.flag { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.flag:last-child { border-bottom: 0; }
.flag i { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 2px; background: var(--ink-3); transform: rotate(45deg); }
.flag.high i { background: var(--loss); }
.flag.medium i { background: var(--gold); }
.flag.low i { background: var(--gulf); }

.event { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.event:last-child { border-bottom: 0; }
.cal { flex: none; width: 46px; text-align: center; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; line-height: 1.1; background: var(--surface); }
.cal small { display: block; background: #0F2747; color: #E9D29A; font-size: 10px; font-weight: 600; padding: 3px 0; }
.cal b { display: block; font-size: 17px; padding: 4px 0; }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--sans); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.alloc { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.alloc span { display: block; height: 100%; }
.alloc-list { margin-top: 14px; display: grid; gap: 7px; font-size: 14px; }
.alloc-list div { display: flex; align-items: center; gap: 8px; }
.alloc-list i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.alloc-list .pct { margin-left: auto; font-weight: 600; }
.range { position: relative; height: 6px; border-radius: 3px; background: var(--surface-2); margin: 40px 0 8px; }
.range .fill { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--gulf-soft); }
.range .mark { position: absolute; top: -5px; width: 2px; height: 16px; background: var(--ink); }
.range .mark.target { background: var(--gold); }
.range .mark span { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); font-size: 12px; white-space: nowrap; color: var(--ink-2); }
.range-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); }
.recbars { display: grid; gap: 8px; }
.recbar { display: grid; grid-template-columns: 70px 1fr; gap: 10px; align-items: center; font-size: 13px; color: var(--ink-3); }
.recbar .rb { display: flex; height: 18px; border-radius: 5px; overflow: hidden; gap: 2px; }
.recbar .rb span { display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; min-width: 0; }

/* ---------- stock page ---------- */
.stock-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 22px; }
.stock-head img { width: 46px; height: 46px; border-radius: 10px; background: #fff; border: 1px solid var(--line); object-fit: contain; }
.stock-head h1 { font-size: 26px; }
.stock-head .price { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.stock-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 16px 20px; }
.kv .k { font-size: 12px; color: var(--ink-3); }
.kv .v { font-weight: 700; font-size: 16px; }
.news-item { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.news-item:last-child { border-bottom: 0; }
.news-item:hover { text-decoration: none; }
.news-item:hover b { text-decoration: underline; text-underline-offset: 3px; }
.news-item b { display: block; font-weight: 600; }
.news-item span { font-size: 12px; color: var(--ink-3); }

.debate { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.side { border-radius: 10px; padding: 16px 18px; border: 1px solid transparent; }
.side.bull { background: var(--gain-soft); }
.side.bear { background: var(--loss-soft); }
.side h3 { font-family: var(--serif); font-size: 18px; margin-bottom: 8px; }
.side.bull h3 { color: var(--gain); }
.side.bear h3 { color: var(--loss); }
.side ul { margin: 0; padding-left: 1.1em; font-size: 14px; }
.side li { margin: 5px 0; }
.verdict { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 12px; }
.verdict .prose { font-size: 16px; }

.thesis-box { border-left: 3px solid var(--line); padding: 4px 0 4px 14px; }
.thesis-box.intact { border-color: var(--gain); }
.thesis-box.watch { border-color: var(--gold); }
.thesis-box.broken { border-color: var(--loss); }

/* ---------- ideas ---------- */
.idea { display: grid; grid-template-columns: 46px 1fr; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.idea:last-child { border-bottom: 0; }
.vote { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.vote button { width: 34px; height: 28px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; cursor: pointer; color: var(--ink-3); display: grid; place-items: center; }
.vote button svg { width: 14px; height: 14px; }
.vote button[aria-pressed="true"].up { background: var(--gain-soft); color: var(--gain); border-color: transparent; }
.vote button[aria-pressed="true"].down { background: var(--loss-soft); color: var(--loss); border-color: transparent; }
.vote b { font-size: 16px; }
.idea-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.idea-top h3 { font-size: 16px; margin-right: 4px; }
.idea p { margin: 8px 0 0; color: var(--ink); max-width: 75ch; }
.idea .risk { color: var(--ink-2); font-size: 14px; }
.idea .meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-3); align-items: center; }
.comments { margin-top: 12px; padding-left: 12px; border-left: 2px solid var(--line); display: grid; gap: 8px; }
.comment { font-size: 14px; }
.comment b { font-weight: 600; }
.comment.mentor { background: var(--sand-soft); border-radius: 8px; padding: 7px 11px; }
.comment-form { display: flex; gap: 8px; margin-top: 4px; }
.comment-form input { flex: 1; }

/* ---------- ask ---------- */
.chat { display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 760px; }
.msg.user { align-self: flex-end; background: #0F2747; color: #fff; padding: 11px 15px; border-radius: 16px 16px 4px 16px; max-width: 80%; white-space: pre-wrap; }
.msg.assistant { background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 16px 20px; }
.msg.assistant .prose { font-size: 16.5px; }
.composer { position: sticky; bottom: 0; padding: 14px 0 6px; background: linear-gradient(transparent, var(--bg) 30%); }
.composer form { display: flex; gap: 8px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; padding: 8px; box-shadow: var(--shadow); }
.composer form:focus-within { border-color: var(--gulf); }
.composer textarea { border: 0; min-height: 44px; max-height: 180px; padding: 8px; background: transparent; box-shadow: none !important; }
.composer textarea:focus { outline: none; }
.starters { display: flex; flex-wrap: wrap; gap: 8px; }
.starters button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 8px 14px; cursor: pointer; font-size: 14px; color: var(--ink-2); }
.starters button:hover { border-color: var(--gold); color: var(--ink); background: var(--sand-soft); }

/* ---------- what-if ---------- */
.slider-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; }
.slider-row label { font-weight: 600; }
.slider-row output { font-weight: 700; min-width: 56px; text-align: right; }
.slider-row input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--gold); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.impact { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; }
.wbar { position: relative; height: 10px; background: var(--surface-2); border-radius: 5px; }
.wbar span { position: absolute; top: 0; bottom: 0; border-radius: 5px; }

/* ---------- activity ---------- */
.notif { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.notif:last-child { border-bottom: 0; }
.notif .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.notif .ic svg { width: 17px; height: 17px; }
.notif.new .ic { background: var(--sand-soft); color: var(--sand); }
.notif b { font-weight: 600; }
.notif p { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.notif time { font-size: 12px; color: var(--ink-3); white-space: nowrap; }

/* ---------- dialog / login ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(8,17,34,.35); }
dialog::backdrop { background: rgba(8, 17, 34, .55); backdrop-filter: blur(2px); }
.dlg-head { display: flex; align-items: center; padding: 20px 24px 0; }
.dlg-head .x { margin-left: auto; }
.dlg-body { padding: 16px 24px 24px; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

.login { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.login-art { position: relative; background: #0F2747; color: #F2F5FA; padding: 48px 52px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; border-right: 3px solid #C8A24A; }
.login-art svg.tape { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 58%; }
.login-art .quote { position: relative; z-index: 1; font-size: 40px; font-weight: 700; line-height: 1.12; letter-spacing: -0.03em; max-width: 15ch; margin-top: 48px; }
.login-art .foot { position: relative; z-index: 1; font-size: 14px; color: #A9B9D0; }
.login-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.login-form form { width: min(360px, 100%); }
.login-form h1 { margin-bottom: 4px; }
.login-form .brand { padding: 0 0 28px; }
.login-form .btn.primary { padding: 12px 16px; font-size: 15px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 14px; }
.chip b { font-weight: 600; color: var(--ink-2); }
.sbars { display: grid; gap: 8px; }
.sbar { display: grid; grid-template-columns: 150px 1fr 62px; gap: 10px; align-items: center; font-size: 13.5px; color: var(--ink-2); }
.sbar.ours { color: var(--ink); font-weight: 700; }
.sbar .track { position: relative; height: 10px; background: var(--surface-2); border-radius: 5px; }
.sbar .track i { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.sbar .v { text-align: right; font-weight: 700; }
.cat { margin-top: 16px; }
.cat-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-start; margin-bottom: 10px; }
.cat-head h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.cat-stats { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; }
.cat-stats div { display: flex; flex-direction: column; }
.cat-stats .k { font-size: 12px; color: var(--ink-3); }
.cat-stats b { font-size: 17px; }
.cat-take { font-family: var(--serif); font-size: 16.5px; line-height: 1.6; max-width: 72ch; border-left: 3px solid var(--gold); padding-left: 14px; margin: 4px 0 14px; }
tr.grp td { background: var(--surface-2); padding-top: 9px; padding-bottom: 9px; font-size: 13.5px; }
tr.grp td:first-child { padding-left: 12px; border-radius: 8px 0 0 8px; }
tr.grp td:last-child { padding-right: 12px; border-radius: 0 8px 8px 0; }
tr.grp b { font-size: 14.5px; }
.inline-select { width: auto; display: inline-block; padding: 2px 6px; margin-left: 6px; font-size: 13px; border-radius: 6px; color: var(--ink-2); }
.stack-gap ~ .panel + .panel { margin-top: 16px; }
.grid > .panel + .panel, .grid > * + .panel { margin-top: 0; }
.mini-rb { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-2); margin-bottom: 3px; gap: 1px; }
.mini-rb span { display: block; height: 100%; }
.rep-head { font-family: var(--serif); font-size: 20px; margin: 0 0 8px; }
table.an td { padding-top: 11px; padding-bottom: 11px; }
.page.wide { max-width: 1500px; }
.ticker { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 4px; scrollbar-width: thin; }
.tk { flex: none; display: flex; flex-direction: column; min-width: 96px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 13px; line-height: 1.3; }
.tk b { font-weight: 700; }
.tk:hover { text-decoration: none; border-color: var(--line-strong); }
.tk[aria-current] { border-color: #0F2747; background: #0F2747; color: #fff; }
.tk[aria-current] .gain { color: #5FD7A1; }
.tk[aria-current] .loss { color: #FF8C9B; }
.tk .p { }
.tk .c { font-size: 12px; font-weight: 700; }
.tk.flash { animation: tkflash 1s ease-out; }
@keyframes tkflash { from { box-shadow: 0 0 0 2px var(--gold); } to { box-shadow: 0 0 0 0 transparent; } }
.live-note { margin: 0 0 12px; }
.chart-panel { padding: 0; overflow: hidden; }
.chart-host { height: min(72vh, 680px); min-height: 420px; }
.ta-full { height: 520px; }
.ta-group { font-family: var(--serif); font-size: 21px; font-weight: 600; margin: 24px 0 10px; }
.ta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ta-card { padding: 14px 16px 6px; }
.ta-grid .panel + .panel { margin-top: 0; }
.ta-card .panel-head { margin-bottom: 4px; }
.ta-host { height: 400px; }
.tv-fail { padding: 16px; }
.lv { border-radius: 3px; transition: background-color .8s; }
.lv.flash { background-color: color-mix(in srgb, var(--gold) 30%, transparent); transition: none; }
.sum-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 16px; align-items: start; }
.runs { position: sticky; top: 78px; max-height: calc(100vh - 96px); overflow: auto; padding: 14px; }
.runs-m { display: none; }
.seg.scope { display: flex; margin-bottom: 8px; }
.seg.scope button { flex: 1; padding: 6px; }
.scope-note { margin: 0 0 10px; font-size: 12.5px; }
.run-day { font-size: 12px; color: var(--ink-3); margin: 12px 0 4px; font-weight: 600; }
.run-day:first-child { margin-top: 0; }
.run { display: flex; flex-direction: column; gap: 3px; padding: 9px 11px; border-radius: 8px; color: var(--ink); font-size: 13px; border: 1px solid transparent; }
.run:hover { background: var(--surface-2); text-decoration: none; }
.run.on { background: var(--sand-soft); border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.run .h { color: var(--ink-2); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sum-h { font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1.2; margin: 0 0 12px; }
.notif.tone-good .ic { background: var(--gain-soft); color: var(--gain); }
.notif.tone-bad .ic { background: var(--loss-soft); color: var(--loss); }
.notif.tone-good b a { color: var(--gain); }
.notif.tone-bad b a { color: var(--loss); }
.act-filter { flex-wrap: wrap; }
.nbody { margin-top: 3px; font-size: 14px; color: var(--ink-2); }
.nbody p { margin: 0 0 4px; }
.nbody strong { color: var(--ink); }
.nbody em { font-size: 13px; color: var(--ink-3); }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 16px; border: 1.5px dashed var(--line-strong); border-radius: 12px; background: var(--surface-2); cursor: pointer; text-align: center; }
.drop:hover, .drop.over { border-color: var(--gold); background: var(--sand-soft); }
.drop b { color: var(--gulf); }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 100; background: #0F2747; color: #fff; padding: 11px 18px; border-radius: 10px; border-left: 3px solid #C8A24A; font-size: 14px; font-weight: 500; transition: .2s; max-width: calc(100vw - 32px); box-shadow: 0 12px 30px rgba(8,17,34,.3); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--loss); border-left-color: #fff; color: #fff; }

/* ---------- phones and small screens ---------- */
@media (max-width: 1020px) {
  .g-main, .g2 { grid-template-columns: 1fr; }
  .g3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  :root { --rail: 0px; }
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .topbar { padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: #0F2747; border-bottom: 2px solid #C8A24A; color: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topbar .title-m { display: block; font-size: 17px; }
  .topbar .iconbtn { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: #E6ECF5; }
  .topbar .iconbtn .dot { border-color: #0F2747; }
  .topbar .search { display: none; }
  .topbar .search.open { display: block; position: absolute; left: 12px; right: 12px; top: calc(100% + 8px); max-width: none; color: var(--ink); }
  .data-pill { display: none; }
  .page { padding: 20px 16px 116px; }
  h1 { font-size: 25px; }
  .page-head { margin-bottom: 18px; }
  .page-head .actions { margin-left: 0; }
  .ledger { grid-template-columns: 1fr 1fr; }
  .ledger > div:nth-child(3) { border-left: 0; }
  .ledger > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .ledger .v { font-size: 20px; }
  .ledger.hero { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ledger.hero > div { padding: 14px 14px 16px; }
  .ledger.hero > div:first-child { grid-column: 1 / -1; padding: 20px 18px 18px; }
  .ledger.hero > div:first-child .v { font-size: 40px; }
  .ledger.hero > div:nth-child(2) { border-left: 0; }
  .ledger.hero > div:nth-child(3), .ledger.hero > div:nth-child(4) { border-left: 1px solid rgba(255,255,255,.1); }
  .ledger.hero > div:nth-child(n+2) { border-top: 1px solid rgba(255,255,255,.1); }
  .ledger.hero .k, .ledger.hero .s { font-size: 12px; }
  .ledger.hero .v { font-size: 19px; }
  .letter { padding: 20px 18px 18px; }
  .letter::before { top: 20px; bottom: 20px; }
  .prose { font-size: 16.5px; }
  .g3 { grid-template-columns: 1fr; }
  .debate { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .hide-m { display: none; }
  .sbar { grid-template-columns: 112px 1fr 56px; font-size: 12.5px; }
  .cat-stats { margin-left: 0; }
  .chart-host { height: 460px; min-height: 0; }
  .ta-full { height: 560px; }
  .sum-layout { grid-template-columns: 1fr; }
  .runs { position: static; max-height: none; }
  .runs-d { display: none; }
  .runs-m { display: block; }
  .runs .panel-head { margin-bottom: 8px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -6px 20px rgba(15,30,51,.06); }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; font-size: 11px; color: var(--ink-3); font-weight: 600; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--ink); }
  .tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: #C8A24A; }
  .tabbar svg { width: 22px; height: 22px; }
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: 250px; padding: 28px 24px; padding-top: max(28px, env(safe-area-inset-top)); border-right: 0; border-bottom: 3px solid #C8A24A; }
  .login-art .quote { font-size: 28px; margin-top: 22px; }
  .login-art svg.tape { height: 50%; }
  .composer { bottom: calc(60px + env(safe-area-inset-bottom)); }
  .stock-head .actions { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .rail, .topbar, .tabbar, .actions, .btn { display: none !important; } .shell { display: block; } body { background: #fff; } }
