/* ── Reset & Base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Tells the browser which native UA chrome to use for form controls it
     draws itself (select dropdown popups, checkboxes, scrollbars, date
     pickers) — without this, the dark theme's own CSS colors a <select>'s
     closed-state text, but the OS still renders its native open dropdown/
     option list and other native widgets with LIGHT-mode defaults, which is
     why those looked black-on-dark instead of following the theme. */
  color-scheme: light;
  /* ════════════════════════════════════════════════════
     LIGHT THEME (default). Dark theme overrides live in
     html[data-theme="dark"] below. Only theme-specific
     tokens are duplicated there; the scales below
     (spacing/type/radius/motion/fonts) are theme-agnostic.
     ════════════════════════════════════════════════════ */

  /* ── Surfaces (Explorer: airy bg, white panels, rail fills) ── */
  --bg:        #faf8f5;          /* page background */
  --bg-grid:   #f4f1ec;
  --surface:   #ffffff;          /* cards */
  --surface2:  #f6f3ee;          /* rail — subtle raised / hover fill */
  --surface-3: #ece7e0;
  --overlay:   rgba(17, 20, 24, 0.45);

  /* ── Borders ──────────────────────────────────────── */
  --border:      #e8e2da;
  --border-soft: #efe9e2;
  --rule:        #ded6cc;
  --rule-2:      #cfc6ba;

  /* ── Text ─────────────────────────────────────────── */
  --text:        #1c1a18;
  --text-2:      #534e47;
  --muted:       #6d675e;        /* WCAG AA: 5.6:1 on white, 5.3:1 on bg */
  --text-faint:  #787167;        /* WCAG AA: 4.8:1 — used for placeholders/meta, must stay legible */

  /* ── Signal — brand accent (crimson #d82747) ──────── */
  /* Brand: AIO coral (#F9674E) primary + periwinkle (#7A80F6) secondary,
     per aioapp.com. The coral→periwinkle gradient is the brand signature. */
  --accent:        #f9674e;       /* brand coral — FILLS only (buttons, gradient, focus) */
  --accent-h:      #ec4f33;       /* hover: deeper coral */
  --accent-soft:   rgba(249, 103, 78, 0.10);
  --accent-edge:   rgba(249, 103, 78, 0.34);
  --accent-ink:    #ffffff;       /* text on brand fill */
  /* Coral as TEXT/links: the brand fill #f9674e is only 3:1 on white, so links use a
     darkened coral that clears AA (4.6:1) while staying on-brand. */
  --accent-text:   #cf4529;
  --ring:          0 0 0 3px rgba(249, 103, 78, 0.30);
  --accent-2:      #7a80f6;       /* secondary — periwinkle */
  --accent-2-soft: rgba(122, 128, 246, 0.12);
  --brand-grad:    linear-gradient(92deg, #f9674e 0%, #7a80f6 100%);

  /* ── Semantic (darkened for contrast on white) ────── */
  --ok:        #0f6d33;           /* AA on the 10% wash used by status pills */
  --warn:      #8f4209;
  --danger:    #b42318;           /* brick red — distinct from brand crimson */
  --info:      #1a63c0;
  --ok-bg:     rgba(21, 127, 60, 0.10);
  --warn-bg:   rgba(180, 83, 9, 0.10);
  --danger-bg: rgba(180, 35, 24, 0.10);
  --info-bg:   rgba(29, 111, 216, 0.10);
  --ok-edge:     rgba(21, 127, 60, 0.30);
  --warn-edge:   rgba(180, 83, 9, 0.28);
  --danger-edge: rgba(180, 35, 24, 0.30);
  --info-edge:   rgba(29, 111, 216, 0.28);

  /* ── Chart palette (data-viz, not UI accent) ──────── */
  --chart-battery: #2563eb;
  --chart-temp:    #ea580c;
  --chart-ram:     #15803d;
  --chart-grid:    rgba(16, 24, 40, 0.08);
  --chart-tick:    #687078;

  /* ── Elevation / interaction (theme-specific) ─────── */
  --shadow-sm:  0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md:  0 2px 8px rgba(16, 24, 40, 0.08);
  --shadow-lg:  0 8px 24px rgba(16, 24, 40, 0.12);
  --shadow-pop: 0 10px 30px rgba(16, 24, 40, 0.16);
  --hover:      rgba(16, 24, 40, 0.04);    /* row/control hover wash */
  --selected:   var(--accent-soft);        /* selection highlight */
  --page-glow:  none;                      /* ambient body wash */

  /* ── Console surfaces (logcat/shell — follow the theme;
        dark values live in the dark block below) ─────── */
  --console-bg:      #f6f7f9;
  --console-surface: #ffffff;
  --console-text:    #2c333c;
  --console-border:  #e2e6eb;

  /* ── Spacing scale (8px baseline) ─────────────────── */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 28px; --s-8: 32px;
  --s-9: 36px; --s-10: 40px;

  /* ── Type scale ───────────────────────────────────── */
  --t-10: 10px; --t-11: 11px; --t-12: 12px; --t-13: 13px;
  --t-14: 14px; --t-16: 16px; --t-18: 18px; --t-22: 22px;
  --leading-tight:  1.2;
  --leading-normal: 1.45;
  --leading-loose:  1.6;
  --fw-normal:    400;
  --fw-medium:    500;
  --fw-semibold:  600;
  --fw-bold:      700;

  /* ── Radius (Explorer: 6 chips · 9 controls · 14 cards) ── */
  --r-1: 3px; --r-2: 6px; --r-3: 9px; --r-4: 14px;
  --radius:    var(--r-3);          /* legacy alias */

  /* ── Motion ───────────────────────────────────────── */
  --dur-fast:   100ms;
  --dur:        140ms;
  --dur-slow:   220ms;
  --ease:       cubic-bezier(.2, .6, .2, 1);
  --ease-in:    cubic-bezier(.4, 0, 1, 1);
  --ease-out:   cubic-bezier(0, 0, .2, 1);

  /* ── Type families ────────────────────────────────── */
  --font:      'IBM Plex Sans', 'Manrope', system-ui, sans-serif;
  /* Display = same sans as body; the Fraunces serif is retired by preference
     (headings and big numbers all use IBM Plex Sans). */
  --font-display: 'IBM Plex Sans', 'Manrope', system-ui, sans-serif;
  --mono:      'JetBrains Mono', 'IBM Plex Mono', 'Fira Code', monospace;
}

/* ════════════════════════════════════════════════════════
   DARK THEME — overrides only the theme-specific tokens.
   ════════════════════════════════════════════════════════ */
html[data-theme="dark"] {
  color-scheme: dark;
  /* Surfaces — a near-black bg (#0b0d10, ~4% luminance) paired with near-white
     text (#e7ebf0, ~88%) put contrast well above what's comfortable for a UI
     meant to be read for long stretches (~15:1 — closer to a AAA-max spec-sheet
     number than a usable one; Material/GitHub/Linear-style dark themes deliberately
     stay off true black and off near-white for this reason). Lifted the floor and
     lowered the ceiling: a dark charcoal bg, a dimmer off-white for text, and more
     separation between bg/surface so cards read as distinct panels instead of
     nearly merging into the page. */
  --bg:        #16181c;
  --bg-grid:   #191c21;
  --surface:   #1e2127;
  --surface2:  #262a31;
  --surface-3: #2f343c;
  --overlay:   rgba(0, 0, 0, 0.58);

  /* Borders */
  --border:      #333941;
  --border-soft: #262b32;
  --rule:        #3d4450;
  --rule-2:      #4c5462;

  /* Text */
  --text:        #d7dce2;
  --text-2:      #aab1bc;
  --muted:       #8992a0;
  --text-faint:  #838a99;        /* WCAG AA: ~4.7:1 on surface */

  /* Brand accent — AIO coral, dimmed slightly off the neon end so it reads as a
     brand color rather than glowing against the darker bg. */
  --accent:        #f9805f;
  --accent-h:      #ffa088;
  --accent-soft:   rgba(249, 128, 95, 0.14);
  --accent-edge:   rgba(249, 128, 95, 0.36);
  --accent-ink:    #ffffff;      /* text on brand-coral fills — white throughout, per request */
  --accent-text:   #f9805f;      /* clears AA as text on the new, lighter surfaces */
  --ring:          0 0 0 2px rgba(249, 128, 95, 0.45);
  --accent-2:      #99a1f2;
  --accent-2-soft: rgba(153, 161, 242, 0.16);
  --brand-grad:    linear-gradient(92deg, #f9805f 0%, #99a1f2 100%);

  /* Semantic — same dimming pass so status colors read as information, not neon */
  --ok:        #55bd75;
  --warn:      #dba33a;
  --danger:    #e07575;
  --info:      #6ba3f0;
  --ok-bg:     rgba(85, 189, 117, 0.12);
  --warn-bg:   rgba(219, 163, 58, 0.12);
  --danger-bg: rgba(224, 117, 117, 0.12);
  --info-bg:   rgba(107, 163, 240, 0.12);
  --ok-edge:     rgba(85, 189, 117, 0.32);
  --warn-edge:   rgba(219, 163, 58, 0.32);
  --danger-edge: rgba(224, 117, 117, 0.32);
  --info-edge:   rgba(107, 163, 240, 0.32);

  /* Charts */
  --chart-battery: #6ba3f0;
  --chart-temp:    #f28654;
  --chart-ram:     #55bd75;
  --chart-grid:    rgba(61, 68, 80, 0.7);
  --chart-tick:    #838a9c;

  /* Elevation / interaction — shadows eased off slightly since the lighter bg
     needs less raw darkness to read as depth. */
  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.26);
  --shadow-md:  0 2px 8px rgba(0, 0, 0, 0.30);
  --shadow-lg:  0 8px 24px rgba(0, 0, 0, 0.38);
  --shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.48);
  --hover:      rgba(255, 255, 255, 0.05);
  --selected:   var(--accent-soft);
  --page-glow:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(244, 63, 99, 0.05) 0%, transparent 70%),
    radial-gradient(ellipse 40% 50% at 20% 80%, rgba(244, 63, 99, 0.035) 0%, transparent 70%);

  /* Console surfaces — kept closer to true black on purpose (a terminal reads as
     a terminal), just enough lifted to avoid a pure #000 void. */
  --console-bg:      #121519;
  --console-surface: #181c22;
  --console-text:    #d6dbe2;
  --console-border:  #2c333d;
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  position: relative;
}

/* ── Focus ring (keyboard only) ──────────────────────── */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-2);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
  box-shadow: var(--ring);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--page-glow);
  opacity: 0.6;
}

body > nav,
body > main {
  position: relative;
  z-index: 1;
}
/* NB: .modal-backdrop must NOT get position:relative here — it is a direct child of
   <body>, and relative positioning would drop the overlay into the document flow
   (the "What's new" popup rendered inline instead of above content). It keeps its
   own position:fixed; z-index:100 from the .modal-backdrop rule below. */

/* View Transitions: htmx wraps every swap in document.startViewTransition()
   (globalViewTransitions, set in layout.html). Keep the crossfade short so the
   app feels snappy rather than animated. Because the header/dock DOM is identical
   across a boosted swap, only <main> visibly crossfades. */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 130ms;
  animation-timing-function: ease;
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* Dock layout: full-width canvas; leave room at the bottom for the floating dock. */
body.has-dock { padding-left: 0; }
body.has-dock .container { padding-bottom: 104px; }

/* ── Responsive convention ─────────────────────────────
 * Two canonical breakpoints are used throughout this file:
 *   @media (max-width: 1024px)  → TABLET: multi-pane grids collapse
 *                                 to a single column; rails go static.
 *   @media (max-width: 640px)   → PHONE:  dense row-grids restack into
 *                                 cards; appbar condenses; padding tightens.
 * Keep new responsive rules on these two breakpoints. Dense mono/log
 * surfaces (logcat, shell, JSON/diff dumps) scroll horizontally via
 * `.scroll-x` rather than restacking.
 * ────────────────────────────────────────────────────── */

/* Never let raster media force horizontal page scroll on small screens.
 * (SVGs are sized explicitly throughout the UI, so they're left alone.) */
img, video, canvas { max-width: 100%; }
/* Form controls with fixed px widths must not overflow narrow viewports. */
input, select, textarea { max-width: 100%; }

/* Reusable horizontal-scroll wrapper for content that must not wrap
 * (wide tables, monospace consoles). Wrap the element, not the page. */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--accent-h); }

/* Visually-hidden but screen-reader-available (for icon-button names, group labels). */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Skip-to-content link: off-screen until focused, then pinned top-left (WCAG 2.4.1).
   With a persistent appbar + nav dock, this lets keyboard users jump straight to <main>. */
.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 1000;
  transform: translateY(-140%); transition: transform var(--dur, .15s) ease;
  background: var(--surface); color: var(--accent-text);
  border: 1px solid var(--accent); border-radius: 8px; padding: 8px 14px;
  font-weight: var(--fw-medium, 600); box-shadow: var(--shadow-pop);
}
.skip-link:focus-visible { transform: translateY(0); outline: none; box-shadow: var(--ring); }

/* ── Navbar ──────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 220px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 16px 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 20;
  overflow-y: auto;
}
.navbar > form { width: 100%; }

.navbar-top {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: 10px;
}
.navbar-brand {
  font-family: var(--font);
  font-weight: var(--fw-semibold);
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--text);
  padding: 6px 10px;
  flex: 1 1 auto;
  min-width: 0;
  transition: opacity var(--dur) var(--ease);
}
.navbar-brand:hover { opacity: 0.85; }
/* Wordmark: AIO MDM in Poppins (the brand font) — "AIO" in the brand
   gradient, "Hub" in a calm grey. */
.brand-aio, .brand-hub { font-family: 'Poppins', var(--font); letter-spacing: -0.01em; }
.brand-aio {
  font-weight: 700;
  /* periwinkle → coral, matching the AIO MDM logo */
  background: linear-gradient(90deg, #7a80f6 0%, #f9674e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.brand-hub { font-weight: 600; color: var(--muted); }
html[data-theme="dark"] .brand-hub { color: #fff; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--s-2);
  border-radius: var(--r-2);
  transition: background var(--dur) var(--ease);
}
.nav-toggle:hover { background: var(--surface2); }
.nav-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--muted);
  border-radius: 1px;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
  transform-origin: center;
}
.nav-toggle:hover span { background: var(--text); }
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); background: var(--text); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); background: var(--text); }

.navbar-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: stretch;
  height: auto;
}
.nav-link {
  color: var(--muted);
  font-family: var(--font);
  font-size: var(--t-13);
  font-weight: var(--fw-medium);
  padding: 9px 10px;
  border-radius: var(--r-3);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  position: relative;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav-link:hover { color: var(--text); background: var(--hover); }
.nav-link.active {
  color: var(--accent-text);
  background: var(--accent-soft);
  font-weight: var(--fw-semibold);
}
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  margin-left: 2px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: var(--fw-semibold);
  line-height: 1;
}

/* ── Nav sections ────────────────────────────────────
 * The sidebar is grouped into labelled domains (Monitor / Inventory /
 * Deploy / Admin) so a 14-item list reads as four short ones.
 */
.nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-section + .nav-section { margin-top: 0; }
.nav-section-label {
  margin: 0 0 4px;
  padding: 0 10px;
  font-size: var(--t-10);
  font-weight: var(--fw-semibold);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
}

/* ── Command palette trigger (sidebar) ──────────────── */
.nav-cmdk {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  margin-bottom: 12px;
  padding: 7px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  color: var(--muted);
  font-family: var(--font);
  font-size: var(--t-12);
  cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.nav-cmdk:hover { color: var(--text); border-color: var(--rule-2); background: var(--surface); }
.nav-cmdk .ui-icon { flex: 0 0 12px; }
.nav-cmdk-label { flex: 1; text-align: left; }
.nav-cmdk-kbd,
.cmdk-esc {
  font-family: var(--mono);
  font-size: var(--t-10);
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-1);
  padding: 1px 5px;
  line-height: 1.4;
}

/* ── Command palette overlay ───────────────────────── */
.cmdk-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 16px 16px;
  background: rgba(16, 24, 40, 0.32);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
/* The `hidden` attribute must win over display:flex, or the invisible
   overlay would sit on top of the page and swallow every click. */
.cmdk-backdrop[hidden] { display: none; }
.cmdk-backdrop.open { opacity: 1; }
.cmdk-panel {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  transform: translateY(-6px);
  transition: transform var(--dur) var(--ease);
}
.cmdk-backdrop.open .cmdk-panel { transform: translateY(0); }
.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.cmdk-input-icon { color: var(--muted); flex: 0 0 14px; }
.cmdk-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t-15, 15px);
  padding: 4px 2px;
}
/* The field is the bordered row; suppress the global focus ring on the bare
   input so it doesn't hug the text. */
.cmdk-input:focus,
.cmdk-input:focus-visible { outline: none; box-shadow: none; }
.cmdk-input::placeholder { color: var(--muted); }
.cmdk-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 52vh;
  overflow-y: auto;
}
.cmdk-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 9px 10px;
  border-radius: var(--r-2);
  cursor: pointer;
  color: var(--text);
}
.cmdk-item.active { background: var(--accent-soft); }
.cmdk-item.active .cmdk-item-label { color: var(--accent-text); font-weight: var(--fw-medium); }
.cmdk-item-label { font-size: var(--t-13); }
.cmdk-item-sub {
  font-size: var(--t-10);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  flex: 0 0 auto;
}
.cmdk-item-sub-device { color: var(--accent-text); }
.cmdk-empty {
  padding: 18px 16px;
  text-align: center;
  color: var(--muted);
  font-size: var(--t-13);
}

@media (prefers-reduced-motion: reduce) {
  .cmdk-backdrop, .cmdk-panel { transition: none; }
  .cmdk-backdrop.open .cmdk-panel { transform: none; }
}

/* ── Tiered confirm dialog ───────────────────────────── */
.mdm-confirm-body { margin: 0; font-size: var(--t-14, 14px); color: var(--text); line-height: 1.5; }
.mdm-confirm-scope {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--r-2);
  background: var(--surface2);
  color: var(--muted);
  font-size: var(--t-13);
  line-height: 1.45;
}
.mdm-confirm-type { margin-top: 12px; }
/* .form-row sets display:flex, which would override the `hidden` attribute, so
   the type-to-confirm field must be hidden explicitly when not in use. */
.mdm-confirm-type[hidden] { display: none; }
.mdm-confirm-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-2); margin-top: 18px; }

/* ── Admin tools links (Settings) ────────────────────── */
.admin-tool {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.admin-tool:hover { border-color: var(--rule-2); background: var(--hover); }
.admin-tool > .ui-icon { color: var(--muted); flex: 0 0 16px; }
.admin-tool-text { display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; min-width: 0; }
.admin-tool-text strong { font-size: var(--t-13); font-weight: var(--fw-semibold); }
.admin-tool-go { color: var(--muted); flex: 0 0 auto; }

/* Reserve volatile columns so constant check-in updates never reflow the
 * roster: fixed-width digits everywhere, and min-widths on the cells whose
 * text length swings (battery %, RAM, temp, last seen). */
#device-table-container .table td { font-variant-numeric: tabular-nums; }
#device-table-container .table td:nth-child(5),
#device-table-container .table td:nth-child(6) { min-width: 52px; }
#device-table-container .table td:nth-child(7) { min-width: 100px; }
.battery-label { display: inline-block; min-width: 2.8ch; font-variant-numeric: tabular-nums; }

/* ── Devices split-pane + inspector ──────────────────
 * The roster (left) keeps its place while a compact inspector (right) shows a
 * single device at a glance. On narrow viewports the inspector becomes a
 * right-edge drawer that overlays the list.
 */
.dv-split {
  display: flex;
  align-items: flex-start;
  gap: var(--s-4);
}
.dv-split > #device-table-container { flex: 1 1 auto; min-width: 0; }

.device-inspector {
  flex: 0 0 340px;
  position: sticky;
  top: 16px;
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: dvp-in var(--dur-slow) var(--ease);
}
@keyframes dvp-in { from { opacity: 0; transform: translateX(6px); } to { opacity: 1; transform: none; } }

.dvp-loading { padding: 20px 16px; }

.dvp { padding: 14px 16px 16px; }
.dvp-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.dvp-id { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.dvp-serial {
  font-size: var(--t-15, 15px);
  font-weight: var(--fw-semibold);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dvp-id .kiosk-lock { color: var(--muted); flex: 0 0 auto; display: inline-flex; }
.dvp-close {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: var(--r-2);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.dvp-close:hover { color: var(--text); background: var(--hover); }

.dvp-status { display: flex; gap: 6px; font-size: var(--t-12); margin-top: 5px; }

.dvp-vitals {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.dvp-vital-wide { grid-column: 1 / -1; }
.dvp-k {
  font-size: var(--t-10);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 4px;
}
.dvp-v { font-size: var(--t-13); color: var(--text); }
.dvp-v .battery-wrap { margin: 0; }

.dvp-actions { margin-top: 18px; display: flex; flex-direction: column; gap: var(--s-2); }
.dvp-actions-row { display: flex; gap: var(--s-2); }
.dvp-actions .btn-primary,
.dvp-actions .btn-outline { width: 100%; justify-content: center; }
.dvp-actions-row .btn-outline,
.dvp-actions-row .btn-danger-sm { flex: 1; justify-content: center; }
.dvp-admin-row { margin-top: 2px; }
.dvp-open { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

/* Selected row in the roster */
#device-table-container tr.row-selected > td { background: var(--accent-soft); }
#device-table-container tr.row-selected > td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

/* Narrow viewports: inspector slides in as a right-edge drawer */
@media (max-width: 1024px) {
  .dv-split { display: block; }
  .device-inspector {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    flex-basis: auto;
    width: min(360px, 92vw);
    border-radius: 0;
    border-top: none; border-bottom: none; border-right: none;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    overflow-y: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .device-inspector { animation: none; }
}

/* One-shot pulse when the live alert count rises (reduced-motion safe). */
@keyframes nav-badge-pulse {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.nav-badge-pulse { animation: nav-badge-pulse 600ms var(--ease); transform-origin: center; }
@media (prefers-reduced-motion: reduce) { .nav-badge-pulse { animation: none; } }

/* ── Icons ───────────────────────────────────────────
 * Single rule normalizes every inline <svg> in .ui-icon.
 * Variants: .ui-icon-sm (12px) | .ui-icon-lg (20px) | .ui-icon-xl (28px)
 */
.ui-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: currentColor;
  flex: 0 0 16px;
}
.ui-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ui-icon-sm { width: 12px; height: 12px; flex-basis: 12px; }
.ui-icon-lg { width: 20px; height: 20px; flex-basis: 20px; }
.ui-icon-xl { width: 28px; height: 28px; flex-basis: 28px; }

.charging-bolt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  margin-left: 2px;
  color: var(--warn);
  vertical-align: -1px;
}
.charging-bolt svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  stroke: none;
}

.collapse-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: var(--muted);
  transition: color var(--dur) var(--ease);
}
.collapse-arrow svg {
  width: 14px;
  height: 14px;
  transition: transform var(--dur-slow) var(--ease);
}
.collapsible-header[aria-expanded="true"] .collapse-arrow svg,
.collapsible-header.open .collapse-arrow svg {
  transform: rotate(90deg);
}
.collapsible-header[aria-expanded="true"] .collapse-arrow,
.collapsible-header.open .collapse-arrow {
  color: var(--text);
}

.btn-logout {
  width: 100%;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--muted);
  padding: 7px 12px;
  border-radius: var(--r-2);
  cursor: pointer;
  font-size: var(--t-12);
  font-family: var(--font);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.btn-logout:hover { border-color: var(--danger-edge); color: var(--danger); background: var(--danger-bg); }

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--muted);
  padding: 6px;
  border-radius: var(--r-2);
  cursor: pointer;
  flex: 0 0 auto;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.theme-toggle:hover { color: var(--text); background: var(--hover); border-color: var(--rule-2); }
.theme-toggle .ui-icon { width: 16px; height: 16px; }
.theme-toggle .ui-icon svg { width: 16px; height: 16px; }
/* Show the icon for the theme you'd switch TO */
.theme-toggle .theme-icon-light { display: none; }
.theme-toggle .theme-icon-dark { display: inline-flex; }
html[data-theme="dark"] .theme-toggle .theme-icon-light { display: inline-flex; }
html[data-theme="dark"] .theme-toggle .theme-icon-dark { display: none; }

.navbar-user {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin: 0 4px 10px;
  line-height: 1.1;
}
.navbar-user-name {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}
.navbar-user-role {
  color: var(--muted);
  font-size: 11px;
  text-transform: capitalize;
}

/* ── Layout ──────────────────────────────────────── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px;
}

.back-link {
  font-size: 13px;
  color: var(--muted);
  display: inline-block;
  margin-bottom: 6px;
}
.back-link:hover { color: var(--accent-h); }

/* ── Cards ───────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ── Stat cards ──────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0;
  margin-bottom: var(--s-5);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.stat-card {
  padding: 14px var(--s-5) 16px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  background: var(--surface);
  transition: background var(--dur) var(--ease);
}
.stat-card:hover { background: var(--surface2); }
.stat-card.is-signal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 2px;
  background: var(--accent);
}

.stat-label {
  font-size: var(--t-11);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

.stat-value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: var(--fw-semibold);
  letter-spacing: -.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-value.battery-low  { color: var(--danger); }
.stat-value.battery-mid  { color: var(--warn); }
.stat-value.battery-ok   { color: var(--ok); }

.stat-sub {
  font-family: var(--mono);
  font-size: var(--t-11);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── Table ───────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-12);
}

.table thead th {
  position: sticky;
  top: 0;
  padding: 9px var(--s-4);
  text-align: left;
  font-size: var(--t-11);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  background: var(--surface2);
  white-space: nowrap;
}

.table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover {
  background: var(--surface2);
  box-shadow: inset 2px 0 0 var(--accent);
}
.table tbody tr.is-selected {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

.table tbody td {
  padding: 11px var(--s-4);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

/* ── Battery bar ─────────────────────────────────── */
.battery-wrap {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 120px;
}

.battery-wrap.large {
  min-width: 100%;
  margin-top: var(--s-2);
}

.battery-track {
  flex: 1;
  min-width: 0;
  height: 4px;
  border-radius: 3px;
  background: var(--rule);
  overflow: hidden;
}
.battery-wrap.large .battery-track { height: 5px; }

.battery-bar {
  height: 100%;
  border-radius: 3px;
  min-width: 2px;
  transition: width var(--dur-slow) var(--ease);
}
.battery-bar.battery-low  { background: var(--danger); }
.battery-bar.battery-mid  { background: var(--warn); }
.battery-bar.battery-ok   { background: var(--ok); }

.battery-label {
  font-family: var(--mono);
  font-size: var(--t-11);
  font-weight: var(--fw-medium);
  color: var(--text-2);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  width: 36px;
  text-align: right;
}

/* ── Helpers ─────────────────────────────────────── */
.mono  { font-family: var(--mono); }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.danger { color: var(--danger); }

/* ── Empty state (canonical pattern) ─────────────────
 * Two flavors:
 *   .empty           — inline cell empty (table colspan, etc.)
 *   .empty-state     — page/section empty with icon + title + copy + CTA
 */
.empty {
  text-align: center;
  color: var(--muted);
  padding: var(--s-7) var(--s-4) !important;
  font-size: var(--t-12);
  font-family: var(--mono);
}

.extra-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-detail {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-text);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  white-space: nowrap;
  transition: border-color 0.15s;
}
.link-detail:hover { border-color: var(--accent); color: var(--accent-h); }

.refresh-badge {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
}

/* HTMX loading indicator */
.htmx-request .refresh-badge { color: var(--accent-text); border-color: var(--accent); }

/* ── Login ───────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
  box-shadow: var(--shadow-sm);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}

.login-brand {
  width: 48px;
  height: 48px;
  color: var(--accent-text);
  margin: 0 auto 20px;
}

.login-brand svg {
  width: 48px;
  height: 48px;
}

.login-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  text-align: center;
}

.login-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 28px;
  text-align: center;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

/* ── Auth v2 — split-screen login/signup, theme-aware (light default, dark via
   html[data-theme="dark"] like the rest of the app) ───────────────────────── */
.auth2-body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: var(--font); }
.auth2-wrap { display: flex; min-height: 100vh; padding: 20px; gap: 20px; box-sizing: border-box; }
@media (max-width: 860px) { .auth2-wrap { flex-direction: column; padding: 0; gap: 0; } }

.auth2-hero {
  flex: 1.05; min-width: 0; border-radius: 24px; position: relative; overflow: hidden;
  background: radial-gradient(120% 140% at 8% 0%, #ff8a5c 0%, #f9674e 22%, #d6608f 48%, #8f6fdb 72%, #6f7ff0 100%);
  display: flex; flex-direction: column; justify-content: space-between; padding: 44px 40px;
}
@media (max-width: 860px) { .auth2-hero { border-radius: 0; padding: 28px 24px 34px; flex: none; } }
.auth2-hero-top { font-size: 13px; font-weight: 650; color: rgba(255,255,255,.85); letter-spacing: .02em; }
.auth2-hero-head { font-size: clamp(28px, 3.6vw, 42px); font-weight: 800; letter-spacing: -.02em; line-height: 1.12; color: #fff; max-width: 13ch; }
.auth2-hero-sub { font-size: 15px; color: rgba(255,255,255,.88); line-height: 1.5; max-width: 42ch; margin-top: 14px; }
.auth2-hero-foot { font-size: 12px; color: rgba(255,255,255,.7); }
@media (max-width: 860px) { .auth2-hero-sub, .auth2-hero-foot { display: none; } }

.auth2-side { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 12px 40px; }
@media (max-width: 860px) { .auth2-side { padding: 32px 24px 40px; } }
.auth2-form-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 400px; width: 100%; margin: 0 auto; }
.auth2-title { font-size: 26px; font-weight: 750; letter-spacing: -.01em; color: var(--text); }
.auth2-subtitle { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.auth2-form { display: flex; flex-direction: column; gap: 14px; margin-top: 26px; }
.auth2-field { display: flex; flex-direction: column; gap: 6px; }
.auth2-field label { font-size: 11.5px; font-weight: 650; color: var(--muted); }
.auth2-field input {
  font: inherit; font-size: 14px; background: var(--surface2); border: 1px solid var(--border); border-radius: 11px;
  padding: 13px 14px; color: var(--text); outline: none; transition: border-color .12s;
}
.auth2-field input::placeholder { color: var(--text-faint); }
.auth2-field input:focus { border-color: var(--accent); }
.auth2-pwrap { position: relative; }
.auth2-pwrap input { width: 100%; box-sizing: border-box; padding-right: 42px; }
.auth2-eye { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; display: flex; }
.auth2-eye:hover { color: var(--text); }
.auth2-eye svg { width: 18px; height: 18px; }
.auth2-row { display: flex; justify-content: flex-end; margin-top: -4px; }
.auth2-row a, .auth2-alt a { color: var(--muted); text-decoration: none; font-size: 12.5px; }
.auth2-row a:hover, .auth2-alt a:hover { color: var(--text); }
.auth2-btn {
  font: inherit; font-size: 14.5px; font-weight: 700; padding: 13px; border: none; border-radius: 11px;
  background: var(--accent); color: #fff; cursor: pointer; margin-top: 4px; transition: filter .12s;
}
.auth2-btn:hover { filter: brightness(1.08); }
.auth2-divider { display: flex; align-items: center; gap: 10px; color: var(--text-faint); font-size: 11.5px; margin: 4px 0; }
.auth2-divider::before, .auth2-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth2-oauth {
  display: flex; align-items: center; justify-content: center; gap: 9px; font-size: 13.5px; font-weight: 650;
  padding: 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); text-decoration: none;
}
.auth2-oauth:hover { border-color: var(--rule-2); }
.auth2-alt { font-size: 13px; color: var(--muted); margin-top: 22px; text-align: center; }
.auth2-alert { font-size: 13px; padding: 11px 13px; border-radius: 10px; margin-top: 22px; }
.auth2-alert.error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-edge); }
.auth2-alert.success { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-edge); }

