/* kaps-desk shell (NMS chrome, 4.11): minimal top bar, left tree, and an inset
   rounded workspace panel that each feature owns. No inline styles anywhere
   (CSP style-src 'self'). Cards adapt to their own width with container queries.

   Colours and fonts are a THEME's (desk 5.0.16, docs/KAPS-THEME.md): every page loads /theme.css after
   this file, the variables of the user's theme by the one map shared/protocol/theme.py desk_vars(). The
   :root block below is that map for the built-in Default theme, so a page whose /theme.css did not
   arrive is still a whole page (desk/tests/test_theme_portal.py keeps the two the same). A colour is
   never written as a number below this block: it is a variable of the theme, or one of the three fixed
   ones that are not a theme's to change. */

/* ---- fonts (OFL, files in /static/fonts; the same files the wall board and a Vent carry) */
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 400; font-display: swap; src: url("fonts/BarlowSemiCondensed-Regular.ttf") format("truetype"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 500; font-display: swap; src: url("fonts/BarlowSemiCondensed-Medium.ttf") format("truetype"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-display: swap; src: url("fonts/BarlowSemiCondensed-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 700; font-display: swap; src: url("fonts/BarlowSemiCondensed-Bold.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 100 700; font-display: swap; src: url("fonts/IBMPlexSans-Variable.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("fonts/IBMPlexMono-Regular.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("fonts/IBMPlexMono-Medium.ttf") format("truetype"); }

/* ---- tokens: the built-in Default theme (theme.py desk_vars; /theme.css replaces them) */
:root {
  color-scheme: dark;
  --bg: #0b0a08;
  --bg2: #100e0b;
  --card: #14120e;
  --card2: #1b1812;
  --field: #0b0a08;
  --line: #3a3224;
  --line2: #4a3d26;
  --fg: #f2ece0;
  --muted: #a39886;
  --accent: #c9a25e;
  --accent-dim: rgba(201, 162, 94, 0.14);
  --accent-soft: #7a6236;
  --accent-ink: #1a1200;
  --info: #6fb7d6;
  --ok: #3fb68b;
  --amber: #f08a3c;
  --red: #e5534b;
  --unknown: #8c8473;
  --violet: #b79bea;
  --teal: #4fc4b4;
  --warn: #f08a3c;
  --crit: #e5534b;
  --yellow: #b29958;
  --on-ok: #1a1200;
  --on-amber: #1a1200;
  --on-red: #1a1200;
  --on-info: #1a1200;
  --ok-dim: rgba(63, 182, 139, 0.16);
  --amber-dim: rgba(240, 138, 60, 0.16);
  --red-dim: rgba(229, 83, 75, 0.16);
  --info-dim: rgba(111, 183, 214, 0.16);
  --unknown-dim: rgba(140, 132, 115, 0.18);
  --glass-ws: #0b0a08;
  --glass-bar: #1b1812;
  --overlay: #14120e;
  --overlay-ink: #ffffff;
  --scrim: rgba(0, 0, 0, 0.55);
  --shade: rgba(0, 0, 0, 0.35);
  --shade-2: rgba(0, 0, 0, 0.6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .25);
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --display: "Barlow Semi Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  /* not a theme's: video is shown on black, a QR code is read on white, and a scrim is black */
  --video: #000000; --video-line: #222222; --paper: #ffffff; --paper-ink: #000000;
  /* drawn over a camera picture by a script (KTheme.v): a picture is not the page, so these are not a theme's either */
  --video-ink: #ffffff; --video-ink-2: #cbd5e1; --video-dark: #0b0f14; --video-shade: rgba(0, 0, 0, .62);
  --box-person: #ff5b5b; --box-vehicle: #ffa23a; --box-animal: #ffe14d; --box-bag: #ff5bd6; --box-plain: #4cc3ff;
  --zone-1: #4cc3ff; --zone-2: #ffb24c; --zone-3: #7bd88f; --zone-4: #ff6f91; --zone-5: #c79bff; --zone-6: #ffe76a; --zone-7: #5ee7d8; --zone-8: #ff9f5e;
  --rv-mine: #22d3ee; --rv-todo: #f5a524; --rv-real: #34d399; --rv-fixed: #a78bfa; --rv-nothing: #f87171; --rv-described: #f472b6; --rv-replay: #60a5fa;
  --radius: 10px; --radius-lg: 14px; --radius-sm: 6px;
  --top-h: 48px; --nav-w: 240px; --bottom-h: 58px; --gutter: 12px;
}

/* ---- base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body { margin: 0; height: 100dvh; font: 14px/1.45 var(--font); background: var(--bg); color: var(--fg);
       display: grid; grid-template-rows: calc(var(--top-h) + env(safe-area-inset-top)) minmax(0, 1fr);
       grid-template-columns: var(--nav-w) minmax(0, 1fr); overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 18px; font-weight: 600; margin: 0; letter-spacing: .01em; }
h1 small { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 8px; }
h2 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: .01em; }
h2 small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
h3 { font-size: 12px; font-weight: 600; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
h3 small { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 6px; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 15px; height: 15px; }
[hidden] { display: none !important; }
.num, .tab-num { font-variant-numeric: tabular-nums; }

/* ---- top bar (global only) */
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; padding: env(safe-area-inset-top) 10px 0 8px;
       background: var(--bg); border-bottom: 1px solid var(--line); z-index: 30; }
.top .tb { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; min-width: 34px; padding: 0 8px;
           border: 0; border-radius: 8px; background: transparent; color: var(--fg); font: inherit; cursor: pointer; }
.top .tb:hover, .top .tb:focus-visible { background: var(--accent-dim); outline: none; }
.top .hamb { display: none; }
.brand { display: inline-flex; align-items: center; gap: 8px; margin: 0 10px 0 4px; font-weight: 700; letter-spacing: .16em; color: var(--fg); font-size: 14px; }
.brand .mark { height: 22px; width: auto; max-width: 64px; display: inline-block; object-fit: contain; }   /* the brand's picture (static/brand/<set>/mark.png) */
.searchbtn { flex: 0 1 380px; justify-content: flex-start !important; height: 32px !important; margin: 0 auto;
             color: var(--muted) !important; background: var(--bg2) !important; border: 1px solid var(--line) !important; }
.searchbtn:hover { border-color: var(--line2) !important; color: var(--fg) !important; }
.searchbtn kbd { margin-left: auto; font: 11px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.badge-link { display: inline-flex; align-items: center; height: 34px; padding: 0 6px; border-radius: 8px; }
.badge-link:hover { background: var(--accent-dim); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.amber { background: color-mix(in srgb, var(--amber) 20%, transparent); color: var(--amber); }
.badge.red { background: var(--red); color: var(--on-red); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--red) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .badge.red { animation: none; } }
.acct { color: var(--muted) !important; }
.acct .avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-dim); color: var(--accent); display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; }

/* popover menus (top bar) */
.pop { position: fixed; margin: 0; inset: auto; min-width: 210px; padding: 6px; border: 1px solid var(--line);
       border-radius: var(--radius); background: var(--card); color: var(--fg); box-shadow: var(--shadow); }
.pop a, .pop button.item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 6px; color: var(--fg);
                           background: transparent; border: 0; font: inherit; text-align: left; cursor: pointer; }
.pop a:hover, .pop button.item:hover, .pop a:focus-visible, .pop button.item:focus-visible { background: var(--accent-dim); color: var(--accent); outline: none; }
.pop-head { display: block; padding: 6px 10px 8px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pop-head b { display: block; color: var(--fg); font-size: 13px; }
.pop form { margin: 0; }

/* ---- left tree */
.tree { grid-row: 2; display: flex; flex-direction: column; min-height: 0; background: var(--bg); border-right: 1px solid var(--line); z-index: 25; }
.tree-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px; }
.tsec { margin-bottom: 2px; position: relative; }
.tree-sep { border: 0; border-top: 1px solid var(--line); margin: 8px 10px; }
.tsec > .tlink, .tsec > .thead { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border-radius: 8px;
                                 color: var(--fg); background: transparent; border: 0; font: inherit; font-weight: 500; cursor: pointer; text-align: left; }
