:root {
  --bg: #040506;
  --panel: #0a0d10;
  --panel-2: #0f1318;
  --panel-3: #141a22;
  --border: rgba(57, 255, 20, 0.14);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f5f8fb;
  --muted: #a3b0be;
  --lime: #39ff14;
  --lime-glow: rgba(57, 255, 20, 0.35);
  --lime-dim: rgba(57, 255, 20, 0.14);
  --lime-soft: rgba(57, 255, 20, 0.07);
  --ok: #39ff14;
  --bad: #ff5c5c;
  --warn: #ffc040;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Outfit", system-ui, sans-serif;
  --radius: 10px;
  --radius-lg: 14px;
  --header-h: 88px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 500;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 45% at 15% -5%, rgba(57, 255, 20, 0.08), transparent 55%),
    radial-gradient(ellipse 50% 35% at 90% 10%, rgba(59, 130, 246, 0.05), transparent 50%);
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(rgba(57, 255, 20, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 255, 20, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, black 20%, transparent 85%);
}

.scanlines {
  display: none;
}

.hidden { display: none !important; }
.mono { font-family: var(--mono); font-size: 0.8125rem; }

/* ── Header ── */
.deck-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(4, 6, 8, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(57, 255, 20, 0.14);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.35);
}

.deck-header-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  min-height: var(--header-h);
}

.nav-toggle {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle:hover {
  border-color: rgba(57, 255, 20, 0.4);
  background: var(--lime-soft);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.deck-brand { display: flex; align-items: center; flex-shrink: 0; }
.deck-brand-link { display: flex; align-items: center; line-height: 0; }
.deck-logo {
  height: 72px;
  width: auto;
  max-width: 340px;
  object-fit: contain;
  background: transparent;
  filter: drop-shadow(0 4px 16px rgba(57, 255, 20, 0.12));
}
.deck-page-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.88);
  margin: 0;
  padding-left: 8px;
}
.deck-brand-name {
  display: block;
  font-size: 1.125rem;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.deck-brand-name em { font-style: italic; color: var(--lime); }
.deck-brand-sub {
  display: block;
  font-family: var(--mono);
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-top: 3px;
}

.deck-kpi-strip {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
  padding: 0 4px;
}

.deck-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--lime);
  padding: 5px 10px;
  border: 1px solid rgba(132,255,0,0.3);
  border-radius: 999px;
  background: var(--lime-dim);
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.85); } }

.deck-clock {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--lime);
  letter-spacing: 0.04em;
  min-width: 92px;
  text-align: right;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 68px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(10, 13, 16, 0.92);
  border: 1px solid rgba(57, 255, 20, 0.14);
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
  text-align: center;
}
.kpi-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: rgba(255,255,255,0.08);
}
.kpi-card.kpi-ok::before { background: var(--lime); box-shadow: 0 0 10px var(--lime-glow); }
.kpi-card.kpi-bad::before { background: var(--bad); }
.kpi-card.kpi-warn::before { background: var(--warn); }

.kpi-v {
  display: block;
  font-family: var(--mono);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text);
}
.kpi-card.kpi-ok .kpi-v { color: var(--lime); }
.kpi-card.kpi-bad .kpi-v { color: var(--bad); }
.kpi-card.kpi-warn .kpi-v { color: var(--warn); }
.kpi-l {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 6px;
}

.sync-pill {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}

