/* DonutAPI console. Dark first, light on [data-theme="light"].
   No inline styles anywhere (CSP): sizes that come from data travel as data-* and are set by JS. */

/* ───────── tokens ───────── */
:root {
  color-scheme: dark;
  --bg: #09090b;
  --surface: #111113;
  --surface-2: #18181b;
  --surface-3: #1f1f23;
  --hover: rgba(255, 255, 255, .035);
  --active: rgba(255, 255, 255, .065);
  --border: #222226;
  --border-2: #2c2c31;
  --border-3: #3a3a41;
  --text: #ededef;
  --text-2: #a1a1aa;
  --text-3: #8b8b94;
  --ok: #3fb950;      --ok-bg: rgba(63, 185, 80, .12);     --ok-bd: rgba(63, 185, 80, .28);
  --warn: #d6a127;    --warn-bg: rgba(214, 161, 39, .12);  --warn-bd: rgba(214, 161, 39, .3);
  --bad: #f2555a;     --bad-bg: rgba(242, 85, 90, .12);    --bad-bd: rgba(242, 85, 90, .3);
  --info: #4c9bff;    --info-bg: rgba(76, 155, 255, .12);  --info-bd: rgba(76, 155, 255, .3);
  --off: #8b8b94;     --off-bg: rgba(139, 139, 148, .12);  --off-bd: rgba(139, 139, 148, .26);
  --bad-solid: #da3633;
  --accent: #4c9bff;
  --link: #6eaefc;
  --primary-bg: #ededef;
  --primary-fg: #09090b;
  --primary-hover: #ffffff;
  --sel: rgba(76, 155, 255, .08);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, .55);
  --backdrop: rgba(0, 0, 0, .62);
  /* charts (validated: dataviz validate_palette, stack order cache → live → failed) */
  --c-cache: #199e70;
  --c-live: #3987e5;
  --c-fail: #e66767;
  --c-p50: #3987e5;
  --c-p95: #d95926;
  --grid: #1f1f23;
  --axis: #34343a;
  --skel: #1c1c20;

  --font: "Inter var", "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", "Cascadia Code", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --r-sm: 4px;
  --r: 6px;
  --r-lg: 8px;
  --sb-w: 224px;
  --sb-w-c: 56px;
  --tb-h: 48px;
  --gut: 20px;
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #ececee;
  --hover: rgba(9, 9, 11, .035);
  --active: rgba(9, 9, 11, .06);
  --border: #e6e6e9;
  --border-2: #dcdce0;
  --border-3: #c7c7cd;
  --text: #09090b;
  --text-2: #52525b;
  --text-3: #686871;
  --ok: #17752f;      --ok-bg: #e7f4ea;   --ok-bd: #b9dfc3;
  --warn: #8f5f00;    --warn-bg: #fbf1d9; --warn-bd: #ecd28f;
  --bad: #c9202c;     --bad-bg: #fdecec;  --bad-bd: #f3b9bc;
  --info: #0b62d6;    --info-bg: #e8f1fd; --info-bd: #b4d0f6;
  --off: #686871;     --off-bg: #f0f0f2;  --off-bd: #d6d6db;
  --bad-solid: #c9202c;
  --accent: #0b62d6;
  --link: #0b62d6;
  --primary-bg: #18181b;
  --primary-fg: #ffffff;
  --primary-hover: #000000;
  --sel: rgba(11, 98, 214, .06);
  --shadow-pop: 0 12px 32px rgba(9, 9, 11, .14), 0 2px 6px rgba(9, 9, 11, .06);
  --backdrop: rgba(9, 9, 11, .35);
  --c-cache: #16a06e;
  --c-live: #2a78d6;
  --c-fail: #e34948;
  --c-p50: #2a78d6;
  --c-p95: #eb6834;
  --grid: #eeeef0;
  --axis: #d4d4d8;
  --skel: #ededf0;
}

/* ───────── base ───────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs)/1.45 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.005em; }
h1 { font-size: var(--fs-md); }
h2 { font-size: var(--fs); }
h3 { font-size: var(--fs-sm); }
p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
code, kbd, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0 4px; }
kbd { border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: var(--r-sm); padding: 0 4px; font-size: 11px; color: var(--text-2); background: var(--surface-2); }
hr { border: 0; border-top: 1px solid var(--border); margin: 8px 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: rgba(76, 155, 255, .35); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.skip:focus { position: fixed !important; left: 12px; top: 8px; width: auto; height: auto; clip: auto; z-index: 100; background: var(--primary-bg); color: var(--primary-fg); padding: 6px 10px; border-radius: var(--r); }
.muted { color: var(--text-3); }
.t2 { color: var(--text-2); }
.fs-sm { font-size: var(--fs-sm); }
.fs-xs { font-size: var(--fs-xs); }
.fw6 { font-weight: 600; }
.nowrap { white-space: nowrap; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.c-ok { color: var(--ok); } .c-warn { color: var(--warn); } .c-bad { color: var(--bad); } .c-info { color: var(--info); }
.sp { flex: 1 1 auto; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.row.nw { flex-wrap: nowrap; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stack.g8 { gap: 8px; } .stack.g16 { gap: 16px; } .stack.g4 { gap: 4px; }
.mt4 { margin-top: 4px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mb8 { margin-bottom: 8px; }
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ic.sm { width: 14px; height: 14px; vertical-align: -2px; }
.ic.xs { width: 12px; height: 12px; vertical-align: -1px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } * { scroll-behavior: auto !important; } }

/* ───────── boot + login ───────── */
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--text-3); font-size: var(--fs-sm); gap: 10px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.login { width: 100%; max-width: 360px; }
.login .brand { margin-bottom: 20px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: var(--fs-lg); }
.login-foot { margin-top: 14px; font-size: var(--fs-sm); color: var(--text-3); text-align: center; }
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { padding-right: 56px; }
.pw-wrap .btn { position: absolute; right: 3px; top: 3px; height: 26px; }

/* ───────── brand ───────── */
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-weight: 600; font-size: var(--fs-md); letter-spacing: -.01em; text-decoration: none !important; min-width: 0; }
.mark { width: 22px; height: 22px; flex: none; border-radius: 6px; background: var(--text); display: grid; place-items: center; }
.mark svg { width: 14px; height: 14px; }
.mark .ring { fill: none; stroke: var(--bg); stroke-width: 3.2; }
.mark .seg { fill: none; stroke: var(--accent); stroke-width: 3.2; stroke-linecap: round; }