.tsec > .tlink:hover, .tsec > .thead:hover { background: var(--accent-dim); }
.tsec.on > .tlink, .tsec.on > .thead { color: var(--accent); }
.tsec.on > .tlink { background: var(--accent-dim); }
.tsec .lbl { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tsec .chev { width: 14px; height: 14px; color: var(--muted); transition: transform .15s; }
.tsec.open .chev { transform: rotate(90deg); }
.kids { display: none; padding: 2px 0 6px 0; }
.tsec.open .kids { display: block; }
.kids a { display: block; padding: 7px 10px 7px 38px; border-radius: 8px; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kids a:hover { color: var(--fg); background: var(--accent-dim); }
.kids a.on { color: var(--accent); background: var(--accent-dim); font-weight: 500; }
.tree-foot { padding: 8px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tree-foot .ver { font: 11px var(--mono); color: var(--muted); padding-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-backdrop { display: none; }


/* ---- workspace panel (the feature owns this) */
.ws { grid-row: 2; grid-column: 2; min-height: 0; min-width: 0; margin: var(--gutter) var(--gutter) var(--gutter) 0;
      background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius-lg);
      display: flex; flex-direction: column; overflow: hidden; }
.ws-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); flex: none;
           background: var(--bg2); }
/* first in the header row of the Network map and graph pages (4.13.38): Back, the Internet map, the Tunnels map.
   Three square buttons, the same size and place on every page that has them. 4.13.39 (Rodney: "50% bigger and
   give them some color"): 48 px, a 27 px icon, and a colour each from the theme (--hb): Back the accent blue,
   Internet teal, Tunnels violet — the icon and the border in the colour on a light wash of it. The map you are
   on is lit: the button filled with its colour, the icon dark on it. */
.ws-nav { display: inline-flex; gap: 9px; flex: none; }
.ws-nav .hb { --hb: var(--accent); display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 12px;
              border: 1px solid color-mix(in srgb, var(--hb) 55%, transparent); background: color-mix(in srgb, var(--hb) 14%, var(--card));
              color: var(--hb); text-decoration: none; }
.ws-nav .hb-internet { --hb: var(--teal); }
.ws-nav .hb-tunnels { --hb: var(--violet); }
.ws-nav .hb:hover, .ws-nav .hb:focus-visible { border-color: var(--hb); background: color-mix(in srgb, var(--hb) 28%, var(--card)); }
.ws-nav .hb.on, .ws-nav .hb.on:hover { color: var(--accent-ink); background: var(--hb); border-color: var(--hb); }
.ws-nav .hb-i { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.ws-title { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
/* a page title that is a link (the device page: the name opens the device's map): the title's own look, the
   accent colour and an underline only under the pointer or the keyboard focus */
.ws-title-link { color: inherit; text-decoration: none; }
.ws-title-link:hover, .ws-title-link:focus-visible { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
/* after a device's name: "on <switch> · port 9", a link to the map of the device it is connected to (4.13.36) */
h1 small.ws-on { white-space: nowrap; }
h1 small.ws-on a { color: var(--accent); text-decoration: none; }
h1 small.ws-on a:hover, h1 small.ws-on a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.crumbs a { color: var(--muted); } .crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: .6; }
.ws-tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--card); border: 1px solid var(--line); border-radius: 9px; }
.ws-tabs a, .ws-tabs button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 6px; border: 0;
                              color: var(--muted); background: transparent; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.ws-tabs a:hover, .ws-tabs button:hover { color: var(--fg); }
.ws-tabs a.on, .ws-tabs button.on, .ws-tabs button.is-on { color: var(--fg); background: var(--bg2); box-shadow: 0 1px 2px var(--shade); }
.ws-tabs .n { font-size: 11px; color: var(--muted); }
.ws-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.ws-actions .btn, .ws-actions .pill { margin: 0; }
.ws-body { flex: 1; min-height: 0; overflow: auto; padding: 16px 18px 20px; }
.ws-bleed .ws-body { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.ws-bleed .ws-head { padding: 8px 14px; }
.ws-note { color: var(--muted); font-size: 13px; margin: 0 0 12px; }

/* ---- cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
        container-type: inline-size; min-width: 0; scroll-margin-top: 12px; }
.card + .card { margin-top: 14px; }
.card.narrow { max-width: 480px; }
.card.is-stale { border-color: color-mix(in srgb, var(--amber) 55%, var(--line)); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.fresh { font: 12px var(--mono); color: var(--muted); }
.fresh.stale { color: var(--amber); }

.dash { display: grid; gap: 14px; grid-template-columns: 1fr; }
.dash .card + .card { margin-top: 0; }
@media (min-width: 760px) { .dash { grid-template-columns: 1fr 1fr; } .dash .wide { grid-column: 1 / -1; } }
@media (min-width: 1360px) { .dash { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); } }

/* alarms */
.alarms { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.alarms a, .alarms .txt-only { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: baseline;
            padding: 9px 12px; border-radius: 8px; color: var(--fg); border-left: 4px solid; background: var(--card2); }
.alarms li { border-radius: 8px; }
.alarms .red a, .alarms .red .txt-only { border-color: var(--red); background: color-mix(in srgb, var(--red) 12%, var(--card2)); }
.alarms .amber a, .alarms .amber .txt-only { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 10%, var(--card2)); }
.alarms .role { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.alarms .txt { min-width: 0; overflow-wrap: anywhere; }
.alarms .when { font: 12px var(--mono); color: var(--muted); white-space: nowrap; }
.alarms a:has(.when) { grid-template-columns: auto 1fr auto; }
@container (max-width: 420px) { .alarms a { grid-template-columns: auto 1fr; } .alarms .txt { grid-column: 1 / -1; }
  .alarms a:has(.when) { grid-template-columns: 1fr auto; } .alarms .when { grid-column: 2; grid-row: 1; } }
.calm { margin: 0; padding: 18px 12px; text-align: center; color: var(--ok); border: 1px dashed color-mix(in srgb, var(--ok) 40%, transparent); border-radius: 8px; }

/* events */
.events { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow-y: auto; }
.ev { display: grid; grid-template-columns: 112px 92px 1fr; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.ev time { font-family: var(--mono); color: var(--muted); font-size: 12px; }
.ev .kind { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-top: 1px; }
.ev .txt { min-width: 0; overflow-wrap: anywhere; }
.ev .site { font-weight: 600; letter-spacing: .02em; }
.ev.red .txt { color: var(--red); } .ev.amber .txt { color: var(--amber); } .ev.green .txt { color: var(--ok); }
@container (max-width: 520px) { .ev { grid-template-columns: 1fr auto; } .ev .txt { grid-column: 1 / -1; } }
.events .more { list-style: none; text-align: center; padding: 10px; }

/* status tiles */
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.tile { display: block; padding: 12px 14px; border-radius: 8px; background: var(--card2); border: 1px solid var(--line); color: var(--fg); }
a.tile:hover { border-color: var(--accent); }
.tile h3 a { color: inherit; }
.tile h3 a:hover, .row-line a.sys:hover { color: var(--accent); }
.row-line a.sys { font-weight: 600; color: var(--fg); }
.tile .big { font-size: 26px; font-weight: 600; margin: 0 0 6px; font-variant-numeric: tabular-nums; }
.tile .big small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.tile p { margin: 4px 0; }
.tile dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 8px 0 0; font-size: 13px; }
.tile dt { color: var(--muted); } .tile dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.row-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0; }
.ok-txt { color: var(--ok); } .red-txt { color: var(--red); } .amber-txt { color: var(--amber); }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.cam-mark { display: inline-flex; align-items: center; vertical-align: middle; margin-right: 4px; color: var(--muted); }
.cam-mark.on { color: var(--ok); }
.cam-mark.dim { opacity: .55; }
.pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 15%, transparent); }
.pill.amber { color: var(--amber); background: color-mix(in srgb, var(--amber) 15%, transparent); }
.pill.red { color: var(--on-red); background: var(--red); }
.pill.orange { color: var(--on-red); background: color-mix(in srgb, var(--amber) 70%, var(--red)); }

/* chips (filters) */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips a { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--fg); font-size: 13px; }
.chips a:hover { border-color: var(--line2); }
.chips a.on { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.alarm-groups { margin-bottom: 8px; }
.alarm-groups .chip { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--fg); font: inherit; font-size: 12px; cursor: pointer; }
.alarm-groups .chip:hover { border-color: var(--line2); }
.alarm-groups .chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.alarm-groups .chip.net-red:not(.on) { color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, var(--line)); }
.alarm-groups .chip .n { opacity: .75; margin-left: 2px; }
.badge .bsep { opacity: .6; }

