/* Design tokens: warm-neutral surfaces, one blue accent, fixed status colours (always paired with an icon + label). */
:root {
  --page: #f9f9f7; --surface: #fcfcfb; --raise: #f3f3ef; --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11, 11, 11, .10);
  --accent: #2a78d6; --accent-ink: #ffffff; --accent-wash: rgba(42, 120, 214, .10); --accent-soft: #cde2fb;
  --good: #0ca30c; --good-text: #006300; --warn: #fab219; --warn-text: #8a5d00; --serious: #ec835a; --crit: #d03b3b;
  --good-wash: rgba(12, 163, 12, .10); --warn-wash: rgba(250, 178, 25, .16); --crit-wash: rgba(208, 59, 59, .10);
  --radius: 14px; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --page: #0d0d0d; --surface: #1a1a19; --raise: #222220; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, .10);
  --accent: #3987e5; --accent-ink: #06121f; --accent-wash: rgba(57, 135, 229, .16); --accent-soft: #184f95;
  --good-text: #0ca30c; --warn-text: #fab219; --good-wash: rgba(12, 163, 12, .16); --warn-wash: rgba(250, 178, 25, .14); --crit-wash: rgba(208, 59, 59, .18);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
h2 { font-size: 14px; font-weight: 650; }
.muted { color: var(--muted); } .ink2 { color: var(--ink-2); } .num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
a { color: var(--accent); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); }
.topbar .in { max-width: 1240px; margin: 0 auto; padding: 0 28px; height: 58px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand i { width: 22px; height: 22px; border-radius: 7px; background: var(--accent); position: relative; display: inline-block; }
.brand i::after { content: ""; position: absolute; inset: 6px; border-radius: 3px; background: var(--surface); opacity: .92; }
.tabs { display: flex; gap: 2px; height: 100%; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs a { display: flex; align-items: center; padding: 0 14px; color: var(--ink-2); text-decoration: none; font-weight: 550; position: relative; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); }
.tabs a.on::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.right { display: flex; align-items: center; gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.run .dot { background: var(--good); box-shadow: 0 0 0 3px var(--good-wash); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px transparent; } }
.iconbtn { border: 1px solid var(--border); background: var(--surface); border-radius: 9px; height: 32px; padding: 0 11px; cursor: pointer; font-weight: 550; color: var(--ink-2); }
.iconbtn:hover { color: var(--ink); background: var(--raise); }

/* page */
main { max-width: 1240px; margin: 0 auto; padding: 30px 28px 80px; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.head p { color: var(--ink-2); margin-top: 4px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; min-width: 0; }
.card > .ch { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card > .ch .sub { color: var(--muted); font-size: 12.5px; }
.sect { margin-top: 16px; }

/* hero + tiles */
.hero { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.6fr); gap: 16px; }
.hero .big { font-size: 56px; line-height: 1.05; font-weight: 650; letter-spacing: -.03em; margin: 8px 0 6px; }
.hero .label { color: var(--ink-2); font-weight: 550; }
.tile .label { color: var(--ink-2); font-size: 13px; font-weight: 550; }
.tile .value { font-size: 30px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; }
.tile .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; min-height: 18px; }
.tile .sub b { color: var(--ink-2); font-weight: 600; }

/* charts */
.chart { position: relative; height: 64px; margin-top: 10px; cursor: crosshair; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .area { fill: var(--accent); opacity: .10; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .base { stroke: var(--grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .cross { stroke: var(--axis); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0; }
.chart:hover .cross { opacity: 1; }
.chart .end { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.chart .hv { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; opacity: 0; }
.chart:hover .hv { opacity: 1; }
#tip { position: fixed; z-index: 30; pointer-events: none; background: var(--ink); color: var(--page); padding: 6px 10px; border-radius: 8px; font-size: 12.5px; opacity: 0; transition: opacity .08s; white-space: nowrap; }
#tip.on { opacity: 1; }
.minis { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px 22px; }
.mini .top { display: flex; justify-content: space-between; align-items: baseline; }
.mini .top b { font-size: 18px; letter-spacing: -.01em; }

/* funnel + bars (<= 24px, 4px rounded data end, square at the baseline) */
.frow { display: grid; grid-template-columns: 210px 1fr 86px; gap: 14px; align-items: center; padding: 7px 0; }
.frow .name { color: var(--ink-2); }
.frow .name small { display: block; color: var(--muted); font-size: 12px; }
.frow .track { height: 12px; border-left: 1px solid var(--axis); }
.frow .fill { height: 12px; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.frow .fill.alt { background: var(--accent-soft); }
.frow .v { text-align: right; font-weight: 600; }
.stack { display: flex; gap: 2px; height: 10px; }
.stack > span { display: block; height: 100%; border-radius: 3px; min-width: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; color: var(--ink-2); font-size: 12.5px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.c-done { background: var(--accent); } .c-run { background: var(--good); } .c-wait { background: var(--axis); } .c-fail { background: var(--crit); } .c-soft { background: var(--accent-soft); }

/* tables, badges */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 550; color: var(--muted); font-size: 12px; padding: 6px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--grid); }
tr:last-child td { border-bottom: 0; }
th.r, td.r { text-align: right; }
.tablewrap { overflow-x: auto; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.status svg { width: 14px; height: 14px; flex: none; }
.status.good { color: var(--good-text); } .status.warn { color: var(--warn-text); } .status.bad { color: var(--crit); } .status.off { color: var(--muted); }
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; background: var(--raise); color: var(--ink-2); font-size: 12px; font-weight: 600; }
.badge.good { background: var(--good-wash); color: var(--good-text); } .badge.warn { background: var(--warn-wash); color: var(--warn-text); } .badge.bad { background: var(--crit-wash); color: var(--crit); }

/* controls */
.btn { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 9px 16px; cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--raise); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.go { background: var(--good); border-color: var(--good); color: #fff; } .btn.stop { color: var(--crit); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: progress; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sb { justify-content: space-between; }
textarea, input[type=text], input[type=number], input[type=password] { width: 100%; border: 1px solid var(--border); background: var(--raise); border-radius: 10px; padding: 9px 12px; outline: none; }
textarea { min-height: 150px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; }
textarea:focus, input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
input.short { width: 120px; }
.field { margin-bottom: 16px; } .field > label, .lbl { display: block; font-weight: 600; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.pair { display: flex; align-items: center; gap: 8px; } .pair span { color: var(--muted); }
.seg { display: inline-flex; background: var(--raise); border: 1px solid var(--border); border-radius: 10px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 13px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--border); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 3px 11px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.chip:hover, .chip.on { color: var(--accent); border-color: var(--accent); background: var(--accent-wash); }
.switch { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--grid); cursor: pointer; }
.switch:first-of-type { border-top: 0; }
.switch input { position: absolute; opacity: 0; }
.switch .tg { flex: none; width: 36px; height: 20px; border-radius: 999px; background: var(--axis); position: relative; transition: .15s; margin-top: 1px; }
.switch .tg::after { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked + .tg { background: var(--accent); } .switch input:checked + .tg::after { left: 18px; }
.switch input:focus-visible + .tg { box-shadow: 0 0 0 3px var(--accent-wash); }
.switch b { display: block; font-weight: 600; } .switch small { color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; } .kv dt { color: var(--ink-2); } .kv dd { margin: 0; text-align: right; font-weight: 600; }
.note { padding: 11px 14px; border-radius: 10px; background: var(--raise); color: var(--ink-2); display: flex; gap: 10px; align-items: flex-start; }
.note.warn { background: var(--warn-wash); color: var(--ink); } .note.bad { background: var(--crit-wash); color: var(--ink); } .note.good { background: var(--good-wash); }
.note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.report { margin-top: 12px; display: grid; gap: 6px; }
.report .line { padding: 8px 12px; border-radius: 9px; background: var(--raise); font-size: 13px; }
.report .line.bad { background: var(--crit-wash); } .report .line.warn { background: var(--warn-wash); }
.sum { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.sum .s { background: var(--raise); border-radius: 10px; padding: 6px 12px; } .sum .s b { font-size: 17px; margin-right: 6px; }
.sum .s.good b { color: var(--good-text); } .sum .s.bad b { color: var(--crit); } .sum .s.warn b { color: var(--warn-text); }
.pv { position: sticky; top: 76px; }
.pv .n { font-size: 34px; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; }
.pv .step { padding: 12px 0; border-top: 1px solid var(--grid); } .pv .step:first-of-type { border-top: 0; }
.empty { color: var(--muted); padding: 22px 6px; text-align: center; }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: var(--page); padding: 10px 16px; border-radius: 10px; opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none; max-width: 440px; z-index: 40; }
.toast.show { opacity: 1; transform: none; } .toast.bad { background: var(--crit); color: #fff; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 28px; }
details.adv summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; padding: 30px; }
.login .brand { margin-bottom: 20px; font-size: 17px; }
.login .err { color: var(--crit); min-height: 20px; margin-top: 10px; font-size: 13px; }

@media (max-width: 900px) {
  .topbar .in { padding: 0 14px; gap: 12px; } main { padding: 20px 14px 60px; }
  .hero { grid-template-columns: 1fr; } .g2 { grid-template-columns: 1fr; } .hero .big { font-size: 44px; }
  .frow { grid-template-columns: 120px 1fr 64px; gap: 10px; } .pv { position: static; }
  .brand span { display: none; } .pill .t { display: none; }
}