.btn {
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 9px 16px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(180deg, #39ff14 0%, #22c55e 100%);
  color: #051005;
  box-shadow: 0 4px 20px rgba(57, 255, 20, 0.28);
}
.btn-primary:hover { box-shadow: 0 6px 28px rgba(57, 255, 20, 0.4); }
.btn-sm {
  font-size: 0.6875rem;
  padding: 6px 10px;
  border-radius: 6px;
}
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.btn-ghost {
  background: rgba(255,255,255,0.03);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-danger {
  background: rgba(255,77,77,0.12);
  color: var(--bad);
  border: 1px solid rgba(255,77,77,0.35);
}
.btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Workspace ── */
.workspace {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: calc(100vh - var(--header-h));
}

.panel-label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding: 14px 16px 8px;
  margin: 0;
}

.fleet-menu {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.fleet-menu-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 10px 12px;
}

.fleet-menu-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.fleet-menu-link:hover,
.fleet-menu-link:focus-visible {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
  outline: none;
}

.fleet-menu-link.active {
  background: var(--lime-soft);
  border-color: rgba(132, 255, 0, 0.22);
  color: var(--lime);
  font-weight: 600;
}

.fleet-panel {
  border-right: 1px solid var(--border-strong);
  background: linear-gradient(180deg, var(--panel) 0%, rgba(10,13,16,0.97) 100%);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.fleet-head { padding: 10px 14px 12px; border-bottom: 1px solid rgba(255,255,255,0.04); }

.search-wrap { position: relative; }
.search-ico {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  stroke: var(--muted);
  pointer-events: none;
}
.search {
  width: 100%;
  padding: 11px 12px 11px 38px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--panel-3);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search:focus {
  outline: none;
  border-color: rgba(132,255,0,0.4);
  box-shadow: 0 0 0 3px var(--lime-dim);
}

.filter-row { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 10px; }
.filter-chip {
  font-family: var(--mono);
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 6px 11px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: 0.12s;
}
.filter-chip:hover { border-color: rgba(132,255,0,0.3); color: var(--text); }
.filter-chip.active {
  background: var(--lime-dim);
  color: var(--lime);
  border-color: rgba(132,255,0,0.45);
  box-shadow: 0 0 14px rgba(132,255,0,0.15);
}

.fleet-meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 8px;
}

.fleet-list { overflow-y: auto; flex: 1; padding: 8px 10px 16px; }

.fleet-item {
  width: 100%;
  display: grid;
  grid-template-columns: 3px auto 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.015);
  color: inherit;
  cursor: pointer;
  margin-bottom: 5px;
  transition: 0.15s;
}
.fleet-item:hover {
  background: var(--lime-soft);
  border-color: rgba(132,255,0,0.15);
}
.fleet-item.selected {
  background: var(--lime-dim);
  border-color: rgba(132,255,0,0.35);
  box-shadow: inset 0 0 20px rgba(132,255,0,0.06);
}

.fleet-bar { align-self: stretch; border-radius: 2px; min-height: 36px; }
.fleet-bar.ok { background: var(--lime); box-shadow: 0 0 8px var(--lime-glow); }
.fleet-bar.bad { background: var(--bad); }
.fleet-bar.warn { background: var(--warn); }

.fleet-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.fleet-dot.ok { background: var(--lime); box-shadow: 0 0 8px var(--lime-glow); }
.fleet-dot.bad { background: var(--bad); box-shadow: 0 0 8px rgba(255,77,77,0.5); }

.fleet-main strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.fleet-sub {
  display: block;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 3px;
}
.fleet-tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.fleet-tag {
  font-family: var(--mono);
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(255,176,32,0.15);
  color: var(--warn);
  border: 1px solid rgba(255,176,32,0.25);
}

.fleet-empty { padding: 20px; color: var(--muted); font-size: 0.8125rem; text-align: center; }

/* ── Welcome / empty console ── */
.console-panel { min-width: 0; display: flex; flex-direction: column; }

.welcome-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 0;
  min-height: calc(100vh - var(--header-h));
}

.welcome-main { padding: 24px 28px; overflow-y: auto; }
.welcome-title {
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
  color: var(--text);
}
.welcome-sub { color: var(--muted); font-size: 0.9375rem; font-weight: 500; margin-bottom: 20px; }

.welcome-table-wrap {
  margin-top: 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: auto;
  max-height: calc(100vh - var(--header-h) - 168px);
  background: var(--panel);
  scrollbar-gutter: stable;
}

.deck-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.deck-table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border-strong);
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--border-strong);
}
.deck-table td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  vertical-align: middle;
  color: var(--text);
}
.deck-table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}
.deck-table tbody tr:hover td { background: var(--lime-soft); }
.deck-table .loc-name { font-weight: 600; display: block; }
.deck-table .loc-model { font-size: 0.6875rem; color: var(--muted); }

