:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #f8f9fc;
  --line: #e3e7ef;
  --line-2: #eef1f6;
  --text: #1a2233;
  --muted: #6b7489;
  --side: #0d1830;
  --side-2: #14233f;
  --side-text: #c4cde0;
  --side-strong: #ffffff; --side-muted: #7f8fb1; --side-group: #6c7a99; --side-border: rgba(255,255,255,.06);
  --on-accent: #ffffff;
  --accent: #1f6feb;
  --accent-soft: #e7f0ff;
  --ok: #12804b;   --ok-soft: #e3f5ec;
  --info: #2d64c8; --info-soft: #e6eefc;
  --warn: #a35a00; --warn-soft: #fff1dc;
  --bad: #c0322b;  --bad-soft: #fde8e6;
  --crit: #ffffff; --crit-bg: #9b1c1c;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 18px rgba(16, 24, 40, .06);
  --radius: 10px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120; --panel: #111a2e; --panel-2: #0f1729; --line: #1f2b45; --line-2: #19243b;
    --text: #e4e9f4; --muted: #8b97b0; --side: #070d1a; --side-2: #0f1a31; --side-text: #aeb9d0;
    --accent: #4c8dff; --accent-soft: #15284d;
    --ok: #4cc38a; --ok-soft: #10301f; --info: #7aa7ff; --info-soft: #14254a;
    --warn: #f0b354; --warn-soft: #36270d; --bad: #ff7b72; --bad-soft: #3a1513; --crit-bg: #b42318;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1120; --panel: #111a2e; --panel-2: #0f1729; --line: #1f2b45; --line-2: #19243b;
  --text: #e4e9f4; --muted: #8b97b0; --side: #070d1a; --side-2: #0f1a31; --side-text: #aeb9d0;
  --accent: #4c8dff; --accent-soft: #15284d;
  --ok: #4cc38a; --ok-soft: #10301f; --info: #7aa7ff; --info-soft: #14254a;
  --warn: #f0b354; --warn-soft: #36270d; --bad: #ff7b72; --bad-soft: #3a1513; --crit-bg: #b42318;
  color-scheme: dark;
}

