/* OPS Waypoint dashboard
   Layout: sidebar + page on wide screens (1024px+); top bar + slide-in menu below that.
   Tables become cards under 680px. Colors are tokens on :root (light) with dark overrides. */

/* ============ Tokens ============ */

:root {
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;

  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --sunken: #f0f2f5;
  --side-bg: #f7f8fa;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --faint: #69778d;

  --accent: #2f5bd8;
  --accent-hover: #2449b8;
  --accent-soft: #eef3ff;
  --accent-ring: rgba(47, 91, 216, .22);
  --on-accent: #ffffff;

  --ok: #12804a;
  --ok-soft: #e7f6ee;
  --warn: #b25e09;
  --warn-soft: #fdf3e5;
  --bad: #c8322b;
  --bad-soft: #fdeeed;
  --idle: #98a2b3;

  --term-bg: #111827;
  --term-head: #1a2232;
  --term-text: #e5e7eb;
  --term-muted: #8b95a7;
  --term-err: #fca5a5;

  --radius-lg: 12px;
  --radius: 9px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: none;
  --shadow-lg: 0 20px 44px -12px rgba(16, 24, 40, .22), 0 4px 10px -4px rgba(16, 24, 40, .08);

  --side-w: 224px;
  --gutter: 32px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0c1018;
  --surface: #141a24;
  --surface-2: #18202c;
  --sunken: #0f141d;
  --side-bg: #10151e;
  --border: #232c3b;
  --border-strong: #334055;
  --text: #edf1f7;
  --text-2: #c3cad6;
  --muted: #8b95a7;
  --faint: #8290a8;

  --accent: #7c9cf5;
  --accent-hover: #98b2f8;
  --accent-soft: rgba(124, 156, 245, .14);
  --accent-ring: rgba(124, 156, 245, .35);
  --on-accent: #0c1018;

  --ok: #4cc276;
  --ok-soft: rgba(76, 194, 118, .13);
  --warn: #e3a641;
  --warn-soft: rgba(227, 166, 65, .13);
  --bad: #f0706b;
  --bad-soft: rgba(240, 112, 107, .13);
  --idle: #5e5e67;

  --term-bg: #0a0e15;
  --term-head: #141416;

  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: 0 20px 50px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .04);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1018;
    --surface: #141a24;
    --surface-2: #18202c;
    --sunken: #0f141d;
    --side-bg: #10151e;
    --border: #232c3b;
    --border-strong: #334055;
    --text: #edf1f7;
    --text-2: #c3cad6;
    --muted: #8b95a7;
    --faint: #8290a8;

    --accent: #7c9cf5;
    --accent-hover: #98b2f8;
    --accent-soft: rgba(124, 156, 245, .14);
    --accent-ring: rgba(124, 156, 245, .35);
    --on-accent: #0c1018;

    --ok: #4cc276;
    --ok-soft: rgba(76, 194, 118, .13);
    --warn: #e3a641;
    --warn-soft: rgba(227, 166, 65, .13);
    --bad: #f0706b;
    --bad-soft: rgba(240, 112, 107, .13);
    --idle: #5e5e67;

    --term-bg: #0a0e15;
    --term-head: #141416;

    --shadow-sm: none;
    --shadow: none;
    --shadow-lg: 0 20px 50px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .04);
    color-scheme: dark;
  }
}

/* ============ Base ============ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* Off-canvas panels (menu, machine details) sit outside the screen; never let them widen the page. */
html, body { overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
[hidden] { display: none !important; }
code { font-family: var(--mono); font-size: .92em; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd {
  font: 11px/1 var(--mono); padding: 2px 5px;
  border: 1px solid var(--border-strong); border-radius: 4px;
  color: var(--muted); background: var(--surface);
}

body[data-view="loading"] .signin,
body[data-view="loading"] .app,
body[data-view="signin"] .app,
body[data-view="app"] .signin { display: none; }

/* ============ Brand ============ */

.mark { width: 32px; height: 32px; flex: none; color: var(--text); }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-name { font: 650 15px/1 var(--font-display); letter-spacing: -.005em; white-space: nowrap; }
.brand-lg .mark { width: 48px; height: 48px; }
.brand-lg .brand-name { font-size: 18px; }

/* ============ Buttons & inputs ============ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; white-space: nowrap; text-align: center;
  transition: background-color .12s, border-color .12s, color .12s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgba(16, 24, 40, .12), inset 0 -1px 0 rgba(0, 0, 0, .08); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); border-color: var(--faint); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--sunken); color: var(--text); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--bad) 86%, #000); }
.btn-danger-ghost { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--bad-soft); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; min-height: 40px; font-size: 14px; }
.btn .caret { width: 14px; height: 14px; margin-right: -3px; transition: transform .15s; }
.btn[aria-expanded="true"] .caret { transform: rotate(180deg); }

/* Prominent call-to-action for the main "Build / Create" actions: soft gradient, rounded, lifts on hover. */
.btn-build {
  min-height: 48px; padding: 0 24px;
  font-size: 14.5px; letter-spacing: .1px;
  border-radius: var(--radius-lg);
  color: var(--on-accent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff) 0%, var(--accent) 55%, var(--accent-hover) 100%);
  box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--accent) 60%, transparent), inset 0 1px 0 rgba(255, 255, 255, .22);
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}
.btn-build:hover:not(:disabled) {
  transform: translateY(-1px); filter: brightness(1.04);
  box-shadow: 0 12px 26px -6px color-mix(in srgb, var(--accent) 65%, transparent), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.btn-build:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 4px 12px -6px color-mix(in srgb, var(--accent) 60%, transparent), inset 0 1px 2px rgba(0, 0, 0, .14);
}
.btn-build .icon { width: 17px; height: 17px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted);
  transition: background-color .12s, color .12s;
}
.icon-btn:hover { background: var(--sunken); color: var(--text); }

.input {
  width: 100%; height: 38px; padding: 0 11px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input-sm { width: 72px; height: 30px; padding: 0 8px; text-align: right; }
select.input { padding-right: 8px; }
/* Native Windows menus may otherwise mix light popup backgrounds with dark inherited text. */
select.input option, select.input optgroup { background-color: var(--surface); color: var(--text); }
.mono-input { font-family: var(--mono); font-size: 12.5px; }
.textarea { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.5; }

.link { color: var(--accent); font-weight: 600; }
.link:hover { text-decoration: underline; }

.field-label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field em { font-style: normal; font-weight: 400; }
.field em.req { color: var(--accent); font-weight: 600; }
.field-help { margin-top: 8px; line-height: 1.5; }
.form-error { min-height: 0; margin: 6px 0 0; color: var(--bad); font-size: 13px; }
.form-error:empty { display: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.span-2 { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); }

/* Segmented control (filters) */
.segmented {
  display: inline-flex; gap: 2px; padding: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius);
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button, .segmented label span {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px;
  border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.segmented label { display: inline-flex; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented button:hover, .segmented label:hover span { color: var(--text); }
.segmented button[aria-pressed="true"], .segmented input:checked + span {
  background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border), var(--shadow-sm);
}
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.segmented .count {
  min-width: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--border); color: var(--text-2);
  font-size: 11px; line-height: 17px; text-align: center;
}
.segmented button[aria-pressed="true"] .count { background: var(--accent-soft); color: var(--accent); }

/* Switch */
.switch {
  appearance: none; position: relative; flex: none; width: 36px; height: 20px; margin: 0; border-radius: 10px;
  background: var(--border-strong); cursor: pointer; transition: background-color .15s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.switch:disabled { opacity: .5; cursor: not-allowed; }

/* ============ Sign in ============ */

.signin {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg);
}
.signin-card {
  width: 100%; max-width: 400px; padding: 36px 32px 32px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
}
.signin-card .brand { margin-bottom: 28px; }
.signin-card h1 { font: 650 20px/1.25 var(--font-display); margin-bottom: 4px; }
.signin-card > p.muted { margin-bottom: 22px; }
.signin-card .form-error { margin: 8px 0 0; }
.signin-card .btn-block { margin-top: 16px; }

/* ============ App shell ============ */

.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.mobilebar, .nav-backdrop, .nav-close { display: none; }

.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  padding: 18px 14px 14px;
  background: var(--side-bg); border-right: 1px solid var(--border);
  overflow-y: auto; scrollbar-width: thin;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 22px; }
