/* Placeholder visual direction: neutral, to be replaced by the owner's design. */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1c1c1a;
  --muted: #6d6b64;
  --line: #e2e0d8;
  --accent: #2f4d8c;
  /* Chart colours follow the owner's FAST Graphs reference. */
  --fv: #f08a24;
  --fv-fill: #4f9a5e;
  --div-fill: #8fe28a;
  --np: #2f6fe0;
  --price: #111111;
  --est-fade: rgba(255, 255, 255, 0.38);
  --flag: #fff1d6;
  --pos: #22744a;
  --neg: #b3392f;
  --est: rgba(28, 28, 26, 0.035);
  --radius: 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141413; --surface: #1d1d1b; --ink: #ecebe6; --muted: #9b9990; --line: #33322e;
    --accent: #8fa8e0; --fv: #f39a3e; --fv-fill: #3f7f4d; --div-fill: #6fbf6a;
    --np: #5b93ff; --price: #f2f2ee; --est-fade: rgba(0, 0, 0, 0.3); --flag: #3a3020; --pos: #6cc495; --neg: #ef8277; --est: rgba(255, 255, 255, 0.04);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; }
main { max-width: 1180px; margin: 0 auto; padding: 0 16px 48px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
code { font-size: 12px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 2; }
.brand { font-weight: 700; letter-spacing: -0.01em; }
select, input, button { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.ticker-pick select { max-width: 34vw; }
.search { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.search input { width: 100%; padding: 7px 10px; }
.search ul { position: absolute; top: calc(100% + 4px); left: 0; right: 0; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 5; }
.search li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.search li b { min-width: 52px; }
.search li span { flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search li.active { background: var(--bg); }
.search li.empty { color: var(--muted); cursor: default; }
.pending { max-width: 1180px; margin: 10px auto 0; padding: 10px 14px; border-radius: 10px; background: var(--flag); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.pending[hidden] { display: none; }
.pending.error { background: var(--neg); color: #fff; }
.pending button { padding: 3px 10px; }

.hero { display: flex; justify-content: space-between; align-items: end; gap: 16px; padding: 20px 0 12px; }
.hero h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.price { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; }
.stats span { color: var(--muted); font-size: 12px; }
.stats b { font-size: 18px; font-variant-numeric: tabular-nums; }

.controls { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 8px; }
.controls label { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.controls select { color: var(--ink); }
.window { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.presets { display: flex; gap: 4px; }
.presets button { padding: 5px 9px; cursor: pointer; }
.presets button:hover { border-color: var(--accent); }
.check input { margin: 0; }
.status { color: var(--muted); min-height: 18px; }

.chart-wrap { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 8px 4px; }
#chart { width: 100%; height: clamp(300px, 52vh, 520px); display: block; touch-action: pan-y; user-select: none; }
.grid line { stroke: var(--line); stroke-width: 1; }
.grid .vgrid { stroke-dasharray: 2 4; }
.axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.axis.est { font-style: italic; }
.est-region { fill: var(--est-fade); pointer-events: none; }
.band-fv { fill: var(--fv-fill); }
.band-div { fill: var(--div-fill); }
.line-fv { fill: none; stroke: var(--fv); stroke-width: 2.4; }
.line-np { fill: none; stroke: var(--np); stroke-width: 2; }
.dot-np { fill: var(--np); }
.dashed { stroke-dasharray: 5 4; }
.dot-fv { fill: #fff; stroke: #222; stroke-width: 1.1; stroke-linejoin: round; }
.dot-fv.filled { stroke-dasharray: 1.5 1.5; }
.dot-fv.override { fill: #d43cc8; }
.line-price { fill: none; stroke: var(--price); stroke-width: 1.5; stroke-linejoin: round; }
.cursor { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.selection { fill: var(--accent); opacity: 0.12; pointer-events: none; }
.tooltip { position: absolute; top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; min-width: 190px; box-shadow: 0 4px 16px rgba(0,0,0,.08); pointer-events: none; }
.tooltip div { display: flex; justify-content: space-between; gap: 12px; }
.tooltip .tip-head { font-weight: 600; margin-bottom: 2px; }
.tooltip b { font-variant-numeric: tabular-nums; font-weight: 600; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 4px; padding: 0; font-size: 12px; }
.legend i { display: inline-block; width: 14px; height: 10px; margin-right: 6px; vertical-align: -1px; border-radius: 2px; }
.k-price { border-top: 2px solid var(--price); height: 0 !important; }
.k-fv { background: var(--fv-fill); border-top: 3px solid var(--fv); }
.k-div { background: var(--div-fill); }
.k-np { border-top: 2px solid var(--np); height: 0 !important; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-top: 12px; }
.grid2 .card { margin-top: 0; }
.card h2 { font-size: 15px; margin: 0 0 8px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.inline { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.inline input { width: 64px; }

.kv-table { width: 100%; border-collapse: collapse; }
.kv-table th { text-align: left; font-weight: 400; color: var(--muted); padding: 5px 0; }
.kv-table td { text-align: right; font-variant-numeric: tabular-nums; padding: 5px 0; }
.kv-table tr + tr { border-top: 1px solid var(--line); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.form-row label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.form-row input { width: 100px; }
.kv { display: flex; justify-content: space-between; padding: 5px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.kv span { color: var(--muted); }
.kv.big b { font-size: 18px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.table-scroll { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 6px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.data th { font-weight: 500; color: var(--muted); font-size: 12px; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data td.sel { font-weight: 600; }
table.data tr.flag td { background: var(--flag); }
table.data tr.est td { font-style: italic; }
.pill { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 99px; background: var(--np); color: #fff; font-style: normal; font-weight: 500; vertical-align: 1px; }
.pill.soft { background: var(--line); color: var(--muted); }

@media (max-width: 760px) {
  .brand { display: none; }
  .pending { margin: 10px 16px 0; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 18px; }
  .price { font-size: 20px; }
}