/* ---------- Appearance options (set by theme.js, chosen under the palette button) ---------- */
/* Light theme with a light sidebar */
:root[data-theme="light"][data-side="light"] {
  --side: #ffffff; --side-2: #eef2f8; --side-text: #3b4558;
  --side-strong: #111827; --side-muted: #6b7489; --side-group: #8a93a6; --side-border: var(--line);
}
/* Soft light: warmer paper background, tinted panels */
:root[data-theme="light"][data-tone="soft"] {
  --bg: #f6f4ef; --panel: #fffdf9; --panel-2: #f8f6f1; --line: #e6e1d6; --line-2: #efebe2;
  --text: #24221e; --muted: #736d62;
}
:root[data-theme="light"][data-tone="soft"][data-side="light"] { --side: #fffdf9; --side-2: #f1ede4; --side-text: #3f3a32; --side-strong: #1f1c18; }
/* Accent colours */
:root[data-accent="indigo"] { --accent: #4f46e5; --accent-soft: #ecebfd; }
:root[data-accent="teal"]   { --accent: #0f7f86; --accent-soft: #ddf3f3; }
:root[data-accent="green"]  { --accent: #138a4a; --accent-soft: #e2f5ea; }
:root[data-accent="orange"] { --accent: #c2560c; --accent-soft: #fdecdf; }
:root[data-accent="rose"]   { --accent: #c42a5a; --accent-soft: #fde6ee; }
:root[data-theme="dark"][data-accent="indigo"] { --accent: #8b85ff; --accent-soft: #221f4d; --on-accent: #0b1120; }
:root[data-theme="dark"][data-accent="teal"]   { --accent: #2bc4c4; --accent-soft: #0d3133; --on-accent: #0b1120; }
:root[data-theme="dark"][data-accent="green"]  { --accent: #3fc77e; --accent-soft: #0f3020; --on-accent: #0b1120; }
:root[data-theme="dark"][data-accent="orange"] { --accent: #ff9a4d; --accent-soft: #3a2210; --on-accent: #0b1120; }
:root[data-theme="dark"][data-accent="rose"]   { --accent: #ff7aa2; --accent-soft: #3d1424; --on-accent: #0b1120; }

/* Appearance dialog */
.theme-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-opt { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 8px; cursor: pointer; display: grid; gap: 6px; font: inherit; color: var(--text); text-align: left; }
.theme-opt.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.theme-opt b { font-size: 12.5px; font-weight: 600; }
.theme-swatch { height: 46px; border-radius: 6px; display: grid; grid-template-columns: 28% 1fr; overflow: hidden; border: 1px solid var(--line); }
.theme-swatch i { display: block; }
.accent-opts { display: flex; gap: 10px; flex-wrap: wrap; }
.accent-opt { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.accent-opt.on { box-shadow: 0 0 0 2px var(--text); }
.theme-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 8px; display: block; }
@media (max-width: 520px) { .theme-opts { grid-template-columns: repeat(2, 1fr); } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }

.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.block { width: 100%; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.iconbtn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.iconbtn:hover { background: rgba(127,127,127,.14); }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; height: 34px; padding: 0 10px; min-width: 0; }
textarea { height: auto; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
input[type=checkbox] { height: 16px; width: 16px; accent-color: var(--accent); }
label { display: grid; gap: 5px; align-content: start; font-weight: 500; font-size: 13px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: radial-gradient(1200px 600px at -10% -10%, #1d3b74 0%, transparent 60%), linear-gradient(160deg, #0b1630, #0d1f43); color: #dfe7f7; padding: 56px; display: flex; flex-direction: column; }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: #fff; }
.login-brand svg { width: 30px; height: 30px; fill: #4c8dff; stroke: none; }
.login-art h1 { font-size: 36px; line-height: 1.15; margin: 80px 0 28px; max-width: 520px; color: #fff; }
.login-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; max-width: 500px; }
.login-points li { padding-left: 26px; position: relative; color: #b9c6e0; }
.login-points li::before { content: ''; position: absolute; left: 0; top: 6px; width: 12px; height: 12px; border-radius: 3px; background: #4c8dff; box-shadow: 0 0 0 4px rgba(76,141,255,.2); }
.login-foot { margin-top: auto; color: #7f8fb1; font-size: 13px; }
.login-panel { display: grid; place-items: center; padding: 32px 16px; }
.login-card { width: min(380px, 100%); display: grid; gap: 14px; }
.login-card h2 { font-size: 24px; }
.login-card p { margin: -6px 0 6px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* Shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-text); border-right: 1px solid var(--side-border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 16px; color: var(--side-strong); }
.brand svg { width: 28px; height: 28px; fill: var(--accent); stroke: none; }
.brand small { display: block; color: var(--side-muted); font-size: 11.5px; }
#nav { padding: 6px 10px; display: grid; gap: 2px; overflow-y: auto; }
#nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--side-group); padding: 14px 10px 6px; }
#nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-text); text-decoration: none; font-weight: 500; }
#nav a:hover { background: var(--side-2); color: var(--side-strong); }
#nav a.active { background: var(--accent); color: var(--on-accent); }
#nav a .count { margin-left: auto; background: #c0322b; color: #fff; border-radius: 10px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.side-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--side-border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me b { display: block; color: var(--side-strong); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; }
.me small { color: var(--side-muted); font-size: 11.5px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.side-actions { display: flex; }

.content { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 20px 28px 8px; }
.topbar h1 { font-size: 22px; }
.topbar p { margin: 2px 0 0; }
.topbar .menu { display: none; }
.live-pill { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 20px; padding: 3px 10px; background: var(--panel); }
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live-pill.on i { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.page { padding: 12px 28px 40px; display: grid; gap: 18px; }

/* Cards & layout */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card h3 { font-size: 14px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h3 .sub { font-weight: 400; color: var(--muted); font-size: 12.5px; margin-left: auto; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi span { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi b { display: block; font-size: 24px; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi.bad b { color: var(--bad); }
.kpi.ok b { color: var(--ok); }
.chart-box { position: relative; height: 260px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .search { flex: 1 1 260px; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: transparent; padding: 0 12px; height: 32px; font: inherit; color: var(--muted); cursor: pointer; font-weight: 500; }
.seg button.on { background: var(--accent-soft); color: var(--accent); }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--panel-2); }
.tbl .chk { width: 36px; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .nowrap { white-space: nowrap; }
.cell-main { font-weight: 500; max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { color: var(--muted); font-size: 12px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; }
.pager .btns { display: flex; gap: 6px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.crit { background: var(--crit-bg); color: var(--crit); }
.badge.muted { background: var(--line-2); color: var(--muted); }
.score { display: inline-block; min-width: 42px; text-align: center; padding: 1px 6px; border-radius: 6px; font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.score.ok { color: var(--ok); background: var(--ok-soft); }
.score.info { color: var(--info); background: var(--info-soft); }
.score.warn { color: var(--warn); background: var(--warn-soft); }
.score.bad { color: var(--bad); background: var(--bad-soft); }

.mini-list { display: grid; gap: 8px; }
.mini-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.mini-row .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-row .bar { flex: 0 0 90px; height: 6px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.mini-row .bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.mini-row b { font-variant-numeric: tabular-nums; min-width: 32px; text-align: right; }

.live-row { display: grid; grid-template-columns: 70px 1fr 64px 110px; gap: 12px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line-2); cursor: pointer; animation: fadein .4s ease; }
.live-row:last-child { border-bottom: 0; }
.live-row:hover { background: var(--panel-2); }
@keyframes fadein { from { background: var(--accent-soft); } to { background: transparent; } }

/* Drawer */
.drawer { position: fixed; inset: 0; z-index: 40; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(8, 14, 28, .45); }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(860px, 100%); background: var(--bg); box-shadow: -10px 0 40px rgba(0,0,0,.25); overflow-y: auto; animation: slidein .2s ease; }
@keyframes slidein { from { transform: translateX(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.dhead { position: sticky; top: 0; z-index: 2; background: var(--panel); border-bottom: 1px solid var(--line); padding: 16px 20px; display: flex; gap: 12px; align-items: flex-start; }
.dhead h2 { font-size: 17px; word-break: break-word; }
.dhead .meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; word-break: break-all; }
.dhead .iconbtn { margin-left: auto; }
.dactions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.dbody { padding: 18px 20px 40px; display: grid; gap: 16px; }
.verdict { display: grid; grid-template-columns: 120px 1fr; gap: 18px; align-items: center; }
.gauge { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.gauge .inner { width: 92px; height: 92px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; text-align: center; }
.gauge .inner b { font-size: 26px; display: block; line-height: 1; }
.gauge .inner small { color: var(--muted); font-size: 11px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--panel-2); padding: 2px 9px; border-radius: 20px; font-size: 12px; }
.chip b { font-weight: 600; }
.chip.ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); color: var(--ok); background: var(--ok-soft); }
.chip.bad { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); color: var(--bad); background: var(--bad-soft); }
.chip.warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); color: var(--warn); background: var(--warn-soft); }
.engine { border-top: 1px solid var(--line-2); padding-top: 10px; margin-top: 10px; }
.engine:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.engine-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.engine-head .sum { margin-left: auto; font-variant-numeric: tabular-nums; }
.brow { display: grid; grid-template-columns: 210px 1fr 54px; gap: 10px; align-items: center; font-size: 12.5px; padding: 3px 0; }
.brow .rname { font-family: var(--mono); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow .rdesc { color: var(--muted); font-size: 12px; }
.brow .rbar { height: 4px; border-radius: 3px; margin-top: 3px; }
.brow .rscore { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.pos { color: var(--bad); } .neg { color: var(--ok); }
.ai-card { border-left: 4px solid var(--accent); }
.ai-card ul { margin: 6px 0 0; padding-left: 18px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs button { border: 0; background: none; padding: 8px 12px; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.preview-frame { width: 100%; height: 480px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
pre.raw { margin: 0; max-height: 480px; overflow: auto; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; white-space: pre-wrap; word-break: break-all; font-family: var(--mono); font-size: 12px; }
.att { display: grid; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.att:last-child { border-bottom: 0; }
.att-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.notice.info { background: var(--info-soft); color: var(--info); }

/* Forms & modal */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(8, 14, 28, .5); display: grid; place-items: center; padding: 16px; }
.mbox { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); padding: 22px; display: grid; gap: 14px; }
.mbox h3 { font-size: 17px; }
.mfoot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 18px; align-items: start; }
.form-grid label.check { grid-column: 1 / -1; }
.form-section h3 { margin-bottom: 4px; }
.form-section > p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.savebar { position: sticky; bottom: 0; display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); }

.health { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.health .card { display: grid; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.ok { background: #22c55e; } .dot.bad { background: #ef4444; }
dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }
code.inline { font-family: var(--mono); font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; }

.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 80; }
.toast { background: #1a2233; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); font-size: 13px; max-width: 360px; animation: slidein .2s ease; }
.toast.bad { background: #9b1c1c; }
.toast.ok { background: #0f6b3f; }

/* Token pages (release / magic link) */
body.plain { background: var(--bg); }
.tokenpage { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.tokencard { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 26px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.tokencard h1 { font-size: 20px; }
.tokencard p { margin: 0; }
.tokencard form { display: grid; gap: 14px; }
.tokencard.wide { width: min(900px, 100%); }
.tokencard > * { min-width: 0; }
.preview-frame { display: block; }
.tokencard .preview-frame { height: 520px; }
.tokencard .att-list { display: grid; gap: 6px; font-size: 13px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.preview-note { font-size: 12px; color: var(--muted); }
.brandmark { font-weight: 700; color: var(--accent); font-size: 13px; letter-spacing: .02em; }

@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .health { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; left: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .topbar .menu { display: inline-grid; }
  .topbar, .page { padding-left: 16px; padding-right: 16px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .health { grid-template-columns: 1fr; }
  .brow { grid-template-columns: 1fr 54px; }
  .brow .rname { grid-column: 1 / -1; }
  .verdict { grid-template-columns: 1fr; justify-items: start; }
  .live-row { grid-template-columns: 1fr 64px; }
  .live-row .lr-time, .live-row .lr-act { display: none; }
  dl.kv { grid-template-columns: 1fr; }
}

/* Retention, scoring, editors */
.ret-row { display: grid; grid-template-columns: 90px 1fr; gap: 8px; }
.kv.compact { grid-template-columns: 80px 1fr; font-size: 13px; gap: 3px 10px; }
.preview-card { display: grid; gap: 12px; }
.preview-card .tabs { margin-bottom: 0; }
.score-input { width: 82px; text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.off td { opacity: .55; }
.tbl td .def { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.weight-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 18px; }
.weight { display: grid; gap: 6px; }
.weight-top { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; }
.weight-top b { font-variant-numeric: tabular-nums; }
input[type=range] { height: auto; padding: 0; border: 0; accent-color: var(--accent); background: transparent; }
.editor { width: 100%; min-height: 360px; line-height: 1.5; tab-size: 4; }
.status-line { font-size: 13px; padding: 8px 12px; border-radius: 8px; white-space: pre-wrap; font-family: var(--mono); font-size: 12px; }
.status-line.ok { background: var(--ok-soft); color: var(--ok); }
.status-line.bad { background: var(--bad-soft); color: var(--bad); }
.status-line.wait { background: var(--info-soft); color: var(--info); }
.subnav { display: flex; gap: 6px; flex-wrap: wrap; }
.dirty-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); margin-left: 6px; }

.progress { height: 8px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 6px; transition: width .4s; }