.led {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}
.led.ok { background: var(--lime); color: var(--lime); }
.led.bad { background: var(--bad); color: var(--bad); }
.led.warn { background: var(--warn); color: var(--warn); }

.chip-sm {
  font-family: var(--mono);
  font-size: 0.5625rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid transparent;
}
.chip-sm.ok { color: var(--lime); border-color: rgba(132,255,0,0.3); background: var(--lime-dim); }
.chip-sm.warn { color: var(--warn); border-color: rgba(255,176,32,0.3); background: rgba(255,176,32,0.08); }
.chip-sm.bad { color: var(--bad); border-color: rgba(255,77,77,0.3); background: rgba(255,77,77,0.08); }
.chip-sm.muted { color: var(--muted); border-color: rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); }

.time-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.2;
}
.time-drift {
  font-size: 0.5rem;
  font-weight: 700;
  opacity: 0.95;
}
.time-mode {
  font-size: 0.5rem;
  font-weight: 500;
  opacity: 0.65;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.deck-table th:nth-child(6),
.deck-table th:nth-child(7),
.deck-table td:nth-child(6),
.deck-table td:nth-child(7) {
  white-space: nowrap;
}

.welcome-side {
  border-left: 1px solid var(--border-strong);
  background: rgba(0,0,0,0.25);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.health-ring-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 28px;
  flex-shrink: 0;
}
.health-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.06); stroke-width: 8; }
.ring-fg {
  fill: none;
  stroke: var(--lime);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 0.6s ease;
  filter: drop-shadow(0 0 6px var(--lime-glow));
}
.health-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.health-pct {
  font-family: var(--mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--lime);
  line-height: 1;
}
.health-lbl {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 4px;
}

.alert-feed {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.alert-feed h3 {
  font-family: var(--mono);
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 12px;
  flex-shrink: 0;
}
.alert-count {
  color: var(--warn);
  font-weight: 600;
}
.alert-feed-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}
.alert-empty { font-size: 0.8125rem; color: var(--muted); }
.alert-card {
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 0.75rem;
  line-height: 1.45;
  border-left: 3px solid;
}
.alert-card.warn {
  background: rgba(255,176,32,0.08);
  border-color: var(--warn);
}
.alert-card.bad {
  background: rgba(255,77,77,0.08);
  border-color: var(--bad);
}
.alert-card strong {
  display: block;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.banner {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  line-height: 1.5;
  margin-bottom: 16px;
}
.banner.warn { background: rgba(255,176,32,0.08); border: 1px solid rgba(255,176,32,0.25); color: #fde68a; }
.banner.ok { background: var(--lime-dim); border: 1px solid rgba(132,255,0,0.3); color: #d9ff99; }
.banner code { font-family: var(--mono); font-size: 0.75rem; }

/* ── Device console ── */
.console-loaded { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.console-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(132,255,0,0.04) 0%, transparent 100%);
}
.console-eyebrow {
  font-family: var(--mono);
  font-size: 0.625rem;
  color: var(--lime);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.console-head h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-top: 4px;
  letter-spacing: -0.03em;
}
.console-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.console-head-actions { display: flex; gap: 8px; align-items: flex-start; }

.badge {
  font-family: var(--mono);
  font-size: 0.5625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid;
}
.badge-ok { color: var(--lime); border-color: rgba(132,255,0,0.35); background: var(--lime-dim); }
.badge-bad { color: var(--bad); border-color: rgba(255,77,77,0.35); background: rgba(255,77,77,0.08); }
.badge-warn { color: var(--warn); border-color: rgba(255,176,32,0.35); background: rgba(255,176,32,0.08); }
.badge-muted { color: var(--muted); border-color: var(--border-strong); background: transparent; }

.console-tabs {
  display: flex;
  gap: 2px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--panel);
  overflow-x: auto;
}
.tab {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 12px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
  transition: 0.12s;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--lime);
  border-bottom-color: var(--lime);
}

.console-body {
  overflow-y: auto;
  padding: 20px 24px 40px;
  flex: 1;
  background: linear-gradient(180deg, transparent 0%, rgba(132,255,0,0.02) 100%);
}

