:root {
  /* Color tokens — mirrored from design-handoff/code.html */
  --bg: #0c0e10;
  --surface: #0c0e10;
  --surface-container: #171a1c;
  --surface-container-high: #1d2022;
  --surface-bright: #292c2f;
  --on-surface: #eeeef0;
  --on-surface-variant: #aaabad;
  --outline-variant: #46484a;

  --primary: #ff8e7d;
  --primary-fixed: #ff7763;
  --primary-glow: rgba(255, 144, 100, 0.8);
  --primary-wash: rgba(255, 142, 125, 0.15);

  --error: #ff6e84;
  --error-dim: rgba(239, 68, 68, 0.8);
  --error-wash: rgba(167, 1, 56, 0.2);

  --secondary: #79f1ff;
  --tertiary: #ffc15b;

  --hairline: rgba(255, 255, 255, 0.05);
  --hairline-strong: rgba(255, 255, 255, 0.1);

  /* Spacing & radius */
  --r-sm: 0.5rem;
  --r-md: 0.75rem;
  --r-lg: 1rem;
  --r-xl: 1.5rem;
  --r-2xl: 2.5rem;
  --r-full: 9999px;

  --pad: 1rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Manrope', system-ui, sans-serif;
  background: var(--bg);
  color: var(--on-surface);
  min-height: max(884px, 100dvh);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { font-family: 'Public Sans', sans-serif; margin: 0; }
p { margin: 0; }

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: 400;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}
.material-symbols-outlined.filled,
.filled .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ───── MAP LAYER ───── */
.map-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #111;
  overflow: hidden;
}
.map-world {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  cursor: grab;
  touch-action: none;
  will-change: transform;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.map-world.dragging {
  cursor: grabbing;
  transition: none;
}
.map-image {
  position: absolute;
  inset: 0;
  background-color: #14171b;
  background-image:
    linear-gradient(180deg, rgba(9, 10, 12, 0.08) 0%, rgba(9, 10, 12, 0.58) 100%),
    linear-gradient(115deg, rgba(255, 255, 255, 0.045) 0 2px, transparent 2px 100%),
    linear-gradient(25deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 100%),
    radial-gradient(circle at 52% 48%, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 100%),
    radial-gradient(120% 100% at 30% 20%, rgba(255, 142, 125, 0.12) 0%, transparent 55%),
    radial-gradient(90% 80% at 70% 70%, rgba(121, 241, 255, 0.08) 0%, transparent 60%),
    url('https://lh3.googleusercontent.com/aida-public/AB6AXuDc59mTptgEqrWfjp1AGy5wn6re2ahwbemAxNuMjEjkC0d1nwd9cZv7oMF9bAAbKf0vTRV2V16cP3bbVXyBxChNjD1al1vx77TCyhWVh43U7-RB8SXllpINsktbZvEEvt7_5eiV-SLo1XfGnl9icQTEqR88QY-DM3XOh0r4h877YxYwITtnOW4ME4kE3nnFuxXHvFk8LKoHgT2v11tV3xda0x0hZAoJkX68qMvFVfrkIjdUbMjzaUOD58TcCSEMgIOz5nSx53pTBMpe');
  background-size: cover, 180px 180px, 110px 110px, 140px 140px, cover, cover, cover;
  background-position: center, center, center, center, center, center, center;
  opacity: 0.5;
  filter: grayscale(1) brightness(0.5);
  pointer-events: none;
}
.map-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, transparent 20%, rgba(12, 14, 16, 0.8) 100%);
  pointer-events: none;
}
.glow {
  position: absolute;
  border-radius: var(--r-full);
  background: radial-gradient(circle at center, rgba(255, 113, 108, 0.15) 0%, transparent 70%);
  pointer-events: none;
}
.glow-a { top: 33%; left: 25%; width: 16rem; height: 16rem; }
.glow-b { bottom: 25%; right: 33%; width: 20rem; height: 20rem; }

