:root {
  --bg: #f6f5f2; --panel: #ffffff; --ink: #1b1b1a; --muted: #6b6a66; --line: #e4e2dc;
  --accent: #1f5eff; --accent-ink: #fff; --soft: #f0efea;
  --fire: #c62828; --red: #d84315; --orange: #ef6c00; --blue: #1565c0; --green: #2e7d32; --gray: #757575;
  --ok-bg: #e8f5e9; --ok-ink: #1b5e20; --warn-bg: #fff8e1; --warn-ink: #8d6e00; --err-bg: #fdecea; --err-ink: #b71c1c;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131312; --panel: #1c1c1b; --ink: #ecebe7; --muted: #a09e98; --line: #2e2d2b; --soft: #252523;
    --accent: #6d95ff; --fire: #ff6b6b; --red: #ff8a65; --orange: #ffb74d; --blue: #64b5f6; --green: #81c784; --gray: #9e9e9e;
    --ok-bg: #1d2e1f; --ok-ink: #a5d6a7; --warn-bg: #2f2a14; --warn-ink: #ffe082; --err-bg: #3a1c1a; --err-ink: #ef9a9a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* nav */
.top { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .wrap { display: flex; align-items: center; gap: 18px; height: 56px; }
.brand { font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand svg { width: 22px; height: 22px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.nav a.on, .nav a:hover { color: var(--ink); background: var(--soft); text-decoration: none; }
.badge-demo { background: var(--warn-bg); color: var(--warn-ink); font-size: 12px; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }

main { padding: 24px 0 64px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

/* panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 24px; }
.stat span { color: var(--muted); font-size: 13px; }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .grid2, .grid3 { grid-template-columns: 1fr; } .stats { grid-template-columns: 1fr 1fr; }
  .top .wrap { gap: 10px; } .brand span.word { display: none; } .badge-demo { font-size: 11px; } .panel { padding: 14px; } h1 { font-size: 22px; } }
.nowrap { white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 5px; background: var(--accent); }
.legend i.med { background: var(--muted); }
.chart .line2 { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--soft); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err-ink); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* flash */
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }
.flash.ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash.warn { background: var(--warn-bg); color: var(--warn-ink); }
.flash.error { background: var(--err-bg); color: var(--err-ink); }
.errors { background: var(--err-bg); color: var(--err-ink); padding: 10px 14px 10px 32px; border-radius: 10px; }

/* watch cards */
.watch { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; }
.watch + .watch { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.watch .name { font-weight: 600; font-size: 16px; }
.watch .price { text-align: right; }
.watch .price b { font-size: 20px; }
.paused { opacity: .55; }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); }
.pill.err { background: var(--err-bg); color: var(--err-ink); }

/* tiers */
.tier { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; border: 1px solid currentColor; white-space: nowrap; }
.t-fire { color: var(--fire); } .t-red { color: var(--red); } .t-orange { color: var(--orange); }
.t-blue { color: var(--blue); } .t-green { color: var(--green); } .t-gray { color: var(--gray); }
.score { font-variant-numeric: tabular-nums; font-weight: 700; }

/* deal cards */
.deal { border: 1px solid var(--line); border-left-width: 5px; border-radius: 10px; padding: 14px 16px; background: var(--panel); margin-bottom: 12px; }
.deal.b-fire { border-left-color: var(--fire); } .deal.b-red { border-left-color: var(--red); } .deal.b-orange { border-left-color: var(--orange); }
.deal.b-blue { border-left-color: var(--blue); } .deal.b-green { border-left-color: var(--green); } .deal.b-gray { border-left-color: var(--gray); }
.deal .route { font-size: 20px; font-weight: 700; margin: 4px 0 2px; }
.deal .route .amt { float: right; }
.deal .facts { color: var(--muted); font-size: 14px; }
.deal .facts b { color: var(--ink); font-weight: 600; }
.deal .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }

/* date grid */
.dgrid td, .dgrid th { text-align: center; padding: 6px 4px; font-size: 13px; border: 1px solid var(--line); }
.dgrid th { text-transform: none; letter-spacing: 0; }
.dgrid td.na { background: repeating-linear-gradient(45deg, transparent 0 4px, var(--soft) 4px 8px); color: transparent; }
.dgrid td.best { outline: 2px solid var(--green); outline-offset: -2px; font-weight: 700; }

/* chart */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .typical { stroke: var(--muted); stroke-dasharray: 5 4; }
.chart .typical-label { fill: var(--muted); font-size: 11px; }
.chart .dot { fill: var(--green); }
.chart .dot-label { fill: var(--green); font-size: 12px; font-weight: 700; }

/* forms */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }
input[type=text], input[type=number], input[type=date], input[type=password], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field { margin-bottom: 14px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: 18px; height: 18px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg label { margin: 0; padding: 7px 14px; cursor: pointer; font-weight: 500; }
.seg input { display: none; }
.seg input:checked + span { color: var(--accent); font-weight: 700; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 4px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; }
.timeline { font-size: 13px; color: var(--muted); background: var(--soft); border-radius: 8px; padding: 10px 12px; margin: 4px 0 14px; }
.examples button { font-size: 13px; }
.understood li { margin: 2px 0; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.login { max-width: 360px; margin: 12vh auto; }
code { background: var(--soft); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