.panel-section {
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}
.panel-section h3 {
  font-family: var(--mono);
  font-size: 0.5625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px 20px;
}
.kv-grid dt {
  font-family: var(--mono);
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 5px;
}
.kv-grid dd { font-size: 0.875rem; font-weight: 500; }

.json-block {
  font-family: var(--mono);
  font-size: 0.6875rem;
  line-height: 1.5;
  background: #020303;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 14px;
  overflow: auto;
  max-height: 380px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #a8b4c4;
}

.data-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.data-table th {
  font-family: var(--mono);
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.cam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.cam-card {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 0.75rem;
  background: var(--panel-2);
  transition: 0.12s;
}
.cam-card:hover { border-color: rgba(132,255,0,0.25); }
.cam-card.ok { border-color: rgba(132,255,0,0.3); box-shadow: inset 0 0 16px rgba(132,255,0,0.05); }
.cam-card.bad { border-color: rgba(255,77,77,0.3); }
.cam-num {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.5625rem;
  color: var(--lime);
  margin-right: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.form-grid label.wide { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea {
  font: inherit;
  font-size: 0.8125rem;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--panel-3);
  color: var(--text);
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  outline: none;
  border-color: rgba(132,255,0,0.4);
}
.isapi-form textarea { min-height: 90px; resize: vertical; font-family: var(--mono); }

.hint { font-size: 0.75rem; color: var(--muted); margin-bottom: 12px; line-height: 1.5; }
.fw-notice {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.fw-notice strong { display: block; margin-bottom: 6px; }
.fw-notice p { margin: 0; color: var(--muted); }
.fw-notice--manual { border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.06); }
.fw-notice--manual strong { color: #fbbf24; }
.fw-notice--ok { border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.06); }
.fw-notice--ok strong { color: var(--lime); }
.fw-upgrade-result {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}
.fw-upgrade-result h4 { margin: 0 0 8px; font-size: 0.875rem; }
.fw-upgrade-result--ok { border-color: rgba(52, 211, 153, 0.35); }
.fw-upgrade-result--warn { border-color: rgba(251, 191, 36, 0.35); }
.fw-upgrade-result--err { border-color: rgba(248, 113, 113, 0.35); }
.err { color: var(--bad); font-size: 0.8125rem; }
.bullets { padding-left: 18px; color: var(--muted); font-size: 0.8125rem; }
.bullets li { margin-bottom: 6px; }
.row-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.state-cell, .state-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  padding: 28px;
  font-size: 0.8125rem;
}
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--lime);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast-dialog {
  border: 1px solid rgba(132,255,0,0.25);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
  padding: 0;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.toast-dialog::backdrop { background: rgba(0,0,0,0.65); }
.toast { padding: 16px 18px; font-size: 0.875rem; }
.toast-ok { color: var(--lime); }
.toast-err { color: var(--bad); }

.toast-err { color: var(--bad); }

/* Auth pages */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; }
.auth-shell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}
.auth-card {
  width: min(420px, 100%);
  padding: 28px 28px 24px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: rgba(12, 16, 22, 0.92);
  box-shadow: 0 24px 80px rgba(0,0,0,0.45);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.auth-logo { width: 52px; height: 52px; object-fit: contain; }
.auth-brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.auth-brand h1 em { color: var(--lime); font-style: normal; }
.auth-brand p { margin: 4px 0 0; color: var(--muted); font-size: 0.8125rem; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; }
.auth-form label span {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.auth-form input, .auth-form select {
  font: inherit;
  font-size: 0.875rem;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--panel-3);
  color: var(--text);
}
.auth-form input:focus, .auth-form select:focus {
  outline: none;
  border-color: rgba(132,255,0,0.4);
}
.auth-submit { width: 100%; margin-top: 4px; }
.auth-error { color: var(--bad); font-size: 0.8125rem; margin: 0; }
.auth-foot { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 0.75rem; }
.user-pill {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Side navigation ── */
.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  opacity: 1;
  transition: opacity 0.22s ease;
}
.nav-backdrop.is-closed {
  opacity: 0;
  pointer-events: none;
}
.deck-nav {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  width: min(320px, 88vw);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: rgba(6, 8, 10, 0.97);
  border-right: 1px solid rgba(57, 255, 20, 0.18);
  box-shadow: 8px 0 40px rgba(0, 0, 0, 0.45);
  transform: translateX(0);
  transition: transform 0.22s ease;
}
.deck-nav.is-closed {
  transform: translateX(-105%);
  pointer-events: none;
}
.deck-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-strong);
}
.deck-nav-logo {
  height: 44px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}