.live-dots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.live-dot {
  position: absolute;
  width: 3rem;
  height: 3rem;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.live-dot-ping,
.live-dot-halo,
.live-dot-core {
  position: absolute;
  border-radius: var(--r-full);
}
.live-dot-ping {
  width: 3rem;
  height: 3rem;
  background: rgba(255, 142, 125, 0.2);
  animation: ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.live-dot-halo {
  width: 2rem;
  height: 2rem;
  background: rgba(255, 142, 125, 0.4);
}
.live-dot-core {
  width: 1rem;
  height: 1rem;
  background: var(--primary-fixed);
  box-shadow: 0 0 15px var(--primary-glow);
}
.live-dot.urgent .live-dot-ping { background: rgba(255, 110, 132, 0.22); }
.live-dot.urgent .live-dot-halo { background: rgba(255, 110, 132, 0.45); }
.live-dot.urgent .live-dot-core {
  background: var(--error);
  box-shadow: 0 0 15px var(--error-dim);
}
@keyframes ping {
  75%, 100% { transform: scale(1.8); opacity: 0; }
}

/* ───── UI LAYER ───── */
.ui-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  pointer-events: none;
}
.ui-layer > * { pointer-events: auto; }

/* Glass variants */
.glass {
  background: rgba(23, 23, 23, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--hairline);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.glass-soft {
  background: rgba(23, 26, 28, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--hairline);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.glass-strong {
  background: rgba(23, 26, 28, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--hairline);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.liquid-glass {
  background: linear-gradient(180deg, rgba(23, 26, 28, 0.4) 0%, rgba(12, 14, 16, 0.6) 100%);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-top: 1px solid var(--hairline-strong);
}

/* Header */
.top-header {
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  border-radius: var(--r-lg);
  margin-bottom: 0.75rem;
}
.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand-icon { color: #fb923c; }
.brand h1 {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fdba74;
}
.top-actions { display: flex; align-items: center; gap: 0.5rem; }
.status-chip {
  display: flex; align-items: center; gap: 0.375rem;
  background: var(--primary-wash);
  padding: 0.25rem 0.75rem;
  border-radius: var(--r-full);
}
.status-dot {
  width: 0.5rem; height: 0.5rem;
  background: var(--primary);
  border-radius: var(--r-full);
}
.status-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--primary);
}
.source-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.625rem;
  border-radius: var(--r-full);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.04);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}
.source-badge[data-source='live'] {
  color: #8ef0a1;
  background: rgba(142, 240, 161, 0.1);
  border-color: rgba(142, 240, 161, 0.25);
}
.source-badge[data-source='demo'] {
  color: var(--tertiary);
  background: rgba(255, 193, 91, 0.1);
  border-color: rgba(255, 193, 91, 0.25);
}
.muted-icon { color: var(--on-surface-variant); font-size: 1.25rem; }

/* Location bar */
.location-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--r-md);
  margin-bottom: 1rem;
}
.location-text {
  flex: 1;
  color: var(--on-surface-variant);
  font-weight: 500;
  font-size: 0.875rem;
}
.icon-btn {
  width: 2rem; height: 2rem;
  background: var(--surface-bright);
  border: none;
  border-radius: var(--r-sm);
  color: var(--on-surface);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.icon-btn .material-symbols-outlined { font-size: 1.125rem; }

/* Drawer */
.drawer-wrap {
  margin-top: auto;
  margin-bottom: calc(7rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.drawer {
  width: 100%;
  max-width: 24rem;
  border-radius: var(--r-2xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: max-height 0.3s ease-in-out;
  pointer-events: auto;
}
.drawer[data-open="true"] { max-height: min(38rem, calc(100dvh - 8.5rem)); }
.drawer[data-open="false"] { max-height: 56px; }

.drawer-handle {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  cursor: pointer;
}
.drawer-title { display: flex; align-items: center; gap: 0.5rem; }
.drawer-title {
  display: inline-flex;
}
.drawer-title p,
.drawer-title span:last-child {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--on-surface-variant);
}
.primary-icon { color: var(--primary); font-size: 1rem; }
.expand-icon {
  color: var(--on-surface-variant);
  transition: transform 0.3s;
}
.drawer[data-open="true"] .expand-icon { transform: rotate(180deg); }

.drawer-body {
  padding: 0 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  opacity: 1;
  transition: opacity 0.25s;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.drawer-body::-webkit-scrollbar {
  display: none;
}
.drawer[data-open="false"] .drawer-body {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.inline-banner {
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%);
  color: var(--on-surface-variant);
  padding: 0.75rem 0.875rem;
  font-size: 0.75rem;
  line-height: 1.4;
}

.inline-banner.danger {
  border-color: rgba(255, 110, 132, 0.24);
  background: var(--error-wash);
  color: #ffd4dc;
}

.inline-banner.success {
  border-color: rgba(121, 241, 255, 0.22);
  background: rgba(121, 241, 255, 0.08);
  color: #d8fbff;
}

.inline-banner[tabindex="-1"]:focus {
  outline: 2px solid rgba(255, 110, 132, 0.75);
  outline-offset: 3px;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.primary-pill-btn,
.ghost-pill-btn,
.mini-action {
  appearance: none;
  border: 1px solid var(--hairline);
  border-radius: var(--r-full);
  padding: 0.65rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--on-surface);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.primary-pill-btn:hover,
.ghost-pill-btn:hover,
.mini-action:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.action-btn:disabled,
.icon-btn:disabled,
.primary-pill-btn:disabled,
.ghost-pill-btn:disabled,
.mini-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.drawer-handle:focus-visible,
.icon-btn:focus-visible,
.action-btn:focus-visible,
.card-trigger:focus-visible,
.primary-pill-btn:focus-visible,
.ghost-pill-btn:focus-visible,
.mini-action:focus-visible,
.page-scroll:focus-visible,
.drawer-body:focus-visible,
.floating-sheet:focus-visible,
.toggle input:focus-visible,
.toggle select:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.nav-item:focus-visible,
.toggle input:focus-visible + .toggle-track {
  outline: 2px solid rgba(255, 142, 125, 0.85);
  outline-offset: 3px;
}

.drawer-handle:focus-visible,
.nav-item:focus-visible {
  border-radius: var(--r-lg);
}

.primary-pill-btn:active,
.ghost-pill-btn:active,
.mini-action:active {
  transform: scale(0.98);
}

.primary-pill-btn {
  background: linear-gradient(180deg, rgba(255, 142, 125, 0.2) 0%, rgba(255, 142, 125, 0.12) 100%);
  border-color: rgba(255, 142, 125, 0.24);
  color: #ffd1c8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.ghost-pill-btn {
  color: var(--on-surface-variant);
}

.mini-action {
  flex: 1 1 0;
  min-width: 0;
  padding-inline: 0.875rem;
  background: rgba(255, 255, 255, 0.04);
}

.mini-action.quiet {
  color: var(--on-surface-variant);
  background: rgba(255, 255, 255, 0.025);
}

.card-row { display: flex; gap: 0.75rem; }
.card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  padding: 1.25rem;
}
.card-trigger {
  cursor: pointer;
}
.card-trigger:hover {
  border-color: rgba(121, 241, 255, 0.22);
}
.card-trigger:active {
  transform: scale(0.99);
}
.card-status { flex: 1; }
.card-status .card-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--on-surface-variant);
  margin-bottom: 0.25rem;
}
.card-status h2 {
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--on-surface);
}
.card-urgent {
  background: var(--error-wash);
  border: 1px solid rgba(255, 110, 132, 0.2);
  min-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.card-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.card-label-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  margin-bottom: 0.375rem;
}
.card-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--on-surface-variant);
  line-height: 1;
}
.card-label.danger { color: rgba(255, 110, 132, 0.8); }
.card-value {
  font-family: 'Public Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--on-surface);
  line-height: 1;
}
.card-value.danger { color: var(--error); }
.tiny-icon { font-size: 0.75rem; }
.tiny-icon.cyan { color: var(--secondary); }
.tiny-icon.amber { color: var(--tertiary); }

