/* Slice — shared styles. Layout: a sticky dark header with search; single-column pages of per-share sections that stack at phone width. */
/* Gouda palette: cream paper, gouda gold, rind brown, wax red for losses. */
:root {
  --ground: #FBF7EF;
  --surface: #FFFFFF;
  --ink: #2B2117;
  --ink-2: #4A3C2C;
  --muted: #6E5F4C;
  --line: #E7DDCB;
  --line-soft: #F1EADC;
  --band: #2B2117;
  --band-2: #3B2E21;
  --band-line: #574634;
  --band-ink: #FBF3E3;
  --band-muted: #DCCBB0;
  --accent: #8C5A00;          /* gold dark enough for text on cream */
  --accent-bright: #F4B740;   /* gouda gold: buttons, highlights on dark */
  --accent-bar: #E9A825;      /* chart fills */
  --accent-soft: #FDF1D3;
  --accent-soft-line: #F2D58C;
  --loss: #A33B23;
  --loss-bar: #C8502E;
  --loss-soft: #FBEAE4;
  --loss-soft-line: #EDBFAF;
  --loss-on-band: #F4A58A;
  --bar-muted: #DCCFB6;
  --seg-1: #EADFC9;
  --seg-2: #C4B08C;
  --seg-3: #8F7B5E;
  --series-b: #3E6FB0;
  --btn-bg: #F4B740;
  --btn-ink: #2B2117;
  --font-display: 'Inter Tight', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Inter Tight', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-data: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #17120C; --surface: #211A12; --ink: #F5ECDD; --ink-2: #DCCFBA; --muted: #B3A38B;
    --line: #3A2F22; --line-soft: #2C241A; --band: #120E09; --band-2: #211A12; --band-line: #3E3224;
    --band-ink: #F5ECDD; --band-muted: #C9B89E; --accent: #F4B740; --accent-bright: #F4B740; --accent-bar: #E9A825;
    --accent-soft: #3A2C12; --accent-soft-line: #6B5020; --loss: #F4A58A; --loss-bar: #D9643F;
    --loss-soft: #3A1F16; --loss-soft-line: #6B3524; --loss-on-band: #F4A58A; --bar-muted: #4A3E2E;
    --seg-1: #4D4132; --seg-2: #7A6A52; --seg-3: #A8916E; --series-b: #8FB3E8; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #17120C; --surface: #211A12; --ink: #F5ECDD; --ink-2: #DCCFBA; --muted: #B3A38B;
  --line: #3A2F22; --line-soft: #2C241A; --band: #120E09; --band-2: #211A12; --band-line: #3E3224;
  --band-ink: #F5ECDD; --band-muted: #C9B89E; --accent: #F4B740; --accent-bright: #F4B740; --accent-bar: #E9A825;
  --accent-soft: #3A2C12; --accent-soft-line: #6B5020; --loss: #F4A58A; --loss-bar: #D9643F;
  --loss-soft: #3A1F16; --loss-soft-line: #6B3524; --loss-on-band: #F4A58A; --bar-muted: #4A3E2E;
  --seg-1: #4D4132; --seg-2: #7A6A52; --seg-3: #A8916E; --series-b: #8FB3E8; color-scheme: dark;
}
* { box-sizing: border-box; }
/* "hidden" must always win over a component's display rule (the chat panel, messages). */
[hidden] { display: none !important; }
body { background: var(--ground); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.5; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--band); }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; letter-spacing: -0.015em; }
p { margin: 0; }
.num { font-family: var(--font-data); font-variant-numeric: tabular-nums; font-weight: 600; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent-bright); outline-offset: 2px; }