.sidebar-brand .brand-name { font-size: 15.5px; }
.nav { display: grid; gap: 2px; }
.nav-section {
  margin: 20px 10px 6px; color: var(--faint);
  font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase;
}
.nav-section:first-child { margin-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 36px; padding: 0 10px; border-radius: var(--radius);
  border: 1px solid transparent;
  color: var(--text-2); font-weight: 550; font-size: 13.5px;
  transition: background-color .12s, color .12s;
}
.nav-item .icon { width: 17px; height: 17px; color: var(--faint); transition: color .12s; }
.nav-item:hover { background: var(--sunken); color: var(--text); }
.nav-item:hover .icon { color: var(--muted); }
/* Current page: a white tile with a hairline border, like a selected tab. */
.nav-item.active { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-sm); color: var(--text); font-weight: 650; }
.nav-item.active .icon { color: var(--accent); }
.nav-count {
  margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px;
  color: var(--muted); font-size: 11.5px; font-weight: 600; line-height: 20px; text-align: center;
}
.nav-count:empty { display: none; }
.nav-dot { width: 7px; height: 7px; margin-left: auto; border-radius: 50%; background: var(--warn); }

.sidebar-foot { margin-top: auto; padding-top: 16px; display: grid; gap: 8px; }
.conn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface);
}
.conn[data-state="live"] .conn-dot { box-shadow: 0 0 0 3px var(--ok-soft); }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); flex: none; }
.conn[data-state="live"] .conn-dot { background: var(--ok); }
.conn[data-state="down"] .conn-dot { background: var(--bad); }
.conn-text { display: grid; line-height: 1.3; min-width: 0; }
.conn-text b { font-size: 12.5px; font-weight: 600; }
.conn-text small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-actions { display: flex; justify-content: space-between; }

.main { min-width: 0; display: flex; flex-direction: column; }

.pagebar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 28px var(--gutter) 20px;
}
.pagebar-title { min-width: 0; }
.pagebar h1 { font: 700 28px/1.2 var(--font-display); letter-spacing: -.035em; }
.pagebar p { margin-top: 5px; font-size: 13.5px; max-width: 760px; color: var(--muted); }
.pagebar-actions { display: flex; gap: 8px; align-items: center; }
.page-actions { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.page-actions:empty { display: none; }

.banner {
  display: flex; align-items: center; gap: 10px;
  margin: 0 var(--gutter) 8px; padding: 10px 14px;
  background: var(--bad-soft); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent);
  border-radius: var(--radius); color: var(--bad); font-size: 13px; font-weight: 600;
}

.page { display: grid; gap: 20px; padding: 4px var(--gutter) 40px; max-width: 1600px; width: 100%; min-width: 0; }

/* ============ Cards ============ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px 0;
}
.card-head h2 { font: 650 15px/1.3 var(--font-display); letter-spacing: -.015em; }
.card-head-pad { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.card-body { padding: 16px 20px 20px; }
.card-flush { overflow: hidden; }

.notice {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 28%, transparent);
  border-radius: var(--radius);
}
.notice .icon { width: 18px; height: 18px; margin-top: 2px; color: var(--warn); }
.notice b { display: block; margin-bottom: 2px; }
.notice span { color: var(--text-2); font-size: 13px; }

/* ============ Pills, tags, status ============ */

.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.pill-ok::before, .pill-bad::before, .pill-warn::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-warn, .pill-pending { background: var(--warn-soft); color: var(--warn); }
.pill-muted { background: var(--sunken); color: var(--muted); }

.status {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 8px;
  border-radius: 11px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-online { background: var(--ok-soft); color: var(--ok); }
.status-reconnecting { background: var(--warn-soft); color: var(--warn); }
.status-offline { background: var(--bad-soft); color: var(--bad); }

.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }

.kind-tag { display: inline-block; padding: 0 6px; border-radius: 4px; border: 1px solid var(--border-strong); font: 650 11px/1.7 var(--mono); }
.kind-msi { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.kind-exe { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.kind-mixed { color: var(--muted); }
.shell-tag { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--sunken); color: var(--text-2); font: 600 11px/1.7 var(--mono); }
.version-list { display: flex; flex-wrap: wrap; gap: 4px; max-width: 260px; }
.version-chip { padding: 0 6px; border-radius: 4px; background: var(--sunken); color: var(--text-2); font: 12px/1.7 var(--mono); }

.txt-ok { color: var(--ok); }
.txt-warn { color: var(--warn); }
.txt-bad { color: var(--bad); }
.txt-muted { color: var(--muted); }

.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius); flex: none;
  background: var(--sunken); color: var(--text-2); border: 1px solid var(--border);
}
.avatar .icon { width: 16px; height: 16px; }
.avatar.off { color: var(--faint); }
.avatar-app { color: var(--accent); }

/* ============ Logos, app icons, colour tiles ============ */

/* Brand logos keep their own colours (no stroke). */
.logo { width: 20px; height: 20px; flex: none; }
.title-with-logo { display: inline-flex; align-items: center; gap: 9px; }
.title-with-logo .logo { width: 22px; height: 22px; }

/* Computers: the Windows logo on a tile, blue when online. */
.os-avatar .icon { fill: currentColor; stroke: none; width: 17px; height: 17px; }
.os-avatar.on { background: #e8f2fd; border-color: #cfe3fb; color: #0078d4; }
.os-avatar.off { background: var(--sunken); color: var(--faint); }
.detail-avatar.os-avatar .icon { width: 21px; height: 21px; }

/* Applications: the real icon from the installer, or coloured initials. */
.app-avatar { background: var(--surface); padding: 5px; }
.app-avatar img { width: 100%; height: 100%; object-fit: contain; }
.letter-avatar {
  background: hsl(var(--hue) 70% 94%); border-color: hsl(var(--hue) 55% 85%); color: hsl(var(--hue) 55% 32%);
  font: 700 12px/1 var(--font-display); letter-spacing: .02em;
}
.avatar-sm.letter-avatar, .avatar-sm.app-avatar { border: 1px solid; }
.avatar-uninstall { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--bad); }

/* Companies: initials on the company's own colour. */
.cbadge {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 9px;
  background: linear-gradient(135deg, hsl(var(--hue) 72% 56%), hsl(calc(var(--hue) + 25) 70% 44%));
  color: #fff; font: 700 12px/1 var(--font-display); letter-spacing: .03em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15), var(--shadow-sm);
}
.cbadge-all { background: var(--sunken); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.cbadge-all .icon { width: 16px; height: 16px; }

:root[data-theme="dark"] .os-avatar.on { background: rgba(0, 120, 212, .16); border-color: rgba(0, 120, 212, .35); color: #4ea8f5; }
:root[data-theme="dark"] .letter-avatar { background: hsl(var(--hue) 40% 18%); border-color: hsl(var(--hue) 35% 28%); color: hsl(var(--hue) 70% 78%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .os-avatar.on { background: rgba(0, 120, 212, .16); border-color: rgba(0, 120, 212, .35); color: #4ea8f5; }
  :root:not([data-theme="light"]) .letter-avatar { background: hsl(var(--hue) 40% 18%); border-color: hsl(var(--hue) 35% 28%); color: hsl(var(--hue) 70% 78%); }
}

/* Live indicator: a gently pulsing dot. */
.conn[data-state="live"] .conn-dot { animation: live-pulse 2s ease-out infinite; }
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ============ Overview ============ */

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat {
  display: flex; align-items: flex-start; gap: 14px; width: 100%;
  padding: 18px 18px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  text-align: left; transition: border-color .12s, box-shadow .12s, transform .12s;
}
.stat:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(16, 24, 40, .18); }
/* Tinted icon tile, one color per figure. */
.stat-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; flex: none; background: var(--accent-soft); color: var(--accent); }
.stat-icon .icon { width: 20px; height: 20px; }
.tone-green { background: var(--ok-soft); color: var(--ok); }
.tone-red { background: var(--bad-soft); color: var(--bad); }
.tone-amber { background: var(--warn-soft); color: var(--warn); }
.stat-body { display: grid; gap: 2px; min-width: 0; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-value { font: 700 36px/1.2 var(--font-display); letter-spacing: -.04em; }
.stat-note { color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Overview quick actions */
.quick-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.quick { display: flex; align-items: center; gap: 12px; padding: 13px 15px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text); text-decoration: none; transition: border-color .12s, background .12s, transform .12s; }
.quick:hover { border-color: var(--border-strong); background: var(--surface-2); transform: translateY(-1px); }
.quick-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); flex: none; }
.quick-ic .icon { width: 19px; height: 19px; }
.quick-t { display: grid; line-height: 1.25; min-width: 0; }
.quick-t b { font-size: 13.5px; font-weight: 600; }
.quick-t small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Overview: fleet by company */
.ov-companies { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px 14px; padding: 12px 14px 14px; }
.ov-company { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; transition: background .12s; }
.ov-company:hover { background: var(--surface-2); }
.ov-company .cbadge { flex: none; }
.ov-company-main { flex: 1; min-width: 0; display: grid; gap: 5px; }
.ov-company-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ov-company-top b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-count { font-size: 13px; font-weight: 650; color: var(--text); flex: none; font-variant-numeric: tabular-nums; }
.ov-company-foot { font-size: 11px; letter-spacing: .01em; }
.ov-bar { height: 6px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.ov-bar-fill { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .3s ease; }
.ov-bar-fill.full { background: var(--ok); }
.ov-bar-fill.none { background: var(--bad); }
.ov-bar-fill.part { background: var(--warn); }
.ov-empty { padding: 16px; color: var(--muted); font-size: 13px; }

.overview-grid { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; }

.attention, .feed { list-style: none; margin: 8px 0 0; padding: 0 8px 8px; }
.attention li + li, .feed li + li { border-top: 1px solid var(--border); }
.attention button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px; border: 0; border-radius: var(--radius-sm); background: transparent; text-align: left;
}
.attention button:hover, .feed button:hover { background: var(--surface-2); }
.attention .who { min-width: 0; flex: 1; }
.attention .who b { display: block; font-weight: 600; }
.attention .who span { color: var(--muted); font-size: 12px; }
.reasons { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
.all-good { display: flex; align-items: center; gap: 12px; padding: 26px 18px; color: var(--muted); }
.all-good .icon { width: 24px; height: 24px; color: var(--ok); }
.all-good b { display: block; color: var(--text); }

.feed button {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  width: 100%; padding: 10px; border: 0; border-radius: var(--radius-sm); background: transparent; text-align: left;
}
.feed-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-sm); }
.feed-icon .icon { width: 15px; height: 15px; }
.feed-main { min-width: 0; }
.feed-main b { font-weight: 600; }
.feed-main code { display: block; margin-top: 1px; color: var(--muted); font: 12px/1.4 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-time { color: var(--faint); font-size: 12px; white-space: nowrap; }
.list-empty { padding: 24px 16px; color: var(--muted); text-align: center; font-size: 13px; }

/* ============ Toolbars, search, tables ============ */

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.search {
  display: flex; align-items: center; gap: 8px;
  width: 280px; max-width: 100%; height: 34px; padding: 0 9px 0 10px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--muted); transition: border-color .12s, box-shadow .12s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13px; }