.pulse-dot {
  width: 0.375rem; height: 0.375rem;
  background: #ef4444;
  border-radius: var(--r-full);
  box-shadow: 0 0 8px var(--error-dim);
  animation: pulse-red 2s infinite;
}
@keyframes pulse-red {
  0%   { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70%  { transform: scale(1);    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0.75rem 2rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  border-top-left-radius: var(--r-2xl);
  border-top-right-radius: var(--r-2xl);
  margin: 0 auto;
  max-width: 32rem;
}
.nav-item {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(163, 163, 163, 0.8);
  padding: 0.5rem;
  border-radius: var(--r-md);
  transition: color 0.2s, background 0.2s;
}
.nav-item:hover { color: #fdba74; }
.nav-item.active {
  color: #fb923c;
  background: rgba(249, 115, 22, 0.15);
  padding: 0.5rem 0.875rem;
}
.nav-item .material-symbols-outlined { font-size: 1.375rem; }
.nav-label {
  font-size: 0.5625rem;
  font-weight: 700;
  margin-top: 0.125rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.nav-icon-wrap { position: relative; display: inline-flex; }
.nav-badge {
  position: absolute;
  top: -2px; right: -2px;
  width: 0.5rem; height: 0.5rem;
  background: var(--primary);
  border-radius: var(--r-full);
  box-shadow: 0 0 0 2px rgba(23, 26, 28, 0.9);
}

/* ───── SHARED PAGE SHELL (non-map screens) ───── */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 80% at 20% 10%, rgba(255, 142, 125, 0.06) 0%, transparent 60%),
    radial-gradient(100% 70% at 90% 100%, rgba(255, 142, 125, 0.05) 0%, transparent 65%),
    var(--bg);
  overflow: hidden;
}
.page-layer {
  display: flex;
  flex-direction: column;
}
.page-title-bar {
  margin: 0.25rem 0.5rem 1rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.page-title-bar h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--on-surface);
  margin: 0;
}
.page-meta {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--on-surface-variant);
}