/* Header */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--band); color: var(--band-ink); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo { color: var(--band-ink); text-decoration: none; font-weight: 700; font-size: 20px; display: flex; align-items: center; gap: 10px; }
.tagline { font-size: 15px; color: var(--band-muted); border-left: 1px solid var(--band-line); padding-left: 14px; }
.search { display: flex; gap: 8px; flex: 1 1 280px; max-width: 460px; }
.search input { flex: 1; min-width: 0; height: 44px; border-radius: 8px; border: 1px solid var(--band-line); background: var(--band-2); color: var(--band-ink); padding: 0 14px; font: inherit; font-size: 15px; }
.search input::placeholder { color: var(--band-muted); }
.search button { height: 44px; padding: 0 18px; border-radius: 8px; border: 0; background: var(--accent-bright); color: var(--btn-ink); font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

main.wrap { display: flex; flex-direction: column; gap: 40px; padding-block: 32px 64px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
.chip { min-height: 36px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.msg { font-size: 15px; color: var(--loss); }

/* Hero */
.hero { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 28px; }
.hero-text { flex: 1 1 520px; min-width: 0; }
.eyebrow { font-family: var(--font-data); font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; }
.hero h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.05; margin-block: 8px 12px; }
.lede { font-size: 17px; color: var(--ink-2); max-width: 62ch; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; margin-left: 8px; vertical-align: middle; font-family: var(--font-body); letter-spacing: 0; text-transform: none; }
.pill.ok { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-soft-line); }
.pill.hold { background: var(--loss-soft); color: var(--loss); border: 1px solid var(--loss-soft-line); }
.pricebox { flex: 0 1 320px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; display: flex; flex-direction: column; gap: 8px; }
.pricebox label { font-size: 14px; color: var(--muted); }
.price-row { display: flex; align-items: center; gap: 6px; }
.price-row span { font-family: var(--font-data); font-size: 34px; font-weight: 600; }
.price-row input { width: 100%; min-width: 0; height: 52px; border: 1px solid var(--line); border-radius: 10px; background: var(--ground); color: var(--ink); font-family: var(--font-data); font-size: 30px; font-weight: 600; padding: 0 10px; }
.small { font-size: 13px; color: var(--muted); }
.valuation { border-top: 1px solid var(--line-soft); padding-top: 12px; font-size: 15px; }

.banner { background: var(--loss-soft); border: 1px solid var(--loss-soft-line); border-radius: 14px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.banner strong { color: var(--loss); }
.banner ul { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: 15px; }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: clamp(20px, 4vw, 36px); display: flex; flex-direction: column; gap: 22px; }
.panel-head { display: flex; flex-direction: column; gap: 8px; }
.kicker { font-family: var(--font-data); font-size: 12px; font-weight: 600; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; }
.panel h2 { font-size: clamp(22px, 3vw, 28px); }
.panel-head p { color: var(--ink-2); max-width: 66ch; }
.row { display: flex; flex-wrap: wrap; gap: 24px; }
.row > * { min-width: 0; }

/* Calculator band */
.band { background: var(--band); color: var(--band-ink); border-radius: 16px; padding: clamp(20px, 4vw, 36px); display: flex; flex-wrap: wrap; gap: 28px; }
.band .kicker { color: var(--accent-bright); }
.band-left { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.band-right { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.band p { color: var(--band-muted); }
.own { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 18px; font-weight: 600; }
.own input { width: 140px; height: 52px; border-radius: 10px; border: 2px solid var(--accent-bright); background: var(--band-2); color: var(--band-ink); padding: 0 12px; font-family: var(--font-data); font-size: 22px; font-weight: 600; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; }
.presets button { min-height: 44px; min-width: 56px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--band-line); background: var(--band-2); color: var(--band-ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.worth { border-top: 1px solid var(--band-line); padding-top: 16px; display: flex; flex-direction: column; gap: 4px; }
.worth .big { font-family: var(--font-data); font-size: 36px; font-weight: 600; color: var(--band-ink); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--band-2); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tile.outline { background: transparent; border: 1px solid var(--band-line); }
.tile .lbl { font-size: 13px; color: var(--band-muted); }
.tile .num { font-size: 20px; color: var(--band-ink); }
.neg { color: var(--loss) !important; }
.band .neg { color: var(--loss-on-band) !important; }
.band .pos { color: var(--accent-bright) !important; }
.sub { font-size: 14px; color: var(--band-muted); }

/* Stacked bars */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-row > span { flex: 0 0 56px; font-size: 14px; font-weight: 600; }
.bar-track { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; height: 44px; border-radius: 8px; overflow: hidden; }
.solid { height: 44px; border-radius: 8px; background: var(--accent); color: #fff; display: flex; align-items: center; padding-left: 12px; font-family: var(--font-data); font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; }
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.legend div { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 4px solid var(--seg-1); }
.legend .lbl { font-size: 14px; color: var(--muted); }
.legend .num { font-size: 21px; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.card { border: 1px solid var(--line-soft); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.card .lbl { font-size: 14px; color: var(--muted); }
.card .num { font-size: 24px; }

/* Ledger list */
.ledger { display: flex; flex-direction: column; }
.ledger div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); font-size: 16px; }
.ledger div.total { border-bottom: 2px solid var(--ink); font-weight: 600; }
.ledger div:last-child { border-bottom: 0; }
.ledger .note { font-size: 14px; color: var(--muted); font-weight: 400; }
.explain { flex: 1 1 340px; border-radius: 16px; padding: clamp(20px, 4vw, 32px); display: flex; flex-direction: column; gap: 12px; background: var(--accent-soft); border: 1px solid var(--accent-soft-line); }
.explain.warn { background: var(--loss-soft); border-color: var(--loss-soft-line); }
.explain .kicker.warn { color: var(--loss); }
.explain .say { font-size: 19px; font-weight: 500; line-height: 1.45; }
.explain p:not(.say) { color: var(--ink-2); }

/* Chart */
.chart-wrap { overflow-x: auto; }
.chart-wrap svg { display: block; width: 100%; min-width: 520px; height: auto; }
.chart-side { flex: 1 1 260px; display: flex; flex-direction: column; gap: 12px; }
.thennow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.thennow div { border: 1px solid var(--line-soft); border-radius: 12px; padding: 14px; }
.thennow div:last-child { background: var(--accent-soft); border-color: var(--accent-soft-line); }
.thennow .num { font-size: 22px; display: block; }
.verdict { background: var(--band); color: var(--band-ink); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.verdict .num { font-size: 26px; color: var(--accent-bright); }
.verdict p { font-size: 15px; color: var(--band-muted); }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); text-align: right; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
thead th { font-weight: 500; color: var(--muted); font-size: 14px; }
td.num { font-weight: 600; }
.table-wrap { overflow-x: auto; }

.notes { display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 20px; }
.notes strong { color: var(--ink); }
.notes ul { margin: 0; padding-left: 20px; }
details summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; color: var(--ink); }
.coverage-list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.coverage-list button { text-align: left; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14px; color: var(--ink-2); cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.coverage-list button b { color: var(--ink); }
@media (prefers-reduced-motion: no-preference) { .solid, .stack > div { transition: width .3s ease, flex-basis .3s ease; } }

/* ------------------------------------------------------------ site chrome */
.nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--band-ink); text-decoration: none; font-weight: 600; font-size: 15px; min-height: 44px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 8px; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--band-2); }
.nav .signin { border: 1px solid var(--band-line); }
.site-foot { border-top: 1px solid var(--line); }
.site-foot .wrap { padding-block: 24px 40px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; font-size: 14px; color: var(--muted); }
.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; border-radius: 10px; border: 0; background: var(--btn-bg); color: var(--btn-ink); font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.bright { background: var(--accent-bright); color: var(--btn-ink); }
.btn[disabled] { opacity: .6; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.field input { height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 0 12px; font: inherit; font-size: 16px; }
.loading { color: var(--muted); padding: 40px 0; }

/* ------------------------------------------------------------- home page */
.home-hero { background: var(--band); color: var(--band-ink); }
.home-hero .wrap { padding-block: clamp(48px, 9vw, 96px) clamp(40px, 7vw, 72px); display: flex; flex-wrap: wrap; gap: 40px; align-items: center; }
.home-hero .copy { flex: 1 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.home-hero h1 { font-size: clamp(44px, 8vw, 88px); line-height: 0.95; letter-spacing: -0.035em; font-weight: 700; }
.home-hero h1 em { font-style: normal; color: var(--accent-bright); }
.home-hero .lede { color: var(--band-muted); font-size: clamp(17px, 2vw, 20px); max-width: 52ch; }
.home-hero .search { max-width: 520px; flex: 0 1 auto; }
.home-hero .search input { height: 54px; font-size: 17px; }
.home-hero .search button { height: 54px; }
.home-hero .chips span { color: var(--band-muted); }
.home-hero .chip { background: var(--band-2); color: var(--band-ink); border-color: var(--band-line); }
.slice-card { flex: 1 1 360px; min-width: 0; background: var(--band-2); border: 1px solid var(--band-line); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.slice-card .top-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.slice-card .tk { font-family: var(--font-data); font-size: 13px; color: var(--band-muted); letter-spacing: .05em; }
.slice-card .px { font-family: var(--font-data); font-size: 30px; font-weight: 600; }
.slice-card .rows { display: flex; flex-direction: column; }
.slice-card .rows div { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--band-line); font-size: 15px; color: var(--band-muted); }
.slice-card .rows div:last-child { border-bottom: 0; }
.slice-card .rows .num { color: var(--band-ink); }
.slice-card .rows .pos { color: var(--accent-bright); }
.slice-card .rows .neg { color: var(--loss-on-band); }
.slice-card a { color: var(--accent-bright); font-weight: 600; }
.points { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.point { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.point .big { font-family: var(--font-data); font-size: 34px; font-weight: 600; letter-spacing: -0.02em; }
.point p { color: var(--ink-2); }
.cta { background: var(--accent-soft); border: 1px solid var(--accent-soft-line); border-radius: 18px; padding: clamp(24px, 5vw, 44px); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.cta h2 { font-size: clamp(24px, 3.5vw, 34px); }
.cta p { color: var(--ink-2); max-width: 56ch; }

/* --------------------------------------------------------- portfolio page */
.auth { max-width: 440px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: clamp(24px, 5vw, 36px); display: flex; flex-direction: column; gap: 16px; }
.auth form { display: flex; flex-direction: column; gap: 14px; }
.notice { font-size: 14px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--ink-2); border: 1px solid var(--accent-soft-line); }
.notice.warn { background: var(--loss-soft); border-color: var(--loss-soft-line); }
.add-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.add-row .field { flex: 1 1 160px; }
.add-row .field.wide { flex: 2 1 240px; }
.holdings td, .holdings th { white-space: nowrap; }
.holdings td:first-child a { font-weight: 600; text-decoration: none; }
.holdings .rm { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; min-height: 36px; padding: 0 6px; text-decoration: underline; }
.summary-band { background: var(--band); color: var(--band-ink); border-radius: 16px; padding: clamp(20px, 4vw, 36px); display: flex; flex-direction: column; gap: 18px; }
.summary-band .kicker { color: var(--accent-bright); }
.summary-band h2 { font-size: clamp(22px, 3vw, 30px); }
.summary-band p { color: var(--band-muted); }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; align-items: center; }

/* ------------------------------------------------------------- assistant */
.ask-fab { position: fixed; right: max(16px, calc(env(safe-area-inset-right, 0px) + 16px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 16px); z-index: 20; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 999px; border: 0; background: var(--band); color: var(--band-ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; box-shadow: 0 6px 20px rgba(16, 32, 27, .25); }
.ask-fab svg { color: var(--accent-bright); }
.ask-panel { position: fixed; right: max(16px, calc(env(safe-area-inset-right, 0px) + 16px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 76px); z-index: 21; width: min(420px, calc(100vw - 32px)); max-height: min(620px, calc(100vh - 110px)); display: flex; flex-direction: column; gap: 12px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: 0 12px 40px rgba(16, 32, 27, .28); }
.ask-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ask-head h2 { font-size: 18px; }
.ask-close { background: none; border: 0; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; min-width: 44px; min-height: 44px; }
.ask-log { flex: 1 1 auto; min-height: 80px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; }
.ask-msg { padding: 10px 12px; border-radius: 12px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; max-width: 92%; }
.ask-msg.assistant { background: var(--ground); align-self: flex-start; }
.ask-msg.user { background: var(--accent); color: #fff; align-self: flex-end; }
.ask-msg.muted { color: var(--muted); }
.ask-suggest .chip { font-weight: 500; text-align: left; min-height: 36px; height: auto; padding: 6px 12px; }
.ask-form { display: flex; gap: 8px; }
.ask-form input { flex: 1; min-width: 0; height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--ground); color: var(--ink); padding: 0 12px; font: inherit; font-size: 15px; }
.ask-foot { margin: 0; }
@media (max-width: 520px) {
  .ask-fab span { display: none; }
  .ask-fab { padding: 0 14px; }
  .ask-panel { left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); width: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 72px); max-height: calc(100vh - 100px); }
}

/* P/E and other price ratios in the price box */
.ratios { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.ratios > div { display: flex; flex-direction: column; gap: 2px; background: var(--ground); border-radius: 10px; padding: 10px 12px; }
.ratios .lbl { font-size: 13px; color: var(--muted); }
.ratios .num { font-size: 24px; }
.ratios .small { font-size: 12px; }
.valuation p { margin: 0; }

/* What the company does */
.about { display: flex; flex-direction: column; gap: 6px; margin-block: 4px 14px; max-width: 70ch; }
.about .industry { align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-soft-line); border-radius: 999px; padding: 3px 10px; }
.about p { font-size: 17px; line-height: 1.55; color: var(--ink); }

/* Search suggestions */
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30; margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(16, 32, 27, .22); max-height: min(380px, 60vh); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.suggest li { display: flex; gap: 10px; align-items: baseline; min-height: 44px; padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.suggest li b { font-family: var(--font-data); font-size: 14px; min-width: 64px; }
.suggest li span { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.suggest li:hover, .suggest li[aria-selected="true"] { background: var(--accent-soft); }
.foot-links { display: flex; gap: 16px; flex-wrap: wrap; }
.foot-links a { color: var(--muted); }
/* Long-form pages: methodology, terms, privacy */
.prose { max-width: 70ch; display: flex; flex-direction: column; gap: 14px; }
.prose h1 { font-size: clamp(30px, 5vw, 44px); }
.prose h2 { font-size: 22px; margin-top: 18px; }
.prose p, .prose li { color: var(--ink-2); line-height: 1.65; }
.prose ul { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.draft-note { background: var(--loss-soft); border: 1px solid var(--loss-soft-line); border-radius: 12px; padding: 14px 16px; color: var(--ink); }
/* Pre-built company summary (shown before the interactive page loads, and to search engines) */
.static-summary table { max-width: 640px; }

/* Company page: tools, the personal story, sources */
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.tools .chip { text-decoration: none; }
.band .story { flex: 1 1 100%; font-size: clamp(18px, 2.4vw, 22px); line-height: 1.45; color: var(--band-ink); max-width: 62ch; margin: 0; }
.band .story strong { font-family: var(--font-data); font-weight: 600; }
.band .story .pos { color: var(--accent-bright); }
.band .story .neg { color: var(--loss-on-band); }
.src { display: inline-block; font-size: 13px; color: var(--muted); }
.src a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.band .src { color: var(--band-muted); }
.sources ul { margin: 6px 0 0; padding-left: 20px; }

/* The receipt */
.receipt-row { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.receipt { flex: 1 1 340px; max-width: 460px; background: var(--surface); border: 1px dashed var(--line); border-radius: 6px; padding: 20px 20px 16px; font-family: var(--font-data); font-size: 14px; display: flex; flex-direction: column; gap: 6px;
  -webkit-mask: radial-gradient(circle 6px at 50% 0, transparent 98%, #000) 0 0 / 16px 100% repeat-x; mask: radial-gradient(circle 6px at 50% 0, transparent 98%, #000) 0 0 / 16px 100% repeat-x; }
.r-head { display: flex; justify-content: space-between; font-weight: 600; font-size: 15px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.r-sec { margin-top: 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.r-line { display: flex; align-items: baseline; gap: 6px; }
.r-line > span:first-child { font-family: var(--font-body); }
.r-line .dots { flex: 1; border-bottom: 1px dotted var(--line); transform: translateY(-4px); min-width: 12px; }
.r-total { font-weight: 600; padding-top: 4px; border-top: 1px solid var(--line-soft); }
.r-total > span:first-child { font-weight: 600; }
.r-foot { margin-top: 12px; padding-top: 8px; border-top: 1px dashed var(--line); text-align: center; font-size: 12px; color: var(--muted); }
.r-big { flex: 1 1 260px; display: flex; flex-direction: column; gap: 8px; padding: 20px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--accent-soft-line); }
.r-big .lbl { font-weight: 600; }
.r-big .num { font-size: clamp(28px, 5vw, 40px); color: var(--accent); line-height: 1.1; }
.r-big.warn { background: var(--loss-soft); border-color: var(--loss-soft-line); }
.r-big.warn .num { color: var(--loss); font-size: 24px; }

/* Share card dialog */
.card-dialog { position: fixed; inset: 0; z-index: 40; background: rgba(8, 17, 15, .6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.card-box { background: var(--surface); color: var(--ink); border-radius: 16px; padding: 20px; width: min(440px, 100%); max-height: calc(100vh - 32px); overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-box img { width: 100%; height: auto; border-radius: 10px; display: block; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Guided tour */
.tour-focus { outline: 3px solid var(--accent-bright) !important; outline-offset: 6px; border-radius: 12px; scroll-margin: 120px; }
.tour-box { position: fixed; z-index: 30; left: 50%; bottom: max(16px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: min(460px, calc(100% - 32px)); background: var(--band); color: var(--band-ink); border-radius: 14px; padding: 18px 18px 14px; box-shadow: 0 12px 40px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 8px; }
.tour-box h2 { font-size: 19px; }
.tour-box .small { color: var(--band-muted); }
.tour-box .btn.ghost { color: var(--band-ink); border-color: var(--band-line); }
.tour-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.tour-offer { position: fixed; z-index: 25; left: 16px; bottom: max(16px, env(safe-area-inset-bottom, 0px)); max-width: min(520px, calc(100% - 100px)); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--band); color: var(--band-ink); box-shadow: 0 8px 30px rgba(0,0,0,.3); font-size: 15px; }
.tour-offer span { flex: 1 1 200px; }

/* Compare */
.cmp-pick { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.cmp-field { flex: 1 1 240px; display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 15px; }
.cmp-input { position: relative; }
.cmp-input input { width: 100%; height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 0 14px; font: inherit; font-size: 16px; }
.cmp-field.a label::before, .cmp-legend .a::before { content: ""; display: inline-block; width: 18px; height: 4px; border-radius: 2px; background: var(--accent); margin-right: 8px; vertical-align: middle; }
.cmp-field.b label::before, .cmp-legend .b::before { content: ""; display: inline-block; width: 18px; height: 0; border-top: 4px dashed var(--series-b); margin-right: 8px; vertical-align: middle; }
.cmp-vs { font-weight: 700; color: var(--muted); padding-bottom: 12px; }
.cmp-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; font-weight: 600; }
.cmp-prices { display: flex; flex-wrap: wrap; gap: 12px 24px; font-size: 14px; font-weight: 600; }
.cmp-prices label { display: flex; align-items: center; gap: 8px; }
.cmp-prices .price-row { display: inline-flex; align-items: center; gap: 4px; }
.cmp-prices input { width: 120px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 0 10px; font-family: var(--font-data); font-size: 15px; }
.cmp-rows { display: flex; flex-direction: column; }
.cmp-row { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.cmp-lbl { flex: 1 1 200px; display: flex; flex-direction: column; gap: 2px; }
.cmp-bars { flex: 2 1 300px; display: flex; flex-direction: column; gap: 6px; }
.cmp-bar { display: flex; align-items: center; gap: 10px; }
.cmp-bar .track { flex: 1; height: 14px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.cmp-bar .track span { display: block; height: 100%; border-radius: 4px; background: var(--accent-bar); }
.cmp-bar.b .track span { background: repeating-linear-gradient(90deg, var(--series-b) 0 10px, transparent 10px 13px); }
.cmp-bar.neg .track span { background: var(--loss-bar); }
.cmp-bar .num { width: 96px; text-align: right; font-size: 14px; }
.cmp-say { max-width: 66ch; color: var(--ink-2); }
.cmp-prices .price-row span { font-size: 15px; }
.cmp-prices .price-row input { width: 120px; height: 40px; font-size: 15px; background: var(--surface); }

/* Portfolio: combined story and email settings */
.summary-band .story { font-size: clamp(17px, 2.2vw, 20px); line-height: 1.45; max-width: 62ch; }
.summary-band .story strong { font-family: var(--font-data); }
.summary-band .story .pos { color: var(--accent-bright); }
.summary-band .story .neg { color: var(--loss-on-band); }
.alerts { display: flex; flex-direction: column; gap: 14px; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.check > span { display: flex; flex-direction: column; gap: 2px; }
.check input:disabled + span { opacity: .6; }

/* Clubs page */
.glossary { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 8px 20px; margin: 0; }
.glossary dt { font-weight: 600; }
.glossary dd { margin: 0; color: var(--ink-2); }
@media (max-width: 520px) { .glossary { grid-template-columns: 1fr; } .glossary dd { margin-bottom: 8px; } }
.worksheet { border: 1px dashed var(--line); border-radius: 12px; padding: 20px; margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.ws-lines { display: flex; flex-direction: column; gap: 14px; font-family: var(--font-data); font-size: 15px; overflow-wrap: anywhere; }
@media print {
  body.print-worksheet .top, body.print-worksheet .site-foot, body.print-worksheet .ask-fab, body.print-worksheet .noprint { display: none !important; }
  body.print-worksheet .prose > *:not(.worksheet) { display: none !important; }
  body.print-worksheet .worksheet { border: 0; }
  body.print-worksheet { background: #fff; color: #000; }
}

/* Home: more ways to use Slice */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.feature { display: flex; flex-direction: column; gap: 6px; padding: 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.feature:hover { border-color: var(--accent); }
.feature strong { font-size: 18px; font-family: var(--font-display); }
.feature > span:last-child { color: var(--ink-2); font-size: 15px; }
.cmp-bar.b.neg .track span { background: repeating-linear-gradient(90deg, var(--loss-bar) 0 10px, transparent 10px 13px); }
/* Phones: keep the header to two rows by letting the menu scroll sideways. */
@media (max-width: 600px) {
  .nav { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; gap: 2px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 0 10px; white-space: nowrap; flex: none; }
  .tagline { display: none; }
  .cmp-vs { display: none; }
}
.onetime { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--loss-soft); border: 1px solid var(--loss-soft-line); font-size: 14px; line-height: 1.45; }


/* ---- Simplified company page ---- */
main.wrap { gap: 24px; padding-block: 24px 56px; }
.panel { padding: clamp(18px, 3vw, 28px); gap: 16px; }
.panel-head { gap: 6px; }
.panel-head h2 { font-size: clamp(20px, 2.6vw, 26px); }
.hero { gap: 20px 32px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.08; }
.about-text { color: var(--ink-2); font-size: 17px; max-width: 60ch; }
.say-big { font-size: 18px; line-height: 1.4; }
.say-big strong { color: var(--accent); }
.say-small { font-size: 14px; color: var(--muted); }
.receipt-row { gap: 20px 28px; }
.r-side { flex: 1 1 260px; display: flex; flex-direction: column; gap: 10px; }
.r-side > p { color: var(--ink-2); font-size: 15px; }
.r-big { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--accent-soft-line); }
.r-big .lbl { font-weight: 600; font-size: 14px; }
.r-big .num { font-size: clamp(32px, 5vw, 44px); color: var(--accent); line-height: 1.05; }
.r-big .num.small-num { font-size: 24px; }
.r-note { font-size: 14px; color: var(--muted); border-left: 3px solid var(--accent-soft-line); padding-left: 10px; }
.r-cash { font-size: 15px; background: var(--accent-soft, rgba(244,183,64,.14)); border-radius: 10px; padding: 10px 12px; margin: 10px 0 0; }
.chart-say { font-size: 15px; color: var(--ink-2); }
.chart-say strong { color: var(--ink); }
.lesson { font-size: 15px; color: var(--ink-2); padding: 10px 12px; border-radius: 10px; background: var(--line-soft); }
details.more { gap: 0; }
details.more summary { cursor: pointer; font-weight: 600; font-size: 16px; list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "＋"; color: var(--muted); font-weight: 400; }
details.more[open] summary::after { content: "－"; }
.more-body { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; }
.more-body h3 { font-size: 15px; margin-top: 8px; }
.more-body ul { margin: 0; padding-left: 18px; }
.fineprint { font-size: 13px; color: var(--muted); text-align: center; }
#page { display: flex; flex-direction: column; gap: 20px; }
.receipt-row { align-items: flex-start; }
.r-big { flex: none; }
.chart-wrap svg { max-height: 300px; }
@media (max-width: 600px) { .legend { grid-template-columns: 1fr 1fr; } }

/* Book value bar: how much of the price is backed by what the company owns */
.bv-box { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.bv-head { font-weight: 600; font-size: 17px; margin-bottom: 10px; }
.bv-bar { height: 22px; border-radius: 6px; border: 2px solid var(--accent-bar); background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(233,168,37,.18) 6px 12px); overflow: hidden; }
.bv-bar span { display: block; height: 100%; background: var(--accent-bar); }
.bv-key { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; margin: 8px 0 4px; }
.bv-key i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.bv-key .k-own { background: var(--accent-bar); }
.bv-key .k-rest { border: 2px solid var(--accent-bar); background: rgba(233,168,37,.18); }

/* Company name stands on its own at the top of a stock page */
.co-id { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.ticker-badge { font-family: var(--font-data); font-weight: 600; font-size: 15px; letter-spacing: .04em; background: var(--btn-bg); color: var(--btn-ink); border-radius: 6px; padding: 3px 9px; }
.hero h1.co-name { font-size: clamp(38px, 7vw, 68px); line-height: 1.02; letter-spacing: -0.025em; margin-block: 12px 6px; overflow-wrap: anywhere; }
.co-sub { font-size: 18px; color: var(--muted); margin: 0 0 12px; }

/* Home page example: company name as its own headline */
.slice-card .ex-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 14px 20px; }
.slice-card .ex-name { font-family: var(--font-display); font-weight: 700; font-size: clamp(40px, 6vw, 56px); line-height: 1; letter-spacing: -0.025em; color: var(--band-ink); margin-top: 10px; }
.slice-card .ex-sub { color: var(--band-muted); font-size: 16px; margin-top: 6px; }
.slice-card .ex-price { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.slice-card .ex-price .lbl { color: var(--band-muted); font-size: 14px; }
.slice-card .ex-price .small { color: var(--band-muted); }
.slice-card .ex-say { color: var(--band-ink); font-size: 18px; }
.slice-card .ex-say .num { color: var(--accent-bright); }
@media (max-width: 420px) { .slice-card .ex-price { align-items: flex-start; text-align: left; } }
.co-name .tick, .ex-name .tick { font-weight: 500; color: var(--muted); font-size: 0.55em; letter-spacing: 0; white-space: nowrap; }
.ex-name .tick { color: var(--band-muted); }
.slice-card .num.neg { color: var(--loss-on-band); }
.ledger .num, .receipt .num { white-space: nowrap; }
.desc { color: var(--muted); font-weight: 400; font-size: .9em; } .slice-card .desc { color: var(--band-muted); }

/* Sources: a quiet note at the bottom of a stock page */
.sources { border-top: 1px solid var(--line); padding-top: 16px; font-size: 14px; color: var(--muted); }
.sources h2 { font-size: 15px; color: var(--ink-2); margin-bottom: 6px; }
.sources p { margin: 0 0 6px; }
.sources a { color: var(--accent); }

/* Stock pages: #page's sections sit directly in main so the TradingView price
   widget (outside #page, never re-drawn) can sit right under the company name. */
main.wrap:has(> #page) { gap: 20px; }
main.wrap > #page { display: contents; }
main.wrap > #page > * { order: 4; }
main.wrap > #page > .hero { order: 1; }
main.wrap > #page > .price-sec { order: 3; }
.tv-slot { order: 2; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px 10px; }
.tv-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin-bottom: 4px; }
.tv-slot .tradingview-widget-copyright { margin-top: 2px; }
.tv-slot .tradingview-widget-copyright a { color: var(--muted); }

.price-sec .pricebox { width: 100%; max-width: 560px; }