.search input::-webkit-search-cancel-button { display: none; }
.search:focus-within kbd { display: none; }
.search-block { width: 100%; margin-bottom: 12px; }
.search-sm { width: auto; flex: 1; height: 32px; }

/* position: relative keeps hidden (.sr-only) headings inside the scroll area instead of widening the page. */
.table-wrap { position: relative; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  color: var(--muted); font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  text-align: left; white-space: nowrap;
}
.table th button {
  display: inline-flex; align-items: center; gap: 3px; padding: 0; border: 0; background: none;
  color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit;
}
.table th button .icon { width: 12px; height: 12px; opacity: .35; }
.table th button:hover, .table th button[data-dir] { color: var(--text); }
.table th button[data-dir] .icon { opacity: 1; color: var(--accent); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .sub { color: var(--muted); font-size: 12px; }
.fleet-table tbody tr, .activity-table tbody tr, .links-table tbody tr, .software-table tbody tr,
.deployments-table tbody tr, .programs-table tbody tr { cursor: pointer; }
.fleet-table tbody tr:hover, .activity-table tbody tr:hover, .links-table tbody tr:hover, .software-table tbody tr:hover,
.deployments-table tbody tr:hover, .programs-table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.selected { background: var(--accent-soft); }
.table tbody tr.selected td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.links-table tbody tr.is-inactive .machine-name { color: var(--muted); }
.col-act { width: 52px; text-align: right; }
.col-act-wide { width: 150px; text-align: right; white-space: nowrap; }
.col-act-wide .btn + .icon-btn { margin-left: 4px; }
.table-empty td { padding: 40px 16px; text-align: center; color: var(--muted); white-space: normal; cursor: default; }

.machine-cell { display: flex; align-items: center; gap: 11px; }
.machine-name { font-weight: 600; }
.machine-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }

.mini { display: inline-flex; align-items: center; gap: 8px; min-width: 104px; }
.mini-track { position: relative; width: 56px; height: 5px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.mini-fill { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--ok); }
.mini-val { min-width: 34px; font-size: 12.5px; color: var(--text-2); }
.mini-fill.lvl-warn, .meter-fill.lvl-warn { background: var(--warn); }
.mini-fill.lvl-bad, .meter-fill.lvl-bad { background: var(--bad); }

.activity-table .script-cell { max-width: 440px; overflow: hidden; text-overflow: ellipsis; font: 12px/1.4 var(--mono); color: var(--text-2); }
.args-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; font: 12px/1.4 var(--mono); color: var(--text-2); }
.args-missing { color: var(--warn); font: 600 12px/1.4 var(--font); }
.targets-table .msg { max-width: 420px; white-space: normal; color: var(--text-2); font-size: 13px; }

.dprogress { display: grid; gap: 5px; min-width: 160px; }
.dprogress-track { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--sunken); }
.dprogress-track span { height: 100%; }
.seg-ok { background: var(--ok); }
.seg-bad { background: var(--bad); }
.seg-run { background: var(--accent); }
.seg-wait { background: var(--border-strong); }
.dprogress small { color: var(--muted); font-size: 12px; }