/* ───────── app shell ───────── */
.app { display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); min-height: 100vh; }
.app.collapsed { grid-template-columns: var(--sb-w-c) minmax(0, 1fr); }
.sb {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); border-right: 1px solid var(--border); min-width: 0; z-index: 30;
}
.sb-top { height: var(--tb-h); display: flex; align-items: center; gap: 8px; padding: 0 12px 0 14px; border-bottom: 1px solid var(--border); flex: none; }
.sb-env { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); border: 1px solid var(--border-2); border-radius: 999px; padding: 0 7px; line-height: 18px; white-space: nowrap; }
.sb-scroll { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 10px 8px; }
.sb-group { font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); padding: 12px 8px 4px; letter-spacing: .02em; white-space: nowrap; }
.sb-group:first-child { padding-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a, .nav button {
  display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 8px; border-radius: var(--r);
  color: var(--text-2); text-decoration: none; background: none; border: 0; width: 100%; text-align: left;
  font-size: var(--fs); font-weight: 500; white-space: nowrap; position: relative;
}
.nav a:hover, .nav button:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--active); color: var(--text); }
.nav a[aria-current="page"]::before { content: ""; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--text); }
.nav .lbl { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav .cnt { font-size: var(--fs-xs); font-weight: 600; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.nav .cnt.bad { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-bd); }
.nav .cnt.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-bd); }
.nav .cnt.n { color: var(--text-3); }
.sb-foot { border-top: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; gap: 2px; flex: none; }
.sb-fleet { padding: 6px 8px 8px; font-size: var(--fs-sm); color: var(--text-3); display: flex; flex-direction: column; gap: 6px; white-space: nowrap; }
.sb-fleet b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.sb-fleet .bar { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; display: flex; gap: 1px; }
.sb-fleet .bar i { display: block; height: 100%; }
.collapsed .sb-top { padding: 0; justify-content: center; }
.collapsed .sb .brand-name, .collapsed .sb-env, .collapsed .sb-group, .collapsed .nav .lbl, .collapsed .sb-fleet { display: none; }
.collapsed .sb-group + .nav { border-top: 1px solid var(--border); padding-top: 6px; margin-top: 6px; }
.collapsed .nav a, .collapsed .nav button { justify-content: center; padding: 0; }
.collapsed .nav .cnt { position: absolute; top: 1px; right: 2px; min-width: 15px; height: 15px; font-size: 10px; padding: 0 3px; }
.collapsed .nav a[aria-current="page"]::before { left: -8px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.tb {
  position: sticky; top: 0; z-index: 20; height: var(--tb-h); display: flex; align-items: center; gap: 10px;
  padding: 0 var(--gut); background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.tb h1 { font-size: var(--fs-md); white-space: nowrap; }
.tb .crumb { color: var(--text-3); font-size: var(--fs-md); white-space: nowrap; }
.tb .menu-btn { display: none; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.live .dot { width: 7px; height: 7px; }
.live.lost { color: var(--bad); }
.live .btn { margin-left: 2px; }
.kbd-btn { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 6px 0 9px; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--surface); color: var(--text-3); font-size: var(--fs-sm); min-width: 200px; }
.kbd-btn:hover { border-color: var(--border-3); color: var(--text-2); }
.kbd-btn .sp { min-width: 16px; }
.banners { display: flex; flex-direction: column; gap: 8px; padding: 12px var(--gut) 0; }
.banners:empty { display: none; }
.page { padding: 16px var(--gut) 40px; container-type: inline-size; container-name: page; min-width: 0; flex: 1 1 auto; }
.page:focus { outline: none; }
.scrim { position: fixed; inset: 0; background: var(--backdrop); z-index: 29; }

/* ───────── page header + toolbars ───────── */
.ph { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; min-height: 30px; }
.ph .desc { color: var(--text-2); font-size: var(--fs); }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .search { flex: 0 1 300px; }

/* ───────── panels ───────── */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); min-width: 0; }
.panel-h { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.panel-h h2 { font-size: var(--fs); font-weight: 600; white-space: nowrap; }
.panel-h .meta { color: var(--text-3); font-size: var(--fs-sm); }
.panel-h.flat { border-bottom: 0; }
.panel-b { padding: 12px 14px; }
.panel-b.tight { padding: 8px 14px; }
.panel-f { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-3); }
details.panel > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 14px; font-weight: 600; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary .chev { transition: transform .15s; color: var(--text-3); }
details.panel[open] > summary { border-bottom: 1px solid var(--border); }
details.panel[open] > summary .chev { transform: rotate(90deg); }
details.panel > summary:hover { background: var(--hover); }
.grid { display: grid; gap: 12px; min-width: 0; align-items: start; }
.reasons { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r); }
.reasons > div { display: grid; grid-template-columns: minmax(120px, max-content) 40px minmax(0, 1fr) 16px; gap: 10px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-2); }
.reasons > div:last-child { border-bottom: 0; }
.reasons code { background: none; border: 0; padding: 0; color: var(--text); }
.reasons b { font-variant-numeric: tabular-nums; text-align: right; color: var(--text); font-weight: 500; }
.grid > * { min-width: 0; }

/* ───────── buttons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: var(--r); border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text);
  font-size: var(--fs); font-weight: 500; white-space: nowrap; text-decoration: none !important; line-height: 1; flex: none;
  transition: background-color .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-3); }
.btn:active { transform: translateY(.5px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary-bg); color: var(--primary-fg); border-color: transparent; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad-bd); background: var(--bad-bg); }
.btn.danger.solid { background: var(--bad-solid); color: #fff; border-color: transparent; }
.btn.danger.solid:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.sm { height: 26px; padding: 0 9px; font-size: var(--fs-sm); gap: 5px; }
.btn.xs { height: 22px; padding: 0 7px; font-size: var(--fs-xs); gap: 4px; border-radius: 5px; }
.btn.icon { width: 30px; padding: 0; }
.btn.icon.sm { width: 26px; }
.btn.block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--link); font-size: inherit; text-decoration: none; }
.linkbtn:hover { text-decoration: underline; text-underline-offset: 2px; }
.btngroup { display: inline-flex; }
.btngroup .btn { border-radius: 0; margin-left: -1px; }
.btngroup .btn:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.btngroup .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--r); padding: 2px; gap: 2px; flex: none; }
.seg button { height: 24px; padding: 0 10px; border: 0; background: none; border-radius: 4px; color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border-2); }
[data-theme="light"] .seg button[aria-pressed="true"] { box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--border-2); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }

/* filter chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 1px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--border-2); background: transparent; color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; flex: none; }
.chip:hover { color: var(--text); border-color: var(--border-3); }
.chip .n { color: var(--text-3); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--active); color: var(--text); border-color: var(--border-3); }
.chip[aria-pressed="true"] .n { color: var(--text-2); }
.chip .dot { width: 6px; height: 6px; }

/* ───────── form controls ───────── */
input[type="text"], input[type="password"], input[type="search"], input[type="number"], input[type="email"], input[type="url"], select, textarea {
  height: 30px; width: 100%; min-width: 0; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--border-2);
  background: var(--surface-2); color: var(--text); font-size: var(--fs); transition: border-color .12s, box-shadow .12s;
}
[data-theme="light"] input[type="text"], [data-theme="light"] input[type="password"], [data-theme="light"] input[type="search"], [data-theme="light"] input[type="number"], [data-theme="light"] select, [data-theme="light"] textarea { background: var(--surface); }
textarea { height: auto; min-height: 120px; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: var(--fs-sm); line-height: 1.5; }
textarea.tall { min-height: 280px; }
select { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8b94' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 14px; }
select.auto { width: auto; }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--border-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--bad); }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="search"]::-webkit-search-cancel-button { filter: grayscale(1); }
.search { position: relative; display: flex; align-items: center; min-width: 0; }
.search .ic { position: absolute; left: 9px; color: var(--text-3); pointer-events: none; }
.search input { padding-left: 30px; }
.search kbd { position: absolute; right: 7px; pointer-events: none; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span:first-child, .flabel { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); }
.help { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.45; }
.err-text { font-size: var(--fs-sm); color: var(--bad); min-height: 0; }
.err-text:empty { display: none; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs); color: var(--text-2); cursor: pointer; }
.cbx, input[type="checkbox"].cbx, input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; flex: none; cursor: pointer; }
.unit { display: flex; align-items: center; min-width: 0; }
.unit input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.unit em { font-style: normal; font-size: var(--fs-sm); color: var(--text-3); height: 30px; display: grid; place-items: center; padding: 0 9px; border: 1px solid var(--border-2); border-left: 0; border-radius: 0 var(--r) var(--r) 0; background: var(--surface-2); white-space: nowrap; }
.unit.bare input { border-radius: var(--r); }
.switch { position: relative; display: inline-flex; width: 30px; height: 18px; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-3); transition: background-color .15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--text-2); transition: transform .15s, background-color .15s; }
.switch input:checked + i { background: var(--ok); border-color: var(--ok); }
.switch input:checked + i::after { transform: translateX(12px); background: #fff; }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + i { opacity: .5; }
.choices { display: grid; gap: 8px; }
.choice { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--border-2); border-radius: var(--r); cursor: pointer; background: var(--surface); }
.choice:hover { border-color: var(--border-3); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--sel); }
.choice input { margin-top: 2px; grid-row: span 2; }
.choice b { font-weight: 600; font-size: var(--fs); }
.choice .help { grid-column: 2; }
.choice .tag { font-size: var(--fs-xs); color: var(--ok); margin-left: 6px; font-weight: 500; }

