@font-face { font-family: Geist; src: url('./assets/geist.woff2') format('woff2'); font-style: normal; font-weight: 100 900; font-display: swap; }
@font-face { font-family: Plex; src: url('./assets/plex-mono.woff2') format('woff2'); font-style: normal; font-weight: 500; font-display: swap; }

/* ------------------------------------------------------------------ colours
   One set of names, two sets of values. Nothing below this block names a colour directly,
   except the felt card, which is the same dark green in both. */
:root {
  color-scheme: light dark;
  --page: #f4f1ea;
  --card: #fffefb;
  --sunk: #efebe2;
  --ink: #17231d;
  --muted: #5f6b63;
  --faint: #8a938c;
  --line: #e5e0d5;
  --brand: #1e7a57;
  --brand-ink: #ffffff;
  --felt: #114537;
  --up: #17734f;
  --down: #b3463a;
  --gold: #8f6410;
  --blue: #35659c;
  --violet: #6b56a6;
  --berry: #a6476b;
  --series: #1e7a57;
  --bench: #4a7db8;
  --tip: #1b2a23;
  --shadow: 0 1px 2px rgb(40 50 40 / 4%), 0 8px 24px rgb(40 50 40 / 5%);
  --radius: 20px;
  --sans: Geist, -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: Plex, ui-monospace, 'SF Mono', Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0e1512;
    --card: #161f1b;
    --sunk: #1d2823;
    --ink: #e9efea;
    --muted: #a0ada5;
    --faint: #76837b;
    --line: #26322c;
    --brand: #45ae80;
    --brand-ink: #08130e;
    --up: #4fb98a;
    --down: #e58274;
    --gold: #d9a441;
    --blue: #7fabeb;
    --violet: #a898e0;
    --berry: #e08aa8;
    --series: #45ae80;
    --bench: #6a9ce6;
    --tip: #26342d;
    --shadow: 0 0 0 1px rgb(255 255 255 / 2%);
  }
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 1rem/1.5 var(--sans);
  color: var(--ink);
  background: var(--page);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button, input, select { font: inherit; color: inherit; }