/* ── Form primitives ─────────────────────────────────
 * One shared input rule. Focus visual is handled by the
 * global :focus-visible ring; we also lift border-color
 * for mouse focus continuity.
 */
.form-group { display: flex; flex-direction: column; gap: var(--s-2); }

.form-group input,
.form-group select,
.form-input,
.form-textarea,
.search-input,
.filter-search-input {
  background: var(--surface2);
  border: 1px solid transparent;
  border-radius: var(--r-3);
  color: var(--text);
  padding: 8px 12px;
  font-family: var(--font);
  font-size: var(--t-13);
  line-height: var(--leading-normal);
  outline: none;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.form-group input:hover,
.form-input:hover,
.form-textarea:hover,
.search-input:hover,
.filter-search-input:hover { border-color: var(--rule); }

.form-group input:focus,
.form-input:focus,
.form-textarea:focus,
.search-input:focus,
.filter-search-input:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-group input::placeholder,
.form-input::placeholder,
.form-textarea::placeholder,
.search-input::placeholder,
.filter-search-input::placeholder { color: var(--text-faint); }

.form-input--error,
.form-input.has-error,
.form-textarea--error,
.form-textarea.has-error {
  border-color: var(--danger-edge);
  background: var(--danger-bg);
}

.form-group label,
.form-label {
  font-size: var(--t-11);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.form-label[data-required]::after,
.form-group label[data-required]::after {
  content: "*";
  margin-left: 4px;
  color: var(--danger);
  font-weight: var(--fw-bold);
}

/* ── Alerts (shared bg + border + color pattern) ──── */
.alert {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-2);
  font-size: var(--t-13);
  line-height: var(--leading-normal);
  margin-bottom: var(--s-4);
  border: 1px solid;
}
.alert-error   { background: var(--danger-bg); border-color: var(--danger-edge); color: var(--danger); }
.alert-warn    { background: var(--warn-bg);   border-color: var(--warn-edge);   color: var(--warn); }
.alert-success { background: var(--ok-bg);     border-color: var(--ok-edge);     color: var(--ok); }
.alert-info    { background: var(--info-bg);   border-color: var(--info-edge);   color: var(--info); }

.ota-incompatible {
  color: var(--muted);
  font-style: italic;
}

/* ── Search ──────────────────────────────────────── */
.search-bar {
  margin-bottom: 14px;
}

.search-input { width: 100%; }

/* ── Pagination ──────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.page-numbers {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.page-btn,
/* These are now <button>s (keyboard-operable pagination); inherit the page font so
   they don't fall back to the UA default, and strip the native button appearance. */
.page-num, .page-btn { font-family: inherit; -webkit-appearance: none; appearance: none; }
.page-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  color: var(--text);
  background: transparent;
  transition: border-color 0.15s, background 0.15s;
  text-decoration: none;
}
.page-btn:hover,
.page-num:hover   { border-color: var(--accent); color: var(--accent-h); }
.page-num.active  { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.page-btn.disabled,
.page-btn.disabled:hover {
  color: var(--muted);
  cursor: default;
  border-color: var(--border);
}

.table-footer {
  padding: 10px 16px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  text-align: right;
}

/* ── Chart ───────────────────────────────────────── */
.chart-card {
  margin-bottom: 20px;
  position: relative;
}

.chart-wrap {
  padding: 20px 20px 16px;
  position: relative;
  height: 230px;
}
.chart-wrap--tall {
  height: 300px;
}
.chart-tabs {
  display: inline-flex;
  gap: 6px;
  margin: 12px 16px 4px;
  padding: 0;
  background: none;
  border: 0;
  width: fit-content;
}
.chart-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  font-size: 12px;
  font-weight: var(--fw-semibold);
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: color 120ms, background 120ms, border-color 120ms;
}
.chart-tab:hover { color: var(--text); border-color: var(--text-faint); }
.chart-tab.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: var(--fw-semibold);
  border-color: transparent;
  box-shadow: none;
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.chart-hover-info {
  --hover-accent: var(--chart-battery);
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  gap: 12px;
  min-width: 0;
  max-width: 400px;
  padding: 5px 14px 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface2);
  color: var(--text);
  font-size: 12.5px;
  line-height: 18px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  pointer-events: none;
  transition: border-color 160ms ease;
}
.chart-hover-info:not(.is-idle) {
  border-color: color-mix(in srgb, var(--hover-accent) 55%, transparent);
  box-shadow: var(--shadow-md);
}
.chart-hover-info[data-accent="battery"] { --hover-accent: var(--chart-battery); }
.chart-hover-info[data-accent="temp"]    { --hover-accent: var(--chart-temp); }
.chart-hover-info[data-accent="ram"]     { --hover-accent: var(--chart-ram); }

.chart-hover-info .hover-indicator {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hover-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hover-accent) 22%, transparent),
    0 0 12px color-mix(in srgb, var(--hover-accent) 65%, transparent);
  animation: hoverPulse 1.8s ease-in-out infinite;
}
.chart-hover-info.is-idle .hover-indicator {
  background: var(--muted);
  box-shadow: 0 0 0 3px var(--hover);
  animation: none;
}
.chart-hover-info .hover-body {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-hover-info .hover-time {
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.chart-hover-info .hover-sep {
  flex: 0 0 1px;
  width: 1px;
  height: 14px;
  background: var(--border);
}
.chart-hover-info .hover-primary {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.chart-hover-info .hover-extra {
  font-size: 11.5px;
  color: color-mix(in srgb, var(--hover-accent) 75%, var(--text));
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hover-accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--hover-accent) 28%, transparent);
}
.chart-hover-info .hover-extra:empty {
  display: none;
}
.chart-hover-info.is-idle .hover-time,
.chart-hover-info.is-idle .hover-sep {
  display: none;
}
.chart-hover-info.is-idle .hover-primary {
  color: var(--muted);
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.02em;
}

@keyframes hoverPulse {
  0%, 100% {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--hover-accent) 22%, transparent),
      0 0 10px color-mix(in srgb, var(--hover-accent) 55%, transparent);
  }
  50% {
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--hover-accent) 10%, transparent),
      0 0 18px color-mix(in srgb, var(--hover-accent) 75%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chart-hover-info .hover-indicator { animation: none; }
}
.chart-legend-line {
  width: 18px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}
.chart-legend-line.command-marker {
  height: 0;
  border-top: 2px dashed var(--muted);
}

/* ── Forms (groups / commands) ───────────────────── */
.inline-form {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  align-items: center;
}

.form-input { flex: 1; }

.command-form {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding: var(--s-4);
}
.form-submitting { opacity: 0.92; }

.form-row {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.form-textarea {
  font-family: var(--mono);
  resize: vertical;
  min-height: 90px;
}

.radio-group,
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-label,
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  user-select: none;
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--surface2);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}

input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent);
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%) rotate(45deg);
  width: 4px;
  height: 7px;
  border: 2px solid var(--accent-ink);
  border-top: none;
  border-left: none;
}

input[type="checkbox"]:hover {
  border-color: var(--accent);
}

.radio-label input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--surface2);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}

.radio-label input[type="radio"]:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.radio-label input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-ink);
}

.radio-label input[type="radio"]:hover {
  border-color: var(--accent);
}

/* ── Buttons ─────────────────────────────────────────
 * Variants: .btn-primary | .btn-outline | .btn-link
 * Modifiers: .btn-sm | .btn-danger-sm
 * All accent-fill variants use --accent-ink for AA contrast on amber.
 */
.btn-primary,
.btn-outline,
.btn-outline-sm,
.btn-danger-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font-family: var(--font);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  cursor: pointer;
  border-radius: var(--r-3);
  border: 1px solid transparent;
  transition: background var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease),
              transform var(--dur-fast) var(--ease),
              opacity var(--dur) var(--ease);
}
/* Tactile press + a busy state while an htmx action is in flight, so every
   button reacts to a click even before the swap/204 lands. */
.btn-primary:active,
.btn-outline:active,
.btn-outline-sm:active,
.btn-danger-sm:active { transform: translateY(1px); }
.btn-primary.htmx-request,
.btn-outline.htmx-request,
.btn-outline-sm.htmx-request,
.btn-danger-sm.htmx-request { opacity: .65; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .btn-primary:active,
  .btn-outline:active,
  .btn-outline-sm:active,
  .btn-danger-sm:active { transform: none; }
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  padding: 8px 16px;
  font-size: var(--t-13);
}
.btn-primary:hover  { background: var(--accent-h); border-color: var(--accent-h); color: var(--accent-ink); }
.btn-primary:active { background: var(--accent); }
.btn-primary:disabled {
  background: var(--surface2);
  color: var(--muted);
  border-color: var(--border);
  cursor: not-allowed;
}

.btn-outline {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--rule);
  padding: 7px 14px;
  font-size: var(--t-13);
  font-weight: var(--fw-medium);
}
.btn-outline:hover {
  border-color: var(--text-2);
  color: var(--text);
}

.btn-outline-sm {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--rule);
  padding: 4px 10px;
  font-size: var(--t-12);
  font-weight: var(--fw-medium);
}
.btn-outline-sm:hover {
  border-color: var(--text-2);
  color: var(--text);
}

.btn-danger-sm {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--rule);
  padding: 4px 10px;
  font-size: var(--t-12);
  font-weight: var(--fw-medium);
}
.btn-danger-sm:hover { color: var(--danger); border-color: var(--danger-edge); background: var(--danger-bg); }

/* ── Status badge / WS badge ─────────────────────────
 * Shared (bg + border + color) pattern keyed off semantic tokens.
 */
.status-badge,
.ws-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
  font-size: var(--t-11);
  font-weight: var(--fw-semibold);
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: none;
}
.status-badge.ok,
.ws-badge.online   { color: var(--ok);     background: var(--ok-bg); }
.status-badge.warn { color: var(--warn);   background: var(--warn-bg); }
.status-badge.danger { color: var(--danger); background: var(--danger-bg); }
.status-badge.muted,
.ws-badge.offline  { color: var(--muted);  background: var(--surface-3); }
.status-badge.active { color: var(--accent-2); background: var(--accent-2-soft); }

/* Shared "Beta" pill for pre-release features (schedules, etc.). */
.beta-pill {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  border-radius: 99px;
  padding: 2px 7px;
  vertical-align: middle;
  line-height: 1.4;
}

/* ── WebSocket online dot ────────────────────────── */
.ws-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  margin-right: 5px;
  flex-shrink: 0;
}
.ws-dot.online {
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-bg);
}

/* ── Segmented control ───────────────────────────── */
.seg-control {
  display: inline-flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 6px 16px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--accent);
  color: var(--accent-ink);
}
.seg-btn:disabled,
.seg-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  color: var(--muted);
}
.seg-btn:disabled:hover { color: var(--muted); }

/* ── App selector ────────────────────────────────── */
.app-select-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.app-select-wrap select { flex: 1; min-width: 0; }

.btn-primary .ui-icon,
.btn-outline .ui-icon,
.btn-outline-sm .ui-icon,
.btn-danger-sm .ui-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.btn-primary .ui-icon svg,
.btn-outline .ui-icon svg,
.btn-outline-sm .ui-icon svg,
.btn-danger-sm .ui-icon svg {
  width: 14px;
  height: 14px;
}

.btn-plus {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--r-2);
}

.dur-btns { display: flex; gap: 2px; }
.dur-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.dur-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.dur-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.dur-btn:disabled:hover { border-color: transparent; color: var(--muted); }
.dur-btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Custom-range popover — drops beneath the Custom button. */
.cr-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 16px;
  z-index: 20;
  width: 300px;
  max-width: calc(100vw - 32px);
  background: var(--surface, var(--card));
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(0,0,0,.22));
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.cr-pop[hidden] { display: none; }
.cr-pop-head { display: flex; align-items: center; }
.cr-pop-title { font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--text-faint); }
.cr-pop-x { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
.cr-pop-x:hover { color: var(--text); }
.cr-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cr-preset {
  background: var(--surface2);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 4px;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.cr-preset:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft, var(--surface2)); }
.cr-range { display: flex; flex-direction: column; gap: 8px; }
.cr-fld { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.cr-fld > span { width: 38px; flex: none; font-weight: 600; }
.range-input {
  flex: 1;
  background: var(--surface, var(--card));
  border: 1px solid var(--border);
  color: var(--text, var(--fg));
  font-size: 12.5px;
  padding: 6px 9px;
  border-radius: 8px;
}
.range-input:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
:root[data-theme="dark"] .range-input::-webkit-calendar-picker-indicator,
:root:not([data-theme="light"]) .range-input::-webkit-calendar-picker-indicator { filter: invert(0.75); }
.cr-error { color: var(--danger, #e74c3c); font-size: 11.5px; }
.cr-pop-foot { display: flex; align-items: center; gap: 7px; padding-top: 3px; border-top: 1px solid var(--border-soft); margin-top: 1px; padding-top: 10px; }
.cr-shift-lbl { font-size: 11.5px; color: var(--text-faint); }
.cr-nudge {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.cr-nudge:hover { border-color: var(--accent); color: var(--accent-text); }
.cr-reset {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
}
.cr-reset:hover { border-color: var(--rule-2); color: var(--text); }


.chart-card > .card-header { position: relative; }

@media (max-width: 760px) {
  .card-header .dur-btns { flex-wrap: wrap; }
  .cr-pop { right: 8px; left: 8px; width: auto; }
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-text);
  font-size: var(--t-13);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--dur) var(--ease);
}
.btn-link:hover { color: var(--accent-h); }

.app-empty-hint {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bold { font-weight: 600; }

/* ── Modal ───────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
}
.modal-backdrop.modal-open { display: flex; animation: modal-fade var(--dur) var(--ease); }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
  box-shadow: var(--shadow-pop);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Rise + settle the dialog in rather than hard-appearing. */
.modal-backdrop.modal-open .modal-box { animation: modal-rise var(--dur-slow) var(--ease); }
@keyframes modal-rise {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .modal-backdrop.modal-open,
  .modal-backdrop.modal-open .modal-box { animation: none; }
}
.modal-box.modal-wide { max-width: 640px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: var(--t-14);
  font-weight: var(--fw-semibold);
  letter-spacing: -.005em;
}

.modal-close {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: var(--t-18);
  cursor: pointer;
  line-height: 1;
  padding: 2px 8px;
  border-radius: var(--r-1);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.modal-close:hover { color: var(--text); background: var(--surface2); border-color: var(--rule); }

.modal-body {
  padding: var(--s-4) var(--s-5);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.modal-row {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
}

.modal-label {
  font-size: var(--t-10);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
  min-width: 70px;
  flex-shrink: 0;
}

.modal-value { color: var(--text); }

.modal-pre {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
  margin-top: 4px;
}

.row-clickable { cursor: pointer; }

/* ── Pagination ──────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 0 6px;
  border-top: 1px solid var(--border);
}
.page-btn {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
  background: var(--surface);
  transition: background 0.15s, border-color 0.15s;
}
.page-btn:not(.disabled):hover {
  background: var(--surface2);
  border-color: var(--accent);
}
.page-btn.disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}
.page-info {
  font-size: 13px;
  color: var(--muted);
}

/* ── Logcat ──────────────────────────────────────── */
.logcat-wrap {
  padding: 0;
  overflow: hidden;
  border-top: 1px solid var(--border);
}
.logcat-terminal {
  background: var(--console-bg);
  color: var(--console-text);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  padding: 16px;
  margin: 0;
  max-height: 500px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.logcat-waiting {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.logcat-level-E { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-edge); }
.logcat-level-W { background: var(--warn-bg);   color: var(--warn);   border-color: var(--warn-edge); }
.logcat-level-I { background: var(--info-bg);   color: var(--info);   border-color: var(--info-edge); }
.logcat-level-D { background: var(--ok-bg);     color: var(--ok);     border-color: var(--ok-edge); }
.logcat-level-V { background: rgba(138,146,160,0.10); color: var(--muted); border-color: rgba(138,146,160,0.25); }
.logcat-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Actions Grid ────────────────────────────────── */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 16px;
}
.action-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.action-label {
  font-weight: 600;
  font-size: 13px;
}
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-edge);
  padding: 7px 14px;
  border-radius: var(--r-2);
  cursor: pointer;
  font-size: var(--t-13);
  font-weight: var(--fw-semibold);
  font-family: var(--font);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn-danger:hover {
  background: var(--danger);
  color: var(--accent-ink);
  border-color: var(--danger);
}

/* ── Screenshot ──────────────────────────────────── */
.screenshot-thumb {
  max-width: 160px;
  max-height: 90px;
  border-radius: 4px;
  border: 1px solid var(--border);
  cursor: pointer;
  display: block;
}

/* ── Table toolbar & bulk actions ────────────────── */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 4px;
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bulk-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-text);
  white-space: nowrap;
}
.lookup-results {
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  overflow: hidden;
}

.lookup-results.compact {
  margin-top: 0;
}
.lookup-title {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.lookup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-soft);
}
.lookup-row:first-of-type {
  border-top: 0;
}
.lookup-empty .lookup-title {
  border-bottom: 0;
}
.kiosk-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
}
.kiosk-summary-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}
.kiosk-summary-value {
  font-size: 14px;
  color: var(--text);
}

.device-actions {
  padding: 18px 20px 20px;
  display: grid;
  gap: 18px;
}

.device-actions-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.device-actions-title {
  font-size: 16px;
  font-weight: 700;
}

.device-actions-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  max-width: 580px;
}

.device-action-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.device-action-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.device-action-tile:hover {
  border-color: var(--text-faint);
  background: var(--hover);
}

.device-action-tile.active {
  border-color: transparent;
  background: var(--accent-soft);
}
.device-action-tile.active .device-action-tile-title { color: var(--accent-text); }

.device-action-tile .ui-icon {
  width: 16px;
  height: 16px;
  color: var(--text-2);
}
.device-action-tile.active .ui-icon { color: var(--accent-text); }

.device-action-tile .ui-icon svg {
  width: 16px;
  height: 16px;
}

.device-action-tile-title {
  font-size: var(--t-13);
  font-weight: var(--fw-semibold);
}

.device-action-tile-copy {
  font-size: var(--t-11);
  color: var(--muted);
  line-height: var(--leading-normal);
}

.device-action-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
/* Let the kiosk package dropdown escape the panel instead of being clipped. */
.device-action-panel:has(.pkg-combo.open) { overflow: visible; }
/* Same, for the bulk-kiosk modal's app picker (modal-body scrolls by default). */
.modal-body:has(.pkg-combo.open) { overflow: visible; }

.device-action-panel-head {
  padding: var(--s-4) var(--s-4) var(--s-3);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
}

.device-action-panel-title {
  font-size: var(--t-14);
  font-weight: var(--fw-semibold);
  letter-spacing: -.005em;
}

.device-action-panel-copy {
  margin-top: 4px;
  font-size: var(--t-12);
  color: var(--muted);
}

.device-action-form {
  padding: var(--s-4);
  display: grid;
  gap: var(--s-3);
}

.device-action-inline {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.device-action-note {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-2);
  border: 1px solid var(--border);
  background: var(--surface2);
  font-size: var(--t-12);
  color: var(--text-2);
  line-height: var(--leading-normal);
}

.device-action-note.warn {
  border-color: var(--warn-edge);
  background: var(--warn-bg);
  color: var(--warn);
}

.device-action-meta {
  font-family: var(--mono);
  font-size: var(--t-11);
  color: var(--muted);
}

.danger-zone {
  background: var(--danger-bg);
  border: 1px solid var(--danger-edge);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.danger-zone-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--danger);
}

.danger-zone-copy {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-2);
  max-width: 560px;
}

.empty-state {
  padding: var(--s-8) var(--s-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--s-3);
  color: var(--muted);
}

.empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-2);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-faint);
  margin-bottom: var(--s-2);
}
.empty-state-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  max-width: 420px;
}

.empty-state-title {
  font-size: var(--t-14);
  font-weight: var(--fw-semibold);
  color: var(--text);
}

.empty-state-text {
  font-size: var(--t-12);
  line-height: var(--leading-normal);
  color: var(--muted);
}

.empty-state-actions {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.command-composer {
  padding: 20px;
  display: grid;
  gap: 18px;
}

.command-composer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.95fr);
  gap: 18px;
}

.composer-panel {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.composer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.composer-title {
  font-size: 14px;
  font-weight: 700;
}

.composer-copy {
  font-size: 12px;
  color: var(--muted);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.choice-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
  display: grid;
  gap: 8px;
}

.choice-card:hover {
  border-color: var(--accent-edge);
  transform: translateY(-1px);
}

.choice-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-edge);
}

.choice-card .ui-icon {
  width: 18px;
  height: 18px;
  color: var(--accent-h);
}

.choice-card .ui-icon svg {
  width: 18px;
  height: 18px;
}

.choice-card-title {
  font-size: 13px;
  font-weight: 700;
}

.choice-card-copy {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.choice-card-meta {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.composer-inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.composer-note {
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text);
}

.composer-note.warn {
  border-color: var(--warn-edge);
  background: var(--warn-bg);
  color: var(--text);
}

.target-option-list {
  display: grid;
  gap: 8px;
}

.target-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.target-option.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.target-option-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.target-option-title {
  font-size: 13px;
  font-weight: 600;
}

.target-option-text {
  font-size: 12px;
  color: var(--muted);
}

.composer-summary {
  display: grid;
  gap: 12px;
}

.summary-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface2);
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 6px;
}

.composer-footer-copy {
  font-size: 12px;
  color: var(--muted);
}

/* ── Filter bar ─────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
}

.filter-search {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-search-icon {
  position: absolute;
  left: 10px;
  color: var(--muted);
  pointer-events: none;
}

.filter-search-input {
  /* Layout-only overrides; visuals inherited from shared input rule. */
  padding: 6px 10px 6px 30px;
  width: 200px;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), width var(--dur-slow) var(--ease);
}
.filter-search-input:focus { width: 260px; }

.filter-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}

.filter-select {
  background: var(--surface2);
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.filter-select:hover { color: var(--text); border-color: var(--border); }
.filter-select:focus-visible { border-color: var(--accent); color: var(--text); box-shadow: var(--ring); }
.filter-select.active {
  color: var(--accent-text);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.filter-select option { background: var(--surface2); color: var(--text); }

/* Leading icon inside a filter dropdown (mirrors .filter-search). */
.filter-select-ic { position: relative; display: inline-flex; align-items: center; }
.filter-select-ic > svg {
  position: absolute; left: 9px; width: 14px; height: 14px;
  color: var(--muted); pointer-events: none;
}
.filter-select-ic > .filter-select { padding-left: 28px; }
.filter-select-ic:has(.filter-select.active) > svg { color: var(--accent-text); }

/* Unset filters show a short label next to the icon (muted); set filters become an
   accent chip with a clear ✕ — all driven live by :has(option:checked). */

/* Active: a value is chosen → accent chip (icon + value) with a clear ✕. */
.filter-select-ic:has(.filter-select option:checked:not([value=""])) > .filter-select {
  color: var(--accent-text);
  border-color: var(--accent);
  background: var(--accent-soft);
  padding-right: 26px;
  -webkit-appearance: none;
  appearance: none;
}
.filter-select-ic:has(.filter-select option:checked:not([value=""])) > svg { color: var(--accent-text); }
.fchip-x {
  display: none;
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--accent-text);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}
.fchip-x:hover { background: var(--accent); color: #fff; }
.filter-select-ic:has(.filter-select option:checked:not([value=""])) > .fchip-x { display: inline-flex; }

.filter-pills {
  display: inline-flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  gap: 1px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.filter-pill svg { width: 13px; height: 13px; }
.filter-pill:hover { color: var(--text); }
.filter-pill.active {
  background: var(--surface);
  color: var(--accent-text);
  font-weight: var(--fw-semibold);
  box-shadow: var(--shadow-sm);
}

.filter-clear {
  background: none;
  border: none;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
  white-space: nowrap;
}
.filter-clear:hover { color: var(--danger); }

/* ── Sortable column headers ────────────────────── */
.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: color var(--dur) var(--ease);
}
.sortable-th:hover { color: var(--text-2); }
.sortable-th.sorted { color: var(--text); }
.sort-arrow {
  font-size: var(--t-10);
  margin-left: 5px;
  vertical-align: middle;
  color: var(--text-faint);
}
.sortable-th.sorted .sort-arrow { color: var(--accent-text); }

/* ── Export page ────────────────────────────────── */
.export-serials {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.export-form {
  margin-bottom: 24px;
}

.export-time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.export-columns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.export-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.export-col-group {
  margin-top: 14px;
}
.export-col-group:first-of-type { margin-top: 0; }

.export-col-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}
.export-col-group-head strong {
  color: var(--text);
  font-weight: 600;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--accent-text);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--accent-h); }

.serial-chip-hidden { display: none; }

.export-submit-bar {
  position: sticky;
  bottom: 0;
  margin-top: 20px;
  padding: 14px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-lg);
}
.export-submit-summary { flex: 1 1 auto; min-width: 0; }
.export-submit-bar .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Send Picker ─────────────────────────────────── */
.send-picker { max-width: 480px; }

