:root {
  --bg-ground: #070B12;
  --bg-surface: #0D1420;
  --bg-surface-glass: rgba(13, 20, 32, 0.92);
  --bg-elevated: #121C2D;
  --bg-hover: #18253A;
  --border-subtle: #1E2D45;
  --border-strong: #2E4466;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --sev-red: #EF4444;
  --sev-orange: #F97316;
  --sev-yellow: #EAB308;
  --sev-green: #22C55E;
  --dom-natural: #22D3EE;
  --dom-non-natural: #E879F9;
  --wa-green: #25D366;
  --tg-blue: #229ED9;

  --font-sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Code", "Consolas", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-ground);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.tabular {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

#app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* Top Command Bar */
#top-command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 8px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 35;
  flex-shrink: 0;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

.brand-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sev-green);
  display: inline-block;
}

.status-dot.is-syncing {
  background: var(--sev-yellow);
}

.status-dot.is-offline {
  background: var(--sev-orange);
}

.mode-switcher {
  display: inline-flex;
  background: var(--bg-ground);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}

.mode-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-weight: 600;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.mode-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.mode-tab.is-active {
  background: var(--bg-elevated);
  color: var(--dom-natural);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gps-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
}

.gps-pill .pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.gps-pill.status-safe {
  color: var(--sev-green);
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.1);
}

.gps-pill.status-watch {
  color: var(--sev-yellow);
  border-color: rgba(234, 179, 8, 0.45);
  background: rgba(234, 179, 8, 0.12);
}

.gps-pill.status-alert {
  color: #FCA5A5;
  border-color: var(--sev-red);
  background: rgba(239, 68, 68, 0.22);
  animation: pulseRing 1.4s ease-in-out infinite;
}

.icon-text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
}

.icon-text-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.mini-badge {
  background: rgba(34, 211, 238, 0.14);
  color: var(--dom-natural);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
}

/* Main Workspace & Globe Stage */
#command-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#globe-stage {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 55% 45%, #0B1526 0%, #070B12 72%);
}

#globe-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#globe-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 20;
  transition: right 0.2s ease;
}

body.inspector-open #globe-controls {
  right: 368px;
}

.control-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.globe-ctrl-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-glass);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.globe-ctrl-btn:hover {
  background: var(--bg-hover);
  border-color: var(--dom-natural);
}

.globe-mode-btn {
  font-size: 11px;
  color: var(--dom-natural);
}

#globe-legend {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--bg-surface-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  backdrop-filter: blur(10px);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.shape-circle, .sev-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.shape-diamond {
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  display: inline-block;
}

.natural-dot { background: var(--dom-natural); }
.non-natural-dot { background: var(--dom-non-natural); }
.sev-red { background: var(--sev-red); }
.sev-orange { background: var(--sev-orange); }
.sev-yellow { background: var(--sev-yellow); }
.sev-green { background: var(--sev-green); }

/* Left Tactical Drawer */
#tactical-drawer {
  position: absolute;
  top: 12px;
  left: 12px;
  bottom: 12px;
  width: 356px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  backdrop-filter: blur(12px);
  overflow: hidden;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
}

.mobile-sheet-handle {
  display: none;
}

.drawer-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 11px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-header h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

/* Safety Status Banner */
.safety-banner {
  border-radius: 8px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.safety-banner.state-safe {
  border-color: rgba(34, 197, 94, 0.45);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.14), rgba(13, 20, 32, 0.95));
}

.safety-banner.state-watch {
  border-color: rgba(234, 179, 8, 0.5);
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.14), rgba(13, 20, 32, 0.95));
}

.safety-banner.state-alert {
  border-color: var(--sev-red);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.24), rgba(13, 20, 32, 0.96));
}

.banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.banner-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.banner-coords {
  font-size: 11px;
  color: var(--text-secondary);
}

.banner-headline {
  margin: 0 0 4px 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.banner-sub {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.banner-quick-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

/* Inputs, Buttons & Pills */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 11.5px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: #0E7490;
  border-color: #22D3EE;
  color: #FFFFFF;
}

.btn-primary:hover {
  background: #0891B2;
}

.btn-primary.is-armed {
  background: rgba(34, 197, 94, 0.18);
  border-color: var(--sev-green);
  color: #86EFAC;
}

.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.18);
  border-color: var(--sev-red);
  color: #FECACA;
}

.btn-danger:hover {
  background: var(--sev-red);
  color: #FFFFFF;
}

.btn-whatsapp {
  background: rgba(37, 211, 102, 0.16);
  border-color: var(--wa-green);
  color: #86EFAC;
}

.btn-whatsapp:hover {
  background: #16A34A;
  color: #FFFFFF;
}

.btn-telegram {
  background: rgba(34, 158, 217, 0.16);
  border-color: var(--tg-blue);
  color: #BAE6FD;
}