/* ───────── status: dots + badges ───────── */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--off); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.info { background: var(--info); } .dot.off { background: var(--off); }
.dot.ring { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 0%, transparent); }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; border: 1px solid var(--off-bd); background: var(--off-bg); color: var(--text-2); max-width: 100%; }
.badge > span { overflow: hidden; text-overflow: ellipsis; }
.badge .ic { width: 12px; height: 12px; }
.badge .dot { width: 6px; height: 6px; }
.badge.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-bd); }
.badge.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-bd); }
.badge.bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-bd); }
.badge.info { color: var(--info); background: var(--info-bg); border-color: var(--info-bd); }
.badge.off { color: var(--text-2); }
.badge.plain { background: transparent; border-color: transparent; padding: 0; height: auto; }
.badge time { font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border-2); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; color: var(--text-2); text-decoration: none !important; }
.pill:hover { border-color: var(--border-3); color: var(--text); }
.pill.ok { color: var(--ok); border-color: var(--ok-bd); background: var(--ok-bg); }
.pill.warn { color: var(--warn); border-color: var(--warn-bd); background: var(--warn-bg); }
.pill.bad { color: var(--bad); border-color: var(--bad-bd); background: var(--bad-bg); }
.pill .dot { width: 7px; height: 7px; }
.sev { width: 20px; height: 20px; border-radius: 5px; display: inline-grid; place-items: center; flex: none; }
.sev .ic { width: 13px; height: 13px; }
.sev.critical { color: var(--bad); background: var(--bad-bg); }
.sev.warning { color: var(--warn); background: var(--warn-bg); }
.sev.info { color: var(--info); background: var(--info-bg); }
.sev.ok { color: var(--ok); background: var(--ok-bg); }
.tagx { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; font-size: var(--fs-xs); font-weight: 500; color: var(--text-2); background: var(--surface-3); white-space: nowrap; }
.tagx.warn { color: var(--warn); background: var(--warn-bg); }
.tagx.bad { color: var(--bad); background: var(--bad-bg); }
.tagx.ok { color: var(--ok); background: var(--ok-bg); }
.tagx.info { color: var(--info); background: var(--info-bg); }

/* notes / inline alerts */
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--border-2); background: var(--surface-2); font-size: var(--fs); color: var(--text-2); }
.note > .ic { margin-top: 1px; }
.note b { color: var(--text); font-weight: 600; }
.note.ok { border-color: var(--ok-bd); background: var(--ok-bg); } .note.ok > .ic { color: var(--ok); }
.note.warn { border-color: var(--warn-bd); background: var(--warn-bg); } .note.warn > .ic { color: var(--warn); }
.note.bad { border-color: var(--bad-bd); background: var(--bad-bg); } .note.bad > .ic { color: var(--bad); }
.note.info { border-color: var(--info-bd); background: var(--info-bg); } .note.info > .ic { color: var(--info); }
[data-theme="light"] .note.warn, [data-theme="light"] .note.bad, [data-theme="light"] .note.ok, [data-theme="light"] .note.info { color: var(--text); }
.note .body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.banner { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r); font-size: var(--fs); border: 1px solid var(--border-2); background: var(--surface); }
.banner > span { flex: 1 1 auto; min-width: 0; }
.banner > .ic { align-self: flex-start; margin-top: 2px; }
.banner.bad { border-color: var(--bad-bd); background: var(--bad-bg); }
.banner.bad > .ic { color: var(--bad); }
.banner.warn { border-color: var(--warn-bd); background: var(--warn-bg); }
.banner.warn > .ic { color: var(--warn); }
.banner a { font-weight: 500; }

/* empty / error / loading */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 32px 16px; color: var(--text-3); font-size: var(--fs); }
.empty > .ic { width: 20px; height: 20px; color: var(--text-3); margin-bottom: 2px; }
.empty b { color: var(--text); font-weight: 600; font-size: var(--fs); }
.empty .row { justify-content: center; margin-top: 6px; }
.empty.sm { padding: 18px 12px; }
.empty.err > .ic { color: var(--bad); }
.skel { display: block; background: var(--skel); border-radius: 4px; height: 12px; animation: pulse 1.6s ease-in-out infinite; }
.skel.h20 { height: 20px; } .skel.h8 { height: 8px; } .skel.w30 { width: 30%; } .skel.w50 { width: 50%; } .skel.w70 { width: 70%; } .skel.w90 { width: 90%; }
.skel-rows { padding: 6px 14px 12px; display: flex; flex-direction: column; gap: 14px; }
.skel-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr .8fr .6fr; gap: 18px; align-items: center; }
.skel-chart { height: 200px; border-radius: var(--r); }
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