.skeleton-row { height: 52px; background: linear-gradient(90deg, transparent, var(--surface-2), transparent) var(--surface); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.skeleton-row + .skeleton-row { border-top: 1px solid var(--border); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.empty { padding: 56px 28px; text-align: center; }
.empty-state { padding: 48px 24px; text-align: center; }
.empty-state p { max-width: 420px; margin: 4px auto 16px; color: var(--muted); }
.empty-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: 12px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
.empty-icon .icon { width: 22px; height: 22px; }
.empty-title { font-weight: 650; margin-bottom: 4px; }

/* Page-level tabs (Software: Library / Installed on machines) */
.page-tabs { display: flex; gap: 2px; max-width: 100%; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.page-tabs a {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap;
}
.page-tabs a .icon { width: 16px; height: 16px; }
.page-tabs a:hover { color: var(--text); }
.page-tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.tab-count {
  min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--sunken); color: var(--text-2);
  font-size: 11px; font-weight: 650; line-height: 17px; text-align: center;
}
.tab-count:empty { display: none; }
[aria-selected="true"] > .tab-count, [aria-current="page"] > .tab-count { background: var(--accent-soft); color: var(--accent); }

/* ============ Machines: detail panel ============ */

.machines-layout { display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 16px; align-items: start; }
.detail { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.drawer-backdrop, .drawer-close { display: none; }

.detail-body { padding: 18px 18px 22px; }
.detail-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.detail-avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius); flex: none; background: var(--sunken); border: 1px solid var(--border); color: var(--text-2); }
.detail-avatar .icon { width: 20px; height: 20px; }
.detail-avatar.off { color: var(--faint); }
.detail-title { flex: 1; min-width: 0; }
.detail-name-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.detail-title h2 { font: 650 17px/1.25 var(--font-display); overflow-wrap: anywhere; }
.detail-title p { margin-top: 3px; font-size: 12.5px; }
.detail-actions { display: flex; gap: 6px; }

.detail-tabs {
  position: sticky; top: 0; z-index: 2; display: flex; gap: 2px; margin: 0 -18px 16px; padding: 0 12px;
  background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none;
}
.detail-tabs button {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 10px; flex: none;
  border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent;
  color: var(--muted); font-weight: 600; font-size: 13px;
}
.detail-tabs button .icon { width: 15px; height: 15px; }
.detail-tabs button:hover { color: var(--text); }
.detail-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.dtab > .section-head:first-child { margin-top: 0; }

.facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 0;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.facts div { padding: 9px 11px; background: var(--surface); min-width: 0; }
.facts dt { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.facts dd { margin: 2px 0 0; font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facts .wide { grid-column: 1 / -1; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 22px 0 10px; }
.section-head h3 { font: 650 13px/1.3 var(--font-display); }

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chart { padding: 11px 12px 8px; border: 1px solid var(--border); border-radius: var(--radius); }
.chart-top { display: flex; align-items: baseline; justify-content: space-between; }
.chart-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.chart-value { font: 650 19px/1.2 var(--font-display); }
.chart-range { color: var(--faint); font-size: 11px; }
.chart svg { display: block; width: 100%; height: 44px; margin-top: 6px; overflow: visible; }
.chart .line { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.chart-empty { height: 44px; margin-top: 6px; display: grid; place-items: center; color: var(--faint); font-size: 11.5px; }

.meters { display: grid; gap: 12px; }
.meter { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.meter-name { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.meter-track { position: relative; height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--ok); transition: width .4s ease; }
.meter-val { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.meter-val b { color: var(--text); font-weight: 600; }

/* Script runner */
.run { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.run-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.run-controls-right { display: flex; align-items: center; gap: 6px; }
.timeout { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.editor {
  display: block; width: 100%; min-height: 136px; padding: 12px 14px;
  border: 0; background: var(--surface); color: var(--text);
  font: 12.5px/1.65 var(--mono); resize: vertical; tab-size: 4;
}
.editor:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent-ring); }
.run-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 8px 14px; border-top: 1px solid var(--border); background: var(--surface-2); }
.hint { color: var(--muted); font-size: 12px; }
.hint .sep { margin: 0 5px; color: var(--faint); }
.hint.warn { color: var(--warn); font-weight: 600; }

.output:empty { display: none; }
.output { margin-top: 12px; border-radius: var(--radius); overflow: hidden; background: var(--term-bg); }
.output-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px;
  background: var(--term-head); color: var(--term-muted); font-size: 12px;
}
.output-head .sep { color: #4a4a52; }
.output-head .where { margin-left: auto; white-space: nowrap; }
.output pre {
  margin: 0; padding: 12px 14px; max-height: 340px; overflow: auto;
  color: var(--term-text); font: 12.5px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word;
}
.output pre.stderr { color: var(--term-err); }
.output pre.dim { color: var(--term-muted); font-style: italic; }
.stream-label { display: block; padding: 9px 14px 0; color: var(--term-muted); font: 600 10.5px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; }
.spinner { width: 13px; height: 13px; border: 2px solid rgba(255, 255, 255, .15); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.history { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.history li + li { border-top: 1px solid var(--border); }
.history button {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  width: 100%; padding: 9px 12px; border: 0; background: var(--surface); text-align: left;
}
.history button:hover { background: var(--surface-2); }
.history button.active { background: var(--accent-soft); }
.history-time { color: var(--muted); font-size: 12px; min-width: 60px; }
.history-script { font: 12px/1.4 var(--mono); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-empty { padding: 16px 12px; color: var(--muted); font-size: 13px; text-align: center; }

/* Programs on a machine / fleet */
.dp-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dp-toolbar .search-block { margin: 0; flex: 1 1 200px; width: auto; }
.dp-sub { margin: 10px 0 8px; }
.program-list { max-height: 58vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.program-list.program-list-inline { max-height: none; overflow: visible; }
.program-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 12px; }
.program-row + .program-row { border-top: 1px solid var(--border); }
.program-row:hover { background: var(--surface-2); }
.program-row b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.program-row small { color: var(--muted); font-size: 12px; }
.program-row .meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.program-row.with-icon { grid-template-columns: auto minmax(0, 1fr) auto; }
.program-row .avatar-sm { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-sm); background: var(--sunken); color: var(--text-2); font: 700 12.5px var(--font-display); flex: none; align-self: start; margin-top: 2px; }
.dp-main { min-width: 0; }
.dp-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-meta { display: flex; align-items: center; gap: 6px; margin-top: 5px; min-width: 0; }
.dp-meta .version-chip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }

/* ============ Setup: install links, install agent, packages ============ */

.deploy-grid { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.form { display: grid; gap: 6px; }
.form .field-label { margin: 8px 0 0; }
.form .field-label:first-child { margin-top: 0; }
.form > .btn { margin-top: 12px; justify-self: start; }
.form p.muted { margin-top: 8px; line-height: 1.5; }

/* Expiry choices: option cards with an example each, plus custom length / date rows */
.expiry { display: grid; gap: 10px; }
.expiry-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.expiry-option {
  display: grid; gap: 1px; align-content: start; min-width: 0; padding: 8px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); text-align: left;
}
.expiry-option b { font-size: 13px; font-weight: 600; }
.expiry-option small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.expiry-option:hover { border-color: var(--faint); }
.expiry-option[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.expiry-option[aria-checked="true"] b { color: var(--accent); }
.expiry-extra { display: flex; align-items: center; gap: 8px; }
.expiry-amount { width: 90px; }
.expiry-unit { width: 120px; }
.expiry-date { width: 180px; }
.card-head-title { display: flex; align-items: baseline; gap: 10px; }
.expiry-preview {
  display: flex; align-items: flex-start; gap: 8px; padding: 9px 11px;
  border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); font-size: 12.5px; line-height: 1.45;
}
.expiry-preview .icon { width: 15px; height: 15px; margin-top: 1px; color: var(--muted); }
.expiry-preview b { color: var(--text); font-weight: 600; }
.expiry-preview.invalid { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: var(--bad); }
.expiry-preview.invalid .icon { color: var(--bad); }

.install-head { padding: 16px 18px 0; }
.install-head-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; padding-bottom: 16px; }
.install-link-pick { display: grid; gap: 6px; min-width: 0; flex: 1 1 300px; max-width: 420px; }
.install-link-pick .field-label { margin: 0; }
.install-head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 220px; min-width: 0; padding-bottom: 8px; }
.method-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 -18px; border-top: 1px solid var(--border); }
.method-tabs a {
  display: flex; align-items: center; gap: 11px; padding: 12px 16px; min-width: 0;
  border-bottom: 2px solid transparent; color: var(--text-2);
}
.method-tabs a + a { border-left: 1px solid var(--border); }
.method-tabs a:hover { background: var(--surface-2); color: var(--text); }
.method-tabs a.active { border-bottom-color: var(--accent); color: var(--text); }
.method-tabs b { display: block; font-weight: 650; }
.method-tabs small { display: block; color: var(--muted); font-size: 12px; }
.method-logo { width: 34px; height: 34px; flex: none; filter: grayscale(.35); opacity: .85; transition: filter .12s, opacity .12s; }
.method-tabs a:hover .method-logo, .method-tabs a.active .method-logo { filter: none; opacity: 1; }
.method-tabs a.active { background: var(--accent-soft); }

.install-panel h2 { font: 650 16px/1.3 var(--font-display); margin-bottom: 4px; }
.install-panel .lead { color: var(--text-2); margin-bottom: 16px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; counter-reset: step; }
.steps > li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; counter-increment: step; }
.steps > li::before {
  content: counter(step); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--border-strong); color: var(--text-2); font-weight: 650; font-size: 12px;
}
.steps > li > div { min-width: 0; }
.steps > li > div > p { margin-bottom: 8px; color: var(--text-2); }
.steps > li > div > b { display: block; margin: 2px 0 6px; }
.install-panel .callout {
  display: flex; gap: 10px; margin-top: 18px; padding: 11px 13px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 13px;
}
.install-panel .callout .icon { color: var(--muted); margin-top: 1px; }
.code-box { position: relative; margin-bottom: 12px; }
.code-box pre {
  margin: 0; padding: 12px 92px 12px 14px;
  background: var(--term-bg); color: var(--term-text); border-radius: var(--radius);
  font: 12.5px/1.65 var(--mono); white-space: pre-wrap; word-break: break-all;
}
.code-box .btn {
  position: absolute; top: 7px; right: 7px;
  background: var(--term-head); color: var(--term-text); border-color: rgba(255, 255, 255, .12);
}
.code-box .btn:hover { background: #2a2b30; color: #fff; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.button-row.tight { margin: 0; }
.inline-warn { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; color: var(--warn); font-size: 13px; font-weight: 600; }
details.source { margin: -2px 0 10px; }
details.source summary { cursor: pointer; color: var(--accent); font-size: 12.5px; font-weight: 600; }

.pkg-list { list-style: none; margin: 6px 0 0; padding: 0 8px 10px; }
.pkg-list li { display: flex; align-items: center; gap: 12px; padding: 10px; }
.pkg-list li + li { border-top: 1px solid var(--border); }
.pkg-list .who { flex: 1; min-width: 0; }
.pkg-list .who b { display: block; font-weight: 600; }
.pkg-list .who span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.pkg-hint { margin: 0 18px 16px; color: var(--muted); font-size: 12.5px; }

/* ============ Software dialogs (upload, install, uninstall) ============ */

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { margin: 0; }
.modal-head p { margin-top: 2px; }
/* Multi-step dialogs (Install / Uninstall): each step is its own soft card with an accent-numbered badge. */
.modal-card .step { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); margin-bottom: 12px; }
.modal-head + .step { margin-top: 2px; }
.step:last-of-type { margin-bottom: 0; }
.step-label { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; font-weight: 650; font-size: 14px; }
.step-label .num {
  display: inline-grid; place-items: center; width: 23px; height: 23px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; flex: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.num-bad { background: var(--bad) !important; color: #fff !important; }
.step-count { margin-left: auto; font-weight: 500; }
.step-note { margin-top: 7px; }
.step-empty { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); font-size: 13px; }

.picker-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.picker-note { flex: 1; }
.picker { max-height: 256px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.pick {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 13px; cursor: pointer; border-top: 1px solid var(--border);
}
.pick:has(input:checked) { background: var(--accent-soft); }
.pick:first-child { border-top: 0; }
.pick:hover { background: var(--surface-2); }
.pick input { width: 16px; height: 16px; accent-color: var(--accent); }
.pick b { display: block; font-weight: 600; }
.pick small { color: var(--muted); font-size: 12px; }
.pick .ver { font: 12px var(--mono); color: var(--text-2); }
.pick-meta { display: flex; align-items: center; gap: 10px; }
.pick-empty { padding: 18px; color: var(--muted); text-align: center; font-size: 13px; }

.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
#un-presets { margin-top: 8px; }
.preset {
  height: 26px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-2); font-size: 12px; font-weight: 600;
}
.preset:hover { border-color: var(--accent); color: var(--accent); }
.preset.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.detected {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 11px 13px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px;
}
.detected .icon { color: var(--ok); width: 18px; height: 18px; }
.detected b { display: block; }
.detected span { color: var(--muted); font-size: 12px; }

.dropzone {
  position: relative; display: grid; justify-items: center; gap: 4px; padding: 34px 20px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2);
  text-align: center; cursor: pointer; transition: border-color .12s, background-color .12s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone:focus-within { outline: 2px solid var(--accent); }
.dropzone-icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 6px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--muted); }
.dropzone-icon .icon { width: 20px; height: 20px; }
.dropzone-sm { padding: 20px 16px; }
.progress { margin-top: 14px; }
.progress-row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.progress-track { height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.progress-fill { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .2s; }
.pkg-pick-row { display: flex; gap: 8px; }
.pkg-pick-row .input { flex: 1; min-width: 0; }
.inline-upload { margin-top: 12px; }

.uninstall-target {
  display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--bad) 28%, transparent); border-radius: var(--radius); background: var(--bad-soft);
}
.uninstall-target .avatar { background: var(--surface); color: var(--bad); }
.uninstall-target b { display: block; font-size: 15px; }
.uninstall-target span { color: var(--text-2); font-size: 12.5px; }