.nav-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.nav-close:hover { border-color: rgba(57, 255, 20, 0.4); }
.deck-nav-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 20px;
}
.deck-nav-section {
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 16px 8px 8px;
}
.deck-nav-section:first-child { margin-top: 4px; }
.deck-nav-link,
button.deck-nav-link {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  padding: 11px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s;
}
.deck-nav-link:hover,
button.deck-nav-link:hover {
  background: var(--lime-soft);
  color: var(--lime);
}
.deck-nav-link.active {
  background: var(--lime-dim);
  color: var(--lime);
  border: 1px solid rgba(57, 255, 20, 0.25);
}
.deck-nav-locations {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
}
.deck-nav-loc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.deck-nav-loc:hover { background: rgba(255, 255, 255, 0.04); }
.deck-nav-loc.active {
  background: var(--lime-dim);
  color: var(--lime);
}
.deck-nav-loc-meta {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--muted);
  white-space: nowrap;
}
.deck-nav-loc-meta b { color: var(--lime); font-weight: 600; }
.deck-nav-foot {
  padding: 14px 16px;
  border-top: 1px solid var(--border-strong);
}
.deck-nav-user {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.fleet-location-filter {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--lime);
  margin-top: 6px;
}
.fleet-location-filter button {
  font: inherit;
  font-size: 0.75rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  margin-left: 8px;
  text-decoration: underline;
}
.fleet-location-filter button:hover { color: var(--text); }
.users-page { min-height: 100vh; display: block; }
.users-shell {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  display: grid;
  gap: 18px;
}
.users-section { margin-bottom: 0; }
.users-section h3 { margin-bottom: 6px; }
.users-form { margin-top: 14px; }
.users-form .wide { grid-column: 1 / -1; }
.users-table-wrap { overflow: auto; margin-top: 4px; }
.users-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.users-id {
  display: block;
  font-size: 0.625rem;
  color: var(--muted);
  margin-top: 2px;
}
.row-inactive td { opacity: 0.55; }
.row-inactive td:last-child { opacity: 1; }

.modal-dialog {
  border: 1px solid rgba(57, 255, 20, 0.2);
  border-radius: 14px;
  background: rgba(8, 10, 12, 0.96);
  color: var(--text);
  padding: 0;
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}
.modal-dialog::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); }
.modal-body { padding: 24px 22px 20px; }
.modal-body h3 { margin: 0 0 8px; font-size: 1.05rem; }
.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}
.modal-field span {
  font-family: var(--mono);
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.modal-field input {
  font: inherit;
  font-size: 0.875rem;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--panel-3);
  color: var(--text);
}
.modal-field input:focus {
  outline: none;
  border-color: rgba(57, 255, 20, 0.45);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

@media (max-width: 960px) {
  .deck-page-title { display: none; }
}

@media (max-width: 1100px) {
  .welcome-grid { grid-template-columns: 1fr; }
  .welcome-side { border-left: none; border-top: 1px solid var(--border-strong); }
}

@media (max-width: 1200px) {
  .deck-kpi-strip {
    grid-template-columns: repeat(5, minmax(72px, 1fr));
  }
  .kpi-v { font-size: 1.375rem; }
  .deck-logo { height: 58px; max-width: 240px; }
}

@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
  .fleet-panel { max-height: 45vh; }
  .deck-header-row {
    flex-wrap: wrap;
    min-height: auto;
    padding-bottom: 12px;
  }
  .deck-kpi-strip {
    order: 4;
    width: 100%;
    grid-template-columns: repeat(5, 1fr);
  }
  .deck-header-actions {
    order: 3;
    width: 100%;
    justify-content: flex-start;
  }
  .deck-logo { height: 52px; }
}