/* tables: cards below 720px of card width */
.fleet-meta { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table.fleet { width: 100%; border-collapse: collapse; font-size: 13px; }
.fleet th { text-align: left; font-weight: 600; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
            font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
.fleet th a { color: inherit; } .fleet th a.on { color: var(--accent); }
table.sortable thead th:not(:empty) { cursor: pointer; user-select: none; }
table.sortable thead th:not(:empty):hover { color: var(--fg); }
table.sortable thead th.asc::after { content: " \2191"; color: var(--accent); }
table.sortable thead th.desc::after { content: " \2193"; color: var(--accent); }
.table-wrap.stick { max-height: calc(100vh - 250px); overflow: auto; }
.table-wrap.stick thead th { position: sticky; top: 0; z-index: 1; background: var(--card); box-shadow: 0 1px 0 var(--line); }
.fleet tr.hl td { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.fleet tr.hl td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.fleet td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; font-variant-numeric: tabular-nums; }
.fleet tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.fleet td.pkg { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.fleet tr.inactive td { opacity: .55; }
@container (max-width: 720px) {
  .fleet thead { display: none; }
  .fleet, .fleet tbody, .fleet tr, .fleet td { display: block; width: 100%; }
  .fleet tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .fleet td { border: 0; padding: 2px 4px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
  .fleet td::before { content: attr(data-l); flex: 0 0 76px; color: var(--muted); font-size: 12px; }
  .fleet td:not([data-l]) { display: block; }
  .fleet td.wide-only { display: none; }
}

/* forms */
.search-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.search-row input[name="q"] { flex: 1 1 220px; }
.check { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
form.inline { display: inline; margin: 0; }
.btn.danger { background: var(--red); color: var(--on-red); }
.stack { display: grid; gap: 10px; max-width: 360px; }
.stack label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea { padding: 8px 11px; background: var(--bg2); color: var(--fg); border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-dim); border-color: var(--accent); }
input:disabled:not([type=checkbox]):not([type=radio]):not([type=color]),
select:disabled, textarea:disabled, input[readonly], textarea[readonly] {
  background: var(--card2); color: var(--muted); border-style: dashed; cursor: not-allowed;
}
input[type=checkbox]:disabled, input[type=radio]:disabled { opacity: .5; cursor: not-allowed; }
.btn, button[type="submit"] { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; background: var(--accent); color: var(--accent-ink); border: 0;
       border-radius: var(--radius-sm); font: inherit; font-weight: 600; cursor: pointer; line-height: 1.3; }
.btn:hover, button[type="submit"]:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--fg); font-weight: 500; }
.btn.ghost:hover { border-color: var(--line2); background: var(--accent-dim); filter: none; }
.btn.red { background: var(--red); color: var(--on-red); }
.btn.blue { background: var(--info); color: var(--on-info); }
.btn.green { background: var(--ok); color: var(--on-ok); }
.btn.small, .btn.tiny, button.tiny { padding: 3px 9px; font-size: 12px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dlg-backdrop { position: fixed; inset: 0; background: var(--scrim); z-index: 40; }
dialog.acct-dlg { position: fixed; inset: 0; margin: auto; z-index: 41; width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px); overflow: auto; padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: var(--radius); background: var(--card2); color: var(--fg);
  box-shadow: 0 0 0 1px var(--shade), 0 24px 64px var(--shade-2), 0 0 32px color-mix(in srgb, var(--accent) 18%, transparent); }
dialog.acct-dlg::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
dialog.acct-dlg[open] { animation: dlg-in .14s ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { dialog.acct-dlg[open] { animation: none; } }
dialog.acct-dlg h2 { margin: 0 0 10px; }
.acct-info { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 14px; }
.acct-info dt { color: var(--muted); }
.acct-info dd { margin: 0; overflow-wrap: anywhere; }
.acct-form { display: flex; flex-direction: column; gap: 10px; }
.acct-form .btn-row .btn, .acct-form .btn-row button { margin: 0; }

/* ---- search dialog (ctrl+k) */
dialog.search-dlg { position: fixed; inset: 0; margin: 8vh auto auto; width: min(640px, calc(100vw - 24px)); padding: 0; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--card); color: var(--fg); box-shadow: var(--shadow); overflow: hidden; }
dialog.search-dlg::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
.search-dlg form { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); margin: 0; }
.search-dlg input { flex: 1; border: 0; background: transparent; font-size: 16px; padding: 6px 0; }
.search-dlg input:focus { outline: none; }
.search-dlg .results { max-height: 60vh; overflow: auto; padding: 6px; }
.sr-group { padding: 8px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sr { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--fg); }
.sr:hover, .sr:focus-visible { background: var(--accent-dim); outline: none; }
.sr .ic { color: var(--muted); }
.sr .sub { color: var(--muted); font-size: 12px; }
.sr .k { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.sr-empty { padding: 18px; text-align: center; color: var(--muted); }

/* ---- right drawer (alarms) */
.drawer-r { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(420px, 92vw); height: 100dvh; max-height: none; padding: 0; border: 0;
            border-left: 1px solid var(--line); background: var(--bg2); color: var(--fg); overflow: hidden; display: none; flex-direction: column; }
.drawer-r:popover-open { display: flex; }
.drawer-r::backdrop { background: var(--scrim); }
.drawer-r .dr-head { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; border-bottom: 1px solid var(--line); }
.drawer-r .dr-body { flex: 1; overflow: auto; padding: 12px 14px; }
.drawer-r .dr-body .card-head h2 { font-size: 13px; }
/* the one close button desk-wide: white X in a red rounded box (Rodney 2026-11-06) */
.x { width: 28px; height: 28px; border: 0; background: var(--red); position: relative; cursor: pointer; border-radius: 7px; color: var(--on-red); padding: 0; flex: 0 0 auto; }
.x:hover { filter: brightness(1.15); }
.x::before, .x::after { content: ""; position: absolute; left: 8px; top: 13px; width: 12px; height: 2px; background: currentColor; border-radius: 1px; }
.x::before { transform: rotate(45deg); } .x::after { transform: rotate(-45deg); }

/* ---- bottom tab bar (phones) */
.bottom { display: none; }

/* ---- responsive chrome */
@media (max-width: 1023px) {
  body { grid-template-columns: minmax(0, 1fr); }
  .top .hamb { display: inline-flex; }
  .tree { position: fixed; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .18s ease; z-index: 60;
          box-shadow: none; }
  body.nav-open .tree { transform: none; box-shadow: var(--shadow); }
  .tree-scroll { padding-top: calc(8px + env(safe-area-inset-top)); }
  .tree-backdrop { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .18s; }
  body.nav-open .tree-backdrop { opacity: 1; pointer-events: auto; }
  .ws { grid-column: 1; margin-left: var(--gutter); }
  .searchbtn { flex: 0 0 auto; margin-left: auto; }
  .searchbtn .q, .searchbtn kbd { display: none; }
}
@media (max-width: 639px) {
  body { grid-template-rows: calc(var(--top-h) + env(safe-area-inset-top)) minmax(0, 1fr) calc(var(--bottom-h) + env(safe-area-inset-bottom)); }
  .ws { margin: 0; border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; }
  .ws-head { padding: 10px 12px; }
  .ws-body { padding: 12px; }
  .bottom { grid-row: 3; grid-column: 1; display: flex; background: var(--bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 600; }
  .bottom a .ic { width: 20px; height: 20px; }
  .bottom a.on { color: var(--accent); }
  .badge-link .badge { padding: 3px 8px; }
  .badge-link .badge .t { display: none; }
  .brand .word { display: none; }
}

/* ---- View Desk viewer: fills the workspace */
.vbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 6px 12px; background: var(--card); border-bottom: 1px solid var(--line); font-size: 13px; }
.vbar .btn { padding: 5px 12px; }
.vbar select { padding: 4px 8px; }
.vtitle b { color: var(--accent); }
.vstats { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 4px 12px; min-height: 22px; border-bottom: 1px solid var(--line); }
.vstats .mon { font: 12px/1.3 var(--mono); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 5px;
               padding: 2px 8px; white-space: nowrap; width: 26ch; box-sizing: content-box; overflow: hidden; font-variant-numeric: tabular-nums; }
.vstats .mon b { color: var(--accent); font-weight: 600; }
.vstats .mon.dark { color: var(--muted); }
.vstage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; background: var(--video); }
.vtile { position: absolute; background: var(--video); border: 1px solid var(--video-line); box-sizing: border-box; }
.vtile video { width: 100%; height: 100%; object-fit: contain; display: block; background: var(--video); }
.vtile { cursor: zoom-in; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.vstage.focus .vtile { display: none; }
.vstage.focus .vtile.on { display: block; cursor: zoom-out; border: 0; }
body.vfocus .top, body.vfocus .tree, body.vfocus .bottom, body.vfocus .vbar, body.vfocus .vstats, body.vfocus .ws-head { display: none; }
body.vfocus { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); background: var(--video); }
body.vfocus .ws { grid-row: 1; grid-column: 1; margin: 0; border: 0; border-radius: 0; }

/* ---- network colours (pills, chips) */
.pill.net-green { color: var(--ok); background: color-mix(in srgb, var(--ok) 15%, transparent); }
.pill.net-yellow { color: var(--yellow); background: color-mix(in srgb, var(--yellow) 15%, transparent); }
.pill.net-orange { color: var(--amber); background: color-mix(in srgb, var(--amber) 15%, transparent); }
.pill.net-red { color: var(--on-red); background: var(--red); }
.pill.net-unknown { color: var(--muted); border: 1px solid var(--line); }
.chips a.net-red:not(.on) { color: var(--red); }
.chips a.net-orange:not(.on) { color: var(--amber); }
.small { font-size: 12px; }
/* Systems > Learn: job / dataset progress (native element, CSP-safe) and the log tail. */
table.fleet progress { width: 90px; height: 10px; vertical-align: middle; accent-color: var(--accent); }
table.fleet details > summary { cursor: pointer; }
table.fleet details pre { max-width: 520px; max-height: 180px; overflow: auto; white-space: pre-wrap; margin: 4px 0 0; }

/* host detail */
.host-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-bottom: 14px; }
.host-grid .tile dd { overflow-wrap: anywhere; }
.host-grid .pkg { font-family: var(--mono); font-size: 12px; }
table.mini { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 13px; }
table.mini th, table.mini td { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line); }
table.mini th { color: var(--muted); font-weight: 500; }
table.mini tr.inactive td { opacity: .55; }
h3.sect { margin: 18px 0 8px; font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--fg); }
.sect-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 18px 0 8px; }
.sect-head h3.sect { margin: 0; }
.charts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.charts-head { margin: 14px 0 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.tile-scroll { max-height: 260px; overflow-y: auto; }
.tile-scroll table.mini { margin-top: 0; }
.chart { margin: 0; padding: 10px 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 8px; }
.chart figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.chart .ct { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.chart .now { flex: 0 0 auto; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart .now-sep { color: var(--muted); font-weight: 400; margin: 0 .3em; }
.chart .now .unit { font-weight: 400; margin-left: .15em; }
.chart svg rect.zoom { fill: var(--accent); fill-opacity: .18; stroke: var(--accent); stroke-width: 1; vector-effect: non-scaling-stroke; pointer-events: none; }
.chart .plot { cursor: crosshair; }
.chart .plot { display: grid; grid-template-columns: 26px minmax(0, 1fr) 26px; align-items: stretch; }
.chart .rail { display: flex; flex-direction: column; justify-content: space-between; font-size: 9px; line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: none; }
.chart .rail span { height: 0; display: flex; align-items: center; overflow: visible; white-space: nowrap; }
.chart .rail:first-child span { justify-content: flex-start; padding-left: 1px; }
.chart .rail:last-child span { justify-content: flex-end; padding-right: 1px; }
.chart svg { display: block; width: 100%; height: 110px; overflow: visible; }
.chart polyline { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.chart polyline.dot { stroke-width: 5; }
.chart .grid { stroke: var(--line); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.chart .tick { stroke: var(--muted); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.chart .thr { stroke-dasharray: 6 4; stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .7; }
.chart .s1 { color: var(--accent); stroke: var(--accent); }
.chart .s2 { color: var(--amber); stroke: var(--amber); }
.chart .s3 { color: var(--ok); stroke: var(--ok); }
.chart .s4 { color: var(--red); stroke: var(--red); }
.chart .s5 { color: var(--violet); stroke: var(--violet); }
.chart .s6 { color: var(--teal); stroke: var(--teal); }
.chart .axis { display: flex; justify-content: space-between; margin: 3px 26px 0; font-size: 11px; color: var(--muted); }
.chart .legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0 0; font-size: 12px; }
.chart .legend b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--fg); }
.chart .legend .s1::before, .chart .legend .s2::before, .chart .legend .s3::before, .chart .legend .s4::before, .chart .legend .s5::before, .chart .legend .s6::before { content: ""; display: inline-block; width: 10px; height: 3px; margin-right: 5px; vertical-align: middle; background: currentColor; }

/* Network console: phone gets the list card unless the map is forced */
.net-phone { display: none; margin: 12px; }
@media (max-width: 639px) {
  .ws-net:not(.force-map) .ws-body { overflow: auto; display: block; }
  .ws-net:not(.force-map) .net-phone { display: block; }
  .ws-net:not(.force-map) .netmap { display: none; }
}

/* Network forms (Net Device edit, Network settings) */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 16px; margin-top: 10px; }
.form-grid .field { display: grid; gap: 4px; align-content: start; }
.form-grid .field > label { font-size: 13px; color: var(--muted); }
.form-grid .field input:not([type="checkbox"]), .form-grid .field select { width: 100%; }
.form-grid .field textarea { width: 100%; font-family: var(--mono); font-size: 13px; resize: vertical; }
.form-grid .field.is-bad textarea { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.form-grid .field-wide { grid-column: 1 / -1; }
.field-note { color: var(--muted); font-size: 12px; margin: 2px 0; }
.field-note.pre-line { white-space: pre-line; }
/* A field a save refused (is-bad) or one to look at (is-warn): the name takes the color, the sentence sits under the box. */
.form-grid .field.is-bad > label { color: var(--red); font-weight: 600; }
.form-grid .field.is-warn > label { color: var(--amber); font-weight: 600; }
.form-grid .field.is-bad input:not([type="checkbox"]), .form-grid .field.is-bad select { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.form-grid .field.is-warn input:not([type="checkbox"]), .form-grid .field.is-warn select { border-color: var(--amber); }
.field-err { color: var(--red); font-size: 12px; margin: 2px 0; }
.field.is-warn .field-err { color: var(--amber); }
ul.form-problems { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
ul.form-problems li { padding: 7px 10px; border-left: 3px solid var(--red); background: color-mix(in srgb, var(--red) 9%, transparent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
ul.form-problems li.is-warn { border-left-color: var(--amber); background: color-mix(in srgb, var(--amber) 9%, transparent); }
.other-ip-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.autofill-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.set-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.set-row label { flex: 1 1 260px; }
.set-row input:not([type="checkbox"]) { flex: 0 1 320px; }
.cred-table input:not([type="checkbox"]), .cred-table select { width: 100%; min-width: 80px; }
.cred-table input[type="checkbox"] { width: auto; min-width: 0; }
.cred-table td[data-l="Try"], .cred-table td[data-l="On"], .cred-table td:last-child { width: 1%; }
.cred-table td .btn, .cred-table td button { padding: 5px 9px; }
.cred-table td:last-child { white-space: nowrap; }
.cred-table .btn-row { flex-wrap: nowrap; gap: 6px; }
.cred-table td[data-l="On"] { text-align: center; }
.site-group h3 { margin: 16px 0 4px; font-size: 14px; }
.dev-site, .dev-kind { margin: 0; }
.dev-site > summary, .dev-kind > summary { cursor: pointer; padding: 8px 0; display: flex; align-items: center; gap: 8px; }
.dev-kind { margin: 0 0 8px 18px; }
.dev-kind > summary { font-size: 13px; }
.fleet tr.is-saved td { background: color-mix(in srgb, var(--ok) 14%, transparent); }

/* ---- AI pages: alerts, identities, teach, watchlist, plates, health */
.mono { font-family: var(--mono); font-size: 12px; }
.plain { list-style: none; margin: 0; padding: 0; } .plain li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.plain li:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; margin: 0; } .kv dd { margin: 0; }
.thumb { display: block; width: 96px; height: 96px; object-fit: cover; border-radius: 8px; background: var(--card2); border: 1px solid var(--line); }
.thumb.md { width: 128px; height: 128px; } .thumb.lg { width: 140px; height: 140px; } .thumb.xl { width: 220px; height: 220px; }
.thumb.none { display: block; background: repeating-linear-gradient(45deg, var(--card2) 0 8px, var(--card) 8px 16px); }
.pill.cls { background: var(--accent-dim); color: var(--accent); text-transform: capitalize; }
.pill.cls.person { color: var(--amber); background: var(--amber-dim); }
.pill.cls.vehicle { color: var(--info); background: var(--info-dim); }
.pill.cls.animal { color: var(--ok); background: var(--ok-dim); }
.pill.cls.bag { color: var(--violet); background: color-mix(in srgb, var(--violet) 16%, transparent); }
.pill.live { color: var(--on-red); background: var(--red); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .pill.live { animation: none; } }
.pill.muted-pill { color: var(--muted); background: var(--card2); border: 1px solid var(--line); font-weight: 400; }
.pill.clip { color: var(--fg); background: var(--card2); border: 1px solid var(--accent); }
.alarm-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.alarm { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 10px; border-radius: 8px;
         background: var(--card2); border: 1px solid var(--line); border-left-width: 4px; }
.alarm.live { border-left-color: var(--red); }
.alarm.dz-danger { border-left-color: var(--red); background: color-mix(in srgb, var(--red) 10%, var(--card2)); }
.alarm.dz-suspicious { border-left-color: var(--amber); }
.alarm.acked { opacity: .65; }
.alarm-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.alarm-title { font-weight: 600; color: var(--fg); font-size: 15px; }
.alarm-meta { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.alarm-cap { margin: 6px 0 0; font-size: 14px; } .alarm-cap.big { font-size: 16px; margin: 10px 0; }
.alarm-act .btn { margin: 0; }
.cam { color: inherit; }
.cams { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
video.clip { display: block; width: 100%; max-width: 960px; aspect-ratio: 16 / 9; background: var(--video); border-radius: 8px; }
.strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.still-fig { margin: 0; flex: 0 0 auto; text-align: center; font-size: 12px; color: var(--muted); }
.still-fig figcaption { margin-top: 4px; } .still-fig form { display: block; margin-top: 2px; }
.id-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-top: 10px; }
.id-tile { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 8px; border-radius: 8px; background: var(--card2);
           border: 1px solid var(--line); color: var(--fg); align-items: start; }
.id-tile.watch { border-color: var(--red); } .id-tile.state-rejected, .id-tile.state-merged { opacity: .5; }
.id-tile.state-confirmed { border-left: 4px solid var(--ok); }
.id-body b { display: inline-block; margin-right: 6px; } .id-body p { margin: 4px 0 0; font-size: 13px; }
.id-body .btn-row { margin-top: 6px; }
.id-detail { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.id-facts dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 8px 0 0; font-size: 14px; }
.id-facts dt { color: var(--muted); } .id-facts dd { margin: 0; }
.teach-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.teach-form { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 8px; background: var(--card2); border: 1px solid var(--line); }
.teach-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.teach-form input, .teach-form textarea { width: 100%; }
.teach-form .btn, .teach-form button { align-self: flex-start; margin: 0; }
.teach-form p { margin: 0; font-size: 12px; }
.tiny-in { width: 110px; padding: 3px 6px; }
.plate-add input { flex: 1 1 160px; }
.fleet td.cap { max-width: 420px; }
.fleet td input[name="notes"] { width: 160px; padding: 3px 6px; }
.fleet td input[name="note"] { width: 240px; padding: 3px 6px; }   /* Inventory > Camera models (W42) */
.site-head { margin: 14px 0 4px; font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--fg); }
/* AI › Judge review (W35): the stills | local beside Claude | the rulings */
.jlist { display: flex; flex-direction: column; gap: 10px; }
.jcard { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; padding: 10px; border-radius: 8px;
         background: var(--card2); border: 1px solid var(--line); border-left: 4px solid var(--line2); }
.jcard.ruled { border-left-color: var(--ok); } .jcard.ruled .jstills, .jcard.ruled .jcols { opacity: .6; }
.jcard.st-approved { border-left-color: var(--ok); } .jcard.st-rejected { border-left-color: var(--red); opacity: .7; }
.jstills { display: flex; flex-direction: column; gap: 8px; } .jstills a { position: relative; display: block; }
.jframe { display: block; width: 320px; height: 180px; object-fit: contain; border-radius: 8px; background: var(--video); border: 1px solid var(--line); }
.jpart { position: absolute; left: 6px; bottom: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; color: var(--overlay-ink); background: color-mix(in srgb, var(--overlay) 70%, transparent); }
.jcols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.jcols.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.jcol { min-width: 0; padding: 8px 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); }
.jcol h4 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.jcol h4 small { margin-left: 6px; text-transform: none; letter-spacing: 0; } .jcol p { margin: 4px 0 0; font-size: 13px; }
.jchips { display: flex; flex-wrap: wrap; gap: 4px; }
.jchips span { padding: 1px 8px; border-radius: 999px; font-size: 12px; color: var(--muted); border: 1px solid var(--line); }
.jul { margin: 0; padding-left: 16px; font-size: 13px; } .jul li { padding: 1px 0; }
.jrule { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 0; }
.jrule .btn { margin: 0; } .jrule .btn.on { background: var(--ok); color: var(--on-ok); }
.jq { min-width: 96px; font-size: 13px; color: var(--muted); } .jby { margin: 6px 0 0; font-size: 12px; }
.jpages { margin-top: 12px; } .jfilter .chips + .chips, .jfilter .muted + .chips { margin-top: 8px; } .jfilter .chips + .muted { margin: 8px 0 0; } .chips small { color: var(--muted); margin-left: 4px; } .chip-gap { flex: 0 0 14px; }
/* a still opened over the page (app.js, a[data-zoom]) */
.zoombox { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 12px;
           background: color-mix(in srgb, var(--video) 92%, transparent); cursor: zoom-out; }
.zoombox img { max-width: 100%; max-height: 100%; min-width: min(60vh, 90vw); object-fit: contain; image-rendering: auto; border-radius: 8px; }
a[data-zoom] { cursor: zoom-in; }
/* Judge > Truth set (W39): one item at a time, the crop beside the frame, big answer buttons */
.tsets { margin-top: 8px; }
.tprog { display: block; width: 100%; height: 8px; margin-top: 10px; accent-color: var(--ok); }
.tcard { border-left: 4px solid var(--line2); } .tcard.ruled { border-left-color: var(--ok); }
.tcard .alarm-head { align-items: center; } .tgap { flex: 1; }
.tview { display: grid; grid-template-columns: minmax(200px, 360px) 1fr; gap: 14px; align-items: start; margin-top: 10px; }
.tcrop img { display: block; width: 100%; max-height: 560px; object-fit: contain; border-radius: 8px; background: var(--video); border: 1px solid var(--line); }
.tframe { min-width: 0; } .tclip { margin-top: 10px; max-width: 1280px; }
.trule { margin-top: 12px; } .trule .btn-row .btn { margin: 0; padding: 9px 16px; font-size: 15px; }
.trule .btn.on { background: var(--ok); color: var(--on-ok); } .trule .jby .btn { padding: 3px 9px; font-size: 12px; }
.trule kbd { margin-right: 6px; font: 11px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.trule .btn.on kbd { color: var(--on-ok); border-color: color-mix(in srgb, var(--on-ok) 50%, transparent); }
.tq { margin: 12px 0 6px; font-weight: 600; } .tq small { font-weight: 400; margin-left: 6px; }
.tradio label { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.tradio label:has(input:checked) { border-color: var(--ok); background: var(--accent-dim); }
.tnote { margin-top: 12px; } .tnote input[type="text"] { flex: 1 1 280px; max-width: 520px; }
@media (max-width: 899px) {
  .jcard { grid-template-columns: 1fr; } .tview { grid-template-columns: 1fr; } .tcrop img { max-height: 320px; } .jstills { flex-direction: row; flex-wrap: wrap; } .jcols { grid-template-columns: 1fr; }
  .jframe { width: 100%; max-width: 320px; height: auto; aspect-ratio: 16 / 9; }
}
@media (max-width: 639px) {
  .alarm { grid-template-columns: auto 1fr; } .alarm-act { grid-column: 1 / -1; }
  .thumb.lg { width: 96px; height: 96px; } .thumb.xl { width: 160px; height: 160px; }
  .id-grid { grid-template-columns: 1fr; }
}
/* KAPS AI chat (W29): conversation + composer | evidence rail. Same JSON widgets as the Horizon
   window; colours are the theme tokens only. */
.aic-page .ws-body { display: flex; flex-direction: column; }
#aic { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 62fr) minmax(280px, 38fr); gap: 12px; }
#aic .card { margin: 0; display: flex; flex-direction: column; min-height: 0; }
.aic-log { flex: 1; overflow: auto; padding: 4px 6px 8px 2px; }
.aic-empty h3 { margin: 6px 0 4px; }
.aic-empty .chips { margin-top: 10px; }
.aic-sug { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--fg); font-size: 13px; cursor: pointer; }
.aic-sug:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.aic-m { margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.aic-m.user { display: flex; justify-content: flex-end; border: 0; padding-bottom: 0; margin-bottom: 10px; }
.aic-bubble { max-width: 72%; margin: 0; padding: 8px 14px; border-radius: 14px; background: var(--card2); border: 1px solid var(--line); white-space: pre-wrap; }
.aic-steps { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.aic-step { display: flex; align-items: center; gap: 8px; line-height: 1.6; }
.aic-step .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.aic-step.bad { color: var(--red); } .aic-step.bad .dot { background: var(--red); }
.aic-text { font-size: 16px; line-height: 1.55; }
.aic-text p { margin: 0 0 4px; } .aic-text p.bullet { padding-left: 16px; } .aic-text p.bullet::before { content: "·"; margin-left: -12px; margin-right: 6px; color: var(--muted); }
.aic-cursor { color: var(--accent); animation: aic-blink 1s steps(2) infinite; } @keyframes aic-blink { to { opacity: 0; } }
.aic-chip { display: inline-block; margin: 0 4px 2px 0; padding: 1px 9px; border-radius: 7px; border: 0; background: var(--accent-dim); color: var(--accent); font-size: 13px; cursor: pointer; vertical-align: baseline; }
.aic-chip:hover { filter: brightness(1.15); }
.aic-chips { margin-top: 6px; }
.aic-m .aic-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.aic-composer { display: flex; gap: 8px; margin-top: 10px; align-items: stretch; }
.aic-composer textarea { flex: 1; resize: none; padding: 10px 12px; font: inherit; font-size: 15px; border-radius: 8px; min-height: 58px; }
.aic-composer .btn { margin: 0; min-width: 84px; }
.aic-rail { overflow: hidden; }
.aic-rail h3 { margin: 0 0 8px; }
#aic-rail { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; }
.aic-card { position: relative; padding: 10px; border-radius: 10px; background: var(--card2); border: 1px solid var(--line); cursor: pointer; }
.aic-card:hover { border-color: var(--line2); }
.aic-card.flash { outline: 2px solid var(--accent); }
.aic-card h4 { margin: 0 0 2px; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aic-card h4.mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em; }
.aic-sub, .aic-meta, .aic-body, .aic-result { margin: 0; font-size: 12px; color: var(--muted); }
.aic-body { color: var(--fg); margin-top: 2px; }
.aic-card.watch .aic-meta { color: var(--red); }
.aic-thumb { display: block; position: relative; overflow: hidden; border-radius: 6px; background: var(--video); }
.aic-media .aic-thumb { aspect-ratio: 16 / 9; margin-bottom: 8px; }
.aic-media .aic-thumb img, .aic-media .aic-thumb video { width: 100%; height: 100%; object-fit: contain; display: block; }
.aic-side { display: grid; grid-template-columns: 96px 1fr; gap: 10px; }
.aic-thumb.sq { width: 96px; height: 96px; } .aic-thumb.sq img { width: 100%; height: 100%; object-fit: cover; }
.aic-card.zoom .aic-thumb.sq { width: 100%; height: auto; aspect-ratio: 1; grid-column: 1 / -1; }
.aic-card.zoom.aic-side { grid-template-columns: 1fr; }
.aic-badge { position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; }
.aic-badge.red { top: 6px; bottom: auto; background: var(--red); color: var(--on-red); }
.aic-clip.playing img, .aic-clip.playing .aic-badge { display: none; }
/* Hover honesty (Rodney 2026-11-06): the pointer hand only where a click does something; images say what it does.
   Live video never plays in the browser — only on a KAPS Vent — so a live card says so and refreshes its still instead. */
.aic-card { cursor: default; }
.aic-card .aic-thumb { cursor: zoom-in; }
.aic-card.zoom .aic-thumb { cursor: zoom-out; }
.aic-card .aic-clip { cursor: pointer; }
.aic-card[data-kind="action_card"], .aic-card[data-kind="table"], .aic-card[data-kind="chart"], .aic-card[data-kind="entity_state"] { cursor: default; }
.aic-card[data-kind="alarm_card"] .aic-thumb, .aic-card[data-kind="identity_card"], .aic-card[data-kind="plate_card"], .aic-card[data-kind="site_card"] { cursor: pointer; }
.aic-thumb::after { content: attr(data-hover); position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 8px; background: color-mix(in srgb, var(--overlay) 82%, transparent); color: var(--overlay-ink); font-size: 11px; line-height: 1.3; opacity: 0; transition: opacity .12s; pointer-events: none; }
.aic-thumb:hover::after { opacity: 1; }
.aic-thumb:not([data-hover])::after, .aic-clip.playing::after { display: none; }
.aic-card.dz-danger { border-left: 4px solid var(--red); } .aic-card.dz-suspicious { border-left: 4px solid var(--amber); }
.aic-state { margin: 4px 0 2px; font-size: 22px; font-weight: 600; }
.aic-actions { display: flex; gap: 8px; margin-top: 8px; } .aic-actions .btn { margin: 0; }
.aic-action[data-state="done"] .aic-result { color: var(--ok); } .aic-action[data-state="failed"] .aic-result { color: var(--red); }
.aic-table { overflow: auto; max-height: 220px; margin-top: 6px; }
.aic-table table { width: 100%; border-collapse: collapse; font-size: 12px; }
.aic-table th, .aic-table td { padding: 2px 6px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.aic-chart { width: 100%; height: auto; margin-top: 6px; background: var(--card); border-radius: 6px; }
.aic-chart polyline { fill: none; stroke-width: 2; }
.aic-chart .s0 { stroke: var(--accent); fill: var(--accent); } .aic-chart .s1 { stroke: var(--amber); fill: var(--amber); } .aic-chart .s2 { stroke: var(--ok); fill: var(--ok); }
.aic-chart .s3 { stroke: var(--red); fill: var(--red); } .aic-chart .s4, .aic-chart .s5 { stroke: var(--muted); fill: var(--muted); }
.aic-chart text { font-size: 10px; stroke: none; } .aic-chart .axis { fill: var(--muted); }
.aic-toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); padding: 8px 16px; border-radius: 8px; background: var(--card); border: 1px solid var(--line2); color: var(--amber); font-size: 14px; opacity: 0; transition: .2s; pointer-events: none; z-index: 50; }
.aic-toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 900px) {
  #aic { grid-template-columns: 1fr; }
  .aic-page .ws-body { display: block; }
  .aic-log { max-height: 55vh; }
  #aic-rail { max-height: 50vh; }
}

/* ---- bare pages (login / password): same tokens, centred card */
body.bare { display: flex; align-items: flex-start; justify-content: center; overflow: auto; }
.bare main { width: min(380px, calc(100vw - 32px)); margin: 16vh 0 40px; padding: 26px 28px; background: var(--card); border: 1px solid var(--line);
             border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.bare h1.brand { display: flex; justify-content: center; margin: 0 0 18px; font-size: 20px; letter-spacing: .18em; text-transform: uppercase; }
.bare .brand-logo { display: block; margin: 0 auto 14px; max-width: 200px; max-height: 96px; object-fit: contain; }
.bare .brand-tag { margin: -12px 0 18px; text-align: center; color: var(--muted); font-size: 12px; letter-spacing: .08em; }
.bare label { display: block; margin: 10px 0; font-size: 13px; color: var(--muted); }
.bare input { display: block; width: 100%; margin-top: 4px; }
.bare button[type="submit"], .bare .btn { margin-top: 12px; }
.bare form.login button[type="submit"] { width: 100%; justify-content: center; }
.bare .err { color: var(--red); margin: 0 0 8px; }
.bare .ok { color: var(--ok); margin: 0 0 8px; }
.bare .btn.pwa { display: flex; width: 100%; justify-content: center; margin-top: 18px; }
.bare .pwa-ios { margin: 18px 0 0; font-size: 13px; }
.bare dialog.mfa label.check { display: flex; gap: 8px; align-items: center; margin: 10px 0 0; }
.bare dialog.mfa label.check input { display: inline-block; width: auto; margin: 0; }
.bare dialog.mfa form.inline { display: inline; }
.bare dialog.mfa form.inline .btn { margin-top: 12px; }
.mfa-qr { background: var(--paper); display: inline-block; padding: 6px; border-radius: 6px; margin: 6px 0; }
.mfa-qr svg { display: block; width: 180px; height: 180px; }
.mfa-key { user-select: all; letter-spacing: .06em; }
.mfa-codes { font: 15px/1.6 ui-monospace, monospace; background: var(--bg2); padding: 10px 14px; border-radius: 6px; user-select: all; }
.bare .pwa-x { margin: 0 0 0 6px; padding: 0; background: none; border: 0; color: var(--accent); text-decoration: underline; font: inherit; cursor: pointer; }
.bare dialog.pwchange { position: fixed; inset: 0; margin: auto; max-width: 360px; width: calc(100% - 32px); padding: 24px 28px; background: var(--card);
  color: var(--fg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 0 0 100vmax var(--shade-2); }
.bare dialog.pwchange h2 { font-size: 17px; margin: 0 0 8px; }

/* Fleet > Packages & Deploy (control plane) */
.fleet-pkgs .fleet-pkg-select { max-width: 320px; margin-bottom: 6px; }
.fleet-pkgs .fleet-pkg-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.fleet-pkgs .fleet-pkg-actions .btn { margin: 0; }
.fleet-pkgs .fleet-pkg-hint { color: var(--muted); font-family: var(--mono); font-size: 11px; margin-top: 2px; }
.fleet-pkgs .fleet-pkg-cell { min-width: 340px; }
.fleet-pkgs .fleet-only { display: block; color: var(--muted); font-size: 12px; margin: -2px 0 6px; }
.fleet-pkgs .fleet-only input { vertical-align: middle; margin-right: 4px; }
.fleet-pkgs .fleet-shared { margin-top: 4px; font-size: 11px; }
dialog.fleet-dlg p { margin: 0 0 14px; overflow-wrap: anywhere; }
.fleet-pkgs .fleet-status { white-space: normal; }
.fleet-pkgs .fleet-sys-table td:last-child { min-width: 150px; }
/* Fleet > Sites (Live View twin) */
.live-ic { display: inline-flex; align-items: center; vertical-align: middle; margin-right: 6px; color: var(--muted); }
.live-ic:hover { color: var(--accent); }
.sites-table .mono { font-family: var(--mono, ui-monospace, monospace); font-size: 12px; }
.swatch { vertical-align: middle; }
.charts-sites { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1200px) { .charts-sites { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } }
.chart svg.swatch { display: inline-block; width: 10px; height: 4px; vertical-align: middle; margin-right: 4px; }
/* Security forms (Users / Certificates / Tokens / Network access) */
.acct-form > label:not(.check) { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.acct-form textarea { font-family: var(--mono, ui-monospace, monospace); font-size: 12px; min-height: 120px; }
dialog.acct-dlg.wide { width: min(760px, calc(100vw - 24px)); }
.sec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.sec-kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.sec-kv dt { color: var(--muted); } .sec-kv dd { margin: 0; overflow-wrap: anywhere; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input[type=text] { padding: 5px 8px; }
.btn.red { background: var(--red); color: var(--on-red); }
.btn.sm { padding: 2px 8px; font-size: 12px; }
details.card > summary { cursor: pointer; list-style: revert; margin: -4px 0; }
details.card[open] > summary { margin-bottom: 10px; }
.sec-grid h4 { margin: 0 0 4px; }
.tok-plain { display: inline-block; padding: 8px 10px; background: var(--card2); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 14px; overflow-wrap: anywhere; user-select: all; }

/* ---- Sites editor (control-plane Phase 2): color picker, trigger chips, contacts ---- */
.graph-swatch { display: inline-flex; width: 18px; height: 18px; padding: 3px; border: 1.5px solid transparent; border-radius: 50%;
  background: transparent; flex: 0 0 auto; cursor: pointer; box-sizing: border-box; }
.graph-swatch::after { content: ""; display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--swatch, var(--muted)); }
.graph-swatch.is-on { border-color: var(--fg); }
.graph-color-menu .graph-swatch.is-used { border-color: var(--muted); }
.graph-color-menu .graph-swatch.is-dup { border-color: var(--red); }
.graph-color-menu .graph-swatch.is-on, .graph-color-toggle .graph-swatch.is-on { border-width: 2px; border-color: var(--ok); }
.graph-color-menu .graph-swatch.is-on.is-dup, .graph-color-toggle .graph-swatch.is-on.is-dup { border-color: var(--red); }
.graph-color-toggle, .trigger-picker-toggle { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 32px 6px 10px;
  border: 1px solid var(--line); background: var(--card2, var(--bg2)); color: var(--fg); border-radius: 6px; cursor: pointer; list-style: none; position: relative; }
.graph-color-toggle::-webkit-details-marker, .trigger-picker-toggle::-webkit-details-marker { display: none; }
.graph-color-toggle::marker, .trigger-picker-toggle::marker { content: ""; }
.graph-color-toggle::after, .trigger-picker-toggle::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px;
  border-right: 1.5px solid var(--fg); border-bottom: 1.5px solid var(--fg); transform: translateY(-70%) rotate(45deg); }
.graph-color-picker[open] .graph-color-toggle::after, .trigger-picker[open] .trigger-picker-toggle::after { transform: translateY(-20%) rotate(-135deg); }
.graph-color-menu { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; margin-top: 8px; padding: 12px;
  border: 1px solid var(--line); background: var(--card); border-radius: 6px; }
.graph-color-menu .graph-swatch { width: 100%; height: auto; aspect-ratio: 1; padding: 15%; }
.trigger-picker-field { min-width: 0; }
.trigger-picker { display: block; min-width: 0; max-width: 100%; }
.trigger-picker-summary { display: block; min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trigger-picker-menu { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; padding: 12px; border: 1px solid var(--line); background: var(--card); border-radius: 6px; }
.trigger-chip { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 5px 12px; border: 1px solid var(--line);
  background: var(--card2, var(--bg2)); color: var(--muted); border-radius: 999px; font: inherit; font-size: 13px; line-height: 20px; cursor: pointer; }
.trigger-chip input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.trigger-chip.is-on, .trigger-chip:has(input:checked) { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.trigger-chip-mark { width: 7px; height: 7px; flex: 0 0 auto; transform: rotate(45deg); background: var(--ok); }
.trigger-chip-mark.is-pending { background: var(--unknown); }
.trigger-chip-all-on { background: var(--ok); color: var(--on-ok); border-color: var(--ok); }
.trigger-chip-all-off { background: var(--red); color: var(--on-red); border-color: var(--red); }
.contact-card { line-height: 20px; min-height: 20px; }
.contact-card div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.form-grid .field-wide.btn-row { grid-column: 1 / -1; }
.sync-mode { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; margin: 0 0 10px; display: grid; gap: 6px; }
.sync-mode legend { color: var(--muted); font-size: 13px; padding: 0 4px; }
.sync-mode .check { align-items: flex-start; }
.sync-log { height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); padding: 8px 10px; font-size: 12.5px; line-height: 18px; margin-bottom: 10px; }
.sync-log-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.sync-log-line.is-ok { color: var(--ok); }
.sync-log-line.is-error { color: var(--red); }
.sync-log-line.is-muted { color: var(--muted); }
.trigger-chip.is-site-on .trigger-chip-mark { background: var(--ok); }
.form-grid .form-title { margin: 8px 0 0; font-size: 14px; color: var(--muted); font-weight: 600; border-top: 1px solid var(--line); padding-top: 10px; }
/* Systems › Magma GPU slots */
.sys-gpus { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 14px; }
.sys-gpus .field-note { grid-column: 1 / -1; }
.sys-gpu { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--card2); display: grid; gap: 8px; }
.sys-gpu-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sys-gpu-head select { width: auto; min-width: 90px; }
.sys-gpu-head .check { margin-left: auto; }
.sys-gpu-facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.sys-gpu-facts .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync-counts { display: flex; gap: 14px; font-weight: 600; }
.sync-counts span:empty { display: none; }
.sync-removals { margin: 4px 0 10px; padding-left: 18px; max-height: 30vh; overflow: auto; }
.btn-row .ok-txt { margin: 0; align-self: center; }

/* ---- Settings (registry groups): label + help left, control right */
.sreg-card { max-width: 1100px; }
.sreg-search input { width: 220px; }
.sreg-h { margin: 18px 0 2px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.sreg-row { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 6px 24px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 80px; }
.sreg-row:last-of-type { border-bottom: 0; }
.sreg-row.is-target { background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 6px; }
.sreg-text label, .sreg-text > a { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: var(--fg); }
.sreg-dot { width: 7px; height: 7px; border-radius: 50%; background: transparent; border: 1px solid transparent; flex: none; }
.is-changed .sreg-dot, .field-note .sreg-dot { background: var(--accent); border-color: var(--accent); display: inline-block; }
.field-note .sreg-dot { vertical-align: middle; margin: 0 2px; }
.sreg-help { margin: 4px 0 0; color: var(--fg); opacity: .82; font-size: 13px; line-height: 19px; max-width: 70ch; }
.sreg-meta { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.sreg-ctl { display: grid; gap: 6px; justify-items: stretch; padding-top: 2px; }
.sreg-ctl input:not([type="checkbox"]), .sreg-ctl select, .sreg-ctl textarea { width: 100%; }
.sreg-ctl textarea { font-family: var(--mono); font-size: 12px; min-height: 64px; resize: vertical; }
.sreg-ctl input:disabled, .sreg-ctl select:disabled, .sreg-ctl textarea:disabled { opacity: .7; }
.sreg-check { font-size: 14px; color: var(--fg); min-height: 36px; }
.sreg-sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; font-size: 13px; }
.sreg-sites .check { min-height: 28px; }
.sreg-check input { width: 18px; height: 18px; }
.sreg-reset { justify-self: start; padding: 3px 9px; font-size: 12px; }
.sreg-actions { position: sticky; bottom: 0; margin: 10px -16px -14px; padding: 12px 16px; background: var(--card); border-top: 1px solid var(--line); }
.sreg-val { justify-items: end; }
@media (max-width: 760px) {
  .sreg-row { grid-template-columns: 1fr; }
  .sreg-search input { width: 100%; }
}

/* ---- Systems › Vents editor (ported from Caldera vent_edit; desk tokens) */
.vent-checks { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.vent-optional { color: var(--muted); font-size: 12px; }
.vent-monitors { grid-column: 1 / -1; display: grid; gap: 14px; margin: 8px 0 0; width: 100%; }
.vent-monitor { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card2); padding: 12px 12px 8px; }
.vent-monitor-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.vent-monitor-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: start; }
.vent-monitor-row > .field { flex: 0 0 auto; min-width: 0; }
.vent-monitor-title { margin: 0 0 6px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.vent-primary-ui-control { display: flex; align-items: center; gap: 6px; min-height: 2.25rem; margin: 0; }
.vent-primary-ui-control input[type="checkbox"] { width: auto; margin: 0; cursor: pointer; }
.vent-gpu-rows { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; width: 100%; }
.vent-gpu-row { display: grid; grid-template-columns: minmax(14rem, 1.6fr) minmax(12rem, 1.4fr) minmax(7rem, .8fr) minmax(9rem, 1fr); gap: 8px 12px; align-items: end; }
.vent-gpu-row .field { margin: 0; min-width: 0; }
.vent-gpu-row .field label { font-size: 11px; letter-spacing: .03em; color: var(--muted); }
.vent-gpu-row input { width: 100%; }
#horizon-ui-edit, #horizon-wall-mosaics { grid-column: 1 / -1; width: 100%; min-width: 0; }
.vent-hui-monitors { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; width: 100%; }
.vent-hui-monitor { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card2); width: 100%; }
.vent-hui-mon-title { margin: 0 0 8px; }
.vent-hui-monitor .vent-monitor-head { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.vent-hui-row-a, .vent-hui-row-b { display: grid; gap: 8px 12px; align-items: end; margin: 0; width: 100%; }
.vent-hui-row-a { grid-template-columns: minmax(8rem, 1fr) minmax(16rem, 2.2fr) minmax(7rem, .9fr) minmax(5rem, .7fr); }
.vent-hui-row-b { grid-template-columns: 6.5rem 6.5rem minmax(14rem, 1.5fr) minmax(11rem, 1.2fr); }
.vent-hui-row-a .field, .vent-hui-row-b .field { display: grid; gap: 4px; min-width: 0; }
.vent-hui-row-a .field label, .vent-hui-row-b .field label { font-size: 12px; color: var(--muted); }
.vent-hui-row-a input, .vent-hui-row-b input, .vent-hui-row-b select { width: 100%; }
.vent-hui-format-val { color: var(--muted); font-size: 12px; margin-left: 6px; }
.vent-canvas-builder { grid-column: 1 / -1; margin: 8px 0 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card2); width: 100%; }
.vent-canvas-title { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.vent-canvas-hint { color: var(--muted); font-size: 12px; margin: 0; }
.vent-canvas-workspace { overflow-x: auto; overflow-y: hidden; margin-top: 10px; padding: 10px; min-height: 440px; width: 100%; background: var(--glass-ws); border-radius: var(--radius-sm); display: block; }
.vent-canvas-stage { position: relative; min-width: 280px; min-height: 160px;
  background: linear-gradient(color-mix(in srgb, var(--fg) 7%, transparent) 1px, transparent 1px) 0 0 / 16px 16px,
              linear-gradient(90deg, color-mix(in srgb, var(--fg) 7%, transparent) 1px, transparent 1px) 0 0 / 16px 16px; }
.vent-canvas-stage.is-invalid { outline: 2px solid var(--red); }
.vent-canvas-bbox { position: absolute; border: 2px solid var(--fg); pointer-events: none; z-index: 1; }
.vent-canvas-tile { position: absolute; z-index: 2; display: flex; align-items: center; justify-content: center; border: 0; outline: none;
  background: color-mix(in srgb, var(--info) 38%, var(--glass-ws)); color: var(--fg); font-size: 12px; font-weight: 600; cursor: grab; user-select: none; }
.vent-canvas-tile.gpu-2 { background: color-mix(in srgb, var(--ok) 38%, var(--glass-ws)); }
.vent-canvas-tile.is-island { background: color-mix(in srgb, var(--red) 48%, var(--glass-ws)); }
.vent-wall-mosaic { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card2); padding: 10px 12px; margin: 0 0 10px; }
.vent-wall-mosaic-title { margin: 0 0 8px; }
.vent-wall-mosaic-format { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin-bottom: 8px; }
.vent-wall-mosaic-format .field { display: grid; gap: 4px; }
.vent-wall-mosaic-format .field label { font-size: 12px; color: var(--muted); }
.vent-wall-format-none .vent-pane-grid { display: none; }
.vent-pane-grid { display: grid; gap: 8px; margin: 4px 0 8px; }
.vent-pane-grid[data-size="0"] { grid-template-columns: minmax(0, 1fr); }
.vent-pane-grid[data-size="1"] { grid-template-columns: minmax(0, 22rem); }
.vent-pane-grid[data-size="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.vent-pane-grid[data-size="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.vent-pane-grid[data-size="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.vent-pane-grid[data-size="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.vent-pane-grid[data-size="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.vent-pane { min-width: 0; }
.vent-pane-rc { display: block; margin-bottom: 4px; letter-spacing: .04em; color: var(--muted); font-size: 11px; }
.vent-pane-controls { display: flex; flex-wrap: nowrap; gap: 4px; align-items: stretch; width: 100%; margin: 4px 0 8px; }
.vent-pane-controls > .vent-pane-fit, .vent-pane-controls > .vent-pane-stream { flex: 1 1 0; width: 0; min-width: 0; margin: 0; padding: 2px 4px; font-size: 11px; line-height: 1.2; }
.vent-pane-controls > .vent-pane-stream:disabled { opacity: .45; }
.vent-pane.is-stream-n .vent-chip { opacity: .55; }
.vent-chip { display: block; width: 100%; margin: 0 0 4px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card);
  color: var(--fg); text-align: left; cursor: pointer; min-height: 44px; font: inherit; }
.vent-chip:hover:not(:disabled) { border-color: var(--accent); }
.vent-chip:disabled { cursor: default; }
.vent-chip-id { display: block; font-weight: 600; }
.vent-chip-name { display: block; color: var(--accent); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; line-height: 16px; }
.vent-pane.is-none .vent-chip { color: var(--muted); background: var(--bg2); border-color: var(--line); }
.vent-pane.is-none .vent-chip-name { color: inherit; }
.vent-chip.is-stream-off .vent-chip-id { opacity: .72; }
.vent-pane-empty { margin: 0 0 8px; color: var(--muted); }
dialog.vent-picker { position: fixed; inset: 0; margin: auto; z-index: 41; border: 1px solid var(--line2); border-radius: var(--radius-lg); background: var(--card); color: var(--fg);
  padding: 20px; width: min(36rem, calc(100vw - 24px)); max-height: min(36rem, calc(100vh - 24px)); box-shadow: 0 0 0 1px var(--accent-dim), var(--shadow); }
dialog.vent-picker[open] { display: flex; flex-direction: column; }
dialog.vent-picker::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
.vent-picker-where { margin: 0 0 12px; font-weight: 600; }
.vent-picker .field { margin-bottom: 8px; }
.vent-picker .field input { width: 100%; }
.vent-picker-list { flex: 1 1 auto; min-height: 12rem; max-height: 22rem; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 0 12px; background: var(--bg2); }
.vent-picker-site { padding: 8px 10px 4px; color: var(--fg); font-weight: 700; position: sticky; top: 0; background: var(--bg2); }
.vent-picker-cam { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-top: 1px solid var(--line); background: transparent; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.vent-picker-cam:hover { background: var(--card); }
.vent-picker-cam-label { min-width: 0; }
.vent-picker-cam-used { color: var(--muted); font-size: 12px; white-space: nowrap; }
.vent-picker-cam-current { color: var(--ok); font-weight: 700; white-space: nowrap; }
.vent-picker-cam.is-stream-off .vent-picker-cam-label { opacity: .72; }
.vent-picker-empty { margin: 12px 10px; color: var(--muted); }
dialog.vent-fill-dialog { position: fixed; inset: 0; margin: auto; z-index: 41; border: 1px solid var(--line2); border-radius: var(--radius-lg); background: var(--card); color: var(--fg);
  padding: 20px; width: min(44rem, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 0 0 1px var(--accent-dim), var(--shadow); }
dialog.vent-fill-dialog[open] { display: flex; flex-direction: column; gap: 8px; overflow: auto; }
dialog.vent-fill-dialog::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
#mosaic-fill-path-block { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 10px; }
@media (max-width: 640px) { #mosaic-fill-path-block { grid-template-columns: 1fr; } }
.vent-fill-title { margin: 0 0 4px; font-size: 16px; }
.vent-fill-msg { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.vent-fill-msg.is-error { color: var(--red); }
.vent-fill-section { border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 0 8px; padding: 8px 10px 10px; background: var(--card2); }
.vent-fill-section legend { padding: 0 4px; font-weight: 600; font-size: 13px; }
.vent-fill-section .check { display: flex; align-items: center; justify-content: flex-start; gap: 8px; margin: 4px 0; color: var(--fg); font-size: 13px; }
.vent-fill-section .check input[type="radio"], .vent-fill-section .check input[type="checkbox"] { width: 16px; height: 16px; flex: none; margin: 0; }
.vent-fill-section .field { display: grid; gap: 4px; margin: 6px 0; }
.vent-fill-section .field label { font-size: 12px; color: var(--muted); }
.vent-fill-section select, .vent-fill-section input[type="text"], .vent-fill-section input[type="number"] { width: 100%; }
.vent-fill-start-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.vent-fill-actions { margin-top: 4px; }
.vent-fill-copy-list { flex: 1 1 auto; min-height: 8rem; max-height: 18rem; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg2); margin: 0 0 12px; }
.vent-fill-copy-row { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--fg); padding: 10px 12px; cursor: pointer; font: inherit; }
.vent-fill-copy-row:hover { background: var(--card); }
.vent-fill-copy-row:last-child { border-bottom: 0; }
.vent-snap { margin: 0 0 12px; }
.vent-snap-head { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; }
.vent-snap-head h2 { margin: 0; }
.vent-snap-msg { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.vent-snap-msg.is-error { color: var(--red); }
.vent-snap-empty { margin: 0; color: var(--muted); font-size: 13px; }
.vent-snap-set { margin: 0 0 12px; }
.vent-snap-set-head { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.vent-snap-thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.vent-snap-thumb { position: relative; width: 160px; }
.vent-snap-thumb img { display: block; width: 160px; height: 90px; object-fit: cover; background: var(--video); cursor: zoom-in; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.vent-snap-thumb span { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.vent-snap-del-one { position: absolute; top: 4px; right: 4px; padding: 0 6px; min-width: 0; line-height: 1.4; }
.vent-snap-fs { position: fixed; inset: 0; z-index: 1000; background: var(--video); display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.vent-snap-fs img { max-width: 100vw; max-height: 100vh; object-fit: contain; pointer-events: none; }
.vent-form .field.is-invalid input, .vent-form .field.is-invalid select { border-color: var(--red); }

/* ---- Assist (Home Assistant instances / entities / events) */
.inline-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.inline-filter select, .inline-filter input { padding: 4px 8px; font-size: 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card2); color: var(--fg); }
.inline-filter input[type="search"], .inline-filter input[type="text"] { min-width: 160px; }
table.fleet.small { font-size: 12px; }
.row-form { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.row-form + .row-form { margin-top: 6px; }
/* The controls of a row read as controls (Rodney 2026-12-01): the page's own text size and a border that shows on
   the card. An entity's actions are one button each; the one whose state the entity is in now is lit and bold. */
.row-form select, .row-form input { padding: 3px 8px; font-size: 13px; font-weight: 500; border: 1px solid var(--line2); border-radius: var(--radius-sm); background: var(--bg2); color: var(--fg); }
.row-form select:hover, .row-form input:hover, .row-form .btn.ghost:hover { border-color: var(--accent); }
.row-form input[type="text"] { width: 110px; }
.row-form .btn { padding: 3px 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.row-form .btn.ghost { border-color: var(--line2); }
.row-form.act .btn { min-width: 46px; justify-content: center; }
.row-form.act .btn.ghost { font-weight: 500; }
.row-form.act .btn.cur { font-weight: 700; }
.fleet th:last-child { white-space: normal; }   /* a long heading over row forms wraps: it never widens the table */
.wrap-any { overflow-wrap: anywhere; }          /* an entity id has no blank to break at */

/* Systems > Learn: job curves + teacher spend bars */
.charts-one { grid-template-columns: minmax(0, 1fr); }
.chart.bars rect { stroke: none; }
.chart.bars rect.s1 { fill: var(--accent); }
.chart.bars rect.s4 { fill: var(--muted); }
.chart.bars rect.s2 { fill: var(--amber); }
.chart.bars rect.s3 { fill: var(--ok); }
.chart.bars rect.s5 { fill: var(--violet); }
.chart.bars rect.s6 { fill: var(--teal); }
/* lane strip (who held each card, when): the lanes' names in the left rail, spread as the lanes are; time left to right */
.chart.lanes rect.lane { fill: var(--line); fill-opacity: .35; }
.chart.lanes rect.s4 { fill: var(--red); }
.chart.lanes .rail:first-child { justify-content: space-around; }
.chart.lanes .axis { justify-content: space-between; }
.chart.lanes .plot { cursor: default; grid-template-columns: 44px minmax(0, 1fr) 26px; }
.chart.lanes .axis { margin-left: 44px; }
/* a run's phases as one bar: where its time went (Systems > Learn, Jobs). An SVG: widths are attributes (CSP) */
svg.phasebar { display: block; width: 100%; min-width: 120px; max-width: 260px; height: 6px; margin: 3px 0 2px; border-radius: 3px; background: var(--line); }
svg.phasebar .s1 { fill: var(--accent); } svg.phasebar .s2 { fill: var(--amber); } svg.phasebar .s3 { fill: var(--ok); }
svg.phasebar .s4 { fill: var(--red); } svg.phasebar .s5 { fill: var(--violet); } svg.phasebar .s6 { fill: var(--teal); }
span.ph { white-space: nowrap; }
span.ph::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; background: currentColor; }
span.ph.s1 { color: var(--accent); } span.ph.s2 { color: var(--amber); } span.ph.s3 { color: var(--ok); }
span.ph.s4 { color: var(--red); } span.ph.s5 { color: var(--violet); } span.ph.s6 { color: var(--teal); }
span.ph > i { font-style: normal; color: var(--fg); }
/* a folded section: one line, opened by a click (app.js keeps it as it was left across the 10 s refresh) */
details.fold > summary { cursor: pointer; padding: 8px 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
details.fold > summary h3.sect { display: inline; margin: 0; }
details.fold[open] > summary { margin-bottom: 6px; }
.chart.bars .axis { display: flex; justify-content: space-around; }

/* Tephra Live View (W34): the Loaded tile takes two grid columns where there is room */
@media (min-width: 900px) { .host-grid .tile-wide { grid-column: span 2; } }
.host-grid .tile-wide .tile-scroll { max-height: 440px; }

/* AI data sheet (W34) */
table.sheet td { vertical-align: top; overflow-wrap: anywhere; }
@media (min-width: 900px) {   /* the same columns in every section, so GPU / Models / Tools / Services line up */
  table.sheet { table-layout: fixed; }
  table.sheet th:nth-child(1) { width: 25%; } table.sheet th:nth-child(2) { width: 16%; } table.sheet th:nth-child(3) { width: 19%; }
  table.sheet th:nth-child(4), table.sheet th:nth-child(5) { width: 9%; } table.sheet th:nth-child(6) { width: 22%; }
}
table.sheet .sheet-v { color: var(--fg); }
.charts-head small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.card-head h3.sect { margin: 0; }
.nowrap { white-space: nowrap; }