/* ============ Companies ============ */

/* Switcher under the brand: which company the whole dashboard shows. */
.company-switch { display: grid; gap: 4px; margin: 0 4px 14px; }
.company-switch-label { color: var(--faint); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; padding-left: 4px; }
.company-switch-row { display: flex; align-items: center; gap: 8px; }
.company-switch-row #company-badge { display: contents; }
.company-switch select { flex: 1; min-width: 0; height: 36px; font-weight: 600; }
.company-switch.is-scoped select { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

.companies-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.companies-grid .form .button-row { margin: 10px 0 0; }
.companies-grid .form > p.muted { margin: 0 0 6px; }
.companies-table .company-row { cursor: pointer; }
.companies-table .company-row:hover { background: var(--surface-2); }
.companies-table .company-row.is-open { background: var(--surface-2); }
.companies-table .company-row .twisty { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-left: -2px; color: var(--muted); transition: transform .18s ease; }
.companies-table .company-row .twisty .icon { width: 16px; height: 16px; }
.companies-table .company-row:not(.is-open) .twisty { transform: rotate(-90deg); }
.companies-table .company-row.is-open .twisty { color: var(--text); }
.companies-table .tree-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.companies-table .tree-cell .cbadge { flex: none; }
.companies-table .tree-text { min-width: 0; }
.companies-table .tree-text .machine-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.company-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; padding: 14px 14px 16px; border-top: 1px solid var(--border); }
.company-add .form-error { grid-column: 1 / -1; margin: 0; }
.company-help { list-style: none; margin: 0; display: grid; gap: 10px; color: var(--text-2); font-size: 13px; line-height: 1.5; }
.company-help b { color: var(--text); }
.company-tag { margin-left: 8px; height: 19px; font-size: 11px; vertical-align: 1px; }
/* Expanded tree: a company's offices and computers appear as inset rows beneath it. */
.companies-table .child-row > td { padding: 0; background: var(--sunken); border-top: 1px solid var(--border); }
.companies-table .office-tree-row { cursor: pointer; }
.companies-table .computer-tree-row { cursor: pointer; }
.tree-office, .tree-computer { display: flex; align-items: center; gap: 10px; padding: 9px 16px; }
.tree-office { padding-left: 46px; font-weight: 600; }
.companies-table .office-tree-row:hover .tree-office { background: var(--surface-2); }
.tree-office-icon { width: 16px; height: 16px; color: var(--muted); flex: none; }
.tree-office-name { font-size: 13px; }
.tree-tag { font-size: 11px; color: var(--muted); font-weight: 500; }
.tree-spacer { flex: 1; }
.tree-computer { padding-left: 54px; }
.companies-table .computer-tree-row.nested .tree-computer { padding-left: 74px; }
.companies-table .computer-tree-row:hover .tree-computer { background: var(--surface-2); }
.tree-computer .avatar { width: 28px; height: 28px; flex: none; }
.tree-computer .avatar .icon { width: 16px; height: 16px; }
.tree-computer .tree-text { flex: 1; min-width: 0; }
.tree-computer .machine-name { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-computer .sub { font-size: 12px; }
.tree-seen { font-size: 12px; flex: none; }
.tree-go { width: 15px; height: 15px; color: var(--faint); flex: none; }
.companies-table .computer-tree-row:hover .tree-go { color: var(--muted); }
.tree-empty { padding: 13px 16px 13px 54px; color: var(--muted); font-size: 13px; }
/* MSI for workers: the builder across the top, the MSI files below (never squeezed side by side). */
.msi-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
/* Build an MSI: office on its own line, then four fields in a row, each with a hint underneath. */
.msi-form { display: grid; gap: 18px; }
.msi-form > p.muted { line-height: 1.5; max-width: 760px; }
.msi-form .field { gap: 7px; align-content: start; }
.msi-form .field > span { font-size: 13px; font-weight: 600; color: var(--text); }
.msi-form .field em { font-weight: 400; }
.msi-office-field { max-width: 420px; }
.msi-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 20px; }
.msi-fields .input { height: 40px; }
.msi-fields .input::placeholder { color: var(--faint); }
.field-hint { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.msi-form > .form-error { margin: -6px 0 0; }
.msi-form > div:last-child { display: flex; justify-content: flex-end; }
.msi-form > div:last-child .btn { width: auto; min-width: 260px; }
@media (max-width: 1180px) { .msi-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) {
  .msi-fields { grid-template-columns: minmax(0, 1fr); }
  .msi-office-field { max-width: none; }
  .msi-form > div:last-child .btn { width: 100%; }
}
.msi-table td:first-child { white-space: normal; min-width: 200px; }
.msi-table .col-act-wide { width: 1%; }
.row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }

/* Settings pages: one readable column. */
.settings-stack { display: grid; gap: 20px; max-width: 760px; }
.theme-choice { margin-top: 10px; }
.theme-choice button .icon { width: 15px; height: 15px; }

/* Dialog forms. */
.dialog-fields { display: grid; gap: 16px; }
.dialog-fields .field > span, .dialog-fields .field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
#new-link-dialog .modal-card { width: 820px; }
.link-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 680px) { .link-top { grid-template-columns: minmax(0, 1fr); } }

.empty-state.compact { padding: 32px 20px; }
.button-row.center { justify-content: center; margin: 4px 0 0; }
.upload-company { margin-bottom: 14px; }
.nt-manual-form select { flex: 1; min-width: 0; }
@media (max-width: 1180px) { .companies-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .company-add { grid-template-columns: 1fr; } }

/* ============ Notifications ============ */

.notify-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.notify-col { display: grid; gap: 16px; min-width: 0; }
.nt-steps { margin: 0 0 16px; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.nt-steps li { counter-increment: step; position: relative; padding-left: 32px; color: var(--text-2); line-height: 1.5; }
.nt-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; border: 1px solid var(--border-strong); color: var(--text-2); font: 650 12px var(--font-display);
}
.nt-steps li > b { color: var(--text); }
.nt-steps code, .nt-detect code, .nt-manual code, .nt-token-form code { padding: 1px 5px; border-radius: 4px; background: var(--sunken); font: 12px var(--mono); }
.nt-token-form { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.nt-token-form .form-error { margin: 0; }
.nt-manual-form { display: flex; gap: 8px; }
.nt-bot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px; margin-bottom: 6px; border-radius: var(--radius); border: 1px solid var(--border); }
.nt-bot-logo { width: 40px; height: 40px; }
.nt-bot-who { flex: 1; min-width: 0; display: grid; }
.nt-bot-who b { font-weight: 650; font-size: 14px; }
#nt-connected .button-row { margin: 10px 0 0; }

