:root {
  --bg: #0e1116; --panel: #161b22; --panel2: #1c232d; --line: #2a323d; --text: #e6edf3; --muted: #8b98a8;
  --yes: #3fb950; --no: #f0883e; --bad: #f85149; --accent: #58a6ff; --warn: #d29922; --radius: 14px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f4f6f9; --panel: #fff; --panel2: #eef2f7; --line: #d6dde6; --text: #14202e; --muted: #5b6b7d; --yes: #1a7f37; --no: #bc4c00; --bad: #cf222e; --accent: #0969da; --warn: #9a6700; color-scheme: light; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding-bottom: 60px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; position: sticky; top: 0; background: var(--bg); z-index: 5; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 1.15rem; }
.brand .sub { color: var(--muted); font-weight: 400; font-size: .75rem; margin-left: 6px; }
.logo { color: var(--warn); }
.top-right { display: flex; gap: 8px; align-items: center; }
.pill { font-size: .75rem; padding: 4px 10px; border-radius: 99px; background: var(--panel2); color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--yes); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); }
button { font: inherit; color: inherit; cursor: pointer; }
button.icon { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px; font-size: 1.1rem; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px; scrollbar-width: none; }
.tabs button { background: transparent; border: 1px solid var(--line); border-radius: 99px; padding: 8px 14px; white-space: nowrap; color: var(--muted); }
.tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.banner { margin: 8px 16px; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--bad) 18%, var(--panel)); border: 1px solid var(--bad); }
main { padding: 0 16px; max-width: 980px; margin: 0 auto; }
.panel[hidden], .banner[hidden] { display: none; }
h2 { font-size: 1.05rem; margin: 20px 0 8px; }
.muted { color: var(--muted); } .small { font-size: .8rem; }
.empty { padding: 40px 12px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); margin-top: 12px; }

/* recommendation cards */
.cards { display: grid; gap: 12px; margin-top: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .cards { grid-template-columns: 1fr 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; position: relative; }
.card.expired { opacity: .45; filter: grayscale(1); }
.card .head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card .city { font-weight: 700; font-size: 1.1rem; }
.card .when { color: var(--muted); font-size: .85rem; }
.card .bracket { font-size: 1.05rem; color: var(--muted); }
.card .bracket b { color: var(--text); }
.side { font-size: 2.2rem; font-weight: 800; letter-spacing: .02em; line-height: 1; }
.side.YES { color: var(--yes); } .side.NO { color: var(--no); }
.buyrow { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.maxp { font-size: 1.25rem; font-weight: 700; }
.grid4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 420px) { .grid4 { grid-template-columns: repeat(4, 1fr); } }
.kv { background: var(--panel2); border-radius: 10px; padding: 8px 10px; }
.kv .k { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
.kv .v { font-weight: 650; font-size: 1.02rem; }
.bar { height: 8px; background: var(--panel2); border-radius: 99px; position: relative; overflow: hidden; }
.bar > i { position: absolute; top: 0; bottom: 0; left: 0; background: var(--accent); opacity: .85; }
.bar > u { position: absolute; top: -2px; bottom: -2px; width: 3px; background: var(--warn); text-decoration: none; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; }
.countdown.low { color: var(--warn); } .countdown.gone { color: var(--bad); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
a.btn, button.primary, button.ghost { display: inline-block; text-decoration: none; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); font-weight: 600; text-align: center; }
a.btn.main, button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* tiles + tables */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.tile .k { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.tile .v { font-size: 1.5rem; font-weight: 750; }
.pos { color: var(--yes); } .neg { color: var(--bad); }
.tablewrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.chartbox { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-top: 12px; height: 260px; position: relative; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.seg button { background: transparent; border: 0; padding: 6px 14px; color: var(--muted); }
.seg button.active { background: var(--accent); color: #fff; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot.ok { background: var(--yes); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
dl.nest { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
dl.nest dt { color: var(--muted); } dl.nest dd { margin: 0; }
/* dialog */
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); width: min(520px, calc(100vw - 32px)); padding: 18px; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog label { display: block; margin: 12px 0; font-weight: 600; }
dialog input { width: 100%; margin-top: 6px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
dialog small { color: var(--muted); font-weight: 400; }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 12px 0 0; }
.hint { color: var(--muted); font-size: .8rem; }
footer { text-align: center; color: var(--muted); font-size: .75rem; padding: 24px 16px; }

/* v2.1: tiers, advice, manage */
.sect { margin: 22px 0 6px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sect h2 { margin: 0; }
.card.probe { border-style: dashed; border-color: var(--warn); background: color-mix(in srgb, var(--warn) 6%, var(--panel)); }
.ribbon { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.ribbon.core { color: var(--yes); border-color: var(--yes); }
.ribbon.probe { color: var(--warn); border-color: var(--warn); }
.ribbon.real { color: var(--accent); border-color: var(--accent); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.card.expired .maxp { color: var(--bad); }
a.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.advice { font-weight: 800; letter-spacing: .03em; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line); display: inline-block; }
.advice.TAKE_PROFIT { color: #fff; background: var(--yes); border-color: var(--yes); }
.advice.CUT { color: #fff; background: var(--bad); border-color: var(--bad); }
.advice.ADD { color: #fff; background: var(--accent); border-color: var(--accent); }
.advice.HOLD { color: var(--muted); }
.reasons { margin: 4px 0 0; padding-left: 18px; font-size: .82rem; color: var(--muted); }
.sellat { font-size: 1.05rem; }
.sellat b { font-size: 1.2rem; }
.note { font-size: .82rem; color: var(--muted); margin: 6px 0; }
details { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin-top: 10px; }
details > summary { cursor: pointer; font-weight: 600; }
.cards.greyed { opacity: .5; filter: grayscale(1); }

/* v2.2: pause bar, live re-quote chip, "I took this", admin */
.pausebar { margin: 8px 16px; padding: 18px 16px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 22%, var(--panel)); border: 2px solid var(--warn); text-align: center; display: grid; gap: 8px; justify-items: center; }
.pausebar[hidden] { display: none; }
.pausebar .big { font-size: 2rem; font-weight: 800; letter-spacing: .1em; color: var(--warn); }
.chip { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--muted); font-size: .9rem; font-weight: 600; }
.chip.ok { color: var(--yes); border-color: var(--yes); } .chip.warn { color: var(--warn); border-color: var(--warn); } .chip.bad { color: var(--bad); border-color: var(--bad); }
.chip .age { font-weight: 400; font-size: .75rem; color: var(--muted); }
.took { display: grid; gap: 8px; grid-template-columns: 1fr 1fr auto; align-items: end; }
.took label { font-size: .75rem; color: var(--muted); display: grid; gap: 4px; }
.took input { padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; width: 100%; }
.took-msg { font-size: .8rem; color: var(--muted); }
button.mini { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); font-weight: 600; }

/* laptop runner banner (MODE=storage) */
.runnerbar { margin: 8px 16px; padding: 7px 12px; border-radius: 10px; font-size: .9rem; border: 1px solid var(--yes); background: color-mix(in srgb, var(--yes) 12%, var(--panel)); }
.runnerbar.bad { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 18%, var(--panel)); font-weight: 600; }
.runnerbar[hidden] { display: none; }
