:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6e69;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --accent: #2a78d6;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --s7: #4a3aa7;
  --lab: #c2185b;
  --up: #e34948;
  --down: #008300;
  --div-pos: #e34948;
  --div-neg: #008300;
  --div-mid: #f0efec;
  --vol: rgba(137, 135, 129, 0.35);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft JhengHei", "PingFang TC", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #242422;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #9a9890;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #3987e5;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
  --s7: #9085e9;
    --lab: #ec6aa0;
    --up: #e66767;
    --down: #0ca30c;
    --div-pos: #e66767;
    --div-neg: #0ca30c;
    --div-mid: #383835;
    --vol: rgba(137, 135, 129, 0.3);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #242422;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #9a9890;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #3987e5;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --s5: #d55181;
  --s7: #9085e9;
  --lab: #ec6aa0;
  --up: #e66767;
  --down: #0ca30c;
  --div-pos: #e66767;
  --div-neg: #0ca30c;
  --div-mid: #383835;
  --vol: rgba(137, 135, 129, 0.3);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-right: auto; }
.brand h1 { font-size: 18px; margin: 0; }

.tabs { display: flex; gap: 4px; }
.tabs a {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
}
.tabs a:hover { background: var(--surface-2); }
.tabs a[aria-current="page"] { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 16px;
}
.icon-btn:hover { background: var(--surface-2); }

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

h2 { font-size: 17px; margin: 28px 0 6px; }
.muted { color: var(--muted); font-size: 13px; }
.note { color: var(--ink-2); font-size: 13px; margin: 0 0 10px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.field.grow { flex: 1 1 200px; }
.field-row { display: inline-flex; align-items: center; gap: 6px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); padding-bottom: 6px; }

input, select {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  min-height: 34px;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button {
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  padding: 6px 12px;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--grid); }
table.data th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--surface); }
table.data th[data-sort] { cursor: pointer; }
table.data th[data-sort]:hover { color: var(--ink); }
table.data th.sorted::after { content: " ▾"; }
table.data th.sorted.asc::after { content: " ▴"; }
table.data td:first-child, table.data th:first-child { text-align: left; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.baseline td { color: var(--ink-2); }
table.data tbody tr:hover { background: var(--surface-2); }

.name-cell { display: inline-flex; align-items: center; gap: 8px; }
.swatch { display: inline-block; width: 18px; height: 0; border-top: 3px solid currentColor; flex: none; }
.swatch-svg { display: inline-block; width: 20px; height: 6px; flex: none; vertical-align: middle; }
.swatch.dash { border-top-style: dashed; }
.swatch.dot { border-top-style: dotted; }
.family { color: var(--muted); font-size: 12px; }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
tr.focus .link-btn { font-weight: 700; }
.pos, table.data td.pos { color: var(--up); }
.neg, table.data td.neg { color: var(--down); }

table.heat { border-collapse: separate; border-spacing: 2px; font-size: 12px; font-variant-numeric: tabular-nums; }
table.heat th { font-weight: 500; color: var(--muted); padding: 4px 6px; white-space: nowrap; position: sticky; background: var(--surface); }
table.heat thead th { top: 0; z-index: 2; vertical-align: bottom; max-width: 92px; white-space: normal; line-height: 1.25; }
table.heat tbody th { left: 0; z-index: 1; text-align: left; }
table.heat td { min-width: 58px; padding: 5px 6px; text-align: right; border-radius: 4px; cursor: pointer; color: var(--ink); }
table.heat td.ref { background: transparent; color: var(--ink-2); cursor: default; }
table.heat td.na { color: var(--muted); cursor: default; background: transparent; }
table.heat td:not(.ref):not(.na):hover { outline: 2px solid var(--ink); }
.heat-wrap { max-height: 70vh; }
#cvMetric { margin: 4px 0 10px; }
table.heat.cv td { min-width: 64px; }
table.heat.cv tbody th { white-space: normal; min-width: 180px; max-width: 260px; }
table.heat.cv tr.cv-row th { padding-left: 22px; font-weight: 400; }
table.heat.cv tr.cv-row th::before { content: "↳ "; color: var(--muted); }
table.heat.cv td.tally { background: transparent; color: var(--ink); cursor: default; font-weight: 600; }
table.heat.cv td.tally:hover { outline: none; }
table.heat.cv thead .link-btn { color: var(--muted); font-weight: 500; text-decoration: underline dotted; }

.callout { margin-top: 16px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; font-size: 14px; color: var(--ink-2); }
.callout strong { color: var(--ink); margin-right: 6px; }
.callout-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.legend-ramp { display: inline-flex; align-items: center; gap: 6px; margin: 0 6px; }
.ramp { display: inline-block; width: 90px; height: 10px; border-radius: 4px; background: linear-gradient(90deg, var(--div-neg), var(--div-mid), var(--div-pos)); }

.stock-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.stock-head h2 { margin: 0; font-size: 20px; }

.panel { margin-top: 12px; padding: 8px 8px 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.chart { width: 100%; }
.chart-price { height: 360px; }
.chart-ind { height: 120px; }
.chart-eq { height: 300px; }
.pane-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); padding: 4px 4px 2px; min-height: 24px; font-variant-numeric: tabular-nums; }
.pane-legend b { color: var(--ink); font-weight: 600; }
.ma-legend { gap: 6px; }
.ma-tog {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 2px 10px;
  font: inherit;
  font-size: 12px;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}