/* ───────── KPIs + status strip ───────── */
.status { display: grid; grid-template-columns: minmax(260px, auto) 1fr; align-items: stretch; }
.status-main { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 12px 16px; border-right: 1px solid var(--border); min-width: 0; }
.status-main .ttl { display: flex; align-items: center; gap: 9px; font-size: var(--fs-md); font-weight: 600; }
.status-main .ttl .dot { width: 9px; height: 9px; }
.status-main .why { font-size: var(--fs-sm); color: var(--text-2); }
.fleet { display: flex; flex-direction: column; justify-content: center; gap: 9px; padding: 10px 16px; min-width: 0; }
.fleet-counts { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.fleet-counts a, .fleet-counts span.fc { display: inline-flex; align-items: baseline; gap: 6px; color: var(--text-2); font-size: var(--fs-sm); text-decoration: none; white-space: nowrap; }
.fleet-counts a:hover { color: var(--text); text-decoration: none; }
.fleet-counts b { font-size: var(--fs-md); font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.fleet-counts .dot { width: 7px; height: 7px; align-self: center; }
.segbar { display: flex; gap: 2px; height: 6px; border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.segbar i { display: block; height: 100%; min-width: 2px; }
.f-serving { background: var(--ok); } .f-coming { background: var(--info); } .f-fixing { background: color-mix(in srgb, var(--warn) 70%, var(--info)); }
.f-parked { background: #7a7a85; } .f-break { background: color-mix(in srgb, var(--off) 60%, var(--surface-3)); } .f-needs { background: var(--bad); } .f-stopped { background: var(--border-3); }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.kpi { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 11px 14px 12px; min-width: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 0 -1px -1px 0; }
.kpi-l { display: flex; align-items: center; gap: 5px; font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; white-space: nowrap; min-width: 0; }
.kpi-l > span { overflow: hidden; text-overflow: ellipsis; }
.kpi-v { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.015em; line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-v small { font-size: var(--fs); font-weight: 500; color: var(--text-3); margin-left: 2px; letter-spacing: 0; }
.kpi-s { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.4; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-s b { color: var(--text-2); font-weight: 500; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-xs); font-weight: 600; padding: 0 5px; border-radius: 4px; height: 17px; font-variant-numeric: tabular-nums; vertical-align: 1px; }
.delta.good { color: var(--ok); background: var(--ok-bg); }
.delta.bad { color: var(--bad); background: var(--bad-bg); }
.delta.flat { color: var(--text-3); background: var(--surface-3); }
.meter { display: flex; align-items: center; gap: 8px; min-width: 0; }
.meter .bar { flex: 1 1 auto; height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--info) 18%, var(--surface-3)); overflow: hidden; min-width: 30px; }
.meter .bar i { display: block; height: 100%; background: var(--info); border-radius: 4px; }
.meter.hi .bar i { background: var(--warn); }
.meter.full .bar i { background: var(--bad); }
.meter .lbl { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tipbtn { display: inline-grid; place-items: center; width: 14px; height: 14px; border: 0; padding: 0; background: none; color: var(--text-3); border-radius: 50%; flex: none; cursor: help; }
.tipbtn:hover { color: var(--text-2); }
.tipbtn .ic { width: 13px; height: 13px; }
#tip { position: fixed; z-index: 90; max-width: 280px; padding: 7px 10px; border-radius: var(--r); background: var(--surface-3); border: 1px solid var(--border-3); color: var(--text); font-size: var(--fs-sm); line-height: 1.45; box-shadow: var(--shadow-pop); pointer-events: none; }
[data-theme="light"] #tip { background: #18181b; color: #f4f4f5; border-color: #18181b; }

/* ───────── charts ───────── */
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-sm); color: var(--text-2); }
.legend .it { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend .sw { width: 9px; height: 9px; border-radius: 2px; }
.legend .ln { width: 14px; height: 2px; border-radius: 2px; }
.sw-cache, .ln-cache { background: var(--c-cache); } .sw-live, .ln-live { background: var(--c-live); } .sw-fail, .ln-fail { background: var(--c-fail); }
.ln-p50 { background: var(--c-p50); } .ln-p95 { background: var(--c-p95); }
.chart { position: relative; min-width: 0; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart text.end { fill: var(--text-2); font-weight: 500; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .base { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .xh { stroke: var(--border-3); stroke-width: 1; shape-rendering: crispEdges; }
.chart .colbg { fill: var(--hover); }
.m-cache { fill: var(--c-cache); } .m-live { fill: var(--c-live); } .m-fail { fill: var(--c-fail); }
.chart path.hot, .chart rect.hot { filter: brightness(1.15); }
.l-p50 { stroke: var(--c-p50); } .l-p95 { stroke: var(--c-p95); }
.a-p50 { fill: var(--c-p50); opacity: .08; } .a-p95 { fill: var(--c-p95); opacity: .06; }
.d-p50 { fill: var(--c-p50); stroke: var(--surface); stroke-width: 2; } .d-p95 { fill: var(--c-p95); stroke: var(--surface); stroke-width: 2; }
.chart .tip { position: absolute; top: 0; z-index: 5; min-width: 150px; padding: 8px 10px; border-radius: var(--r); background: var(--surface-3); border: 1px solid var(--border-3); box-shadow: var(--shadow-pop); font-size: var(--fs-sm); pointer-events: none; }
[data-theme="light"] .chart .tip { background: var(--surface); }
.chart .tip .h { font-weight: 600; margin-bottom: 4px; color: var(--text); }
.chart .tip .r { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 8px; color: var(--text-2); line-height: 1.6; }
.chart .tip .r i { width: 9px; height: 9px; border-radius: 2px; }
.chart .tip .r i.ln { height: 2px; }
.chart .tip .r b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.chart .tip .tot { border-top: 1px solid var(--border-2); margin-top: 4px; padding-top: 4px; }
.chart-empty { height: 200px; display: grid; place-items: center; }
.spark { width: 88px; height: 24px; display: block; }
.spark path { fill: none; stroke: var(--c-live); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--c-live); }
.hbars { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 6px 12px; align-items: center; font-size: var(--fs-sm); }
.hbars code { background: none; border: 0; padding: 0; color: var(--text-2); }
.hbars .b { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hbars .b i { display: block; height: 8px; border-radius: 0 3px 3px 0; background: var(--c-fail); min-width: 2px; }
.hbars .b span { color: var(--text-2); font-variant-numeric: tabular-nums; }
.dtable-wrap { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r); margin-top: 10px; }
.dtable { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.dtable th, .dtable td { padding: 4px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.dtable th:first-child, .dtable td:first-child { text-align: left; }
.dtable th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-2); font-weight: 500; }

/* ───────── tables ───────── */
.tbl-wrap { overflow-x: auto; min-width: 0; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs); }
.tbl th { position: sticky; top: var(--tb-h); z-index: 2; background: var(--surface); text-align: left; font-weight: 500; font-size: var(--fs-sm); color: var(--text-3); height: 34px; padding: 0 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl-wrap .tbl th { top: 0; }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl th button.sort { background: none; border: 0; padding: 0; color: inherit; font: inherit; display: inline-flex; align-items: center; gap: 3px; }
.tbl th button.sort:hover { color: var(--text); }
.tbl th[aria-sort] button.sort { color: var(--text); }
.tbl th button.sort .ic { width: 12px; height: 12px; opacity: .8; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; min-width: 0; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--hover); }
.tbl tbody tr.sel td { background: var(--sel); }
.tbl td.num, .tbl td .num { font-variant-numeric: tabular-nums; }
.tbl .sub { font-size: var(--fs-sm); color: var(--text-3); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .c-cb { width: 36px; padding-right: 0; }
.tbl .c-act { width: 40px; text-align: right; padding-left: 0; padding-right: 8px; }
.tbl .nm { font-weight: 500; color: var(--text); background: none; border: 0; padding: 0; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.tbl button.nm:hover { text-decoration: underline; text-underline-offset: 2px; }
.cellx { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.cellx > * { max-width: 100%; }
.tbl .mono { font-size: 12px; }
.tbl .dim { color: var(--text-3); }

/* workers table columns */
.wt { table-layout: fixed; min-width: 980px; }
.wt th.c-cb { width: 36px; } .wt th.c-acct { width: 17%; } .wt th.c-state { width: 17%; } .wt th.c-safe { width: 9%; }
.wt th.c-dim { width: 8%; } .wt th.c-proxy { width: 10%; } .wt th.c-ping { width: 64px; } .wt th.c-ok { width: 84px; }
.wt th.c-err { width: 10%; } .wt th.c-lastok { width: 84px; } .wt th.c-avg { width: 66px; } .wt th.c-uses { width: 104px; } .wt th.c-next { width: 11%; } .wt th.c-act { width: 44px; }
.wt td { height: 46px; padding-top: 5px; padding-bottom: 5px; overflow: hidden; }
.wt td.c-next, .wt td.c-lastok, .wt td.c-ping, .wt td.c-avg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl td.nowrap, .tbl .nw { white-space: nowrap; }
.wt.no-safety .c-safe, .wt.no-safety .c-dim { display: none; }
.wt-dim2 { display: none; }
.wt td .badge { max-width: 100%; }
.uses { display: flex; flex-direction: column; gap: 3px; }
.uses .meter .bar { height: 3px; }
.uses .meter .lbl { font-size: var(--fs-sm); }
@container page (max-width: 1350px) { .wt .c-dim { display: none; } .wt .wt-dim2 { display: block; } }
@container page (max-width: 1180px) { .wt .c-avg { display: none; } }

/* ───────── workers page ───────── */
.codebar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 9px 14px; border: 1px solid var(--warn-bd); background: var(--warn-bg); border-radius: var(--r-lg); }
.codebar .who { display: flex; align-items: center; gap: 8px; font-weight: 500; min-width: 0; }
.codebar .who > .ic { color: var(--warn); }
.codebar .code { font-family: var(--mono); font-size: var(--fs-lg); font-weight: 600; letter-spacing: .14em; color: var(--text); }
.codebar .exp { font-size: var(--fs-sm); color: var(--text-2); font-variant-numeric: tabular-nums; }
.codebar ol { margin: 0; padding-left: 18px; font-size: var(--fs-sm); color: var(--text-2); }
.bulkbar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 25; display: flex; align-items: center; gap: 6px;
  padding: 6px 6px 6px 14px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border-3); box-shadow: var(--shadow-pop);
  max-width: calc(100vw - 24px); flex-wrap: wrap;
}
[data-theme="light"] .bulkbar { background: var(--surface); }
.bulkbar b { font-weight: 600; margin-right: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bulkbar .div { width: 1px; height: 18px; background: var(--border-3); margin: 0 2px; }

/* ───────── drawer + modal + menu ───────── */
dialog { padding: 0; border: 0; color: var(--text); background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: var(--backdrop); }
.modal { width: min(520px, calc(100vw - 24px)); margin: auto; border: 1px solid var(--border-2); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-pop); max-height: calc(100vh - 48px); }
.modal.narrow { width: min(420px, calc(100vw - 24px)); }
.modal.wide { width: min(720px, calc(100vw - 24px)); }
.modal[open] { display: flex; flex-direction: column; }
.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; height: 100vh; max-height: 100vh; width: min(560px, 100vw); border-left: 1px solid var(--border-2); background: var(--surface); box-shadow: var(--shadow-pop); }
.drawer[open] { display: flex; flex-direction: column; }
.dlg { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.dlg-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex: none; min-height: 52px; }
.dlg-h h2 { font-size: var(--fs-md); }
.dlg-h .titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dlg-h .titles .sub { font-size: var(--fs-sm); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-b { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; flex: 1 1 auto; min-height: 0; }
.dlg-f { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); flex: none; flex-wrap: wrap; }
.dlg-f .sp { min-width: 0; }
.steps { display: flex; gap: 6px; font-size: var(--fs-sm); color: var(--text-3); flex-wrap: wrap; }
.steps .on { color: var(--text); font-weight: 500; }
.steps .done { color: var(--ok); }
.dsec { display: flex; flex-direction: column; gap: 8px; }
.dsec + .dsec { border-top: 1px solid var(--border); padding-top: 14px; }
.dsec h3 { font-size: var(--fs-sm); color: var(--text-3); font-weight: 500; }
.kv { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: var(--fs); }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.kv2 > div { background: var(--surface); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kv2 .k { font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; }
.kv2 .v { font-size: var(--fs); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.timeline { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.timeline .log { border-bottom: 1px solid var(--border); }
.timeline .log:last-child { border-bottom: 0; }

#menu { position: fixed; z-index: 80; min-width: 210px; max-width: 280px; padding: 4px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border-3); box-shadow: var(--shadow-pop); }
[data-theme="light"] #menu { background: var(--surface); }
#menu button { display: flex; align-items: center; gap: 9px; width: 100%; height: 30px; padding: 0 9px; border: 0; background: none; border-radius: 5px; font-size: var(--fs); color: var(--text); text-align: left; white-space: nowrap; }
#menu button .ic { color: var(--text-3); }
#menu button:hover, #menu button:focus-visible { background: var(--active); outline: none; }
#menu button.danger { color: var(--bad); }
#menu button.danger .ic { color: var(--bad); }
#menu button:disabled { opacity: .45; cursor: not-allowed; }
#menu hr { margin: 4px -4px; border-color: var(--border-2); }

#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 95; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 9px; max-width: 380px; padding: 9px 12px; border-radius: var(--r-lg); background: var(--surface-3); border: 1px solid var(--border-3); box-shadow: var(--shadow-pop); font-size: var(--fs); pointer-events: auto; }
[data-theme="light"] .toast { background: var(--surface); }
.toast > .ic { color: var(--ok); margin-top: 1px; }
.toast.err > .ic { color: var(--bad); }

/* command palette */
.cmdk { width: min(600px, calc(100vw - 24px)); margin: 12vh auto auto; border: 1px solid var(--border-3); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-pop); max-height: 70vh; }
.cmdk[open] { display: flex; flex-direction: column; }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--border); height: 48px; flex: none; }
.cmdk-in .ic { color: var(--text-3); }
.cmdk-in input { border: 0; background: none; height: 46px; padding: 0; font-size: var(--fs-md); box-shadow: none !important; }
.cmdk-list { overflow-y: auto; padding: 6px; flex: 1 1 auto; }
.cmdk-g { font-size: var(--fs-xs); color: var(--text-3); padding: 8px 8px 4px; font-weight: 500; }
.cmdk-it { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; background: none; border-radius: var(--r); text-align: left; color: var(--text); font-size: var(--fs); }
.cmdk-it .ic { color: var(--text-3); }
.cmdk-it .hint { margin-left: auto; color: var(--text-3); font-size: var(--fs-sm); }
.cmdk-it[aria-selected="true"] { background: var(--active); }
.cmdk-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-3); flex: none; }

/* ───────── overview ───────── */
.ov { display: grid; gap: 12px; }
.traffic { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.traffic > section { padding: 12px 14px 10px; min-width: 0; }
.traffic > section + section { border-top: 1px solid var(--border); }
.traffic .ch-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.traffic .ch-h h3 { font-size: var(--fs); color: var(--text); font-weight: 600; }
.traffic .ch-h .meta { font-size: var(--fs-sm); color: var(--text-3); }
.ov-lower { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.issues { display: flex; flex-direction: column; }
.issue { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 2px 12px; padding: 9px 14px; border-bottom: 1px solid var(--border); align-items: start; }
.issue:last-child { border-bottom: 0; }
.issue .sev { grid-row: span 2; margin-top: 1px; }
.issue .t { font-weight: 500; color: var(--text); min-width: 0; }
.issue .t .mono { font-weight: 500; }
.issue .c { font-size: var(--fs-sm); color: var(--text-2); min-width: 0; }
.issue .acts { grid-column: 2; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
@container page (min-width: 900px) {
  .issue { grid-template-columns: 20px minmax(0, 1fr) auto; }
  .issue .acts { grid-column: 3; grid-row: 1 / span 2; align-self: center; margin-top: 0; justify-content: flex-end; flex-wrap: nowrap; }
}
.issues-more { display: flex; justify-content: center; padding: 8px; border-top: 1px solid var(--border); }
.sevsum { display: inline-flex; gap: 10px; font-size: var(--fs-sm); color: var(--text-3); }
.sevsum span { display: inline-flex; align-items: center; gap: 5px; }
.logs-mini { container-type: inline-size; container-name: mini; }
.logs-mini .log { border-bottom: 1px solid var(--border); }
@container mini (max-width: 600px) {
  .logs-mini .log { grid-template-columns: 58px 44px minmax(0, 1fr); row-gap: 1px; }
  .logs-mini .log .msg { grid-column: 3; grid-row: 2; }
  .logs-mini .log .src { grid-column: 3; grid-row: 1; }
}
.logs-mini .log:last-child { border-bottom: 0; }

/* ───────── log lines (Logs, overview, drawer) ───────── */
.log { display: grid; grid-template-columns: 64px 46px minmax(70px, 120px) minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 5px 14px; font-size: 12px; line-height: 1.5; min-width: 0; }
.log time { font-family: var(--mono); color: var(--text-3); font-size: 11.5px; white-space: nowrap; }
.log .lv { font-size: 10.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--text-3); }
.log .lv.info { color: var(--text-3); } .log .lv.success { color: var(--ok); } .log .lv.warn { color: var(--warn); } .log .lv.error { color: var(--bad); }
.log .src { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log .src button { all: unset; cursor: pointer; }
.log .src button:hover { text-decoration: underline; color: var(--text); }
.log .msg { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.log.lv-error .msg { color: color-mix(in srgb, var(--bad) 35%, var(--text)); }
.logbox { height: calc(100vh - 230px); min-height: 360px; overflow-y: auto; overscroll-behavior: contain; }
.logbox .log { cursor: pointer; border-bottom: 1px solid transparent; }
.logbox .log:hover { background: var(--hover); }
.logbox .log.open { background: var(--surface-2); border-bottom-color: var(--border); }
.logbox .log.open .msg { white-space: pre-wrap; overflow-wrap: anywhere; }
.logbox .log:focus-visible { outline-offset: -2px; }
.log .more { grid-column: 1 / -1; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; font-size: var(--fs-sm); color: var(--text-3); padding-top: 4px; }
.log-older { display: flex; justify-content: center; padding: 8px; border-bottom: 1px solid var(--border); }
.log-new { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 3; }
.logwrap { position: relative; }
.log-head { display: grid; grid-template-columns: 64px 46px minmax(70px, 120px) minmax(0, 1fr); gap: 10px; padding: 0 14px; height: 30px; align-items: center; font-size: var(--fs-xs); color: var(--text-3); border-bottom: 1px solid var(--border); font-weight: 500; }

/* ───────── proxies ───────── */
.capbar { display: flex; height: 10px; border-radius: 3px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.capbar i { display: block; height: 100%; }
.capbar .used, .capbar-sw.used { background: var(--info); } .capbar .free, .capbar-sw.free { background: color-mix(in srgb, var(--ok) 55%, var(--surface-3)); } .capbar .short, .capbar-sw.short { background: var(--bad); }
.cap-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cap-grid .k { font-size: var(--fs-sm); color: var(--text-3); }
.cap-grid .v { font-size: var(--fs-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.namelist { display: flex; flex-wrap: wrap; gap: 4px; }
.namelist button { all: unset; cursor: pointer; font-size: var(--fs-sm); color: var(--text-2); }
.namelist button:hover { color: var(--text); text-decoration: underline; }
.parse { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r); max-height: 240px; overflow: auto; font-size: var(--fs-sm); }
.parse.free { max-height: none; }
.parse > div { display: grid; grid-template-columns: 16px minmax(0, 1fr) minmax(0, auto); gap: 8px; align-items: center; padding: 5px 10px; border-bottom: 1px solid var(--border); min-width: 0; }
.parse > div:last-child { border-bottom: 0; }
.parse .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parse .why { color: var(--text-2); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ───────── keys ───────── */
.copyk { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--surface-2); }
.copyk span { font-family: var(--mono); font-size: var(--fs-sm); overflow-wrap: anywhere; flex: 1 1 auto; min-width: 0; user-select: all; }
.codebox { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface-2); min-width: 0; }
.codebox .tabs { display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--border); background: var(--surface); }
.codebox .tabs [role="tab"] { height: 26px; padding: 0 9px; border: 0; background: none; color: var(--text-3); font-size: var(--fs-sm); font-weight: 500; border-radius: 4px; }
.codebox .tabs [role="tab"]:hover { color: var(--text); }
.codebox .tabs [role="tab"][aria-selected="true"] { color: var(--text); background: var(--active); }
pre.code { margin: 0; padding: 12px 14px; overflow-x: auto; font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--text); background: var(--surface-2); }
.codebox pre.code { border: 0; border-radius: 0; }
pre.code.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
pre.code:not(.codebox pre) { border: 1px solid var(--border); border-radius: var(--r); }
.j-k { color: #9cc4ff; } .j-s { color: #8fd19e; } .j-n { color: #f0b86e; } .j-b { color: #d2a8ff; }
[data-theme="light"] .j-k { color: #0550ae; } [data-theme="light"] .j-s { color: #116329; } [data-theme="light"] .j-n { color: #953800; } [data-theme="light"] .j-b { color: #8250df; }

/* ───────── settings ───────── */
.set-layout { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 24px; align-items: start; max-width: 1180px; }
.set-nav { position: sticky; top: calc(var(--tb-h) + 16px); display: flex; flex-direction: column; gap: 1px; }
.set-nav a { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; border-radius: var(--r); color: var(--text-2); font-size: var(--fs); font-weight: 500; text-decoration: none; white-space: nowrap; }
.set-nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.set-nav a[aria-current="true"] { background: var(--active); color: var(--text); }
.set-nav a .dot { width: 6px; height: 6px; margin-left: auto; background: var(--warn); }
.set-form { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding-bottom: 64px; }
.set-group { scroll-margin-top: calc(var(--tb-h) + 16px); }
.set-group .panel-h { min-height: 50px; }
.set-group .panel-h p { flex-basis: 100%; font-size: var(--fs-sm); color: var(--text-3); }
.sub-h { padding: 14px 16px 2px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); letter-spacing: .03em; text-transform: uppercase; }
.setting { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 6px 24px; padding: 12px 16px; border-top: 1px solid var(--border); align-items: start; }
.sub-h + .setting { border-top: 0; }
.set-group > .setting:first-of-type, .set-group .panel-h + .setting { border-top: 0; }
.setting .lab { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.setting .lab label, .setting .lab b { font-weight: 500; color: var(--text); font-size: var(--fs); }
.setting .meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.setting .ctl { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.setting .ctl > input[type="text"], .setting .ctl > select, .setting .ctl > .unit { width: 100%; }
.setting .err { grid-column: 1 / -1; font-size: var(--fs-sm); color: var(--bad); }
.setting.changed { box-shadow: inset 2px 0 0 var(--warn); }
.setting.off { opacity: .55; }
.setting.wide { grid-template-columns: minmax(0, 1fr); }
.setting.wide .ctl { justify-content: flex-start; align-items: stretch; }
#pwForm { max-width: 640px; }
.range { display: flex; align-items: center; gap: 6px; width: 100%; }
.range .unit { flex: 1 1 0; }
.range .to { color: var(--text-3); font-size: var(--fs-sm); }
input[type="range"] { flex: 1 1 auto; accent-color: var(--accent); }
output { font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; font-size: var(--fs-sm); color: var(--text-2); }
.estimate { margin: 0 16px 6px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
.estimate b { color: var(--text); font-weight: 600; }
details.adv > summary { cursor: pointer; list-style: none; padding: 12px 16px; border-top: 1px solid var(--border); }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary:hover { color: var(--text); background: var(--hover); }
details.adv[open] > summary { border-bottom: 1px solid var(--border); }
.savebar { position: sticky; bottom: 12px; z-index: 15; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border-3); box-shadow: var(--shadow-pop); flex-wrap: wrap; }
[data-theme="light"] .savebar { background: var(--surface); }
.savebar .dot { background: var(--warn); }
.strength { display: flex; gap: 3px; }
.strength i { flex: 1 1 0; height: 4px; border-radius: 2px; background: var(--surface-3); }
.strength.s1 i:nth-child(-n+1) { background: var(--bad); }
.strength.s2 i:nth-child(-n+2) { background: var(--warn); }
.strength.s3 i:nth-child(-n+3) { background: color-mix(in srgb, var(--ok) 70%, var(--warn)); }
.strength.s4 i { background: var(--ok); }
.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: var(--fs-sm); color: var(--text-3); }
.rules li { display: flex; align-items: center; gap: 7px; }
.rules li .ic { width: 13px; height: 13px; }
.rules li.ok { color: var(--ok); }
.rules li.no { color: var(--text-3); }
.acct-pick { display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow-y: auto; padding: 8px; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--surface-2); width: 100%; }
.acct-pick label { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border: 1px solid var(--border-2); border-radius: 999px; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; background: var(--surface); }
.acct-pick label:has(input:checked) { border-color: var(--accent); color: var(--text); background: var(--sel); }
.acct-pick input { width: 13px; height: 13px; }

/* ───────── docs ───────── */
.docs-top { position: sticky; top: 0; z-index: 20; height: var(--tb-h); display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--border); background: var(--bg); }
.docs-top .sep { width: 1px; height: 18px; background: var(--border-2); }
.docs { display: grid; grid-template-columns: 240px minmax(0, 1fr); max-width: 1180px; margin: 0 auto; }
.toc { position: sticky; top: var(--tb-h); align-self: start; height: calc(100vh - var(--tb-h)); overflow-y: auto; padding: 20px 12px 20px 20px; display: flex; flex-direction: column; gap: 1px; border-right: 1px solid var(--border); }
.toc .g { font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); padding: 14px 8px 4px; letter-spacing: .03em; text-transform: uppercase; }
.toc a { display: block; padding: 5px 8px; border-radius: var(--r); color: var(--text-2); font-size: var(--fs); text-decoration: none; }
.toc a:hover { background: var(--hover); color: var(--text); }
.toc a[aria-current] { background: var(--active); color: var(--text); font-weight: 500; }
.doc { padding: 28px 40px 80px; max-width: 820px; min-width: 0; display: flex; flex-direction: column; gap: 14px; font-size: var(--fs-md); line-height: 1.65; color: var(--text-2); }
.doc h1 { font-size: 26px; color: var(--text); letter-spacing: -.02em; line-height: 1.2; }
.doc h2 { font-size: 18px; color: var(--text); margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); scroll-margin-top: calc(var(--tb-h) + 12px); letter-spacing: -.01em; }
.doc h3 { font-size: var(--fs-md); color: var(--text); margin-top: 6px; }
.doc .lead { font-size: var(--fs-lg); color: var(--text-2); margin-top: 6px; }
.doc b { color: var(--text); font-weight: 600; }
.doc code { font-size: 12.5px; color: var(--text); }
.doc .tw { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); }
.doc table { width: 100%; border-collapse: collapse; font-size: var(--fs); line-height: 1.5; }
.doc th, .doc td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc tr:last-child td { border-bottom: 0; }
.doc th { font-weight: 500; color: var(--text-3); font-size: var(--fs-sm); background: var(--surface); }
.doc td { color: var(--text-2); }
.doc td:first-child { color: var(--text); white-space: nowrap; }
.doc code.wrap { white-space: normal; }
.ep { display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: var(--fs); padding: 6px 10px; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--surface); color: var(--text); align-self: flex-start; }
.ep .m { font-weight: 700; font-size: var(--fs-xs); color: var(--ok); background: var(--ok-bg); border-radius: 4px; padding: 1px 6px; }
.steps3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.steps3 > div { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs); line-height: 1.5; }
.steps3 b { font-size: var(--fs); }
.steps3 .n { font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-3); }
.toc-select { display: none; }
.try { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: 14px; display: flex; flex-direction: column; gap: 12px; font-size: var(--fs); }
.try-row { display: grid; grid-template-columns: 2fr 1.3fr 1fr; gap: 10px; align-items: end; }