.send-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.send-tab {
  padding: 6px 16px;
  font-size: 13px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.send-tab.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

.send-search {
  margin-bottom: 8px;
  font-size: 13px;
}

.send-list-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.send-check-all {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.send-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.send-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.send-item:last-child { border-bottom: none; }
.send-item:hover { background: var(--bg); }

.send-item input[type="checkbox"] {
  flex-shrink: 0;
  accent-color: var(--accent);
}

.send-count { font-size: 12px; }

/* ── OTA Progress ────────────────────────────────── */
/* Deployment "Device Status" rollup: padded body that aligns with the card
   header (20px) and a divider before the targets table. */
.ota-rollup {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.ota-rollup-summary {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
/* Align the targets table cells with the header/rollup (cards use 20px). */
#deployment-targets .table thead th,
#deployment-targets .table tbody td { padding-left: 20px; padding-right: 20px; }

.ota-progress-panel {
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  margin: 6px 0 2px;
  max-width: 300px;
}

.ota-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.ota-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ── Density Toggle ─────────────────────────────── */
.density-toggle {
  padding: 5px 8px !important;
  border: 1px solid var(--border) !important;
  background: var(--surface) !important;
  border-radius: var(--r-2);
  color: var(--muted);
}
.density-toggle:hover { color: var(--text); border-color: var(--rule-2) !important; }
.density-toggle.active { color: var(--accent-text); border-color: var(--accent-edge) !important; box-shadow: none; }
.compact .table td,
.compact .table th { padding: 5px var(--s-3); font-size: var(--t-11); line-height: 1.3; }
.compact .battery-wrap { height: 14px; }
.compact .battery-track { height: 8px; }
.compact .battery-label { font-size: 11px; }
.compact .ws-dot { width: 6px; height: 6px; }
.compact .status-badge { font-size: 10px; padding: 1px 6px; }

/* ── Row Highlighting ──────────────────────────── */
.row-alert-battery { box-shadow: inset 3px 0 0 var(--danger); }
.row-alert-temp { box-shadow: inset 3px 0 0 var(--warn); }
.row-alert-battery.row-alert-temp { box-shadow: inset 3px 0 0 var(--danger), inset 6px 0 0 var(--warn); }

/* ── Last Synced ───────────────────────────────── */
.last-synced { font-size: 10px; color: var(--muted); opacity: 0.6; margin-left: 8px; }

/* ── HTMX Progress Bar ────────────────────────── */
#htmx-progress { position: fixed; top: 0; left: 0; height: 2px; background: var(--accent); z-index: 999; width: 0; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.htmx-requesting-progress #htmx-progress { opacity: 1; animation: htmx-progress-grow 2s ease-out forwards; }
@keyframes htmx-progress-grow { from { width: 0; } to { width: 90%; } }

/* ── Loading skeletons ─────────────────────────────
 * Element-level loading state. Use .skeleton on a placeholder
 * element, or wrap a region with .is-loading to dim its contents.
 */
.skeleton {
  display: block;
  background: linear-gradient(90deg,
    var(--surface2) 0%,
    var(--surface-3) 50%,
    var(--surface2) 100%);
  background-size: 200% 100%;
  border-radius: var(--r-1);
  animation: skeleton-shimmer 1.4s linear infinite;
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}
.skeleton-text  { height: 12px; width: 100%; margin: 4px 0; }
.skeleton-line  { height: 1em; width: 60%; }
.skeleton-row   { height: 36px; margin-bottom: 1px; }
.skeleton-stat  { height: 24px; width: 70px; margin: 4px 0; }

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Region-level loading indicator — DISABLED. htmx adds .htmx-request to the element
 * making a request, so every live-refresh region (#apps-live, #device-vitals-live,
 * #device-queue, …) and every submitting form got a 35%-opacity overlay for the
 * duration of the request. With the morph engine updating content smoothly in place,
 * that dim-then-restore was the "flash": the pane dimmed and redrew on every telemetry
 * tick / install / uninstall instead of just the changed text updating. The morph gives
 * the visual feedback now; the top progress bar covers real page navigations. Buttons
 * keep their own .htmx-request opacity cue (see .btn-*.htmx-request). */
.htmx-request::after,
.htmx-request.htmx-indicator-row::after { content: none; }

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; background: var(--surface2); }
}

/* ── Form Submit Feedback ─────────────────────── */
.btn-submitting { opacity: 0.72; pointer-events: none; position: relative; }
.btn-submitting::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
  vertical-align: -2px;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

.shell-spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid var(--accent);
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

/* ── Logcat Line Colors ───────────────────────── */
/* Light-legible defaults; bright variants for the dark terminal below. */
.logcat-terminal .log-E { color: #c0392b; }
.logcat-terminal .log-W { color: #9a6d00; }
.logcat-terminal .log-I { color: #2563c9; }
.logcat-terminal .log-D { color: #1e8a4c; }
.logcat-terminal .log-V { color: #6b7280; }
html[data-theme="dark"] .logcat-terminal .log-E { color: #e05656; }
html[data-theme="dark"] .logcat-terminal .log-W { color: #e6a836; }
html[data-theme="dark"] .logcat-terminal .log-I { color: #6aa9ff; }
html[data-theme="dark"] .logcat-terminal .log-D { color: #59c97a; }
html[data-theme="dark"] .logcat-terminal .log-V { color: #8a92a0; }

/* ── Logcat Pause Button ──────────────────────── */
.logcat-pause { display: flex; align-items: center; gap: 6px; }
.logcat-pause .btn-outline { font-size: 12px; padding: 3px 10px; }
.logcat-pause .btn-outline[aria-pressed="true"] {
  border-color: var(--warn);
  color: var(--warn);
}

/* ── Double-Lock Modal ────────────────────────── */
.confirm-input { font-size: 18px; text-align: center; letter-spacing: 2px; width: 120px; }
.confirm-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.confirm-count { font-size: 24px; font-weight: 700; color: var(--danger); }
.confirm-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
}
.poll-stamp {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.7;
}

/* ── Toast — top banner, liquid glass (replaces the old bottom-right corner
   stack; see /demo/toasts direction C for the design this was tuned against) ── */
.toast-stack {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: calc(100% - 40px);
  max-width: 420px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px 9px 10px;
  background: rgba(255, 255, 255, .45);
  -webkit-backdrop-filter: blur(4px) saturate(180%);
  backdrop-filter: blur(4px) saturate(180%);
  /* Own compositing layer — without it, a layout change anywhere near another
     backdrop-filter surface on the page (e.g. a dropdown's content swapping
     in) can force every glass surface to drop and redraw its blur together,
     visible as the whole navbar/dock flashing, not just what actually changed. */
  will-change: backdrop-filter;
  border: 1px solid rgba(255, 255, 255, .29);
  border-radius: 20px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .21), inset 0 1px 0 rgba(255, 255, 255, .5);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 550;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-14px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
html[data-theme="dark"] .toast { background: rgba(20, 18, 17, .45); border-color: rgba(255, 255, 255, .12); }
.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.toast-ic {
  flex: none; width: 26px; height: 26px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2); color: var(--muted);
}
.toast-ic svg { width: 14px; height: 14px; display: block; }
.toast-msg { flex: 1; min-width: 0; word-break: break-word; }
.toast-x {
  flex: none; width: 20px; height: 20px; margin: 0;
  border: none; border-radius: 5px; background: none; color: var(--text-faint);
  opacity: .8; cursor: pointer; line-height: 1; font-size: 15px;
  transition: opacity .12s, background .12s;
}
.toast-x:hover { opacity: 1; background: rgba(0, 0, 0, .08); }
.toast.success .toast-ic { background: var(--ok-bg); color: var(--ok); }
.toast.error   .toast-ic { background: var(--danger-bg); color: var(--danger); }
.toast.warn    .toast-ic { background: var(--warn-bg); color: var(--warn); }
.toast.info    .toast-ic { background: var(--info-bg); color: var(--info); }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .command-composer-grid { grid-template-columns: 1fr; }
  .type-grid { grid-template-columns: repeat(2, 1fr); }
  .container { padding: var(--s-5); }
}

@media (max-width: 900px) {
  .filter-bar { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .container { padding: var(--s-4); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .type-grid { grid-template-columns: 1fr; }
  .ov-greet { flex-wrap: wrap; }
  .composer-footer { flex-direction: column; align-items: flex-start; }
  .choice-grid { grid-template-columns: 1fr; }
  .device-actions-header { flex-direction: column; }
  .device-action-inline { flex-direction: column; align-items: stretch; }
  .danger-zone { flex-direction: column; }
  .target-pills { flex-wrap: wrap; }
  .modal-box { max-height: 92vh; }
  .table thead th:nth-child(4),
  .table tbody td:nth-child(4) { display: none; }
}

/* ── New Command Builder ──────────────────────────────────── */
.cmd-builder {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: var(--s-4);
  position: relative;
}

.cmd-builder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.cmd-builder-head .head-title {
  font-size: 15px;
  font-weight: var(--fw-semibold);
  color: var(--text);
}

/* Live command preview strip — kept in DOM for JS, hidden in the clean UI */
.cmd-preview { display: none; }

.cmd-builder-body {
  padding: var(--s-4);
}

/* Type cards — match device-action-tile pattern */
.type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.type-card:hover {
  border-color: var(--rule-2);
  background: var(--surface2);
}
.type-card.is-active {
  border-color: var(--accent-edge);
  background: var(--accent-soft);
}
.type-card.is-active::before {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
}

.type-card .type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--text-2);
}
.type-card.is-active .type-icon { color: var(--accent-text); }
.type-card .type-icon svg { width: 14px; height: 14px; stroke-width: 1.6; fill: none; stroke: currentColor; }
.type-card .type-name {
  font-size: var(--t-13);
  font-weight: var(--fw-semibold);
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}
.type-card .type-desc {
  font-size: var(--t-11);
  color: var(--muted);
  line-height: var(--leading-normal);
}

/* Payload zone — solid panel, not dashed */
.payload-zone {
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-4);
  background: var(--surface2);
  position: relative;
  min-height: 56px;
}
.payload-zone-label {
  font-size: var(--t-11);
  font-weight: var(--fw-semibold);
  letter-spacing: .02em;
  color: var(--muted);
  display: block;
  margin-bottom: var(--s-2);
}
.payload-zone .payload-section { display: none; }
.payload-zone .payload-section.is-active { display: block; }
.payload-zone .payload-empty {
  font-size: var(--t-12);
  color: var(--muted);
}

/* Target selector — segmented, matches .seg-btn radius */
.target-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-bottom: var(--s-3);
}
.target-row .target-label {
  font-size: var(--t-11);
  font-weight: var(--fw-semibold);
  letter-spacing: .02em;
  color: var(--muted);
}
.target-pills {
  display: inline-flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  gap: 1px;
}
.target-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: var(--t-12);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.target-pill:hover { color: var(--text); }
.target-pill.is-active {
  background: var(--surface);
  color: var(--accent-text);
  font-weight: var(--fw-semibold);
  box-shadow: var(--shadow-sm);
}
.target-pill .pill-dot { display: none; }

.target-detail { display: none; margin-top: var(--s-2); }
.target-detail.is-active { display: block; }

/* Submit footer */
.cmd-builder-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.cmd-builder-foot .foot-meta {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-12);
  color: var(--muted);
}
.cmd-builder-foot .foot-meta .meta-dot { display: none; }
.btn-send-cli {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 8px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  border-radius: var(--r-2);
  font-family: var(--font);
  font-size: var(--t-13);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.btn-send-cli:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn-send-cli .kbd {
  font-family: var(--mono);
  font-size: var(--t-10);
  font-weight: var(--fw-semibold);
  padding: 2px 6px;
  border-radius: var(--r-1);
  background: rgba(0,0,0,0.20);
  letter-spacing: .04em;
}

@media (max-width: 720px) {
  .type-grid { grid-template-columns: repeat(2, 1fr); }
  .cmd-builder-foot { flex-direction: column; align-items: stretch; }
}

/* ── Device detail (tabbed shell) ─────────────────── */
.device-detail { max-width: 1040px; margin: 0 auto; }

.dd-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.dd-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  padding: 4px;
  border-radius: var(--r-2);
  flex: 0 0 auto;
  margin-top: 4px;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.dd-close:hover { color: var(--text); background: var(--hover); }
.dd-avatar {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1d2026, #2c313a);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #cfd5de;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.dd-avatar svg { width: 22px; height: 22px; }
.dd-titlewrap { flex: 1 1 auto; min-width: 0; }
.dd-eyebrow {
  font-size: var(--t-12);
  color: var(--muted);
  margin-bottom: 3px;
  letter-spacing: .01em;
}
.dd-title {
  font-size: 22px;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0;
}
.dd-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: var(--t-12);
  white-space: nowrap;
  flex: 0 0 auto;
  padding-top: 6px;
}
.dd-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: var(--r-2);
  background: transparent;
  cursor: pointer;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.dd-icon-btn:hover { color: var(--text); background: var(--hover); border-color: var(--rule-2); }

.dd-rule { border: none; border-top: 1px solid var(--border); margin: 18px 0 22px; }

/* Summary cards */
.dd-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.dd-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}
.dd-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: var(--t-14);
  font-weight: var(--fw-semibold);
  margin-bottom: 12px;
}
.dd-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  font-size: var(--t-13);
  border-top: 1px solid var(--border-soft);
}
.dd-row:first-of-type { border-top: none; }
.dd-row-label { color: var(--muted); }
.dd-row-val { color: var(--text); font-family: var(--mono); font-size: var(--t-12); font-weight: var(--fw-medium); text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dd-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--t-13);
  padding: 4px 0;
}
.dd-alert-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--muted); }
.dd-alert.ok     { color: var(--text-2); } .dd-alert.ok     .dd-alert-dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.dd-alert.warn   { color: var(--warn); }   .dd-alert.warn   .dd-alert-dot { background: var(--warn); }
.dd-alert.danger { color: var(--danger); } .dd-alert.danger .dd-alert-dot { background: var(--danger); }

/* Tab bar */
.dd-tabs {
  display: inline-flex;
  gap: 3px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 18px;
  max-width: 100%;
  overflow-x: auto;
}
.dd-tab {
  background: none;
  border: none;
  border-radius: 9px;
  padding: 8px 16px;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: var(--fw-semibold);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.dd-tab:hover { color: var(--text); }
.dd-tab.active { color: var(--accent-text); background: var(--surface); box-shadow: var(--shadow-sm); }
.pill-beta {
  font-size: 10px;
  font-weight: var(--fw-semibold);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent-text);
  background: var(--accent-soft);
  border: 1px solid var(--accent-edge);
  border-radius: 999px;
  padding: 1px 7px;
}
.dd-panel[hidden] { display: none; }

/* Device details — simple label/value rows inside a card surface */
.dd-details-card { padding: 6px 20px 10px; }
.dd-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 56px;
}
.dd-details .dd-drow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 2px;
  font-size: var(--t-13);
  border-bottom: 1px solid var(--border-soft);
}
/* drop trailing dividers against the card edge (last row of each column) */
.dd-details .dd-drow:nth-last-child(-n+2) { border-bottom: none; }
@media (max-width: 720px) {
  .dd-details { grid-template-columns: 1fr; }
  .dd-details .dd-drow:nth-last-child(2) { border-bottom: 1px solid var(--border-soft); }
}

@media (max-width: 820px) {
  .dd-summary { grid-template-columns: 1fr; }
  .dd-header-meta { display: none; }
  .dd-title { font-size: 22px; }
}

/* AI analysis output: rendered Markdown from the model. */
.ai-text { color: var(--text); line-height: 1.55; }
.ai-text p { margin: 0 0 8px; }
.ai-text p:last-child { margin-bottom: 0; }
.ai-text ul, .ai-text ol { margin: 4px 0 10px; padding-left: 20px; }
.ai-text li { margin: 3px 0; }
.ai-text strong { font-weight: 600; color: var(--text-strong, var(--text)); }
.ai-text code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; background: var(--surface-2, rgba(127,127,127,0.12)); padding: 1px 4px; border-radius: 4px; }

/* ── Daily Report · Assistant treatment (orb header + chat-bubble briefing) ── */
.ai-hdr { display: flex; align-items: center; gap: 11px; }
.ai-orb { position: relative; width: 32px; height: 32px; flex: none; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2, #7a80f6)); box-shadow: 0 4px 13px rgba(249,103,78,.28); }
.ai-orb svg { width: 16px; height: 16px; }
.ai-orb::after { content: ""; position: absolute; inset: -4px; border-radius: 13px; border: 1.5px solid var(--accent-soft); animation: ai-orbpulse 2.6s ease-out infinite; }
@keyframes ai-orbpulse { 0% { transform: scale(.9); opacity: .7; } 70% { transform: scale(1.35); opacity: 0; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ai-orb::after { animation: none; } }
.ai-hdr-t { font-size: 15px; font-weight: 650; letter-spacing: -.01em; line-height: 1.2; }
.ai-hdr-sub { display: block; font-size: 11px; font-weight: 500; color: var(--text-faint); letter-spacing: 0; margin-top: 1px; }
.ai-hdr-r { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.ai-stamp { font-size: 12px; color: var(--muted); }
.ai-body { padding: 15px 18px 17px; }
.ai-bubble { background: var(--surface2); border: 1px solid var(--border-soft); border-radius: 5px 16px 16px 16px; padding: 15px 17px; }

/* Daily Report — live per-restaurant open-alert breakdown */
.rab:not(:empty) { margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--border-soft); }
.rab-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 9px; }
.rab-t { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rab-total { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); }
.rab-list { display: flex; flex-direction: column; gap: 1px; }
.rab-row { display: flex; align-items: center; gap: 12px; padding: 9px 11px; border-radius: 9px; text-decoration: none; color: inherit; transition: background .12s; }
.rab-row:hover { background: var(--surface2); color: inherit; }
.rab-name { font-weight: 600; font-size: 13.5px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rab-pills { display: flex; gap: 6px; flex: none; }
.rab-pill { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.rab-pill.crit { background: var(--danger-bg); color: var(--danger); }
.rab-pill.warn { background: var(--warn-bg); color: var(--warn); }
.rab-count { flex: none; min-width: 22px; text-align: right; font-weight: 750; font-variant-numeric: tabular-nums; font-size: 14px; }
.rab-more { display: inline-block; margin-top: 9px; font-size: 12.5px; font-weight: 600; color: var(--accent-text); }
.rab-empty { font-size: 13px; color: var(--muted); padding: 4px 2px; }

.ai-lede { font-size: 15px; line-height: 1.5; font-weight: 500; color: var(--text); }
.ai-intro { font-weight: 700; }
.ai-intro.ai-ok { color: var(--ok); } .ai-intro.ai-warn { color: var(--warn); } .ai-intro.ai-bad { color: var(--danger); } .ai-intro.ai-muted { color: var(--muted); }
.rep-headline { color: var(--text); }

/* metrics → pills */
.rep-tiles { display: flex; flex-wrap: wrap; gap: 8px; margin: 13px 0 4px; }
.rep-tile { display: inline-flex; align-items: baseline; gap: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 4px 12px; font-size: 12.5px; }
.rep-tile b { font-weight: 700; font-variant-numeric: tabular-nums; }
.rep-tile .l { color: var(--muted); font-weight: 500; }

/* issues → dotted briefing list */
.rep-rows { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.rep-row { display: flex; gap: 10px; }
.rep-row .ind { width: 7px; height: 7px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--muted); }
.rep-row.rep-danger .ind { background: var(--danger); }
.rep-row.rep-warn .ind { background: var(--warn); }
.rep-row .meta { font-size: 13.5px; color: var(--text); line-height: 1.55; min-width: 0; }
.rep-row .scope { font-weight: 650; }
.rep-act { color: var(--accent-text); font-weight: 600; }

/* healthy footer line */
.rep-good { font-size: 12px; color: var(--text-faint); margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.rep-good b { color: var(--text-2); font-weight: 600; }

/* Serial links inside report prose: inline mono text, not boxed chips —
   the boxed .link-detail style breaks the sentence flow around commas. */
#ai-sum-preview .link-detail, #ai-sum-full .link-detail {
  display: inline; padding: 0; border: none; border-radius: 0;
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  color: var(--accent-text); white-space: nowrap;
}
#ai-sum-preview .link-detail:hover, #ai-sum-full .link-detail:hover {
  color: var(--accent-h); text-decoration: underline;
}

/* ════════════════════════════════════════════════════
   OVERVIEW PAGE (main1 "command deck" port)
   ════════════════════════════════════════════════════ */
.ov-greet { display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px; }
.ov-greet .acts { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ov-title { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.ov-date { font-size: 13px; color: var(--text-faint); }
.ov-live { margin-left: auto; display: flex; align-items: center; gap: 7px; font-family: var(--mono);
  font-size: 11px; color: var(--ok); text-transform: uppercase; letter-spacing: 0.08em; }
.ov-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }

.ov-hero { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: stretch; margin-bottom: 22px; }
.ov-pulse { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-4);
  padding: 24px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
  justify-content: space-between; position: relative; overflow: hidden; }
.ov-pulse::after { content: ""; position: absolute; right: -50px; top: -50px; width: 170px; height: 170px;
  border-radius: 50%; background: radial-gradient(circle, var(--accent-soft), transparent 70%); }
.ov-pulse h2 { font-family: var(--font-display); font-size: 15px; font-weight: 600; margin: 0;
  color: var(--text-2); letter-spacing: 0.02em; }
.ov-score-row { display: flex; align-items: center; gap: 18px; margin: 14px 0 8px; }
.ov-ring { width: 104px; height: 104px; flex: none; }
.ov-ring-track { fill: none; stroke: var(--surface-3); stroke-width: 9; }
.ov-ring-val { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; }
.ov-ring-val.is-warn { stroke: var(--warn); }
.ov-ring-val.is-danger { stroke: var(--danger); }
.ov-score { font-family: var(--font-display); font-size: 44px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.ov-score-sub { font-size: 12.5px; color: var(--text-faint); margin-top: 6px; line-height: 1.45; }
.ov-verdict { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; color: var(--ok); }
.ov-verdict::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 4px var(--ok-bg); }
.ov-verdict.is-warn { color: var(--warn); }
.ov-verdict.is-warn::before { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-bg); }
.ov-verdict.is-danger { color: var(--danger); }
.ov-verdict.is-danger::before { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-bg); }

.ov-vitals { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr 1fr; gap: 14px; }
.ov-vital { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-4);
  padding: 15px 17px; box-shadow: var(--shadow-sm); cursor: pointer; position: relative;
  text-decoration: none; color: inherit; display: block;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.ov-vital:hover { transform: translateY(-2px); border-color: var(--rule-2); }
.ov-vital.alerty { border-color: var(--danger-edge); }
.ov-vital .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-faint); font-weight: var(--fw-semibold); }
.ov-vital .v { font-family: var(--font-display); font-size: 27px; font-weight: 600; margin-top: 4px; letter-spacing: -0.01em; }
.ov-vital .v.ok { color: var(--ok); }
.ov-vital .v.bad { color: var(--danger); }
.ov-vital .v.warn { color: var(--warn); }
.ov-vital .v.hot { color: var(--chart-temp); }
.ov-vital .d { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.ov-vital .spark { position: absolute; right: 14px; bottom: 13px; opacity: 0.85; }
.ov-vital .spark polyline { fill: none; stroke-width: 1.6; stroke: var(--muted); }
.ov-vital .spark .sp-ok { stroke: var(--ok); }
.ov-vital .spark .sp-bad { stroke: var(--danger); }
.ov-vital .spark .sp-warn { stroke: var(--warn); }
.ov-vital .spark .sp-hot { stroke: var(--chart-temp); }

.ov-strip { display: flex; align-items: center; gap: 14px;
  background: linear-gradient(90deg, var(--accent-soft), var(--surface) 60%);
  border: 1px solid var(--accent-edge); border-radius: 13px; padding: 13px 18px;
  margin-bottom: 22px; box-shadow: var(--shadow-sm); }
.ov-strip .ic { width: 34px; height: 34px; border-radius: 10px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; flex: none; }
.ov-strip .ic svg { width: 17px; height: 17px; stroke: var(--accent-ink); fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ov-strip .tx { font-size: 13.5px; color: var(--text-2); }
.ov-strip .tx b { color: var(--text); }
.ov-strip .go { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--accent-text);
  text-decoration: none; white-space: nowrap; }
.ov-strip .go:hover { text-decoration: underline; }

.ov-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; align-items: start; }
.ov-side { display: flex; flex-direction: column; gap: 16px; }