.page-title-bar-split {
  align-items: center;
  gap: 1rem;
}

.page-title-bar-split > div {
  min-width: 0;
}

.page-title-bar-split .page-meta {
  display: inline-flex;
  margin-top: 0.25rem;
}

.page-inline-notice {
  margin: 0 0.5rem 1rem;
}

.page-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0.25rem calc(7rem + env(safe-area-inset-bottom, 0px));
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.page-scroll::-webkit-scrollbar { display: none; }

/* Section headers */
.section { margin-bottom: 1.5rem; }
.section:last-child { margin-bottom: 0; }
.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.5625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--on-surface-variant);
  margin: 0 0.625rem 0.625rem;
}

/* Grouped list card (alerts, settings) */
.list-card {
  background: rgba(23, 26, 28, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  overflow: hidden;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 54;
  background: rgba(2, 4, 8, 0.52);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.floating-sheet {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: calc(6.25rem + env(safe-area-inset-bottom, 0px));
  z-index: 55;
  width: min(calc(100vw - 2rem), 30rem);
  margin-inline: auto;
  border-radius: calc(var(--r-xl) + 0.125rem);
  padding: 1rem;
  min-height: 5.5rem;
  max-height: calc(100dvh - 8rem - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

#saved-page-shell[data-modal-open="true"],
#saved-page-shell[data-modal-open="true"] * {
  pointer-events: none;
}

#saved-sheet-backdrop {
  z-index: 60;
}

#saved-form-sheet {
  z-index: 70;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
}

.sheet-title {
  font-family: 'Public Sans', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--on-surface);
}

.sheet-copy {
  color: var(--on-surface-variant);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.sheet-copy-spaced {
  margin-bottom: 0.875rem;
}

.sheet-inline-error {
  margin-bottom: 0.875rem;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.field-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
}

.stack-form input {
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.04);
  color: var(--on-surface);
  font: inherit;
  padding: 0.8125rem 0.875rem;
}