/* ───────── layouts by container width ───────── */
@container page (min-width: 700px) {
  .kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .kpis.k6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@container page (min-width: 1000px) {
  .ov-lower { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .cols2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container page (max-width: 999px) {
  .wt { min-width: 0; }
  .wt .c-ping, .wt .c-avg, .wt .c-dim, .wt .c-proxy { display: none; }
  .wt th.c-acct { width: 21%; } .wt th.c-state { width: 21%; } .wt th.c-safe { width: 13%; }
  .wt .wt-dim2 { display: block; }
}
@container page (min-width: 1100px) {
  .kpis.k6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@container page (min-width: 1000px) {
  .traffic { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .traffic > section + section { border-top: 0; border-left: 1px solid var(--border); }
}
@container page (min-width: 1500px) {
  .kpis.k10 { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .ov-lower { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .cols3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ───────── responsive shell ───────── */
@media (max-width: 1100px) {
  :root { --gut: 16px; }
  .kbd-btn { min-width: 0; }
  .kbd-btn .lbl, .kbd-btn kbd { display: none; }
}
@media (max-width: 900px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); }
  .sb { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .18s ease; box-shadow: none; }
  .sb.open { transform: none; box-shadow: var(--shadow-pop); }
  .collapsed .sb .brand-name, .collapsed .sb-env, .collapsed .sb-group, .collapsed .nav .lbl, .collapsed .sb-fleet { display: revert; }
  .collapsed .nav a, .collapsed .nav button { justify-content: flex-start; padding: 0 8px; }
  .collapsed .nav .cnt { position: static; }
  .collapsed .sb-top { padding: 0 12px 0 14px; justify-content: flex-start; }
  .sb .collapse-btn { display: none; }
  .tb .menu-btn { display: inline-flex; }
  .tb .crumb { display: none; }
  .set-layout { grid-template-columns: minmax(0, 1fr); }
  .set-nav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 4px; }
  .set-nav a { flex: none; border: 1px solid var(--border-2); height: 28px; }
  .docs { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .toc-select { display: block; }
  .doc { padding: 20px 16px 60px; }
}
@media (max-width: 640px) {
  :root { --gut: 16px; }
  .tb { gap: 8px; }
  .tb .live .txt-long { display: none; }
  .hide-sm { display: none !important; }
  .status { grid-template-columns: minmax(0, 1fr); }
  .status-main { border-right: 0; border-bottom: 1px solid var(--border); }
  .kpi-v { font-size: 18px; }
  .setting { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .setting .ctl { justify-content: flex-start; }
  .cap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .log, .log-head { grid-template-columns: 56px minmax(0, 1fr); gap: 2px 8px; }
  .log .lv, .log-head .lv { display: none; }
  .log .src { grid-column: 2; }
  .log .msg { grid-column: 1 / -1; white-space: normal; }
  .log-head .src, .log-head .msg { display: none; }
  .logs-mini .log { grid-template-columns: 56px minmax(0, 1fr); }
  .logs-mini .log .src { grid-column: 2; grid-row: 1; }
  .logs-mini .log .msg { grid-column: 1 / -1; grid-row: 2; }
  .logbox { height: calc(100vh - 290px); }
  .steps3 { grid-template-columns: minmax(0, 1fr); }
  .try-row { grid-template-columns: minmax(0, 1fr); }
  .bulkbar { left: 12px; right: 12px; transform: none; bottom: 12px; padding-left: 12px; flex-wrap: nowrap; gap: 4px; justify-content: space-between; }
  .bulkbar .lbl, .bulkbar .div { display: none; }
  .bulkbar b { margin-right: 2px; }
  .kv { grid-template-columns: 110px minmax(0, 1fr); }
  .modal, .modal.narrow, .modal.wide { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .dlg-f .btn { flex: 1 1 auto; }
  .codebar .code { font-size: var(--fs-md); }
  /* tables → compact cards: the main cells full width, the rest as inline "label value" pairs */
  .cards thead { display: none; }
  .cards, .cards tbody { display: block; width: auto; }
  .cards { min-width: 0 !important; table-layout: auto; }
  .cards tr { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 14px; padding: 10px 44px 10px 12px; border-bottom: 1px solid var(--border); }
  .cards tbody tr:last-child { border-bottom: 0; }
  .cards td { display: block; border: 0 !important; padding: 0 !important; height: auto !important; overflow: visible; width: auto; min-width: 0; text-align: left !important; }
  .cards td.c-main { flex: 1 1 100%; }
  .cards td.c-main + td.c-main { margin-top: 2px; margin-bottom: 4px; }
  .cards td[data-l] { display: inline-flex; align-items: baseline; gap: 5px; font-size: var(--fs-sm); max-width: 100%; }
  .cards td[data-l]::before { content: attr(data-l); color: var(--text-3); flex: none; }
  .cards td[data-l] .cellx { flex-direction: row; align-items: baseline; gap: 5px; }
  .cards td[data-l] .sub { font-size: var(--fs-sm); }
  .cards td[data-l] .meter .bar { display: none; }
  .cards td[data-l] .uses { flex-direction: row; gap: 5px; }
  .cards td.c-hide-sm { display: none !important; }
  .cards td.c-cb { position: absolute; left: 12px; top: 12px; }
  .cards tr:has(td.c-cb) { padding-left: 38px; }
  .cards td.c-act { position: absolute; right: 6px; top: 6px; }
  .cards td.c-main .cellx { gap: 3px; }
  .cards tbody tr:hover td { background: none; }
  .cards tr.sel { background: var(--sel); }
  .cards tr.sel td { background: none !important; }
  .cards .clamp2 { -webkit-line-clamp: 3; }
  .toolbar .search { flex: 1 1 160px; }
  .tb .live > span:not(.dot) { display: none; }
  .tb h1 { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
}
@media (min-width: 641px) { .only-sm { display: none !important; } }
@media print { .sb, .tb, .bulkbar, #toasts { display: none !important; } .app { display: block; } }
@media (forced-colors: active) { .dot, .segbar i, .capbar i, .meter .bar i { forced-color-adjust: none; } }