.ov-qa { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px; }
.ov-qact { display: flex; flex-direction: column; gap: 9px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 13px; padding: 15px 16px; cursor: pointer;
  text-decoration: none; color: inherit;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.ov-qact:hover { transform: translateY(-2px); border-color: var(--accent); background: var(--surface); }
.ov-qact .qi { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.ov-qact .qi svg { width: 17px; height: 17px; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ov-qact .qi.c1 { background: var(--accent-soft); }   .ov-qact .qi.c1 svg { stroke: var(--accent); }
.ov-qact .qi.c2 { background: var(--info-bg); }       .ov-qact .qi.c2 svg { stroke: var(--info); }
.ov-qact .qi.c3 { background: var(--ok-bg); }         .ov-qact .qi.c3 svg { stroke: var(--ok); }
.ov-qact .qi.c4 { background: var(--warn-bg); }       .ov-qact .qi.c4 svg { stroke: var(--warn); }
.ov-qact .qt { font-size: 13.5px; font-weight: 600; }
.ov-qact .qd { font-size: 11.5px; color: var(--text-faint); line-height: 1.4; margin-top: -4px; }

.ov-ract { padding: 4px 18px 12px; }
.ov-ra { display: flex; align-items: center; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--border-soft); font-size: 12.5px; }
.ov-ra:last-child { border-bottom: 0; }
.ov-ra .who { font-weight: 600; color: var(--text-2); flex: none; }
.ov-ra .what { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-ra .what b { font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--text-2); }
.ov-ra .t { margin-left: auto; color: var(--text-faint); font-family: var(--mono); font-size: 11px; white-space: nowrap; }

.ov-alrs { padding: 4px 18px 12px; }
.ov-alr { display: flex; align-items: center; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--border-soft); font-size: 12.5px; }
.ov-alr:last-child { border-bottom: 0; }
.ov-alr .status-badge { flex: none; }
.ov-alr .sn { flex: none; font-size: 11.5px; }
.ov-alr .sum { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-alr .t { margin-left: auto; color: var(--text-faint); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.ov-alr-more { display: block; padding: 9px 0; font-size: 12.5px; font-weight: 600;
  color: var(--accent-text); text-decoration: none; }
.ov-alr-more:hover { text-decoration: underline; }
.ov-alrs-empty { display: flex; align-items: center; gap: 10px; padding: 18px;
  color: var(--muted); font-size: 13px; }
.ov-alrs-empty svg { width: 16px; height: 16px; flex: none; stroke: var(--ok); fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ════════════════════════════════════════════════════════
   OVERVIEW · revamp (".ovx") — soft, rounded, card-forward
   dashboard. Self-contained; nothing outside the main page
   references these classes.
   ════════════════════════════════════════════════════════ */
.ovx {
  --ovx-r: 20px;          /* card radius */
  --ovx-pad: 20px;
  --ovx-lime: var(--accent);   /* interim: brand crimson, pending design pick */
  --ovx-lime-ink: var(--accent-ink);
  --ovx-green: var(--accent);  /* interim: brand crimson */
}
.ovx :is(.ovx-ico, .ovx-qact .qi, .ovx-strip .ic) svg,
.ovx .ovx-search svg, .ovx .ovx-empty svg, .ovx .ovx-bars-empty svg {
  fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}

/* ── Greeting bar ── */
.ovx-top { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.ovx-hello h1 { font-family: var(--font); font-size: 28px; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.1; margin: 0; }
.ovx-hello p { font-size: 13.5px; color: var(--text-faint); margin: 6px 0 0; }
.ovx-tools { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.ovx-search { display: inline-flex; align-items: center; gap: 9px; height: 42px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.ovx-search:hover { border-color: var(--rule-2); box-shadow: var(--shadow-md); }
.ovx-search svg { width: 16px; height: 16px; stroke: var(--muted); }
.ovx-search span { min-width: 110px; text-align: left; }
.ovx-search kbd { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint);
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; }
.ovx-live { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.ovx-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 4px var(--ok-bg); animation: ovx-pulse 2.2s var(--ease) infinite; }
@keyframes ovx-pulse { 0%,100% { box-shadow: 0 0 0 3px var(--ok-bg); } 50% { box-shadow: 0 0 0 6px transparent; } }

/* ── Layout grid ── */
.ovx-grid { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
.ovx-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.ovx-side { display: flex; flex-direction: column; gap: 18px; }
.ovx-sec { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 2px -4px; }
.ovx-sec h2 { font-family: var(--font); font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.ovx-sec a { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.ovx-sec a:hover { color: var(--ovx-green); }

/* ── Shared card shell ── */
.ovx-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--ovx-r);
  box-shadow: var(--shadow-sm); overflow: hidden; }
.ovx-ch { display: flex; align-items: center; justify-content: space-between; padding: 16px var(--ovx-pad) 0; }
.ovx-ch h3 { font-size: 14.5px; font-weight: 600; margin: 0; }
.ovx-ch a, .ovx-tag { font-size: 12px; font-weight: 600; color: var(--muted); }
.ovx-ch a:hover { color: var(--ovx-green); }
.ovx-tag { font-family: var(--mono); font-weight: 500; font-size: 11px; color: var(--text-faint); }

/* ── Pastel icon tiles ── */
.ovx-ico, .ovx-qact .qi { width: 40px; height: 40px; border-radius: 13px; flex: none;
  display: flex; align-items: center; justify-content: center; }
.ovx-ico svg, .ovx-qact .qi svg { width: 19px; height: 19px; }
.i-violet { background: rgba(124,58,237,0.12); } .i-violet svg { stroke: #7c3aed; }
.i-green  { background: var(--ok-bg); }          .i-green svg  { stroke: var(--ok); }
.i-rose   { background: var(--danger-bg); }      .i-rose svg   { stroke: var(--danger); }
.i-amber  { background: var(--warn-bg); }        .i-amber svg  { stroke: var(--warn); }
.i-blue   { background: var(--info-bg); }        .i-blue svg   { stroke: var(--info); }

/* ── Stat cards ── */
.ovx-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.ovx-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--ovx-r);
  padding: var(--ovx-pad); display: flex; flex-direction: column; box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.ovx-stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--rule-2); }
.ovx-stat.alerty { border-color: var(--danger-edge); }
.ovx-stat-top { display: flex; align-items: center; gap: 13px; }
.ovx-stat .ovx-big { font-family: var(--font-display); font-size: 30px; font-weight: 600;
  letter-spacing: -0.02em; line-height: 1; margin: 0; color: var(--text); }
.ovx-big.ok { color: var(--ok); } .ovx-big.bad { color: var(--danger); } .ovx-big.warn { color: var(--warn); }
.ovx-stat .ovx-lbl { font-size: 13px; font-weight: 600; color: var(--text-2); margin-top: 6px; }
.ovx-stat .ovx-sub { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

/* ── Attention strip ── */
.ovx-strip { display: flex; align-items: center; gap: 13px; padding: 13px 18px;
  background: var(--danger-bg); border: 1px solid var(--danger-edge); border-radius: var(--ovx-r); }
.ovx-strip .ic { width: 34px; height: 34px; border-radius: 11px; flex: none; background: var(--danger);
  display: flex; align-items: center; justify-content: center; }
.ovx-strip .ic svg { width: 17px; height: 17px; stroke: #fff; }
.ovx-strip .tx { font-size: 13px; color: var(--text-2); }
.ovx-strip .tx b { color: var(--text); }
.ovx-strip .go { margin-left: auto; font-size: 12.5px; font-weight: 700; color: var(--danger); white-space: nowrap; }
.ovx-strip:hover .go { text-decoration: underline; }

/* ── Activity + alerts two-up ── */
.ovx-two { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; align-items: stretch; }
.ovx-activity, .ovx-alerts { display: flex; flex-direction: column; }
.ovx-bars { display: flex; align-items: flex-end; gap: 8px; padding: 18px var(--ovx-pad) 16px; flex: 1; min-height: 168px; }
.ovx-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 9px; height: 100%; }
.ovx-bar .track { width: 100%; max-width: 30px; flex: 1; display: flex; align-items: flex-end;
  background: var(--bg); border-radius: 9px; }
.ovx-bar .fill { width: 100%; min-height: 6px; border-radius: 9px; background: var(--rule-2);
  position: relative; transition: filter var(--dur) var(--ease); animation: ovx-grow 0.6s var(--ease) both; transform-origin: bottom; }
.ovx-bar.cur .fill { background: var(--ovx-lime); }
.ovx-bar .cap { position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; opacity: 0;
  transition: opacity var(--dur) var(--ease); white-space: nowrap; box-shadow: var(--shadow-sm); }
.ovx-bar.cur .cap, .ovx-bar:hover .cap { opacity: 1; }
.ovx-bar .day { font-size: 11px; color: var(--text-faint); font-weight: 500; }
.ovx-bar.cur .day { color: var(--text-2); font-weight: 700; }
@keyframes ovx-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.ovx-bars-empty { margin: auto; color: var(--text-faint); font-size: 13px; }

.ovx-alist { padding: 10px var(--ovx-pad) 14px; display: flex; flex-direction: column; }
.ovx-al { display: flex; align-items: flex-start; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.ovx-al:last-child { border-bottom: 0; }
.ovx-al .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 4px; flex: none; background: var(--muted); }
.ovx-al .dot.danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.ovx-al .dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.ovx-al .body { min-width: 0; }
.ovx-al .t1 { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ovx-al .t2 { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.ovx-al .t2 .mono { font-family: var(--mono); color: var(--muted); }
.ovx-al-more { display: block; padding-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--ovx-green); }
.ovx-al-more:hover { text-decoration: underline; }
.ovx-empty { display: flex; align-items: center; gap: 10px; padding: 22px var(--ovx-pad); color: var(--muted); font-size: 13px; }
.ovx-empty svg { width: 17px; height: 17px; flex: none; stroke: var(--ok); }

/* ── Quick actions ── */
.ovx-qa { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.ovx-qact { background: var(--surface); border: 1px solid var(--border); border-radius: var(--ovx-r);
  padding: 18px; display: flex; flex-direction: column; gap: 11px; box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.ovx-qact:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--rule-2); }
.ovx-qact .qt { font-size: 13.5px; font-weight: 600; color: var(--text); }
.ovx-qact .qd { font-size: 11.5px; color: var(--text-faint); line-height: 1.4; margin-top: -6px; }

/* ── Fleet pulse (accent-tinted hero card) ── */
.ovx-pulse { position: relative; overflow: hidden; border-radius: var(--ovx-r); padding: 22px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--surface)); box-shadow: var(--shadow-sm); }
.ovx-pulse::after { content: ""; position: absolute; right: -55px; top: -55px; width: 150px; height: 150px;
  border-radius: 50%; background: radial-gradient(circle, var(--accent-2-soft), transparent 70%); pointer-events: none; }
.ovx-pulse-head { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.12em; color: var(--muted); }
.ovx-pulse-head .d { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.ovx-ring-row { display: flex; align-items: center; gap: 16px; margin: 18px 0 14px; }
.ovx-ring { width: 96px; height: 96px; flex: none; }
.ovx-ring .trk { fill: none; stroke: color-mix(in srgb, var(--accent) 16%, var(--surface)); stroke-width: 9; }
.ovx-ring .val { fill: none; stroke: var(--accent); stroke-width: 9; stroke-linecap: round; }
.ovx-pulse.is-warn .val { stroke: var(--warn); }
.ovx-pulse.is-danger .val { stroke: var(--danger); }
.ovx-pulse.is-warn .ovx-pulse-head .d { background: var(--warn); }
.ovx-pulse.is-danger .ovx-pulse-head .d { background: var(--danger); }
.ovx-score b { font-family: var(--font-display); font-size: 46px; font-weight: 600; line-height: 1;
  letter-spacing: -0.02em; display: block; color: var(--text); }
.ovx-score span { font-size: 11.5px; color: var(--text-faint); line-height: 1.45; display: block; margin-top: 6px; }
.ovx-verdict { font-size: 13px; color: var(--text-2); line-height: 1.5; margin: 0 0 16px; }
.ovx-cta { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand-grad); color: #fff; font-size: 13px; font-weight: 700;
  padding: 11px 16px; border-radius: 999px; box-shadow: 0 6px 16px var(--accent-soft);
  transition: filter var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.ovx-cta:hover { filter: brightness(1.05); color: #fff; transform: translateY(-1px); box-shadow: 0 9px 22px var(--accent-edge); }

/* ── Snapshot tiles ── */
.ovx-snap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px var(--ovx-pad) var(--ovx-pad); }
.ovx-snap-grid .snap { background: var(--bg); border: 1px solid var(--border-soft); border-radius: 13px;
  padding: 13px 14px; display: flex; flex-direction: column; gap: 2px;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.ovx-snap-grid .snap:hover { border-color: var(--rule-2); background: var(--surface); }
.ovx-snap-grid .v { font-family: var(--font-display); font-size: 23px; font-weight: 600; line-height: 1; color: var(--text); }
.ovx-snap-grid .v.hot { color: var(--chart-temp); } .ovx-snap-grid .v.warn { color: var(--warn); }
.ovx-snap-grid .k { font-size: 11.5px; color: var(--text-faint); }

/* ── Recent activity ── */
.ovx-rlist { padding: 8px var(--ovx-pad) 14px; }
.ovx-r { display: flex; align-items: flex-start; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.ovx-r:last-child { border-bottom: 0; }
.ovx-r .av { width: 28px; height: 28px; border-radius: 50%; flex: none; display: flex; align-items: center;
  justify-content: center; background: var(--accent-soft); color: var(--accent-text); font-size: 12px;
  font-weight: 700; text-transform: uppercase; }
.ovx-r .body { min-width: 0; }
.ovx-r .t1 { font-size: 12.5px; color: var(--text-2); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ovx-r .t1 b { color: var(--text); font-weight: 600; }
.ovx-r .t2 { font-size: 11px; color: var(--text-faint); margin-top: 1px; }
.ovx-r .t2 .mono { font-family: var(--mono); color: var(--muted); }

/* ── Entrance ── */
.ovx-top, .ovx-grid { animation: ov-rise 0.45s var(--ease) both; }
.ovx-grid { animation-delay: 0.08s; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .ovx-grid { grid-template-columns: 1fr; }
  .ovx-side { flex-direction: row; flex-wrap: wrap; }
  .ovx-side > * { flex: 1 1 240px; }
}
@media (max-width: 720px) {
  .ovx-stats, .ovx-qa { grid-template-columns: 1fr 1fr; }
  .ovx-two { grid-template-columns: 1fr; }
  .ovx-hello h1 { font-size: 25px; }
  .ovx-tools { width: 100%; }
  .ovx-search { flex: 1; }
}

@keyframes ov-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ov-hero, .ov-strip, .ov-cols { animation: ov-rise 0.45s var(--ease) both; }
.ov-strip { animation-delay: 0.08s; }
.ov-cols { animation-delay: 0.16s; }

/* Devices page reuses the overview vocabulary: a single-row vitals strip plus
   the same staggered entrance for the filter bar and table card. */
.dv-vitals { grid-template-rows: none; margin-bottom: 18px; animation: ov-rise 0.45s var(--ease) both; }
.dv-vitals .ov-vital:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dv-rise-1 { animation: ov-rise 0.45s var(--ease) 0.08s both; }
.dv-rise-2 { animation: ov-rise 0.45s var(--ease) 0.16s both; }

/* Fleet-health vitals: five-up single row of the overview tiles. */
.hl-vitals { grid-template-columns: repeat(5, 1fr); grid-template-rows: none;
  margin-bottom: 18px; animation: ov-rise 0.45s var(--ease) both; }

/* Groups page: one card per cohort, same tile language as the overview vitals.
   The group name's ::after stretches over the card so the whole tile is the link;
   the delete form sits above it. */
.gp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.gp-card { position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-4); box-shadow: var(--shadow-sm); padding: 15px 17px;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.gp-card:hover { transform: translateY(-2px); border-color: var(--rule-2); }
.gp-card.alerty { border-color: var(--danger-edge); }
.gp-top { display: flex; align-items: baseline; gap: 12px; }
.gp-name { font-family: var(--font-display); font-size: 17px; font-weight: 600;
  color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.gp-name::after { content: ""; position: absolute; inset: 0; }
.gp-score { margin-left: auto; font-family: var(--font-display); font-size: 27px;
  font-weight: 600; letter-spacing: -0.01em; flex: none; }
.gp-score.is-ok { color: var(--ok); }
.gp-score.is-warn { color: var(--warn); }
.gp-score.is-danger { color: var(--danger); }
.gp-score.is-empty { color: var(--text-faint); font-size: 20px; }
.gp-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.gp-foot { display: flex; align-items: center; gap: 8px; font-size: 11.5px;
  color: var(--text-faint); margin-top: 10px; }
.gp-chip { font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ok); background: var(--ok-bg);
  border-radius: 5px; padding: 2px 7px; }
.gp-del { position: absolute; right: 12px; bottom: 12px; z-index: 1; opacity: 0;
  transition: opacity var(--dur) var(--ease); }
.gp-card:hover .gp-del, .gp-del:focus-within { opacity: 1; }

@media (max-width: 1100px) {
  .ov-hero { grid-template-columns: 1fr; }
  .ov-vitals { grid-template-columns: repeat(2, 1fr); }
  .ov-cols { grid-template-columns: 1fr; }
}

/* ── Alerts page ─────────────────────────────────────
 * Summary cards reuse the overview .ov-vital style; below: sticky control bar,
 * severity cells, row expansion. */
.alert-vitals {
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: none;
  margin: 14px 0 16px;
}
.alert-vitals .ov-vital .v.info { color: var(--info); }
.alert-vitals .ov-vital.is-active { border-color: var(--accent-edge); background: var(--accent-soft); }

/* Sticky control bar (search + grouped filters). */
.alert-controls {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  margin-bottom: 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
}
.alert-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  min-width: 220px;
}
.alert-search .ui-icon { position: absolute; left: 10px; color: var(--text-faint); pointer-events: none; }
.alert-search .search-input { padding-left: 32px; }
.alert-filter-group { display: flex; align-items: center; gap: 8px; }
.alert-filter-label {
  font-size: var(--t-11);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-faint);
}

/* On this page the sticky control bar owns the top edge; keep headers in flow. */
.alerts-table thead th { position: static; }
.alerts-table td { padding-top: 11px; padding-bottom: 11px; vertical-align: top; }
.alerts-table tbody tr.alert-row { cursor: default; }

/* Severity cell: icon + label, color-coded. */
.sev-cell { display: inline-flex; align-items: center; gap: 7px; font-weight: var(--fw-medium); text-transform: capitalize; }
.sev-cell .sev-icon { width: 16px; height: 16px; flex: 0 0 16px; }
.sev-cell .sev-icon svg { width: 16px; height: 16px; }
.sev-cell.sev-critical { color: var(--danger); }
.sev-cell.sev-warning  { color: var(--warn); }
.sev-cell.sev-info     { color: var(--info); }
.sev-text { font-size: var(--t-13); }

/* Occurrence multiplier badge. */
.occ-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  font-family: var(--mono);
  font-size: var(--t-11);
  font-weight: var(--fw-semibold);
  color: var(--warn);
  background: var(--warn-bg);
  border: 1px solid var(--warn-edge);
  border-radius: 999px;
  vertical-align: middle;
}

/* Expandable alert cell. */
.alert-expand-cell { cursor: pointer; }
.alert-caret {
  display: inline-block;
  color: var(--text-faint);
  font-size: 10px;
  margin-right: 5px;
  transition: transform var(--dur) var(--ease);
}
.alert-row.is-expanded .alert-caret { transform: rotate(90deg); }
.alert-summary { font-weight: var(--fw-medium); color: var(--text); }

/* Detail expansion row. */
.alert-detail-row > td { background: var(--surface2); padding: 0 16px; }
.alert-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  padding: 12px 4px 14px 20px;
}
.alert-detail-item { display: flex; flex-direction: column; gap: 2px; }
.alert-detail-item.alert-detail-raw { flex-basis: 100%; }
.alert-detail-k {
  font-size: var(--t-11);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-faint);
}
.alert-detail-v { font-size: var(--t-13); color: var(--text); }
.alert-detail-json {
  font-family: var(--mono);
  font-size: var(--t-12);
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-2);
  padding: 6px 10px;
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
}
/* Auto-captured crash logs shown inside an alert's detail row. */
.alert-logs { width: 100%; }
.alert-logs-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px; }
.alert-logs-acts { display: flex; gap: 6px; }
.lg-btn { font: inherit; font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 3px 9px; cursor: pointer; }
.lg-btn:hover { border-color: var(--accent-edge); color: var(--accent-text); }
.lg-btn.ai { color: var(--accent-2); border-color: var(--accent-2-soft); background: var(--accent-2-soft); }
.lg-btn.ai:hover { color: var(--accent-2); }
.lg-btn:disabled { opacity: .6; cursor: default; }
.alert-logs-pre { max-height: 320px; overflow: auto; margin: 0; }
.alert-logs-ai { margin-top: 10px; border: 1px solid var(--accent-2-soft); background: var(--accent-2-soft); border-radius: 10px; padding: 11px 13px; }
.alert-logs-ai.loading { color: var(--muted); font-size: 13px; }
.alert-logs-ai.err { border-color: var(--danger-bg); background: var(--danger-bg); color: var(--danger); font-size: 13px; }
.alert-logs-ai .ai-tag { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-2); margin-bottom: 6px; }
.alert-logs-ai .ai-body { font-size: 13px; line-height: 1.6; color: var(--fg); white-space: pre-wrap; }

/* De-emphasized destructive text button (Clear all). */
.btn-link-danger {
  background: none;
  border: none;
  color: var(--muted);
  font-size: var(--t-12);
  cursor: pointer;
  padding: 3px 6px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-link-danger:hover { color: var(--danger); }

@media (max-width: 1100px) {
  .alert-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .alert-stats { grid-template-columns: repeat(2, 1fr); }
  .alert-controls { flex-direction: column; align-items: stretch; }
}

/* ── Fixed alerts indicator (top-right bell) ─────────
 * Replaces the sidebar Alerts link; keeps alerts reachable from every page. */
.alerts-indicator {
  position: fixed;
  top: 16px;
  right: 18px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.alerts-indicator:hover { background: var(--surface2); border-color: var(--rule-2); transform: translateY(-1px); }
.alerts-indicator.active { border-color: var(--accent-edge); color: var(--accent-text); }
.alerts-indicator .ui-icon { width: 18px; height: 18px; }
.alerts-indicator .ui-icon svg { width: 18px; height: 18px; }
.alerts-indicator .nav-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  margin: 0;
  border: 2px solid var(--surface);
  height: 18px;
  min-width: 18px;
  border-radius: 9px;
}
/* ── Global top-right bar: search + alerts, shown on every page ── */
.topbar { position: fixed; top: 14px; right: 18px; z-index: 60; display: flex; align-items: center; gap: 10px; }
.topbar .alerts-indicator { position: static; }
.topbar-search { height: 38px; }
@media (max-width: 1024px) {
  /* Tablet & down: collapse the appbar search to an icon-only button. */
  .topbar { top: 9px; right: 56px; }
  .topbar-search span, .topbar-search kbd { display: none; }
  .topbar-search { width: 38px; min-width: 38px; padding: 0; justify-content: center; }
}

/* ── Fleet tab strip (Devices / Restaurants / Groups unified surface) ── */
.fleet-tabs { display:flex; gap:4px; border-bottom:1px solid var(--border); margin-bottom:18px; }
.fleet-tab {
  display:flex; align-items:center; gap:8px;
  padding:9px 18px; margin-bottom:-1px;
  font-size:14px; font-weight:var(--fw-medium); color:var(--muted);
  text-decoration:none; border-bottom:2px solid transparent;
  transition:color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.fleet-tab:hover { color:var(--text-2); }
.fleet-tab.cur { color: var(--accent-text); border-bottom-color:var(--accent); }
.fleet-tab .pill {
  font-family:var(--mono); font-size:var(--t-11);
  background:var(--surface2); color:var(--muted);
  border:1px solid var(--border); border-radius:999px; padding:0 7px; line-height:1.5;
}
.fleet-tab.cur .pill { color: var(--accent-text); border-color:var(--accent-edge); background:var(--accent-soft); }

/* ── Fleet Pulse status chip (on the dark hero card) ── */
.ovx-pulse-head .ovx-chip { margin-left: auto; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 3px 9px; border-radius: 999px; color: var(--text-2);
  background: var(--surface2); border: 1px solid var(--border); }
.ovx-pulse.is-warn .ovx-chip { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-edge); }
.ovx-pulse.is-danger .ovx-chip { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-edge); }

/* ════════════════════════════════════════════════════════
   FLEET page · filters (F1) — quick views + a Filters popover
   + active-filter chips, replacing the old inline filter row.
   ════════════════════════════════════════════════════════ */
.fleet-views { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.fleet-view { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease); }
.fleet-view:hover { border-color: var(--rule-2); }
.fleet-view .n { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.fleet-view.on { background: var(--accent-soft); border-color: var(--accent-edge); color: var(--accent-text); }
.fleet-view.on .n { color: var(--accent-text); }

.fleet-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px;
  position: relative; z-index: 40; }
.fleet-search { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 9px; height: 40px;
  padding: 0 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; color: var(--muted); }
.fleet-search svg { width: 16px; height: 16px; flex: none; }
.fleet-search input { flex: 1; border: 0; background: none; outline: none; font: inherit; font-size: 13px; color: var(--text); }
/* The container shows the focus ring (:focus-within); suppress the input's own
   global focus ring so they don't stack into a double outline. */
.fleet-search input:focus, .fleet-search input:focus-visible { outline: none; box-shadow: none; }
.fleet-search:focus-within { border-color: var(--accent-edge); box-shadow: var(--ring); }

.fleet-fwrap { position: relative; }
.fleet-fbtn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px; font: inherit;
  font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease); }
.fleet-fbtn:hover, .fleet-fbtn.open { border-color: var(--rule-2); }
.fleet-fbtn.has { color: var(--accent-text); border-color: var(--accent-edge); background: var(--accent-soft); }
.fleet-fbtn svg { width: 16px; height: 16px; }
.fleet-fbtn .cnt { display: inline-flex; align-items: center; justify-content: center; min-width: 18px;
  height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.fleet-fbtn .cnt[hidden] { display: none; }

.fleet-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px; color: var(--text-2); cursor: pointer; }
.fleet-iconbtn:hover { border-color: var(--rule-2); }

.fleet-pop { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; width: 520px; max-width: 92vw;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-pop);
  padding: 18px; animation: ov-rise 0.16s var(--ease) both; }
.fleet-pop[hidden] { display: none; }
.fp-cap { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); margin: 0 0 10px; }
.fp-cap:not(:first-child) { margin-top: 18px; }
.fp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.fp-field { display: flex; flex-direction: column; gap: 5px; }
.fp-field span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.fp-field select { height: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); font: inherit; font-size: 13px; color: var(--text); cursor: pointer; }
.fp-field select:focus { outline: none; border-color: var(--accent-edge); box-shadow: var(--ring); }
.fp-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 18px;
  padding-top: 14px; border-top: 1px solid var(--border-soft); }
.fp-clear { background: none; border: 0; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.fp-clear:hover { color: var(--accent-text); }
.fp-done { font-size: 12.5px; padding: 8px 16px; }

.fleet-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.fleet-seg button { padding: 8px 16px; border: 0; background: var(--surface); font: inherit; font-size: 12.5px;
  font-weight: 600; color: var(--text-2); cursor: pointer; }
.fleet-seg button + button { border-left: 1px solid var(--border); }
.fleet-seg button.on { background: var(--accent-soft); color: var(--accent-text); }

.fleet-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 13px 16px; margin: 0; border-bottom: 1px solid var(--border-soft); }
.fchip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 6px 0 11px;
  border-radius: 999px; background: var(--accent-soft); border: 1px solid var(--accent-edge);
  color: var(--accent-text); font-size: 12.5px; font-weight: 600; }
.fchip .k { opacity: .72; }
.fchip .x { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border: 0; border-radius: 50%; background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent-text); font-size: 13px; line-height: 1; cursor: pointer; }
.fchip .x:hover { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.fchip-clear { background: none; border: 0; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.fchip-clear:hover { color: var(--accent-text); }

@media (max-width: 680px) {
  .fp-grid { grid-template-columns: 1fr; }
  .fleet-pop { width: 340px; }
}

/* ════════════════════════════════════════════════════════
   FLEET page · master–detail (L-A) — collections rail + roster
   ════════════════════════════════════════════════════════ */
.fleet-md { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 20px; align-items: start; }
.fleet-rail { position: sticky; top: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 10px 8px; max-height: calc(100vh - 32px); overflow-y: auto; }
.fleet-rail-cap { display: flex; align-items: center; gap: 6px; margin: 15px 8px 5px; font-size: 10px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); }
.fleet-rail-cap:first-child { margin-top: 4px; }
.fleet-rail-cap a:first-child { color: var(--text-faint); }
.fleet-rail-cap a:first-child:hover, .fleet-rail-cap a:first-child.on { color: var(--accent-text); }
.fleet-rail-cap .add { margin-left: auto; width: 18px; height: 18px; display: inline-flex; align-items: center;
  justify-content: center; border-radius: 6px; font-size: 15px; line-height: 1; color: var(--muted); }
.fleet-rail-cap .add:hover { background: var(--accent-soft); color: var(--accent-text); }
.fleet-rail-item { display: flex; align-items: center; gap: 0; border-radius: 9px; font-size: 13px;
  color: var(--text-2); text-decoration: none; }
a.fleet-rail-item { gap: 9px; padding: 8px 9px; }
.fleet-rail-item:hover { background: var(--hover); }
.fleet-rail-item.on { background: var(--accent-soft); color: var(--accent-text); }
.fleet-rail-item .nm { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fleet-rail-item .ct { font-family: var(--mono); font-size: 11px; color: var(--text-faint); flex: none; padding-right: 9px; }
.fleet-rail-item .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
/* collection rows: a filter link (.ri-main) + an always-visible "→" detail link
   (.ri-go). The arrow stays faded so it reads as "open this collection's page" at a
   glance (it used to be hover-only, which hid that the row was openable), and brightens
   + nudges right on hover. */
.fleet-rail-item .ri-main { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0;
  padding: 8px 0 8px 9px; color: inherit; text-decoration: none; }
.fleet-rail-item .ri-go { opacity: .45; width: 24px; height: 30px; display: inline-flex; align-items: center;
  justify-content: center; color: var(--muted); text-decoration: none; flex: none;
  transition: opacity .12s, transform .12s, color .12s; }
.fleet-rail-item:hover .ri-go { opacity: 1; transform: translateX(2px); }
.fleet-rail-item .ri-go:hover { color: var(--accent-text); opacity: 1; }
.fleet-rail-item.on, .fleet-rail-item.on .ri-main, .fleet-rail-item.on .nm, .fleet-rail-item.on .ct { color: var(--accent-text); }
.fleet-rail-item .dot.ok { background: var(--ok); }
.fleet-rail-item .dot.warn { background: var(--warn); }
.fleet-rail-item .dot.bad { background: var(--danger); }
.fleet-rail-item .dot.muted { background: var(--text-faint); }

.fleet-rail-empty { padding: 5px 9px 6px; font-size: 12px; color: var(--text-faint); }
.fleet-rail-empty a { font-weight: 600; color: var(--muted); }
.fleet-rail-empty a:hover { color: var(--accent-text); }

.fleet-roster { min-width: 0; }
.fleet-pane-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.fleet-pane-head .t { font-size: 17px; font-weight: 700; }
.fleet-pane-head .c { font-size: 13px; color: var(--muted); }

/* Rail section captions rendered as pills — they are section buttons/links. */
.fleet-rail-cap > a:first-child, .fleet-rail-cap > span:first-child {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  background: var(--hover); border: 1px solid var(--border-soft); color: var(--muted);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  text-decoration: none; line-height: 1.5; transition: background .12s, color .12s, border-color .12s; }
.fleet-rail-cap > a:first-child:hover, .fleet-rail-cap > a:first-child.on {
  background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-text); }

/* Collection toolbar (rename / delete / manage the active group·venue·release). */
.coll-tools { display: inline-flex; align-items: center; gap: 4px; }
.ct-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 26px; min-width: 26px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--border-soft);
  background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: background .12s, color .12s, border-color .12s; }
.ct-btn:hover { background: var(--hover); color: var(--accent-text); border-color: var(--border); }
.ct-btn.danger:hover { background: var(--danger-soft, rgba(216,39,71,.12)); color: var(--danger); border-color: var(--danger); }

/* Group/venue kebab menu — reuses the top-bar .nbar-pop/.nbar-mi look, positioned
   under the toolbar kebab instead of the app bar. */
.coll-menu-wrap { position: relative; }
.coll-menu { left: 0; right: auto; top: calc(100% + 6px); width: 208px; }
.coll-menu .nbar-mi { font-size: 12.5px; padding: 8px 10px; }

/* Inline rename — replaces the roster title in place; see collRenameOpen/Close. */
.coll-rename { display: inline-flex; align-items: center; gap: 6px; }
.coll-rename input[type=text] { height: 30px; font-size: 13px; width: 220px; padding: 0 10px;
  border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }

/* Push-page target rail — single-select scope chips (All / restaurants / groups),
   mirroring the Actions target picker. */
.push-rail { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.push-rail .pr-src { width: 100%; font-size: 10.5px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-faint); margin: 9px 0 1px; }
.pr-item { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2, var(--muted));
  font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .12s, color .12s, border-color .12s; }