button, a, input, select { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { border: 0; background: none; cursor: pointer; padding: 0; text-align: inherit; }
a { color: inherit; text-decoration: none; }
button:disabled { opacity: .5; cursor: wait; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 70%, transparent); outline-offset: 2px; }
[hidden] { display: none !important; }
.ico { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.symbol { font-family: var(--sans); font-weight: 650; letter-spacing: .01em; }
.muted { color: var(--muted); }
.meta { font-size: .8rem; }
.positive { color: var(--up); }
.negative { color: var(--down); }
.skip-link { position: fixed; left: 10px; top: -100px; background: var(--card); padding: 12px; z-index: 10; border-radius: 10px; }
.skip-link:focus { top: 10px; }

/* ------------------------------------------------------------------ frame */
.shell { min-height: 100dvh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.rail {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column;
  padding: 22px 14px 18px;
  border-right: 1px solid var(--line);
  background: var(--card);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 22px; font-size: 1.25rem; font-weight: 700; letter-spacing: .04em; }
.brand img { border-radius: 11px; }
.rail nav { display: grid; gap: 4px; }
.rail nav a {
  display: flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 12px; border-radius: 12px;
  color: var(--muted); font-weight: 500;
}
.rail nav a:hover { background: var(--sunk); color: var(--ink); }
.rail nav a[aria-current=page] { background: color-mix(in srgb, var(--brand) 12%, var(--card)); color: var(--brand); font-weight: 650; }
.rail nav a[aria-current=page] .ico { stroke-width: 2.1; }
.nav-short { display: none; }
.rail-bottom { margin-top: auto; }
.rail-setting { display: flex; align-items: center; gap: 12px; width: 100%; height: 44px; padding: 0 12px; border-radius: 12px; color: var(--muted); font-weight: 500; margin-bottom: 12px; }
.rail-setting:hover { background: var(--sunk); color: var(--ink); }
.identity { border-top: 1px solid var(--line); display: flex; align-items: center; gap: 11px; padding: 16px 8px 0; }
.identity strong { display: block; font-size: .92rem; }
.identity small { color: var(--faint); font-size: .76rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--felt); color: #f1e3b6; font-weight: 650; font-size: .9rem; flex: none; }

.work { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  height: 60px; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: color-mix(in srgb, var(--page) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.breadcrumbs { display: flex; align-items: center; gap: 9px; color: var(--faint); font-size: .9rem; min-width: 0; }
.breadcrumbs strong { color: var(--ink); font-weight: 600; white-space: nowrap; }
.top-logo { display: none; border-radius: 8px; }
.tools { display: flex; align-items: center; gap: 10px; }
.sync { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.sync:empty { display: none; }
.sync::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--up); }
.sync.waiting::before { background: var(--gold); }
.icon-button {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--muted);
}
.icon-button:hover { color: var(--ink); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.notification { position: relative; }
.notification span { position: absolute; right: 8px; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: #d9663f; border: 1.5px solid var(--card); }
.mobile-toggle, .scrim, .top-setting { display: none; }

main { padding: 12px 32px 64px; max-width: 1240px; margin: 0 auto; outline: none; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 10px 0 22px; }
.page-heading h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: .01em; line-height: 1.25; }
.page-heading p { color: var(--muted); font-size: .92rem; margin-top: 4px; }

/* ------------------------------------------------------------------ pieces */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; box-shadow: var(--shadow); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 20px 22px 0; }
.section-head h2 { font-size: 1.05rem; font-weight: 650; }
.section-head p { color: var(--muted); font-size: .82rem; margin-top: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 17px; border-radius: 12px; font-weight: 600; font-size: .93rem; white-space: nowrap;
}
.btn .ico, .action-light .ico, .action-glass .ico { width: 17px; height: 17px; }
.btn.outline { border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.btn.outline:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { border: 1px solid color-mix(in srgb, var(--down) 35%, var(--line)); color: var(--down); background: var(--card); }
.btn.more { display: flex; margin: 4px auto 20px; }
.link-button { color: var(--brand); font-weight: 600; font-size: .88rem; }
.link-button:hover { text-decoration: underline; }

.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; background: var(--sunk); color: var(--muted); }
.pill.green { background: color-mix(in srgb, var(--up) 14%, var(--card)); color: var(--up); }
.pill.blue { background: color-mix(in srgb, var(--blue) 14%, var(--card)); color: var(--blue); }
.pill.gold { background: color-mix(in srgb, var(--gold) 16%, var(--card)); color: var(--gold); }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 7px; font-size: .78rem; font-weight: 600; background: var(--sunk); color: var(--muted); }
.chip.positive { background: color-mix(in srgb, var(--up) 13%, var(--card)); color: var(--up); }
.chip.negative { background: color-mix(in srgb, var(--down) 13%, var(--card)); color: var(--down); }

.segmented { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--sunk); gap: 2px; }
.segmented button { height: 32px; padding: 0 13px; border-radius: 9px; font-size: .84rem; font-weight: 550; color: var(--muted); white-space: nowrap; }
.segmented button[aria-pressed=true] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 12%); }

.empty { display: grid; justify-items: center; gap: 6px; padding: 38px 20px; text-align: center; color: var(--muted); }
.empty .ico { width: 26px; height: 26px; color: var(--faint); }
.empty strong { color: var(--ink); font-weight: 600; }
.empty p { font-size: .88rem; max-width: 34ch; }
.note { color: var(--muted); font-size: .88rem; line-height: 1.65; }
.risk-note { margin: -6px 0 18px; padding: 12px 16px; border-radius: 14px; font-size: .9rem; background: color-mix(in srgb, var(--gold) 13%, var(--card)); color: var(--ink); }
.risk-note a { color: var(--gold); font-weight: 600; }

.stock-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--sunk); color: var(--muted); }
.stock-mark.jade { background: color-mix(in srgb, var(--up) 14%, var(--card)); color: var(--up); }
.stock-mark.sky { background: color-mix(in srgb, var(--blue) 14%, var(--card)); color: var(--blue); }
.stock-mark.berry { background: color-mix(in srgb, var(--berry) 14%, var(--card)); color: var(--berry); }
.stock-mark.violet { background: color-mix(in srgb, var(--violet) 14%, var(--card)); color: var(--violet); }

.bar { display: block; height: 5px; border-radius: 3px; background: var(--sunk); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--brand); min-width: 5px; }
.due .bar i { background: var(--gold); }

