/* Dividend Tracker — styles. Every colour is a token; light and dark are each
   chosen (series steps validated per surface), not an automatic flip. */
:root {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --raised: #f1f0ec;
  --raised-2: #e8e7e1;
  --line: #e1e0d9;
  --line-strong: #c3c2b7;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #6e6c66;
  --axis: #898781;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --accent-soft: rgba(42, 120, 214, .10);
  --good: #006300;
  --bad: #b02a2a;
  --warn-bg: #fff6e0;
  --warn-line: #f0d48a;
  --warn-ink: #5c4300;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --money-in: #898781;
  --topbar: rgba(249, 249, 247, .88);
  --shadow: 0 10px 30px -12px rgba(11, 11, 11, .18);
  --ring: rgba(11, 11, 11, .10);
  --radius: 14px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --page: #0d0d0d; --surface: #1a1a19; --raised: #232321; --raised-2: #2c2c2a; --line: #2c2c2a; --line-strong: #383835;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #a09e96; --axis: #898781;
  --accent: #3987e5; --accent-ink: #ffffff; --accent-soft: rgba(57, 135, 229, .16);
  --good: #0ca30c; --bad: #e66767; --warn-bg: #2a2310; --warn-line: #5c4a14; --warn-ink: #f2d58a;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --money-in: #898781; --topbar: rgba(13, 13, 13, .86); --shadow: 0 10px 30px -12px rgba(0, 0, 0, .7); --ring: rgba(255, 255, 255, .10);
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --page: #0d0d0d; --surface: #1a1a19; --raised: #232321; --raised-2: #2c2c2a; --line: #2c2c2a; --line-strong: #383835;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #a09e96; --axis: #898781;
  --accent: #3987e5; --accent-ink: #ffffff; --accent-soft: rgba(57, 135, 229, .16);
  --good: #0ca30c; --bad: #e66767; --warn-bg: #2a2310; --warn-line: #5c4a14; --warn-ink: #f2d58a;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --money-in: #898781; --topbar: rgba(13, 13, 13, .86); --shadow: 0 10px 30px -12px rgba(0, 0, 0, .7); --ring: rgba(255, 255, 255, .10);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.num, table, .axis text { font-variant-numeric: tabular-nums; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── top bar ── */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--topbar); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 14px; padding: 10px 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; margin-right: auto; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.brand small { font-weight: 500; color: var(--muted); margin-left: 2px; }
.tbtn { width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--text-2); }
.tbtn:hover { color: var(--text); border-color: var(--line-strong); }
.back { color: var(--muted); font-size: 13.5px; text-decoration: none; white-space: nowrap; }
.back:hover { color: var(--text); }
@media (max-width: 520px) { .brand small { display: none; } }

main { max-width: 1180px; margin: 0 auto; padding: 0 16px 80px; }

/* ── hero ── */
.hero { padding: 36px 0 18px; }
.eyebrow { font-family: var(--mono); font-size: 12px; color: var(--accent); letter-spacing: .04em; text-transform: uppercase; margin: 0 0 10px; }
.hero h1 { font-size: clamp(28px, 5vw, 46px); line-height: 1.06; letter-spacing: -.03em; margin: 0 0 12px; font-weight: 750; max-width: 20ch; }
.hero p { color: var(--text-2); font-size: 16.5px; max-width: 64ch; margin: 0; }

/* ── form ── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) repeat(3, minmax(0, 1fr)); gap: 14px 16px; align-items: start; }
.form-grid .wide { grid-column: 1 / -1; }
@media (max-width: 900px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .tick-field { grid-column: 1 / -1; } }
@media (max-width: 520px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.field label, .field .label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 0 0 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.input { width: 100%; background: var(--page); border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 11px; font-size: 15px; min-width: 0; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-pre { position: relative; }
.input-pre span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.input-pre .input { padding-left: 26px; }
.input-pre.suffix span { left: auto; right: 11px; }
.input-pre.suffix .input { padding-left: 11px; padding-right: 28px; }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ticker token box */
.tickbox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--page); border: 1px solid var(--line-strong); border-radius: 10px; padding: 5px 6px; min-height: 42px; position: relative; cursor: text; }
.tickbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tok { display: inline-flex; align-items: center; gap: 6px; background: var(--raised); border-radius: 999px; padding: 3px 4px 3px 9px; font-weight: 650; font-size: 13.5px; }
.tok i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.tok button { border: 0; background: transparent; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; color: var(--muted); display: grid; place-items: center; padding: 0; }
.tok button:hover { background: var(--raised-2); color: var(--text); }
.tickbox input { border: 0; outline: none; background: transparent; flex: 1 1 120px; min-width: 90px; padding: 5px 4px; font-size: 15px; text-transform: uppercase; }
.tickbox input::placeholder { text-transform: none; color: var(--muted); }
.suggest { position: absolute; left: -1px; right: -1px; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); z-index: 30; padding: 4px; margin: 0; list-style: none; max-height: 300px; overflow: auto; }
.suggest li { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--raised); }
.suggest b { font-weight: 700; min-width: 64px; }
.suggest span { color: var(--text-2); font-size: 13.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest em { font-style: normal; color: var(--muted); font-size: 12px; white-space: nowrap; }
.suggest .empty { color: var(--muted); cursor: default; }
.suggest .empty:hover { background: transparent; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-strong); background: transparent; border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.chip:hover { color: var(--text); border-color: var(--axis); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--page); border-color: var(--text); }
.row-chips { margin-top: 7px; }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