.pr-item:hover { background: var(--hover); }
.pr-item.on { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-text); }
.pr-item .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pr-item .dot.ok { background: var(--ok); }
.pr-item .dot.muted { background: var(--text-faint); }
.pr-item .ct { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.pr-item.on .ct { color: var(--accent-text); }

@media (max-width: 1024px) {
  .fleet-md { grid-template-columns: 1fr; }
  .fleet-rail { position: static; max-height: none; }
}

/* ── Fleet collections grid + detail (in-shell, Option A) ── */
.cl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.cl-card { border: 1px solid var(--border); border-radius: 14px; padding: 15px; background: var(--surface);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.cl-card:hover { border-color: var(--rule-2); box-shadow: var(--shadow-md); }
.cl-card.alerty { border-color: var(--danger-edge); }
.cl-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cl-name { font-weight: 700; font-size: 14.5px; color: var(--text); }
.cl-name:hover { color: var(--accent-text); }
.cl-score { font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 7px; flex: none; }
.cl-score.ok { background: var(--ok-bg); color: var(--ok); }
.cl-score.warn { background: var(--warn-bg); color: var(--warn); }
.cl-score.bad { background: var(--danger-bg); color: var(--danger); }
.cl-score.is-empty { background: var(--surface2); color: var(--text-faint); }
.cl-meta { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.cl-meta .danger { color: var(--danger); }
.cl-foot { display: flex; align-items: center; gap: 14px; margin-top: 13px; padding-top: 11px;
  border-top: 1px solid var(--border-soft); font-size: 12.5px; font-weight: 600; }
.cl-foot a { color: var(--muted); }
.cl-foot a:hover { color: var(--accent-text); }
.cl-delform { margin-left: auto; }
.cl-del { background: none; border: 0; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--danger); cursor: pointer; padding: 0; }
.cl-del:hover { text-decoration: underline; }

.dt-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.dt-head .dt-name { font-size: 19px; font-weight: 700; }
.dt-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.dt-stat { border: 1px solid var(--border); border-radius: 12px; padding: 12px 15px; background: var(--surface); }
.dt-stat .v { font-size: 22px; font-weight: 700; }
.dt-stat .k { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

/* ════════════════════════════════════════════════════════
   FLEET · device list as cards (C2 row cards) + sort control
   ════════════════════════════════════════════════════════ */
/* Scroll the roster horizontally instead of clipping it: the .card wrapper sets
   overflow:hidden, and the columns have min-widths, so at ~320px / 400% zoom the
   right-hand columns were cut off (data loss). overflow-x:auto keeps them reachable
   (WCAG 1.4.10); overflow-y stays hidden so the card's rounded corners are preserved. */
#device-table-container { container-type: inline-size; overflow-x: auto; }
.dl-list { display: flex; flex-direction: column; }
/* Column-count control. The whole segment hides when there's no room for >1
   column; the "3" option appears only when there's room for three. */
.cols-seg { display: none; margin-left: auto; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cols-seg button { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 28px;
  border: 0; background: var(--surface); color: var(--muted); cursor: pointer; }
.cols-seg button + button { border-left: 1px solid var(--border); }
.cols-seg button:hover { color: var(--text-2); background: var(--hover); }
.cols-seg button.on { background: var(--accent-soft); color: var(--accent-text); }
.cols-seg button svg { width: 15px; height: 15px; }
.cols-seg [data-cols="3"] { display: none; }
.dl-card { display: grid; grid-template-columns: 18px auto minmax(0, 1.4fr) auto auto auto;
  grid-template-areas: "cb bat id metrics status act";
  align-items: center; gap: 18px; padding: 11px 16px; border-bottom: 1px solid var(--border-soft);
  background: var(--surface); transition: background var(--dur) var(--ease); }
.dl-card:first-child { border-top: 1px solid var(--border-soft); }
.dl-card:hover { background: var(--hover); }
.dl-card.row-selected { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.dl-card > .device-cb { width: 15px; height: 15px; grid-area: cb; }
.dl-card > .dl-cb-spacer { grid-area: cb; width: 0; }
.dl-card > .dl-bat { grid-area: bat; }
.dl-card > .dl-id { grid-area: id; }
/* Top-align (not the grid's default center) — .dl-card's align-items:center
   centers each column on its OWN height, and .dl-metrics (always 2-3 lines)
   vs .dl-status-col (1 line online, 2 offline with "Last seen") differ, so
   centering independently put their first lines at different heights: an
   offline row's RAM/Temp/Cycles rows didn't line up with an online row's. */
.dl-card > .dl-metrics { grid-area: metrics; align-self: start; }
.dl-card > .dl-status-col { grid-area: status; align-self: start; }
.dl-card > .dl-act { grid-area: act; }

/* battery — tinted chip: glyph + % on a level-tinted pill */
.dl-bat { display: flex; align-items: center; flex: none; }
.dl-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; white-space: nowrap; }
.dl-chip .bat-glyph { display: inline-flex; }
.dl-chip .bat-glyph svg { display: block; }
.dl-chip.battery-ok { background: rgba(43, 182, 115, .13); color: #1c7d50; }
.dl-chip.battery-mid { background: rgba(232, 161, 58, .15); color: #9a6512; }
.dl-chip.battery-low { background: rgba(229, 72, 77, .13); color: #b4282d; }
html[data-theme="dark"] .dl-chip.battery-ok { background: rgba(43, 182, 115, .2); color: #5fd49a; }
html[data-theme="dark"] .dl-chip.battery-mid { background: rgba(232, 161, 58, .22); color: #f0b765; }
html[data-theme="dark"] .dl-chip.battery-low { background: rgba(229, 72, 77, .22); color: #f08a8d; }

/* identity column: serial / release / onboarded */
.dl-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dl-id-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dl-serial { display: inline; font-family: var(--mono); font-size: 13px; font-weight: 600;
  color: var(--accent-text); padding: 0; border: 0; border-radius: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-serial:hover { color: var(--accent-h); text-decoration: underline; }
.dl-kiosk { color: var(--muted); display: inline-flex; flex: none; }
.dl-flap { color: var(--warn); display: inline-flex; flex: none; vertical-align: -1px; }
.vitals-flap { color: var(--warn); display: inline-flex; align-items: center; vertical-align: -2px; }
.ddc-flap-alert { display: flex; align-items: flex-start; gap: 11px; margin: 14px 0 2px; padding: 11px 14px;
  background: var(--warn-bg); border: 1px solid var(--warn); border-radius: 10px; font-size: 13px; line-height: 1.5; color: var(--text2, var(--muted)); }
.ddc-flap-alert .ic { flex: none; color: var(--warn); display: inline-flex; margin-top: 1px; }
.ddc-flap-alert b { color: var(--text); font-weight: 650; }
.dl-hidden-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; flex: none;
  color: var(--muted); background: var(--surface2); border-radius: 4px; padding: 1px 5px; }
.dl-rel { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-onboard { font-size: 10.5px; color: var(--text-faint); white-space: nowrap; }
/* Product category tag on a device card (e.g. "Kiosk 27"). */
.dl-product { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 8px;
  background: var(--surface-2, rgba(127,127,127,.14)); color: var(--text-faint);
  font-family: var(--sans, inherit); font-size: 10px; letter-spacing: .02em; vertical-align: middle; }
/* Mains-power chip shown in place of the battery chip for wall-powered kiosks. */
.dl-chip.dl-mains { color: var(--muted); }

/* status column: online/offline + last sync */
.dl-status-col { display: flex; flex-direction: column; gap: 2px; white-space: nowrap; }
.dl-status { font-size: 12.5px; font-weight: 600; }
.dl-status i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dl-status.on { color: var(--ok); } .dl-status.on i { background: var(--ok); }
.dl-status.off { color: var(--muted); } .dl-status.off i { background: var(--text-faint); }
.dl-synced { font-size: 11px; color: var(--text-faint); }
.dl-synced.hidden { display: none; }
/* Legacy-device tag (WS-incapable firmware — always shows Offline by design). */
.ddc-legacy-tag, .dl-legacy-tag {
  display: inline-flex; align-items: center; gap: 4px; vertical-align: middle;
  border-radius: 99px; font-weight: 600; white-space: nowrap; cursor: help;
  background: rgba(122,128,246,.10); color: #5a4bd0; border: 1px solid transparent;
}
.ddc-legacy-tag { margin-left: 8px; padding: 2px 9px; font-size: 11.5px; }
.dl-legacy-tag { margin-top: 4px; padding: 1px 7px; font-size: 10px; }
.ddc-info-ic { opacity: .75; flex: none; }
html[data-theme="dark"] .ddc-legacy-tag,
html[data-theme="dark"] .dl-legacy-tag { background: rgba(122,128,246,.2); color: #b3a8f5; }
/* Settings: legacy-build chips (add/remove list). */
.legacy-build-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 12px;
  border-radius: 99px; background: rgba(122,128,246,.10); color: #5a4bd0; font-size: 12.5px; font-weight: 600; }
.legacy-build-x { border: none; background: transparent; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; opacity: .6; }
.legacy-build-x:hover { opacity: 1; }
html[data-theme="dark"] .legacy-build-chip { background: rgba(122,128,246,.2); color: #b3a8f5; }

/* metrics column: RAM / Temp stacked */
.dl-metrics { display: flex; flex-direction: column; gap: 2px; white-space: nowrap; }
.dl-m { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
.dl-m .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); min-width: 30px; }
.dl-m .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.dl-m .v.muted { color: var(--text-faint); font-weight: 500; }

.dl-act { display: flex; align-items: center; gap: 10px; justify-self: end; }
.dl-view { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  padding: 0; border: 0; border-radius: 8px; color: var(--muted); transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.dl-view:hover { background: var(--accent-soft); color: var(--accent-text); }
.dl-x { width: 24px; height: 24px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface);
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; cursor: pointer; }
.dl-x:hover { border-color: var(--danger-edge); color: var(--danger); }
.dl-unhide:hover { border-color: var(--accent-edge); color: var(--accent-text); }

/* Reflow based on the list's own width (handles the narrow inspector pane,
   not just the viewport): stay one line, dropping the secondary info but
   keeping status, serial and battery. */
@container (max-width: 680px) {
  .dl-card {
    grid-template-columns: 18px minmax(0, 1fr) auto auto;
    grid-template-areas:
      "cb id  status act"
      "cb bat status act";
    gap: 5px 14px;
  }
  .dl-metrics { display: none; }
  .dl-rel, .dl-onboard { display: none; }
}
/* Wide enough for ≥2 columns: offer the control, and lay the cards out in
   their compact form when multi-column. cols-3 falls back to 2 here and only
   becomes 3 once there's room (next query). */
@container (min-width: 640px) {
  .cols-seg { display: inline-flex; }
  .dl-list.cols-2, .dl-list.cols-3 { display: grid; grid-template-columns: 1fr 1fr; }
  .dl-list.cols-2 .dl-card, .dl-list.cols-3 .dl-card {
    grid-template-columns: 18px minmax(0, 1fr) auto auto;
    grid-template-areas:
      "cb id  status act"
      "cb bat status act";
    gap: 5px 14px;
  }
  .dl-list.cols-2 .dl-metrics, .dl-list.cols-3 .dl-metrics { display: none; }
  .dl-list.cols-2 .dl-rel, .dl-list.cols-2 .dl-onboard,
  .dl-list.cols-3 .dl-rel, .dl-list.cols-3 .dl-onboard { display: none; }
  .dl-list.cols-2 .dl-card, .dl-list.cols-3 .dl-card { border-right: 1px solid var(--border-soft); }
}
/* Wide enough for three columns: surface the option and use it. */
@container (min-width: 930px) {
  .cols-seg [data-cols="3"] { display: inline-flex; }
  .dl-list.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* Sort popover (reuses .fleet-fwrap / .fleet-pop) */
.fleet-sortpop { width: 230px; }
.sortpop { display: flex; flex-direction: column; gap: 2px; }
.sortopt { display: flex; align-items: center; justify-content: space-between; padding: 9px 11px; border: 0;
  background: none; border-radius: 8px; font: inherit; font-size: 13px; color: var(--text-2); cursor: pointer; text-align: left; }
.sortopt:hover { background: var(--hover); }
.sortopt.on { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.sortopt .dir { font-family: var(--mono); font-size: 13px; min-width: 12px; text-align: right; }

/* ===== shared two-pane device picker (.dp-*) — used by group/restaurant add + create ===== */
.dp-tp { display: grid; grid-template-columns: 1fr 320px; gap: 16px; }
.dp-pane { background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.dp-pane-h { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft); }
.dp-pane-h .t { font-weight: 700; font-size: 12.5px; }
.dp-pane-h .n { color: var(--text-faint); font-size: 11.5px; font-weight: 600; }
.dp-search { margin: 11px 14px 0; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border);
  border-radius: 9px; padding: 7px 11px; color: var(--text-faint); }
.dp-search input { border: 0; outline: 0; font: inherit; font-size: 13px; flex: 1; background: none; color: var(--text); }
.dp-pills { display: flex; gap: 6px; flex-wrap: wrap; padding: 11px 14px 4px; }
.dp-pill { font: inherit; font-size: 11.5px; font-weight: 600; padding: 5px 10px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
.dp-pill.sel { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.dp-rows { padding: 5px 7px; overflow: auto; max-height: 340px; min-height: 120px; }
.dp-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 11px; align-items: center;
  padding: 8px 9px; border-radius: 9px; }
.dp-row:hover { background: var(--hover); }
.dp-row.staged { opacity: .55; }
.dp-bchip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dp-bchip svg { display: block; }
.dp-bchip.battery-ok { background: rgba(43,182,115,.13); color: #1c7d50; }
.dp-bchip.battery-mid { background: rgba(232,161,58,.15); color: #9a6512; }
.dp-bchip.battery-low { background: rgba(229,72,77,.13); color: #b4282d; }
html[data-theme="dark"] .dp-bchip.battery-ok { background: rgba(43,182,115,.2); color: #5fd49a; }
html[data-theme="dark"] .dp-bchip.battery-mid { background: rgba(232,161,58,.22); color: #f0b765; }
html[data-theme="dark"] .dp-bchip.battery-low { background: rgba(229,72,77,.22); color: #f08a8d; }
.dp-rid { min-width: 0; }
.dp-serial { font-weight: 600; font-size: 13px; }
.dp-sub { color: var(--muted); font-size: 11px; }
.dp-where { font-size: 11px; color: var(--muted); white-space: nowrap; }
.dp-where.lab { color: var(--accent-2); font-weight: 600; }
.dp-where.elsewhere { color: #8a5d12; background: rgba(232,161,58,.12); padding: 2px 7px; border-radius: 6px; font-weight: 600; }
html[data-theme="dark"] .dp-where.elsewhere { color: #f0b765; }
.dp-add { width: 27px; height: 27px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  color: var(--accent-text); font-size: 16px; line-height: 1; cursor: pointer; }
.dp-add:hover { background: var(--accent-soft); border-color: transparent; }
.dp-add.done { color: var(--ok); border-color: transparent; background: none; cursor: default; }
.dp-empty { padding: 24px 16px; text-align: center; color: var(--text-faint); font-size: 12.5px; }
/* staging basket */
.dp-basket { padding: 7px; overflow: auto; flex: 1; min-height: 170px; }
.dp-bk-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 170px; color: var(--text-faint); font-size: 12.5px; text-align: center; }
.dp-bk-row { display: grid; grid-template-columns: auto 1fr auto; gap: 9px; align-items: center;
  padding: 7px 9px; border-radius: 8px; }
.dp-bk-row:hover { background: var(--hover); }
.dp-bk-id { min-width: 0; }
.dp-bk-move { font-size: 10.5px; color: #8a5d12; }
html[data-theme="dark"] .dp-bk-move { color: #f0b765; }
.dp-x { color: var(--text-faint); cursor: pointer; font-size: 15px; border: 0; background: none; }
.dp-x:hover { color: var(--danger); }
.dp-moves { display: flex; align-items: center; gap: 8px; background: rgba(232,161,58,.12); color: #8a5d12;
  font-size: 12px; padding: 9px 13px; border-radius: 9px; margin: 12px 14px 0; }
html[data-theme="dark"] .dp-moves { color: #f0b765; }
.dp-bar { display: flex; align-items: center; gap: 14px; padding: 14px 0 0; margin-top: 14px; border-top: 1px solid var(--border-soft); }
.dp-bar .summary { font-size: 13px; color: var(--muted); }
.dp-bar .summary b { color: var(--text); }
@media (max-width: 1024px) { .dp-tp { grid-template-columns: 1fr; } }

/* Fleet-page "Add/remove devices" popup — wider than a normal modal (it hosts the
   two-pane device picker + members list, both of which need real room), stacked
   above everything else on the page (kebab menus, toasts, etc — z-index:1300), and
   every list inside it drops to serial + one action button so it doesn't get
   crowded. The submit bar and members list sit below the picker in document flow;
   modal-box caps at 85vh with overflow:hidden, so modal-body needs its own bounded
   height + overflow-y:auto to make that reachable rather than silently clipped. A
   plain max-height (not flex-basis) is used here deliberately — it's not at the
   mercy of flex-shrink/min-height:auto edge cases that were still clipping content
   under some layouts. */
#fleet-devices-modal { z-index: 1300; }
#fleet-devices-modal .modal-box { max-width: 760px; }
#fleet-devices-modal .modal-body {
  max-height: min(66vh, 620px);
  overflow-y: auto !important;
}
/* .modal-body is flex-direction:column, and its card children have overflow:hidden
   — which makes their flex-shrink auto-minimum 0, so flexbox was compressing them
   to fit the bounded height above instead of letting them overflow into the
   scrollbar. Refusing to shrink is what actually makes the max-height above
   produce a real scrollbar instead of silently clipped content. */
#fleet-devices-modal .modal-body > * { flex-shrink: 0; }
#fleet-devices-modal .dp-tp { grid-template-columns: 1fr 1fr; }
#fleet-devices-modal .dp-rows { max-height: 220px; }
#fleet-devices-modal .dp-basket { min-height: 120px; }
#fleet-devices-modal .dp-row { grid-template-columns: 1fr auto; }
#fleet-devices-modal .dp-row .dp-bchip,
#fleet-devices-modal .dp-row .dp-where,
#fleet-devices-modal .dp-sub { display: none; }
#fleet-devices-modal .dp-rid { grid-column: 1; }
#fleet-devices-modal .dp-add { grid-column: 2; }
#fleet-devices-modal .dp-bk-row { grid-template-columns: 1fr auto; }
#fleet-devices-modal .dp-bk-row .dp-bchip { display: none; }
#fleet-devices-modal .dp-bk-id { grid-column: 1; }
#fleet-devices-modal .dp-x { grid-column: 2; }
@media (max-width: 640px) { #fleet-devices-modal .dp-tp { grid-template-columns: 1fr; } }

/* Lean device list (see "device-cards-lean") — serial + one action button. */
.dl-lean-list { display: flex; flex-direction: column; max-height: 260px; overflow: auto;
  border: 1px solid var(--border); border-radius: 12px; }
.dl-lean-row { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; border-bottom: 1px solid var(--border-soft); }
.dl-lean-row:last-child { border-bottom: 0; }
.dl-lean-row:hover { background: var(--hover); }
.dl-lean-serial { font-size: 13px; font-weight: 600; color: var(--text); text-decoration: none; }
.dl-lean-serial:hover { color: var(--accent-text); }

/* ===== device detail — Cockpit hero ===== */
.ddc-hero { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px 22px; margin-bottom: 16px; }
.ddc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ddc-id { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ddc-status { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; }
.ddc-status i { width: 8px; height: 8px; border-radius: 50%; }
.ddc-status.on { color: var(--ok); } .ddc-status.on i { background: var(--ok); box-shadow: 0 0 0 3px rgba(43,182,115,.18); }
.ddc-status.off { color: var(--muted); } .ddc-status.off i { background: var(--text-faint); }
.ddc-serial { font-size: 23px; font-weight: 700; letter-spacing: -.01em; }
.ddc-meta { color: var(--muted); font-size: 12.5px; }
.ddc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ddc-btn { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 13px; border-radius: 10px; cursor: pointer; text-decoration: none; }
.ddc-btn:hover { background: var(--hover); }
.ddc-btn svg { width: 15px; height: 15px; flex: none; }
/* primary hero action (Remote Control) */
.ddc-btn-prim { background: var(--accent); border-color: transparent; color: #fff; }
/* Keep the label white on hover. Without this, the global `a:hover { color: accent }`
   (this button is an <a>) repaints the text coral on the coral hover background,
   making it vanish. */
.ddc-btn-prim:hover { background: var(--accent-h); color: #fff; }
/* hero "Actions ▾" dropdown */
.ddc-menu-wrap { position: relative; }
.ddc-caret { width: 13px; height: 13px; opacity: .8; }
.ddc-btn.open { border-color: var(--rule-2); }
.ddc-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: 232px;
  background: rgba(255,255,255,.45); backdrop-filter: blur(18px) saturate(180%); -webkit-backdrop-filter: blur(18px) saturate(180%);
  will-change: backdrop-filter; /* own compositing layer — see .toast for why */
  border: 1px solid rgba(255,255,255,.29); border-radius: 16px;
  box-shadow: 0 14px 36px rgba(0,0,0,.21), inset 0 1px 0 rgba(255,255,255,.50); padding: 7px; animation: ov-rise 0.14s var(--ease) both; }
html[data-theme="dark"] .ddc-menu { background: rgba(20,18,17,.45); border-color: rgba(255,255,255,.12); }
.ddc-menu[hidden] { display: none; }
.ddc-mcap { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-faint); padding: 9px 10px 5px; }
.ddc-mi { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border: 0;
  background: none; border-radius: 9px; font: inherit; font-size: 13px; color: var(--text);
  text-align: left; text-decoration: none; cursor: pointer; box-sizing: border-box; }
.ddc-mi:hover { background: var(--hover); }
.ddc-mi svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.ddc-mi.danger, .ddc-mi.danger svg { color: var(--danger); }
.ddc-mi.danger:hover { background: var(--danger-bg); }
.ddc-msep { height: 1px; background: var(--border-soft); margin: 5px 4px; }
.ddc-menu form { margin: 0; }
.ddc-vitals { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.ddc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; font-size: 12.5px; font-weight: 600;
  font-variant-numeric: tabular-nums; background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.ddc-chip svg, .ddc-chip .ic { display: block; flex: none; }
.ddc-chip.battery-ok { background: rgba(43,182,115,.13); color: #1c7d50; border-color: transparent; }
.ddc-chip.battery-mid { background: rgba(232,161,58,.15); color: #9a6512; border-color: transparent; }
.ddc-chip.battery-low { background: rgba(229,72,77,.13); color: #b4282d; border-color: transparent; }
html[data-theme="dark"] .ddc-chip.battery-ok { background: rgba(43,182,115,.2); color: #5fd49a; }
html[data-theme="dark"] .ddc-chip.battery-mid { background: rgba(232,161,58,.22); color: #f0b765; }
html[data-theme="dark"] .ddc-chip.battery-low { background: rgba(229,72,77,.22); color: #f08a8d; }
.ddc-chip .k { color: var(--text-faint); font-weight: 600; }
/* font-family/line-height only — "font: inherit" here would also reset the base
   rule's font-size/font-weight (button.ddc-chip outranks the plain .ddc-chip
   selector on specificity), which was why the Wi-Fi pill (the only <button>
   among these otherwise-<span> chips) rendered with different text than the rest. */
button.ddc-chip { appearance: none; cursor: pointer; font-family: inherit; line-height: inherit; }
button.ddc-chip:hover { background: var(--surface-2, var(--surface)); }
.wifi-scan-list { display: flex; flex-direction: column; gap: 2px; max-height: 360px; overflow-y: auto; }
.wifi-scan-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--border-soft, var(--border)); }
.wifi-scan-row:last-child { border-bottom: none; }
.wifi-scan-row .ic { flex: none; }
.wifi-scan-ssid { flex: 1; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wifi-scan-bssid { font-family: var(--mono); flex: none; }
.wifi-scan-rssi { flex: none; font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text-faint); min-width: 62px; text-align: right; }
/* Wireless-charging (WLC) state chip — colours mirror the battery-graph legend. */
.ddc-chip.wlc-on  { background: rgba(232,67,147,.13); color: #c0267a; border-color: transparent; }
.ddc-chip.wlc-off { background: rgba(108,92,231,.12); color: #5a4bd0; border-color: transparent; }
.ddc-chip.wlc-bad { background: rgba(243,156,18,.15); color: #9a6512; border-color: transparent; }
html[data-theme="dark"] .ddc-chip.wlc-on  { background: rgba(232,67,147,.22); color: #f48fbf; }
html[data-theme="dark"] .ddc-chip.wlc-off { background: rgba(108,92,231,.24); color: #b3a8f5; }
html[data-theme="dark"] .ddc-chip.wlc-bad { background: rgba(243,156,18,.22); color: #f0b765; }
/* placement strip */
.ddc-place { display: flex; gap: 26px; flex-wrap: wrap; align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 13px 18px; margin-bottom: 16px; }
.ddc-place-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ddc-place-item .k { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); }
.ddc-place-item .v { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ddc-gtag { display: inline-flex; align-items: center; gap: 6px; background: rgba(122,128,246,.12); color: #4b50c4; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 7px; text-decoration: none; }
html[data-theme="dark"] .ddc-gtag { color: #a9adfb; }
.ddc-alert { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; }
.ddc-alert.danger { background: rgba(229,72,77,.12); color: #b4282d; }
.ddc-alert.warn { background: rgba(232,161,58,.14); color: #8a5d12; }
.ddc-alert.ok { background: rgba(43,182,115,.12); color: #1c7d50; }

/* device detail — Cockpit 2-column body */
.ddc-body { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.ddc-side { display: flex; flex-direction: column; gap: 14px; }
.ddc-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 17px; }
.ddc-card-t { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); margin: 0 0 12px; }
.ddc-kv { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; padding: 6px 0; }
.ddc-kv + .ddc-kv { border-top: 1px solid var(--border-soft); }

/* Device notes card */
.dn-ta { width: 100%; box-sizing: border-box; resize: vertical; min-height: 76px; padding: 9px 11px; font: inherit; font-size: 13px; line-height: 1.5; color: var(--fg); background: var(--surface-2, var(--surface)); border: 1px solid var(--border); border-radius: 10px; }
.dn-ta:focus { outline: none; border-color: var(--accent-edge); box-shadow: 0 0 0 3px var(--accent-soft); }
.dn-actions { display: flex; justify-content: flex-end; margin-top: 9px; }
.dn-save { padding: 5px 14px; font-size: 12px; }
.dn-view { font-size: 13px; line-height: 1.55; color: var(--fg); white-space: pre-wrap; word-break: break-word; }
.dn-saved { font-size: 10px; font-weight: 700; letter-spacing: .04em; color: var(--ok); background: var(--ok-bg); border-radius: 99px; padding: 2px 7px; margin-left: 6px; animation: dnSavedFade 2.4s forwards; }
@keyframes dnSavedFade { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
.ddc-kv .k { color: var(--muted); }
.ddc-kv .v { font-weight: 600; min-width: 0; display: flex; align-items: center; gap: 6px; justify-content: flex-end; text-align: right; }
.ddc-kv .v.tags { flex-wrap: wrap; }
.ddc-main { min-width: 0; }
/* recent activity timeline (Overview) */
.ddc-activity { display: flex; flex-direction: column; }
.ddc-tl { display: grid; grid-template-columns: 10px 1fr auto; gap: 11px; align-items: start; padding: 9px 0; font-size: 13px; }
.ddc-tl + .ddc-tl { border-top: 1px solid var(--border-soft); }
.ddc-tl .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 4px; background: var(--accent-2); }
.ddc-tl .dot.ok { background: var(--ok); } .ddc-tl .dot.warn { background: var(--warn); } .ddc-tl .dot.err { background: var(--danger); }
.ddc-tl .when { color: var(--text-faint); font-size: 11.5px; white-space: nowrap; }
@media (max-width: 1024px) { .ddc-body { grid-template-columns: 1fr; } }

/* device detail — hero/placement affordances + inline activity (match demo) */
.ddc-btn.ddc-btn-icon { padding: 8px 11px; font-size: 15px; line-height: 1; }
.ddc-kv .kv-edit { border: 0; background: none; color: var(--text-faint); cursor: pointer; padding: 0 2px; display: inline-flex; align-items: center; }
.ddc-kv .kv-edit:hover { color: var(--accent-text); }
.ddc-gtag .gtag-x { border: 0; background: none; color: #4b50c4; opacity: .6; cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.ddc-gtag .gtag-x:hover { opacity: 1; }
html[data-theme="dark"] .ddc-gtag .gtag-x { color: #a9adfb; }
.ddc-kv .kv-add { font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; border: 1px dashed var(--border); border-radius: 7px; padding: 2px 8px; }
.ddc-kv .kv-add:hover { color: var(--accent-text); border-color: var(--accent); }
.ddc-actsec { margin-top: 18px; }
.ddc-act-h { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); margin: 0 0 6px; }

/* command-history timeline links + apps list (device detail) */
.ddc-tl-link { text-decoration: none; color: inherit; padding-left: 8px; padding-right: 8px; margin: 0 -8px; border-radius: 8px; transition: background var(--dur) var(--ease); }
.ddc-tl-link:hover { background: var(--hover); }
.ddc-tl-link + .ddc-tl-link { border-top: 1px solid var(--border-soft); }
.ddc-tl-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* installed apps — clean rows (no version / last-updated columns) */
.app-list { display: flex; flex-direction: column; }
.app-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--border-soft); }
.app-row:hover { background: var(--hover); }
.app-id { min-width: 0; }
.app-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-pkg { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-uninstall { font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 5px 12px; cursor: pointer; }
.app-uninstall:hover { border-color: var(--danger-edge); color: var(--danger); }
.app-search { margin: 12px 18px 4px; max-width: 320px; }
.app-list.collapsed .app-extra { display: none; }
.app-more { display: block; width: calc(100% - 36px); margin: 8px 18px 14px; padding: 9px; font: inherit; font-size: 12.5px;
  font-weight: 600; color: var(--accent-text); background: var(--accent-soft); border: 0; border-radius: 9px; cursor: pointer; }
.app-more:hover { background: var(--accent-soft-2, var(--accent-soft)); filter: brightness(.97); }

/* searchable package combobox (kiosk settings) */
.pkg-combo { position: relative; max-width: 420px; }
.pkg-combo.open { z-index: 200; }
.pkg-list { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 200; max-height: 260px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); display: none; }
.pkg-combo.open .pkg-list { display: block; }
.pkg-opt { display: flex; flex-direction: column; gap: 1px; padding: 8px 12px; cursor: pointer; position: relative; }
.pkg-opt.hidden { display: none; }
.pkg-opt.active, .pkg-opt:hover { background: var(--accent-soft); }
.pkg-opt-name { font-size: 13px; font-weight: 600; }
.pkg-opt-pkg { font-size: 11px; color: var(--muted); }

/* Bulk-kiosk: an app present on only some selected devices is greyed but usable. */
.pkg-opt-partial .pkg-opt-name, .pkg-opt-partial .pkg-opt-pkg { opacity: .5; }
.pkg-opt-badge { position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 10px; font-weight: 700; color: var(--warn, #9a6512);
  background: rgba(232,161,58,.16); border-radius: 99px; padding: 2px 7px; }

/* placement popovers (device detail) */
.pl-pop-wrap { position: relative; display: inline-flex; }
.pl-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 50; width: 230px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-lg); padding: 8px; }
.pl-pop-h { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); padding: 4px 8px 8px; }
.pl-pop-list { display: flex; flex-direction: column; gap: 1px; max-height: 240px; overflow: auto; }
.pl-pop-opt { display: flex; align-items: center; gap: 8px; padding: 8px 9px; border-radius: 8px; font: inherit; font-size: 13px;
  font-weight: 500; color: var(--text); text-align: left; background: none; border: 0; cursor: pointer; width: 100%; }
.pl-pop-opt:hover { background: var(--hover); }
.pl-pop-save { width: 100%; margin-top: 8px; font-size: 13px; padding: 8px; }
/* "+ group" popover: liquid-glass treatment, matching the hero Actions dropdown. */
#pl-group-pop { background: rgba(255,255,255,.45); backdrop-filter: blur(18px) saturate(180%); -webkit-backdrop-filter: blur(18px) saturate(180%);
  will-change: backdrop-filter; /* own compositing layer — see .toast for why */
  border-color: rgba(255,255,255,.29); box-shadow: 0 14px 36px rgba(0,0,0,.21), inset 0 1px 0 rgba(255,255,255,.50); }
html[data-theme="dark"] #pl-group-pop { background: rgba(20,18,17,.45); border-color: rgba(255,255,255,.12); }

/* AI sparkle button + analysis modal (device detail) */
.ddc-btn-ai { border-color: transparent; background: var(--accent-soft); color: var(--accent-text); }
.ddc-btn-ai:hover { background: var(--accent-soft); filter: brightness(.97); }
.ddc-btn-ai svg { width: 15px; height: 15px; }
.ai-modal-box { max-width: 600px; width: 100%; padding: 0; overflow: hidden; }
.ai-modal-h { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--border-soft); }
.ai-modal-title { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; }
.ai-spark { width: 16px; height: 16px; flex: none; }
.ai-grad { background: var(--brand-grad, linear-gradient(90deg,#7a80f6,#f9674e)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.ai-modal-body { padding: 16px 18px 18px; }
.ai-result { border: 1px solid var(--border); border-radius: 11px; padding: 14px 15px; font-size: 13.5px; line-height: 1.6; max-height: 320px; overflow: auto; }
.ai-result p:first-child { margin-top: 0; } .ai-result p:last-child { margin-bottom: 0; }
.ai-modal-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.ai-run { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.ai-run .ai-spark { width: 14px; height: 14px; }
.ai-prev-wrap { margin-top: 18px; }
.ai-prev-h { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 8px; }
.ai-prev-list { display: flex; flex-direction: column; gap: 7px; max-height: 220px; overflow: auto; }
.ai-prev-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left;
  padding: 9px 11px; border: 1px solid var(--border-soft); border-radius: 9px; background: var(--surface); cursor: pointer; font: inherit; font-size: 12.5px; }
.ai-prev-row:hover { background: var(--hover); }
.ai-prev-snip { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* screenshot command result — framed preview + download */
.ss-result { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.ss-frame { display: inline-block; border: 4px solid #11161c; border-radius: 16px; overflow: hidden; line-height: 0;
  background: #11161c; box-shadow: var(--shadow-sm); transition: box-shadow var(--dur) var(--ease); }
.ss-frame img { display: block; max-width: 150px; height: auto; border-radius: 9px; }
.ss-frame:hover { box-shadow: 0 10px 26px rgba(0,0,0,.16); }
.ss-dl { font-size: 12px; padding: 5px 11px; display: inline-flex; align-items: center; gap: 6px; }
.ss-dl .ui-icon { width: 13px; height: 13px; }

/* command-history type filters (device detail) */
.ch-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.ch-pill { font: inherit; font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
.ch-pill:hover { color: var(--text); }
.ch-pill.on { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }

/* commands page — scannable list */
.cmd-list { display: flex; flex-direction: column; }
.cmd-row { display: grid; grid-template-columns: auto auto minmax(0,1fr) auto auto auto; gap: 13px; align-items: center;
  padding: 11px 18px; border-top: 1px solid var(--border-soft); }
.cmd-row:hover { background: var(--hover); }
.cmd-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); }
.cmd-dot.ok { background: var(--ok); } .cmd-dot.warn { background: var(--warn); } .cmd-dot.err { background: var(--danger); }
.cmd-ic { width: 15px; height: 15px; color: var(--accent-text); display: inline-flex; }
.cmd-ic svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.cmd-main { min-width: 0; text-decoration: none; color: inherit; }
.cmd-name { font-weight: 600; font-size: 13.5px; }
.cmd-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-chip { display: inline-flex; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cmd-chip.ok { background: rgba(43,182,115,.13); color: #1c7d50; }
.cmd-chip.mid { background: rgba(232,161,58,.15); color: #9a6512; }
.cmd-chip.low { background: rgba(229,72,77,.13); color: #b4282d; }

/* Selected-device chip in the two-pane target picker. The remove control (dp-chip-x)
   is collapsed to zero width and only expands on hover/focus, so the basket stays
   compact and uncluttered while still being keyboard-accessible. */
.dp-chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); max-width: 100%; }
.dp-chip-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-chip-x { display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 0; margin-left: 0; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 11px; line-height: 1; opacity: 0; overflow: hidden;
  transition: width .12s ease, margin .12s ease, opacity .12s ease; }
.dp-chip:hover .dp-chip-x, .dp-chip:focus-within .dp-chip-x { width: 13px; margin-left: 6px; opacity: .75; }
.dp-chip-x:hover, .dp-chip-x:focus-visible { opacity: 1; color: var(--danger); outline: none; }
.cmd-when { white-space: nowrap; }
.cmd-del { border: 0; background: none; color: var(--text-faint); font-size: 17px; line-height: 1; cursor: pointer; padding: 0 4px; }
.cmd-del:hover { color: var(--danger); }

/* releases — card list with rollout bars */
.rel-list { display: flex; flex-direction: column; }
.rel-row { display: grid; grid-template-columns: auto minmax(160px,1.3fr) minmax(150px,1fr) auto auto; gap: 16px; align-items: center;
  padding: 13px 18px; border-top: 1px solid var(--border-soft); }
.rel-row:first-child { border-top: 0; }
.rel-row:hover { background: var(--hover); }
.rel-drag { cursor: grab; color: var(--text-faint); user-select: none; }
.rel-id { min-width: 0; }
.rel-ver { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; flex-wrap: wrap; }
.rel-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rel-roll { min-width: 0; }
.rel-bar-row { display: flex; align-items: center; gap: 10px; }
.rel-bar { flex: 1; height: 8px; border-radius: 99px; background: var(--surface2); overflow: hidden; }
.rel-bar i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.rel-bar i.warn { background: var(--warn); }
.rel-bar i.faint { background: var(--text-faint); }
.rel-pct { font-size: 12px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }
.rel-rollnum { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.rel-dlink { color: var(--accent-text); text-decoration: none; font-weight: 600; }
.rel-dlink:hover { text-decoration: underline; }
/* releases tabs */
.rel-tabs { display: inline-flex; gap: 3px; background: var(--surface2); border: 1px solid var(--border); border-radius: 11px; padding: 4px; margin-bottom: 14px; }
.rel-tab { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.rel-tab:hover { color: var(--text); }
.rel-tab.on { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow-sm); }
.rel-tab-n { color: var(--text-faint); font-weight: 600; }
.rel-tab.on .rel-tab-n { color: var(--accent-text); }
.rel-meta { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.rel-act { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.rel-act form { display: inline; }
@media (max-width: 820px) { .rel-row { grid-template-columns: 1fr auto; } .rel-roll, .rel-meta { grid-column: 1 / -1; } }

/* fleet-app picker (commands · uninstall) */
.fleet-app-list { max-height: 240px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.fleet-app { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left;
  padding: 9px 12px; border: 0; border-top: 1px solid var(--border-soft); background: var(--surface); cursor: pointer; font: inherit; }
.fleet-app:first-child { border-top: 0; }
.fleet-app:hover { background: var(--hover); }
.fleet-app.sel { background: var(--accent-soft); }
.fa-id { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fa-name { font-weight: 600; font-size: 13px; }
.fa-pkg { font-size: 11px; color: var(--muted); }
.fa-cnt { font-size: 11px; color: var(--text-faint); font-weight: 600; white-space: nowrap; }
.fleet-app.sel .fa-cnt { color: var(--accent-text); }

/* commands target two-pane: available column wider than the default picker */
.cmd-dp { grid-template-columns: 1fr 280px; }
.cmd-dp .filter-select { font-size: 12px; }
@media (max-width: 1024px) { .cmd-dp { grid-template-columns: 1fr; } }

/* command builder: concise Filters + Sort toolbar (mirrors the Fleet page) */
.cb-tools { display: flex; gap: 8px; margin: 9px 12px 2px; }
.cb-tools .fleet-fbtn { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.cb-tools .fleet-fbtn svg { width: 14px; height: 14px; }
.cb-tools .fleet-pop { left: 0; right: auto; width: 360px; }
.cb-tools .fleet-sortpop { width: 210px; }
/* let the popover escape the available-devices pane (the pane itself clips its scroll list) */
.cmd-dp .dp-pane:has(.cb-tools) { overflow: visible; }
/* Command-builder Filters panel: render in-flow so it pushes the device list down
   (and spans the pane) instead of overlaying the rows as a narrow popover. */
.cmd-filters-panel { position: static; width: auto; max-width: none; margin: 8px 12px 2px; animation: none; box-sizing: border-box; }
.cmd-filters-panel .fp-grid { margin-bottom: 0; }
/* Keep the filter fields inside the (now narrower) picker pane. Without min-width:0
   a <select>'s intrinsic min-content width forces the grid tracks — and the whole
   pane — to overflow the builder's config column. */
.cmd-dp .dp-pane { min-width: 0; }
.cmd-filters-panel .fp-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cmd-filters-panel .fp-field { min-width: 0; }
.cmd-filters-panel .fp-field select,
.cmd-filters-panel .fp-field input { width: 100%; min-width: 0; box-sizing: border-box; }

/* command-history show-more (device detail History tab) */
.ch-collapsed .ch-extra { display: none; }

/* users page */
.users-wrap { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
@media (max-width: 1024px) { .users-wrap { grid-template-columns: 1fr; } }
.user-list { display: flex; flex-direction: column; }
.user-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto auto; gap: 14px; align-items: center;
  padding: 12px 18px; border-top: 1px solid var(--border-soft); }
.user-row:first-child { border-top: 0; }
.user-row:hover { background: var(--hover); }
.user-av { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; text-transform: uppercase; color: #fff; background: var(--accent-2); }
.role-av-admin { background: var(--accent); } .role-av-dev { background: var(--accent-2); }
.role-av-tester { background: var(--ok); } .role-av-operator { background: var(--warn); } .role-av-viewer { background: var(--text-faint); }
.user-id { min-width: 0; }
.user-name { font-weight: 600; font-size: 14px; }
.user-meta { margin-top: 1px; }
.role-chip { display: inline-flex; padding: 3px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700; text-transform: capitalize; }
.role-admin { background: var(--accent-soft); color: var(--accent-text); }
.role-dev { background: rgba(122,128,246,.14); color: #4b50c4; }
.role-tester { background: rgba(43,182,115,.13); color: #1c7d50; }
.role-operator { background: rgba(232,161,58,.15); color: #9a6512; }
.role-viewer { background: var(--surface2); color: var(--muted); }
html[data-theme="dark"] .role-dev { color: #a9adfb; }
.user-act { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.user-role-sel { width: auto; padding: 5px 9px; font-size: 12px; }
.user-del { border: 0; background: none; color: var(--text-faint); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.user-del:hover { color: var(--danger); }

/* commands browse list (Available pane) — Fleet-style rows */
.cb-list { padding: 4px 6px; }
.cb-row { display: grid; grid-template-columns: auto auto minmax(0,1fr) auto; gap: 11px; align-items: center;
  padding: 8px 9px; border-radius: 9px; cursor: pointer; }
.cb-row:hover { background: var(--hover); }
.cb-row input[type=checkbox] { width: 15px; height: 15px; flex: none; }
.cb-bat-na { background: var(--surface2); color: var(--muted); }
.cb-id { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cb-serial { font-weight: 600; font-size: 13px; color: var(--accent-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); display: inline-block; }
.cb-status i.on { background: var(--ok); }
.cmd-hint { color: var(--text-2, var(--text)); font-weight: 600; }

/* WLC states legend (battery chart) */
.wlc-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 8px 16px 0; }

/* ============================================================================
   Global chrome v2 — top app bar + floating bottom dock (replaces the sidebar)
   ============================================================================ */
.appbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  /* Own compositing layer — without it, this always-visible glass bar was one
     of the surfaces that flashed whenever another glass popover (e.g. the
     alerts dropdown) resized its content; see .toast for the full note. */
  will-change: backdrop-filter;
  border-bottom: 1px solid var(--border-soft);
}
.appbar-brand {
  font-family: var(--font); font-weight: var(--fw-semibold); font-size: 27px;
  letter-spacing: -0.01em; color: var(--text); flex: none;
}
.appbar-brand:hover { opacity: 0.85; }
.appbar-right { display: flex; align-items: center; gap: 10px; }

.appbar-icon {
  position: relative; width: 38px; height: 38px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 11px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); cursor: pointer; transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.appbar-icon:hover { border-color: var(--rule-2); color: var(--text); }
.appbar-icon .ui-icon, .appbar-icon .ui-icon svg { width: 18px; height: 18px; }
.appbar-icon .nav-badge {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 9px; border: 2px solid var(--bg); margin: 0;
}

.appbar-acct {
  display: flex; align-items: center; gap: 9px; height: 38px; padding: 0 6px 0 12px;
  border-radius: 11px; border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  transition: border-color var(--dur) var(--ease);
}
.appbar-acct:hover { border-color: var(--rule-2); }
.appbar-acct .who { display: flex; flex-direction: column; text-align: right; line-height: 1.15; }
.appbar-acct .who .n { font-size: 12.5px; font-weight: var(--fw-semibold); color: var(--text); }
.appbar-acct .who .r { font-size: 10.5px; color: var(--muted); text-transform: capitalize; }
.appbar-acct .av {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #7a80f6, #f9674e); color: #fff;
  font-weight: 700; font-size: 12px; text-transform: uppercase;
}

/* dropdown shells */
.nbar-wrap { position: relative; }
.nbar-pop {
  position: absolute; top: calc(100% + 9px); right: 0; z-index: 50; width: 250px;
  background: rgba(255,255,255,.45); backdrop-filter: blur(18px) saturate(180%); -webkit-backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(255,255,255,.29); border-radius: 16px;
  box-shadow: 0 14px 36px rgba(0,0,0,.21), inset 0 1px 0 rgba(255,255,255,.50); padding: 7px;
  animation: ov-rise 0.14s var(--ease) both;
  will-change: backdrop-filter;
}
html[data-theme="dark"] .nbar-pop { background: rgba(20,18,17,.45); border-color: rgba(255,255,255,.12); }
.nbar-pop[hidden] { display: none; }
.nbar-mhead { padding: 9px 11px 9px; border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; }
.nbar-mhead .n { font-weight: var(--fw-semibold); font-size: 13px; color: var(--text); }
.nbar-mhead .e { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.nbar-mi {
  width: 100%; display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  border: 0; background: none; border-radius: 9px; font: inherit; font-size: 13px;
  color: var(--text); cursor: pointer; text-align: left; text-decoration: none;
}
.nbar-mi:hover { background: var(--hover); color: var(--text); }
.nbar-mi .ui-icon, .nbar-mi .ui-icon svg { width: 16px; height: 16px; color: var(--muted); }
.nbar-mi .nbar-mi-label { flex: 1; }
.nbar-mi .nbar-mi-rt, .nbar-mi .nbar-theme-state { margin-left: auto; font-size: 11px; color: var(--text-faint); }
.nbar-mi.danger, .nbar-mi.danger .ui-icon { color: var(--danger); }
.nbar-mi.danger:hover { background: var(--danger-bg); }
.nbar-sep { height: 1px; background: var(--border-soft); margin: 6px 4px; }

/* alerts dropdown list */
.nbar-alerts { width: 322px; }
/* Fixed height, not max-height: the "Loading…" placeholder and the real
   alert rows must occupy IDENTICAL outer dimensions, or swapping one for the
   other resizes .nbar-pop (a backdrop-filter surface) while it's visible —
   that resize, not just the swap itself, is what was triggering the
   blur-drops-and-reappears flicker (will-change alone didn't stop it because
   the layer still has to be re-snapshot when its own bounds change, isolated
   compositing or not). Scrolls internally instead of ever changing height. */
.nbar-al-list { height: 320px; overflow-y: auto; }
.nbar-pop-h { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); padding: 7px 9px 8px; }
.nbar-al { display: flex; gap: 10px; padding: 9px 9px; border-radius: 9px; text-decoration: none; }
.nbar-al:hover { background: var(--hover); }
.nbar-al-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--muted); }
.nbar-al-dot.sev-critical { background: var(--danger); }
.nbar-al-dot.sev-warning { background: var(--warn); }
.nbar-al-dot.sev-info { background: var(--accent-2, #7a80f6); }
.nbar-al-main { min-width: 0; }
.nbar-al-t { display: block; font-size: 12.5px; font-weight: var(--fw-semibold); color: var(--text); }
.nbar-al-s { display: block; font-size: 11.5px; color: var(--muted); }
.nbar-al-all { display: block; text-align: center; font-size: 12px; font-weight: var(--fw-semibold); color: var(--accent-text); padding: 9px; border-top: 1px solid var(--border-soft); margin-top: 4px; text-decoration: none; }
.nbar-al-sec { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); padding: 8px 9px 3px; }

/* ── Friendly alert toasts (new critical alert) — top banner, liquid glass,
   same design as the plain .toast above (/demo/toasts direction C). ── */
#mdm-toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 500; display: flex; flex-direction: column; align-items: center; gap: 10px; width: calc(100% - 40px); max-width: 460px; }
.mtoast {
  display: flex; gap: 12px; width: 100%;
  background: rgba(255, 255, 255, .45);
  -webkit-backdrop-filter: blur(4px) saturate(180%);
  backdrop-filter: blur(4px) saturate(180%);
  will-change: backdrop-filter; /* own compositing layer — see .toast for why */
  border: 1px solid rgba(255, 255, 255, .29);
  border-radius: 20px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .21), inset 0 1px 0 rgba(255, 255, 255, .5);
  padding: 12px 16px;
  animation: mtoast-in .32s cubic-bezier(.2,.7,.3,1);
}
html[data-theme="dark"] .mtoast { background: rgba(20, 18, 17, .45); border-color: rgba(255, 255, 255, .12); }
.mtoast.leaving { animation: mtoast-out .3s forwards; }
@keyframes mtoast-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes mtoast-out { to { opacity: 0; transform: translateY(-14px); } }
.mtoast .mt-i { width: 32px; height: 32px; flex: none; border-radius: 9px; background: var(--danger-bg); position: relative; }
.mtoast .mt-i::after { content: "!"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--danger); font-weight: 800; font-size: 17px; }
.mtoast .mt-m { min-width: 0; flex: 1; }
.mtoast .mt-t { font-size: 13.5px; font-weight: 700; color: var(--text); }
.mtoast .mt-s { font-size: 12px; color: var(--muted); margin-top: 1px; }
.mtoast .mt-a { display: flex; gap: 7px; margin-top: 9px; }
.mtoast .mt-b { font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 7px; border: 1px solid var(--border); color: var(--muted); text-decoration: none; }
.mtoast .mt-b.p { border-color: transparent; background: var(--accent); color: #fff; }
.mtoast .mt-x { flex: none; align-self: flex-start; background: none; border: none; color: var(--text-faint); font-size: 17px; line-height: 1; cursor: pointer; }
.nbar-al-empty { height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px 11px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ── floating bottom-center dock — liquid glass over whatever's scrolled
   beneath it, coral ring kept for brand/visibility ── */
.dock {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 45;
  display: flex; gap: 4px; padding: 7px;
  background: rgba(255, 255, 255, .45);
  -webkit-backdrop-filter: blur(4px) saturate(180%);
  backdrop-filter: blur(4px) saturate(180%);
  will-change: backdrop-filter; /* own compositing layer — see .toast for why */
  border: 1.5px solid rgba(255, 255, 255, .29); border-radius: 20px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .21), inset 0 1px 0 rgba(255, 255, 255, .5), 0 0 0 1.5px var(--accent-edge);
}
html[data-theme="dark"] .dock { background: rgba(20, 18, 17, .45); border-color: rgba(255, 255, 255, .12); }
.dock .nav-link {
  display: inline-flex; align-items: center; gap: 9px; padding: 10px 16px;
  border-radius: 11px; font-size: 13.5px; font-weight: var(--fw-semibold); color: var(--muted);
}
.dock .nav-link:hover { background: var(--surface2); color: var(--text); }
.dock .nav-link.active { background: var(--accent-soft); color: var(--accent-text); }
.dock .nav-link .ui-icon, .dock .nav-link .ui-icon svg { width: 17px; height: 17px; }

@media (max-width: 640px) {
  .appbar { padding: 10px 14px; gap: 8px; }
  .appbar-brand { font-size: 22px; }
  .appbar-right { gap: 6px; }
  /* Touch targets: keep icons ≥40px on phones. */
  .appbar-icon { width: 40px; height: 40px; }
  .dock { left: 12px; right: 12px; transform: none; justify-content: space-around; bottom: 14px; }
  .dock .nav-link { padding: 8px 6px; min-height: 46px; flex-direction: column; gap: 3px; font-size: 11px; }
  .appbar-acct .who { display: none; }
  .appbar-acct { height: 40px; padding: 0 6px; }
  /* Taller stacked dock — ensure page content clears it. */
  body.has-dock .container { padding-bottom: 92px; }
}
/* Very narrow phones: drop dock labels to guarantee all items fit. */
@media (max-width: 380px) {
  .dock .dock-lbl { display: none; }
  .dock .nav-link { padding: 10px 8px; }
}

/* ── Releases list — fleet-card row language ── */
.rlc-list { display: grid; grid-template-columns: 16px 40px minmax(0, 1.4fr) minmax(0, 1fr) auto auto; column-gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
/* Rows share the list's column tracks (subgrid) so every progress bar lines up,
   including nested branch rows whose meta/action cells are near-empty. */
/* Offline kiosk-exit unlock code — authenticator-style live widget on the device page. */
.oe-card { margin-top: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-4); background: var(--surface2); }
.oe-top { display: flex; align-items: center; justify-content: space-between; }
.oe-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; }
.oe-ring { width: 24px; height: 24px; transform: rotate(-90deg); }
.oe-ring-bg { fill: none; stroke: var(--border); stroke-width: 3; }
.oe-ring-fg { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke .3s ease; }
.oe-code { font-family: var(--mono, ui-monospace, monospace); font-size: 34px; font-weight: 700; letter-spacing: 5px; color: var(--text); margin: 8px 0 4px; font-variant-numeric: tabular-nums; user-select: all; }
.oe-code.expiring { color: var(--warn); }
.oe-code.expiring ~ .oe-top .oe-ring-fg, .oe-card.expiring .oe-ring-fg { stroke: var(--warn); }
.oe-hint { font-size: 11.5px; color: var(--muted); line-height: 1.55; }
.oe-relock { margin-top: 4px; }
.oe-rotate { margin-top: 11px; }
.oe-rotate-btn { background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: var(--r-4); padding: 5px 11px; font-size: 12px; cursor: pointer; transition: color .15s, border-color .15s; }
.oe-rotate-btn:hover { color: var(--text); border-color: var(--accent); }
.rlc { position: relative; grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: center; column-gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--border-soft); }
/* Reported (not-yet-a-release) builds are hidden by default to reduce clutter;
   the "Show reported builds" toggle adds .show-reported to the list to reveal them. */
.rlc-list .rlc-reported { display: none; }
.rlc-list.show-reported .rlc-reported { display: grid; }
.rel-reported-toggle { display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.rel-reported-toggle input { cursor: pointer; }
.nb-details { grid-column: 1 / -1; }
.rlc:last-child { border-bottom: 0; }
.rlc:hover { background: var(--hover); }
.rlc.dragging { opacity: .5; }
.rlc-drag { cursor: grab; color: var(--text-faint); font-size: 13px; line-height: 1; user-select: none; }
.rlc-badge { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: none; }
.rlc-badge svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.rlc-badge.ok { background: var(--ok-bg); color: var(--ok); }
.rlc-badge.draft { background: var(--warn-bg); color: var(--warn); }
.rlc-badge.muted { background: var(--surface2); color: var(--text-faint); }
.rlc-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rlc-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
/* Release date pushed to the far right of the title row so dates line up in a column. */
.rlc-date { margin-left: auto; flex: none; }
.rlc-stat { font-size: 11px; font-weight: 600; text-transform: capitalize; white-space: nowrap; flex: none; }
.rlc-stat.ok { color: var(--ok); }
.rlc-stat.warn { color: var(--warn); }
.rlc-stat.danger { color: var(--danger); }
.rlc-stat.muted { color: var(--text-faint); }
.rlc-ver { font-family: var(--mono); font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.rlc-ver:hover { color: var(--accent-h); text-decoration: underline; }
.rlc-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rlc-roll { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rlc-meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.rlc-meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.rlc-meter i.muted { background: var(--rule-2); }
.rlc-rollf { font-size: 11px; color: var(--muted); white-space: nowrap; }
.rlc-rollf b { color: var(--text); font-weight: 700; }
.rlc-cnt b { color: var(--text); }
.rlc-cnt:hover b { color: var(--accent-text); text-decoration: underline; }
.rlc-meta { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; white-space: nowrap; }
.rchip { font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 99px; }
.rchip.qa { background: var(--accent-soft); color: var(--accent-text); }
.rchip.ok { background: #e6f6ee; color: #1c7d50; }
.rchip.warn { background: var(--warn-bg); color: #9a6512; }
.rchip.bad { background: var(--danger-bg); color: var(--danger); }
.rchip.active { background: var(--accent-soft); color: var(--accent-text); }
.rchip.muted { background: var(--surface-3); color: var(--muted); }

/* ── Branch builds (off-mainline forks) — periwinkle accent ──────────────── */
.status-badge.branch { background: rgba(122,128,246,.16); color: #5b61d6; }
.rlc-badge.branch { background: rgba(122,128,246,.16); color: #5b61d6; }
.rchip.branch-merged { background: rgba(122,128,246,.16); color: #5b61d6; }
[data-theme="dark"] .rchip.branch-merged { color: #a6abfa; }
[data-theme="dark"] .status-badge.branch, [data-theme="dark"] .rlc-badge.branch { color: #a6abfa; }
.branch-banner { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; padding: 11px 16px; border-radius: 10px; background: rgba(122,128,246,.10); border: 1px solid rgba(122,128,246,.30); font-size: 13px; line-height: 1.5; }
.branch-banner a { color: #5b61d6; }
[data-theme="dark"] .branch-banner a { color: #a6abfa; }
.bb-mark { color: #7a80f6; font-weight: 700; flex: none; }
.branch-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.branch-list { display: flex; flex-direction: column; }
.branch-row { display: flex; align-items: center; gap: 10px; padding: 10px 6px; border-top: 1px solid var(--border-soft); text-decoration: none; color: var(--text); border-radius: 6px; }
.branch-row:first-child { border-top: 0; }
.branch-row:hover { background: var(--surface2); }
.branch-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.branch-suggest { margin-bottom: 12px; padding: 10px 12px; border: 1px dashed rgba(122,128,246,.35); border-radius: 10px; background: rgba(122,128,246,.06); }
.branch-suggest-h { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.branch-suggest-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border-soft); }
.branch-suggest-row:first-of-type { border-top: 0; }

/* Branch builds nested under their parent in the releases list. */
/* Branch rows keep every column aligned with parents (subgrid); nesting is shown
   by the elbow connector drawn in the first (drag-handle) column, not a row shift. */
.rlc-child { position: relative; }
.rlc-child::before { content: ""; position: absolute; left: 23px; top: -9px; height: calc(50% + 9px); width: 21px; border-left: 2px solid rgba(122,128,246,.45); border-bottom: 2px solid rgba(122,128,246,.45); border-bottom-left-radius: 8px; }
.nb-details { margin: 0 0 8px 30px; }
.nb-summary { cursor: pointer; font-size: 12px; color: var(--muted); padding: 3px 2px; list-style: none; user-select: none; display: inline-flex; align-items: center; gap: 5px; }
.nb-summary::-webkit-details-marker { display: none; }
.nb-summary::marker { content: ""; }
.nb-summary:hover { color: var(--accent-text); }
.nb-details[open] .nb-summary { color: var(--text); font-weight: 600; }
.nb-mark { color: #7a80f6; font-weight: 700; }
.nb-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px 0 4px; }
.nb-name { flex: 1; min-width: 180px; }
.rlc-act { display: flex; align-items: center; gap: 6px; justify-self: end; flex-wrap: wrap; justify-content: flex-end; }
.rlc-act form { display: inline; margin: 0; }
.rlc-open { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.rlc-open svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.rlc-open:hover { border-color: var(--accent-edge); color: var(--accent-text); }
.rlc-open.disabled { opacity: .3; pointer-events: none; cursor: default; }
/* Release download + pencil-edit on the release detail page */
.qfil-ctl { display: inline-flex; align-items: center; gap: 6px; }
.qfil-edit { position: relative; display: inline-flex; }
.qfil-edit > summary { list-style: none; cursor: pointer; }
.qfil-edit > summary::-webkit-details-marker { display: none; }
.qfil-pencil { display: inline-flex; align-items: center; justify-content: center; }
.qfil-edit-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; display: flex; flex-direction: column; gap: 9px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 34px rgba(28,26,24,.18); padding: 12px; }
.qfil-remove { background: none; border: none; color: var(--danger); font-size: 12px; font-weight: 600; cursor: pointer; text-align: left; padding: 0; }
.qfil-remove:hover { text-decoration: underline; }
/* Subtle dismiss (×) tucked in the row's top-right corner, clear of the action icons. */
.rlc-x { position: absolute; top: 6px; right: 8px; margin: 0; z-index: 2; }
.rlc-x button { display: flex; align-items: center; justify-content: center; width: 19px; height: 19px; padding: 0; border: 0; background: transparent; border-radius: 5px; color: var(--text-faint); opacity: .35; cursor: pointer; transition: opacity .12s, color .12s, background .12s; }
.rlc:hover .rlc-x button { opacity: .6; }
.rlc-x button:hover { opacity: 1; color: var(--danger); background: var(--danger-bg); }
.rlc-x.rlc-del { right: 30px; } /* sit left of the hide button so they don't overlap */
.rlc-x svg { width: 11px; height: 11px; stroke: currentColor; stroke-width: 2.4; fill: none; }
@media (max-width: 760px) {
  .rlc-list { grid-template-columns: 16px 40px 1fr auto; }
  .rlc-roll, .rlc-meta { display: none; }
}

/* Deploy two-pane: selectable rows (override the .cb-row grid with flex) */
.dp-av { display: flex; align-items: center; gap: 11px; cursor: pointer; }
.dp-av .cb-id { flex: 1; }
.dp-av .dp-check { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--border); flex: none; position: relative; }
.dp-av.sel { background: var(--accent-soft); }
.dp-av.sel .dp-check { background: var(--accent); border-color: var(--accent); }
.dp-av.sel .dp-check::after { content: ''; position: absolute; left: 5px; top: 2px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* device detail: system-app tag (no uninstall) */
.app-systag { font-size: 10.5px; font-weight: 600; color: var(--text-faint); border: 1px solid var(--border); border-radius: 99px; padding: 2px 8px; white-space: nowrap; }

/* release detail: at-a-glance vitals (overview .ovx-stat cards, 5-up) */
/* .ovx-stat reads --ovx-r / --ovx-pad, which are scoped to .ovx — redeclare them
   here so the cards get the same radius/padding as the overview page. */
.rel-vitals { --ovx-r: 20px; --ovx-pad: 20px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.rel-vitals .ovx-stat:hover { transform: none; box-shadow: none; border-color: var(--border); cursor: default; }
@media (max-width: 920px) { .rel-vitals { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .rel-vitals { grid-template-columns: 1fr; } }

/* release detail — Testing & QA pane */
.qa-progress { display: flex; align-items: center; gap: 18px; padding: 14px 18px; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
.qa-bar { flex: 1; min-width: 220px; height: 10px; border-radius: 99px; overflow: hidden; display: flex; background: var(--surface-3); }
.qa-bar i { height: 100%; }
.qa-bar i.pass { background: var(--ok); } .qa-bar i.fail { background: var(--danger); }
.qa-bar i.blocked { background: var(--warn); } .qa-bar i.skip { background: var(--text-faint); }
.qa-legend { display: flex; gap: 13px; flex-wrap: wrap; font-size: 12px; }
.qa-legend span { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.qa-legend i { width: 8px; height: 8px; border-radius: 50%; }
.qa-legend i.pass { background: var(--ok); } .qa-legend i.fail { background: var(--danger); }
.qa-legend i.blocked { background: var(--warn); } .qa-legend i.skip { background: var(--text-faint); }
.qa-legend i.untested { background: var(--surface-3); border: 1px solid var(--border); }
.qa-flash { font-size: 12px; padding: 9px 18px; color: var(--muted); border-bottom: 1px solid var(--border-soft); }
.qa-flash.warn { color: #9a6512; background: var(--warn-bg); }
.qa-list { display: flex; flex-direction: column; }
.qa-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border-soft); }
.qa-row:last-child { border-bottom: 0; }
.qa-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); flex: none; }
.qa-row.pass .qa-dot { background: var(--ok); } .qa-row.fail .qa-dot { background: var(--danger); }
.qa-row.blocked .qa-dot { background: var(--warn); } .qa-row.skip .qa-dot { background: var(--text-faint); }
.qa-id { min-width: 0; }
.qa-title { font-size: 13px; font-weight: 600; }
.qa-star { color: var(--warn); }
.qa-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.qa-del { color: var(--danger); }
.qa-rec { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin: 0; }
.qa-notes { width: 150px; padding: 5px 9px; font-size: 12px; }
.qa-pills { display: inline-flex; gap: 3px; background: var(--surface2); border-radius: 9px; padding: 3px; }
.qa-pill { border: 0; background: none; font: inherit; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 5px 11px; border-radius: 6px; cursor: pointer; }
.qa-pill:hover { color: var(--text); }
.qa-pill.on.pass { background: var(--ok-bg); color: var(--ok); }
.qa-pill.on.fail { background: var(--danger-bg); color: var(--danger); }
.qa-pill.on.blocked { background: var(--warn-bg); color: #9a6512; }
.qa-pill.on.skip { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.qa-ro { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.qa-tested { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.qa-add { padding: 14px 18px; border-top: 1px solid var(--border-soft); }
@media (max-width: 720px) { .qa-row { grid-template-columns: auto 1fr; } .qa-rec { grid-column: 1 / -1; justify-content: flex-start; } }
/* QA readiness strip + checklist/problem filter chips (release detail) */
.rd-ready { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 18px; padding: 11px 16px; border-radius: 10px; font-size: 12.5px; }
.rd-ready.ok { background: var(--ok-bg); }
.rd-ready.warn { background: var(--warn-bg); }
.rd-ready-verdict { font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 8px; }
.rd-ready-verdict::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
.rd-ready.ok .rd-ready-verdict { color: var(--ok); }
.rd-ready.warn .rd-ready-verdict { color: var(--warn); }
.rd-ready-detail { color: var(--muted); }
.qa-filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
/* Align the QA-card filter chips with the rest of the card body (18px inset). */
#rd-qa-filter { padding: 0 18px; margin-bottom: 14px; align-items: center; }
.qa-fchip { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 4px 12px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.qa-fchip:hover { border-color: var(--rule-2); }
.qa-fchip.on { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-edge); }
.qa-fchip .c { font-size: 11px; opacity: .7; }
/* Brief "saved" flash on an htmx-swapped checklist row */
.qa-list .qa-row.htmx-added { animation: qaSaved 1.1s ease-out; }
@keyframes qaSaved { 0% { background: var(--ok-bg); } 100% { background: transparent; } }
/* Release-page QA status card (links to the dedicated QA page) */
.rel-qa-card { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 0 0 16px; padding: 15px 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-decoration: none; color: inherit; transition: border-color .14s, box-shadow .14s, transform .1s; }
.rel-qa-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.rel-qa-main { display: flex; align-items: center; gap: 12px; }
.rel-qa-k { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rel-qa-big { font-size: 26px; font-weight: 750; }
.rel-qa-big.ok { color: var(--ok); } .rel-qa-big.bad { color: var(--danger); } .rel-qa-big.warn { color: var(--warn); } .rel-qa-big.muted { color: var(--muted); }
.rel-qa-verdict { font-size: 14px; font-weight: 650; }
.rel-qa-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); flex: 1; }
.rel-qa-meta .bad { color: var(--danger); font-weight: 600; } .rel-qa-meta .warn { color: var(--warn); font-weight: 600; }
.rel-qa-go { font-size: 13px; font-weight: 650; color: var(--accent-text); white-space: nowrap; }
.rchip-a { text-decoration: none; }

/* ── Release page: lifecycle pipeline ── */
.pipe { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 12px; padding: 22px 8px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); }
.pipe::before { content: ""; position: absolute; left: calc(100%/8); right: calc(100%/8); top: 44px; height: 2px; background: var(--border); z-index: 0; }
.pipe.pipe-3 { grid-template-columns: repeat(3, 1fr); }
.pipe.pipe-3::before { left: calc(100%/6); right: calc(100%/6); }
.pipe .stage { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 9px; padding: 0 6px; }
.pipe .node { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-faint); }
.pipe .node svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pipe .stage.done .node { background: var(--ok); border-color: var(--ok); color: #fff; }
.pipe .stage.now .node { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 5px var(--accent-soft); }
.pipe .st-name { font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.pipe .stage.todo .st-name { color: var(--text-faint); }
.pipe .stage.now .st-name { color: var(--accent-text); }
.pipe .stage.finish.todo .node { border-color: var(--p); color: var(--p); }
.pipe .stage.finish.todo .st-name { color: var(--p); }
.pipe .st-sub { font-size: 11px; color: var(--muted); }
.pipe-note { font-size: 12px; color: var(--muted); margin: 0 0 18px; padding-left: 2px; }
.pipe-note a { color: var(--accent-text); text-decoration: none; font-weight: 600; }
@media (max-width: 720px) { .pipe { grid-template-columns: 1fr 1fr; gap: 16px 0; } .pipe::before { display: none; } }

/* release two-column body */
.rel-cols { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
@media (max-width: 860px) { .rel-cols { grid-template-columns: 1fr; } }

/* package stack */
.pkg-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.pkg { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 12px; }
.pkg.base { border-left: 3px solid var(--p); }
.pkg.inc { margin-left: 24px; border-left: 3px solid var(--warn); position: relative; }
.pkg.inc::before { content: ""; position: absolute; left: -15px; top: -9px; width: 13px; height: 26px; border-left: 2px solid var(--border); border-bottom: 2px solid var(--border); border-bottom-left-radius: 8px; }
.pkg .ptype { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.pkg.base .ptype { background: var(--p-soft); color: var(--p); }
.pkg.inc .ptype { background: var(--warn-bg); color: var(--warn); }
.pkg .pmeta { flex: 1; min-width: 0; }
.pkg .pmeta b { font-size: 13px; font-weight: 650; }
.pkg .pmeta .u { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.pkg .pmeta .u:hover { color: var(--accent-text); }
.pkg .pwhen { white-space: nowrap; }
.pkg-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 2px 7px; border-radius: 6px; }
.pkg-x:hover { color: var(--danger); background: var(--danger-bg); }

/* package composer */
.composer { border: 1px dashed var(--accent-edge); border-radius: 13px; padding: 15px; background: var(--accent-soft); }
/* A low-opacity warm tint over the dark surface reads as muddy brown rather
   than a highlight — use the plain elevated dark surface instead and let the
   dashed accent border carry the "highlighted" cue. */
html[data-theme="dark"] .composer { background: var(--surface2); }
.composer-h { font-size: 12.5px; font-weight: 700; margin-bottom: 11px; }
.tcards { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 12px; }
.tcard { border: 1.5px solid var(--border); background: var(--surface); border-radius: 11px; padding: 10px 12px; cursor: pointer; text-align: left; transition: border-color .12s; }
.tcard:disabled { opacity: .55; cursor: not-allowed; }
.tcard.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tcard .tt { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.tcard .td { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.tcard .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.tcard.on .dot.b { background: var(--p); }
.tcard.on .dot.i { background: var(--warn); }
.composer .field { margin-bottom: 11px; }
.composer .field label { display: block; font-size: 11.5px; font-weight: 650; color: var(--muted); margin-bottom: 5px; }
.composer .sel { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; font: inherit; font-size: 13px; background: var(--surface); color: var(--text); }
.composer .form-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.urlbox { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.urlbox input { flex: 1; border: 0; padding: 10px 12px; font: inherit; font-size: 12.5px; font-family: var(--mono); background: transparent; outline: none; min-width: 0; }
.urlbox .verify { border: 0; border-left: 1px solid var(--border); background: var(--surface2); padding: 0 14px; font: inherit; font-size: 12.5px; font-weight: 650; cursor: pointer; color: var(--p); }
.urlbox .verify:hover { background: var(--surface-3); }
.detected-line { margin-top: 8px; font-size: 12px; min-height: 18px; }
.detected-line .pkg-ok { color: var(--ok); font-weight: 600; }
.detected-line .pkg-bad { color: var(--danger); font-weight: 600; }
.detected-line .pkg-chip { background: var(--surface2); border-radius: 99px; padding: 2px 9px; color: var(--muted); font-weight: 600; margin-left: 2px; }

/* QA readiness + rollout rail */
.rel-ready-top { display: flex; align-items: center; gap: 14px; }
.rel-donut { width: 74px; height: 74px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; position: relative; }
.rel-donut::after { content: ""; position: absolute; width: 52px; height: 52px; border-radius: 50%; background: var(--surface); }
.rel-donut-c { position: relative; z-index: 1; font-size: 15px; font-weight: 750; }
.rel-verdict { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; }
.rel-verdict.ok { color: var(--ok); }
.rel-verdict.warn { color: var(--warn); }
.rel-verdict .d { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.rel-facts { margin-top: 14px; }
.rf { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-top: 1px solid var(--border-soft); font-size: 13px; }
.rf:first-child { border-top: 0; }
.rf .k { color: var(--muted); }
.rf .v { font-weight: 650; }
.rf .v.stat { font-family: var(--mono); }
.rf .v.ok { color: var(--ok); }
.rf .v.bad { color: var(--danger); }
.rel-deploy-row { display: flex; align-items: center; gap: 8px; padding: 9px 18px; border-top: 1px solid var(--border-soft); text-decoration: none; color: inherit; }
.rel-deploy-row:first-child { border-top: 0; }
.rel-deploy-row:hover { background: var(--surface2); }

/* Release problem reports */
.prob-form { display: flex; flex-direction: column; gap: 8px; padding: 14px; margin-bottom: 16px; background: var(--surface-2, var(--surface)); border: 1px solid var(--border); border-radius: 12px; }
/* Title input + textarea are direct children of the flex COLUMN. Override the
   global `.form-input { flex: 1 }` (meant for flex rows) so they stay full-width
   block fields instead of growing vertically / staying intrinsic-width. */
.prob-form > .form-input { flex: none; width: 100%; box-sizing: border-box; }
.prob-form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.prob-form-row .form-input { flex: 1; min-width: 140px; }
.prob-form-row select.form-input { flex: 0 1 auto; }
.prob-list { display: flex; flex-direction: column; gap: 10px; }
.prob { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; }
.prob.closed { opacity: .62; }
.prob-h { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.prob-title { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; }
.prob-sev { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 99px; }
.prob-sev.blocker { background: var(--danger-bg); color: var(--danger); }
.prob-sev.major   { background: var(--warn-bg); color: #9a6512; }
.prob-sev.minor   { background: var(--surface-3); color: var(--muted); }
.prob-status { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding: 2px 8px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }
.prob-status.st-open { background: var(--accent-soft); color: var(--accent-text); }
.prob-status.st-fixed { background: var(--warn-bg); color: #9a6512; }
.prob-status.st-verified { background: var(--ok-bg); color: var(--ok); }
.prob-status.st-failverify { background: var(--danger-bg); color: var(--danger); }
.prob-qa { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-2); background: var(--accent-2-soft); border-radius: 99px; padding: 2px 7px; }
.prob-desc { font-size: 13px; line-height: 1.5; color: var(--fg); white-space: pre-wrap; word-break: break-word; margin: 8px 0 6px; }
.prob-meta { font-size: 11.5px; color: var(--text-faint); }
.prob-actions { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.prob-resolved { font-size: 12px; color: var(--muted); margin-right: auto; }
.prob-failverify { font-size: 12px; font-weight: 600; color: var(--danger); margin-right: auto; }
.prob { position: relative; }
.prob-del { position: absolute; top: 6px; right: 8px; margin: 0; }
.prob-x { width: 20px; height: 20px; border-radius: 5px; border: none; background: transparent; display: flex; align-items: center; justify-content: center; color: var(--text-faint); cursor: pointer; padding: 0; font-size: 15px; line-height: 1; }
.prob-x:hover { color: var(--danger); background: var(--danger-bg); }
.prob-crashes { margin: 0 0 16px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 10px; }
.prob-crashes-h { font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.prob-crash { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border-soft); font-size: 12.5px; }
.prob-crash:first-of-type { border-top: 0; }
.prob-crash-kind { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--danger); background: var(--danger-bg); padding: 2px 7px; border-radius: 99px; white-space: nowrap; }
.crash-count { font-size: 11px; font-weight: 700; color: var(--danger); background: var(--danger-bg); padding: 2px 7px; border-radius: 99px; white-space: nowrap; }
.crash-devs { white-space: nowrap; }
.crash-more { margin-top: 10px; }
.prob-crash-sum { flex: 1; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prob-crash-when { white-space: nowrap; }
.prob-crash-trace { margin: 2px 0 6px; }
.prob-crash-trace > summary { cursor: pointer; user-select: none; padding: 2px 0; }
.prob-crash-trace .logcat-terminal { margin-top: 6px; max-height: 320px; overflow: auto; }
.trace-wrap { position: relative; }
.trace-copy { position: absolute; top: 8px; right: 8px; z-index: 2; opacity: .85; }
.trace-copy:hover { opacity: 1; }

/* ── Release problem trail + carried-over (Phase 2) ─────────────────────── */
.prob-carry { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-text); background: var(--accent-soft); border-radius: 99px; padding: 2px 7px; }
.prob-trail { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.prob-trail .tr-step { padding: 1px 7px; border-radius: 99px; background: var(--surface-3); }
.prob-trail .tr-step b { font-weight: 600; }
.prob-trail .tr-step.fixed { background: var(--warn-bg); color: #9a6512; }
.prob-trail .tr-step.verified { background: var(--ok-bg); color: var(--ok); }
.prob-trail .tr-arrow { color: var(--text-faint); }
.carried-sec { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border); }
.carried-h { font-size: 12.5px; font-weight: 600; margin-bottom: 10px; }

/* ── Releases hub: focus band + cross-release problems board (Phase 3) ───── */
.hub-focus { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; padding: 16px 20px; margin: 4px 0 16px; background: var(--surface2); border: 1px solid var(--border-soft); border-radius: 14px; }
.hub-focus-main { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 9px; }
.hub-eyebrow { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }
.hub-focus-ver { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.hub-focus-verlink { font-size: 18px; font-weight: 700; color: var(--text); text-decoration: none; }
.hub-focus-verlink:hover { color: var(--accent-text); }
.hub-qa-bar { min-width: 0; max-width: 420px; }
.hub-verdict { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; }
.hub-verdict .d { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.hub-verdict.ok { color: var(--ok); } .hub-verdict.warn { color: var(--warn); }
.hub-focus-stats { display: flex; gap: 20px; flex-wrap: wrap; }
.hub-stat { display: flex; flex-direction: column; gap: 2px; min-width: 62px; }
.hub-stat .n { font-size: 20px; font-weight: 700; line-height: 1; }
.hub-stat .k { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.hub-stat.bad .n { color: var(--danger); }
.hub-focus-cta { flex: none; }
.hub-list-h { font-size: 14px; font-weight: 700; margin: 22px 0 10px; color: var(--muted); }

/* Release train: the repeating ship -> test -> fix cycle, oldest -> newest. */
.rel-train { position: relative; display: flex; align-items: flex-start; gap: 0; flex-wrap: wrap; margin: 2px 0 14px; padding: 2px; overflow-x: auto; }
.rt-lines { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 0; }
.rt-lines path { fill: none; stroke: #7a80f6; stroke-width: 2.5; stroke-linecap: round; }
.rt-col { position: relative; z-index: 1; }
.rt-link { width: 26px; height: 2px; background: var(--border); flex: none; margin-top: 15px; }
.rt-col { display: inline-flex; flex-direction: column; align-items: center; flex: none; }
/* Branch forks hang below their build like a git graph. */
.rt-branches { position: relative; margin-top: 4px; padding-top: 11px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.rt-branches::before { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 11px; background: rgba(122,128,246,.5); transform: translateX(-50%); }
.rt-branch { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid rgba(122,128,246,.4); border-radius: 99px; background: rgba(122,128,246,.08); text-decoration: none; color: var(--text); white-space: nowrap; }
.rt-branch:hover { border-color: #7a80f6; }
.rt-branch-mark { color: #7a80f6; font-weight: 700; }
.rt-branch-ver { font-size: 11px; font-weight: 600; }
.rt-branch.merged { background: rgba(122,128,246,.16); border-color: #7a80f6; }
.rt-branch-into { font-size: 10.5px; font-weight: 700; color: #5b61d6; }
.rt-merge-in { color: #7a80f6; font-weight: 700; font-size: 12px; margin-left: 1px; }
.rt-node { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border: 1px solid var(--border-soft); border-radius: 99px; background: var(--surface); text-decoration: none; color: var(--text); white-space: nowrap; flex: none; }
.rt-node:hover { border-color: var(--accent); }

/* ── Lineage graph (commit-style: main spine + branch forks/merges) ── */
.collapsible-header .collapse-caret { transition: transform .15s; display: inline-block; }
.collapsible-header.open .collapse-caret { transform: rotate(90deg); }
.lineage-scroll { overflow-x: auto; padding: 20px 16px 10px; }
.lineage-svg { display: block; }
.lg-edge { stroke-width: 2; }
.lg-main { stroke: var(--rule-2, #d6d8e0); }
.lg-fork { stroke: rgba(122,128,246,.5); stroke-dasharray: 4 3; }
.lg-merge { stroke: #7a80f6; }
.lg-node { cursor: pointer; }
.lg-node:hover circle { stroke: #7a80f6; stroke-width: 2.5; }
.lg-label { font-size: 11px; font-weight: 700; fill: var(--text); font-family: var(--mono); }
.lg-blabel { fill: #5b61d6; font-size: 10.5px; }
[data-theme="dark"] .lg-blabel { fill: #a6abfa; }
.lg-sub { font-size: 9.5px; fill: var(--muted); text-transform: capitalize; }
.rt-node.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rt-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex: none; }
.rt-node.st-published .rt-dot { background: var(--ok); }
.rt-node.st-draft .rt-dot { background: var(--warn); }
.rt-ver { font-size: 12px; font-weight: 600; }
.rt-meta { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }

/* Live pulse — signals the region auto-updates via SSE. */
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); vertical-align: middle; margin-left: 2px; box-shadow: 0 0 0 0 var(--ok); animation: livepulse 2.4s ease-out infinite; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(21,127,60,.4); } 70% { box-shadow: 0 0 0 6px rgba(21,127,60,0); } 100% { box-shadow: 0 0 0 0 rgba(21,127,60,0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

.hub-board { margin-bottom: 8px; }
.board-list { display: flex; flex-direction: column; }
.board-row { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-top: 1px solid var(--border-soft); text-decoration: none; color: var(--text); font-size: 13px; border-radius: 6px; }
.board-row:first-child { border-top: 0; }
.board-row:hover { background: var(--surface2); }
.board-row.closed { opacity: .55; }
.board-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-ver { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.board-row .tr-step.fixed { font-size: 10.5px; padding: 1px 6px; border-radius: 99px; background: var(--warn-bg); color: #9a6512; white-space: nowrap; }
.board-when { white-space: nowrap; flex: none; }
/* Board filter is a class on the list container — no JS needed for the default view. */
.board-list.filter-open .board-row[data-open="0"] { display: none; }
.board-list.filter-blocker .board-row:not([data-severity="blocker"]) { display: none; }
.board-list.filter-blocker .board-row[data-open="0"] { display: none; }
@media (max-width: 640px) {
  .board-ver, .board-when { display: none; }
  .hub-focus-cta { width: 100%; }
  .hub-focus-cta .btn-primary { width: 100%; justify-content: center; }
}
/* Tab count badge (QA / Problems tabs). Hidden when the inner pill is empty. */
.dd-tab .tab-badge { display: inline-flex; margin-left: 3px; vertical-align: middle; }
.dd-tab .tab-badge:empty { display: none; }
.dd-tab-n { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--danger); background: var(--danger-bg); border-radius: 99px; padding: 1px 7px; }

/* device detail: Install app form (Applications tab) */
.app-install { border-bottom: 1px solid var(--border-soft); }
.app-install[hidden] { display: none; }

/* device detail: hero Kiosk pill → config popover */
.ddc-chip-btn { cursor: pointer; font: inherit; }
.ddc-chip-btn.on { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.ddc-kcaret { width: 12px; height: 12px; opacity: .7; }
.ddc-kpop-wrap { position: relative; display: inline-flex; }
.ddc-kpop { position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; width: 300px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 13px;
  box-shadow: var(--shadow-pop); padding: 14px; animation: ov-rise 0.14s var(--ease) both; }
.ddc-kpop[hidden] { display: none; }
.ddc-kpop-h { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.ddc-kpop .form-row { margin-bottom: 12px; }
.ddc-kpop .form-label { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; display: block; }

/* device-cards roster: remove action button */
.dl-remove { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px; color: var(--text-faint); cursor: pointer; }
.dl-remove:hover { border-color: var(--danger-edge); color: var(--danger); background: var(--danger-bg); }

/* kiosk popover: enable/disable toggle row */
.ddc-kpop-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kiosk-sw { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; cursor: pointer; }
.kiosk-sw input { opacity: 0; width: 0; height: 0; }
.kiosk-sw .kiosk-sw-tr { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); transition: background .15s; }
.kiosk-sw .kiosk-sw-kn { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: left .15s; }
.kiosk-sw input:checked + .kiosk-sw-tr { background: var(--accent); }
.kiosk-sw input:checked + .kiosk-sw-tr .kiosk-sw-kn { left: 21px; }
.kiosk-need { border-color: var(--accent) !important; box-shadow: var(--ring); }

/* device detail: app being installed (in-flight) */
.app-row.app-installing { background: var(--accent-soft); }
.app-installing-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600;
  color: var(--accent-text); white-space: nowrap; }
.app-dup { display: inline-block; font-size: 10.5px; font-weight: 600; color: var(--text-faint);
  border: 1px solid var(--border); border-radius: 99px; padding: 1px 6px; vertical-align: middle; }
.app-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent-edge); border-top-color: var(--accent);
  animation: app-spin 0.7s linear infinite; flex: none; }
@keyframes app-spin { to { transform: rotate(360deg); } }

/* ── Actions history: day-grouped timeline, one line per row. Shared by /commands
   and the standalone /commands/history page. Status buckets (hgrp-h) carry the
   priority hierarchy; day headers (hist-day) carry the chronological one — each
   row then sheds every column it doesn't need instead of a fixed grid. ── */
.hgrp-h{display:flex;align-items:center;gap:8px;font-size:11px;font-weight:700;letter-spacing:.5px;text-transform:uppercase;padding:14px 18px 6px;color:var(--text-faint);}
.hgrp-h svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2.2;flex:none;}
.hgrp-h .cnt{color:var(--text-faint);font-weight:700;}
.hgrp-h.attn{color:var(--danger);}
.hgrp-h.prog{color:var(--accent-2);}
.hgrp-h.done{color:var(--text-faint);}
.hist-day{padding:10px 18px 4px;font-size:10.5px;font-weight:750;text-transform:uppercase;letter-spacing:.06em;color:var(--text-faint);}
.htrow{display:flex;align-items:center;gap:11px;padding:9px 18px;border-top:1px solid var(--border-soft);}
.htrow:hover{background:var(--surface2);}
/* Timeline rail dot (replaces the old icon-box per row, matching the chosen
   history-hierarchy demo exactly): a small state dot with a hairline connecting
   it to the next row, drawn via the wrapper's own padding so it reads as one
   continuous rail down the list without needing a separate wrapping container
   per day group. */
.ht-dotwrap{width:18px;flex:none;display:flex;justify-content:center;align-items:flex-start;padding-top:5px;position:relative;align-self:stretch;}
.ht-dotwrap::before{content:"";position:absolute;top:-9px;bottom:-9px;left:50%;width:1px;background:var(--border-soft);transform:translateX(-50%);}
.ht-dotwrap .dot{position:relative;z-index:1;width:7px;height:7px;border-radius:99px;background:var(--text-faint);flex:none;}
.ht-dotwrap .dot.ok{background:var(--ok);}
.ht-dotwrap .dot.fail{background:var(--danger);}
.ht-dotwrap .dot.run{background:var(--accent-2);}
.ht-body{flex:1;min-width:0;display:flex;align-items:baseline;gap:9px;flex-wrap:wrap;}
.ht-title{font-size:13.5px;font-weight:650;color:inherit;text-decoration:none;flex:none;}
.ht-title:hover{color:var(--accent-text);}
.ht-meta{font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;}
.ht-by{font-size:12px;color:var(--text-faint);flex:none;white-space:nowrap;display:inline-flex;align-items:center;gap:5px;}
/* avatar bubble: initial, or a small subtle picture; used next to author names */
.ubub{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:50%;flex:none;overflow:hidden;background:var(--surface-3,var(--surface2));color:var(--text-2,var(--muted));font-size:10px;font-weight:750;text-transform:uppercase;line-height:1;vertical-align:-4px;box-shadow:inset 0 0 0 1px var(--border);}
.ubub img{width:100%;height:100%;object-fit:cover;display:block;opacity:.92;}
.ad-by{display:inline-flex;align-items:center;gap:6px;}
.appbar-acct .av{overflow:hidden;}.appbar-acct .av .av-img{width:100%;height:100%;object-fit:cover;display:block;}
.ht-by::before{content:"by ";}
.ht-meta .sep{display:inline-block;width:3px;height:3px;border-radius:50%;background:var(--rule-2);margin:0 7px;vertical-align:middle;}
.ht-meta .pd{display:inline-block;width:6px;height:6px;border-radius:99px;background:var(--accent-2);animation:tlpulse 1.2s ease-in-out infinite;margin-right:5px;}
@keyframes tlpulse{0%,100%{opacity:1}50%{opacity:.25}}
.ht-fail{color:var(--danger);font-weight:600;}
.ht-when{flex:none;font-size:11px;color:var(--text-faint);white-space:nowrap;}
.hact{flex:none;display:flex;align-items:center;gap:8px;}
.hact form{display:inline;margin:0;}
.hmore{display:block;padding:9px 18px 11px;font-size:12px;font-weight:600;color: var(--accent-text);text-decoration:none;border-top:1px solid var(--border-soft);background:var(--surface);}
.hmore:hover{background:var(--surface2);}
.hretry{font-size:11.5px;font-weight:650;color: var(--accent-text);border:1px solid var(--accent-edge);background:var(--surface);border-radius:8px;padding:5px 11px;cursor:pointer;display:inline-flex;align-items:center;gap:6px;}
.hretry:hover{background:var(--accent-soft);}
.hretry svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:2;}
.htrow .cmd-del{border:none;background:none;color:var(--text-faint);font-size:16px;line-height:1;cursor:pointer;padding:2px 5px;border-radius:6px;}
.htrow .cmd-del:hover{color:var(--danger);background:var(--danger-bg);}
@media (max-width:640px){.htrow{flex-wrap:wrap;}.ht-when{order:1;margin-left:auto;}.hact{order:2;}.ht-body{order:3;flex-basis:100%;}}

/* History-page status context tabs */
.hist-tabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:14px;}
.hist-tab{display:inline-flex;align-items:center;gap:7px;padding:7px 13px;border:1px solid var(--border);border-radius:9px;background:var(--surface);font-size:13px;font-weight:600;color:var(--muted);text-decoration:none;}
.hist-tab:hover{background:var(--surface2);}
.hist-tab.on{border-color:transparent;background:var(--accent-soft);color: var(--accent-text);}
.hist-tab .cnt{font-size:11.5px;color:var(--text-faint);font-weight:700;}
.hist-tab.on .cnt{color: var(--accent-text);}

/* History empty-state row + the "Clear all" (dismiss) control */
.hist-empty{padding:14px 18px;font-size:12.5px;color:var(--muted);border-top:1px solid var(--border-soft);}
.hclear{font-size:11px;font-weight:650;color:var(--muted);border:1px solid var(--border);background:var(--surface);border-radius:7px;padding:4px 10px;cursor:pointer;text-transform:none;letter-spacing:0;}
.hclear:hover{border-color:var(--danger-edge);color:var(--danger);background:var(--danger-bg);}

/* ── Skeleton loading placeholders (shown until an hx-trigger=load fragment or a
   boosted page swaps in). The shimmer respects reduced-motion. ── */
.skel{position:relative;overflow:hidden;background:var(--surface-3);border-radius:6px;}
.skel::after{content:"";position:absolute;inset:0;transform:translateX(-100%);
  background:linear-gradient(90deg,transparent,color-mix(in srgb,var(--surface) 60%,transparent),transparent);
  animation:skel-sweep 1.2s infinite;}
@keyframes skel-sweep{100%{transform:translateX(100%);}}
@media (prefers-reduced-motion: reduce){.skel::after{animation:none;}}
.skel-line{height:12px;margin:8px 0;}
.skel-list{padding:12px 14px;}
.skel-row{display:flex;align-items:center;gap:12px;padding:10px 0;border-bottom:1px solid var(--border-soft);}
.skel-row:last-child{border-bottom:none;}
.skel-av{width:32px;height:32px;border-radius:8px;flex:none;}
.skel-row .g{flex:1;display:flex;flex-direction:column;gap:6px;}
.skel-w40{width:40%;}.skel-w60{width:60%;}.skel-w25{width:25%;}
.skel-pill{height:22px;width:64px;border-radius:99px;flex:none;}

/* Full-page skeleton shown during boosted navigation (see layout.html). */
.skel-page{padding:6px 0;}
.skel-title{width:210px;height:24px;border-radius:8px;margin:8px 0 22px;}
.skel-card{border:1px solid var(--border);border-radius:14px;background:var(--surface);}

/* Skeleton archetype building blocks (per-page nav skeletons — see layout <template>s). */
.skel-block{background:var(--surface-3);border-radius:14px;position:relative;overflow:hidden;}
.skel-block::after{content:"";position:absolute;inset:0;transform:translateX(-100%);
  background:linear-gradient(90deg,transparent,color-mix(in srgb,var(--surface) 60%,transparent),transparent);animation:skel-sweep 1.2s infinite;}
@media (prefers-reduced-motion: reduce){.skel-block::after{animation:none;}}
.skel-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin:0 0 16px;}
.skel-statcard{border:1px solid var(--border);border-radius:12px;background:var(--surface);padding:16px 18px;}
.skel-2col{display:grid;grid-template-columns:1fr 320px;gap:16px;align-items:start;}
.skel-chips{display:flex;gap:12px;margin:0 0 20px;}
.skel-chip-lg{flex:1;height:64px;border-radius:13px;}
.skel-3pane{display:grid;grid-template-columns:212px 1fr 300px;border:1px solid var(--border);border-radius:14px;overflow:hidden;background:var(--surface);}
.skel-3pane .p{padding:16px 18px;}
@media (max-width:1180px){.skel-3pane{grid-template-columns:212px 1fr;}.skel-3pane .imp{display:none;}}
@media (max-width:900px){.skel-2col{grid-template-columns:1fr;}.skel-stats{grid-template-columns:repeat(2,1fr);}}

/* ════════════════════════════════════════════════════════
   FLEET HEALTH · Ops Split (hero + ranked list · evidence feed)
   ════════════════════════════════════════════════════════ */
.hl-hero { display: flex; align-items: center; gap: 22px; margin-bottom: 16px;
  background: linear-gradient(120deg, var(--surface), var(--surface2));
  border: 1px solid var(--border);
  border-radius: var(--r-4); padding: 18px 22px; box-shadow: var(--shadow-sm); }
.hl-ring { position: relative; flex: none; width: 84px; height: 84px; }
.hl-ring .trk { fill: none; stroke: var(--border); stroke-width: 8; }
.hl-ring .val { fill: none; stroke-width: 8; stroke-linecap: round; stroke: var(--muted); }
.hl-hero.is-ok .hl-ring .val { stroke: var(--ok); }
.hl-hero.is-warn .hl-ring .val { stroke: var(--warn); }
.hl-hero.is-danger .hl-ring .val { stroke: var(--danger); }
.hl-ring-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hl-hero.is-ok .hl-ring-num { color: var(--ok); }
.hl-hero.is-warn .hl-ring-num { color: var(--warn); }
.hl-hero.is-danger .hl-ring-num { color: var(--danger); }
.hl-htxt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hl-eyebrow { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); font-weight: 600; }
.hl-verdict { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.hl-sub { font-size: 13px; color: var(--muted); }
.hl-kpis { margin-left: auto; display: flex; gap: 22px; }
.hl-kpi { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.hl-kpi .v { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; color: var(--text); }
.hl-kpi .v.ok { color: var(--ok); } .hl-kpi .v.warn { color: var(--warn); } .hl-kpi .v.bad { color: var(--danger); }
.hl-kpi .k { font-size: 11px; color: var(--muted); }
.hl-kpi:hover .v { color: var(--accent-text); }
.hl-toggle { flex: none; align-self: flex-start; }
@media (max-width: 860px) { .hl-hero { flex-wrap: wrap; } .hl-kpis { margin-left: 0; width: 100%; order: 3; } .hl-toggle { order: 2; } }

.spacer-l { margin-left: auto; }

/* split */
.hl-split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 980px) { .hl-split { grid-template-columns: 1fr; } }

/* ranked restaurant rows */
.hl-row { display: grid; grid-template-columns: 118px minmax(0,1.4fr) repeat(4, minmax(0,1fr));
  gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--border-soft);
  color: var(--text); transition: background var(--dur) var(--ease); }
.hl-row:last-child { border-bottom: 0; }
a.hl-row:hover { background: var(--hover); }
.hl-row-head { padding-top: 10px; padding-bottom: 10px; }
.hl-row-head span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 600; }
.hl-row .num { text-align: right; }
.hl-scorewrap { display: flex; align-items: center; gap: 9px; }
.hl-scorebar { flex: 1; height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; }
.hl-scorebar i { display: block; height: 100%; border-radius: 99px; background: var(--muted); }
.hl-scorebar i.ok { background: var(--ok); } .hl-scorebar i.warn { background: var(--warn); } .hl-scorebar i.danger { background: var(--danger); }
.hl-scoren { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 20px; text-align: right; }
.hl-scoren.ok { color: var(--ok); } .hl-scoren.warn { color: var(--warn); } .hl-scoren.danger { color: var(--danger); } .hl-scoren.muted { color: var(--text-faint); }
.hl-rname { font-size: 13.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-rname .s { display: block; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.hl-cell { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.hl-cell b.bad { color: var(--danger); } .hl-cell .warn { color: var(--warn); }
.hl-cell .u { color: var(--text-faint); font-size: 11px; }
.hl-cell .muted { color: var(--text-faint); }

/* evidence feed */
.hl-feed { display: flex; flex-direction: column; }
.hl-evcat { display: flex; align-items: center; gap: 8px; padding: 9px 18px; background: var(--surface2);
  border-bottom: 1px solid var(--border-soft); font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; }
.hl-evcat .c { margin-left: auto; color: var(--text-faint); }
.hl-ev { display: flex; gap: 11px; padding: 11px 18px; border-bottom: 1px solid var(--border-soft); }
.hl-ev:last-child { border-bottom: 0; }
.hl-ev .dot { margin-top: 5px; }
.hl-ev .evb { min-width: 0; flex: 1; }
.hl-ev .t1 { font-size: 13px; }
.hl-ev .t1 .sm { color: var(--text-2); }
.hl-ev .t2 { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.hl-sev { flex: none; align-self: flex-start; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: 2px 7px; border-radius: 5px; }
.hl-sev.c { background: rgba(180,35,24,.11); color: var(--danger); }
.hl-sev.w { background: rgba(180,83,9,.13); color: var(--warn); }
.hl-sev.m { background: var(--surface2); color: var(--muted); }
.hl-allclear { display: flex; align-items: center; gap: 13px; padding: 26px 20px; }
.hl-check { width: 34px; height: 34px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--ok-soft, rgba(21,127,60,.12)); color: var(--ok); }
.hl-check svg { width: 18px; height: 18px; }
.hl-allclear .t { font-size: 14px; font-weight: 600; }
.hl-allclear .d { font-size: 12.5px; color: var(--muted); }

/* severity dots shared by the feed */
.hl-evidence .dot, .hl-evcat .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.d-bad { background: var(--danger); } .d-warn { background: var(--warn); } .d-muted { background: var(--text-faint); }

/* ── Daily Report · live generation (thinking log + streamed reveal) ── */
.ai-think{display:flex;flex-direction:column;gap:9px;padding:2px 0}
.ai-tline{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--muted);opacity:0;transform:translateY(4px);transition:opacity .3s,transform .3s}
.ai-tline.show{opacity:1;transform:none}
.ai-tick{width:16px;height:16px;flex:none;color:var(--ok)}
.ai-tspin{width:14px;height:14px;flex:none;border:2px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:ai-spin .7s linear infinite}
@keyframes ai-spin{to{transform:rotate(360deg)}}
.ai-caret{display:inline-block;width:2px;height:1.05em;background:var(--accent);margin-left:1px;vertical-align:-2px;animation:ai-blink 1s steps(2) infinite}
@keyframes ai-blink{50%{opacity:0}}
.ai-reveal .rep-tile,.ai-reveal .rep-row,.ai-reveal .rep-good{opacity:0;transform:translateY(6px)}
.ai-reveal .rep-tile.in,.ai-reveal .rep-row.in,.ai-reveal .rep-good.in{opacity:1;transform:none;transition:opacity .35s,transform .35s}
@media(prefers-reduced-motion:reduce){.ai-tline,.ai-reveal .rep-tile,.ai-reveal .rep-row,.ai-reveal .rep-good{transition:none;opacity:1;transform:none}.ai-caret,.ai-tspin{animation:none}}

/* Fleet nav skeleton: mirrors .fleet-md (collections rail + roster). */
.skel-w80{width:80%;}
.skel-fleet-grid{display:grid;grid-template-columns:232px minmax(0,1fr);gap:20px;align-items:start;}
.skel-fleet-rail{padding:16px 16px 20px;}
.skel-fleet-roster{min-width:0;}
.skel-fleet-views{display:flex;gap:8px;margin:0 0 16px;flex-wrap:wrap;}
@media (max-width:900px){.skel-fleet-grid{grid-template-columns:1fr;}.skel-fleet-rail{display:none;}}

/* ══════════════════════════════════════════════════════════
   Responsive · phone row-grid relaxation (≤640px)
   Dense multi-column list rows wrap or shed low-value columns
   so nothing overflows on phones. Rows that already collapse
   (.rel-row@820, .rlc@760, .qa-row@720, .htrow@640) and the
   container-query fleet cards (.dl-card) keep their own rules.
   ══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Commands list: identity grows; status chip / time / delete wrap below. */
  .cmd-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
  .cmd-row .cmd-main { flex: 1 1 58%; min-width: 0; }

  /* Users list: avatar + identity on the first line; role + actions wrap. */
  .user-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
  .user-row .user-id { flex: 1 1 55%; min-width: 0; }
  .user-row .user-act { margin-left: auto; }

  /* Fleet-health ranked table: keep Score/Restaurant/Offline/Battery;
     drop the two least-critical metric columns (Charging, Max °C). */
  .hl-row { grid-template-columns: 92px minmax(0, 1fr) auto auto; gap: 10px; padding: 11px 14px; }
  .hl-row > :nth-child(5), .hl-row > :nth-child(6) { display: none; }

  /* Wide data tables (nowrap headers) scroll sideways inside their card
     instead of forcing the whole page to scroll. Cards otherwise clip
     (overflow:hidden); relax that only when they hold a raw table. */
  .card:has(> .table),
  .card:has(> table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── Global reduced-motion safety net (WCAG 2.3.3 / 2.2.2) ──────────────────────
   The app gates most animations individually, but the overview entrance motion
   (ov-rise, ovx-grow, dvp-in), infinite decorative pulses (ovx-pulse), the error
   toast slide (mtoast-in/out), and a few inline template keyframes were not covered.
   This catch-all neutralises any remaining animation/transition for users who ask
   for reduced motion — entrance animations that use fill-mode `both`/`forwards` snap
   straight to their final (visible, in-place) state, so nothing is hidden. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Changelog media gallery + "What's new" popup ─────────────────────────── */
/* Screenshot/gif grid shown on the changelog page and in the What's new popup. */
.cl-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 14px;
}
.cl-shot { margin: 0; min-width: 0; }
.cl-shot-wide { grid-column: 1 / -1; }
.cl-shot-link {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--r-3, 10px);
  overflow: hidden;
  background: var(--surface2, var(--surface));
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.cl-shot-link:hover { border-color: var(--accent); box-shadow: var(--shadow-pop); }
.cl-shot img { display: block; width: 100%; height: auto; }
.cl-shot figcaption {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.4;
}
@media (max-width: 560px) {
  .cl-gallery { grid-template-columns: 1fr; }
  .cl-shot-wide { grid-column: auto; }
}

/* What's new popup: a wider modal that can hold the media gallery, with a
   pinned "Show all changelogs" footer under a scrolling body. */
.whatsnew-box { max-width: 620px; }
.whatsnew-body { gap: var(--s-2, 8px); }
.whatsnew-head { display: flex; align-items: flex-start; justify-content: space-between; }
.whatsnew-kicker {
  font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 2px;
}
.whatsnew-ver { font-size: 16px; font-weight: 700; }
.whatsnew-changes { margin: 0; padding: 0; list-style: none; }
.whatsnew-changes li {
  position: relative; padding: 9px 0 9px 20px; line-height: 1.6; font-size: 12.5px;
  color: var(--text2, var(--muted)); border-top: 1px dashed var(--border-soft);
}
.whatsnew-changes li:first-child { border-top: none; }
.whatsnew-changes li::before {
  content: ""; position: absolute; left: 3px; top: 15px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent);
}
/* clFormat's bold lead sentence — styled globally so it also renders in the popup
   (the changelog page has its own scoped copy). */
.whatsnew-changes .cl-lead { color: var(--text); font-weight: 650; }
.whatsnew-foot {
  display: flex; justify-content: flex-end;
  padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border);
}

/* Release push pane: group/restaurant target chips. */
.push-tgt-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 150px; overflow-y: auto; }
.push-tgt-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; font-size: 12.5px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.push-tgt-chip:hover { border-color: var(--accent); }
.push-tgt-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.push-tgt-chip input { margin: 0; }

/* ════════════════════════════════════════════════════
   COMMAND-CENTER COMPONENTS (cc-*) — shared page language
   introduced with the Overview redesign. Every page uses
   these for its header, KPI strip, cards, chips, empties.
   ════════════════════════════════════════════════════ */
.cc-wrap{max-width:1280px;margin:0 auto}
.cc-tnum{font-variant-numeric:tabular-nums}

/* page top bar: eyebrow · headline · subtitle | actions */
.cc-top{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;margin-bottom:18px}
.cc-top>div:first-child{flex:1;min-width:0}
.cc-eyebrow{font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--text-faint);display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.cc-live{display:inline-flex;align-items:center;gap:6px;font-size:10.5px;font-weight:700;letter-spacing:.06em;color:var(--ok);text-transform:uppercase}
.cc-live .dot{width:6px;height:6px;border-radius:50%;background:var(--ok);animation:ccpulse 2s infinite}
@keyframes ccpulse{0%{box-shadow:0 0 0 0 rgba(21,127,60,.45)}70%{box-shadow:0 0 0 6px rgba(21,127,60,0)}100%{box-shadow:0 0 0 0 rgba(21,127,60,0)}}
.cc-h1{font-size:26px;font-weight:750;letter-spacing:-.022em;margin:6px 0 0;line-height:1.15}
.cc-h1 .hl{color:var(--accent-text)}.cc-h1 .hl.ok{color:var(--ok)}.cc-h1 .hl.warn{color:var(--warn)}.cc-h1 .hl.danger{color:var(--danger)}
.cc-sub{font-size:13.5px;color:var(--muted);margin-top:6px;max-width:78ch;line-height:1.5}
.cc-sub b{color:var(--text);font-weight:650}
.cc-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center;justify-content:flex-end;flex:none;padding-top:20px}
@media(max-width:1000px){.cc-top{flex-direction:column;gap:14px}.cc-actions{padding-top:0;justify-content:flex-start}}
.cc-btn{display:inline-flex;align-items:center;gap:7px;font:inherit;font-size:12.5px;font-weight:650;padding:8px 13px;border-radius:10px;border:1px solid var(--border);background:var(--surface);color:var(--text-2);text-decoration:none;box-shadow:var(--shadow-sm);cursor:pointer;transition:border-color var(--dur),background var(--dur);white-space:nowrap}
.cc-btn:hover{border-color:var(--rule-2);background:var(--surface2);color:var(--text)}
.cc-btn.primary{background:var(--accent);color:var(--accent-ink);border-color:transparent}.cc-btn.primary:hover{background:var(--accent-h);color:#fff}
.cc-btn.danger{color:var(--danger);border-color:var(--danger-edge)}.cc-btn.danger:hover{background:var(--danger-bg)}
.cc-btn:disabled,.cc-btn[aria-disabled=true]{opacity:.5;cursor:not-allowed}
.cc-btn svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.cc-btn .n{font-size:10.5px;font-weight:750;padding:1px 6px;border-radius:99px;background:var(--surface-3);color:var(--text-2);margin-left:2px}
.cc-btn .n.warn{background:var(--warn-bg);color:var(--warn)}.cc-btn .n.bad{background:var(--danger-bg);color:var(--danger)}
.cc-btn.sm{font-size:12px;padding:6px 10px;border-radius:8px}

/* hero band (tinted by state) */
.cc-hero{display:grid;gap:0;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-4);box-shadow:var(--shadow-sm);margin-bottom:16px;overflow:hidden;position:relative}
.cc-hero::before{content:"";position:absolute;inset:0;pointer-events:none;background:linear-gradient(118deg,var(--accent-soft),transparent 55%)}
.cc-hero.is-ok::before{background:linear-gradient(118deg,var(--ok-bg),transparent 55%)}
.cc-hero.is-warn::before{background:linear-gradient(118deg,var(--warn-bg),transparent 55%)}
.cc-hero.is-danger::before{background:linear-gradient(118deg,var(--danger-bg),transparent 55%)}
.cc-hero>*{position:relative}
.cc-hero-cell{padding:22px 26px;min-width:0}
.cc-hero-cell+.cc-hero-cell{border-left:1px solid var(--border-soft)}
@media(max-width:980px){.cc-hero{grid-template-columns:1fr!important}.cc-hero-cell+.cc-hero-cell{border-left:none;border-top:1px solid var(--border-soft)}}
.cc-label{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}
.cc-pill{display:inline-flex;align-items:center;gap:6px;font-size:11px;font-weight:700;padding:3px 10px;border-radius:99px;background:var(--surface2);color:var(--muted)}
.cc-pill.ok{background:var(--ok-bg);color:var(--ok)}.cc-pill.warn{background:var(--warn-bg);color:var(--warn)}.cc-pill.danger,.cc-pill.bad{background:var(--danger-bg);color:var(--danger)}.cc-pill.info{background:var(--info-bg);color:var(--info)}.cc-pill.accent{background:var(--accent-soft);color:var(--accent-text)}
.cc-big{font-size:28px;font-weight:750;letter-spacing:-.02em;line-height:1;font-variant-numeric:tabular-nums}
.cc-big small{font-size:12px;font-weight:600;color:var(--muted);letter-spacing:0;margin-left:6px}
.cc-big.ok{color:var(--ok)}.cc-big.warn{color:var(--warn)}.cc-big.danger,.cc-big.bad{color:var(--danger)}

/* score ring (SVG r=44 in a 104 viewbox; dasharray 276.5) */
.cc-ring{position:relative;width:104px;height:104px;flex:none}
.cc-ring svg{width:104px;height:104px}
.cc-ring .trk{fill:none;stroke:var(--surface-3);stroke-width:9}
.cc-ring .val{fill:none;stroke:var(--accent);stroke-width:9;stroke-linecap:round}
.cc-ring.ok .val{stroke:var(--ok)}.cc-ring.warn .val{stroke:var(--warn)}.cc-ring.danger .val{stroke:var(--danger)}
.cc-ring b{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:30px;font-weight:750;letter-spacing:-.02em;line-height:1;color:var(--accent-text)}
.cc-ring.ok b{color:var(--ok)}.cc-ring.warn b{color:var(--warn)}.cc-ring.danger b{color:var(--danger)}
.cc-ring b small{font-size:9.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--text-faint);margin-top:3px}

/* fact chips (linkable) */
.cc-facts{display:flex;flex-wrap:wrap;gap:7px}
.cc-fact{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:600;color:var(--muted);background:var(--surface);border:1px solid var(--border);border-radius:99px;padding:4px 11px;text-decoration:none}
a.cc-fact:hover{border-color:var(--rule-2);color:var(--text)}
.cc-fact b{color:var(--text);font-variant-numeric:tabular-nums}
.cc-fact.bad{color:var(--danger);border-color:var(--danger-edge)}.cc-fact.bad b{color:var(--danger)}
.cc-fact.warn{color:var(--warn);border-color:var(--warn-edge)}.cc-fact.warn b{color:var(--warn)}
.cc-fact.ok{color:var(--ok);border-color:var(--ok-edge)}.cc-fact.ok b{color:var(--ok)}
.cc-fact svg{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}

/* KPI strip — state-tinted tiles: accent rail on the left, icon chip,
   corner wash and the number in the state colour. Neutral tiles stay quiet. */
.cc-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin-bottom:16px}
.cc-kpi{--kc:var(--text-2);--kwash:transparent;--kchip:var(--surface2);position:relative;display:block;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-4);box-shadow:none;padding:14px 16px 13px;text-decoration:none;color:inherit;overflow:hidden;transition:border-color var(--dur),transform var(--dur-fast),box-shadow var(--dur)}
.cc-kpi.has-spark{padding-bottom:0}
a.cc-kpi:hover{border-color:var(--rule-2);transform:translateY(-1px);color:inherit}
.cc-kpi:has(.v.ok){--kc:var(--ok);--kwash:var(--ok-bg);--kchip:var(--ok-bg)}
.cc-kpi:has(.v.warn){--kc:var(--warn);--kwash:var(--warn-bg);--kchip:var(--warn-bg)}
.cc-kpi:has(.v.bad),.cc-kpi:has(.v.danger){--kc:var(--danger);--kwash:var(--danger-bg);--kchip:var(--danger-bg)}
.cc-kpi:has(.v.info){--kc:var(--info);--kwash:var(--info-bg);--kchip:var(--info-bg)}
.cc-kpi:has(.v.accent){--kc:var(--accent);--kwash:var(--accent-soft);--kchip:var(--accent-soft)}
.cc-kpi.ok{--kc:var(--ok);--kwash:var(--ok-bg);--kchip:var(--ok-bg)}.cc-kpi.warn{--kc:var(--warn);--kwash:var(--warn-bg);--kchip:var(--warn-bg)}.cc-kpi.bad,.cc-kpi.danger{--kc:var(--danger);--kwash:var(--danger-bg);--kchip:var(--danger-bg)}.cc-kpi.info{--kc:var(--info);--kwash:var(--info-bg);--kchip:var(--info-bg)}
.cc-kpi .k{display:flex;align-items:center;gap:6px;font-size:11.5px;font-weight:600;color:var(--muted)}
.cc-kpi .k svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none;color:var(--kc)}
.cc-kpi .v{font-size:26px;font-weight:700;letter-spacing:-.02em;line-height:1;margin-top:9px;font-variant-numeric:tabular-nums;color:var(--text)}
.cc-kpi .v.ok{color:var(--ok)}.cc-kpi .v.warn{color:var(--warn)}.cc-kpi .v.bad,.cc-kpi .v.danger{color:var(--danger)}.cc-kpi .v.info{color:var(--info)}.cc-kpi .v.accent{color:var(--accent-text)}
.cc-kpi .v small{font-size:13px;font-weight:600;color:var(--muted);letter-spacing:0;margin-left:4px}
.cc-kpi .d{font-size:11.5px;color:var(--muted);margin-top:7px;display:flex;align-items:center;gap:5px;min-height:16px}
.cc-dl{font-weight:700;display:inline-flex;align-items:center;gap:1px}
.cc-dl.bad{color:var(--danger)}.cc-dl.good{color:var(--ok)}
.cc-dl svg{width:10px;height:10px;fill:none;stroke:currentColor;stroke-width:2.6}
.cc-sp{display:block;width:100%;height:30px;margin-top:6px}
.cc-sp polyline{fill:none;stroke-width:1.8;stroke-linejoin:round;stroke-linecap:round;vector-effect:non-scaling-stroke}
.cc-sp polygon{opacity:.14}
.cc-sp.ok polyline{stroke:var(--ok)}.cc-sp.ok polygon{fill:var(--ok)}
.cc-sp.warn polyline{stroke:var(--warn)}.cc-sp.warn polygon{fill:var(--warn)}
.cc-sp.bad polyline{stroke:var(--danger)}.cc-sp.bad polygon{fill:var(--danger)}
.cc-sp.accent polyline{stroke:var(--accent)}.cc-sp.accent polygon{fill:var(--accent)}
.cc-sp.mut polyline{stroke:var(--rule-2)}.cc-sp.mut polygon{fill:var(--rule-2)}
.cc-sp-empty{height:30px;margin-top:6px}

/* layout grids */
.cc-grid{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(0,1fr);gap:16px;align-items:start}
.cc-grid.even{grid-template-columns:1fr 1fr}
.cc-grid.rail{grid-template-columns:260px minmax(0,1fr)}
@media(max-width:980px){.cc-grid,.cc-grid.even,.cc-grid.rail{grid-template-columns:1fr}}
.cc-col{display:flex;flex-direction:column;gap:16px;min-width:0}

/* cards */
.cc-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-4);box-shadow:var(--shadow-sm);overflow:hidden}
.cc-card+.cc-card{margin-top:16px}
.cc-ch{display:flex;align-items:center;gap:9px;padding:13px 17px;border-bottom:1px solid var(--border-soft);flex-wrap:wrap}
.cc-ch h3,.cc-ch h2{font-size:14px;font-weight:700;margin:0;letter-spacing:-.005em}
.cc-ch .ic{width:26px;height:26px;border-radius:8px;display:flex;align-items:center;justify-content:center;background:var(--accent-soft);color:var(--accent-text);flex:none}
.cc-ch .ic.v2{background:var(--accent-2-soft);color:var(--accent-2)}
.cc-ch .ic.ok{background:var(--ok-bg);color:var(--ok)}
.cc-ch .ic.warn{background:var(--warn-bg);color:var(--warn)}
.cc-ch .ic.danger,.cc-ch .ic.bad{background:var(--danger-bg);color:var(--danger)}
.cc-ch .ic.info{background:var(--info-bg);color:var(--info)}
.cc-ch .ic.mut{background:var(--surface2);color:var(--muted)}
.cc-ch .ic svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.cc-ch .m{margin-left:auto;font-size:12px;color:var(--muted);white-space:nowrap}
.cc-ch .r{font-size:12px;font-weight:650;color:var(--accent-text);text-decoration:none;white-space:nowrap}
.cc-ch .m+.r{margin-left:12px}
.cc-ch .right{margin-left:auto;display:inline-flex;align-items:center;gap:8px}
.cc-cb{padding:14px 17px}
.cc-foot{display:block;text-align:center;padding:10px;font-size:12.5px;font-weight:600;color:var(--accent-text);border-top:1px solid var(--border-soft);text-decoration:none}
.cc-foot:hover{background:var(--surface2)}

/* list rows inside cards */
.cc-row{display:flex;align-items:center;gap:12px;padding:12px 17px;border-top:1px solid var(--border-soft);color:inherit;text-decoration:none}
.cc-row:first-of-type{border-top:none}
a.cc-row:hover,.cc-row.hover:hover{background:var(--surface2);color:inherit}
.cc-row .main{flex:1;min-width:0}
.cc-row .t{font-size:13.5px;font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cc-row .s{font-size:12px;color:var(--muted);margin-top:2px}
.cc-row .s .mono,.cc-mono{font-family:var(--mono)}
.cc-row .end{flex:none;display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var(--muted)}
.cc-sq{width:40px;height:40px;flex:none;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:15px;font-weight:750;font-variant-numeric:tabular-nums;background:var(--surface2);color:var(--muted)}
.cc-sq.ok{background:var(--ok-bg);color:var(--ok)}.cc-sq.warn{background:var(--warn-bg);color:var(--warn)}.cc-sq.danger,.cc-sq.bad{background:var(--danger-bg);color:var(--danger)}.cc-sq.info{background:var(--info-bg);color:var(--info)}.cc-sq.accent{background:var(--accent-soft);color:var(--accent-text)}.cc-sq.v2{background:var(--accent-2-soft);color:var(--accent-2)}
.cc-sq svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* tags */
.cc-tag{font-size:10px;font-weight:700;padding:1px 6px;border-radius:5px;background:var(--surface2);color:var(--muted);white-space:nowrap;letter-spacing:.02em}
.cc-tag.bad,.cc-tag.danger{background:var(--danger-bg);color:var(--danger)}.cc-tag.warn{background:var(--warn-bg);color:var(--warn)}.cc-tag.ok{background:var(--ok-bg);color:var(--ok)}.cc-tag.info{background:var(--info-bg);color:var(--info)}.cc-tag.accent{background:var(--accent-soft);color:var(--accent-text)}.cc-tag.v2{background:var(--accent-2-soft);color:var(--accent-2)}
.cc-tag.up{text-transform:uppercase;letter-spacing:.04em}

/* meters + stacked bars */
.cc-meter{height:6px;border-radius:99px;background:var(--surface-3);overflow:hidden}
.cc-meter i{display:block;height:100%;border-radius:99px;background:var(--accent-2)}
.cc-meter i.ok{background:var(--ok)}.cc-meter i.warn{background:var(--warn)}.cc-meter i.bad,.cc-meter i.danger{background:var(--danger)}.cc-meter i.accent{background:var(--accent)}
.cc-stack{display:flex;height:9px;border-radius:99px;overflow:hidden;background:var(--surface-3);gap:2px}
.cc-stack i{display:block;height:100%;min-width:3px}
.cc-c1{background:var(--accent)}.cc-c2{background:var(--accent-2)}.cc-c3{background:var(--info)}.cc-c4{background:var(--ok)}.cc-c5{background:var(--warn)}.cc-c6{background:var(--rule-2)}
.cc-legend{display:flex;flex-wrap:wrap;gap:5px 13px;margin-top:10px;font-size:11.5px;color:var(--muted)}
.cc-legend span{display:inline-flex;align-items:center;gap:6px}
.cc-legend i{width:8px;height:8px;border-radius:2px;display:inline-block}
.cc-legend b{color:var(--text);font-weight:650;font-variant-numeric:tabular-nums}

/* segmented filter chips */
.cc-seg{display:inline-flex;gap:6px;flex-wrap:wrap}
.cc-seg a,.cc-seg button{font:inherit;font-size:12px;font-weight:650;padding:5px 11px;border-radius:99px;border:1px solid var(--border);background:var(--surface);color:var(--muted);cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.cc-seg a:hover,.cc-seg button:hover{border-color:var(--rule-2);color:var(--text)}
.cc-seg .on,.cc-seg .cur,.cc-seg [aria-pressed=true]{background:var(--accent-soft);border-color:var(--accent-edge);color:var(--accent-text)}
.cc-seg .n{font-size:10.5px;font-weight:700;color:var(--text-faint)}
.cc-seg i.dot{width:7px;height:7px;border-radius:50%;background:var(--muted)}
.cc-seg i.dot.ok{background:var(--ok)}.cc-seg i.dot.warn{background:var(--warn)}.cc-seg i.dot.danger{background:var(--danger)}

/* empty states */
.cc-empty{display:flex;align-items:center;gap:10px;padding:20px 17px;font-size:13px;color:var(--muted)}
.cc-empty .i{width:32px;height:32px;flex:none;border-radius:9px;background:var(--ok-bg);color:var(--ok);display:flex;align-items:center;justify-content:center}
.cc-empty .i.mut{background:var(--surface2);color:var(--muted)}.cc-empty .i.warn{background:var(--warn-bg);color:var(--warn)}.cc-empty .i.accent{background:var(--accent-soft);color:var(--accent-text)}
.cc-empty .i svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2.3;stroke-linecap:round;stroke-linejoin:round}
.cc-empty b{display:block;color:var(--text);font-weight:650;font-size:13px}
.cc-empty.tall{flex-direction:column;text-align:center;padding:36px 20px;gap:12px}
.cc-empty.tall .i{width:44px;height:44px;border-radius:12px}.cc-empty.tall .i svg{width:20px;height:20px}

/* stat tiles (hero right cell) */
.cc-mini{display:grid;grid-template-columns:1fr 1fr;gap:8px 14px;margin-top:14px;padding-top:12px;border-top:1px solid var(--border-soft)}
.cc-mini div{font-size:11.5px;color:var(--muted)}
.cc-mini b{display:block;font-size:15px;font-weight:700;color:var(--text);font-variant-numeric:tabular-nums;letter-spacing:-.01em}

/* section label between blocks */
.cc-sec{font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--text-faint);display:flex;align-items:center;gap:10px;margin:22px 0 10px}
.cc-sec::after{content:"";flex:1;height:1px;background:var(--border-soft)}
.cc-sec .n{font-size:10.5px;padding:1px 7px;border-radius:99px;background:var(--surface2);color:var(--muted)}

/* data tables inside cards */
.cc-table{width:100%;border-collapse:collapse;font-size:13px}
.cc-table th{font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--text-faint);text-align:left;padding:10px 17px;border-bottom:1px solid var(--border-soft);background:color-mix(in srgb,var(--surface2) 55%,transparent)}
.cc-table td{padding:11px 17px;border-top:1px solid var(--border-soft);vertical-align:middle}
.cc-table tr:first-child td{border-top:none}
.cc-table tbody tr:hover td{background:var(--surface2)}
.cc-table .num{text-align:right;font-variant-numeric:tabular-nums}

/* ════════════════════════════════════════════════════
   APP SHELL ON PHONES / TABLETS (PWA) + GUIDED TOUR
   ════════════════════════════════════════════════════ */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{-webkit-tap-highlight-color:transparent;overscroll-behavior-y:none}
a,button,[role=button]{touch-action:manipulation}
/* Safe areas: notch / home indicator. */
.appbar{padding-top:max(10px,env(safe-area-inset-top));padding-left:max(14px,env(safe-area-inset-left));padding-right:max(14px,env(safe-area-inset-right))}
.dock{bottom:max(22px,calc(env(safe-area-inset-bottom) + 10px))}
@media (max-width:640px){
  .dock{bottom:max(10px,env(safe-area-inset-bottom));left:8px;right:8px;border-radius:18px;padding:6px}
  body.has-dock .container{padding-bottom:calc(96px + env(safe-area-inset-bottom))}
  .appbar{position:sticky;top:0;z-index:40;background:var(--bg);border-bottom:1px solid var(--border-soft)}
  .topbar-search{flex:1;min-width:0;justify-content:flex-start}
  .topbar-search kbd,#whatsnew-btn{display:none}
  .container{padding:12px 12px 0}
  /* Any page-level top bar stacks on phones. */
  /* Page-level <style> blocks come later in the cascade, so these carry extra
     specificity (.container …) to win on phones. */
  .container .cc-top,.container .ov3-top,.container .fm-top{flex-direction:column;gap:12px}
  .container .cc-actions,.container .ov3-actions,.container .fm-actions{padding-top:0;justify-content:flex-start;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;width:100%;padding-bottom:4px;scrollbar-width:none;max-width:100%}
  .container .cc-actions::-webkit-scrollbar,.container .ov3-actions::-webkit-scrollbar,.container .fm-actions::-webkit-scrollbar{display:none}
  .container .cc-actions>*,.container .ov3-actions>*,.container .fm-actions>*{flex:none}
  .container .ov3-cust{position:static}
  .cc-btn,.ov3-btn,.fm-btn{min-height:40px}
  .cc-h1,.ov3-h1{font-size:22px}
  .cc-kpis,.ov3-kpis{grid-template-columns:repeat(2,1fr)!important;gap:8px}
  .cc-hero,.ov3-hero{grid-template-columns:1fr!important}
  .ov3-score,.cc-hero-cell{padding:16px 18px}
  .ov3-sites{grid-template-columns:repeat(2,1fr);padding:12px}
  .ov3-pop{position:fixed;left:12px;right:12px;top:auto;bottom:calc(84px + env(safe-area-inset-bottom));width:auto;max-height:60vh;overflow:auto}
  .cc-table{min-width:560px}
  .cc-card:has(> .cc-table),.cc-card > .cc-table-wrap{overflow-x:auto}
  .modal-box{width:100%;max-width:none;border-radius:16px 16px 0 0;position:fixed;left:0;right:0;bottom:0;max-height:88vh}
  .cc-ch{padding:11px 13px}.cc-cb{padding:12px 13px}.cc-row{padding:11px 13px}
  input,select,textarea{font-size:16px!important} /* iOS: no zoom-on-focus */
}
/* Installed (standalone) app: no browser chrome, slightly denser header. */
html.is-pwa .appbar{padding-top:max(12px,env(safe-area-inset-top))}
html.is-pwa body{overscroll-behavior:none}

/* Install nudge */
.pwa-nudge{position:fixed;left:12px;right:12px;bottom:calc(84px + env(safe-area-inset-bottom));z-index:80;display:flex;align-items:center;gap:12px;padding:12px 12px 12px 14px;background:var(--surface);border:1px solid var(--border);border-radius:16px;box-shadow:var(--shadow-pop);animation:pwa-in .25s var(--ease-out)}
@keyframes pwa-in{from{transform:translateY(12px);opacity:0}to{transform:none;opacity:1}}
.pwa-nudge img{width:40px;height:40px;border-radius:11px;flex:none}
.pwa-nudge .t{flex:1;min-width:0}.pwa-nudge .t b{display:block;font-size:13.5px}.pwa-nudge .t span{font-size:12px;color:var(--muted)}
.pwa-nudge .ok{font:inherit;font-size:12.5px;font-weight:650;padding:8px 13px;border-radius:9px;border:0;background:var(--accent);color:#fff;cursor:pointer}
.pwa-nudge .x{font:inherit;font-size:18px;line-height:1;width:32px;height:32px;border-radius:8px;border:0;background:transparent;color:var(--muted);cursor:pointer}

/* Guided tour */
.tour-ov{position:fixed;inset:0;z-index:120;opacity:0;transition:opacity .2s}
.tour-ov.in{opacity:1}.tour-ov.out{opacity:0}
.tour-spot{position:fixed;border-radius:14px;box-shadow:0 0 0 9999px rgba(12,10,9,.62),0 0 0 3px var(--accent);transition:top .25s var(--ease),left .25s var(--ease),width .25s var(--ease),height .25s var(--ease);pointer-events:none}
html[data-theme="dark"] .tour-spot{box-shadow:0 0 0 9999px rgba(0,0,0,.72),0 0 0 3px var(--accent)}
.tour-card{position:fixed;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:16px;box-shadow:var(--shadow-pop);padding:16px 18px 14px;transition:top .25s var(--ease),left .25s var(--ease)}
.tour-card::before{content:"";position:absolute;left:var(--ax,50%);top:-7px;width:12px;height:12px;background:var(--surface);border-left:1px solid var(--border);border-top:1px solid var(--border);transform:translateX(-50%) rotate(45deg)}
.tour-card.above::before{top:auto;bottom:-7px;border:0;border-right:1px solid var(--border);border-bottom:1px solid var(--border)}
.tour-card.sheet::before{display:none}
.tour-k{font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--accent-text)}
.tour-t{font-size:16px;font-weight:750;letter-spacing:-.01em;margin-top:4px}
.tour-b{font-size:13px;color:var(--muted);line-height:1.5;margin-top:6px}
.tour-f{display:flex;align-items:center;gap:10px;margin-top:14px}
.tour-f button{font:inherit;font-size:12.5px;font-weight:650;padding:7px 12px;border-radius:9px;border:1px solid var(--border);background:var(--surface);color:var(--text-2);cursor:pointer;min-height:36px}
.tour-f button:hover{border-color:var(--rule-2);color:var(--text)}
.tour-f .tour-skip{border-color:transparent;color:var(--muted);padding-left:4px}
.tour-f .tour-next{background:var(--accent);color:#fff;border-color:transparent}.tour-f .tour-next:hover{background:var(--accent-h);color:#fff}
.tour-f button:disabled{opacity:.4;cursor:default}
.tour-nav{margin-left:auto;display:inline-flex;gap:6px}
.tour-dots{display:inline-flex;gap:4px}
.tour-dots i{width:6px;height:6px;border-radius:50%;background:var(--surface-3);display:inline-block}
.tour-dots i.done{background:var(--accent-edge)}.tour-dots i.on{background:var(--accent);width:16px;border-radius:3px}
@media (max-width:719px){.tour-dots{display:none}}