.btn-telegram:hover {
  background: #0284C7;
  color: #FFFFFF;
}

.link-btn {
  background: transparent;
  border: 0;
  color: var(--dom-natural);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}

.link-btn:hover {
  text-decoration: underline;
}

.input-control {
  width: 100%;
  background: var(--bg-ground);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  padding: 7px 9px;
}

.input-control:focus {
  outline: none;
  border-color: var(--dom-natural);
}

.compact-select {
  width: auto;
  padding: 4px 8px;
  font-size: 11px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.guard-primary-row, .inline-add-row, .search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.guard-primary-row .btn, .inline-add-row .btn, .search-row .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.guard-primary-row .btn-block {
  flex: 1 1 auto;
  width: auto;
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.pill-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-ground);
  color: var(--text-secondary);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
}

.pill-btn.is-selected {
  background: rgba(34, 211, 238, 0.14);
  border-color: var(--dom-natural);
  color: var(--text-primary);
}

.sev-chip.sev-red.is-selected { border-color: var(--sev-red); background: rgba(239, 68, 68, 0.18); color: #FECACA; }
.sev-chip.sev-orange.is-selected { border-color: var(--sev-orange); background: rgba(249, 115, 22, 0.18); color: #FED7AA; }
.sev-chip.sev-yellow.is-selected { border-color: var(--sev-yellow); background: rgba(234, 179, 8, 0.18); color: #FEF08A; }
.sev-chip.sev-green.is-selected { border-color: var(--sev-green); background: rgba(34, 197, 94, 0.18); color: #BBF7D0; }

.toggle-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}

.check-row input {
  accent-color: var(--dom-natural);
  width: 15px;
  height: 15px;
}

.share-btn-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

/* Watchlist Cards */
.custom-pin-details summary {
  font-size: 11.5px;
  color: var(--dom-natural);
  cursor: pointer;
  user-select: none;
}

.custom-pin-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.custom-pin-grid input:first-child {
  grid-column: 1 / -1;
}

.watchlist-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.watchlist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-radius: 7px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

.watchlist-item.is-alert {
  border-color: var(--sev-red);
  background: rgba(239, 68, 68, 0.12);
}

.watchlist-info {
  min-width: 0;
}

.watchlist-name {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watchlist-meta {
  font-size: 11px;
  color: var(--text-secondary);
}

.watchlist-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* Consultant Domain & Subcategory Matrix */
.domain-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.domain-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 9px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-ground);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

.domain-btn strong {
  font-size: 14px;
  color: var(--text-primary);
}

.domain-btn.is-selected {
  border-color: var(--dom-natural);
  background: rgba(34, 211, 238, 0.12);
  color: var(--text-primary);
}

.domain-btn.domain-non-natural.is-selected {
  border-color: var(--dom-non-natural);
  background: rgba(232, 121, 249, 0.12);
}

.taxonomy-group {
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 7px 8px;
  background: var(--bg-ground);
}

.taxonomy-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
}

.cat-bulk-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 6px 0 4px;
}

.subcat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.subcat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 4px 8px;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.subcat-chip.is-selected {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.subcat-chip .cat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.subcat-chip .cat-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.sim-coord-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 90px;
  gap: 6px;
}

/* Incident Feed Cards */
.stream-meta-bar {
  font-size: 11px;
  color: var(--text-secondary);
}

.incident-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.incident-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.incident-card:hover, .incident-card.is-selected {
  border-color: var(--dom-natural);
  background: var(--bg-hover);
}

.incident-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 10.5px;
}