.btn { border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 650; cursor: pointer; background: var(--accent); color: var(--accent-ink); }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.btn.ghost { background: transparent; color: var(--text-2); border: 1px solid var(--line-strong); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.status { font-size: 13px; color: var(--muted); }
.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ── notices ── */
.notices { display: grid; gap: 8px; margin: 14px 0 0; }
.notice { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); border-radius: 10px; padding: 9px 12px; font-size: 13.5px; }
.notice.err { background: transparent; border-color: var(--bad); color: var(--text); }

/* ── results ── */
.results { margin-top: 22px; transition: opacity .15s; }
.results.busy { opacity: .55; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.card-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.card-head b { font-size: 16px; }
.card-head span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-num { font-size: 30px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; margin: 8px 0 2px; }
.sub { color: var(--text-2); font-size: 13.5px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; margin: 12px 0 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.bonus { margin-top: 10px; padding: 8px 10px; border-radius: 9px; background: var(--raised); font-size: 13px; color: var(--text-2); }
.bonus strong { color: var(--text); }

.section { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.section-head h2 { font-size: 17px; letter-spacing: -.01em; margin: 0; }
.section-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.seg { display: inline-flex; background: var(--raised); border-radius: 999px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px var(--ring); }
.toggles { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.toggles label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-2); margin: 0 0 8px; padding: 0; list-style: none; }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.legend svg { flex: none; }

/* chart */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.grid line { stroke: var(--line); stroke-width: 1; }
.axis text { fill: var(--axis); font-size: 11px; }
.axis .base { stroke: var(--line-strong); stroke-width: 1; }
.series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.series.dim { stroke-dasharray: 5 4; stroke-width: 1.6; opacity: .9; }
.series.money { stroke: var(--money-in); stroke-width: 1.4; }
.endlabel { font-size: 11.5px; font-weight: 650; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.cross { stroke: var(--axis); stroke-width: 1; }
.dot { stroke: var(--surface); stroke-width: 2; }
.bar { transition: opacity .1s; }
.bars:hover .bar { opacity: .55; }
.bars .bar:hover, .bars .bar.on { opacity: 1; }
.tip { position: absolute; pointer-events: none; z-index: 20; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); padding: 9px 11px; font-size: 12.5px; min-width: 180px; max-width: 280px; }
.tip h4 { margin: 0 0 6px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.tip table { width: 100%; border-collapse: collapse; }
.tip td { padding: 1px 0; }
.tip td:last-child { text-align: right; font-weight: 650; padding-left: 12px; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.chart-note { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
table.data th { text-align: right; font-size: 12px; font-weight: 600; color: var(--muted); padding: 7px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
table.data td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data tr.partial td { color: var(--muted); }
table.data tbody tr:hover td { background: var(--raised); }
.scroll-y { max-height: 520px; overflow-y: auto; }
.flag { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; margin-left: 6px; border: 1px solid currentColor; }
.flag.cut, .flag.suspended { color: var(--bad); }
.flag.special { color: var(--text-2); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--raised); border-radius: 10px; padding: 10px 12px; }
.stat span { display: block; font-size: 12px; color: var(--muted); }
.stat b { font-size: 18px; letter-spacing: -.01em; }

/* empty state + method */
.empty-state { text-align: center; padding: 46px 16px; color: var(--text-2); }
.empty-state h2 { margin: 0 0 6px; font-size: 19px; color: var(--text); }
details.method { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
details.method summary { cursor: pointer; font-weight: 650; }
details.method ul { margin: 10px 0 0; padding-left: 20px; color: var(--text-2); font-size: 14px; }
details.method li { margin: 5px 0; }
.foot { margin-top: 28px; color: var(--muted); font-size: 12.5px; }

@media (forced-colors: active) {
  .series { stroke: CanvasText; }
  .card::before { background: CanvasText; }
}
