/* ============================================================================
   GuardM8 — Operator Console
   Design direction: Trading-floor telemetry. Dense, data-first, control-room.
   Warm-tinted dark base · IBM Plex (Sans + Mono) · one accent ramp.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Warm-tinted neutrals — not blue. Control room, not VS Code. */
  --gm8-bg:        #0c0b09;
  --gm8-sidebar:   #0a0907;
  --gm8-card:      #14120e;
  --gm8-card-hi:   #1b1814;
  --gm8-border:    #2a2620;
  --gm8-border-hi: #3a342a;
  --gm8-text:      #ebe6dd;
  --gm8-text-dim:  #b4ac9d;
  --gm8-muted:     #7e7666;

  /* Single accent ramp — earn the loudness */
  --gm8-red:    #e54034;       /* P1 critical / FIRE / PANIC */
  --gm8-amber:  #f49a2b;       /* P2 high / INTRUDER / TAMPER */
  --gm8-gold:   #d4a73a;       /* P3 med / FAULT */
  --gm8-blue:   #4c9eff;       /* informational / TEST */
  --gm8-green:  #4caf78;       /* RESTORE / closed / ok */
  --gm8-violet: #9a7dd6;       /* OPEN_CLOSE arming */

  --gm8-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
  --gm8-sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
}

/* ── Theme: high-contrast ─ daylight rooms, max legibility ──────────── */
body[data-theme="high-contrast"] {
  --gm8-bg:        #000000;
  --gm8-sidebar:   #000000;
  --gm8-card:      #0d0d0d;
  --gm8-card-hi:   #1a1a1a;
  --gm8-border:    #444444;
  --gm8-border-hi: #6a6a6a;
  --gm8-text:      #ffffff;
  --gm8-text-dim:  #d0d0d0;
  --gm8-muted:     #9a9a9a;
  --gm8-red:    #ff5347;
  --gm8-amber:  #ffaa3d;
  --gm8-gold:   #ffcb47;
  --gm8-blue:   #66b3ff;
  --gm8-green:  #5ec88c;
  --gm8-violet: #b59be3;
}

/* ── Theme: cool ─ blue-tinted neutrals (VS Code-ish) ──────────────── */
body[data-theme="cool"] {
  --gm8-bg:        #0b1118;
  --gm8-sidebar:   #080d13;
  --gm8-card:      #121922;
  --gm8-card-hi:   #1a2330;
  --gm8-border:    #243245;
  --gm8-border-hi: #324259;
  --gm8-text:      #e6edf5;
  --gm8-text-dim:  #a9b6c6;
  --gm8-muted:     #6f7d8f;
  --gm8-red:    #ef5350;
  --gm8-amber:  #ffa726;
  --gm8-gold:   #ffd54f;
  --gm8-blue:   #54a9ff;
  --gm8-green:  #4dd0a0;
  --gm8-violet: #ab8df0;
}

/* ── Theme: daylight ─ light theme, for office daylight use ────────── */
body[data-theme="daylight"] {
  --gm8-bg:        #f5f3ee;
  --gm8-sidebar:   #2a2620;
  --gm8-card:      #ffffff;
  --gm8-card-hi:   #f0ece4;
  --gm8-border:    #d6d0c4;
  --gm8-border-hi: #b9b1a2;
  --gm8-text:      #1f1c17;
  --gm8-text-dim:  #4a443a;
  --gm8-muted:     #7e7666;
  --gm8-red:    #d23226;
  --gm8-amber:  #d88317;
  --gm8-gold:   #b88a22;
  --gm8-blue:   #2a7fd8;
  --gm8-green:  #2e8b57;
  --gm8-violet: #6f4dba;
}

* { box-sizing: border-box; }

html, body { font-family: var(--gm8-sans); }
.gm8-body {
  background: var(--gm8-bg);
  color: var(--gm8-text);
  min-height: 100vh;
  font-feature-settings: "ss01", "cv11";    /* Plex stylistic alternates */
  letter-spacing: 0.005em;
}

#wrapper { min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: 224px;
  min-width: 224px;
  background: var(--gm8-sidebar);
  border-right: 1px solid var(--gm8-border);
  min-height: 100vh; position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  padding: 0.9rem 0.8rem;
}
.sidebar-brand {
  padding: 0.5rem 0.25rem 0.9rem;
  border-bottom: 1px solid var(--gm8-border);
  margin: 0 -0.3rem 0.7rem;
}
.sidebar-logo {
  display: block;
  width: 100%;
  max-width: 178px;
  height: auto;
  margin: 0.15rem auto 0.1rem;
}
.sidebar-brand .bi-shield-shaded { color: var(--gm8-red); }
.sidebar-brand span { font-family: var(--gm8-sans); letter-spacing: -0.01em; }

.sidebar .nav-link {
  color: var(--gm8-muted);
  padding: 0.42rem 0.65rem;
  border-radius: 4px;
  font-size: 0.82rem;
  display: flex; align-items: center;
  transition: background 0.12s, color 0.12s;
}
.sidebar .nav-link:hover  { background: rgba(255,255,255,0.04); color: var(--gm8-text); }
.sidebar .nav-link.active {
  background: rgba(229, 64, 52, 0.10);
  color: #ff8d82;
  font-weight: 500;
  box-shadow: inset 2px 0 0 var(--gm8-red);
  padding-left: 0.55rem;
}
.nav-section-label {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--gm8-muted); padding: 0 0.65rem; margin: 1rem 0 0.35rem;
  font-weight: 600;
}
.sidebar-footer {
  border-top: 1px solid var(--gm8-border);
  margin: auto -0.3rem 0; padding: 0.6rem 0.5rem 0.2rem;
}
.operator-dot {
  width: 8px; height: 8px; background: var(--gm8-green); border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(76, 175, 120, 0.6);
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.main-content { background: var(--gm8-bg); min-height: 100vh; overflow: auto; }
.topbar {
  background: var(--gm8-sidebar);
  border-bottom: 1px solid var(--gm8-border);
  min-height: 48px;
  padding-inline: 1.25rem;
}

.topbar-clock {
  font-family: var(--gm8-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  color: var(--gm8-text-dim);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--gm8-border);
  padding: 0.22rem 0.55rem;
  border-radius: 3px;
  letter-spacing: 0.04em;
}

.topbar-status-dot {
  display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; background: var(--gm8-green);
  box-shadow: 0 0 0 0 rgba(76, 175, 120, 0.7);
  animation: gm8-heartbeat 2.2s infinite;
}
@keyframes gm8-heartbeat {
  0%   { box-shadow: 0 0 0 0   rgba(76,175,120,0.55); }
  70%  { box-shadow: 0 0 0 6px rgba(76,175,120,0);   }
  100% { box-shadow: 0 0 0 0   rgba(76,175,120,0);   }
}

main { padding: 1rem 1.25rem 2rem !important; }

/* ── Section headers (replaces big h4) ────────────────────────────────────── */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 1.1rem 0 0.55rem 0;
}
.section-head h5 {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--gm8-text-dim); margin: 0; font-weight: 600;
  font-family: var(--gm8-mono);
}
.section-head .head-tools { display: flex; gap: 0.5rem; align-items: center; font-family: var(--gm8-mono); font-size: 0.7rem; }
.section-head .head-tools kbd { vertical-align: 1px; }

/* ── KPI strip ───────────────────────────────────────────────────────────── */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}
.kpi-tile {
  background: var(--gm8-card);
  border: 1px solid var(--gm8-border);
  border-radius: 4px;
  padding: 0.65rem 0.85rem;
  position: relative;
}
.kpi-tile::before {
  content: ''; position: absolute; top:0; left:0; bottom:0;
  width: 2px; background: var(--gm8-blue);
}
.kpi-tile.kpi-critical::before { background: var(--gm8-red); }
.kpi-tile.kpi-warning::before  { background: var(--gm8-amber); }
.kpi-tile.kpi-ok::before       { background: var(--gm8-green); }