.sev-pill {
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.sev-pill.sev-red { background: rgba(239, 68, 68, 0.22); color: #FCA5A5; }
.sev-pill.sev-orange { background: rgba(249, 115, 22, 0.22); color: #FDBA74; }
.sev-pill.sev-yellow { background: rgba(234, 179, 8, 0.22); color: #FDE047; }
.sev-pill.sev-green { background: rgba(34, 197, 94, 0.22); color: #86EFAC; }

.incident-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.incident-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.tag-muted {
  color: var(--text-muted);
}

.tag-armed {
  color: #86EFAC;
  border-color: rgba(34, 197, 94, 0.45);
}

.empty-state {
  padding: 16px 12px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: 7px;
  color: var(--text-secondary);
}

.empty-state p {
  margin: 0 0 10px 0;
}

/* Right Event Inspector */
#event-inspector {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 58px;
  width: 342px;
  z-index: 30;
  background: var(--bg-surface-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
}

.inspector-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.inspector-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.sev-badge, .domain-badge, .prov-badge, .siren-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
}

.domain-badge.is-natural { background: rgba(34, 211, 238, 0.16); color: var(--dom-natural); }
.domain-badge.is-non-natural { background: rgba(232, 121, 249, 0.16); color: var(--dom-non-natural); }
.prov-badge { background: rgba(255, 255, 255, 0.08); color: var(--text-secondary); }
.siren-badge.is-eligible { background: rgba(239, 68, 68, 0.18); color: #FCA5A5; }
.siren-badge.is-advisory { background: rgba(148, 163, 184, 0.15); color: var(--text-secondary); }

.close-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.inspector-body {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inspector-cat {
  font-size: 11px;
  font-weight: 700;
  color: var(--dom-natural);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.inspector-body h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.inspector-summary {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.telemetry-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background: var(--bg-ground);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 9px;
}

.telemetry-grid dt {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.telemetry-grid dd {
  margin: 2px 0 0 0;
  font-size: 11.5px;
  color: var(--text-primary);
  word-break: break-word;
}

.inspector-actions, .inspector-share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.inspector-share-row .btn {
  flex: 1;
}

/* Emergency Full-Screen Alert Takeover */
#emergency-alert-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at center, rgba(127, 29, 29, 0.96), rgba(7, 11, 18, 0.98));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.alert-frame {
  width: 100%;
  max-width: 540px;
  background: #14090C;
  border: 2px solid var(--sev-red);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 0 60px rgba(239, 68, 68, 0.45);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.alert-pulse-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.alert-code {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #FCA5A5;
}

.siren-pill {
  background: var(--sev-red);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
}

#alert-hazard-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  color: #FFFFFF;
}

.alert-meta {
  margin: 0;
  font-size: 12.5px;
  color: #FECACA;
}

.alert-summary {
  margin: 0;
  font-size: 13px;
  color: #E2E8F0;
}

.alert-action-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.btn-alert-dismiss,
#btn-alert-checklist {
  grid-column: 1 / -1;
}

.btn-alert-dismiss {
  min-height: 52px;
  font-size: 14px;
  font-weight: 800;
  background: #FFFFFF;
  color: #7F1D1D;
  border: 0;
}

.btn-alert-dismiss:hover {
  background: #FEE2E2;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(4, 7, 12, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-card.modal-wide {
  max-width: 720px;
}

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

.modal-header h2 {
  margin: 0;
  font-size: 14px;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.muted-note {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.checklist-steps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checklist-steps li {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 9px 11px;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

.telemetry-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.telemetry-table th, .telemetry-table td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.telemetry-table th {
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
}

.brief-tabs {
  display: flex;
  gap: 8px;
}

.brief-textarea {
  width: 100%;
  min-height: 280px;
  background: var(--bg-ground);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  color: var(--text-primary);
  padding: 10px;
  font-size: 11.5px;
  resize: vertical;
}

.brief-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Footnote Ad Container */
#ad-footnote-slot {
  height: 54px;
  padding: 2px 8px;
  background: var(--bg-ground);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 25;
}

#ad-footnote-slot.is-emergency-hidden {
  display: none !important;
}

/* Toast */
#toast-region {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  pointer-events: none;
}

.toast-msg {
  background: var(--bg-elevated);
  border: 1px solid var(--dom-natural);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--dom-natural);
  outline-offset: 2px;
}

@keyframes pulseRing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* Mobile Bottom Sheet & >=48px Touch Targets */
@media (max-width: 768px) {
  #top-command-bar {
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 8px;
  }

  .brand-cluster {
    flex: 1 1 auto;
  }

  .header-actions {
    gap: 6px;
  }

  .mode-switcher {
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .mode-tab,
  .btn,
  .pill-btn,
  .subcat-chip,
  .domain-btn,
  .globe-ctrl-btn,
  .mobile-sheet-handle,
  .close-btn,
  .icon-text-btn,
  .gps-pill {
    min-height: 48px;
  }

  .globe-ctrl-btn {
    width: 48px;
    height: 48px;
  }

  #globe-controls {
    top: 10px;
    right: 10px;
  }

  body.inspector-open #globe-controls {
    right: 10px;
  }

  #globe-legend {
    left: 10px;
    right: 68px;
    bottom: 64px;
    font-size: 10px;
    padding: 5px 8px;
  }

  #tactical-drawer {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    border-radius: 14px 14px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    z-index: 45;
    transition: height 0.22s ease;
  }

  #tactical-drawer.drawer-collapsed-mobile {
    height: 52px;
  }

  #tactical-drawer.drawer-expanded-mobile {
    height: 70vh;
  }

  .mobile-sheet-handle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 14px;
    background: var(--bg-surface);
    border: 0;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
  }

  .handle-bar {
    width: 32px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-strong);
  }

  .handle-chevron {
    font-size: 11px;
    color: var(--dom-natural);
  }

  #event-inspector {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 75vh;
    border-radius: 14px 14px 0 0;
    z-index: 65;
  }

  .sim-coord-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sim-coord-grid select {
    grid-column: 1 / -1;
  }

  .alert-action-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
