/* Votol Dashboard — instrument-cluster styling. Two themes: garage (dark) and daylight. */
:root {
  --digits: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --signal: #f2c14e;          /* signal yellow: accent, marks */
  --fault: #ff5a4e;
  --ok: #4cc38a;
  --info: #5aa9f0;
  /* harness wire colours for data series */
  --w-voltage: #ff6b5e; --w-current: #f2c14e; --w-rpm: #5aa9f0; --w-coeff: #4cc38a; --w-temp: #c08cff;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --nav-h: 64px;
  color-scheme: dark;
}
:root, [data-theme="garage"] {
  --bg: #20262d; --panel: #2a3139; --panel-2: #323a43; --line: #3d4650; --ink: #e8ecef; --ink-2: #a9b4be; --ink-3: #7d8a96;
  --lamp-off: #39424c; --shadow: none;
}
[data-theme="daylight"] {
  color-scheme: light;
  --bg: #eef1f3; --panel: #ffffff; --panel-2: #f5f7f8; --line: #d3d9de; --ink: #0f1720; --ink-2: #3f4b57; --ink-3: #66727e;
  --lamp-off: #dfe4e8; --signal: #e0a800; --fault: #d92d20; --ok: #17804b; --info: #1f6fc0;
  --w-voltage: #d92d20; --w-current: #b98900; --w-rpm: #1f6fc0; --w-coeff: #17804b; --w-temp: #7a44c8;
  --shadow: none;
}
@media (prefers-color-scheme: light) {
  [data-theme="auto"] {
    color-scheme: light;
    --bg: #eef1f3; --panel: #ffffff; --panel-2: #f5f7f8; --line: #d3d9de; --ink: #0f1720; --ink-2: #3f4b57; --ink-3: #66727e;
    --lamp-off: #dfe4e8; --signal: #e0a800; --fault: #d92d20; --ok: #17804b; --info: #1f6fc0;
    --w-voltage: #d92d20; --w-current: #b98900; --w-rpm: #1f6fc0; --w-coeff: #17804b; --w-temp: #7a44c8;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--text); min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
h1, h2, h3 { font-family: var(--digits); font-weight: 650; line-height: 1.2; margin: 0; }
h2 { font-size: 18px; letter-spacing: -.005em; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--info); }
button, select, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.num { font-family: var(--digits); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
[hidden] { display: none !important; }

/* ---------- top bar */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-family: var(--digits); font-weight: 700; font-size: 17px; }
.brand svg { width: 28px; height: 28px; color: var(--signal); }
.conn-chip { display: inline-flex; align-items: center; gap: 9px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-sm); padding: 0 13px 0 11px; min-height: 36px; cursor: pointer; max-width: 62vw; }
.conn-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.led { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); flex: none; }
.conn-chip[data-state="connected"] .led { background: var(--ok); }
.conn-chip[data-state="connecting"] .led { background: var(--signal); animation: pulse 1s infinite; }
.conn-chip[data-state="error"] .led { background: var(--fault); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- navigation: bottom tabs on phones, side rail on wide screens */
.nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--panel); border-top: 1px solid var(--line); }
.nav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-3); text-decoration: none; font-size: 11.5px; }
.nav svg { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"] svg { color: var(--signal); }
.badge { position: absolute; top: 7px; left: 54%; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--fault); color: #fff; font: 700 11px/18px var(--digits); text-align: center; }
main { max-width: 1280px; margin: 0 auto; padding: 16px; }
@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 92px; }
  .nav { top: 0; right: auto; width: 92px; height: auto; grid-template-columns: 1fr; grid-auto-rows: 76px; align-content: start;
    padding: 72px 0 0; border-top: 0; border-right: 1px solid var(--line); }
  .bar { padding-left: 24px; }
  main { padding: 24px; }
}
.view { display: none; }
.view.on { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .view.on, .conn-chip .led { animation: none; } }