/* ------------------------------------------------------------------ today */
.lower-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 18px; margin-top: 18px; }
/* two columns side by side: the pick, the account and the curve; the calendar and the holdings */
.today { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.today-col { display: grid; gap: 18px; min-width: 0; }
.today .strip { margin-top: 0; }

/* the felt card: this round's pick */
.hero { position: relative; isolation: isolate; overflow: hidden; border-radius: 24px; background: #0c3f2c; color: #fff; box-shadow: 0 14px 34px rgb(13 54 40 / 22%); container-type: inline-size; }
/* a narrow card: the tile small in the top corner, clear of the words */
.hero-art { position: absolute; top: -19px; right: -86px; height: 240px; width: auto; z-index: -2; -webkit-mask-image: radial-gradient(closest-side, #000 38%, transparent 100%); mask-image: radial-gradient(closest-side, #000 38%, transparent 100%); }
.hero-shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(200deg, rgb(8 44 32 / 0%) 0%, rgb(8 44 32 / 40%) 45%); }
.hero-inner { display: flex; flex-direction: column; height: 100%; padding: 26px 28px 26px; }
.hero-title p { max-width: calc(100% - 100px); }
@container (max-width: 699.98px) {
  .bare .hero-title, .bare .hero-say { max-width: calc(100% - 96px); }
}
/* a wide card: the felt and the tile fill the right, the words keep to the left */
@container (min-width: 700px) {
  .hero-inner { min-height: 340px; }
  .hero-art { top: 0; right: -13%; height: 100%; -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 42%); mask-image: linear-gradient(90deg, transparent 0, #000 42%); }
  .hero-shade { background: linear-gradient(100deg, rgb(8 44 32 / 80%) 0%, rgb(8 44 32 / 46%) 58%, rgb(8 44 32 / 6%) 100%); }
  .hero-title, .hero-say, .hero-numbers, .hero-deadline { max-width: 60cqw; }
  .hero-title p { max-width: none; }
}
.hero-meta { display: flex; align-items: center; gap: 12px; font-size: .86rem; font-weight: 600; color: #f0e2b4; }
.hero-meta > span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta .ico { width: 16px; height: 16px; }
.hero-meta .hero-date { color: rgb(255 255 255 / 66%); font-weight: 450; }
.hero-pill { margin-left: auto; height: 26px; padding: 0 12px; border-radius: 999px; display: inline-flex; align-items: center; background: rgb(255 255 255 / 15%); color: #fff; font-size: .8rem; }
.hero-pill.live { background: #f0c96a; color: #2b2208; }
.hero-title { margin-top: 20px; }
.hero-title h2 { font-size: 2rem; font-weight: 700; line-height: 1.15; }
.hero-title h2.ticker { font-size: 3.5rem; letter-spacing: .01em; line-height: 1; }
.hero-title p { margin-top: 8px; color: rgb(255 255 255 / 72%); font-size: .95rem; }
.hero-say { margin-top: 16px; font-size: 1.1rem; line-height: 1.55; font-weight: 500; max-width: 30em; }
.hero-numbers { display: flex; gap: 12px; margin-top: 18px; }
.hero-numbers div { flex: 0 1 190px; padding: 12px 16px; border-radius: 14px; background: rgb(255 255 255 / 11%); border: 1px solid rgb(255 255 255 / 10%); }
.hero-numbers span { display: block; font-size: .78rem; color: rgb(255 255 255 / 68%); }
.hero-numbers strong { display: block; font-size: 1.35rem; font-weight: 650; margin-top: 1px; white-space: nowrap; }
.hero-deadline { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: .88rem; color: rgb(255 255 255 / 80%); }
.hero-deadline .ico { width: 16px; height: 16px; }
.hero-deadline b { color: #f0c96a; font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 22px; }
.action-light, .action-glass { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: 14px; font-weight: 650; font-size: .95rem; white-space: nowrap; }
.action-light { background: #fffdf6; color: #0f3d2e; }
.action-light:hover { background: #fff; }
.action-glass { background: rgb(255 255 255 / 13%); color: #fff; border: 1px solid rgb(255 255 255 / 16%); }
.action-glass:hover { background: rgb(255 255 255 / 20%); }

/* what is on the calendar */
.agenda { display: flex; flex-direction: column; }
.agenda > .note { padding: 10px 22px 0; }
.agenda-list { padding: 8px 10px 12px; display: grid; }
.agenda-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 14px; }
button.agenda-row:hover { background: var(--sunk); }
.agenda-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.agenda-icon.green { background: color-mix(in srgb, var(--up) 14%, var(--card)); color: var(--up); }
.agenda-icon.violet { background: color-mix(in srgb, var(--violet) 14%, var(--card)); color: var(--violet); }
.agenda-icon.amber { background: color-mix(in srgb, var(--gold) 16%, var(--card)); color: var(--gold); }
.agenda-copy { display: grid; min-width: 0; }
.agenda-copy b { font-weight: 600; font-size: .95rem; }
.agenda-copy em { font-style: normal; font-weight: 650; color: var(--brand); }
.agenda-copy small { color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-row time { font-size: .86rem; color: var(--muted); white-space: nowrap; }

/* four figures in a row */
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 18px; container-type: inline-size; }
.metric { padding: 20px 22px; min-width: 0; display: block; width: 100%; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric-head { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .84rem; white-space: nowrap; }
.metric-head .ico { width: 16px; height: 16px; color: var(--faint); }
.metric-value { margin-top: 8px; font-size: clamp(1.05rem, 2.55cqw, 1.6rem); font-weight: 650; line-height: 1.2; white-space: nowrap; letter-spacing: -.01em; }
.metric-value small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.metric-foot { margin-top: 8px; min-height: 22px; font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric.as-link:hover { background: var(--sunk); }
.metric.as-link:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.slots { display: inline-flex; gap: 5px; vertical-align: middle; }
.slots i { width: 22px; height: 6px; border-radius: 3px; background: var(--sunk); }
.slots i.on { background: var(--brand); }

/* a curve against QQQ */
.chart-panel { display: flex; flex-direction: column; }
.chart-summary { display: flex; flex-wrap: wrap; gap: 6px 24px; padding: 14px 22px 0; }
.series-key { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); }
.series-key b { color: var(--ink); font-size: 1.15rem; font-weight: 650; }
.series-key b small { font-size: .8rem; font-weight: 500; color: var(--muted); }
.swatch { display: inline-block; width: 18px; height: 3px; border-radius: 3px; background: var(--series); flex: none; }
.swatch.benchmark { height: 2px; background: repeating-linear-gradient(90deg, var(--bench) 0, var(--bench) 5px, transparent 5px, transparent 8px); }
.nav-chart { position: relative; height: 250px; margin: 10px 14px 0; outline: none; border-radius: 10px; }
.nav-chart:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 70%, transparent); }
.nav-chart svg { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.nav-chart text { fill: var(--faint); font-size: 11px; font-family: var(--sans); }
.nav-chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.nav-chart .line-model { fill: none; stroke: var(--series); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.nav-chart .line-bench { fill: none; stroke: var(--bench); stroke-width: 2; stroke-dasharray: 5 5; stroke-linecap: round; }
.nav-chart .dot-model { fill: var(--series); stroke: var(--card); stroke-width: 2; }
.nav-chart .dot-bench { fill: var(--bench); stroke: var(--card); stroke-width: 2; }
.nav-chart .cross line { stroke: var(--faint); stroke-dasharray: 3 4; }
.nav-chart .fill-top { stop-color: var(--series); stop-opacity: .2; }
.nav-chart .fill-end { stop-color: var(--series); stop-opacity: .01; }
.chart-tip { position: absolute; z-index: 2; pointer-events: none; background: var(--tip); color: #fff; border-radius: 10px; padding: 9px 12px; box-shadow: 0 6px 18px rgb(0 0 0 / 18%); font-size: .78rem; min-width: 150px; }
.chart-tip > b { display: block; margin-bottom: 3px; font-weight: 600; }
.chart-tip span { display: flex; align-items: center; gap: 7px; color: rgb(255 255 255 / 80%); }
.chart-tip strong { margin-left: auto; color: #fff; }
.chart-tip .swatch { background: #5fc79a; }
.chart-tip .swatch.benchmark { background: repeating-linear-gradient(90deg, #8db6f2 0, #8db6f2 5px, transparent 5px, transparent 8px); }
.chart-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; padding: 8px 22px 18px; font-size: .78rem; color: var(--faint); }

/* ------------------------------------------------------------------ holdings */
.list-panel { margin-top: 18px; }
.hold-list, .round-list { container-type: inline-size; padding: 6px 10px 10px; }
.hold-head, .round-head { display: grid; gap: 14px; padding: 16px 22px 4px; font-size: .78rem; color: var(--faint); }
.hold-head { grid-template-columns: 40px minmax(96px, 1.15fr) minmax(190px, 1.5fr) minmax(100px, .8fr) minmax(130px, .9fr); }
.hold-head span:first-child { grid-column: span 2; }
.hold-head span:nth-child(n+3) { text-align: right; }
.hold-row {
  display: grid; align-items: center; gap: 4px 14px; width: 100%; padding: 13px 12px; border-radius: 14px;
  grid-template-columns: 40px minmax(96px, 1.15fr) minmax(190px, 1.5fr) minmax(100px, .8fr) minmax(130px, .9fr);
  grid-template-areas: 'mark name plan worth gain';
}
.hold-row:hover, .round-row:hover { background: var(--sunk); }
.hold-row, .round-row { position: relative; }
.hold-row + .hold-row::before, .round-row + .round-row::before { content: ''; position: absolute; top: -.5px; left: 12px; right: 12px; height: 1px; background: var(--line); }
.hold-row:hover::before, .hold-row:hover + .hold-row::before, .round-row:hover::before, .round-row:hover + .round-row::before { display: none; }
.hold-row .stock-mark { grid-area: mark; }
.hold-name { grid-area: name; display: grid; min-width: 0; }
.hold-name b { font-size: 1.02rem; }
.hold-name small { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hold-plan { grid-area: plan; display: grid; gap: 7px; min-width: 0; }
.hold-plan small { font-size: .84rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hold-plan.due small { color: var(--gold); font-weight: 600; }
.hold-plan .bar { max-width: 260px; }
.hold-worth { grid-area: worth; display: grid; justify-items: end; }
.hold-worth small { color: var(--muted); font-size: .8rem; }
.hold-worth b { font-weight: 550; }
.hold-gain { grid-area: gain; display: grid; justify-items: end; gap: 4px; }
.hold-gain strong { font-size: 1.02rem; font-weight: 650; white-space: nowrap; }
/* narrow: two lines, the stock and its result above, the sale and the percentage below */
@container (max-width: 660px) {
  .hold-row { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: 'mark name gain' 'mark plan gain'; padding: 12px 10px; }
  .hold-name { display: flex; align-items: baseline; gap: 8px; }
  .hold-worth, .hold-plan .wide { display: none; }
  .hold-plan { gap: 6px; }
  .hold-plan .bar { max-width: 200px; }
}
.panel:has(> .hold-list.compact) .hold-head { display: none; }
.mini-hold .hold-list { padding-top: 10px; }

/* ------------------------------------------------------------------ every round */
.round-head, .round-row { grid-template-columns: 104px minmax(160px, 1.4fr) minmax(90px, .8fr) minmax(110px, .9fr) 18px; }
.round-head span:nth-child(4) { text-align: right; }
.round-row { display: grid; align-items: center; gap: 4px 14px; width: 100%; padding: 12px 12px; border-radius: 14px; grid-template-areas: 'time stock state fill chev'; }
.round-row time { grid-area: time; color: var(--muted); font-size: .88rem; }
.round-stock { grid-area: stock; display: flex; align-items: center; gap: 12px; min-width: 0; }
.round-stock > span:last-child { display: grid; min-width: 0; }
.round-stock b { font-size: 1.02rem; }
.round-stock small { color: var(--muted); font-size: .8rem; }
.round-state { grid-area: state; }
.round-fill { grid-area: fill; display: grid; justify-items: end; }
.round-fill b { font-weight: 550; font-size: .92rem; }
.round-fill small { color: var(--muted); font-size: .8rem; }
.round-row .chev { grid-area: chev; width: 16px; height: 16px; color: var(--faint); }
@container (max-width: 620px) {
  .round-row { grid-template-columns: 40px minmax(0, 1fr) auto 16px; grid-template-areas: 'mark name state chev' 'mark time fill chev'; padding: 12px 10px; gap: 3px 12px; }
  .round-stock { display: contents; }
  .round-stock .stock-mark { grid-area: mark; }
  .round-stock > span:last-child { grid-area: name; }
  .round-stock small { display: none; }
  .round-row time { font-size: .82rem; }
  .round-state { justify-self: end; }
  .round-fill { display: flex; gap: 8px; align-items: baseline; justify-self: end; }
  .round-fill b { font-size: .86rem; }
  .round-fill small:only-child { display: none; }
}

/* ------------------------------------------------------------------ figures, tables */
.stats-panel { padding-bottom: 8px; }
.stats-panel > .note { padding: 10px 22px 0; }
.stats-panel .facts, .stats-panel .check-list { padding: 8px 22px 12px; }
.facts { display: grid; }
.facts > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; }
.facts > div + div { border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { font-weight: 600; text-align: right; }
.check-list { display: grid; gap: 10px; }
.check-list li { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; line-height: 1.55; }
.check-list .ico { width: 17px; height: 17px; margin-top: 3px; color: var(--brand); }

.table-scroll { overflow-x: auto; padding: 8px 12px 14px; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: 11px 10px; text-align: left; white-space: nowrap; }
thead th { color: var(--faint); font-weight: 500; font-size: .8rem; }
tbody tr { border-top: 1px solid var(--line); }
tbody th { font-weight: 500; color: var(--muted); }
.num { text-align: right; }
td.num { font-weight: 600; }
td.num.muted { font-weight: 500; }
table.compare thead th { vertical-align: top; padding-bottom: 12px; }
table.compare .col-name { display: block; color: var(--ink); font-size: .98rem; font-weight: 650; }
table.compare thead .pill { margin-top: 5px; height: 21px; font-size: .7rem; padding: 0 8px; }
table.compare td { font-size: 1.05rem; padding: 13px 10px; }
.best { display: inline-block; padding: 2px 9px; margin: -2px -9px -2px 0; border-radius: 8px; background: color-mix(in srgb, var(--up) 14%, var(--card)); color: var(--up); }
.compare-panel { margin-top: 0; }
.model-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 22px; }
.model-toolbar .btn { margin-left: auto; }
.model-grid { margin-top: 14px; }
.book-chart, .model-grid { align-items: start; }

/* ------------------------------------------------------------------ dialogs */
dialog {
  padding: 0; border: 1px solid var(--line); border-radius: 22px;
  width: min(540px, calc(100% - 28px)); max-height: min(88dvh, 860px);
  background: var(--card); color: var(--ink);
  box-shadow: 0 30px 90px rgb(0 0 0 / 28%); overscroll-behavior: contain;
}
dialog::backdrop { background: rgb(10 22 16 / 48%); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
body:has(dialog[open]) { overflow: hidden; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 14px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 1; }
.dialog-head h2 { font-size: 1.1rem; font-weight: 650; }
.dialog-head .icon-button { border: 0; background: var(--sunk); width: 34px; height: 34px; border-radius: 50%; }
.dialog-content { padding: 20px 24px 24px; }
.dialog-content h3 { font-size: .82rem; font-weight: 600; color: var(--faint); margin: 24px 0 4px; letter-spacing: .04em; }
.dialog-content h3 + .check-list { margin-top: 10px; }
.dialog-content p { line-height: 1.65; }
.dialog-content p.note + .field, .dialog-content p.note + .form-grid { margin-top: 16px; }
.dialog-content .note + .facts, .dialog-content .note + h3 { margin-top: 14px; }
.dialog-lead + .note { margin-top: 6px; }
.dialog-content .note + .check-list { margin-top: 12px; }
.result ~ .facts { margin-top: 12px; }
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.dialog-actions:empty { display: none; }
.dialog-lead { display: flex; gap: 12px; align-items: center; }
.dialog-lead .symbol, .dialog-lead > strong { font-size: 1.8rem; line-height: 1.2; }
.subtle { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.subtle:empty { display: none; }
.say { margin: 14px 0 6px; padding: 13px 16px; border-radius: 14px; background: color-mix(in srgb, var(--brand) 9%, var(--card)); font-weight: 500; }
.result { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-top: 18px; }
.result > span:first-child { flex-basis: 100%; color: var(--muted); font-size: .86rem; }
.result strong { font-size: 2.2rem; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.result .chip { align-self: center; height: 26px; font-size: .88rem; }
.progress { margin: 18px 0 8px; padding: 15px 16px 13px; border-radius: 16px; background: var(--sunk); }
.progress .bar { height: 7px; border-radius: 4px; margin: 11px 0 8px; background: color-mix(in srgb, var(--ink) 9%, var(--sunk)); }
.progress .bar i { border-radius: 4px; }
.progress-say { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.progress-say b { font-weight: 650; }
.progress.due .progress-say b { color: var(--gold); }
.progress-say span, .progress-ends { font-size: .8rem; color: var(--muted); }
.progress-ends { display: flex; justify-content: space-between; gap: 12px; }
.trade-record { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 0; }
.trade-record + .trade-record { border-top: 1px solid var(--line); }
.trade-record .side { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: .82rem; font-weight: 650; background: color-mix(in srgb, var(--up) 14%, var(--card)); color: var(--up); }
.trade-record .side.sell { background: color-mix(in srgb, var(--gold) 16%, var(--card)); color: var(--gold); }
.trade-record b { display: block; font-weight: 600; }
.trade-record small { color: var(--muted); font-size: .8rem; }
.trade-record .btn { height: 34px; padding: 0 13px; font-size: .84rem; }
.rank-list { display: grid; }
.rank-list li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 0; }
.rank-list li + li { border-top: 1px solid var(--line); }
.rank-list .rank { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 600; background: var(--sunk); color: var(--muted); }
.rank-list small { color: var(--muted); font-size: .84rem; }
.rank-list .chosen .rank { background: var(--brand); color: var(--brand-ink); }
.rank-list .chosen small { color: var(--brand); font-weight: 600; }
.sizing { margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 0 16px; }
.sizing summary { cursor: pointer; padding: 12px 0; font-weight: 600; font-size: .9rem; color: var(--brand); }
.sizing .note { padding-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.field { display: grid; gap: 7px; font-size: .86rem; color: var(--muted); font-weight: 500; min-width: 0; }
form > .field { margin-top: 16px; }
.field input:not([type=range]) { height: 46px; width: 100%; min-width: 0; padding: 0 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--page); color: var(--ink); font-size: 1.02rem; font-weight: 550; }
.field input:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.field input[type=range] { width: 100%; accent-color: var(--brand); height: 28px; }
.field small { font-weight: 400; font-size: .82rem; }
.range-label { display: flex; justify-content: space-between; align-items: baseline; }
.range-label b { color: var(--ink); font-weight: 600; font-size: .95rem; }
.range-label output { color: var(--ink); font-weight: 650; font-size: 1.1rem; }
.reserve-panel { padding: clamp(18px, 3vw, 28px); margin-bottom: 18px; }
.reserve-panel form { max-width: 44rem; }
.reserve-panel form > .field { margin-top: 0; }
.reserve-panel .range-label output { font-size: 1.65rem; font-variant-numeric: tabular-nums; }
.reserve-scale { display: flex; justify-content: space-between; font-size: .8rem; }
.reserve-example { margin: 12px 0 18px; }
form .facts { margin-top: 16px; padding: 4px 16px; border-radius: 14px; background: var(--sunk); }
form .facts > div + div { border-top-color: color-mix(in srgb, var(--ink) 8%, var(--sunk)); }
.form-error { margin-top: 14px; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--down) 12%, var(--card)); color: var(--down); font-size: .9rem; }
.message-row { padding: 14px 0; }
.message-row:first-child { padding-top: 0; }
.message-row + .message-row { border-top: 1px solid var(--line); }
.message-row b { display: block; font-weight: 600; }
.message-row small { color: var(--faint); font-size: .78rem; }
.message-row p { margin-top: 4px; color: var(--muted); font-size: .92rem; }

#toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); color: #fff; background: var(--tip); border-radius: 14px; padding: 12px 20px; z-index: 8; max-width: calc(100% - 24px); font-size: .9rem; box-shadow: 0 8px 24px rgb(0 0 0 / 22%); }
#toast:empty { display: none; }

/* ------------------------------------------------------------------ a narrower window */
@media (max-width: 1180px) {
  .lower-grid, .today { grid-template-columns: minmax(0, 1fr); }
  /* one column: the pick, the calendar, the account, the holdings, then the curve */
  .today-col { display: contents; }
  .today .hero { order: 1; }
  .today .agenda { order: 2; }
  .today .strip { order: 3; }
  .today .mini-hold { order: 4; }
  .today .chart-panel { order: 5; }
  .metric { padding: 18px 18px; }
}

/* ------------------------------------------------------------------ a phone or a small tablet:
   the rail becomes a tab bar at the foot of the screen */
@media (max-width: 860px) {
  .shell { display: block; }
  .rail {
    position: fixed; inset: auto 0 0 0; z-index: 6; height: auto;
    flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--card) 90%, transparent);
    backdrop-filter: saturate(1.5) blur(18px); -webkit-backdrop-filter: saturate(1.5) blur(18px);
  }
  .rail .brand, .rail-bottom { display: none; }
  .rail nav { grid-template-columns: repeat(4, 1fr); gap: 2px; width: 100%; max-width: 520px; margin: 0 auto; }
  .rail nav a { flex-direction: column; justify-content: center; gap: 3px; height: 52px; padding: 0; font-size: .7rem; border-radius: 12px; }
  .rail nav a:hover { background: none; color: var(--muted); }
  .rail nav a[aria-current=page], .rail nav a[aria-current=page]:hover { background: none; color: var(--brand); }
  .rail nav a .ico { width: 23px; height: 23px; }
  .nav-long { display: none; }
  .nav-short { display: block; }

  .topbar { height: 54px; padding: 0 16px; }
  .top-logo { display: block; }
  .crumb-root, .slash { display: none; }
  .breadcrumbs strong { font-size: 1.08rem; font-weight: 700; }
  .top-setting { display: inline-grid; }
  .icon-button { width: 38px; height: 38px; }
  .tools { gap: 8px; }

  main { padding: 4px 16px calc(96px + env(safe-area-inset-bottom)); }
  .page-heading { margin: 4px 0 14px; align-items: center; }
  .page-heading h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .page-heading p { margin: 0; font-size: .84rem; }
  .heading-action { height: 36px; padding: 0 12px; font-size: .84rem; flex: none; }

  .lower-grid, .today { gap: 14px; }
  .lower-grid, .strip, .list-panel { margin-top: 14px; }
  .hero { border-radius: 22px; }
  .hero-inner { padding: 20px 20px 20px; }
  .hero-title h2.ticker { font-size: 2.9rem; }
  .hero-say { font-size: 1.02rem; }
  .hero-numbers div { flex: 1 1 0; padding: 11px 13px; }
  .hero-numbers strong { font-size: 1.2rem; }
  .hero-actions button { flex: 1 1 auto; padding: 0 14px; }
  .hero-actions .action-light { flex-basis: 100%; }

  .strip { grid-template-columns: 1fr 1fr; }
  .metric { padding: 16px 16px; }
  .metric + .metric { border-left: 0; }
  .metric:nth-child(even) { border-left: 1px solid var(--line); }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .metric.as-link:last-child { border-radius: 0 0 var(--radius) 0; }
  .metric-value { font-size: clamp(1.05rem, 5.4cqw, 1.45rem); }
  .slots i { width: 16px; }

  .section-head { padding: 16px 16px 0; }
  .chart-summary { padding: 12px 16px 0; }
  .nav-chart { height: 210px; margin: 8px 8px 0; }
  .chart-foot { padding: 8px 16px 16px; }
  .agenda-list, .hold-list, .round-list { padding: 6px 6px 8px; }
  .hold-head, .round-head { display: none; }
  .stats-panel > .note { padding: 10px 16px 0; }
  .stats-panel .facts, .stats-panel .check-list { padding: 6px 16px 10px; }
  .table-scroll { padding: 6px 6px 10px; }
  th, td { padding: 10px 8px; }
  table.compare { table-layout: fixed; }
  table.compare th:first-child { width: 23%; }
  table.compare th:last-child { width: 19%; }
  table.compare th, table.compare td { padding: 12px 4px; }
  table.compare td { font-size: .88rem; }
  table.compare tbody th { font-size: .84rem; }
  table.compare .col-name { font-size: .78rem; white-space: normal; }
  .best { padding: 2px 6px; margin-right: -6px; }
  .compare-panel .table-scroll { padding: 6px 12px 10px; }
  .model-toolbar { margin-top: 16px; }
  .model-toolbar .btn { margin-left: 0; width: 100%; }
  .model-tabs { width: 100%; }
  .model-tabs button { flex: 1; padding: 0 6px; }

  dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 22px 22px 0 0; border-width: 1px 0 0; max-height: 92dvh; padding-bottom: env(safe-area-inset-bottom); }
  .dialog-head { padding: 14px 14px 12px 20px; }
  .dialog-content { padding: 18px 20px 22px; }
  .dialog-actions .btn { flex: 1 1 auto; height: 46px; }
  #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (max-width: 400px) {
  .sync { display: none; }
  .hero-title h2.ticker { font-size: 2.6rem; }
  .segmented button { padding: 0 10px; }
  table.compare td { font-size: .82rem; }
  table.compare th:first-child { width: 22%; }
}
@media (prefers-reduced-motion: no-preference) {
  .hold-row, .round-row, .agenda-row, .rail nav a, .btn, .action-light, .action-glass { transition: background-color .15s, border-color .15s, filter .15s; }
  dialog[open] { animation: rise .22s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } }
}