.kpi-tile .kpi-label {
  font-family: var(--gm8-mono);
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--gm8-muted); margin-bottom: 0.2rem;
}
.kpi-tile .kpi-value {
  font-size: 1.55rem; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums;
  font-family: var(--gm8-mono);
  color: var(--gm8-text);
  letter-spacing: -0.02em;
}
.kpi-tile .kpi-meta {
  font-size: 0.68rem; color: var(--gm8-muted); margin-top: 0.3rem;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.gm8-card {
  background: var(--gm8-card);
  border: 1px solid var(--gm8-border);
  border-radius: 4px;
}
.gm8-card .card-header {
  background: rgba(255,255,255,0.015);
  border-bottom: 1px solid var(--gm8-border);
  font-family: var(--gm8-mono);
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.13em;
  padding: 0.55rem 0.85rem;
  color: var(--gm8-text-dim);
  font-weight: 500;
}
.gm8-card .card-body { padding: 0.85rem; }

/* ── Alarm cards (queue) ─────────────────────────────────────────────────── */
.alarm-card {
  background: var(--gm8-card);
  border: 1px solid var(--gm8-border);
  border-left: 3px solid var(--gm8-border-hi);
  border-radius: 4px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.5rem;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.alarm-card:hover { background: var(--gm8-card-hi); }
.alarm-card.priority-1 { border-left-color: var(--gm8-red); }
.alarm-card.priority-2 { border-left-color: var(--gm8-amber); }
.alarm-card.priority-3 { border-left-color: var(--gm8-gold); }
.alarm-card.priority-4 { border-left-color: var(--gm8-muted); }

.alarm-card.alarm-pending.priority-1 { animation: gm8-pulse-critical 1.6s infinite; }
@keyframes gm8-pulse-critical {
  0%, 100% { box-shadow: inset 3px 0 0 var(--gm8-red), 0 0 0 0 rgba(229, 64, 52, 0); }
  50%      { box-shadow: inset 3px 0 0 var(--gm8-red), 0 0 0 4px rgba(229, 64, 52, 0.10); }
}

.alarm-card-row { display: flex; align-items: flex-start; gap: 0.7rem; }

.alarm-type-icon {
  width: 36px; height: 36px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
  background: rgba(229, 64, 52, 0.10);
  color: var(--gm8-red);
}
.alarm-type-icon.alarm-type-fire,
.alarm-type-icon.alarm-type-panic,
.alarm-type-icon.alarm-type-holdup,
.alarm-type-icon.alarm-type-duress,
.alarm-type-icon.alarm-type-medical { background: rgba(229,64,52,0.14); color: #ff7268; }
.alarm-type-icon.alarm-type-intruder { background: rgba(244,154,43,0.14); color: var(--gm8-amber); }
.alarm-type-icon.alarm-type-tamper   { background: rgba(212,167,58,0.14); color: var(--gm8-gold); }
.alarm-type-icon.alarm-type-fault    { background: rgba(126,118,102,0.16); color: var(--gm8-text-dim); }
.alarm-type-icon.alarm-type-restore  { background: rgba(76,175,120,0.12); color: var(--gm8-green); }
.alarm-type-icon.alarm-type-test     { background: rgba(76,158,255,0.12); color: var(--gm8-blue); }
.alarm-type-icon.alarm-type-open_close { background: rgba(154,125,214,0.14); color: var(--gm8-violet); }

/* Type badges */
.alarm-type-badge {
  display: inline-block;
  padding: 0.1em 0.5em;
  border-radius: 2px;
  font-family: var(--gm8-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.alarm-type-badge.alarm-type-intruder { background: rgba(244,154,43,0.12); color: var(--gm8-amber); border-color: rgba(244,154,43,0.3); }
.alarm-type-badge.alarm-type-fire,
.alarm-type-badge.alarm-type-panic,
.alarm-type-badge.alarm-type-holdup,
.alarm-type-badge.alarm-type-duress,
.alarm-type-badge.alarm-type-medical { background: rgba(229,64,52,0.14); color: #ff7268; border-color: rgba(229,64,52,0.35); }
.alarm-type-badge.alarm-type-tamper   { background: rgba(212,167,58,0.12); color: var(--gm8-gold); border-color: rgba(212,167,58,0.3); }
.alarm-type-badge.alarm-type-fault    { background: rgba(126,118,102,0.16); color: var(--gm8-text-dim); border-color: rgba(126,118,102,0.3); }
.alarm-type-badge.alarm-type-restore  { background: rgba(76,175,120,0.12); color: var(--gm8-green); border-color: rgba(76,175,120,0.3); }
.alarm-type-badge.alarm-type-test     { background: rgba(76,158,255,0.10); color: var(--gm8-blue); border-color: rgba(76,158,255,0.25); }
.alarm-type-badge.alarm-type-open_close { background: rgba(154,125,214,0.12); color: var(--gm8-violet); border-color: rgba(154,125,214,0.3); }
.alarm-type-badge.alarm-type-other    { background: rgba(126,118,102,0.14); color: var(--gm8-text-dim); border-color: rgba(126,118,102,0.25); }

/* Status / priority pills — use same family of mono caps */
.badge { font-family: var(--gm8-mono); font-weight: 500; letter-spacing: 0.06em; }

/* ── Age pill ────────────────────────────────────────────────────────────── */
.alarm-age-pill {
  display: inline-flex; align-items: center; gap: 0.28rem;
  padding: 0.12em 0.5em;
  font-family: var(--gm8-mono);
  font-size: 0.68rem;
  font-weight: 500;
  border-radius: 2px;
  background: rgba(255,255,255,0.04);
  color: var(--gm8-text-dim);
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--gm8-border);
}
.alarm-age-pill.age-warning { background: rgba(244,154,43,0.10); color: var(--gm8-amber); border-color: rgba(244,154,43,0.3); }
.alarm-age-pill.age-critical { background: rgba(229,64,52,0.14); color: #ff7268; border-color: rgba(229,64,52,0.35); }

/* ── Big operator buttons ───────────────────────────────────────────────── */
.btn-ops {
  font-family: var(--gm8-sans);
  font-weight: 600; font-size: 0.85rem;
  letter-spacing: 0.02em;
  padding: 0.55rem 1rem;
  border-radius: 4px;
  border: 1px solid var(--gm8-blue);
  /* Solid default fill — the bare .btn-ops (e.g. Customize) had no background,
     so it rendered see-through on the light topbar. Modifiers below override. */
  background: var(--gm8-blue);
  color: #fff;
}
.btn-ops:hover { filter: brightness(1.08); color: #fff; }
.btn-ops.btn-ack       { background: var(--gm8-amber); border-color: var(--gm8-amber); color: #1d1004; }
.btn-ops.btn-ack:hover { background: #ffae3d; border-color: #ffae3d; color: #1d1004; }
.btn-ops.btn-close-ev  { background: var(--gm8-green); border-color: var(--gm8-green); color: #051a0e; }
.btn-ops.btn-close-ev:hover { background: #5fc28d; border-color: #5fc28d; color: #051a0e; }
.btn-ops.btn-cancel-ev { background: transparent; border-color: var(--gm8-border-hi); color: var(--gm8-text-dim); }
.btn-ops.btn-cancel-ev:hover { background: rgba(255,255,255,0.04); color: var(--gm8-text); }

/* ── Keyboard hint ──────────────────────────────────────────────────────── */
kbd.gm8-kbd {
  display: inline-block;
  font-family: var(--gm8-mono);
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.08em 0.38em;
  border-radius: 2px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--gm8-border-hi);
  border-bottom-width: 2px;
  color: var(--gm8-text);
  min-width: 1.25em; text-align: center;
  letter-spacing: 0;
}

/* ── Action timeline ────────────────────────────────────────────────────── */
.gm8-timeline { list-style: none; padding: 0; margin: 0; }
.gm8-timeline li {
  position: relative;
  padding: 0.5rem 0 0.5rem 1.5rem;
  border-bottom: 1px solid var(--gm8-border);
}
.gm8-timeline li:last-child { border-bottom: none; }
.gm8-timeline li::before {
  content: ''; position: absolute; left: 0.4rem; top: 0.85rem;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--gm8-blue);
  box-shadow: 0 0 0 2px rgba(76,158,255,0.18);
}
.gm8-timeline li.tl-ack::before    { background: var(--gm8-amber); box-shadow: 0 0 0 2px rgba(244,154,43,0.2); }
.gm8-timeline li.tl-close::before  { background: var(--gm8-green); box-shadow: 0 0 0 2px rgba(76,175,120,0.2); }
.gm8-timeline li.tl-cancel::before { background: var(--gm8-muted); box-shadow: 0 0 0 2px rgba(126,118,102,0.2); }
.gm8-timeline li.tl-sms::before    { background: #60a5fa;          box-shadow: 0 0 0 2px rgba(96,165,250,0.2); }
.gm8-timeline li::after {
  content: ''; position: absolute; left: 0.71rem; top: 1.4rem; bottom: -0.3rem;
  width: 1px; background: var(--gm8-border);
}
.gm8-timeline li:last-child::after { display: none; }

/* ── Live signal tape — the signature element ───────────────────────────── */
.signal-tape {
  background: var(--gm8-card);
  border: 1px solid var(--gm8-border);
  border-radius: 4px;
  overflow: hidden;
  height: 100%;
  min-height: 360px;
  display: flex; flex-direction: column;
}
.signal-tape-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--gm8-border);
  font-family: var(--gm8-mono);
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--gm8-text-dim);
  background: rgba(255,255,255,0.015);
}
.signal-tape-head .tape-status {
  display: inline-flex; align-items: center; gap: 0.35rem;
  color: var(--gm8-text-dim);
}
.signal-tape-head .tape-status .topbar-status-dot { width: 6px; height: 6px; }
.signal-tape-body {
  flex: 1; overflow-y: auto; padding: 0;
  font-family: var(--gm8-mono);
}
.signal-tape-body::-webkit-scrollbar { width: 6px; }
.signal-tape-body::-webkit-scrollbar-track { background: transparent; }
.signal-tape-body::-webkit-scrollbar-thumb { background: var(--gm8-border-hi); border-radius: 3px; }

.signal-row {
  display: grid;
  grid-template-columns: 3px 60px minmax(0, 1fr);
  gap: 0.5rem;
  padding: 0.36rem 0.55rem 0.36rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.025);
  font-size: 0.72rem;
  color: var(--gm8-text-dim);
  align-items: baseline;
  transition: background 0.1s;
  text-decoration: none;
}
.signal-row:hover { background: rgba(255,255,255,0.025); color: var(--gm8-text); }
.signal-row.is-new { animation: signalIn 0.5s ease-out; }
@keyframes signalIn {
  from { background: rgba(244,154,43,0.18); }
  to   { background: transparent; }
}

.signal-pip {
  height: 100%; min-height: 26px;
  background: var(--gm8-muted);
}
.signal-pip.t-intruder, .signal-pip.t-tamper { background: var(--gm8-amber); }
.signal-pip.t-fire, .signal-pip.t-panic, .signal-pip.t-holdup,
.signal-pip.t-duress, .signal-pip.t-medical { background: var(--gm8-red); }
.signal-pip.t-fault { background: var(--gm8-gold); }
.signal-pip.t-restore { background: var(--gm8-green); }
.signal-pip.t-test { background: var(--gm8-blue); }
.signal-pip.t-open_close { background: var(--gm8-violet); }

.signal-time {
  color: var(--gm8-muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.7rem;
}
.signal-body { min-width: 0; }
.signal-body .sig-line1 {
  display: flex; gap: 0.4rem; align-items: center;
  font-size: 0.72rem;
  color: var(--gm8-text);
  min-width: 0;
}
.signal-body .sig-site {
  font-weight: 600;
  color: var(--gm8-text);
  font-family: var(--gm8-sans);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.signal-body .sig-code {
  font-size: 0.65rem;
  color: var(--gm8-muted);
}
.signal-body .sig-desc {
  font-size: 0.7rem;
  color: var(--gm8-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.signal-type {
  margin-left: auto;
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.62rem; letter-spacing: 0.08em;
  font-weight: 600;
  font-family: var(--gm8-mono);
  color: var(--gm8-text-dim);
}
.signal-type.urgent { color: var(--gm8-red); }

/* ── Filter chips ───────────────────────────────────────────────────────── */
.filter-chips {
  display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.18em 0.55em;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--gm8-border);
  border-radius: 2px;
  font-family: var(--gm8-mono);
  font-size: 0.68rem;
  color: var(--gm8-text);
  text-decoration: none;
}

/* ── Sites status grid ──────────────────────────────────────────────────── */
.sites-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.35rem;
}
.site-tile {
  display: block;
  text-decoration: none;
  padding: 0.55rem 0.7rem;
  background: var(--gm8-card);
  border: 1px solid var(--gm8-border);
  border-left: 2px solid var(--gm8-muted);
  border-radius: 3px;
  color: var(--gm8-text);
  font-size: 0.8rem;
  transition: background 0.12s, border-left-color 0.12s;
}
.site-tile:hover { background: var(--gm8-card-hi); color: var(--gm8-text); }
.site-tile.s-recent { border-left-color: var(--gm8-amber); }
.site-tile.s-active { border-left-color: var(--gm8-red); }
.site-tile.s-quiet  { border-left-color: var(--gm8-green); }
.site-tile.s-test   { border-left-color: var(--gm8-blue); }
.site-tile .st-code {
  font-family: var(--gm8-mono);
  font-size: 0.62rem;
  color: var(--gm8-muted);
  display: block;
  letter-spacing: 0.04em;
}
.site-tile .st-name {
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--gm8-text);
}
.site-tile .st-meta {
  font-family: var(--gm8-mono);
  font-size: 0.62rem;
  color: var(--gm8-muted);
  margin-top: 0.15rem;
}

/* ── Audio toggle ───────────────────────────────────────────────────────── */
.audio-toggle {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.22em 0.55em;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--gm8-border);
  border-radius: 3px;
  font-family: var(--gm8-mono);
  font-size: 0.68rem;
  color: var(--gm8-muted);
  cursor: pointer;
}
.audio-toggle.on { color: var(--gm8-green); border-color: rgba(76,175,120,0.4); }
.audio-toggle:hover { background: rgba(255,255,255,0.06); }

/* ── Reports / Charts ───────────────────────────────────────────────────── */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.65rem;
}
.chart-card {
  background: var(--gm8-card);
  border: 1px solid var(--gm8-border);
  border-radius: 4px;
  padding: 0.85rem 1rem;
}
.chart-card .chart-title {
  font-family: var(--gm8-mono);
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--gm8-text-dim); margin-bottom: 0.6rem; font-weight: 600;
}
.chart-card canvas { max-height: 260px; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-dark { --bs-table-bg: transparent; --bs-table-hover-bg: rgba(255,255,255,0.025); }
.table thead th {
  font-family: var(--gm8-mono);
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.13em;
  font-weight: 600;
  color: var(--gm8-text-dim);
  border-color: var(--gm8-border);
  background: rgba(255,255,255,0.015);
  padding: 0.45rem 0.6rem;
}
.table td, .table th { border-color: var(--gm8-border) !important; vertical-align: middle; }
.table.gm8-dense td { padding: 0.4rem 0.6rem; font-size: 0.82rem; }
.table.gm8-dense .font-monospace { font-family: var(--gm8-mono); }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-control, .form-select {
  background: rgba(255,255,255,0.03) !important;
  border-color: var(--gm8-border) !important;
  color: var(--gm8-text) !important;
  font-family: var(--gm8-sans);
}
.form-control:focus, .form-select:focus {
  background: rgba(255,255,255,0.06) !important;
  border-color: var(--gm8-amber) !important;
  box-shadow: 0 0 0 2px rgba(244,154,43,0.15) !important;
}
.form-control::placeholder { color: var(--gm8-muted) !important; }
.form-label { font-family: var(--gm8-mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--gm8-text-dim); font-weight: 600; }

/* ── Misc ───────────────────────────────────────────────────────────────── */
.gm8-empty {
  text-align: center; padding: 1.5rem 1rem;
  color: var(--gm8-muted);
}
.gm8-empty i { font-size: 1.8rem; opacity: 0.4; }
.gm8-empty .small { font-size: 0.78rem; }

.font-monospace { font-family: var(--gm8-mono) !important; }
.font-mono { font-family: var(--gm8-mono) !important; }

/* Login (kept simple) */
.login-card {
  background: var(--gm8-card); border: 1px solid var(--gm8-border);
  border-radius: 8px; padding: 2.25rem; width: 100%; max-width: 380px;
}
.login-logo {
  width: 56px; height: 56px; background: rgba(229,64,52,0.12); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; margin: 0 auto;
  font-size: 1.7rem; color: var(--gm8-red);
}
.login-brand-logo {
  display: block; width: 100%; max-width: 230px; height: auto; margin: 0 auto 0.5rem;
}

.pulse-alarm { animation: btnPulse 1.5s infinite; }
@keyframes btnPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.65; } }

.snapshot-stack img { width: 100%; border-radius: 4px; border: 1px solid var(--gm8-border); }
.snapshot-stack { display: grid; gap: 0.4rem; }

.toast.alarm-toast { background: var(--gm8-card) !important; border: 1px solid var(--gm8-border) !important; border-left-width: 3px !important; }

/* Mobile */
@media (max-width: 991px) {
  .sidebar { position: fixed; left: -260px; z-index: 1050; transition: left 0.25s; }
  .sidebar.show { left: 0; box-shadow: 8px 0 30px rgba(0,0,0,0.5); }
  .main-content { margin-left: 0 !important; }
  main { padding: 0.75rem !important; }
  .signal-tape { min-height: 240px; }
}

/* ============================================================================
   THEME: professional ─ Light, airy, Bootstrappy — modelled on CentralHub
   ROUND everything · LOTS of padding · soft shadows · big breathable cards
   Activate by setting <body data-theme="pro"> (default for new users)
   ============================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

body[data-theme="pro"] {
  --gm8-bg:        #f4f5fa;
  --gm8-sidebar:   #1a1d2b;
  --gm8-sidebar-hi:#252939;
  --gm8-card:      #ffffff;
  --gm8-card-hi:   #fafbfd;
  --gm8-border:    #e5e7ef;
  --gm8-border-hi: #d4d7e2;
  --gm8-text:      #1c1f2a;
  --gm8-text-dim:  #5b6275;
  --gm8-muted:     #8a91a3;

  --gm8-red:    #ef4444;
  --gm8-amber:  #f59e0b;
  --gm8-gold:   #eab308;
  --gm8-blue:   #4f46e5;
  --gm8-green:  #10b981;
  --gm8-violet: #8b5cf6;

  --gm8-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-family: var(--gm8-sans);
  letter-spacing: -0.005em;
  font-size: 15px;
  line-height: 1.5;
}

body[data-theme="pro"] .gm8-body,
body[data-theme="pro"]               { background: var(--gm8-bg); color: var(--gm8-text); }
body[data-theme="pro"] main          { padding: 1.75rem 2rem 2.5rem !important; }

/* ── Sidebar — generous spacing, rounded active pill ───────────────────── */
body[data-theme="pro"] .sidebar {
  background: var(--gm8-sidebar);
  border-right: 0;
  padding: 1.25rem 0.9rem;
  width: 248px; min-width: 248px;
  color: #d8dbe5;
}
body[data-theme="pro"] .sidebar-brand {
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0.3rem 0.6rem 1.1rem;
  margin: 0 -0.3rem 1rem;
}
body[data-theme="pro"] .sidebar-brand span { color: #ffffff !important; font-weight: 700; font-size: 1.1rem; letter-spacing: -0.02em; }
body[data-theme="pro"] .sidebar-brand .bi-shield-shaded { color: var(--gm8-blue) !important; font-size: 1.3rem; }
body[data-theme="pro"] .sidebar .nav { gap: 0.25rem !important; }
body[data-theme="pro"] .sidebar .nav-link {
  color: #a8acba;
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: none !important;
}
body[data-theme="pro"] .sidebar .nav-link i { font-size: 1.05rem; opacity: 0.85; }
body[data-theme="pro"] .sidebar .nav-link:hover { background: rgba(255,255,255,0.06); color: #ffffff; }
body[data-theme="pro"] .sidebar .nav-link.active {
  background: var(--gm8-blue);
  color: #ffffff !important;
  font-weight: 600;
}
body[data-theme="pro"] .sidebar .nav-link.active i { opacity: 1; }
body[data-theme="pro"] .nav-section-label {
  color: #6b7080;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.5rem 0.85rem 0.35rem !important;
  margin: 1rem 0 0.25rem !important;
  font-family: var(--gm8-sans) !important;
}
body[data-theme="pro"] .sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 0.9rem 0.5rem 0.2rem;
}
body[data-theme="pro"] .operator-dot {
  background: var(--gm8-green);
  box-shadow: 0 0 0 4px rgba(16,185,129,0.18);
  width: 10px; height: 10px;
}

/* ── Topbar — clean white, taller ────────────────────────────────────── */
body[data-theme="pro"] .main-content { background: var(--gm8-bg); }
body[data-theme="pro"] .topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--gm8-border);
  color: var(--gm8-text);
  min-height: 60px;
  padding-inline: 1.75rem;
}
body[data-theme="pro"] .topbar-status-dot { background: var(--gm8-green); }
body[data-theme="pro"] .topbar-clock {
  background: #f3f4f8;
  color: var(--gm8-text-dim);
  border: 1px solid var(--gm8-border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-family: var(--gm8-sans);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ── Cards — ROUND, airy, soft shadows ───────────────────────────────── */
body[data-theme="pro"] .gm8-card {
  background: var(--gm8-card);
  border: 1px solid var(--gm8-border);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(20,22,40,0.04), 0 1px 2px rgba(20,22,40,0.03);
  overflow: hidden;
}
body[data-theme="pro"] .gm8-card .card-header {
  background: transparent;
  border-bottom: 1px solid var(--gm8-border);
  color: var(--gm8-text);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 1.1rem 1.4rem;
  letter-spacing: 0;
  text-transform: none;
  font-family: var(--gm8-sans);
}
body[data-theme="pro"] .gm8-card .card-body { padding: 1.25rem 1.4rem; }

/* ── Section header (page H1 strip) ─────────────────────────────────── */
body[data-theme="pro"] .section-head { margin: 1.5rem 0 1rem; }
body[data-theme="pro"] .section-head h5 {
  font-family: var(--gm8-sans);
  font-size: 1.1rem;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--gm8-text);
  font-weight: 700;
}

/* ── KPI tiles — big number, soft icon pill, airy ───────────────────── */
body[data-theme="pro"] .kpi-strip { gap: 1rem; margin-bottom: 1.5rem; }
body[data-theme="pro"] .kpi-tile {
  background: var(--gm8-card);
  border: 1px solid var(--gm8-border);
  border-radius: 16px;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 1px 3px rgba(20,22,40,0.04);
}
body[data-theme="pro"] .kpi-tile::before { display: none; }
body[data-theme="pro"] .kpi-tile .kpi-label {
  font-family: var(--gm8-sans);
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--gm8-muted);
  font-weight: 500;
  margin-bottom: 0.4rem;
}
body[data-theme="pro"] .kpi-tile .kpi-value {
  font-family: var(--gm8-sans);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--gm8-text);
  line-height: 1.1;
}

/* ── Buttons — rounded, padded, Bootstrappy ─────────────────────────── */
body[data-theme="pro"] .btn { border-radius: 10px; font-weight: 500; padding: 0.5rem 1rem; }
body[data-theme="pro"] .btn-sm { border-radius: 8px; padding: 0.35rem 0.75rem; font-size: 0.85rem; }
body[data-theme="pro"] .btn-ops { font-weight: 600; border-radius: 10px; padding: 0.6rem 1.2rem; }
body[data-theme="pro"] .btn-ack    { background: var(--gm8-blue); border-color: var(--gm8-blue); color: #fff; }
body[data-theme="pro"] .btn-ack:hover { filter: brightness(1.08); color: #fff; }
body[data-theme="pro"] .btn-close-ev { background: var(--gm8-green); border-color: var(--gm8-green); color: #fff; }
body[data-theme="pro"] .btn-close-ev:hover { filter: brightness(1.08); color: #fff; }
body[data-theme="pro"] .btn-cancel-ev{ background: #ffffff; border: 1px solid var(--gm8-border-hi); color: var(--gm8-text); }
body[data-theme="pro"] .btn-outline-secondary,
body[data-theme="pro"] .btn-outline-light { color: var(--gm8-text-dim); border-color: var(--gm8-border-hi); background: #fff; }
body[data-theme="pro"] .btn-outline-secondary:hover,
body[data-theme="pro"] .btn-outline-light:hover { background: #f3f4f8; color: var(--gm8-text); border-color: var(--gm8-border-hi); }
body[data-theme="pro"] .btn-outline-info { color: var(--gm8-blue); border-color: var(--gm8-blue); background: #fff; }
body[data-theme="pro"] .btn-outline-info:hover { background: var(--gm8-blue); color: #fff; }
body[data-theme="pro"] .btn-outline-warning { color: var(--gm8-amber); border-color: var(--gm8-amber); background: #fff; }
body[data-theme="pro"] .btn-outline-warning:hover { background: var(--gm8-amber); color: #fff; }
body[data-theme="pro"] .btn-outline-success { color: var(--gm8-green); border-color: var(--gm8-green); background: #fff; }
body[data-theme="pro"] .btn-outline-success:hover { background: var(--gm8-green); color: #fff; }
body[data-theme="pro"] .btn-outline-danger { color: var(--gm8-red); border-color: var(--gm8-red); background: #fff; }
body[data-theme="pro"] .btn-outline-danger:hover { background: var(--gm8-red); color: #fff; }

/* ── Status pills — full rounded ────────────────────────────────────── */
body[data-theme="pro"] .alarm-type-badge {
  background: #f3f4f8;
  color: var(--gm8-text-dim);
  border: 1px solid var(--gm8-border);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.75rem;
  font-family: var(--gm8-sans);
}
body[data-theme="pro"] .alarm-type-badge.alarm-type-intruder { background: #fff4e6; color: #b45309; border-color: #fde4c0; }
body[data-theme="pro"] .alarm-type-badge.alarm-type-fire,
body[data-theme="pro"] .alarm-type-badge.alarm-type-panic,
body[data-theme="pro"] .alarm-type-badge.alarm-type-holdup,
body[data-theme="pro"] .alarm-type-badge.alarm-type-duress,
body[data-theme="pro"] .alarm-type-badge.alarm-type-medical { background: #fde8e8; color: #b91c1c; border-color: #f9c3c3; }
body[data-theme="pro"] .alarm-type-badge.alarm-type-tamper   { background: #fef9c3; color: #854d0e; border-color: #fbeb8b; }
body[data-theme="pro"] .alarm-type-badge.alarm-type-fault    { background: #f3f4f8; color: #4b5163; border-color: #e6e8ee; }
body[data-theme="pro"] .alarm-type-badge.alarm-type-restore  { background: #e8faf0; color: #047857; border-color: #c3f0d6; }
body[data-theme="pro"] .alarm-type-badge.alarm-type-test     { background: #eef0ff; color: #4338ca; border-color: #d4d8f8; }
body[data-theme="pro"] .alarm-type-badge.alarm-type-open_close { background: #f3eefe; color: #6d28d9; border-color: #ddd0fb; }
body[data-theme="pro"] .alarm-type-badge.alarm-type-other    { background: #f3f4f8; color: #4b5163; border-color: #e6e8ee; }

body[data-theme="pro"] .badge {
  border-radius: 999px !important;
  padding: 0.3rem 0.7rem;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0;
}
body[data-theme="pro"] .badge.bg-danger  { background: #fde8e8 !important; color: #b91c1c !important; }
body[data-theme="pro"] .badge.bg-warning { background: #fef9c3 !important; color: #854d0e !important; }
body[data-theme="pro"] .badge.bg-success { background: #e8faf0 !important; color: #047857 !important; }
body[data-theme="pro"] .badge.bg-secondary { background: #f3f4f8 !important; color: #4b5163 !important; }
body[data-theme="pro"] .badge.bg-info    { background: #eef0ff !important; color: #4338ca !important; }
body[data-theme="pro"] .badge.bg-dark    { background: #f3f4f8 !important; color: #4b5163 !important; border: 1px solid var(--gm8-border) !important; }

/* ── Age pills ──────────────────────────────────────────────────────── */
body[data-theme="pro"] .alarm-age-pill {
  background: #f3f4f8;
  color: var(--gm8-text-dim);
  border: 1px solid var(--gm8-border);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
}

/* ── Tables — clean Bootstrap-feel ──────────────────────────────────── */
body[data-theme="pro"] .table-dark {
  --bs-table-bg: transparent;
  --bs-table-color: var(--gm8-text);
  --bs-table-border-color: var(--gm8-border);
  --bs-table-hover-bg: #f8f9fb;
  --bs-table-hover-color: var(--gm8-text);
  --bs-table-striped-bg: #fafbfd;
  color: var(--gm8-text);
}
body[data-theme="pro"] .table-dark thead th {
  color: var(--gm8-muted);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--gm8-border);
  background: transparent;
  padding: 0.85rem 1rem;
}
body[data-theme="pro"] .table-dark tbody td { padding: 0.85rem 1rem; }
body[data-theme="pro"] .gm8-dense thead th,
body[data-theme="pro"] .gm8-dense tbody td { padding: 0.65rem 0.85rem; font-size: 0.875rem; }

/* ── Forms — Bootstrap-shape ───────────────────────────────────────── */
body[data-theme="pro"] .form-control,
body[data-theme="pro"] .form-select {
  background: #ffffff;
  color: var(--gm8-text);
  border: 1px solid var(--gm8-border-hi);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
}
body[data-theme="pro"] .form-control-sm,
body[data-theme="pro"] .form-select-sm { border-radius: 8px; padding: 0.4rem 0.7rem; }
body[data-theme="pro"] .form-control:focus,
body[data-theme="pro"] .form-select:focus {
  border-color: var(--gm8-blue);
  box-shadow: 0 0 0 4px rgba(79,70,229,0.12);
}
body[data-theme="pro"] .form-label { color: var(--gm8-text-dim); font-weight: 500; font-size: 0.85rem; margin-bottom: 0.4rem; }
body[data-theme="pro"] .form-check-input:checked { background-color: var(--gm8-blue); border-color: var(--gm8-blue); }

/* ── Settings tab strip ────────────────────────────────────────────── */
body[data-theme="pro"] .gm8-settings-tabs { border-bottom: 1px solid var(--gm8-border); margin-bottom: 1.5rem !important; }
body[data-theme="pro"] .gm8-settings-tabs .nav-link {
  color: var(--gm8-muted);
  padding: 0.65rem 1rem;
  font-weight: 500;
  font-size: 0.9rem;
}
body[data-theme="pro"] .gm8-settings-tabs .nav-link:hover { color: var(--gm8-text); }
body[data-theme="pro"] .gm8-settings-tabs .nav-link.active {
  color: var(--gm8-blue);
  border-bottom-color: var(--gm8-blue);
  background: transparent;
  font-weight: 600;
}

/* ── Settings rows ─────────────────────────────────────────────────── */
body[data-theme="pro"] .gm8-setting-row { padding: 1rem 0; }
body[data-theme="pro"] .gm8-setting-label { font-weight: 600; }
body[data-theme="pro"] .gm8-setting-help  { color: var(--gm8-muted); font-size: 0.825rem; font-family: var(--gm8-sans); }
body[data-theme="pro"] .gm8-pill-on  { background: #e8faf0; color: #047857; border: 1px solid #c3f0d6; padding: 0.25rem 0.7rem; border-radius: 999px; font-weight: 500; font-size: 0.75rem; }
body[data-theme="pro"] .gm8-pill-off { background: #f3f4f8; color: #4b5163; border: 1px solid var(--gm8-border); padding: 0.25rem 0.7rem; border-radius: 999px; font-weight: 500; font-size: 0.75rem; }

/* ── kbd hints ─────────────────────────────────────────────────────── */
body[data-theme="pro"] .gm8-kbd {
  background: #ffffff;
  color: var(--gm8-text-dim);
  border: 1px solid var(--gm8-border-hi);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-family: var(--gm8-sans);
  font-size: 0.7rem;
}

/* ── List groups ──────────────────────────────────────────────────── */
body[data-theme="pro"] .list-group-item {
  background: #ffffff;
  color: var(--gm8-text);
  border-color: var(--gm8-border);
  padding: 0.85rem 1.2rem;
}
body[data-theme="pro"] .list-group-item.bg-transparent { background: transparent; }

/* ── Identity strip (alarm detail) ─────────────────────────────────── */
body[data-theme="pro"] .gm8-card a { color: var(--gm8-text); }
body[data-theme="pro"] .gm8-card a:hover { color: var(--gm8-blue); }
body[data-theme="pro"] .text-muted { color: var(--gm8-muted) !important; }

/* ── Misc Bootstrap-ish reset for dark elements ────────────────────── */
body[data-theme="pro"] .bg-transparent { background-color: transparent !important; }
body[data-theme="pro"] .text-white,
body[data-theme="pro"] .text-light { color: var(--gm8-text) !important; }
body[data-theme="pro"] hr { border-color: var(--gm8-border); opacity: 1; }

/* ── Empty state ───────────────────────────────────────────────────── */
body[data-theme="pro"] .gm8-empty {
  color: var(--gm8-muted);
  padding: 2rem;
  text-align: center;
}
body[data-theme="pro"] .gm8-empty i { font-size: 2rem; opacity: 0.4; }

/* ── Signal tape ──────────────────────────────────────────────────── */
body[data-theme="pro"] .signal-tape {
  background: var(--gm8-card);
  border: 1px solid var(--gm8-border);
  border-radius: 16px;
}
body[data-theme="pro"] .signal-tape .signal-row {
  border-bottom: 1px solid var(--gm8-border);
  padding: 0.7rem 1rem;
}
body[data-theme="pro"] .signal-tape .signal-row:hover { background: #f8f9fb; }

/* ── Professional theme — compact alarm cards + bounded scroll panes ── */
body[data-theme="pro"] .gm8-scroll-pane {
  padding-right: 0.5rem;
}
body[data-theme="pro"] .gm8-scroll-pane::-webkit-scrollbar { width: 8px; }
body[data-theme="pro"] .gm8-scroll-pane::-webkit-scrollbar-track { background: transparent; }
body[data-theme="pro"] .gm8-scroll-pane::-webkit-scrollbar-thumb { background: var(--gm8-border-hi); border-radius: 4px; }

body[data-theme="pro"] .alarm-card {
  background: var(--gm8-card);
  border: 1px solid var(--gm8-border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(20,22,40,0.04);
  margin-bottom: 0.55rem;
}
body[data-theme="pro"] .alarm-card-row {
  padding: 0.7rem 0.9rem;
  gap: 0.7rem;
}
body[data-theme="pro"] .alarm-card .alarm-type-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 1rem;
}
/* Pull all the per-alarm action sub-rows tighter */
body[data-theme="pro"] .alarm-card .btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}

/* Signal tape bound height too */
body[data-theme="pro"] .signal-tape {
  max-height: calc(100vh - 200px);
  display: flex; flex-direction: column;
}
body[data-theme="pro"] .signal-tape-body {
  max-height: none;     /* let flex parent control */
  font-family: var(--gm8-sans);
  font-size: 0.82rem;
}
body[data-theme="pro"] .signal-row { padding: 0.55rem 0.9rem; }
body[data-theme="pro"] .signal-row:hover { background: #f8f9fb; }

/* ============================================================================
   Alarm detail page redesign (professional theme)
   Breadcrumb · alarm hero · stepper · checklist progress · activity feed ·
   contacts list · camera card · audio silence
   ============================================================================ */

body[data-theme="pro"] .alarm-crumbs {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.85rem; color: var(--gm8-muted);
}
body[data-theme="pro"] .alarm-crumbs a {
  color: var(--gm8-text-dim); text-decoration: none; font-weight: 500;
}
body[data-theme="pro"] .alarm-crumbs a:hover { color: var(--gm8-blue); }
body[data-theme="pro"] .alarm-crumbs-sep { color: var(--gm8-border-hi); }
body[data-theme="pro"] .alarm-crumbs-current { color: var(--gm8-text); font-weight: 600; font-family: var(--gm8-sans); }

/* ── Alarm hero ───────────────────────────────────────────────── */
body[data-theme="pro"] .alarm-hero { padding: 1.5rem 1.5rem 1.25rem; position: relative; }
body[data-theme="pro"] .alarm-hero::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  border-radius: 16px 0 0 16px;
  background: var(--gm8-muted);
}
body[data-theme="pro"] .alarm-hero--critical::before { background: var(--gm8-red); }
body[data-theme="pro"] .alarm-hero--high::before     { background: var(--gm8-amber); }
body[data-theme="pro"] .alarm-hero--medium::before   { background: var(--gm8-gold); }

body[data-theme="pro"] .alarm-hero__top { display: flex; gap: 1.25rem; align-items: flex-start; }
body[data-theme="pro"] .alarm-hero__icon {
  width: 56px; height: 56px; border-radius: 14px;
  background: #f3f4f8; color: var(--gm8-text-dim);
  display: grid; place-items: center; font-size: 1.5rem; flex-shrink: 0;
}
body[data-theme="pro"] .alarm-hero--critical .alarm-hero__icon { background: #fde8e8; color: #b91c1c; }
body[data-theme="pro"] .alarm-hero--high .alarm-hero__icon     { background: #fff4e6; color: #b45309; }
body[data-theme="pro"] .alarm-hero--medium .alarm-hero__icon   { background: #fef9c3; color: #854d0e; }

body[data-theme="pro"] .alarm-hero__title { flex-grow: 1; min-width: 0; }
body[data-theme="pro"] .alarm-hero__site {
  font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em;
  color: var(--gm8-text); display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
body[data-theme="pro"] .alarm-hero__site a { color: var(--gm8-text); text-decoration: none; }
body[data-theme="pro"] .alarm-hero__site a:hover { color: var(--gm8-blue); }
body[data-theme="pro"] .alarm-hero__code {
  font-family: var(--gm8-sans); font-size: 0.9rem; font-weight: 500; color: var(--gm8-muted);
}
body[data-theme="pro"] .alarm-hero__chips {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}
body[data-theme="pro"] .alarm-hero__meta {
  font-size: 0.85rem; color: var(--gm8-muted); margin-left: 0.25rem;
}
body[data-theme="pro"] .alarm-hero__meta strong { color: var(--gm8-text-dim); font-weight: 600; }

body[data-theme="pro"] .alarm-hero__ref { text-align: right; flex-shrink: 0; }
body[data-theme="pro"] .alarm-hero__refnum {
  font-family: var(--gm8-sans); font-weight: 700; font-size: 1.1rem; color: var(--gm8-text);
  letter-spacing: -0.01em;
}
body[data-theme="pro"] .alarm-hero__reflbl {
  font-size: 0.7rem; text-transform: uppercase; color: var(--gm8-muted); letter-spacing: 0.06em;
}

body[data-theme="pro"] .alarm-hero__desc {
  margin: 1.1rem 0 0;
  font-size: 1rem; color: var(--gm8-text-dim); line-height: 1.5;
}

body[data-theme="pro"] .alarm-hero__instructions {
  margin-top: 1rem; padding: 0.85rem 1rem; display: flex; gap: 0.75rem;
  background: #fff8eb; border: 1px solid #fbeb8b; border-radius: 10px;
  color: #854d0e;
}
body[data-theme="pro"] .alarm-hero__instructions i { font-size: 1.1rem; }
body[data-theme="pro"] .alarm-hero__instructions-title {
  font-weight: 600; margin-bottom: 0.2rem;
}

/* ── Status stepper (RCV → ACK → END) ─────────────────────────── */
body[data-theme="pro"] .alarm-stepper {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0; list-style: none;
  margin: 1.25rem -1.5rem -1.25rem; padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--gm8-border);
  background: var(--gm8-card-hi);
  border-radius: 0 0 16px 16px;
}
body[data-theme="pro"] .alarm-stepper .step {
  display: flex; flex-direction: column; gap: 0.2rem;
  position: relative; padding-left: 1.5rem;
}
body[data-theme="pro"] .alarm-stepper .step .step-dot {
  position: absolute; left: 0; top: 0.4rem;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2px solid var(--gm8-border-hi);
}
body[data-theme="pro"] .alarm-stepper .step.done .step-dot {
  background: var(--gm8-green); border-color: var(--gm8-green);
}
body[data-theme="pro"] .alarm-stepper .step-label {
  font-size: 0.72rem; text-transform: uppercase; color: var(--gm8-muted); letter-spacing: 0.06em; font-weight: 600;
}
body[data-theme="pro"] .alarm-stepper .step-time {
  font-size: 0.85rem; color: var(--gm8-text);
}

/* ── Primary action banner ────────────────────────────────────── */
body[data-theme="pro"] .alarm-primary-action { padding: 1rem 1.4rem; }
body[data-theme="pro"] .alarm-primary-action .btn-primary {
  background: var(--gm8-blue); border-color: var(--gm8-blue); color: #fff;
  font-weight: 600; padding: 0.85rem 1.25rem; font-size: 1rem;
}
body[data-theme="pro"] .alarm-primary-action .btn-primary:hover { filter: brightness(1.08); color: #fff; }

/* ── Checklist progress ──────────────────────────────────────── */
body[data-theme="pro"] .alarm-checklist__progress {
  display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; font-weight: 500;
  color: var(--gm8-text-dim);
}
body[data-theme="pro"] .alarm-checklist__bar {
  width: 80px; height: 6px; border-radius: 3px; background: var(--gm8-border); overflow: hidden;
}
body[data-theme="pro"] .alarm-checklist__bar-fill {
  height: 100%; background: var(--gm8-green); transition: width 0.18s ease;
}
body[data-theme="pro"] .alarm-checklist__item {
  display: flex; gap: 0.85rem; align-items: flex-start; padding: 0.85rem 1.4rem;
}
body[data-theme="pro"] .alarm-checklist__item input[type=checkbox] { margin-top: 0.15rem; flex-shrink: 0; }
body[data-theme="pro"] .alarm-checklist__item .step-text { font-size: 0.95rem; color: var(--gm8-text); }
body[data-theme="pro"] .alarm-checklist__item.gm8-step-done .step-text {
  color: var(--gm8-muted); text-decoration: line-through;
}
body[data-theme="pro"] .alarm-checklist__meta {
  font-size: 0.78rem; color: var(--gm8-muted); margin-top: 0.2rem;
}

/* ── Activity timeline ────────────────────────────────────────── */
body[data-theme="pro"] .alarm-activity {
  list-style: none; padding: 0; margin: 0;
}
body[data-theme="pro"] .alarm-activity__item {
  position: relative; padding: 1rem 1.4rem 1rem 3rem;
  border-bottom: 1px solid var(--gm8-border);
}
body[data-theme="pro"] .alarm-activity__item:last-child { border-bottom: none; }
body[data-theme="pro"] .alarm-activity__dot {
  position: absolute; left: 1.4rem; top: 1.25rem;
  width: 10px; height: 10px; border-radius: 50%; background: var(--gm8-muted);
  box-shadow: 0 0 0 4px #fff, 0 0 0 5px var(--gm8-border);
}
body[data-theme="pro"] .alarm-activity__item--ack    .alarm-activity__dot { background: var(--gm8-amber); }
body[data-theme="pro"] .alarm-activity__item--sms    .alarm-activity__dot { background: var(--gm8-blue); }
body[data-theme="pro"] .alarm-activity__item--close  .alarm-activity__dot { background: var(--gm8-green); }
body[data-theme="pro"] .alarm-activity__item--cancel .alarm-activity__dot { background: var(--gm8-muted); }
body[data-theme="pro"] .alarm-activity__type { font-weight: 600; font-size: 0.92rem; }
body[data-theme="pro"] .alarm-activity__time { font-size: 0.78rem; color: var(--gm8-muted); font-variant-numeric: tabular-nums; }
body[data-theme="pro"] .alarm-activity__meta { font-size: 0.82rem; color: var(--gm8-muted); }
body[data-theme="pro"] .alarm-activity__notes {
  margin-top: 0.4rem; font-size: 0.88rem; color: var(--gm8-text-dim);
}

/* ── Site card (right column) ─────────────────────────────────── */
body[data-theme="pro"] .alarm-site__name { font-weight: 700; font-size: 1.05rem; }
body[data-theme="pro"] .alarm-site__code { font-size: 0.85rem; color: var(--gm8-muted); margin-bottom: 1rem; }
body[data-theme="pro"] .alarm-site__block { margin-top: 1rem; }
body[data-theme="pro"] .alarm-site__label {
  font-size: 0.75rem; text-transform: uppercase; color: var(--gm8-muted);
  letter-spacing: 0.06em; font-weight: 600; margin-bottom: 0.3rem;
}

/* ── Contacts list ────────────────────────────────────────────── */
body[data-theme="pro"] .alarm-contacts { list-style: none; padding: 0; margin: 0; }
body[data-theme="pro"] .alarm-contacts__item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.85rem 1.4rem;
  border-bottom: 1px solid var(--gm8-border);
}
body[data-theme="pro"] .alarm-contacts__item:last-child { border-bottom: none; }
body[data-theme="pro"] .alarm-contacts__order {
  width: 28px; height: 28px; border-radius: 8px;
  background: #eef0ff; color: #4338ca; display: grid; place-items: center;
  font-weight: 600; font-size: 0.8rem; flex-shrink: 0;
}
body[data-theme="pro"] .alarm-contacts__info { flex-grow: 1; min-width: 0; }
body[data-theme="pro"] .alarm-contacts__name { font-weight: 600; font-size: 0.92rem; color: var(--gm8-text); }
body[data-theme="pro"] .alarm-contacts__rel { font-size: 0.78rem; color: var(--gm8-muted); }
body[data-theme="pro"] .alarm-contacts__sms { color: var(--gm8-green); margin-left: 0.35rem; }
body[data-theme="pro"] .gm8-call-btn {
  background: var(--gm8-blue) !important; border-color: var(--gm8-blue) !important; color: #fff !important;
  white-space: nowrap; font-weight: 500;
}
body[data-theme="pro"] .gm8-call-btn:hover { filter: brightness(1.1); color: #fff !important; }

/* ── Camera ───────────────────────────────────────────────────── */
body[data-theme="pro"] .alarm-camera {
  border-radius: 10px; overflow: hidden; background: #f3f4f8; aspect-ratio: 16 / 9;
}
body[data-theme="pro"] .alarm-camera img { width: 100%; height: 100%; object-fit: cover; display: block; }
body[data-theme="pro"] .alarm-camera__empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--gm8-muted); gap: 0.4rem;
}
body[data-theme="pro"] .alarm-camera__empty i { font-size: 1.5rem; }

/* ── Raw payload ──────────────────────────────────────────────── */
body[data-theme="pro"] .alarm-raw-payload {
  background: #f3f4f8; color: var(--gm8-text-dim); border: 1px solid var(--gm8-border);
  border-radius: 8px; padding: 0.85rem; font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 0.82rem; white-space: pre-wrap; max-height: 14rem; overflow: auto; margin: 0;
}

/* ============================================================================
   Incident workspace — PagerDuty-style operator console
   Sticky header · left workflow rail · center work area · right resources rail
   ============================================================================ */

/* ── Sticky incident header ─────────────────────────────────────────── */
body[data-theme="pro"] .incident-header {
  position: sticky;
  top: 60px;            /* sits below the global topbar (60px tall) */
  z-index: 20;
  background: #ffffff;
  border: 1px solid var(--gm8-border);
  border-radius: 14px;
  padding: 0.9rem 1.1rem;
  margin: -0.75rem 0 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1.5rem;
  align-items: center;
  box-shadow: 0 4px 16px rgba(20,22,40,0.04), 0 1px 3px rgba(20,22,40,0.04);
}
body[data-theme="pro"] .incident-header::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  border-radius: 14px 0 0 14px; background: var(--gm8-muted);
}
body[data-theme="pro"] .incident-header--critical::before { background: var(--gm8-red); }
body[data-theme="pro"] .incident-header--high::before     { background: var(--gm8-amber); }
body[data-theme="pro"] .incident-header--medium::before   { background: var(--gm8-gold); }

body[data-theme="pro"] .incident-header__left {
  display: flex; align-items: center; gap: 1rem; min-width: 0;
}
body[data-theme="pro"] .incident-header__back {
  width: 36px; height: 36px; border-radius: 10px;
  background: #f3f4f8; color: var(--gm8-text-dim);
  display: grid; place-items: center; text-decoration: none;
  font-size: 1.1rem; flex-shrink: 0;
  transition: background 120ms ease;
}
body[data-theme="pro"] .incident-header__back:hover { background: var(--gm8-blue); color: #fff; }
body[data-theme="pro"] .incident-header__icon {
  width: 44px; height: 44px; border-radius: 11px;
  background: #f3f4f8; color: var(--gm8-text-dim);
  display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0;
}
body[data-theme="pro"] .incident-header--critical .incident-header__icon { background: #fde8e8; color: #b91c1c; }
body[data-theme="pro"] .incident-header--high .incident-header__icon     { background: #fff4e6; color: #b45309; }
body[data-theme="pro"] .incident-header--medium .incident-header__icon   { background: #fef9c3; color: #854d0e; }

body[data-theme="pro"] .incident-header__title { min-width: 0; }
body[data-theme="pro"] .incident-header__event {
  font-size: 1.2rem; font-weight: 700; letter-spacing: -0.015em;
  color: var(--gm8-text); line-height: 1.2;
}
body[data-theme="pro"] .incident-header__site {
  font-size: 0.9rem; font-weight: 500;
  color: var(--gm8-text-dim);
  display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; line-height: 1.2;
  margin-top: 0.15rem;
}
body[data-theme="pro"] .incident-header__code {
  font-weight: 500; font-size: 0.85rem; color: var(--gm8-muted);
}
body[data-theme="pro"] .incident-header__meta {
  font-size: 0.8rem; color: var(--gm8-muted); margin-top: 0.2rem;
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}
body[data-theme="pro"] .incident-header__meta strong { color: var(--gm8-text-dim); font-weight: 600; }
body[data-theme="pro"] .incident-header__type { font-weight: 600; color: var(--gm8-text); }
body[data-theme="pro"] .incident-header__dot {
  width: 4px; height: 4px; border-radius: 50%; background: var(--gm8-border-hi);
}

body[data-theme="pro"] .incident-header__center {
  display: flex; align-items: center; gap: 0.75rem;
}
body[data-theme="pro"] .incident-status {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.35rem 0.75rem; border-radius: 999px;
}
body[data-theme="pro"] .incident-status--pending   { background: #fde8e8; color: #b91c1c; }
body[data-theme="pro"] .incident-status--progress  { background: #fef9c3; color: #854d0e; }
body[data-theme="pro"] .incident-status--closed    { background: #e8faf0; color: #047857; }
body[data-theme="pro"] .incident-status--cancelled { background: #f3f4f8; color: #4b5163; }
body[data-theme="pro"] .incident-age {
  font-size: 0.85rem; color: var(--gm8-text-dim); font-weight: 500;
  background: #f3f4f8; padding: 0.35rem 0.75rem; border-radius: 999px;
  display: inline-flex; align-items: center;
}

body[data-theme="pro"] .incident-header__right {
  display: flex; align-items: center; gap: 0.85rem;
}
body[data-theme="pro"] .incident-header__ref {
  font-family: var(--gm8-sans); font-weight: 700; font-size: 0.95rem;
  color: var(--gm8-muted); letter-spacing: -0.005em;
}
body[data-theme="pro"] .incident-header__ack {
  background: var(--gm8-blue); border-color: var(--gm8-blue); color: #fff;
  font-weight: 600; padding: 0.6rem 1.4rem; font-size: 0.95rem;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(79,70,229,0.25);
}
body[data-theme="pro"] .incident-header__ack:hover { filter: brightness(1.08); color: #fff; }
body[data-theme="pro"] .incident-kbd {
  background: rgba(255,255,255,0.2); color: inherit;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 4px; padding: 0.05rem 0.35rem; font-size: 0.7rem; font-weight: 500;
}
body[data-theme="pro"] .incident-resolved {
  font-weight: 600; color: var(--gm8-green); font-size: 0.95rem;
}

/* ── 3-column workspace ──────────────────────────────────────────── */
body[data-theme="pro"] .incident-workspace {
  display: grid;
  grid-template-columns: 220px 1fr 320px;
  gap: 1.25rem;
  align-items: start;
}
body[data-theme="pro"] .incident-workspace > * { min-width: 0; }
/* Breakpoints account for the 224px sidebar still being visible ≥992px:
   at 1366 viewport the content area is ~1100px — too narrow for 3 columns;
   at 1180 it's ~940px — too narrow for a side rail at all. */
@media (max-width: 1366px) {
  body[data-theme="pro"] .incident-workspace { grid-template-columns: 200px minmax(0, 1fr); }
  body[data-theme="pro"] .incident-rail--right { grid-column: 2; }
}
@media (max-width: 1180px) {
  body[data-theme="pro"] .incident-workspace { grid-template-columns: 1fr; }
  body[data-theme="pro"] .incident-rail--left,
  body[data-theme="pro"] .incident-rail--right { grid-column: 1; position: static; }
  /* Work area first — operators need Actions/Dispatch above the fold, not a
     full-height workflow timeline. Rails follow after the main column. */
  body[data-theme="pro"] .incident-main { order: 1; }
  body[data-theme="pro"] .incident-rail--left { order: 2; }
  body[data-theme="pro"] .incident-rail--right { order: 3; }
}
/* Stacked left rail (tablet): workflow and checklist side by side instead of
   one long column. Children are flat siblings, so place them explicitly. */
@media (min-width: 641px) and (max-width: 1180px) {
  body[data-theme="pro"] .incident-rail.incident-rail--left {
    display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr);
    column-gap: 1.75rem; grid-template-rows: auto auto 1fr;
    align-items: start;
  }
  body[data-theme="pro"] .incident-rail--left > .incident-rail__title:first-child { grid-column: 1; grid-row: 1; }
  body[data-theme="pro"] .incident-rail--left > .incident-workflow { grid-column: 1; grid-row: 2 / span 2; }
  body[data-theme="pro"] .incident-rail--left > .incident-workflow ~ .incident-rail__title { grid-column: 2; grid-row: 1; }
  body[data-theme="pro"] .incident-rail--left > .incident-checklist-progress { grid-column: 2; grid-row: 2; }
  body[data-theme="pro"] .incident-rail--left > .incident-checklist { grid-column: 2; grid-row: 3; }
}

/* Tablet header (769–1366): the desktop `1fr auto auto` grid crushes the
   title once status/ref/ack eat the width — wrap instead. */
@media (min-width: 769px) and (max-width: 1366px) {
  body[data-theme="pro"] .incident-header {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 0.6rem 1rem;
  }
  body[data-theme="pro"] .incident-header__left { flex: 1 1 300px; }
  body[data-theme="pro"] .incident-header__right { margin-left: auto; }
}

/* ── Rails ──────────────────────────────────────────────────────── */
body[data-theme="pro"] .incident-rail {
  display: flex; flex-direction: column; gap: 0.5rem;
  position: sticky; top: 140px; align-self: start;
}
body[data-theme="pro"] .incident-rail__title {
  font-size: 0.7rem; text-transform: uppercase; color: var(--gm8-muted);
  letter-spacing: 0.07em; font-weight: 700; margin: 0.75rem 0 0.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
body[data-theme="pro"] .incident-rail__count {
  font-size: 0.78rem; color: var(--gm8-text-dim); font-weight: 600;
  text-transform: none; letter-spacing: 0;
}

/* Workflow stepper (left rail) */
body[data-theme="pro"] .incident-workflow {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column;
}
body[data-theme="pro"] .incident-workflow .step {
  display: flex; gap: 0.75rem; padding: 0.5rem 0; position: relative;
}
body[data-theme="pro"] .incident-workflow .step:not(:last-child)::after {
  content: ''; position: absolute; left: 6px; top: 1.5rem; bottom: -0.5rem;
  width: 2px; background: var(--gm8-border);
}
body[data-theme="pro"] .incident-workflow .step.done:not(:last-child)::after { background: var(--gm8-green); }
body[data-theme="pro"] .incident-workflow .step .step-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 2px solid var(--gm8-border-hi); flex-shrink: 0; margin-top: 0.2rem;
  position: relative; z-index: 1;
}
body[data-theme="pro"] .incident-workflow .step.done .step-dot {
  background: var(--gm8-green); border-color: var(--gm8-green);
}
body[data-theme="pro"] .incident-workflow .step.current .step-dot {
  background: var(--gm8-blue); border-color: var(--gm8-blue);
  box-shadow: 0 0 0 4px rgba(79,70,229,0.18);
}
body[data-theme="pro"] .incident-workflow .step-name {
  font-size: 0.85rem; font-weight: 600; color: var(--gm8-text);
}
body[data-theme="pro"] .incident-workflow .step:not(.done):not(.current) .step-name { color: var(--gm8-muted); }
body[data-theme="pro"] .incident-workflow .step-time {
  font-size: 0.72rem; color: var(--gm8-muted); margin-top: 0.15rem; line-height: 1.35;
}

/* Checklist in left rail */
body[data-theme="pro"] .incident-checklist-progress {
  height: 4px; background: var(--gm8-border); border-radius: 2px; overflow: hidden;
  margin-bottom: 0.5rem;
}
body[data-theme="pro"] .incident-checklist-progress__bar {
  height: 100%; background: var(--gm8-green); transition: width 0.18s ease;
}
body[data-theme="pro"] .incident-checklist {
  list-style: none; padding: 0; margin: 0;
}
body[data-theme="pro"] .incident-checklist__item {
  display: flex; gap: 0.55rem; align-items: flex-start; padding: 0.4rem 0;
  font-size: 0.83rem; line-height: 1.35; color: var(--gm8-text);
}
body[data-theme="pro"] .incident-checklist__item input { margin-top: 0.15rem; flex-shrink: 0; }
body[data-theme="pro"] .incident-checklist__item.done span {
  color: var(--gm8-muted); text-decoration: line-through;
}

/* ── Center main panels ─────────────────────────────────────────── */
body[data-theme="pro"] .incident-main {
  display: flex; flex-direction: column; gap: 1rem; min-width: 0;
}
body[data-theme="pro"] .incident-panel {
  background: #ffffff;
  border: 1px solid var(--gm8-border);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(20,22,40,0.04);
  overflow: hidden;
}
body[data-theme="pro"] .incident-panel__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid var(--gm8-border);
  gap: 0.75rem;
}
body[data-theme="pro"] .incident-panel__header h2 {
  font-size: 0.95rem; font-weight: 600; margin: 0; color: var(--gm8-text);
  letter-spacing: -0.005em;
  display: flex; align-items: center;
}
body[data-theme="pro"] .incident-panel__hint {
  font-size: 0.78rem; color: var(--gm8-muted);
}
body[data-theme="pro"] .incident-panel__actions {
  display: flex; gap: 0.5rem;
}
body[data-theme="pro"] .incident-panel__body { padding: 1.1rem 1.2rem; }

/* Event details */
body[data-theme="pro"] .incident-description {
  font-size: 1rem; line-height: 1.55; color: var(--gm8-text-dim); margin: 0 0 0.85rem;
}
body[data-theme="pro"] .incident-instructions {
  display: flex; gap: 0.75rem; padding: 0.85rem 1rem;
  background: #fff8eb; border: 1px solid #fbeb8b; border-radius: 10px;
  color: #854d0e;
}
body[data-theme="pro"] .incident-instructions i { font-size: 1.1rem; flex-shrink: 0; }
body[data-theme="pro"] .incident-instructions__title { font-weight: 600; margin-bottom: 0.2rem; }
body[data-theme="pro"] .incident-raw { margin-top: 0.85rem; }
body[data-theme="pro"] .incident-raw summary {
  cursor: pointer; font-size: 0.85rem; color: var(--gm8-muted); font-weight: 500;
}
body[data-theme="pro"] .incident-raw pre {
  margin: 0.5rem 0 0; background: #f3f4f8; border: 1px solid var(--gm8-border);
  border-radius: 8px; padding: 0.75rem; font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 0.78rem; color: var(--gm8-text-dim); white-space: pre-wrap; max-height: 12rem; overflow: auto;
}

/* CCTV — prominent */
body[data-theme="pro"] .incident-cctv {
  background: #0a0a0a; aspect-ratio: 16 / 9;
  position: relative; display: flex; align-items: center; justify-content: center;
}
body[data-theme="pro"] .incident-cctv img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
body[data-theme="pro"] .incident-cctv__empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: #6a6a6a; gap: 0.5rem;
}
body[data-theme="pro"] .incident-cctv__empty i { font-size: 2.5rem; }

/* Quick-action grid — one-click big buttons */
body[data-theme="pro"] .incident-quick-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem; margin-bottom: 1rem;
}
body[data-theme="pro"] .incident-quick-grid__item { display: flex; }
body[data-theme="pro"] .incident-quick-btn {
  flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
  background: #fff; border: 1px solid var(--gm8-border-hi); border-radius: 12px;
  padding: 1rem 0.85rem; cursor: pointer;
  font-size: 0.88rem; font-weight: 600; color: var(--gm8-text);
  transition: all 120ms ease;
}
body[data-theme="pro"] .incident-quick-btn i { font-size: 1.5rem; color: var(--gm8-text-dim); }
body[data-theme="pro"] .incident-quick-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(20,22,40,0.08);
  border-color: var(--gm8-text-dim);
}
body[data-theme="pro"] .incident-quick-btn--critical { border-color: #f9c3c3; }
body[data-theme="pro"] .incident-quick-btn--critical i { color: #b91c1c; }
body[data-theme="pro"] .incident-quick-btn--critical:hover { background: #fef2f2; border-color: var(--gm8-red); }
body[data-theme="pro"] .incident-quick-btn--high { border-color: #fde4c0; }
body[data-theme="pro"] .incident-quick-btn--high i { color: #b45309; }
body[data-theme="pro"] .incident-quick-btn--high:hover { background: #fff8eb; border-color: var(--gm8-amber); }
body[data-theme="pro"] .incident-quick-btn--medium { border-color: #fbeb8b; }
body[data-theme="pro"] .incident-quick-btn--medium i { color: #854d0e; }
body[data-theme="pro"] .incident-quick-btn--medium:hover { background: #fefce8; border-color: var(--gm8-gold); }

body[data-theme="pro"] .incident-quick-detailed { margin-top: 0.5rem; }
body[data-theme="pro"] .incident-quick-detailed summary {
  cursor: pointer; padding: 0.65rem 0.85rem; border-radius: 8px;
  background: #f8f9fb; color: var(--gm8-text-dim); font-size: 0.85rem; font-weight: 500;
  list-style: none;
}
body[data-theme="pro"] .incident-quick-detailed summary::-webkit-details-marker { display: none; }
body[data-theme="pro"] .incident-quick-detailed summary::before {
  content: '+'; display: inline-block; margin-right: 0.5rem; font-weight: 600;
  width: 16px; text-align: center;
}
body[data-theme="pro"] .incident-quick-detailed[open] summary::before { content: '−'; }
body[data-theme="pro"] .incident-quick-detailed[open] summary { background: #eef0ff; color: #4338ca; }
body[data-theme="pro"] .incident-quick-detailed__form { padding: 1rem 0.5rem 0.25rem; }

/* Activity feed */
body[data-theme="pro"] .incident-activity {
  list-style: none; padding: 0.5rem 0; margin: 0;
}
body[data-theme="pro"] .incident-activity__item {
  position: relative; padding: 0.85rem 1.2rem 0.85rem 3rem;
  border-bottom: 1px solid var(--gm8-border);
}
body[data-theme="pro"] .incident-activity__item:last-child { border-bottom: none; }
body[data-theme="pro"] .incident-activity__item:not(:last-child)::after {
  content: ''; position: absolute; left: calc(1.2rem + 4px); top: 1.5rem; bottom: -0.85rem;
  width: 2px; background: var(--gm8-border);
}
body[data-theme="pro"] .incident-activity__dot {
  position: absolute; left: 1.2rem; top: 1rem;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--gm8-muted); border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--gm8-border);
  z-index: 1;
}
body[data-theme="pro"] .incident-activity__item--receive   .incident-activity__dot { background: var(--gm8-muted); }
body[data-theme="pro"] .incident-activity__item--ack       .incident-activity__dot { background: var(--gm8-amber); }
body[data-theme="pro"] .incident-activity__item--dispatch  .incident-activity__dot { background: var(--gm8-red); }
body[data-theme="pro"] .incident-activity__item--call      .incident-activity__dot { background: var(--gm8-blue); }
body[data-theme="pro"] .incident-activity__item--sms       .incident-activity__dot { background: var(--gm8-blue); }
body[data-theme="pro"] .incident-activity__item--close     .incident-activity__dot { background: var(--gm8-green); }
body[data-theme="pro"] .incident-activity__item--cancel    .incident-activity__dot { background: var(--gm8-muted); }
body[data-theme="pro"] .incident-activity__item--note      .incident-activity__dot { background: var(--gm8-violet); }
body[data-theme="pro"] .incident-activity__header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.2rem;
}
body[data-theme="pro"] .incident-activity__type { font-weight: 600; font-size: 0.9rem; color: var(--gm8-text); }
body[data-theme="pro"] .incident-activity__time { font-size: 0.75rem; color: var(--gm8-muted); font-variant-numeric: tabular-nums; }
body[data-theme="pro"] .incident-activity__meta { font-size: 0.8rem; color: var(--gm8-muted); }
body[data-theme="pro"] .incident-activity__notes {
  margin-top: 0.45rem; font-size: 0.88rem; color: var(--gm8-text-dim);
  padding: 0.5rem 0.7rem; background: #f8f9fb; border-radius: 6px;
}

/* Inline table */
body[data-theme="pro"] .incident-table {
  width: 100%; border-collapse: collapse;
}
body[data-theme="pro"] .incident-table thead th {
  padding: 0.65rem 1rem; text-align: left;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--gm8-muted); font-weight: 600;
  border-bottom: 1px solid var(--gm8-border);
}
body[data-theme="pro"] .incident-table tbody td {
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--gm8-border);
  font-size: 0.88rem;
}
body[data-theme="pro"] .incident-table tbody tr:last-child td { border-bottom: none; }
body[data-theme="pro"] .incident-table tbody tr:hover { background: #f8f9fb; }

/* ── Right rail resources ──────────────────────────────────────── */
body[data-theme="pro"] .incident-resource {
  background: #fff;
  border: 1px solid var(--gm8-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(20,22,40,0.03);
}
body[data-theme="pro"] .incident-resource__title {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gm8-border);
  font-size: 0.8rem; font-weight: 600; color: var(--gm8-text-dim);
  text-transform: uppercase; letter-spacing: 0.04em;
}
body[data-theme="pro"] .incident-resource__link {
  margin-left: auto; color: var(--gm8-muted); text-decoration: none; font-size: 0.85rem;
}
body[data-theme="pro"] .incident-resource__link:hover { color: var(--gm8-blue); }
body[data-theme="pro"] .incident-resource__pill {
  margin-left: auto; background: #fef9c3; color: #854d0e; border-radius: 999px;
  padding: 0.2rem 0.55rem; font-size: 0.7rem; font-weight: 500; text-transform: none; letter-spacing: 0;
}
body[data-theme="pro"] .incident-resource__body { padding: 0.85rem 1rem; }
body[data-theme="pro"] .incident-resource__primary { font-weight: 700; font-size: 1rem; color: var(--gm8-text); }
body[data-theme="pro"] .incident-resource__sub { font-size: 0.82rem; color: var(--gm8-muted); margin-bottom: 0.75rem; }
body[data-theme="pro"] .incident-resource__block { margin-top: 0.75rem; font-size: 0.85rem; color: var(--gm8-text-dim); }
body[data-theme="pro"] .incident-resource__label {
  font-size: 0.7rem; text-transform: uppercase; color: var(--gm8-muted);
  letter-spacing: 0.06em; font-weight: 600; margin-bottom: 0.2rem;
}

/* Contacts in right rail */
body[data-theme="pro"] .incident-contacts {
  list-style: none; padding: 0; margin: 0;
}
body[data-theme="pro"] .incident-contact {
  padding: 0.75rem 1rem; border-bottom: 1px solid var(--gm8-border);
}
body[data-theme="pro"] .incident-contact:last-child { border-bottom: none; }
body[data-theme="pro"] .incident-contact__row {
  display: flex; align-items: center; gap: 0.65rem; margin-bottom: 0.55rem;
}
body[data-theme="pro"] .incident-contact__order {
  width: 26px; height: 26px; border-radius: 7px;
  background: #eef0ff; color: #4338ca; display: grid; place-items: center;
  font-weight: 600; font-size: 0.78rem; flex-shrink: 0;
}
body[data-theme="pro"] .incident-contact__name { font-weight: 600; font-size: 0.88rem; color: var(--gm8-text); }
body[data-theme="pro"] .incident-contact__rel { font-size: 0.75rem; color: var(--gm8-muted); }
body[data-theme="pro"] .incident-contact__sms { color: var(--gm8-green); margin-left: 0.35rem; font-size: 0.85rem; }
body[data-theme="pro"] .incident-contact__call {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 0.55rem 0.75rem;
  background: var(--gm8-blue); color: #fff; text-decoration: none;
  border-radius: 8px; font-size: 0.88rem; font-weight: 600;
  transition: filter 120ms ease;
}
body[data-theme="pro"] .incident-contact__call:hover { filter: brightness(1.08); color: #fff; }

/* ============================================================================
   Heading + label cleanup pass (professional theme)
   Kill the dated UPPERCASE-MONO-WITH-LETTER-SPACING look across labels,
   table headers, section-heads, settings rows. Sentence case · sans · soft.
   ============================================================================ */
body[data-theme="pro"] .form-label,
body[data-theme="pro"] .alarm-site__label,
body[data-theme="pro"] .incident-resource__label,
body[data-theme="pro"] .incident-rail__title,
body[data-theme="pro"] .alarm-hero__reflbl,
body[data-theme="pro"] .section-head h5,
body[data-theme="pro"] .nav-section-label {
  font-family: var(--gm8-sans) !important;
  font-size: 0.82rem !important;
  font-weight: 500 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  color: var(--gm8-text-dim) !important;
}

body[data-theme="pro"] .incident-rail__title,
body[data-theme="pro"] .incident-resource__title,
body[data-theme="pro"] .alarm-hero__reflbl {
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  color: var(--gm8-muted) !important;
}

body[data-theme="pro"] .section-head h5 {
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: var(--gm8-text) !important;
  letter-spacing: -0.01em !important;
}

/* Sidebar section labels (Operations / Admin) — keep subtle uppercase, but smaller */
body[data-theme="pro"] .nav-section-label {
  font-size: 0.68rem !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  color: #6b7080 !important;
}

/* Table column headers — sentence case, no uppercase */
body[data-theme="pro"] .incident-table thead th,
body[data-theme="pro"] .table-dark thead th,
body[data-theme="pro"] .gm8-dense thead th {
  font-family: var(--gm8-sans) !important;
  font-size: 0.78rem !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-weight: 600 !important;
  color: var(--gm8-text-dim) !important;
}

/* Incident-resource title bar — slightly larger, no uppercase */
body[data-theme="pro"] .incident-resource__title {
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 0.92rem !important;
  font-weight: 600 !important;
  color: var(--gm8-text) !important;
}

/* Card headers — already sentence case, just normalise size */
body[data-theme="pro"] .gm8-card .card-header {
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
}

/* Activity feed "type" labels — title case looks better than the JINJA |title pipe doing weird things */
body[data-theme="pro"] .incident-activity__type {
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-weight: 600 !important;
}

/* Step labels on the workflow stepper */
body[data-theme="pro"] .incident-workflow .step-name {
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
}

/* Pills + status — keep these uppercase since they're tiny pills, not labels */
/* (intentionally no override for .incident-status, .alarm-type-badge) */

/* ══════════════════════════════════════════════════════════════════════════
   Customizable widget dashboard (Gridstack) + grouped incident cards
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.dash-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin: 0.1rem 0 0.6rem; flex-wrap: wrap;
}
.dash-toolbar-title { display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap; }
.dash-toolbar-actions { display: flex; gap: 0.4rem; align-items: center; }

/* ── Grid + widget chrome ────────────────────────────────────────────────── */
.gm8-grid { background: transparent; }
.gm8-widget {
  position: relative; height: 100%; overflow: hidden;
  background: var(--gm8-card); border: 1px solid var(--gm8-border);
  border-radius: 12px; padding: 0.7rem 0.8rem;
  display: flex; flex-direction: column;
}
.gm8-widget-metric { padding: 0; border: none; background: transparent; }
.gm8-widget .widget-inner { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.widget-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; margin-bottom: 0.5rem; flex: 0 0 auto;
}
.widget-head h6 { margin: 0; font-size: 0.9rem; font-weight: 700; }
.widget-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-right: 0.3rem; }
.legend-swatch { display: inline-block; width: 9px; height: 3px; vertical-align: middle; border-radius: 2px; }

/* metric tile fills its grid cell */
.kpi-widget { height: 100%; display: flex; flex-direction: column; justify-content: center; }

/* Remove (×) button — only visible in edit mode */
.widget-remove {
  position: absolute; top: 6px; right: 6px; z-index: 5;
  width: 26px; height: 26px; border-radius: 50%; display: none;
  align-items: center; justify-content: center; cursor: pointer;
  background: var(--gm8-red); color: #fff; border: none; font-size: 0.7rem;
}
body.dash-editing .widget-remove { display: inline-flex; }
body.dash-editing .gm8-widget { cursor: move; outline: 1px dashed var(--gm8-border-hi); }
body.dash-editing .gm8-widget::after {
  content: ''; position: absolute; inset: 0; background: rgba(244,154,43,0.04); pointer-events: none;
}
.grid-stack-item-content { inset: 0; }
/* Gridstack's stylesheet (loaded after ours) sets .grid-stack-item-content
   overflow-y:auto, which put an ugly scrollbar on every widget. Two classes
   here out-specify it so widgets clip to their border; list widgets still
   scroll via their inner .widget-scroll child. */
.grid-stack-item-content.gm8-widget { overflow: hidden; }
/* Metric tiles fill their cell and centre cleanly with no overflow. */
.gm8-widget-metric .kpi-tile { height: 100%; display: flex; flex-direction: column;
  justify-content: center; border: none; border-radius: 12px; }

/* ── Grouped incident card extras ────────────────────────────────────────── */
.alarm-card.alarm-incident { border-left-width: 5px; }
.incident-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.72rem; font-weight: 700; padding: 0.08rem 0.45rem;
  border-radius: 999px; background: rgba(76,158,255,0.14);
  color: var(--gm8-blue, #4c9eff); border: 1px solid rgba(76,158,255,0.3);
}
.incident-more { margin-top: 0.1rem; }
.incident-more > summary {
  list-style: none; cursor: pointer; font-size: 0.78rem; color: var(--gm8-text-dim);
  display: inline-flex; align-items: center; gap: 0.35rem; user-select: none;
  padding: 0.15rem 0; outline: none;
}
.incident-more > summary::-webkit-details-marker { display: none; }
.incident-more .toggle-caret { transition: transform 0.15s; }
.incident-more[open] .toggle-caret { transform: rotate(90deg); }
.incident-list { list-style: none; margin: 0.3rem 0 0; padding: 0; border-left: 2px solid var(--gm8-border); }
.incident-item {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.28rem 0.5rem;
  font-size: 0.78rem; border-bottom: 1px solid var(--gm8-border);
}
.incident-item:last-child { border-bottom: none; }
.incident-pip { width: 8px; height: 8px; border-radius: 50%; background: var(--gm8-muted); flex: 0 0 auto; }
.incident-time { color: var(--gm8-muted); white-space: nowrap; min-width: 62px; }
.incident-type { font-size: 0.62rem; padding: 0.02rem 0.3rem; }
.incident-desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--gm8-text-dim); }
.incident-open { color: var(--gm8-muted); flex: 0 0 auto; }
.incident-open:hover { color: var(--gm8-text); }

/* New / merged card flash */
.alarm-card.card-flash { animation: gm8-card-flash 1.2s ease-out; }
@keyframes gm8-card-flash {
  0% { box-shadow: 0 0 0 2px var(--gm8-amber); background: rgba(244,154,43,0.10); }
  100% { box-shadow: none; }
}

/* ── Compact density ─────────────────────────────────────────────────────── */
.gm8-density-compact .alarm-card { padding: 0.45rem 0.6rem; }
.gm8-density-compact .alarm-card-row { gap: 0.5rem; }
.gm8-density-compact .alarm-type-icon { width: 30px; height: 30px; }
.gm8-density-compact .alarm-card .text-muted.small { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Modals (lightweight, no bootstrap dependency) ───────────────────────── */
.dash-modal {
  position: fixed; inset: 0; z-index: 1200; display: flex;
  align-items: flex-start; justify-content: center; padding: 6vh 1rem;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(2px);
}
.dash-modal[hidden] { display: none; }
.dash-modal-card {
  background: var(--gm8-card); border: 1px solid var(--gm8-border);
  border-radius: 14px; width: 100%; max-width: 540px; max-height: 86vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.dash-modal-head, .dash-modal-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 1rem; border-bottom: 1px solid var(--gm8-border);
}
.dash-modal-foot { border-bottom: none; border-top: 1px solid var(--gm8-border); gap: 0.5rem; justify-content: flex-end; }
.dash-modal-body { padding: 0.9rem 1rem; overflow-y: auto; }

.settings-section { margin-bottom: 1.1rem; }
.settings-title {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--gm8-muted); font-weight: 700; margin-bottom: 0.45rem;
  border-bottom: 1px solid var(--gm8-border); padding-bottom: 0.25rem;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.8rem; padding: 0.32rem 0; font-size: 0.86rem;
}
.settings-row > span:first-child { color: var(--gm8-text-dim); }
.settings-check { cursor: pointer; }
.settings-check input { width: 1.1rem; height: 1.1rem; }

/* Widget palette */
.widget-palette { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.palette-item {
  display: flex; align-items: center; gap: 0.5rem; text-align: left;
  padding: 0.6rem 0.7rem; border-radius: 10px; cursor: pointer;
  background: var(--gm8-card-hi); border: 1px solid var(--gm8-border); color: var(--gm8-text);
  font-size: 0.84rem;
}
.palette-item:hover { border-color: var(--gm8-amber); background: var(--gm8-card); }
.palette-item i { color: var(--gm8-amber); }
.palette-item span { flex: 1; }

@media (max-width: 640px) { .widget-palette { grid-template-columns: 1fr; } }

/* ── Operator console on phones ──────────────────────────────────────────────
   Gridstack collapses to one column < 768px, which blows every widget — incl.
   the four KPI tiles — up to full-width, tall blocks. Take over its absolute
   layout here: flow the grid as a real 2-up CSS grid (KPI tiles half-width,
   panels full-width, packed densely), and size everything to content so the
   page scrolls naturally instead of each tile eating a screen. */
@media (max-width: 768px) {
  #dashGrid.grid-stack {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    grid-auto-flow: row dense;
    gap: 10px;
    height: auto !important;
  }
  #dashGrid .grid-stack-item {
    position: relative !important;
    left: auto !important; top: auto !important;
    width: auto !important; height: auto !important;
    min-height: 0 !important; max-width: none !important;
    transform: none !important; inset: auto !important; margin: 0 !important;
  }
  #dashGrid .grid-stack-item > .grid-stack-item-content {
    position: relative !important; inset: auto !important; height: 100%;
  }
  /* KPI tiles → two per row */
  #dashGrid .grid-stack-item:has(.gm8-widget-metric) { grid-column: span 1; }
  #dashGrid .grid-stack-item:has(.gm8-widget-metric) .gm8-widget-metric { min-height: 84px; }
  /* Queue, lists, charts → full width, sized to content (cap very long lists) */
  #dashGrid .grid-stack-item:not(:has(.gm8-widget-metric)) { grid-column: 1 / -1; }
  #dashGrid .grid-stack-item:not(:has(.gm8-widget-metric)) .gm8-widget { min-height: 150px; }
  #dashGrid .widget-scroll { max-height: 68vh; }

  /* Compact KPI typography so two tiles sit comfortably side by side */
  body[data-theme="pro"] .kpi-tile { padding: 0.8rem 0.9rem; border-radius: 14px; }
  body[data-theme="pro"] .kpi-tile .kpi-value { font-size: 1.65rem; }
  body[data-theme="pro"] .kpi-tile .kpi-label { font-size: 0.72rem; margin-bottom: 0.15rem; }

  /* Toolbar: let the action buttons share the row evenly under the title */
  .dash-toolbar { gap: 0.55rem; margin-bottom: 0.5rem; }
  .dash-toolbar-actions { width: 100%; flex-wrap: wrap; gap: 0.4rem; }
  .dash-toolbar-actions .btn { flex: 1 1 auto; justify-content: center; }

  /* Topbar: tighten so the live "Active" alarm button never clips off-screen */
  .topbar { padding-left: 0.7rem !important; padding-right: 0.7rem !important; gap: 0.5rem !important; }
  .topbar .ms-auto { gap: 0.5rem !important; }
  .audio-toggle-label { display: none; }
  .topbar-clock { display: none; }
  .pulse-alarm { white-space: nowrap; flex: 0 0 auto; }
}

/* ── Incident detail page on phones ──────────────────────────────────────────
   The sticky header is a 3-column grid (title | status+age | ref+ack) that has
   no narrow breakpoint, so on a phone the columns overlap, the site name clips
   mid-word and the Acknowledge button runs off-screen. Stack it. The "Recent at
   this site" table also can't fit 5 columns — turn it into stacked label/value
   cards instead of a clipped sideways-scroll. */
@media (max-width: 768px) {
  body[data-theme="pro"] .incident-header {
    position: static;                /* don't eat screen height when stacked */
    grid-template-columns: 1fr;      /* one column, stacked */
    gap: 0.75rem;
    padding: 0.85rem 0.95rem;
    margin: -0.25rem 0 1rem;
  }
  body[data-theme="pro"] .incident-header__left { gap: 0.7rem; }
  body[data-theme="pro"] .incident-header__event { font-size: 1.05rem; }
  body[data-theme="pro"] .incident-header__center { flex-wrap: wrap; }
  body[data-theme="pro"] .incident-header__right {
    flex-wrap: wrap; width: 100%; gap: 0.6rem;
    justify-content: space-between;
  }
  body[data-theme="pro"] .incident-header__right form { flex: 1 1 100%; }
  body[data-theme="pro"] .incident-header__right .btn-group { flex: 1 1 100%; display: flex; }
  body[data-theme="pro"] .incident-header__right .btn-group .btn { flex: 1 1 0; }
  body[data-theme="pro"] .incident-header__ack { width: 100%; justify-content: center; }

  /* Recent-at-site table → stacked cards (no sideways scroll, nothing clipped) */
  body[data-theme="pro"] .incident-table thead { display: none; }
  body[data-theme="pro"] .incident-table,
  body[data-theme="pro"] .incident-table tbody,
  body[data-theme="pro"] .incident-table tr,
  body[data-theme="pro"] .incident-table td { display: block; width: 100%; }
  body[data-theme="pro"] .incident-table tr {
    border: 1px solid var(--gm8-border); border-radius: 10px;
    padding: 0.35rem 0.7rem; margin-bottom: 0.5rem;
  }
  body[data-theme="pro"] .incident-table tbody td {
    border: none; padding: 0.3rem 0;
    display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  }
  body[data-theme="pro"] .incident-table tbody td::before {
    content: attr(data-label);
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em;
    font-weight: 600; color: var(--gm8-muted); flex: 0 0 auto;
  }
  /* let the description wrap fully instead of truncating */
  body[data-theme="pro"] .incident-table__desc {
    max-width: none !important; white-space: normal !important;
    text-align: right;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   Wall board — unattended control-room big-screen display (/dashboard/wallboard)
   ══════════════════════════════════════════════════════════════════════════ */
.wb-body {
  margin: 0; height: 100vh; overflow: hidden;
  background: radial-gradient(circle at 50% -20%, #161310 0%, #0a0908 60%, #060504 100%);
  color: var(--gm8-text); font-family: var(--gm8-font, system-ui, sans-serif);
}
.wb-shell { display: flex; flex-direction: column; height: 100vh; padding: 1.1vh 1.2vw; gap: 1vh; }

/* Header */
.wb-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.wb-brand { display: flex; align-items: center; gap: 0.9vw; }
.wb-brand i { color: var(--gm8-amber); font-size: 2.2vh; }
.wb-brand-logo { height: 3.4vh; width: auto; display: block; }
.wb-brand-name { font-size: 2.6vh; font-weight: 800; letter-spacing: 0.02em; }
.wb-brand-sub { font-size: 1.5vh; color: var(--gm8-muted); text-transform: uppercase; letter-spacing: 0.12em; }
.wb-header-right { display: flex; align-items: center; gap: 1.1vw; font-size: 1.6vh; color: var(--gm8-text-dim); }
.wb-clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 2vh; color: var(--gm8-text); }
.wb-updated { color: var(--gm8-muted); font-size: 1.4vh; }
.wb-conn { display: inline-flex; align-items: center; gap: 0.4vw; font-size: 1.4vh; text-transform: uppercase; letter-spacing: 0.08em; }
.wb-conn .wb-dot { width: 0.9vh; height: 0.9vh; border-radius: 50%; background: var(--gm8-green); box-shadow: 0 0 8px var(--gm8-green); }
.wb-conn-bad .wb-dot { background: var(--gm8-red); box-shadow: 0 0 8px var(--gm8-red); animation: wb-blink 0.8s infinite; }
.wb-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 3.4vh; height: 3.4vh; border-radius: 8px; cursor: pointer;
  background: var(--gm8-card-hi); border: 1px solid var(--gm8-border); color: var(--gm8-text); text-decoration: none;
  font-size: 1.6vh;
}
.wb-btn:hover { border-color: var(--gm8-amber); color: var(--gm8-amber); }

/* KPI band */
.wb-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1vw; }
.wb-kpis[hidden], .wb-main[hidden], .wb-ticker[hidden], .wb-legend[hidden] { display: none !important; }
.wb-kpi {
  background: linear-gradient(180deg, var(--gm8-card) 0%, var(--gm8-bg) 100%);
  border: 1px solid var(--gm8-border); border-radius: 14px;
  padding: 1.2vh 1vw; text-align: center; display: flex; flex-direction: column; justify-content: center;
}
.wb-kpi-val { font-size: 6.2vh; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.wb-kpi-lbl { font-size: 1.5vh; color: var(--gm8-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 0.5vh; }
.wb-kpi-crit.wb-on { border-color: var(--gm8-red); background: linear-gradient(180deg, rgba(229,64,52,0.22), rgba(229,64,52,0.05)); animation: wb-pulse-crit 1.8s infinite; }
.wb-kpi-crit.wb-on .wb-kpi-val { color: #ff7268; }
.wb-kpi-pending.wb-on { border-color: var(--gm8-amber); }
.wb-kpi-pending.wb-on .wb-kpi-val { color: var(--gm8-amber); }
.wb-kpi-fire.wb-on { border-color: #f97316; background: linear-gradient(180deg, rgba(249,115,22,0.20), rgba(249,115,22,0.04)); }
.wb-kpi-fire.wb-on .wb-kpi-val { color: #fb923c; }
.wb-kpi-intruder.wb-on { border-color: #e54034; }
.wb-kpi-intruder.wb-on .wb-kpi-val { color: #ff7268; }
.wb-kpi-test .wb-kpi-val { color: #38bdf8; }

/* ── Wall-board layout editor ─────────────────────────────────────────── */
.wb-editor-backdrop { position: fixed; inset: 0; background: rgba(4,7,13,0.55); backdrop-filter: blur(2px); z-index: 1200; }
.wb-editor {
  position: fixed; top: 0; right: 0; height: 100vh; width: 380px; max-width: 92vw; z-index: 1201;
  background: var(--gm8-card, #11161f); border-left: 1px solid var(--gm8-border);
  box-shadow: -18px 0 60px rgba(0,0,0,0.5); display: flex; flex-direction: column;
  color: var(--gm8-text, #e7ecf3); font-size: 14px;
}
/* `hidden` attr must beat the explicit display above, or the drawer won't close. */
.wb-editor[hidden], .wb-editor-backdrop[hidden] { display: none !important; }
.wb-editor-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--gm8-border); font-weight: 700; }
.wb-editor-body { flex: 1; overflow-y: auto; padding: 14px 18px; }
.wb-editor-sec { margin-bottom: 20px; }
.wb-editor-lbl { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gm8-muted); margin-bottom: 9px; }
.wb-editor-hint { text-transform: none; letter-spacing: 0; opacity: 0.7; margin-left: 6px; }
.wb-preset-row { display: flex; flex-wrap: wrap; gap: 8px; }
.wb-tile-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.wb-tile-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--gm8-border); border-radius: 9px; background: rgba(255,255,255,0.02); }
.wb-tile-toggle { display: flex; align-items: center; gap: 9px; cursor: pointer; margin: 0; flex: 1; }
.wb-tile-arrows { display: flex; gap: 4px; }
.wb-arrow { background: rgba(255,255,255,0.05); border: 1px solid var(--gm8-border); color: var(--gm8-text); border-radius: 6px; width: 28px; height: 26px; cursor: pointer; }
.wb-arrow:hover:not([disabled]) { border-color: var(--gm8-amber); color: var(--gm8-amber); }
.wb-arrow[disabled] { opacity: 0.3; cursor: default; }
.wb-sec-list { display: flex; flex-direction: column; gap: 8px; }
.wb-sec-toggle { display: flex; align-items: center; gap: 9px; cursor: pointer; margin: 0; }
.wb-editor-foot { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--gm8-border); }
.wb-ed-btn { flex: 1; padding: 10px 12px; border-radius: 9px; font-weight: 600; cursor: pointer; border: 1px solid var(--gm8-border); font-size: 13px; }
.wb-ed-primary { background: var(--gm8-blue, #2563eb); border-color: var(--gm8-blue, #2563eb); color: #fff; }
.wb-ed-ghost { background: transparent; color: var(--gm8-text); }
.wb-ed-ghost:hover { border-color: var(--gm8-amber); color: var(--gm8-amber); }
.wb-preset { flex: 0 0 auto; padding: 7px 12px; }

/* ── Dashboard layout auto-save pill ──────────────────────────────────── */
.dash-save-pill {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(14px);
  background: #16a34a; color: #fff; padding: 8px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; z-index: 1400;
}
.dash-save-pill.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.dash-save-pill.is-err { background: #dc2626; }

/* Section head */
.wb-section-head { display: flex; align-items: center; justify-content: space-between; }
.wb-section-head h2 { font-size: 2.2vh; font-weight: 700; margin: 0; }
.wb-muted { color: var(--gm8-muted); font-weight: 400; font-size: 1.7vh; }
.wb-legend { display: flex; gap: 1.2vw; font-size: 1.4vh; color: var(--gm8-text-dim); }
.wb-legend span { display: inline-flex; align-items: center; gap: 0.4vw; }
.wb-sw { width: 1.2vh; height: 1.2vh; border-radius: 3px; display: inline-block; }
.wb-sw-1 { background: var(--gm8-red); } .wb-sw-2 { background: var(--gm8-amber); } .wb-sw-3 { background: var(--gm8-gold); }

/* Incident wall */
.wb-main { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 0.8vh; }
.wb-wall {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(22vw, 1fr));
  grid-auto-rows: min-content; gap: 1vh 1vw; align-content: start; padding-right: 0.3vw;
}
.wb-wall::-webkit-scrollbar { width: 0; height: 0; }
.wb-tile {
  border: 1px solid var(--gm8-border); border-left-width: 7px; border-radius: 12px;
  background: var(--gm8-card); padding: 1.1vh 1vw; display: flex; flex-direction: column; gap: 0.5vh;
}
.wb-tile.wb-p1 { border-left-color: var(--gm8-red); background: linear-gradient(110deg, rgba(229,64,52,0.12), var(--gm8-card) 60%); }
.wb-tile.wb-p2 { border-left-color: var(--gm8-amber); }
.wb-tile.wb-p3 { border-left-color: var(--gm8-gold); }
.wb-tile.wb-p4 { border-left-color: var(--gm8-muted); }
.wb-tile.wb-pulse { animation: wb-pulse-crit 1.6s infinite; }
.wb-tile-top { display: flex; align-items: center; gap: 0.5vw; font-size: 1.5vh; }
.wb-tile-icon { font-size: 2vh; color: var(--gm8-amber); }
.wb-tile.wb-p1 .wb-tile-icon { color: #ff7268; }
.wb-tile-type { font-weight: 700; letter-spacing: 0.04em; }
.wb-tile-p { font-size: 1.2vh; font-weight: 800; padding: 0.1vh 0.5vw; border-radius: 5px; background: var(--gm8-card-hi); border: 1px solid var(--gm8-border); }
.wb-tile-count { display: inline-flex; align-items: center; gap: 0.3vw; font-size: 1.3vh; font-weight: 800; color: var(--gm8-blue, #4c9eff); }
.wb-tile-age { margin-left: auto; font-size: 1.5vh; font-weight: 700; color: var(--gm8-text-dim); font-variant-numeric: tabular-nums; }
.wb-tile-site { font-size: 2.6vh; font-weight: 800; line-height: 1.05; }
.wb-tile-code { font-size: 1.4vh; color: var(--gm8-muted); font-family: var(--gm8-mono, monospace); margin-top: -0.3vh; }
.wb-tile-desc { font-size: 1.6vh; color: var(--gm8-text-dim); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wb-tile-foot { display: flex; align-items: center; gap: 0.6vw; margin-top: 0.2vh; }
.wb-tile-new { font-size: 1.2vh; font-weight: 800; letter-spacing: 0.08em; color: #ff7268; }
.wb-tile-ack { font-size: 1.2vh; font-weight: 800; letter-spacing: 0.08em; color: var(--gm8-amber); }
.wb-tile-types { font-size: 1.3vh; color: var(--gm8-muted); }

/* All clear */
.wb-allclear { grid-column: 1 / -1; text-align: center; padding: 6vh 0; color: var(--gm8-green); }
.wb-allclear i { font-size: 9vh; }
.wb-allclear-t { font-size: 4vh; font-weight: 800; letter-spacing: 0.1em; margin-top: 1vh; }
.wb-allclear-s { font-size: 2vh; color: var(--gm8-muted); }

/* Ticker */
.wb-ticker { display: flex; align-items: center; gap: 1vw; border-top: 1px solid var(--gm8-border); padding-top: 0.9vh; min-height: 4vh; }
.wb-ticker-label { font-size: 1.4vh; font-weight: 800; letter-spacing: 0.1em; color: var(--gm8-amber); white-space: nowrap; display: inline-flex; align-items: center; gap: 0.4vw; }
.wb-ticker-track { display: flex; gap: 1.6vw; overflow: hidden; white-space: nowrap; font-size: 1.5vh; }
.wb-tick { color: var(--gm8-text-dim); }
.wb-tick b { color: var(--gm8-muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.wb-tick-urgent { color: #ff7268; font-weight: 700; }

@keyframes wb-blink { 50% { opacity: 0.3; } }
@keyframes wb-pulse-crit {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229,64,52,0.0); }
  50% { box-shadow: 0 0 0 3px rgba(229,64,52,0.45); }
}

@media (max-width: 1100px) {
  .wb-wall { grid-template-columns: repeat(auto-fill, minmax(45vw, 1fr)); }
  .wb-kpi-val { font-size: 4.6vh; }
}

/* ============================================================================
   Call-contact modal — context + dial + outcome logging. Mobile-first.
   ============================================================================ */
.gm8-call-modal[hidden] { display: none; }
.gm8-call-modal {
  position: fixed; inset: 0; z-index: 1080;
  display: flex; align-items: flex-end; justify-content: center;
}
.gm8-call-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
}
.gm8-call-modal__dialog {
  position: relative;
  width: 100%; max-width: 480px;
  max-height: 92vh; overflow-y: auto;
  background: var(--gm8-card);
  border: 1px solid var(--gm8-border-hi);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.55);
  -webkit-overflow-scrolling: touch;
  animation: gm8CallIn 180ms cubic-bezier(.2, .8, .2, 1);
}
@keyframes gm8CallIn { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .gm8-call-modal__dialog { animation: none; } }

.gm8-call-modal__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem;
  padding: 1.1rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--gm8-border);
}
.gm8-call-modal__eyebrow { font-size: 0.74rem; color: var(--gm8-muted); font-weight: 600; }
.gm8-call-modal__title { margin: 0.15rem 0 0; font-size: 1.18rem; color: var(--gm8-text); font-weight: 700; }
.gm8-call-modal__rel { font-size: 0.82rem; color: var(--gm8-text-dim); margin-top: 0.1rem; }
.gm8-call-modal__x {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px;
  background: var(--gm8-card-hi); border: 1px solid var(--gm8-border);
  color: var(--gm8-text-dim); display: grid; place-items: center; cursor: pointer;
}
.gm8-call-modal__x:hover { color: var(--gm8-text); border-color: var(--gm8-border-hi); }

.gm8-call-modal__body { padding: 0.9rem 1.1rem 1rem; }
.gm8-call-modal__site {
  background: var(--gm8-card-hi); border: 1px solid var(--gm8-border);
  border-radius: 11px; padding: 0.65rem 0.8rem; margin-bottom: 0.85rem;
}
.gm8-call-modal__site-name { color: var(--gm8-text); font-size: 0.92rem; }
.gm8-call-modal__addr { color: var(--gm8-muted); font-size: 0.8rem; margin-top: 0.2rem; }

.gm8-call-modal__dial {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  width: 100%; padding: 0.85rem 1rem; margin-bottom: 1rem;
  background: var(--gm8-green); color: #06281a; text-decoration: none;
  border-radius: 12px; font-weight: 700; font-size: 1.18rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.gm8-call-modal__dial:hover { filter: brightness(1.06); color: #06281a; }
.gm8-call-modal__dial-hint { font-size: 0.7rem; font-weight: 600; opacity: 0.75; margin-left: 0.35rem; }

.gm8-call-modal__label {
  font-size: 0.78rem; font-weight: 600; color: var(--gm8-text-dim); margin-bottom: 0.5rem;
}
.gm8-call-modal__outcomes { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.gm8-call__outcome {
  display: flex; align-items: center; justify-content: center;
  padding: 0.7rem 0.5rem; min-height: 46px;
  background: var(--gm8-card-hi); border: 1px solid var(--gm8-border);
  border-radius: 10px; color: var(--gm8-text); font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: border-color 120ms ease, background 120ms ease;
}
.gm8-call__outcome:hover { border-color: var(--gm8-border-hi); background: var(--gm8-card); }
.gm8-call__outcome:disabled { opacity: 0.45; cursor: default; }
.gm8-call__outcome--ok { border-color: var(--gm8-green); color: var(--gm8-green); }

.gm8-call-modal__notes {
  width: 100%; margin-top: 0.8rem; padding: 0.6rem 0.7rem;
  background: var(--gm8-card-hi); border: 1px solid var(--gm8-border);
  border-radius: 10px; color: var(--gm8-text); font-size: 0.88rem; resize: vertical;
}
.gm8-call-modal__notes::placeholder { color: var(--gm8-muted); }

.gm8-call__status { min-height: 1.1rem; margin-top: 0.55rem; font-size: 0.82rem; color: var(--gm8-text-dim); }
.gm8-call__status--ok { color: var(--gm8-green); }
.gm8-call__status--err { color: var(--gm8-red); }

.gm8-call-modal__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.75rem 1.1rem 1.1rem;
  border-top: 1px solid var(--gm8-border);
}
.gm8-call-modal__foot #cm-next { margin-left: auto; }

@media (min-width: 560px) {
  .gm8-call-modal { align-items: center; }
  .gm8-call-modal__dialog { border-radius: 18px; border-bottom: 1px solid var(--gm8-border-hi); }
}

/* ============================================================================
   Operator actions — primary "do it" buttons + merged dispatch panel
   ============================================================================ */
.incident-actions {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.6rem; margin-bottom: 0.75rem;
}
.incident-action {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem;
  padding: 0.85rem 0.95rem; min-height: 84px;
  border-radius: 13px; border: 1px solid var(--gm8-border);
  background: var(--gm8-card-hi); color: var(--gm8-text);
  text-decoration: none; cursor: pointer; text-align: left;
  transition: transform 110ms ease, border-color 110ms ease, box-shadow 110ms ease;
}
.incident-action:hover { transform: translateY(-1px); border-color: var(--gm8-border-hi); box-shadow: 0 4px 14px rgba(0,0,0,.28); color: var(--gm8-text); }
.incident-action:disabled { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }
.incident-action > i { font-size: 1.35rem; margin-bottom: 0.2rem; }
.incident-action__label { font-weight: 700; font-size: 0.98rem; }
.incident-action__sub { font-size: 0.74rem; color: var(--gm8-muted); }
.incident-action--call > i { color: var(--gm8-green); }
.incident-action--call { border-color: color-mix(in srgb, var(--gm8-green) 45%, var(--gm8-border)); }
.incident-action--dispatch > i { color: var(--gm8-amber); }
.incident-action--dispatch { border-color: color-mix(in srgb, var(--gm8-amber) 45%, var(--gm8-border)); }
.incident-action--emergency { background: color-mix(in srgb, var(--gm8-red) 16%, var(--gm8-card-hi)); border-color: var(--gm8-red); }
.incident-action--emergency > i { color: var(--gm8-red); }
.incident-action--emergency .incident-action__sub { color: color-mix(in srgb, var(--gm8-red) 70%, var(--gm8-text-dim)); }

.incident-actions-mini { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.incident-actions-mini form { margin: 0; }
.incident-action-mini {
  display: inline-flex; align-items: center; padding: 0.45rem 0.8rem;
  border-radius: 9px; border: 1px solid var(--gm8-border);
  background: var(--gm8-card); color: var(--gm8-text-dim);
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
}
.incident-action-mini:hover { border-color: var(--gm8-border-hi); color: var(--gm8-text); }

.incident-panel--dispatch { border-color: color-mix(in srgb, var(--gm8-amber) 30%, var(--gm8-border)); }

.incident-dispatch-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.85rem; }
.incident-dispatch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.55rem 0.7rem; border: 1px solid var(--gm8-border); border-radius: 10px;
  background: var(--gm8-card-hi);
}
.incident-dispatch-row__main a { color: var(--gm8-text); }

/* Segmented who-attends toggle */
.incident-seg {
  display: inline-flex; gap: 0.25rem; padding: 0.25rem;
  background: var(--gm8-card-hi); border: 1px solid var(--gm8-border);
  border-radius: 11px; margin-bottom: 0.85rem;
}
.incident-seg__btn {
  display: inline-flex; align-items: center; padding: 0.45rem 0.95rem;
  border: none; background: transparent; color: var(--gm8-text-dim);
  font-size: 0.85rem; font-weight: 600; border-radius: 8px; cursor: pointer;
}
.incident-seg__btn:hover:not(.is-active):not(:disabled) { color: var(--gm8-text); }
.incident-seg__btn.is-active { background: var(--gm8-amber); color: #2a1c00; }
.incident-seg__btn:disabled { opacity: 0.4; cursor: default; }

.incident-pane { display: none; }
.incident-pane.is-active { display: block; animation: gm8PaneIn 160ms ease; }
@keyframes gm8PaneIn { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .incident-pane.is-active { animation: none; } }
.incident-pane__hint { font-size: 0.8rem; color: var(--gm8-muted); margin-bottom: 0.65rem; }

/* ============================================================================
   Refinement layer (2026-07-07) — small, theme-aware polish on top of the
   existing system. Uses --gm8-* tokens so every theme/skin inherits. Kept
   conservative and additive: no structural or colour-system changes.
   ============================================================================ */

/* Accessible, on-brand keyboard focus ring — keyboard-only, mouse unaffected. */
:where(a, button, .btn, .nav-link, .form-control, .form-select,
       .form-check-input, [tabindex]):focus-visible {
  outline: 2px solid var(--gm8-blue);
  outline-offset: 2px;
}
.gm8-body :focus:not(:focus-visible) { outline: none; }

/* Consistent, unobtrusive scrollbars app-wide (previously only select panes). */
* { scrollbar-width: thin; scrollbar-color: var(--gm8-border-hi) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--gm8-border-hi);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--gm8-muted); background-clip: content-box; }

/* Smoother micro-interactions on interactive chrome. */
.btn, .nav-link, .gm8-search-btn, .audio-toggle {
  transition: background-color .15s ease, border-color .15s ease,
              color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.btn:active { transform: translateY(1px); }

/* Subtle elevation for clickable cards only (not every card). */
a.gm8-card:hover, .gm8-card.gm8-card--link:hover {
  border-color: var(--gm8-border-hi);
  box-shadow: 0 6px 22px rgba(0,0,0,.28);
}

/* Crisper sidebar active state. */
.sidebar .nav-link.active { font-weight: 600; }

/* Honour reduced-motion: drop the micro-interaction transforms/animation. */
@media (prefers-reduced-motion: reduce) {
  .btn, .nav-link, .gm8-search-btn, .audio-toggle { transition: none; }
  .btn:active { transform: none; }
}

/* ── Signal-provider-down banner (injected by dashboard.js on every page) ──
   The one alert an ARC must never miss: a feed has gone dark and alarms are
   silently not arriving. Fixed full-width, flashing, above everything. */
#ingest-alert-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem;
  background: #a4121c;
  color: #fff;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: .02em;
  box-shadow: 0 4px 18px rgba(0,0,0,.45);
  animation: ingest-alert-flash 1.1s step-end infinite;
}
#ingest-alert-banner i { font-size: 1.35rem; flex: 0 0 auto; }
#ingest-alert-banner .ingest-alert-text { flex: 1 1 auto; }
#ingest-alert-banner .ingest-alert-silence {
  flex: 0 0 auto;
  border: 2px solid #fff;
  background: transparent;
  color: #fff;
  font-weight: 700;
  border-radius: 6px;
  padding: .25rem .75rem;
  white-space: nowrap;
}
#ingest-alert-banner .ingest-alert-silence:hover { background: rgba(255,255,255,.15); }
#ingest-alert-banner .ingest-alert-silence.is-silenced { opacity: .75; border-style: dashed; }
body.has-ingest-alert { padding-top: 52px; }
@keyframes ingest-alert-flash {
  0%, 100% { background: #a4121c; }
  50%      { background: #d81f2b; }
}
/* Reduced motion: hold the brighter solid red — still unmissable, no strobe. */
@media (prefers-reduced-motion: reduce) {
  #ingest-alert-banner { animation: none; background: #d81f2b; }
}