.stack-form input::placeholder {
  color: rgba(170, 171, 173, 0.9);
}

.stack-form input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.stack-form .primary-pill-btn {
  width: 100%;
}

.sheet-form input,
.sheet-form select,
.sheet-form textarea {
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.04);
  color: var(--on-surface);
  font: inherit;
  padding: 0.8125rem 0.875rem;
}

.sheet-form select,
.sheet-form textarea {
  appearance: none;
}

.sheet-form textarea {
  resize: vertical;
  min-height: 5.5rem;
}

.sheet-form input::placeholder,
.sheet-form textarea::placeholder {
  color: rgba(170, 171, 173, 0.9);
}

.sheet-form input:disabled,
.sheet-form select:disabled,
.sheet-form textarea:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.sheet-actions {
  display: flex;
  gap: 0.625rem;
}

.sheet-actions > * {
  flex: 1 1 0;
}

.metric-big {
  font-family: 'Public Sans', sans-serif;
  font-size: clamp(2rem, 7vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  color: var(--on-surface);
  margin-bottom: 1rem;
}

.metric-big-muted {
  color: rgba(238, 238, 240, 0.78);
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  color: var(--on-surface);
  font-size: 0.8125rem;
}

.metric-row span:last-child {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.muted-copy {
  color: var(--on-surface-variant);
  font-size: 0.75rem;
  line-height: 1.45;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--on-surface);
  font-size: 0.8125rem;
}

.checkbox-row input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--primary);
}

@media (prefers-reduced-motion: reduce) {
  .live-dot-ping,
  .pulse-dot,
  .status-pill.urgent .dot {
    animation: none;
  }

  .map-world,
  .drawer,
  .drawer-body,
  .expand-icon,
  .nav-item,
  .action-btn,
  .primary-pill-btn,
  .ghost-pill-btn,
  .mini-action,
  .toggle-track,
  .toggle-thumb {
    transition: none;
  }
}

/* ───── SAVED BLOCK CARD ───── */
.saved-card {
  background: rgba(23, 26, 28, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  padding: 1.125rem 1.25rem;
  margin-bottom: 0.875rem;
  transition: border-color 0.2s, transform 0.2s;
}
.saved-card:hover { border-color: var(--hairline-strong); }
.saved-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.875rem;
}
.saved-card-name {
  font-family: 'Public Sans', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--on-surface);
  line-height: 1.2;
  margin: 0 0 0.1875rem;
}
.saved-card-area {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.5625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--on-surface-variant);
  margin: 0;
}
.saved-card-actions { display: flex; gap: 0.375rem; }
.action-btn {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--r-md);
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.18s, background 0.18s, border-color 0.18s, transform 0.12s;
}
.action-btn:hover {
  color: var(--primary);
  border-color: rgba(255, 142, 125, 0.3);
}
.action-btn:active { transform: scale(0.95); }
.action-btn[data-active="true"] {
  color: var(--primary);
  background: var(--primary-wash);
  border-color: rgba(255, 142, 125, 0.3);
}
.action-btn .material-symbols-outlined { font-size: 1rem; }

.saved-card-pillrow { margin-bottom: 0.875rem; }

.saved-card-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.625rem;
}
.stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 0.625rem 0.5rem;
  text-align: center;
}
.stat-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--on-surface-variant);
  margin: 0 0 0.25rem;
  line-height: 1;
}
.stat-value {
  font-family: 'Public Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--on-surface);
  margin: 0;
  line-height: 1.1;
}
.stat-value.danger { color: var(--error); }
.stat-value.primary { color: var(--primary); }