/* ---------- live: cluster hero */
.cluster { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 10px 20px; padding: 20px 22px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); }
.cluster .state { font-family: var(--digits); font-weight: 800; font-size: clamp(40px, 9vw, 60px); letter-spacing: -.015em; line-height: 1; }
.state[data-s="RUN"] { color: var(--ok); } .state[data-s="FAULT"] { color: var(--fault); }
.state[data-s="INIT"], .state[data-s="START"], .state[data-s="WAIT"] { color: var(--signal); }
.state[data-s="BRAKE"], .state[data-s="STOP"] { color: var(--info); } .state[data-s="IDLE"], .state[data-s="—"] { color: var(--ink-3); }
.cluster .speed { text-align: right; }
.speed .big { font-family: var(--digits); font-weight: 750; font-size: clamp(40px, 9vw, 60px); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.015em; }
.speed small { display: block; color: var(--ink-3); font-size: 13px; }
.speed small a { color: var(--ink-3); }
.cluster .sub { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; }
.cluster .sub b { color: var(--ink); font-family: var(--digits); font-variant-numeric: tabular-nums; }
.indicators { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.ind { font-size: 12.5px; padding: 3px 8px; border-radius: var(--r-sm); color: var(--ink-3); border: 1px solid var(--line); }
.ind.on { color: #08130d; background: var(--ok); border-color: transparent; }
.ind.on[data-k="brake"], .ind.on[data-k="park"] { background: var(--info); color: #fff; }
.ind.on[data-k="reverse"] { background: var(--signal); color: #1b1300; }

/* ---------- telltale lamps: the one loud element */
.lamps { display: flex; gap: 8px; overflow-x: auto; padding: 14px 2px 4px; scrollbar-width: none; }
.lamps::-webkit-scrollbar { display: none; }
.lamp { flex: none; display: flex; align-items: center; gap: 9px; padding: 8px 12px 8px 10px; border-radius: var(--r-md); background: var(--panel); border: 1px solid var(--line); color: var(--ink-3); font-size: 13.5px; white-space: nowrap; }
.lamp > i { width: 4px; height: 16px; border-radius: 2px; background: var(--lamp-off); flex: none; }
.lamp.on { color: #fff; background: var(--fault); border-color: transparent; font-weight: 600; }
.lamp.on > i { background: #fff; }
.lamps.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); overflow: visible; }
.lamps.grid .lamp { white-space: normal; align-items: flex-start; padding: 12px; }
.lamps.grid .lamp i { margin-top: 3px; }
.lamp .lt { display: flex; flex-direction: column; gap: 2px; }
.lamp .lt b { color: var(--ink); font-weight: 600; } .lamp.on .lt b { color: #fff; }
.lamp .lt small { font-size: 12.5px; line-height: 1.35; } .lamp.on .lt small { color: #ffe9e7; }

/* ---------- readouts */
.readouts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
@media (min-width: 700px) { .readouts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ro { padding: 12px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.ro label { display: flex; justify-content: space-between; align-items: center; color: var(--ink-3); font-size: 13px; }
.ro .v { font-family: var(--digits); font-weight: 650; font-size: 28px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ro .v small { font-size: 14px; color: var(--ink-3); margin-left: 3px; font-weight: 500; }
.ro .s { color: var(--ink-2); font-size: 12.5px; line-height: 1.35; }
.conf { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.c-unknown { background: var(--ink-3); } .c-single_source { background: var(--signal); } .c-multi_source { background: var(--info); } .c-confirmed_hw { background: var(--ok); }

/* ---------- charts */
.charts { display: grid; gap: 1px; margin-top: 12px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
@media (min-width: 900px) { .charts { grid-template-columns: 1fr 1fr; } }
.chart { margin: 0; background: var(--panel); padding: 12px 14px 10px; }
.chart header { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--ink-2); }
.chart header .k { display: inline-flex; align-items: center; gap: 7px; }
.chart header .k::before { content: ""; width: 14px; height: 3px; border-radius: 2px; background: var(--c); }
.chart header .r { color: var(--ink-3); font-family: var(--digits); font-variant-numeric: tabular-nums; }
.chart canvas { width: 100%; height: 96px; display: block; touch-action: pan-y; }
.timeline canvas { height: 120px; cursor: crosshair; }

/* ---------- generic panels, lists, tables */
.section { margin-top: 22px; }
.section > header { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.section > header p { color: var(--ink-3); font-size: 13.5px; max-width: 70ch; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; }
.events { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.events li { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: baseline; padding: 10px 14px; border-top: 1px solid var(--line); border-left: 3px solid transparent; }
.events li[data-type="fault"], .events li[data-type="init"], .events li[data-type="lost"], .events li[data-type="status"], .events li[data-type="error"] { border-left-color: var(--fault); }
.events li[data-type="cleared"], .events li[data-type="restored"] { border-left-color: var(--ok); }
.events li[data-type="mark"], .events li[data-type="note"] { border-left-color: var(--signal); }
.events time { font-family: var(--digits); font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 13px; }
.events a, .events button.link { font-size: 13px; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line); border-radius: var(--r-md); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 12.5px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.t td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t td.n { text-align: right; font-family: var(--digits); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr.hit td { background: color-mix(in srgb, var(--fault) 12%, transparent); }
table.t tr.diff td { background: color-mix(in srgb, var(--signal) 14%, transparent); }
.note { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.warnmark { color: var(--signal); font-weight: 700; }
details.panel > summary { cursor: pointer; font-weight: 600; }
details.panel[open] > summary { margin-bottom: 10px; }

/* params */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar input[type="search"] { flex: 1 1 200px; }
.pages { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); margin-top: 12px; }
.page h3 { margin-bottom: 4px; }
.prow { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; padding: 9px 0; border-top: 1px solid var(--line); align-items: baseline; }
.prow:first-of-type { border-top: 0; }
.prow .name { font-weight: 550; }
.prow .val { font-family: var(--digits); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.prow .note { grid-column: 2 / -1; }

/* throttle window */
.tw { position: relative; height: calc(var(--rows, 0) * 17px + 74px); margin: 14px 6px 30px; }
.tw .rail, .tw .ok, .tw .dead { position: absolute; bottom: 30px; height: 12px; }
.tw .rail { left: 0; right: 0; border-radius: 6px; background: var(--fault); opacity: .85; }
.tw .ok { background: var(--ok); }
.tw .dead { background: var(--panel-2); }
.tw .tick { position: absolute; bottom: 24px; width: 2px; height: 24px; background: var(--ink); }
.tw .tick span { position: absolute; top: 26px; transform: translateX(-50%); font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.tw .tick:first-of-type span { transform: none; left: -2px; }
.tw .tick:last-of-type span { transform: translateX(-100%); }
.tw .meas { position: absolute; width: 2px; bottom: 30px; background: currentColor; }
.tw .meas span { position: absolute; top: -2px; font-size: 12px; font-weight: 700; white-space: nowrap; transform: translateY(-100%); }
.tw .meas.right span { right: 4px; } .tw .meas.left span { left: 4px; }
.verdict { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.verdict li { padding: 8px 12px; border-radius: 10px; background: var(--panel-2); border-left: 4px solid var(--ink-3); font-size: 14px; }
.verdict li.bad { border-left-color: var(--fault); } .verdict li.warn { border-left-color: var(--signal); } .verdict li.good { border-left-color: var(--ok); }

/* tools */
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
.seg button { border: 0; background: none; padding: 0 13px; min-height: 32px; border-radius: 4px; cursor: pointer; color: var(--ink-2); white-space: nowrap; font-weight: 500; }
@media (max-width: 600px) { .seg { display: flex; width: 100%; } .seg button { flex: 1; padding: 7px 6px; } }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); font-weight: 600; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.steps > li { counter-increment: step; display: grid; grid-template-columns: 34px 1fr; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; }
.steps > li::before { content: counter(step); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--line); font: 700 14px var(--digits); }
.steps > li.done::before { content: "✓"; background: var(--ok); color: #08130d; border-color: transparent; }
.steps > li[data-kind="warn"] { border-color: color-mix(in srgb, var(--signal) 60%, var(--line)); }
.steps h3 { margin-bottom: 4px; }
.steps .body > * + * { margin-top: 8px; }
.steps p { color: var(--ink-2); max-width: 72ch; }
.measure { display: grid; grid-template-columns: minmax(0, 1fr) repeat(var(--cols), minmax(64px, 96px)); gap: 6px 8px; align-items: center; font-size: 14px; }
.measure .h { font-size: 12.5px; color: var(--ink-3); }
.measure input { width: 100%; text-align: right; font-family: var(--digits); font-variant-numeric: tabular-nums; }
label.check { display: flex; gap: 10px; align-items: flex-start; color: var(--ink); }
.steps ul { padding-left: 20px; margin: 6px 0 0; color: var(--ink-2); }
.steps ul li + li { margin-top: 4px; }
.dropzone { border: 2px dashed var(--line); border-radius: var(--r-md); padding: 18px; text-align: center; color: var(--ink-3); }
.dropzone.over { border-color: var(--signal); color: var(--ink); }
.bytes { display: grid; grid-template-columns: repeat(17, minmax(0, 1fr)); gap: 2px; font: 11px var(--digits); font-variant-numeric: tabular-nums; }
.bytes span { padding: 3px 0; text-align: center; border-radius: 4px; background: var(--panel-2); }
.bytes span.d { background: var(--signal); color: #1b1300; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.stats div { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; }
.stats b { display: block; font: 650 20px var(--digits); font-variant-numeric: tabular-nums; }
.stats span { font-size: 12.5px; color: var(--ink-3); }
.cursor { font-size: 13.5px; color: var(--ink-2); min-height: 20px; }

/* forms + buttons */
input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; padding: 0; margin: 1px 0 0; accent-color: var(--signal); flex: none; }
input, select, textarea { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 10px; min-height: 38px; }
textarea { width: 100%; min-height: 90px; resize: vertical; }
label { display: grid; gap: 5px; font-size: 14px; color: var(--ink-2); }
.form { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.form .hint, .hint { font-size: 13px; color: var(--ink-3); }
button { cursor: pointer; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); padding: 9px 14px; min-height: 42px; }
button:hover:not(:disabled) { border-color: var(--ink-3); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--signal); color: #1b1300; border-color: transparent; font-weight: 650; }
button.ghost { background: none; }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--info); text-decoration: underline; }

/* MARK floating button */
.fab { position: fixed; z-index: 15; right: 16px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--signal); color: #1b1300; font: 750 15px var(--digits);
  box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.fab:active { transform: scale(.95); }
@media (min-width: 900px) { .fab { bottom: 24px; right: 24px; } }

/* dialog sheet */
dialog.sheet { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: var(--r-lg); padding: 20px;
  width: min(520px, calc(100vw - 24px)); }
dialog.sheet::backdrop { background: rgba(10, 14, 18, .55); }
dialog.sheet form { display: grid; gap: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.err { color: var(--fault); font-size: 14px; }
@media (max-width: 600px) {
  dialog.sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

.toast { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 96px + env(safe-area-inset-bottom));
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100vw - 32px); }
@media (min-width: 900px) { .toast { bottom: 28px; } }
.raw { font: 12px/1.55 ui-monospace, Menlo, Consolas, monospace; background: var(--panel-2); border-radius: 10px; padding: 10px; overflow: auto; max-height: 50vh; white-space: pre; }

.selrow { display: flex; gap: 8px; align-items: stretch; }
.selrow select { flex: 1; min-width: 0; }
dialog.sheet form { grid-template-columns: minmax(0, 1fr); }
dialog.sheet form > *, dialog.sheet .row2 > * { min-width: 0; }
dialog.sheet select { width: 100%; text-overflow: ellipsis; }

/* record button: sits above Mark */
.fab.rec { bottom: calc(var(--nav-h) + 92px + env(safe-area-inset-bottom)); background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); display: grid; place-items: center; align-content: center; gap: 3px; font-size: 13px; }
.fab.rec i { width: 14px; height: 14px; border-radius: 50%; background: var(--fault); }
.fab.rec[data-on="true"] { background: var(--fault); color: #fff; border-color: transparent; font-variant-numeric: tabular-nums; }
.fab.rec[data-on="true"] i { border-radius: 2px; background: #fff; width: 12px; height: 12px; }
@media (min-width: 900px) { .fab.rec { bottom: 100px; } }

/* replay player */
.player { margin-bottom: 14px; display: grid; gap: 10px; }
.ptrans { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ptrans #rPlay { min-width: 84px; }
.ptrans select { width: auto; }
.ptime { font-variant-numeric: tabular-nums; color: var(--ink-3); margin-right: auto; }
.ptime b { color: var(--ink); font-size: 18px; }
.scrub { position: relative; padding-bottom: 8px; }
.scrub input[type=range] { width: 100%; min-height: 0; padding: 0; border: 0; background: none; accent-color: var(--signal); height: 32px; }
.scrub .ticks { position: absolute; left: 8px; right: 8px; bottom: 0; height: 8px; pointer-events: none; }
.scrub .ticks i { position: absolute; width: 3px; height: 8px; border-radius: 1px; transform: translateX(-1px); background: var(--ink-3); }
.scrub .ticks i.fault { background: var(--fault); }
.scrub .ticks i.note { background: var(--signal); }
.replay-cluster { margin-bottom: 4px; }

/* ---------- nav: 6 tabs on phones */
@media (max-width: 899px) { .nav { grid-template-columns: repeat(6, 1fr); } }

/* ---------- console + status bar (bottom) */
:root { --sb-h: 30px; }
body { padding-bottom: calc(var(--nav-h) + var(--sb-h) + env(safe-area-inset-bottom)); }
.console { position: fixed; z-index: 19; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: var(--panel);
  border-top: 1px solid var(--line); font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.statusbar { display: flex; align-items: center; gap: 14px; width: 100%; height: var(--sb-h); padding: 0 12px; border: 0; background: none;
  color: var(--ink-2); font: inherit; cursor: pointer; text-align: left; white-space: nowrap; }
.statusbar > span { display: inline-flex; align-items: center; gap: 6px; }
.statusbar i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.sb-conn[data-state="connected"] i { background: var(--ok); }
.sb-conn[data-state="connecting"] i { background: var(--signal); animation: pulse 1s infinite; }
.sb-conn[data-state="error"] i { background: var(--fault); }
.sb-conn b { font-weight: 600; color: var(--ink); }
.sb-rec[data-on="true"] { color: var(--fault); }
.sb-rec[data-on="true"] i { background: var(--fault); }
.sb-last { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink-3); display: block !important; }
.sb-last[data-level="error"] { color: var(--fault); }
.sb-last[data-level="warn"] { color: var(--signal); }
.sb-toggle { color: var(--ink-3); }
.sb-toggle::after { content: " ▴"; }
.console[data-open="true"] .sb-toggle::after { content: " ▾"; }
.console-log { display: none; max-height: 34vh; overflow: auto; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.console[data-open="true"] .console-log { display: block; }
.cl { display: flex; gap: 10px; padding: 1px 0; color: var(--ink-2); }
.cl time { color: var(--ink-3); flex: none; }
.cl.ok span { color: var(--ok); }
.cl.warn span { color: var(--signal); }
.cl.error span { color: var(--fault); }
.cl em { color: var(--ink-3); font-style: normal; }
@media (max-width: 700px) { .sb-rec:not([data-on="true"]), .sb-toggle { display: none !important; } .statusbar { gap: 10px; } }
.fab { bottom: calc(var(--nav-h) + var(--sb-h) + 16px + env(safe-area-inset-bottom)); }
.fab.rec { bottom: calc(var(--nav-h) + var(--sb-h) + 92px + env(safe-area-inset-bottom)); }
.toast { bottom: calc(var(--nav-h) + var(--sb-h) + 96px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) {
  body { padding-bottom: var(--sb-h); }
  .console { left: 92px; bottom: 0; }
  .fab { bottom: calc(var(--sb-h) + 20px); }
  .fab.rec { bottom: calc(var(--sb-h) + 96px); }
  .toast { bottom: calc(var(--sb-h) + 24px); }
}

/* ---------- log viewer */
.lg-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.lg-head h2 { max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-tag { font: 600 11px/1 ui-monospace, Menlo, monospace; letter-spacing: .08em; color: var(--ink-3); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.lg-meta { font-size: 13px; }
.lg-sp { flex: 1; }
.btnlike { display: inline-flex; align-items: center; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; background: var(--panel-2); }
.lg-body { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .lg-body { grid-template-columns: 230px minmax(0, 1fr); } }
.lg-ch { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px; align-self: start; }
@media (min-width: 1000px) { .lg-ch { position: sticky; top: 76px; max-height: calc(100dvh - 130px); overflow: auto; } }
.lg-chhead { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--ink-3); margin-bottom: 8px; }
.lg-ch input[type=search] { width: 100%; min-height: 36px; padding: 6px 10px; margin-bottom: 8px; }
.lg-chlist { display: flex; flex-wrap: wrap; gap: 6px; }
@media (min-width: 1000px) { .lg-chlist { flex-direction: column; flex-wrap: nowrap; } }
.lg-chrow { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
  font: 12.5px/1.2 ui-monospace, Menlo, monospace; color: var(--ink-2); }
.lg-chrow input { accent-color: var(--c); margin: 0; width: 15px; height: 15px; min-height: 0; padding: 0; }
.lg-chrow.on { border-color: color-mix(in srgb, var(--c) 70%, transparent); background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--ink); }
.lg-cards { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.lg-card { flex: 1 1 130px; max-width: 220px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--c, var(--line)); border-radius: 12px; padding: 9px 12px; }
.lg-card label { display: block; font: 11px/1.2 ui-monospace, Menlo, monospace; letter-spacing: .04em; color: var(--ink-3); }
.lg-card b { font: 650 24px/1.25 var(--digits); font-variant-numeric: tabular-nums; }
.lg-card small { color: var(--ink-3); }
.lg-gear div { display: flex; gap: 5px; align-items: center; margin-top: 4px; }
.lg-gear span { width: 26px; height: 30px; display: grid; place-items: center; border-radius: 7px; background: var(--panel-2); color: var(--ink-3); font: 650 15px var(--digits); }
.lg-gear span.on { color: var(--signal); outline: 2px solid var(--signal); }
.lg-gear em { font-style: normal; margin-left: 6px; font: 650 13px var(--digits); color: var(--ink-2); }
.lg-gear em[data-s="RUN"] { color: var(--ok); }
.lg-gear em[data-s="FAULT"] { color: var(--fault); }
.lg-fault { --c: var(--fault); }
.lg-fault b { color: var(--fault); font-size: 18px; }
.lg-chart { position: relative; height: min(52vh, 460px); min-height: 260px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); }
.lg-chart canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.lg-tip { position: absolute; top: 10px; min-width: 150px; pointer-events: none; background: color-mix(in srgb, var(--bg) 92%, transparent); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; font: 12px/1.6 ui-monospace, Menlo, monospace; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.lg-tip time { color: var(--ink-3); }
.lg-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.lg-over { position: relative; height: 64px; margin-top: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; touch-action: none; }
.lg-over canvas { width: 100%; height: 100%; display: block; }
.lg-brush { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--signal) 18%, transparent); border-left: 2px solid var(--signal); border-right: 2px solid var(--signal); cursor: grab; }
.lg-brush::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--cur, 50%); width: 1px; background: var(--ink); }
.lg-brush .h { position: absolute; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--bg); border: 2px solid var(--signal); cursor: ew-resize; }
.lg-brush .h[data-h="l"] { left: -8px; }
.lg-brush .h[data-h="r"] { right: -8px; }
.lg-trans { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 6px; }
.lg-trans #lgPlay { min-width: 84px; }
.lg-trans select { width: auto; }
.lg-time { font: 13px ui-monospace, Menlo, monospace; color: var(--ink-3); }
.lg-time b { color: var(--ink); font-size: 16px; }
.lg-events { margin-top: 14px; }
.lg-events summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
@media (max-width: 700px) { .sb-tgt { display: none; } }

/* log viewer fills the window when a log is open */
body.lg-full main { max-width: none; }
@media (min-width: 1000px) {
  body.lg-full #lgView { display: flex; flex-direction: column; height: calc(100dvh - var(--bar-h, 63px) - var(--sb-h) - 48px); }
  body.lg-full .lg-head { flex: none; }
  body.lg-full .lg-body { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); }
  body.lg-full .lg-ch { position: static; max-height: none; height: 100%; overflow: auto; }
  body.lg-full .lg-main { display: flex; flex-direction: column; min-height: 0; }
  body.lg-full .lg-cards, body.lg-full .lg-over, body.lg-full .lg-trans, body.lg-full .lg-main > .hint { flex: none; }
  body.lg-full .lg-chart { flex: 1; height: auto; min-height: 240px; }
  body.lg-full .lg-events { flex: none; max-height: 20vh; overflow: auto; }
}

/* connection sheet */
.conn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.conn-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.conn-dev { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-dev svg { width: 20px; height: 20px; flex: none; color: var(--ink-3); }
.conn-empty { color: var(--ink-2); }
.conn-add { display: grid; gap: 8px; justify-items: start; }
.conn-add .hint .link { display: inline; padding: 0; margin-left: 2px; }
.conn-now { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.conn-now > div { flex: 1; min-width: 0; }
.conn-now .led { background: var(--ok); }
.conn-warn { padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--signal) 14%, transparent); }
.conn-demo { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.conn-opts summary { cursor: pointer; color: var(--ink-2); }
.conn-opts .row2 { margin-top: 10px; }
.ok-text { color: var(--ok); } .warn-text { color: var(--signal); }

/* configuration editor */
.cfg-tabs { margin: 12px 0 14px; flex-wrap: wrap; }
.cfg-groups { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .cfg-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1500px) { .cfg-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cfg-wide { grid-column: 1 / -1; }
.cfg-group h3 { margin-bottom: 8px; }
.cfg-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.cfg-row:first-of-type { border-top: 0; }
.cfg-label { flex: 1; min-width: 0; }
.cfg-label em { display: block; font-style: normal; font-size: 12px; color: var(--signal); }
.cfg-label em.err { color: var(--fault); }
.cfg-row.changed .cfg-label { color: var(--signal); }
.cfg-row.ro { opacity: .62; }
.cfg-num { display: inline-flex; align-items: center; gap: 6px; }
.cfg-num input { width: 110px; min-height: 36px; padding: 6px 9px; text-align: right; font-variant-numeric: tabular-nums; }
.cfg-num small { color: var(--ink-3); min-width: 1.6em; }
.cfg-row select { min-height: 36px; padding: 6px 9px; width: 140px; }
.cfg-row.changed input, .cfg-row.changed select { border-color: var(--signal); }
.cfg-sw { position: relative; display: inline-block; width: 44px; height: 26px; }
.cfg-sw input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.cfg-sw span { position: absolute; inset: 0; border-radius: 13px; background: var(--lamp-off); transition: background .15s; pointer-events: none; }
.cfg-sw span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); transition: transform .15s; }
.cfg-sw input:checked + span { background: var(--ok); }
.cfg-sw input:checked + span::after { transform: translateX(18px); }
.cfg-sw input:focus-visible + span { outline: 2px solid var(--signal); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .cfg-sw span, .cfg-sw span::after { transition: none; } }
.cfg-changes { border: 1px solid var(--signal); background: color-mix(in srgb, var(--signal) 8%, transparent); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 4px; }
.cfg-changes ul { margin: 6px 0 8px; padding-left: 18px; }
.cfg-bytes { display: grid; gap: 6px; }
.cfg-page { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font: 13px ui-monospace, Menlo, monospace; }
.cfg-page b { width: 2.4em; }
.cfg-page span { padding: 3px 5px; border-radius: 5px; background: var(--panel-2); }
.cfg-page span.d { background: var(--signal); color: #1b1300; }
.mono { font-family: ui-monospace, Menlo, monospace; }

/* ---------- polish pass (2026-11-20): flatter, fewer boxes, no glows, one radius scale */
.events li:first-child { border-top: 0; }
.cluster .sub b { font-weight: 600; }
.cluster .sub .gearbox { display: inline-flex; gap: 2px; margin-left: 2px; }
.cluster .sub .gearbox i { font-style: normal; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 4px; font: 650 12.5px var(--digits); color: var(--ink-3); }
.cluster .sub .gearbox i.on { background: var(--ink); color: var(--bg); }
.cluster .sub code { font: 600 13px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); }
.cluster .sub code.bad { color: var(--fault); }
.cluster-off { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.cluster-off h2 { font: 800 clamp(28px, 6vw, 40px)/1 var(--digits); color: var(--ink-3); letter-spacing: -.015em; }
.cluster-off p { color: var(--ink-3); font-size: 14px; max-width: 52ch; margin-top: 6px; }
.conn-chip b { font-weight: 600; } .conn-chip small { color: var(--ink-3); font-size: 13px; margin-left: 2px; }
.bar-actions { display: none; gap: 8px; margin-left: auto; }
.bar-actions + .conn-chip { margin-left: 0; }
.bar-actions button { min-height: 36px; }
.bar-actions .rec { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.bar-actions .rec i { width: 10px; height: 10px; border-radius: 50%; background: var(--fault); }
.bar-actions .rec[data-on="true"] { background: var(--fault); color: #fff; border-color: transparent; }
.bar-actions .rec[data-on="true"] i { border-radius: 2px; background: #fff; }
@media (min-width: 900px) { .bar-actions { display: flex; } main { padding: 22px 28px 28px; } }
.fab { box-shadow: 0 4px 14px rgba(0,0,0,.3); }
/* status bar: plain text fields, not a terminal */
.statusbar { font: 500 12.5px var(--text); gap: 0; }
.statusbar > span { padding: 0 12px; border-left: 1px solid var(--line); }
.statusbar > span:first-child { padding-left: 0; border-left: 0; }
.sb-conn b { font-weight: 600; }
.sb-f { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sb-last { border-left: 1px solid var(--line); }
.console-log { font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.toast { border-radius: var(--r-md); }
.conf { width: 6px; height: 6px; }
.lamps.grid .lamp { border-radius: var(--r-md); }
.lamps.grid .lamp > i { width: 4px; height: auto; align-self: stretch; margin: 0; }
.lamps.grid .lt b { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sb-rec em { font-style: normal; }
.sb-rec[data-on="true"] i { background: var(--fault); }
@media (max-width: 700px) { #sbTgt, #sbBaud { display: none !important; } .brand span { white-space: nowrap; } .conn-chip { max-width: 52vw; } .indicators { margin-left: 0; } }

/* ---------- diff view + dialogs */
dialog.sheet.wide { width: min(860px, calc(100vw - 24px)); }
.dv-intro { color: var(--ink-2); font-size: 14px; }
.dv-scroll { max-height: min(60vh, 560px); overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.dv-sum { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.dv-same { padding: 16px; color: var(--ink-3); }
.dv-t { width: 100%; border-collapse: collapse; font-size: 14px; }
.dv-t th, .dv-t td { padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.dv-t thead th { font-size: 12.5px; color: var(--ink-3); font-weight: 600; position: sticky; top: 0; background: var(--panel); }
.dv-t .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dv-g th { background: var(--panel-2); font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.dv-a { color: var(--ink-3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--fault) 60%, transparent); }
.dv-b { font-weight: 650; }
.dv-arrow { color: var(--ink-3); width: 1%; }
.dv-delta { font-size: 12.5px; padding: 1px 6px; border-radius: 4px; }
.dv-delta { color: var(--ink-2); background: var(--panel-2); font-variant-numeric: tabular-nums; }

/* ---------- project switcher */
.proj-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 10px; margin-left: 6px; border-radius: var(--r-sm); background: none; border: 1px solid transparent; color: var(--ink-2); font-weight: 600; max-width: 34vw; }
.proj-btn:hover { border-color: var(--line); }
.proj-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-btn::after { content: "▾"; font-size: 11px; color: var(--ink-3); }
.proj-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.proj-list li { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--r-md); }
.proj-list li.on { border-color: var(--signal); }
.proj-open { flex: 1; min-width: 0; display: grid; gap: 2px; text-align: left; background: none; border: 0; padding: 10px 12px; min-height: 0; }
.proj-open small { color: var(--ink-3); font-weight: 400; font-size: 12.5px; }
.proj-cur { font-size: 12.5px; color: var(--signal); margin-right: 12px; }

/* ---------- config: sync banner, history */
.cfg-sync { margin: 0 0 12px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--signal) 45%, var(--line)); border-radius: var(--r-md); background: color-mix(in srgb, var(--signal) 8%, transparent); font-size: 14px; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 6px; border-radius: 4px; color: var(--signal); background: color-mix(in srgb, var(--signal) 14%, transparent); }
.hist { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.hist-list { padding: 0; overflow: auto; max-height: 42vh; }
.hist-list td:nth-child(2) { white-space: nowrap; }
.hist-list tr[data-v] { cursor: pointer; }
.hist-list tr.sel td { background: color-mix(in srgb, var(--signal) 9%, transparent); }
.hist-cmp .toolbar { margin-bottom: 10px; align-items: center; }
.hist-cmp .toolbar label { display: flex; align-items: center; gap: 8px; }
.hist-cmp .toolbar select { max-width: 360px; }
.hist-cmp .dv { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }

/* ---------- fault guide */
a.lamp { color: inherit; text-decoration: none; cursor: pointer; }
.lamps.grid a.lamp:hover { border-color: var(--ink-3); }
.lamps.grid a.lamp.sel { border-color: var(--signal); box-shadow: inset 0 0 0 1px var(--signal); }
.guide-body { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .guide-body { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); align-items: start; } .guide-data { position: sticky; top: 12px; } }
.guide-main { max-width: 78ch; }
.guide-sum { font-size: 15.5px; line-height: 1.55; margin: 0 0 8px; }
.guide-feel { color: var(--ink-2); margin: 0 0 16px; }
.guide h3 { font-size: 14px; margin: 0 0 10px; }
.causes { margin: 0; padding: 0; list-style: none; counter-reset: c; display: grid; gap: 10px; }
.causes > li { counter-increment: c; border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px 12px 44px; position: relative; background: var(--panel); }
.causes > li::before { content: counter(c); position: absolute; left: 14px; top: 12px; width: 20px; height: 20px; border-radius: 50%; background: var(--panel-2); color: var(--ink-2); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.cause-h { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.causes p { margin: 4px 0; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.causes .k { display: inline-block; min-width: 42px; font-weight: 650; color: var(--ink); }
.causes .toolbar { margin-top: 8px; }
.likely { font-size: 12px; white-space: nowrap; color: var(--ink-3); }
.likely.l-most-common { color: var(--signal); font-weight: 650; }
.findings { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.findings li { display: flex; gap: 8px; font-size: 14px; line-height: 1.45; }
.findings li i { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--ink-3); }
.findings .f-bad i { background: var(--fault); }
.findings .f-warn i { background: var(--signal); }
.findings .f-good i { background: var(--ok); }
.findings .f-bad span { font-weight: 600; }
.cluster a.lamp:hover { color: var(--ink); }

a.btn { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: inherit; text-decoration: none; font-size: 14px; }
a.btn:hover { border-color: var(--ink-3); }
a.btn.ghost { background: none; }

/* ---------- throttle probe */
#lThrottle { margin: 14px 0; }
.thr { padding: 14px 16px 10px; }
.thr-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.thr-head h3 { margin: 0; font-size: 15px; }
.thr-head .ghost { margin-left: auto; min-height: 32px; padding: 4px 10px; font-size: 13px; }
.thr-val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.thr-bar { position: relative; height: 26px; border-radius: 6px; background: color-mix(in srgb, var(--fault) 16%, var(--panel-2)); overflow: hidden; }
.thr-ok { position: absolute; top: 0; bottom: 0; background: var(--panel-2); }
.thr-range { position: absolute; top: 9px; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--ok) 35%, transparent); }
.thr-mark { position: absolute; top: 4px; bottom: 4px; width: 2px; background: var(--ok); }
.thr-peak { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--fault); }
.thr-needle { position: absolute; top: 0; bottom: 0; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--ink); transition: left .05s linear; }
.thr-scale { position: relative; height: 18px; font-size: 11.5px; color: var(--ink-3); }
.thr-scale span { position: absolute; transform: translateX(-50%); top: 2px; }
.thr-scale span:first-child { transform: none; }
.thr .hint { margin: 4px 0 0; }
.thr[data-state="bad"] .thr-val { color: var(--fault); }
.thr[data-state="warn"] .thr-val { color: var(--signal); }
.probe-now { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
@media (prefers-reduced-motion: reduce) { .thr-needle { transition: none; } }

/* ---------- wizards */
.wiz { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .wiz { grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr); align-items: start; } }
.wiz-form { grid-template-columns: 1fr; }
.wiz-form label small { display: block; font-weight: 400; margin-top: 4px; }
.wiz-row { display: flex; gap: 8px; }
.wiz-row input { flex: 1; min-width: 0; }
.wiz-row button { white-space: nowrap; min-height: 0; padding: 6px 10px; font-size: 13px; }
.wiz-out { display: grid; gap: 12px; }
.wiz-out .dv { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--panel); }
@media (max-width: 1099px) { .guide-data { order: -1; } }
.dv-note { margin: 0; padding: 10px 12px; font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--line); background: var(--panel-2); }

/* ---------- write dialog */
.w-checks { display: grid; gap: 10px; margin-top: 14px; }
.w-checks label.check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.w-checks input[type=checkbox] { width: 20px; height: 20px; }