.nt-chats { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.nt-chats:empty { display: none; }
.nt-chat { display: flex; align-items: center; gap: 12px; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.nt-chat-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none; background: var(--sunken); color: var(--text-2); font: 700 12.5px var(--font-display); }
.nt-chat-who { flex: 1; min-width: 0; display: grid; }
.nt-chat-who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-chat-who small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-detect { margin-top: 14px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.nt-detect-head { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; }
.nt-seen { margin-top: 10px; }
.pulse { position: relative; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--ok); }
.nt-manual { margin-top: 14px; }
.nt-manual summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13px; }
.nt-manual-form { margin: 10px 0 6px; }
.nt-manual-form .input:first-child { flex: 1.3; min-width: 0; }
.nt-manual-form .input { flex: 1; min-width: 0; }
.nt-group + .nt-group { margin-top: 16px; }
.nt-group h3 { margin-bottom: 2px; color: var(--faint); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; cursor: pointer; }
.switch-row + .switch-row { border-top: 1px solid var(--border); }
.switch-row > span { min-width: 0; display: grid; }
.switch-row b { font-weight: 600; font-size: 13.5px; }
.switch-row small { color: var(--muted); font-size: 12px; }
.switch-row select.input-sm { width: auto; text-align: left; padding-right: 26px; }
.nt-rules .switch-row:first-of-type { border-top: 0; }
.nt-sub-row { padding-left: 14px; border-left: 2px solid var(--border); margin-left: 2px; }
.nt-sub-row.is-off { opacity: .45; pointer-events: none; }
.nt-commands { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.nt-commands li { display: flex; align-items: baseline; gap: 10px; font-size: 12.5px; color: var(--muted); }
.nt-commands code { min-width: 76px; color: var(--text); font: 600 12px var(--mono); }
.notify-disabled .nt-manual, .notify-disabled .nt-chats { opacity: .6; pointer-events: none; }

/* ============ Menu ============ */

.menu {
  position: fixed; z-index: 60; min-width: 220px; max-width: min(320px, calc(100vw - 16px)); padding: 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.menu-heading { padding: 7px 9px 5px; color: var(--faint); font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-sep { height: 1px; margin: 5px 4px; background: var(--border); }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 9px; border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--text); font-size: 13px; text-align: left;
}
.menu-item .icon { color: var(--muted); }
.menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--sunken); outline: none; }
.menu-item:disabled { opacity: .45; cursor: not-allowed; }
.menu-item.danger, .menu-item.danger .icon { color: var(--bad); }
.menu-item small { margin-left: auto; color: var(--faint); font-size: 11.5px; }

/* ============ Modal ============ */

