:root {
  color-scheme: dark;
  --page: #161b29;
  --head: #0e111a;
  --panel: #161b29;
  --surface: #161b29;
  --line: #262d40;
  --ink: #f2f4f8;
  --ink2: #c9ceda;
  --muted: #8a93a8;
  --accent: #f7a600;
  --grid: #222838;
  --axis: #2f3750;
  --up: #2ec27e;
  --down: #f0555a;
  --s1: #3987e5; --s2: #f7a600; --s3: #199e70; --s4: #d55181; --s5: #9085e9; --s6: #5b6275;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.dim { color: var(--muted); }
.small { font-size: 12px; }
.up { color: var(--up) !important; } .down { color: var(--down) !important; }
sup { font-size: 9px; }

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 20px; height: 58px; padding: 0 20px; background: var(--head); position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: 0.08em; text-decoration: none; }
.logo .dim { color: var(--accent); }
.mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--accent); color: #111522; font-size: 16px; font-weight: 900; letter-spacing: 0; }
nav { margin-left: auto; display: flex; align-items: center; gap: 22px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
nav a { text-decoration: none; color: var(--muted); }
nav a:hover { color: var(--ink); }
nav .cur { color: var(--accent); font-weight: 700; }
.demo { background: var(--warning); color: #0b0b0b; text-align: center; font-size: 13px; font-weight: 600; padding: 6px 16px; }

/* ---------- top grid ---------- */
.topgrid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; border-bottom: 1px solid var(--line); }
.main { min-width: 0; border-right: 1px solid var(--line); }
.strip { display: grid; grid-template-columns: 250px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.pricebox { padding: 16px 20px; border-right: 1px solid var(--line); }
.plabel { color: var(--accent); font-size: 15px; letter-spacing: 0.02em; }
.price { font-size: 40px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.pchg { font-size: 16px; font-variant-numeric: tabular-nums; }
.stripstats { margin: 0; padding: 14px 20px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; row-gap: 4px; align-content: center; }
.stripstats div { display: flex; justify-content: space-between; gap: 12px; }
.stripstats dt { color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 13px; }
.stripstats dd { margin: 0; font-variant-numeric: tabular-nums; font-size: 15px; }

.tfbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.tf { display: flex; gap: 4px; flex-wrap: wrap; }
.tf button, .logbtn { font: inherit; font-size: 14px; letter-spacing: 0.06em; color: var(--muted); background: none; border: 0; padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.tf button:hover, .logbtn:hover { color: var(--ink); }
.tf button.on { background: var(--accent); color: #111522; font-weight: 700; }
.logbtn[aria-pressed="true"] { color: var(--accent); font-weight: 700; }

.chart { position: relative; height: 220px; }
.chart.tall { height: 440px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 14px; text-align: center; padding: 0 20px; }
.histnote { color: var(--muted); font-size: 12px; padding: 0 16px 10px; min-height: 10px; }
.tip { position: absolute; pointer-events: none; background: var(--head); border: 1px solid var(--line); box-shadow: 0 4px 16px rgba(0,0,0,.4); border-radius: 6px; padding: 6px 10px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -115%); }
.tip b { display: block; font-size: 14px; }

/* ---------- sidebar ---------- */
.side { min-width: 0; }
.sidebox { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sidebox:last-child { border-bottom: 0; }
h2 { color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; font-size: 17px; font-weight: 600; margin: 0 0 14px; }
.meter-status { font-size: 14px; color: var(--ink2); margin-bottom: 14px; }
.meter-status b { color: var(--ink); }
.badge { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; font-weight: 600; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.meter { position: relative; height: 10px; background: var(--grid); border-radius: 5px; margin: 18px 0 14px; }
.meter-fill { height: 100%; border-radius: 5px; width: 0; transition: width .4s; }
.meter-mark { position: absolute; left: 51%; top: -6px; bottom: -6px; width: 2px; background: var(--critical); }
.meter-mark span { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--critical); font-weight: 700; }
.stack { display: flex; gap: 2px; height: 22px; margin-bottom: 10px; }
.stack div { height: 100%; min-width: 2px; }
.stack div:first-child { border-radius: 4px 0 0 4px; }
.stack div:last-child { border-radius: 0 4px 4px 0; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink2); }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 7px; vertical-align: 0; }
.blocklist { list-style: none; margin: 0; padding: 0; }
.blocklist li { display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; font-variant-numeric: tabular-nums; }
.blocklist li:last-child { border-bottom: 0; }
.blocklist .h { color: var(--accent); }
.blocklist .t { color: var(--muted); font-size: 13px; }

/* ---------- stats grid ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sec { padding: 22px 20px 24px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.sec:nth-child(3n) { border-right: 0; }
.rows { margin: 0; }
.rows div { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rows div:last-child { border-bottom: 0; }
.rows dt { color: var(--ink2); font-size: 16px; }
.rows dd { margin: 0; font-size: 16px; font-variant-numeric: tabular-nums; text-align: right; }
.note { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.big { font-size: 28px; font-weight: 700; }
.bar { height: 6px; background: var(--grid); border-radius: 3px; margin: 12px 0 6px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 6px; border-bottom: 1px solid var(--axis); }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 8px; }
.form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.form label:first-child { grid-column: 1 / -1; }
input, select { font: inherit; font-size: 14px; color: var(--ink); background: var(--head); border: 1px solid var(--axis); border-radius: 6px; padding: 7px 9px; width: 100%; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.foot { padding: 20px; font-size: 13px; color: var(--ink2); }
.foot p { margin: 6px 0; }

@keyframes fu { from { color: var(--up); } to { color: var(--ink); } }
@keyframes fd { from { color: var(--down); } to { color: var(--ink); } }
.flash-up { animation: fu 1.2s ease-out; }
.flash-down { animation: fd 1.2s ease-out; }
@media (prefers-reduced-motion: reduce) { .flash-up, .flash-down { animation: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .topgrid { grid-template-columns: minmax(0, 1fr); }
  .main { border-right: 0; }
  .side { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
  .sidebox { border-bottom: 0; border-right: 1px solid var(--line); }
  .sidebox:last-child { border-right: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sec:nth-child(3n) { border-right: 1px solid var(--line); }
  .sec:nth-child(2n) { border-right: 0; }
}
@media (max-width: 720px) {
  .top { padding: 0 16px; }
  nav a { display: none; }
  .strip { grid-template-columns: 1fr; }
  .pricebox { border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 16px; }
  .stripstats { grid-template-columns: 1fr; padding: 12px 16px; }
  .chart.tall { height: 300px; }
  .tfbar { padding: 6px 8px; }
  .tf button, .logbtn { padding: 6px 8px; font-size: 13px; }
  .side { grid-template-columns: 1fr; }
  .sidebox { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .sec { border-right: 0 !important; padding: 18px 16px; }
  .rows dt, .rows dd { font-size: 15px; }
}

/* breakout buttons + modal */
.bo { display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; margin-left: 6px; vertical-align: -3px; background: none; border: 0; color: var(--muted); cursor: pointer; border-radius: 4px; }
.bo svg { width: 15px; height: 15px; }
.bo:hover { color: var(--accent); background: var(--grid); }
.plabel .bo { color: var(--accent); }
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(5,7,12,.72); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { width: min(1100px, 100%); background: var(--page); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal-h { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.modal-h h2 { margin: 0; }
.modal-h .tf { margin-left: auto; }
.modal-x { font: inherit; font-size: 18px; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.modal-x:hover { color: var(--ink); }
.modal-now { font-size: 22px; font-weight: 700; margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.tf button:disabled { opacity: .35; cursor: not-allowed; }
@media (max-width: 720px) { .modal-h .tf { margin-left: 0; } .modal-box { padding: 12px; } }