/* ───── STATUS PILLS (reusable) ───── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  padding: 0.3125rem 0.6875rem;
  border-radius: var(--r-full);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.status-pill .dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: var(--r-full);
}
.status-pill.active {
  background: var(--primary-wash);
  color: var(--primary);
  border-color: rgba(255, 142, 125, 0.2);
}
.status-pill.active .dot { background: var(--primary); }
.status-pill.urgent {
  background: var(--error-wash);
  color: var(--error);
  border-color: rgba(255, 110, 132, 0.2);
}
.status-pill.urgent .dot {
  background: #ef4444;
  box-shadow: 0 0 8px var(--error-dim);
  animation: pulse-red 2s infinite;
}
.status-pill.calm {
  background: rgba(121, 241, 255, 0.08);
  color: var(--secondary);
  border-color: rgba(121, 241, 255, 0.18);
}
.status-pill.calm .dot { background: var(--secondary); }
.status-pill.neutral {
  background: rgba(255, 255, 255, 0.05);
  color: var(--on-surface-variant);
  border-color: var(--hairline);
}
.status-pill.neutral .dot { background: var(--on-surface-variant); }

/* ───── ALERTS ───── */
.alert-row {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1rem 1.125rem;
  border-bottom: 1px solid var(--hairline);
}
.alert-row:last-child { border-bottom: none; }
.alert-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.alert-icon .material-symbols-outlined { font-size: 1.125rem; }
.alert-icon.urgent  { background: var(--error-wash); color: var(--error); }
.alert-icon.warning { background: rgba(255, 193, 91, 0.14); color: var(--tertiary); }
.alert-icon.info    { background: var(--primary-wash); color: var(--primary); }
.alert-icon.calm    { background: rgba(121, 241, 255, 0.10); color: var(--secondary); }
.alert-body { flex: 1; min-width: 0; }
.alert-title {
  font-family: 'Public Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--on-surface);
  line-height: 1.25;
  margin: 0 0 0.25rem;
}
.alert-sub {
  font-size: 0.75rem;
  color: var(--on-surface-variant);
  line-height: 1.4;
  margin: 0;
}
.alert-time {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.5625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--on-surface-variant);
  flex-shrink: 0;
  padding-top: 0.1875rem;
  white-space: nowrap;
}

/* ───── SETTINGS ───── */
.setting-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.9375rem 1.125rem;
  border-bottom: 1px solid var(--hairline);
}
.setting-row:last-child { border-bottom: none; }
.setting-body { flex: 1; min-width: 0; }
.setting-label {
  font-family: 'Public Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--on-surface);
  line-height: 1.2;
  margin: 0 0 0.1875rem;
}
.setting-desc {
  font-size: 0.75rem;
  color: var(--on-surface-variant);
  line-height: 1.35;
  margin: 0;
}
.trail-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  background: var(--primary-wash);
  padding: 0.3125rem 0.625rem;
  border-radius: var(--r-full);
  border: 1px solid rgba(255, 142, 125, 0.2);
  white-space: nowrap;
  flex-shrink: 0;
}

.diagnostics-section {
  margin-top: 0.5rem;
}

.diagnostics-section .section-title {
  color: rgba(170, 171, 173, 0.78);
}

.diagnostics-card {
  min-height: 4.25rem;
  background: rgba(23, 26, 28, 0.58);
  border-color: rgba(255, 255, 255, 0.04);
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 2.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  display: inline-block;
}
.toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--hairline);
  border-radius: var(--r-full);
  transition: background 0.2s, border-color 0.2s;
}
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(1.5rem - 8px);
  height: calc(1.5rem - 8px);
  background: var(--on-surface-variant);
  border-radius: var(--r-full);
  transition: transform 0.22s ease, background 0.22s;
  pointer-events: none;
}
.toggle input:checked ~ .toggle-track {
  background: var(--primary-wash);
  border-color: rgba(255, 142, 125, 0.4);
}
.toggle input:checked ~ .toggle-thumb {
  transform: translateX(1rem);
  background: var(--primary);
  box-shadow: 0 0 10px rgba(255, 142, 125, 0.4);
}

@media (max-width: 560px) {
  .page-title-bar-split {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-title-bar-split .primary-pill-btn,
  .page-title-bar-split .ghost-pill-btn {
    width: 100%;
  }

  .drawer-actions {
    flex-direction: column;
  }
}