.modal { padding: 0; border: 0; background: transparent; color: var(--text); max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); }
.modal::backdrop { background: rgba(10, 10, 12, .5); }
.modal-card {
  width: 440px; max-width: 100%; padding: 22px 22px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.modal-card.modal-wide { width: 640px; }
.modal-icon { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 12px; border-radius: var(--radius); background: var(--bad-soft); color: var(--bad); }
.modal-icon .icon { width: 20px; height: 20px; }
.modal-card h2 { font: 650 16px/1.3 var(--font-display); margin-bottom: 6px; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal-head-actions { display: flex; align-items: center; gap: 4px; }

/* ============ Toasts ============ */

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 70; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  background: var(--text); color: var(--bg); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: 13px; animation: toast-in .18s ease-out;
}
.toast .icon { color: var(--ok); }
.toast-bad { background: var(--bad); color: #fff; }
.toast-bad .icon { color: #fff; }
@keyframes toast-in { from { transform: translateY(6px); opacity: 0; } }

/* ============ Grouped workspace ============ */

.sidebar { overflow: hidden; background: var(--side-bg); }
.sidebar-brand, .sidebar .company-switch, .sidebar-foot { flex-shrink: 0; }
.sidebar .nav { min-height: 0; overflow-y: auto; scrollbar-width: thin; gap: 3px; }
.sidebar .brand-name, .mobilebar .brand-name { min-width: 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
.sidebar-brand .brand-name { flex: 1; font-size: 14px; }
.sidebar .mark { width: 32px; height: 32px; }
.sidebar .company-switch { margin: 0 4px 22px; padding: 0; }
.sidebar .company-switch-label { display: flex; align-items: center; justify-content: space-between; min-height: 20px; font-size: 10px; color: var(--muted); }
.sidebar .company-switch select { font-size: 12px; height: 34px; }
.sidebar .company-switch .cbadge { width: 20px; height: 20px; border-radius: 4px; font-size: 9px; box-shadow: none; }
.sidebar .nav-section { margin: 21px 10px 7px; font-size: 10px; color: var(--muted); letter-spacing: .08em; }
.sidebar .nav-section:first-child { margin-top: 0; }
.sidebar .nav-item { height: 38px; font-size: 13px; font-weight: 500; border-radius: 5px; }
.sidebar .nav-item.active { background: var(--accent-soft); border-color: transparent; box-shadow: none; color: var(--accent); font-weight: 600; }
.sidebar .nav-item .icon { color: var(--muted); width: 17px; height: 17px; }
.sidebar .nav-item.active .icon { color: var(--accent); }
.nav-divider { height: 1px; margin: 18px 10px 12px; background: var(--border); }
.sidebar-foot { border-top: 1px solid var(--border); margin-top: auto; padding-top: 12px; }
.sidebar .conn { border: 0; background: transparent; padding: 6px 10px; }
.sidebar .conn-dot { animation: none; }
.sidebar .conn-text b { font-size: 11.5px; }
.sidebar .conn-text small { font-size: 11px; }
.page-context { margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 400; }
.pagebar { padding-top: 27px; padding-bottom: 22px; max-width: 1440px; width: 100%; align-items: center; }
.pagebar h1 { font-size: 25px; font-weight: 650; letter-spacing: -.025em; }
.pagebar-title { flex: 1 1 260px; }
.pagebar-actions { max-width: 100%; }
.pagebar p { line-height: 1.5; font-size: 13px; overflow-wrap: anywhere; }
.page { max-width: 1440px; gap: 22px; }
.workspace-tabs { display: flex; gap: 24px; overflow-x: auto; margin: 0 var(--gutter) 22px; border-bottom: 1px solid var(--border); max-width: calc(1440px - 2 * var(--gutter)); }
.workspace-tabs a { flex: none; padding: 0 0 12px; color: var(--muted); border-bottom: 2px solid transparent; font-size: 13px; font-weight: 500; white-space: nowrap; }
.workspace-tabs a:hover { color: var(--text); }
.workspace-tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 650; }
.card { box-shadow: none; }
.card-head { padding-top: 18px; }
.card-head-pad { padding-bottom: 14px; }
.card-flush > .toolbar:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

/* Overview: a modern card layout — a summary row, quick actions, two work lists, fleet by company. */
.stats { gap: 14px; border: 0; border-radius: 0; overflow: visible; background: transparent; }
.stat { padding: 17px 19px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
.stat:first-child { border-left: 1px solid var(--border); }
.stat:hover { transform: translateY(-2px); box-shadow: 0 16px 32px -20px rgba(16, 24, 40, .55); border-color: var(--border-strong); background: var(--surface); }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; }
.stat-body { gap: 3px; }
.stat-label { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.stat-value { font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 12px; color: var(--muted); }
.overview-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; align-items: stretch; background: transparent; border: 0; border-radius: 0; overflow: visible; }
.overview-grid > .card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.overview-grid > .card + .card { border-left: 1px solid var(--border); }
.overview-grid .card-head { min-height: 52px; padding-top: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.overview-grid .card-head h2 { font-size: 13px; }
.overview-grid .link { font-size: 12px; }
.overview-companies { border: 1px solid var(--border); border-radius: var(--radius-lg); }
.overview-companies .card-head { min-height: 52px; border-bottom: 1px solid var(--border); }
.overview-companies .card-head h2 { font-size: 13px; }
.all-good { margin: 0; padding: 30px 16px; background: transparent; }
.all-good .icon { width: 19px; height: 19px; flex: none; }
.all-good b { margin-bottom: 3px; font-size: 13px; }
.all-good span { font-size: 12px; }
.attention, .feed { margin-top: 0; padding-bottom: 6px; }
.list-empty { text-align: left; padding: 30px 12px; }
.toolbar { gap: 12px; padding: 14px 16px; }
.search { height: 38px; }
.table th { padding-top: 11px; padding-bottom: 11px; letter-spacing: .025em; }
.table td { padding-top: 14px; padding-bottom: 14px; }

/* Settings belong to one divided sheet rather than a collection of floating cards. */
.notify-grid, .settings-stack { gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.settings-stack { max-width: 960px; }
.notify-grid { align-items: stretch; }
.notify-grid .notify-col { gap: 0; align-content: start; }
.notify-grid .card, .settings-stack > .card { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.notify-grid > :nth-child(2) { border-left: 1px solid var(--border); }
.notify-col > .card + .card, .settings-stack > .card + .card { border-top: 1px solid var(--border); }
.notify-grid .card-head, .settings-stack .card-head { padding: 20px 24px 0; }
.notify-grid .card-body, .settings-stack .card-body { padding: 16px 24px 24px; }
#org-name { max-width: 540px; display: block; }
.nt-chat { flex-wrap: wrap; }
.nt-chat-who { flex-basis: 110px; }
.nt-chat .pill { max-width: 100%; height: auto; min-height: 22px; white-space: normal; overflow-wrap: anywhere; }
.nt-manual-form { flex-wrap: wrap; }
.nt-manual-form .input { flex-basis: 130px; }
.switch-row { padding-top: 13px; padding-bottom: 13px; }
.switch-row .switch, .switch-row select { flex-shrink: 0; }
.message-preview { margin-top: 20px; padding: 14px; border-left: 2px solid var(--border-strong); background: var(--surface-2); }
.message-preview-label { color: var(--muted); font-size: 11px; margin-bottom: 8px; }
.message-preview p { line-height: 1.8; font-size: 13px; }
.message-preview small { display: block; margin-top: 8px; color: var(--muted); }

/* Destination and validity are the main installer choices. Branding stays together. */
.msi-destination { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; max-width: 800px; }
.msi-destination .msi-office-field { max-width: none; }
.installer-customization { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 14px 0; }
.installer-customization summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.installer-customization summary > span { margin-left: 8px; font-weight: 400; }
.installer-customization > p { margin: 12px 0 16px; }
.installer-customization-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.msi-layout { gap: 24px; }
.skip-link { position: fixed; left: 16px; top: -100px; z-index: 100; padding: 12px 18px; background: var(--surface); border: 2px solid var(--accent); border-radius: 6px; }
.skip-link:focus { top: 12px; }
:focus-visible { outline-width: 3px; outline-offset: 3px; }

@media (max-width: 1180px) {
  .notify-grid > :nth-child(2) { border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 680px) {
  .workspace-tabs { gap: 20px; margin-bottom: 18px; }
  .workspace-tabs a { font-size: 12px; padding-bottom: 10px; }
  .msi-destination, .installer-customization-fields { grid-template-columns: minmax(0, 1fr); }
  .notify-grid .card-head, .settings-stack .card-head { padding: 18px 16px 0; }
  .notify-grid .card-body, .settings-stack .card-body { padding: 14px 16px 20px; }
}


/* ============ Responsive ============ */

/* Wide: machines table and the detail panel side by side; keep the table compact. */
@media (min-width: 1321px) {
  .machines-layout .col-seen { display: none; }
  .machines-layout .table th, .machines-layout .table td { padding-left: 11px; padding-right: 11px; }
  .machines-layout .mini { min-width: 0; }
  .machines-layout .mini-track { width: 42px; }
  .machines-layout .machine-sub { max-width: 180px; }
}

/* Machine details become a slide-in drawer. */
@media (max-width: 1320px) {
  .machines-layout { grid-template-columns: minmax(0, 1fr); }
  /* Single-column: drop the optional columns (Last seen, Disk) so the table never scrolls sideways. */
  .fleet-table .col-opt { display: none; }
  .detail {
    position: fixed; z-index: 40; top: 0; right: 0; bottom: 0;
    width: min(520px, 100vw); max-height: none; border-radius: 0; border-width: 0 0 0 1px;
    box-shadow: var(--shadow-lg);
    /* Closed: stays inside the screen but invisible (sliding it off-screen would widen the page on phones). */
    transform: translateX(24px); opacity: 0; visibility: hidden; pointer-events: none;
    transition: transform .2s ease, opacity .2s ease, visibility 0s linear .2s;
  }
  body.drawer-open .detail { transform: none; opacity: 1; visibility: visible; pointer-events: auto; transition: transform .2s ease, opacity .2s ease; }
  .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(10, 10, 12, .45); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
  .drawer-close { display: inline-grid; }
  #detail-empty { display: none; }
}

/* Narrow tablets (phones switch to the card layout at 680px): drop the CPU/Memory meters too, so the table keeps
   just Machine, Status and Actions and never scrolls sideways. */
@media (min-width: 681px) and (max-width: 900px) {
  .fleet-table th:nth-child(4), .fleet-table td:nth-child(4),
  .fleet-table th:nth-child(5), .fleet-table td:nth-child(5) { display: none; }
}

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid, .deploy-grid, .notify-grid { grid-template-columns: minmax(0, 1fr); }
  .method-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .method-tabs a:nth-child(3) { border-left: 0; }
  .method-tabs a:nth-child(n + 3) { border-top: 1px solid var(--border); }
}

/* Phones and tablets: top bar + slide-in menu. */
@media (max-width: 1023px) {
  :root { --gutter: 16px; }
  .app { display: block; }
  .mobilebar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 8px 0 6px;
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .mobilebar .brand { flex: 1; min-width: 0; }
  .mobilebar .icon-btn { width: 40px; height: 40px; color: var(--text); }
  .mobilebar-live { width: 9px; height: 9px; margin-right: 10px; border-radius: 50%; background: var(--idle); }
  .mobilebar-live[data-state="live"] { background: var(--ok); }
  .mobilebar-live[data-state="down"] { background: var(--bad); }

  .sidebar {
    position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: min(280px, 86vw); height: auto;
    box-shadow: var(--shadow-lg);
    transform: translateX(-102%); visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
  }
  body.nav-open .sidebar { transform: none; visibility: visible; transition: transform .2s ease; }
  .nav-close { display: inline-grid; margin-left: auto; }
  .nav-item { height: 40px; }
  .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(10, 10, 12, .45); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

  .pagebar { padding: 22px var(--gutter) 18px; }
  .pagebar h1 { font-size: 24px; }
  .page { padding: 4px var(--gutter) 32px; gap: 14px; }
}

/* Phones: tables become cards, dialogs fill the screen. */
@media (max-width: 680px) {
  .pagebar-title { flex-basis: 100%; }
  .page-context { margin-bottom: 5px; }
  .btn:not(.btn-sm), .search { min-height: 44px; }
  .input { font-size: 16px; }
  .segmented { max-width: 100%; flex-wrap: wrap; }
  #filter { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  #filter button { justify-content: center; min-height: 36px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  .switch-row { gap: 10px; }
  .switch-row select.input-sm { max-width: 46%; }
  .all-good { margin: 12px; padding: 18px 12px; }
  .pagebar { align-items: flex-start; }
  .pagebar-actions, .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .stats { gap: 10px; }
  .stat { padding: 13px; gap: 10px; flex-direction: column; }
  .stat-icon { width: 32px; height: 32px; border-radius: 8px; }
  .stat-icon .icon { width: 17px; height: 17px; }
  .stat-value { font-size: 24px; }
  .stat-note { display: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar > .muted { align-self: flex-start; }
  .search { width: 100%; }
  .segmented { align-self: flex-start; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .feed button { grid-template-columns: auto minmax(0, 1fr) auto; }
  .feed-time { display: none; }
  .nt-manual-form { flex-direction: column; }
  .method-tabs small { display: none; }
  .method-tabs a { padding: 11px 12px; }
  .install-link-pick { max-width: none; }
  .button-row .btn, .steps .btn { white-space: normal; max-width: 100%; min-height: 38px; padding-top: 6px; padding-bottom: 6px; }
  .code-box pre { padding: 44px 12px 12px; }
  .detail-body { padding: 14px 14px 20px; }
  .detail-tabs { margin: 0 -14px 14px; padding: 0 6px; }

  /* Table rows as cards: first cell is the title, the rest are "label: value" lines. */
  .table-wrap { overflow-x: visible; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tbody tr { position: relative; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td {
    display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 12px;
    padding: 3px 0; border: 0; white-space: normal; text-align: right; min-width: 0;
  }
  .table td::before { content: attr(data-label); grid-column: 1; grid-row: span 3; align-self: start; color: var(--muted); font: 600 12px/22px var(--font); text-align: left; }
  .table td > * { grid-column: 2; justify-self: end; min-width: 0; max-width: 100%; }
  .table td:first-child { display: block; padding: 0 44px 6px 0; text-align: left; font-size: 14px; }
  .table td:first-child::before { display: none; }
  .table td.col-act { position: absolute; top: 8px; right: 8px; width: auto; padding: 0; }
  .table td.col-act::before, .table td.col-act-wide::before { display: none; }
  /* Rows with real buttons (Download, Uninstall): buttons go on their own line under the details. */
  .table td.col-act-wide { display: flex; justify-content: flex-end; gap: 6px; width: 100%; padding: 8px 0 0; }
  .table td.col-opt { display: none; }
  .table td:empty { display: none; }
  .table tbody tr.selected td:first-child { box-shadow: none; }
  .table tbody tr.selected { box-shadow: inset 3px 0 0 var(--accent); }
  .table-empty td { display: block; padding: 32px 8px; text-align: center; }
  .table-empty td::before { display: none; }
  .machine-sub, .activity-table .script-cell, .args-cell { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .targets-table .msg { max-width: none; text-align: right; }
  .dprogress { min-width: 0; width: 60%; }
  .mini { min-width: 0; }

  /* Dialogs fill the screen. */
  .modal { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; }
  .modal-card, .modal-card.modal-wide { width: 100%; min-height: 100%; border-radius: 0; border: 0; padding: 18px 16px; }
  .modal-actions { position: sticky; bottom: 0; margin: 20px -16px -18px; padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--border); }
  .modal-actions .btn { flex: 1 1 auto; }
  #confirm .modal-card { min-height: 0; }
  #confirm { height: auto; margin: auto 0 0; }

  .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============ Installed software grouped by computer ============ */
.pc-groups { display: grid; }
.pc-group + .pc-group { border-top: 1px solid var(--border); }
.pc-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; user-select: none; }
.pc-head:hover { background: var(--surface-2); }
.pc-head:focus-visible { outline: 2px solid var(--accent, #2b59e8); outline-offset: -2px; }
.pc-chevron { flex: none; color: var(--muted); transition: transform .15s ease; transform: rotate(-90deg); }
.pc-group.open .pc-chevron { transform: none; }
.pc-title { min-width: 0; flex: 1; display: grid; }
.pc-title b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-title small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-actions { flex: none; }
.pc-list { border-top: 1px solid var(--border); background: var(--surface-2); padding: 0 0 0 28px; }
.pc-list .program-row { background: var(--surface); }
.pc-list .program-row:hover { background: var(--surface-2); }
#programs-view .icon { width: 14px; height: 14px; margin-right: 5px; vertical-align: -2px; }
@media (max-width: 680px) {
  .pc-head { flex-wrap: wrap; padding: 12px; }
  .pc-title { flex-basis: calc(100% - 100px); }
  .pc-actions { margin-left: 36px; }
  .pc-list { padding-left: 0; }
}

/* ============ Telegram confirmation code ============ */
.otp-box { margin: 14px 0 4px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm, 8px); background: var(--surface-2); }
.otp-head { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; margin-bottom: 10px; }
.otp-head .icon { flex: none; width: 18px; height: 18px; }
.otp-row { display: flex; gap: 8px; }
.otp-input { flex: 1; min-width: 0; font: 600 18px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .35em; text-align: center; }
#secure-move { margin-top: 12px; }
#secure-move small { display: block; margin-top: 4px; font-size: 12px; }

.pill-update { margin-left: 8px; height: 18px; padding: 0 7px; font-size: 10.5px; background: var(--warn-soft); color: var(--warn); vertical-align: 1px; }

/* ============ Admin account dialog ============ */
.admin-status { display: flex; align-items: center; gap: 6px; margin: 4px 0 12px; }
.admin-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0 0 12px; font-size: 13px; }
.admin-facts dt { color: var(--muted); }
.admin-facts dd { margin: 0; overflow-wrap: anywhere; }
.admin-secret { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; padding: 12px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm, 8px); background: var(--surface-2); }
.admin-secret > span { grid-column: 1 / -1; }
.admin-secret code { font: 600 17px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .04em; overflow-wrap: anywhere; user-select: all; }
.admin-switch-row { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: var(--surface-2, var(--accent-soft)); }
.admin-switch-row[title]:not([title=""]) { opacity: .7; }
.admin-actions { flex-wrap: wrap; }
.admin-actions #admin-reveal { margin-right: auto; }
@media (max-width: 680px) { .admin-facts { grid-template-columns: 1fr; gap: 2px; } .admin-facts dd { margin-bottom: 8px; } }

/* ============ Machine Overview: Agent management block ============ */
.agent-manage { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.agent-manage .agent-manage-spacer { flex: 1 1 auto; min-width: 0; }
.agent-manage .btn .icon { width: 15px; height: 15px; }
#d-agent-note { font-weight: 500; }
@media (max-width: 680px) {
  .agent-manage { gap: 8px; }
  .agent-manage .agent-manage-spacer { flex-basis: 100%; height: 0; }
  .agent-manage .btn { flex: 1 1 auto; justify-content: center; }
}

/* Fleet Command Center */
.command-stats { gap: 1px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--border); overflow: hidden; }
.command-stats .stat { border: 0; border-radius: 0; box-shadow: none; }
.command-stats .stat:hover { transform: none; box-shadow: none; }
.command-stats .stat:focus-visible { outline-offset: -3px; }
.command-grid { align-items: start; }
.command-activity { display: grid; gap: 14px; min-width: 0; }
.command-activity > .card { border: 1px solid var(--border); border-radius: var(--radius-lg); }
.command-deployment {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 9px 14px; color: var(--text); text-decoration: none;
}
.command-deployment:hover { background: var(--surface-2); }
.command-deployment .feed-main { display: grid; gap: 3px; }
.command-deployment .pill { white-space: normal; height: auto; min-height: 20px; max-width: 140px; }

/* Live Wallboard */
#main-content[data-page="wallboard"] {
  --wall-bg: #101722;
  --wall-surface: #182332;
  --wall-border: #344458;
  --wall-text: #f0f5fc;
  --wall-muted: #b6c4d5;
  --wall-online: #66d9ad;
  --wall-offline: #ff9b9e;
  --wall-reconnecting: #f9ca7e;
  --wall-attention: #a8c8ff;
  color-scheme: dark;
  min-height: 100%;
  background: var(--wall-bg);
  color: var(--wall-text);
}
#main-content[data-page="wallboard"] .pagebar,
#main-content[data-page="wallboard"] .wallboard { max-width: none; }
#main-content[data-page="wallboard"] .page-context,
#main-content[data-page="wallboard"] .pagebar p { color: var(--wall-muted); }
#main-content[data-page="wallboard"] .pagebar .btn { color: var(--wall-text); background: var(--wall-surface); border-color: var(--wall-border); }
#main-content[data-page="wallboard"] .pagebar .btn:hover { border-color: var(--wall-attention); }
#main-content[data-page="wallboard"] .banner { color: var(--wall-offline); background: var(--wall-surface); border-color: var(--wall-border); }
#main-content[data-page="wallboard"]:fullscreen { overflow: auto; }
.wallboard { align-content: start; }
.wallboard-connection,
.wallboard-section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.wallboard-connection { color: var(--wall-muted); font-size: 13px; }
.wallboard-connection[data-state="live"] { color: var(--wall-online); }
.wallboard-connection[data-state="stale"] { color: var(--wall-reconnecting); }
#wallboard-updated { color: var(--wall-muted); font-variant-numeric: tabular-nums; }
.wallboard-dot { display: inline-block; flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.wallboard-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; }
.wallboard-stats > div { display: flex; flex-direction: column-reverse; gap: 3px; padding: clamp(12px, 2vw, 26px); }
.wallboard-stats > div, .wallboard-columns > article {
  min-width: 0; background: var(--wall-surface); border: 1px solid var(--wall-border); border-radius: var(--radius-lg);
}
.wallboard [data-tone="online"] { --wall-tone: var(--wall-online); }
.wallboard [data-tone="offline"] { --wall-tone: var(--wall-offline); }
.wallboard [data-tone="reconnecting"] { --wall-tone: var(--wall-reconnecting); }
.wallboard [data-tone="attention"] { --wall-tone: var(--wall-attention); }
.wallboard-stats dt { color: var(--wall-muted); font-size: clamp(14px, 1.25vw, 19px); }
.wallboard-stats dd {
  margin: 0; color: var(--wall-tone); font: 700 clamp(30px, 5.2vw, 94px)/1.08 var(--font-display);
  font-variant-numeric: tabular-nums; letter-spacing: -.04em; overflow-wrap: anywhere;
}
.wallboard-columns { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.wallboard-columns > article { padding: clamp(12px, 1.65vw, 22px); }
.wallboard-columns h2 { font-size: clamp(15px, 1.4vw, 22px); }
.wallboard-section-head { justify-content: space-between; }
.wallboard-section-head a { color: var(--wall-attention); }
.wallboard-device-count { margin: 5px 0 0; color: var(--wall-muted); font-size: 13px; }
.wallboard-device-count:empty { display: none; }
.wallboard-devices, .wallboard-events { list-style: none; margin: 12px 0 0; padding: 0; }
.wallboard-devices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 135px), 1fr)); gap: 8px; }
.wallboard-devices > li:not(.wallboard-empty) { display: grid; gap: 4px; padding: 10px; background: var(--wall-bg); border-radius: var(--radius-sm); }
.wallboard-devices li, .wallboard-events li { min-width: 0; overflow-wrap: anywhere; }
.wallboard-device-status { display: flex; align-items: center; gap: 6px; color: var(--wall-tone); font-size: 13px; }
.wallboard-devices small, .wallboard-events time, .wallboard-empty { color: var(--wall-muted); }
.wallboard-events > li:not(.wallboard-empty) { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--wall-border); }
.wallboard-events > li > div { display: grid; gap: 3px; min-width: 0; }
.wallboard-events li span, .wallboard-events time { font-size: 13px; }
.wallboard-events time { flex: none; font-variant-numeric: tabular-nums; }
.wallboard-events .pill-ok { color: var(--wall-online); }
.wallboard-events .pill-bad { color: var(--wall-offline); }
.wallboard-events .pill-pending { color: var(--wall-reconnecting); }
.wallboard-events .pill-muted { color: var(--wall-muted); }
@media (max-width: 980px) {
  .wallboard-columns { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .command-deployment { grid-template-columns: auto minmax(0, 1fr); }
  .command-deployment .pill { grid-column: 2; justify-self: start; }
  .wallboard-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