.ma-tog b { font-variant-numeric: tabular-nums; }
.ma-tog[aria-pressed="false"] { opacity: 0.45; }
.ma-tog[aria-pressed="false"] .swatch { border-top-style: dotted; }
.pane-legend .item { display: inline-flex; align-items: center; gap: 6px; }

.trades { margin-top: 16px; }

/* signals */
.filters.slim { padding: 8px 12px; margin: 6px 0 8px; align-items: center; }
.act { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid currentColor; white-space: nowrap; }
.act.buy { color: var(--up); background: color-mix(in oklab, var(--up) 10%, transparent); }
.act.sell { color: var(--down); background: color-mix(in oklab, var(--down) 10%, transparent); }
.act.hold { color: var(--muted); }
.counts { font-size: 13px; font-weight: 400; margin-left: 8px; }
.badge { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.buy { color: var(--up); background: color-mix(in oklab, var(--up) 12%, transparent); }
.badge.sell { color: var(--down); background: color-mix(in oklab, var(--down) 12%, transparent); }
.warn { color: var(--s4); font-size: 12px; }
table.data.sig td, table.data.sig th { vertical-align: top; text-align: left; }
table.data td.wrap { white-space: normal; min-width: 180px; text-align: left; }
table.data tr[data-href] { cursor: pointer; }
table.data tr.dim td { opacity: 0.5; }
.pick { position: relative; }
.pick summary { cursor: pointer; font-size: 13px; color: var(--ink-2); padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; min-height: 34px; display: flex; align-items: center; }
.pick-list { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; width: min(520px, calc(100vw - 48px)); max-height: 60vh; overflow: auto; padding: 8px 12px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); }
.pick-list fieldset { border: 0; padding: 0; margin: 10px 0 0; display: grid; gap: 2px; }
.pick-list legend { font-size: 12px; color: var(--muted); padding: 0; }
.pick-list .check { padding-bottom: 0; }
.macro { padding: 10px 12px; margin: 10px 0 12px; }
.macro-items { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.macro-item { display: flex; flex-direction: column; min-width: 96px; }
.macro-item b { font-size: 18px; font-variant-numeric: tabular-nums; }
.macro-item.stress.on b { color: var(--s4); }
.macro .note { margin: 8px 0 4px; }
.chart-fx { height: 160px; }
.sig-panel { margin-top: 12px; }
.table-wrap.flat { border: 0; border-radius: 0; background: transparent; }
/* low-point ranking: fits the page width (no sideways scrolling); rows become cards on narrow screens */
.table-wrap.fit { overflow-x: visible; }
table.data.low td { white-space: normal; vertical-align: middle; text-align: left; }
table.data.low th { text-align: left; white-space: normal; }
table.data.low .c-rank { width: 28px; color: var(--muted); }
table.data.low .c-name { min-width: 150px; }
table.data.low .c-spark { width: 248px; padding: 4px 6px; }
table.data.low .c-score { min-width: 140px; font-size: 12px; }
table.data.low .c-hist, table.data.low .c-rule { font-size: 12px; line-height: 1.45; min-width: 120px; }
.tags { margin-top: 3px; }
.score { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.score b { font-size: 16px; min-width: 26px; font-variant-numeric: tabular-nums; }
.bar { flex: 1; height: 8px; min-width: 50px; max-width: 110px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.tag { display: inline-block; margin: 1px 4px 1px 0; padding: 0 6px; border-radius: 4px; font-size: 11px; white-space: nowrap; color: var(--ink-2); background: var(--surface-2); }
.tag.hot { color: #fff; background: var(--up); font-weight: 600; }
.tag.turn { color: var(--up); background: color-mix(in oklab, var(--up) 12%, transparent); }
.tag.hot-sell { color: #fff; background: var(--down); font-weight: 600; }
.tag.turn-sell { color: var(--down); background: color-mix(in oklab, var(--down) 12%, transparent); }
.tag.warn-tag { color: var(--s4); background: color-mix(in oklab, var(--s4) 14%, transparent); }
.bar.high i { background: var(--s2); }
.seg { flex-wrap: wrap; }
svg.spark { display: block; overflow: visible; }
svg.spark .sp-line { fill: none; stroke: var(--ink-2); stroke-width: 1.4; }
svg.spark .sp-area { fill: var(--ink-2); opacity: 0.08; }
svg.spark .sp-last { fill: var(--ink); }
svg.spark circle.sp-hi, svg.spark text.sp-hi { fill: var(--up); }
svg.spark circle.sp-lo, svg.spark text.sp-lo { fill: var(--down); }
svg.spark .sp-t { font-size: 9.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
svg.spark text.sp-hi, svg.spark text.sp-lo { font-weight: 600; }
svg.spark .sp-guide { stroke: var(--axis); stroke-dasharray: 2 2; stroke-width: 0.8; }
svg.spark .sp-zero { stroke: var(--axis); stroke-width: 0.8; }
svg.spark .sp-k { fill: none; stroke: var(--s1); stroke-width: 1.2; }
svg.spark .sp-d { fill: none; stroke: var(--s2); stroke-width: 1.2; }
svg.spark .sp-up { fill: var(--up); opacity: 0.75; }
svg.spark .sp-dn { fill: var(--down); opacity: 0.75; }
svg.spark .sp-hit { fill: transparent; }
.sp-frame { fill: none; stroke: var(--border); stroke-width: 1; }
.sp-div { stroke: var(--grid); stroke-width: 1; }
.sp-t.sp-lab { font-size: 8.5px; letter-spacing: 0.02em; }
.low-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.low-title { margin: 14px 0 4px; }
.low-filters { gap: 8px 14px; }
.low-filters select { min-height: 32px; padding: 4px 6px; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { font: inherit; font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--ink-2); cursor: pointer; }
.chip-btn:hover { background: var(--surface-2); }
.chip-btn b { color: var(--ink); }
.kind { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; margin-left: 4px; }
/* blind trading replay */
.lb-panel { padding: 10px 12px 12px; }
.lb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.lb-actions .btn { min-width: 110px; justify-content: center; font-size: 15px; min-height: 42px; }
.btn.lb-buy { border-color: var(--up); color: var(--up); }
.btn.lb-sell { border-color: var(--down); color: var(--down); }
.btn.lb-buy:hover { background: color-mix(in oklab, var(--up) 12%, transparent); }
.btn.lb-sell:hover { background: color-mix(in oklab, var(--down) 12%, transparent); }
kbd { font: inherit; font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; margin-left: 6px; }
.lb-result { margin-top: 10px; }
.lb-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 6px 0 2px; }
.lb-tools .btn { min-height: 30px; padding: 3px 10px; font-size: 12px; }
.lb-wrap { position: relative; }
.lb-price { height: 320px; }
.lb-ind { height: 110px; }
.lb-future { position: absolute; top: 0; bottom: 26px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: color-mix(in oklab, var(--surface-2) 75%, transparent); border-left: 2px dashed var(--axis); pointer-events: none; color: var(--muted); z-index: 5; }
.lb-future b { font-size: 34px; font-weight: 500; }
.lb-future small { font-size: 12px; }
@media (max-width: 640px) { .lb-price { height: 260px; } .lb-ind { height: 96px; } }
table.data.bands th, table.data.bands td { white-space: normal; }
@media (max-width: 900px) {
  table.data.low thead { display: none; }
  table.data.low, table.data.low tbody { display: block; }
  table.data.low tr { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-areas: "rank name score" "spark spark spark" "hist hist rule";
    gap: 6px 10px; padding: 12px 8px; border-bottom: 1px solid var(--grid); }
  table.data.low td { border: 0; padding: 0; min-width: 0; }
  table.data.low .c-rank { grid-area: rank; width: auto; }
  table.data.low .c-name { grid-area: name; min-width: 0; }
  table.data.low .c-score { grid-area: score; min-width: 0; text-align: right; }
  table.data.low .c-score .score { justify-content: flex-end; }
  table.data.low .c-spark { grid-area: spark; width: auto; padding: 0; }
  table.data.low .c-hist { grid-area: hist; min-width: 0; }
  table.data.low .c-rule { grid-area: rule; min-width: 0; text-align: right; }
  svg.spark { width: 100%; height: auto; max-width: 300px; }
  table.data.low tbody tr:hover { background: transparent; }
}
@media (max-width: 480px) {
  table.data.low tr { grid-template-areas: "rank name name" "rank score score" "spark spark spark" "hist hist hist" "rule rule rule"; }
  table.data.low .c-score, table.data.low .c-rule { text-align: left; }
  table.data.low .c-score .score { justify-content: flex-start; }
  table.data.bands { font-size: 12px; }
  table.data.bands th, table.data.bands td { padding: 6px 5px; }
}

/* rule lab */
.lab-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 12px; }
.lab-side { padding: 10px 12px 12px; }
.lab-side h3 { margin: 0 0 8px; font-size: 15px; }
.lab-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.cond-list { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 6px; }
.cond-list li { display: flex; gap: 6px; align-items: center; }
.cond-list select { flex: 1 1 auto; min-width: 0; }
.cond-list input[type="number"] { width: 76px; }
.lab-risk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.lab-risk-grid input { width: 100%; }
.lab-desc { line-height: 1.6; }
.or-sep { margin: 10px 0 6px; font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; border-top: 1px dashed var(--border); }
.btn.subtle { margin-top: 8px; font-size: 12px; color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: progress; }
.lb-actions .btn:disabled { opacity: 0.35; cursor: not-allowed; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-top: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.kpi .muted { display: block; }
.kpi b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.kpi .ref { display: block; color: var(--muted); font-size: 12px; }
table.data tr.clickable { cursor: pointer; }
textarea.digest { width: 100%; font: inherit; font-size: 13px; color: var(--ink); background: var(--page); border: 1px solid var(--border); border-radius: 8px; padding: 8px; margin-top: 8px; }
.trades summary { cursor: pointer; font-weight: 600; padding: 6px 0; }

.strat-family { margin-top: 24px; }
.strat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-top: 10px; }
.strat-card h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.strat-card code.id { font-size: 12px; color: var(--muted); font-weight: 400; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn {
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--page);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn:hover { background: var(--surface-2); }
pre.code { margin: 10px 0 0; padding: 12px; background: var(--page); border: 1px solid var(--border); border-radius: 8px; overflow: auto; max-height: 480px; font-size: 12px; line-height: 1.45; }

.md { font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.md h1, .md h2, .md h3 { font-size: 16px; margin: 16px 0 6px; }
.md table { border-collapse: collapse; font-size: 13px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--grid); padding: 4px 8px; }
.md code { background: var(--surface-2); padding: 1px 4px; border-radius: 4px; font-size: 12px; }
.md pre code { display: block; padding: 10px; overflow-x: auto; }
.md a { color: var(--accent); }

dialog { width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 0; }
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.dlg-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.dlg-head h2 { margin: 0; }
#docBody { padding: 4px 16px 16px; }

.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15); max-width: 260px; }

footer { max-width: 1280px; margin: 24px auto 0; padding: 16px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }

@media (max-width: 640px) {
  .top { position: static; gap: 8px; }
  table.data .family { display: none; }
  .brand .muted { display: none; }
  .chart-price { height: 280px; }
  .chart-eq { height: 240px; }
  .tabs a { padding: 6px 8px; }
  h2 { margin-top: 22px; }
  .pick { width: 100%; }
  .pick-list { position: static; width: auto; max-height: none; box-shadow: none; margin-top: 6px; }
  .macro-item { min-width: 80px; }
  .macro-item b { font-size: 16px; }
}
