:root {
  color-scheme: dark;
  --bg: #08101a;
  --panel: #0f1926;
  --panel-2: #121f2f;
  --panel-3: #172638;
  --line: rgba(255, 255, 255, .08);
  --text: #f4f7fb;
  --muted: #91a0b3;
  --muted-2: #6e7c8d;
  --accent: #63e6be;
  --accent-2: #93c5fd;
  --marker-fire: #ff7043;
  --marker-medical: #f472b6;
  --marker-other: #cbd5e1;
  --danger: #ff8b8b;
  --warning: #ffd166;
  --shadow: 0 20px 60px rgba(0, 0, 0, .24);
  --radius: 18px;
  --body-glow-primary: rgba(52, 211, 153, .09);
  --body-glow-secondary: rgba(59, 130, 246, .08);
  --panel-glass: rgba(15, 25, 38, .86);
  --panel-glass-soft: rgba(15, 25, 38, .66);
  --control-bg: #101d2b;
  --subtle-fill: rgba(255, 255, 255, .025);
  --hover-fill: rgba(255, 255, 255, .018);
  --accent-soft: rgba(99, 230, 190, .08);
  --accent-soft-strong: rgba(99, 230, 190, .2);
  --accent-line: rgba(99, 230, 190, .42);
  --accent-ring: rgba(99, 230, 190, .16);
  --accent-highlight: rgba(99, 230, 190, .13);
  --accent-faint: rgba(99, 230, 190, .03);
  --info-soft: rgba(116, 185, 255, .09);
  --info-line: rgba(116, 185, 255, .45);
  --on-accent: #06261e;
  --focus-ring: #fff;
  --secondary-text: #c7d0dc;
  --link-text: #d5deea;
  --warning-soft: rgba(255, 209, 102, .055);
  --warning-line: rgba(255, 209, 102, .28);
  --warning-badge: #ffd26a;
  --status-warning: #f5d98b;
  --status-danger: #ffb4b4;
  --marker-default: #93c5fd;
  --map-background: #101d2b;
  --map-tile-opacity: .46;
  --map-control-background: rgba(15, 25, 38, .9);
  --map-attribution-background: rgba(8, 16, 26, .78);
  --map-attribution-text: #8b98a8;
  --map-attribution-link: #b7c8d9;
  --map-note-text: #b3bfce;
  --panel-shadow: 0 16px 50px rgba(0, 0, 0, .14);
  --marker-border: #fff;
  --marker-text: #08111b;
  --marker-ring: rgba(8, 17, 27, .58);
  --marker-ring-strong: rgba(255, 255, 255, .34);
  --marker-selected-border: #fff;
  --marker-selected-inner: #08111b;
  --marker-selected-ring: rgba(99, 230, 190, .48);
  --marker-shadow: rgba(0, 0, 0, .7);
  --marker-shadow-strong: rgba(0, 0, 0, .82);
  --warning-ring: rgba(255, 209, 102, .22);
  --warning-glow: rgba(255, 209, 102, .65);
  --warning-marker-ring: rgba(255, 209, 102, .25);
  --warning-marker-glow: rgba(255, 209, 102, .8);
  --warning-cluster: #7a5b00;
  --map-overlay-border: rgba(255, 255, 255, .1);
  --approximate-marker: #fbbf24;
  --road-marker: #f43f5e;
  --cluster-background: #16394c;
  --cluster-border: #fff;
  --cluster-text: #fff;
  --cluster-ring: rgba(8, 17, 27, .58);
  --boundary-marker: #c084fc;
  --connector-line: #b7c8d9;
  --control-disabled: .58;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7f8;
  --panel: #ffffff;
  --panel-2: #edf3f4;
  --panel-3: #e2eaec;
  --line: rgba(16, 36, 42, .14);
  --text: #10242a;
  --muted: #526970;
  --muted-2: #687b81;
  --accent: #087f67;
  --accent-2: #1769aa;
  --marker-fire: #d94720;
  --marker-medical: #db2777;
  --marker-other: #64748b;
  --danger: #b42318;
  --warning: #805600;
  --shadow: 0 18px 50px rgba(31, 53, 59, .13);
  --body-glow-primary: rgba(8, 127, 103, .1);
  --body-glow-secondary: rgba(23, 105, 170, .08);
  --panel-glass: rgba(255, 255, 255, .9);
  --panel-glass-soft: rgba(255, 255, 255, .76);
  --control-bg: #ffffff;
  --subtle-fill: rgba(16, 36, 42, .045);
  --hover-fill: rgba(16, 36, 42, .04);
  --accent-soft: rgba(8, 127, 103, .1);
  --accent-soft-strong: rgba(8, 127, 103, .16);
  --accent-line: rgba(8, 127, 103, .45);
  --accent-ring: rgba(8, 127, 103, .18);
  --accent-highlight: rgba(8, 127, 103, .13);
  --accent-faint: rgba(8, 127, 103, .04);
  --info-soft: rgba(23, 105, 170, .09);
  --info-line: rgba(23, 105, 170, .4);
  --on-accent: #ffffff;
  --focus-ring: #10242a;
  --secondary-text: #314b52;
  --link-text: #294d58;
  --warning-soft: rgba(128, 86, 0, .08);
  --warning-line: rgba(128, 86, 0, .3);
  --warning-badge: #725000;
  --status-warning: #725000;
  --status-danger: #a5261c;
  --map-background: #e2eaec;
  --map-tile-opacity: 1;
  --map-control-background: rgba(255, 255, 255, .92);
  --map-attribution-background: rgba(255, 255, 255, .82);
  --map-attribution-text: #526970;
  --map-attribution-link: #294d58;
  --map-note-text: #314b52;
  --panel-shadow: 0 16px 42px rgba(31, 53, 59, .11);
  --marker-border: #173d35;
  --marker-text: #08111b;
  --marker-ring: rgba(255, 255, 255, .9);
  --marker-ring-strong: rgba(16, 36, 42, .3);
  --marker-selected-border: #fff;
  --marker-selected-inner: #173d35;
  --marker-selected-ring: rgba(8, 127, 103, .42);
  --marker-shadow: rgba(31, 53, 59, .28);
  --marker-shadow-strong: rgba(31, 53, 59, .38);
  --warning-ring: rgba(128, 86, 0, .2);
  --warning-glow: rgba(128, 86, 0, .38);
  --warning-marker-ring: rgba(128, 86, 0, .24);
  --warning-marker-glow: rgba(128, 86, 0, .46);
  --warning-cluster: #765300;
  --map-overlay-border: rgba(16, 36, 42, .16);
  --approximate-marker: #e0a000;
  --road-marker: #be123c;
  --cluster-background: #15526e;
  --cluster-border: #10242a;
  --cluster-text: #fff;
  --cluster-ring: rgba(255, 255, 255, .9);
  --boundary-marker: #7e22ce;
  --connector-line: #526970;
  --control-disabled: .55;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, var(--body-glow-primary), transparent 28rem),
    radial-gradient(circle at 80% 10%, var(--body-glow-secondary), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

html[data-display-mode="standalone"] body {
  min-height: 100dvh;
  padding-right: env(safe-area-inset-right, 0px);
  padding-left: env(safe-area-inset-left, 0px);
}

button,
input,
select {
  font: inherit;
}

input::placeholder { color: var(--muted-2); opacity: 1; }
input[type="checkbox"] { accent-color: var(--accent); }
button:disabled,
input:disabled,
select:disabled { opacity: var(--control-disabled); }

a {
  color: inherit;
}

.app-shell {
  width: min(1480px, calc(100% - 36px));
  margin: 0 auto;
}

html[data-display-mode="standalone"] .app-shell {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.topbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  border-radius: 12px;
  display: block;
  flex-shrink: 0;
  object-fit: cover;
  object-position: center top;
}

.brand-kicker,
.eyebrow,
.section-kicker {
  font: 700 10px/1.2 "Space Mono", monospace;
  letter-spacing: .14em;
  color: var(--muted);
}

.brand h1 {
  font-size: 19px;
  margin: 5px 0 0;
  letter-spacing: -.02em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-tools {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.theme-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font: 700 10px/1.2 "Space Mono", monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.theme-control select {
  min-height: 38px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--control-bg);
}

.theme-control select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.live-pill {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--subtle-fill);
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 5px var(--warning-soft);
}

.live-pill.connected .pulse {
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--text);
  background: transparent;
  cursor: pointer;
  transition: .2s ease;
  font-size: 18px;
}

.icon-button:hover {
  background: var(--panel-2);
  transform: translateY(-1px);
}

.icon-button.spinning {
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hero {
  padding: 54px 0 34px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 34px;
  align-items: end;
}

.hero h2 {
  margin: 10px 0 12px;
  max-width: 800px;
  font-size: clamp(38px, 5vw, 66px);
  line-height: .98;
  letter-spacing: -.055em;
  font-weight: 600;
}

.hero-copy {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.hero-copy strong {
  color: var(--text);
}

.hero-meta {
  border-top: 1px solid var(--line);
}

.meta-row {
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 13px;
}

.meta-row span {
  color: var(--muted);
}

.meta-row strong {
  font-weight: 600;
  text-align: right;
}

.controls-card {
  background: var(--panel-glass);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  position: sticky;
  top: 10px;
  z-index: 5;
}

.search-wrap {
  position: relative;
}

.mobile-filters-toggle { display: none; }

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-52%);
  color: var(--muted-2);
  font-size: 22px;
}

.search-wrap input,
.control-group select {
  width: 100%;
  min-height: 46px;
  color: var(--text);
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 12px;
  outline: none;
}

.search-wrap input {
  padding: 0 44px 0 45px;
}

.search-wrap input::-webkit-search-cancel-button { display: none; }

.clear-search {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 34px;
  height: 34px;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: 700 22px/1 "DM Sans", sans-serif;
  cursor: pointer;
}

.clear-search:hover { background: var(--subtle-fill); color: var(--text); }
.clear-search:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 1px; }

.search-wrap input:focus,
.control-group select:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.control-group {
  display: grid;
  grid-template-columns: auto minmax(130px, 160px);
  align-items: center;
  gap: 10px;
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.control-group label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.control-group select {
  padding: 0 34px 0 12px;
}

.stats-grid {
  margin: 18px 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.event-filters {
  margin: 18px 0;
  min-height: 76px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-glass);
  display: flex;
  align-items: center;
  gap: 20px;
}

.event-filters select {
  min-height: 38px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--control-bg);
}

.event-filters select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.event-toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.event-toggle {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--subtle-fill);
  cursor: pointer;
  font: 700 11px/1 "Space Mono", monospace;
  transition: .18s ease;
}

.event-toggle:hover,
.event-toggle:focus-visible {
  border-color: var(--accent-line);
  color: var(--text);
}

.event-toggle.active {
  border-color: var(--accent-line);
  color: var(--on-accent);
  background: var(--accent);
}

.stat-card {
  min-height: 150px;
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-primary {
  background:
    linear-gradient(145deg, var(--accent-highlight), var(--accent-faint)),
    var(--panel);
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  font-size: 42px;
  letter-spacing: -.04em;
  font-weight: 600;
}

.stat-value.compact {
  font-size: 24px;
  line-height: 1.05;
}

.stat-foot {
  color: var(--muted-2);
  font-size: 12px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(320px, .72fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel-glass);
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
}

.calls-panel {
  min-height: 650px;
  overflow: hidden;
}

.panel-head {
  min-height: 82px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.panel-head h3 {
  margin: 5px 0 0;
  font-size: 20px;
  letter-spacing: -.02em;
}

.compact-head {
  min-height: 74px;
}

.result-count {
  color: var(--muted);
  font: 12px/1 "Space Mono", monospace;
}

.call-list {
  max-height: 820px;
  overflow: auto;
}

.call-row {
  min-height: 116px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .16s ease, box-shadow .16s ease;
}

.call-row:last-child {
  border-bottom: 0;
}

.call-row:hover {
  background: var(--hover-fill);
}

.call-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.call-row.selected {
  background: var(--accent-soft);
  box-shadow: inset 4px 0 var(--accent), inset 0 0 0 1px var(--accent-line);
}

.call-recency {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin: 9px 0 5px;
  line-height: 1.4;
}

.distance-separator {
  color: var(--muted);
  font-size: 14px;
}

.distance-away,
.time-ago {
  color: var(--accent);
  font: 700 14px/1.4 "Space Mono", monospace;
  font-weight: 700;
}

.call-main {
  padding: 18px 20px 17px;
  min-width: 0;
}

.call-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.call-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -.015em;
  font-weight: 600;
}

.call-title-with-glossary {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 6px;
}

.glossary-trigger {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin: -2px 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  font: 700 17px/1 sans-serif;
  cursor: pointer;
}

.glossary-trigger:hover { background: var(--accent-soft); }
.glossary-trigger:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

.glossary-popover {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 9px);
  left: 0;
  width: min(330px, calc(100vw - 72px));
  padding: 12px 14px;
  border: 1px solid var(--accent-line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .24);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.glossary-popover[hidden], .glossary-trigger[hidden] { display: none; }
.glossary-popover p { margin: 0; }
.glossary-footer { margin-top: 9px !important; padding-top: 9px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.incident-status {
  flex: 0 0 auto;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 6px 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font: 700 11px/1 "Space Mono", monospace;
  letter-spacing: .05em;
  animation: badge-blink 1.6s ease-in-out infinite;
}

.incident-badges {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
}

.incident-change-badge {
  border: 1px solid var(--warning-line);
  border-radius: 999px;
  padding: 5px 7px;
  color: var(--warning-badge);
  background: var(--warning-soft);
  font: 700 11px/1 "Space Mono", monospace;
  letter-spacing: .05em;
  animation: badge-blink 1.2s ease-in-out infinite;
}

.incident-change-badge--updated {
  border-color: var(--info-line);
  color: var(--accent-2);
  background: var(--info-soft);
  animation-duration: 2s;
}

@keyframes badge-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

.call-location {
  margin: 6px 0 0;
  color: var(--secondary-text);
  font-size: 14px;
  line-height: 1.45;
}

.call-details {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.call-details summary {
  width: max-content;
  color: var(--accent-2);
  cursor: pointer;
  font: 700 10px/1.45 "Space Mono", monospace;
  text-transform: uppercase;
}

.call-details-body {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.call-detail {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 8px;
}

.detail-label {
  color: var(--muted-2);
  font: 10px/1.45 "Space Mono", monospace;
  text-transform: uppercase;
}

.call-alarm[hidden],
.call-division[hidden],
.call-vehicles[hidden] {
  display: none;
}

.alarm-value {
  color: var(--warning);
}

.unit-list strong {
  color: var(--secondary-text);
}

.call-meta {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--muted-2);
  font: 10px/1.45 "Space Mono", monospace;
  flex-wrap: wrap;
  margin: 0;
}

.dot-sep {
  opacity: .45;
}

.side-stack {
  display: grid;
  gap: 14px;
}

.map-stage {
  margin: 12px 0 18px;
}

.nearby-summary {
  margin-top: 22px;
  padding: 18px 22px;
  border: 1px solid var(--accent-line);
  border-left: 5px solid var(--accent);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-highlight), var(--info-soft));
  box-shadow: var(--shadow);
}

.nearby-summary p {
  margin: 6px 0 0;
  color: var(--text);
  font-size: clamp(18px, 2.3vw, 25px);
  font-weight: 700;
  line-height: 1.35;
}

.mobile-nearby-summary-text,
.mobile-map-info-label,
.mobile-map-located,
.mobile-map-data-warning { display: none; }

.expand-nearby-radius {
  margin-top: 12px;
  padding: 9px 13px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--control-bg);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.expand-nearby-radius:hover { background: var(--accent-highlight); }
.expand-nearby-radius:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

@media (max-width: 680px) {
  .nearby-summary { padding: 13px 15px; }
  .nearby-summary p { font-size: 16px; }
  .expand-nearby-radius { margin-top: 9px; padding: 8px 11px; }
}

.nearby-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nearby-sort {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font: 10px/1 "Space Mono", monospace;
  text-transform: uppercase;
}

.nearby-sort select {
  min-height: 32px;
  padding: 5px 28px 5px 9px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-2);
  font: 600 12px/1 "DM Sans", sans-serif;
}

.nearby-summary[hidden] {
  display: none;
}

.nearby-summary + .map-stage {
  margin-top: 12px;
}

.map-panel {
  overflow: hidden;
}

.map-info {
  margin-top: 18px;
  overflow: hidden;
}

.map-info > summary {
  min-height: 54px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  font-weight: 700;
}

.map-info > summary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: -4px;
}

.map-info-body {
  padding: 18px 20px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 400 14px/1.4 "DM Sans", sans-serif;
}

.map-info-section + .map-info-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.map-info-section h3 {
  margin: 0 0 8px;
  color: var(--text);
  font: 700 14px/1.4 "DM Sans", sans-serif;
}
.map-coverage { display: none; }
.map-info-section p { margin: 0; }

.map-status {
  color: var(--accent);
  font: 10px/1 "Space Mono", monospace;
}

.map-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
}

.source-updated {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 5px 12px;
  text-align: left;
  color: var(--muted-2);
  font: 10px/1.2 "Space Mono", monospace;
}

.source-updated strong {
  display: contents;
  color: var(--muted);
  font-weight: 400;
}

.map-wrap {
  position: relative;
  min-height: 620px;
}

#dispatchMap {
  height: 620px;
  background: var(--map-background);
}

.map-load-status {
  position: absolute;
  inset: 0;
  z-index: 450;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--map-background);
  color: var(--muted);
  font-weight: 700;
  pointer-events: none;
}

.map-load-status[hidden] { display: none; }
.map-load-status.is-error { color: var(--status-warning); }

/* Keep one-version service-worker upgrades coherent if an older app module controls the first navigation. */
html:not([data-map-load-state]) #dispatchMap.leaflet-container + .map-load-status { display: none; }

.leaflet-container {
  font-family: "DM Sans", sans-serif;
  background: var(--map-background);
}

.leaflet-tile-pane {
  /* A muted OSM layer is cheaper than color-filtering the full tile pane. */
  opacity: var(--map-tile-opacity);
}

.police-boundary { stroke: var(--boundary-marker) !important; fill: none !important; }

.police-boundary-debug-panel {
  z-index: 10000;
  right: 8px;
  bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100vw - 16px);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: 700 11px/1.3 "DM Sans", sans-serif;
  box-shadow: var(--shadow);
}
.police-boundary-debug-panel span { flex-basis: 100%; }
.police-boundary-debug-panel button { min-height: 36px; }
.cluster-connector { stroke: var(--connector-line) !important; }
.nearby-radius { stroke: var(--accent) !important; fill: var(--accent) !important; }
.nearby-origin { stroke: var(--marker-selected-border) !important; fill: var(--accent) !important; }
.road-restriction { stroke: var(--road-marker) !important; fill: var(--road-marker) !important; }
.road-closure-line {
  stroke: var(--road-marker) !important;
  filter: drop-shadow(0 0 2px var(--panel));
  pointer-events: stroke;
}
.road-closure-symbol {
  background: transparent;
  border: 0;
}
.road-closure-symbol span {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.7));
}
.road-closure-symbol--point span { font-size: 20px; }
.ttc-line-sign {
  background: transparent;
  border: 0;
  cursor: pointer;
}
.ttc-line-sign span {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  font-size: 15px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.7));
}
/* Story 41: the Road closures control sits directly below the Police Divisions
   control and shares its width. The top edge tracks the Police Divisions
   control's real rendered bottom edge (set by syncMobileLayerRowOffset) so the
   two controls stay stacked without overlap at every breakpoint. */
.map-wrap { --map-layer-control-width: 200px; }
.map-layer-toggle {
  position: absolute;
  top: var(--police-control-bottom, 47px);
  right: 10px;
  left: auto;
  width: var(--map-layer-control-width);
  z-index: 500;
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  font-size: 13px;
  font-weight: 700;
}
.map-panel .leaflet-top.leaflet-right .leaflet-control-layers { width: var(--map-layer-control-width); }
/* Match the Road closures / TTC disruptions label weight so the stacked map
   layer controls read as one bold control group at every breakpoint. */
.map-panel .leaflet-control-layers-overlays label { font-weight: 700; }
/* The road-closure count is not shown beneath the "Road closures" label at any
   breakpoint; the checkbox, dashed red legend key, and label remain. The count
   stays in the DOM for assistive technology and is surfaced in the disruptions
   panel (#roadCount). */
.map-layer-toggle .map-layer-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* The TTC disruptions control sits directly below the Road closures control and
   shares its styling. Its top edge tracks the Road closures control's real
   rendered bottom edge (set by syncMobileLayerRowOffset) so the three stacked
   controls stay aligned without overlap at every breakpoint. */
.ttc-overlay-toggle { top: var(--road-control-bottom, 89px); }
/* The control is only shown when TTC geometry exists; the .map-layer-toggle
   display: grid would otherwise override the hidden attribute. */
.ttc-overlay-toggle[hidden] { display: none; }
.ttc-key { width: 24px; height: 0; border-top: 4px dashed #2251a8; display: inline-block; }
[data-theme="dark"] .ttc-key { border-top-color: #8ab4e8; }
.closure-detail { width: min(300px, 100%); padding: 16px; }
.closure-detail-kicker { color: var(--road-marker); font: 700 10px/1 "Space Mono", monospace; letter-spacing: .08em; }
.closure-detail h3 { margin: 7px 0 12px; font-size: 18px; }
.ttc-detail.closure-detail > h4 { margin: 7px 0 12px; font-size: 18px; }
.closure-detail-fields { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: 6px 10px; margin: 0 0 12px; font-size: 12px; line-height: 1.4; }
.closure-detail-fields dt { color: var(--muted); }
.closure-detail-fields dd { margin: 0; overflow-wrap: anywhere; }
.closure-source-link { color: var(--accent); font-size: 12px; }

.leaflet-control-zoom a {
  color: var(--text) !important;
  background: var(--map-control-background) !important;
  border-color: var(--line) !important;
}

.leaflet-control-zoom a.leaflet-disabled {
  color: var(--muted-2) !important;
  opacity: var(--control-disabled);
}

.leaflet-control-attribution {
  color: var(--map-attribution-text) !important;
  background: var(--map-attribution-background) !important;
}

.leaflet-control-attribution a {
  color: var(--map-attribution-link) !important;
}

.dispatch-marker-wrap {
  background: transparent;
  border: 0;
}

.dispatch-marker {
  box-sizing: border-box;
  display: block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--marker-border);
  border-radius: 50%;
  background: var(--marker-default);
  box-shadow: 0 0 0 2px var(--marker-ring), 0 3px 8px var(--marker-shadow);
  color: var(--marker-text);
  text-align: center;
  opacity: 1;
  transition: transform .16s ease, background .16s ease, opacity .16s ease;
}

.dispatch-marker.service-tps { border-radius: 4px; }
.dispatch-marker.category-fire { background: var(--marker-fire); }
.dispatch-marker.category-medical { background: var(--marker-medical); }
.dispatch-marker.category-other { background: var(--marker-other); }
.dispatch-marker-glyph { display: block; font: 900 11px/16px system-ui, sans-serif; }
.dispatch-marker.category-medical .dispatch-marker-glyph { font-size: 15px; line-height: 15px; }
.dispatch-marker.age-recent { transform: scale(1.12); box-shadow: 0 0 0 2px var(--marker-ring), 0 0 0 5px var(--marker-ring-strong), 0 3px 10px var(--marker-shadow); }
.dispatch-marker.age-current,
.dispatch-marker.age-unknown { opacity: 1; }
.dispatch-marker.age-aging { opacity: .72; }
.dispatch-marker.age-old { opacity: .52; }

.call-cluster.age-aging { opacity: .76; }
.call-cluster.age-old { opacity: .58; }
.call-cluster.siren-match { opacity: 1; }

.dispatch-marker.selected,
.dispatch-marker.siren-match {
  opacity: 1;
}

.dispatch-marker.selected {
  transform: scale(1.45);
  border-color: var(--marker-selected-border);
  box-shadow: 0 0 0 3px var(--marker-selected-inner), 0 0 0 7px var(--marker-selected-ring), 0 3px 12px var(--marker-shadow-strong);
}

.leaflet-tooltip {
  color: var(--text);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.leaflet-tooltip strong {
  color: var(--accent);
}

.leaflet-tooltip-top::before { border-top-color: var(--panel); }
.leaflet-tooltip-bottom::before { border-bottom-color: var(--panel); }
.leaflet-tooltip-left::before { border-left-color: var(--panel); }
.leaflet-tooltip-right::before { border-right-color: var(--panel); }

.map-note {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 500;
  padding: 6px 8px;
  border: 1px solid var(--map-overlay-border);
  border-radius: 6px;
  color: var(--map-note-text);
  background: var(--map-attribution-background);
  font: 10px/1.2 "Space Mono", monospace;
  pointer-events: none;
}

.notice {
  border: 1px solid var(--warning-line);
  background: var(--warning-soft);
  border-radius: var(--radius);
  padding: 17px;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
}

.notice-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--warning-line);
  color: var(--warning);
  border-radius: 50%;
  font: 700 12px/1 "Space Mono", monospace;
}

.notice-cat {
  display: block;
  width: 40px;
  height: 40px;
  margin: 12px 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 1px solid var(--line);
}

.notice strong {
  display: block;
  font-size: 13px;
  margin: 2px 0 6px;
}

.notice p,
.source-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.source-card {
  border: 1px solid var(--line);
  background: var(--panel-glass-soft);
  border-radius: var(--radius);
  padding: 18px;
}

.source-card p {
  margin-top: 10px;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.source-links a {
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--subtle-fill);
  border-radius: 9px;
  padding: 7px 9px;
  font-size: 11px;
  color: var(--link-text);
}

.source-links a:hover {
  border-color: var(--accent-line);
  color: var(--accent);
}

.licence {
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted-2) !important;
  font-size: 10px !important;
}

.loading-state,
.error-state,
.empty-state {
  min-height: 360px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

.loader {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}

.loader--small {
  width: 18px;
  height: 18px;
}

.quick-look-data-status {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.quick-look-data-status.is-error { color: var(--status-warning); }
html:not([data-incident-load-state]):has(#callList > :not(.loading-state)) .quick-look-data-status { display: none; }

.error-state strong {
  color: var(--danger);
}

.incident-list-more {
  display: flex;
  justify-content: center;
  padding: 18px 16px 6px;
}

.incident-list-more button {
  min-height: 44px;
  padding: 10px 18px;
}

.incident-card--surfaced {
  outline: 2px solid var(--accent-line);
  outline-offset: -2px;
}

.feed-status {
  margin: 0;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--warning-soft);
  color: var(--status-warning);
  font-size: 12px;
  line-height: 1.5;
}

.offline-status {
  margin: 0;
  padding: 10px 20px;
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--warning-soft);
  color: var(--status-warning);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.refresh-info.is-updating { color: var(--accent); }
.refresh-info.is-error { color: var(--status-danger); }
.source-state-unavailable { color: var(--status-danger); }
.source-state-stale { color: var(--status-warning); }

footer {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted-2);
  font-size: 11px;
  border-top: 1px solid var(--line);
  margin-top: 22px;
}

#footerClock {
  font-variant-numeric: tabular-nums;
}

/* Let the sidebar determine desktop height; scroll calls within that height. */
@media (min-width: 1051px) {
  .content-grid > .calls-panel {
    align-self: stretch;
    min-height: 0;
    contain: size;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .calls-panel > .call-list {
    grid-row: 3;
    min-height: 0;
    max-height: none;
  }
}

@media (max-width: 1050px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-meta {
    max-width: 650px;
  }

  .controls-card {
    grid-template-columns: 1fr 1fr;
  }

  .search-wrap {
    grid-column: 1 / -1;
  }

  .control-group {
    border-left: 0;
    padding-left: 0;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .event-filters {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .side-stack {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .source-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 22px, 1480px);
  }

  .topbar {
    min-height: 56px;
  }

  .brand-kicker {
    display: none;
  }

  .live-pill {
    padding: 0 10px;
  }

  .hero {
    padding: 38px 0 26px;
    gap: 24px;
  }

  .hero h2 {
    font-size: clamp(36px, 12vw, 54px);
  }
}

@media (max-width: 950px) and (max-height: 500px) and (pointer: coarse), (max-width: 680px) {
  .controls-card {
    position: static;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 6px;
    background: var(--panel);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .search-wrap {
    grid-column: auto;
    min-width: 0;
  }

  .mobile-filters-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid var(--accent-line);
    border-radius: 10px;
    background: var(--control-bg);
    color: var(--text);
    font: 800 13px/1 "DM Sans", sans-serif;
    cursor: pointer;
  }

  .mobile-filters-toggle::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-inline-start: auto;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
  }
  .mobile-filters-toggle[aria-expanded="true"]::after { transform: rotate(225deg); }
  .mobile-filters-toggle.active { background: var(--accent-soft); }
  .mobile-filters-toggle:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
  .mobile-filter-count {
    min-width: 22px;
    padding: 4px 7px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font: 800 11px/1 "Space Mono", monospace;
  }
  .mobile-filter-count[hidden] { display: none; }

  .secondary-filter-control { display: none; }
  .mobile-filters-open .secondary-filter-control { display: grid; }
  .mobile-filters-open .event-filters { display: grid; }

  .control-group {
    grid-template-columns: 90px 1fr;
  }

  /* Mobile hides the redundant Police division / History labels; the select fills the row. */
  .control-group.secondary-filter-control {
    grid-template-columns: minmax(0, 1fr);
  }
  .control-group.secondary-filter-control > label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .event-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 10px;
    padding: 14px;
  }

  .event-filters select {
    width: 100%;
    min-height: 44px;
  }

  .event-toggle-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .event-toggle {
    min-width: 0;
    min-height: 44px;
    padding-inline: 8px;
  }

  .event-toggle:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat-card {
    min-height: 132px;
    padding: 16px;
  }

  .stat-value {
    font-size: 34px;
  }

  .stat-value.compact {
    font-size: 20px;
  }

  .call-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .call-main {
    padding: 16px;
  }

  .map-info > summary {
    min-height: 48px;
    padding: 0 14px;
  }

  .map-info-body {
    padding: 14px;
  }



  #dispatchMap {
    height: 460px;
  }

  .map-wrap {
    min-height: 460px;
  }

  .call-title-row {
    flex-wrap: wrap;
  }

  .side-stack {
    grid-template-columns: 1fr;
  }

  .source-card {
    grid-column: auto;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }
}
.refresh-info {
  color: var(--muted);
  font: 11px/1.4 "Space Mono", monospace;
  max-width: 300px;
  display: grid;
  gap: 4px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.refresh-freshness {
  color: color-mix(in srgb, var(--muted) 82%, transparent);
  font-size: 10px;
}
.topbar > .brand,
.topbar-photo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.topbar-tools > .refresh-info {
  flex: 1;
  min-width: 0;
  max-width: none;
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
}
@media (max-width: 680px) {
  .topbar {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 6px 0;
  }
  .brand { gap: 8px; }
  .brand h1 { margin-top: 0; }
  .topbar-photo,
  .topbar-tools > .refresh-info { display: none; }
  .topbar-tools { flex: 0 0 auto; justify-content: flex-end; }
  .theme-control > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .theme-control select { min-height: 44px; }
}

/* Brief feedback when a newer snapshot changes the displayed source timestamp. */
.source-updated strong.source-just-updated {
  color: var(--warning);
  font-weight: 800;
  background-color: var(--warning-soft);
  border-radius: 4px;
  box-shadow: 0 0 0 4px var(--warning-soft);
}

/* Keep accuracy colour visible when a marker is selected. */
.dispatch-marker.approximate {
  background: var(--approximate-marker);
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 14px;
}
.map-legend span { display: inline-flex; align-items: center; gap: 8px; }
.map-legend i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--marker-default); }
.map-legend .fire-key { background: var(--marker-fire); }
.map-legend .medical-key { background: var(--marker-medical); }
.map-legend .other-key { background: var(--marker-other); }
.map-legend .approximate-key { background: var(--approximate-marker); }
.map-legend .tps-key { border-radius: 2px; }
.map-legend .age-key { background: var(--marker-default); }
.map-legend .age-recent-key { transform: scale(1.2); box-shadow: 0 0 0 2px var(--marker-ring-strong); }
.map-legend .age-aging-key { opacity: .72; }
.map-legend .age-old-key { opacity: .52; }

/* Pin-to-record navigation: a brief emphasis, followed by the selected state. */
.call-row.pin-highlight {
  background: var(--accent-soft-strong);
  box-shadow: inset 4px 0 0 var(--accent), inset 0 0 0 2px var(--accent-line);
}
.call-row { scroll-margin-block: 120px; }

.nearby-feature { margin: 20px 0; padding: 24px; border: 1px solid var(--accent); border-radius: 18px; background: linear-gradient(120deg, var(--accent-soft-strong), var(--subtle-fill)); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.nearby-feature h2 { margin: 0 0 6px; font-size: 22px; }
.nearby-feature .section-kicker { display: block; margin-bottom: 7px; color: var(--accent); }
.nearby-feature p { margin: 0; color: var(--muted); }
.nearby-action { width: min(100%, 380px); }
.mobile-location-action { display: none; }
#nearMe { width: 100%; min-height: 54px; padding: 13px 20px; border: 0; border-radius: 12px; background: var(--accent); color: var(--on-accent); font: inherit; font-size: 17px; font-weight: 800; cursor: pointer; box-shadow: 0 8px 24px var(--accent-ring); }
#nearMe:disabled, #hearSirens:disabled { opacity: .7; cursor: wait; }
#nearMe:focus-visible, #hearSirens:focus-visible, #clearNearby:focus-visible, #chooseArea:focus-visible, .saved-location-controls button:focus-visible, .saved-location-controls select:focus-visible, .saved-locations-dialog button:focus-visible, .saved-locations-dialog input:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
#nearStatus { margin-top: 8px; font-size: 12px; line-height: 1.5; }
#nearControls:not([hidden]) { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
#hearSirens, #clearNearby, #chooseArea, .open-watch { padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--control-bg); color: var(--text); font: inherit; cursor: pointer; }
#hearSirens { margin-top: 10px; }
.open-watch { margin-top: 10px; color: var(--accent); font-weight: 700; }
.nearby-options { display: contents; }
.nearby-options summary { display: none; color: var(--accent); font-weight: 700; cursor: pointer; }
.nearby-options summary:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.saved-location-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.saved-location-controls label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.saved-location-controls select { min-height: 40px; max-width: 210px; padding: 7px 30px 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--control-bg); color: var(--text); font: inherit; }
#locationContextStatus { flex-basis: 100%; font-size: 13px; color: var(--accent); }
.saved-location-controls button, .saved-location-form-actions button, .saved-location-item-actions button, .dialog-close { padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--control-bg); color: var(--text); font: inherit; cursor: pointer; }
.saved-location-controls button:disabled { opacity: .55; cursor: not-allowed; }
#savedLocationLimit { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.saved-locations-dialog { width: min(92vw, 460px); max-height: min(82vh, 620px); padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.saved-locations-dialog::backdrop { background: rgb(0 0 0 / .52); }
.saved-locations-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.saved-locations-dialog h2 { margin: 4px 0 16px; font-size: 21px; }
.dialog-close { min-width: 40px; min-height: 40px; font-size: 22px; line-height: 1; }
#savedLocationForm { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
#savedLocationForm[hidden] { display: none; }
#savedLocationForm label { display: grid; gap: 6px; font-weight: 700; }
#savedLocationLabel { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--control-bg); color: var(--text); font: inherit; }
#savedLocationLabel[aria-invalid="true"] { border-color: var(--danger, #c43d3d); }
.saved-location-error { margin: 7px 0 0; color: var(--danger, #c43d3d); font-size: 13px; }
.saved-location-form-actions { display: flex; gap: 8px; margin-top: 12px; }
#submitSavedLocation { background: var(--accent); color: var(--on-accent); border-color: transparent; font-weight: 700; }
.saved-locations-empty { margin: 16px 0 0; color: var(--muted); }
.saved-locations-list { display: grid; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.saved-locations-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.saved-location-item-actions { display: flex; gap: 6px; flex: none; }
@media (max-width: 680px) {
  .nearby-feature { flex-direction: column; align-items: stretch; gap: 8px; margin: 10px 0; padding: 14px; border-radius: 14px; }
  .nearby-feature h2 { margin-bottom: 0; font-size: 19px; }
  .nearby-feature .section-kicker { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .nearby-feature > div:first-child > p { display: none; }
  .nearby-action { width: 100%; }
  #nearMe { min-height: 48px; padding: 10px 14px; font-size: 16px; }
  #hearSirens { display: none; }
  #nearStatus { margin-top: 6px; line-height: 1.35; }
  #nearControls:not([hidden]) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
  #nearControls button { min-width: 0; min-height: 44px; padding-inline: 6px; }
  .desktop-location-action { display: none; }
  .mobile-location-action { display: inline; }
  .nearby-options { display: block; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
  .nearby-options summary { min-height: 44px; display: flex; align-items: center; }
  .saved-location-controls { margin-top: 6px; }
  .saved-location-controls select, .saved-location-controls button, .open-watch { min-height: 44px; }
}
@media (max-width: 480px) { .saved-locations-dialog { width: calc(100vw - 24px); padding: 16px; } .saved-locations-list li { align-items: flex-start; flex-direction: column; } .saved-location-item-actions button { min-height: 44px; } }

.watch-dialog { width: min(92vw, 440px); padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.watch-dialog::backdrop { background: rgb(0 0 0 / .52); }
.watch-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.watch-dialog h2 { margin: 4px 0 12px; font-size: 21px; }
.watch-support, .watch-location-required { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; background: var(--subtle-fill); color: var(--muted); font-size: 13px; }
.watch-support[data-kind="denied"], .watch-support[data-kind="unsupported"], .watch-support[data-kind="ios-install"], .watch-location-required { border: 1px solid var(--warning-line); background: var(--warning-soft); color: var(--text); }
.watch-dialog form { display: grid; gap: 13px; }
.watch-dialog label { display: grid; gap: 6px; font-weight: 700; }
.watch-dialog select { min-height: 44px; padding: 8px 32px 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--control-bg); color: var(--text); font: inherit; }
.watch-location { display: grid; gap: 4px; margin: 0; }
.watch-location span { color: var(--accent); }
#saveWatch { min-height: 44px; padding: 10px 14px; border: 0; border-radius: 8px; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 800; cursor: pointer; }
#saveWatch:disabled { opacity: .55; cursor: not-allowed; }
.stop-watch { min-height: 40px; margin-top: 8px; padding: 8px 10px; border: 1px solid var(--warning-line); border-radius: 8px; background: var(--control-bg); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.stop-watch:disabled { opacity: .55; cursor: not-allowed; }
.watch-result { min-height: 1.5em; margin: 12px 0 0; color: var(--accent); font-size: 13px; }
.watch-future-note { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.siren-results { margin: 0 0 20px; padding: 22px; border: 1px solid var(--warning-line); border-radius: 18px; background: var(--warning-soft); }
.siren-results[hidden] { display: none; }
.siren-results-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.siren-results h2 { max-width: 760px; margin: 7px 0 16px; font-size: clamp(19px, 2.3vw, 25px); line-height: 1.25; }
.siren-radius { flex: none; padding: 7px 9px; border: 1px solid var(--warning-line); border-radius: 999px; color: var(--warning); font: 700 10px/1 "Space Mono", monospace; }
.siren-results-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.siren-results-list > li { min-width: 0; }
.incident-card--nearby { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.incident-card--nearby:hover { border-color: var(--warning); transform: translateY(-1px); }
.incident-card--nearby .call-main { padding: 14px; }
.incident-card--nearby .distance-away,
.incident-card--nearby .time-ago { color: var(--warning); font-size: 12px; }
.siren-results-empty { padding: 16px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); }
.siren-disclaimer { margin: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
#dispatchMap.choosing-area { cursor: crosshair; outline: 3px solid var(--warning); outline-offset: -3px; }
.dispatch-marker.siren-match { width: 22px; height: 22px; margin: -1px 0 0 -1px; border-color: var(--marker-selected-border); background: var(--warning); box-shadow: 0 0 0 7px var(--warning-marker-ring), 0 0 22px var(--warning-marker-glow); }
.dispatch-marker.siren-match .dispatch-marker-glyph { line-height: 18px; }
.call-cluster.siren-match { border-color: var(--marker-selected-border); background: var(--warning-cluster); box-shadow: 0 0 0 7px var(--warning-ring), 0 0 22px var(--warning-glow); }
@media (max-width: 680px) { .siren-results { padding: 17px; } .siren-results-head { display: block; } .siren-radius { display: inline-block; margin-bottom: 12px; } }

.radius-controls { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding: 12px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-glass); box-shadow: var(--shadow); }
.radius-toggle-group { display: flex; flex-wrap: wrap; gap: 8px; }
.radius-toggle-group button { min-height: 42px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--control-bg); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.radius-toggle-group button:hover { border-color: var(--accent); }
.radius-toggle-group button.active { border-color: var(--accent); background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.radius-toggle-group button:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.mobile-view-toggle { display: none; }
.mobile-map-focus-toggle { display: none; }
.mobile-bottom-sheet { display: none; }
@media (max-width: 680px), (max-width: 950px) and (max-height: 500px) and (pointer: coarse) {
  .radius-controls {
    position: static;
    margin-top: 8px;
    padding: 6px;
    border-color: var(--accent-line);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: 0 2px 8px rgb(0 0 0 / 18%);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    flex-direction: column;
    gap: 6px;
  }
  .radius-controls > .section-kicker { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .radius-toggle-group { display: flex; flex-wrap: nowrap; gap: 4px; width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; }
  .radius-toggle-group button { flex: 0 0 auto; min-width: 58px; min-height: 44px; padding: 4px 12px; font-size: 12px; line-height: 1.05; white-space: nowrap; }
  .mobile-view-toggle { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; width: 100%; max-width: 100%; }
  .mobile-view-toggle button { min-height: 44px; border: 1px solid var(--line); border-radius: 8px; background: var(--control-bg); color: var(--text); font: 700 12px/1 "DM Sans", sans-serif; cursor: pointer; }
  .mobile-view-toggle button.active { border-color: var(--accent); background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 2px var(--accent-ring); }
  .mobile-view-toggle button:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 1px; }
  html:is([data-mobile-view="calls"], [data-mobile-view="disruptions"]) :is(.map-stage, .map-info, .mobile-bottom-sheet) { display: none; }
  html[data-mobile-view="calls"] main { display: flex; flex-direction: column; }
  html[data-mobile-view="calls"] .content-grid { display: contents; }
  html[data-mobile-view="calls"] .side-stack { order: 2; }
  html:is([data-mobile-view="map"], [data-mobile-view="disruptions"]) :is(.content-grid, .nearby-summary),
  html:is([data-mobile-view="map"], [data-mobile-view="calls"]) .disruptions-panel { display: none; }
  .map-stage {
    position: relative;
    z-index: 0;
    isolation: isolate;
  }
  .nearby-summary {
    margin-top: 8px;
    padding: 8px 12px;
    border-left-width: 3px;
    border-radius: 10px;
    box-shadow: none;
  }
  .nearby-summary-head { display: none; }
  .nearby-summary .desktop-nearby-summary-text { display: none; }
  .nearby-summary .mobile-nearby-summary-text {
    display: block;
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
  }
  .nearby-summary .expand-nearby-radius { min-height: 44px; margin-top: 6px; }
  .mobile-map-data-warning {
    display: block;
    margin: 8px 0;
    padding: 9px 12px;
    border: 1px solid var(--status-danger);
    border-radius: 10px;
    background: var(--panel);
  }
  .mobile-map-data-warning[hidden] { display: none; }
  html:is([data-mobile-view="calls"], [data-mobile-view="disruptions"]) .mobile-map-data-warning { display: none; }
  .map-panel .leaflet-top { top: 60px; }
  /* Story 41: Police Divisions sits first, with Road closures directly below it.
     Controls use the same width before map initialization or source loading,
     keeping single-line labels stable without a later measurement resize. */
  .map-layer-toggle {
    top: var(--police-control-bottom, 56px);
    right: 8px;
    left: auto;
    /* The legend signs widen the controls; the extra cap keeps the repaired-
       source disclosure on one line inside the control. */
    width: min(300px, calc(100vw - 96px));
    min-width: 0;
    max-width: none;
    white-space: nowrap;
    min-height: 48px;
    padding: 2px 8px;
    background: var(--panel);
    box-shadow: 0 2px 8px rgb(0 0 0 / 18%);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  /* The legend signs are compacted inside the mobile controls so the labels
     stay on one line without widening the stack. */
  .map-layer-toggle :is(.road-sign, .ttc-sign) { font-size: 11px; }
  .map-layer-toggle :is(.road-key-wrap, .ttc-key-wrap) { gap: 3px; }
  /* The TTC disruptions control stacks directly below Road closures, anchored to
     the Road closures control's measured bottom edge. */
  .ttc-overlay-toggle {
    top: var(--road-control-bottom, 104px);
  }
  .map-panel .leaflet-top.leaflet-right {
    top: 8px;
    right: 8px;
    left: auto;
  }
  .map-panel .leaflet-top.leaflet-right .leaflet-control-layers {
    box-sizing: border-box;
    width: min(300px, calc(100vw - 96px));
    min-width: 0;
    min-height: 48px;
    margin: 0;
    padding: 1px 8px;
    display: flex;
    align-items: center;
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: 0 2px 8px rgb(0 0 0 / 18%);
    color: var(--text);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .map-panel .leaflet-control-layers-overlays label {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 4px;
    /* Match the Road closures label weight so the two stacked controls read as
       one control group. */
    font-weight: 700;
  }
  /* Story 40D: concise mobile boundary label; the full wording stays in the DOM
     (visually hidden) and in the map attribution for screen readers. */
  .map-panel .leaflet-control-layers-overlays label[data-mobile-label] > span > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  /* The police badge glyph and key line must stay visible on mobile; the
     Story 40D rule above clips every nested span under the overlay label
     (including our injected .police-key-wrap children), so un-clip them. */
  .map-panel .leaflet-control-layers-overlays label[data-mobile-label] .police-key-wrap,
  .map-panel .leaflet-control-layers-overlays label[data-mobile-label] .police-key-wrap span {
    position: static;
    overflow: visible;
    clip-path: none;
    white-space: nowrap;
    width: auto;
    height: auto;
  }
  .map-panel .leaflet-control-layers-overlays label[data-mobile-label] .police-key-wrap .police-key {
    width: 24px;
    height: 0;
  }
  .map-panel .leaflet-control-layers-overlays label .police-sign { font-size: 11px; }
  .map-panel .leaflet-control-layers-overlays label[data-mobile-label]::after {
    content: attr(data-mobile-label);
    font-size: 13px;
    font-weight: 700;
  }
  html {
    --mobile-map-height: 460px;
    --mobile-sheet-height: calc(52px + env(safe-area-inset-bottom, 0px));
  }
  /* Story 42: the collapsed sheet sizes to its header so a wrapped summary is
     never clipped or overlapped. The body keeps its normal layout but no longer
     contributes height, so it stays clipped below the sheet as before. */
  html[data-mobile-sheet-state="collapsed"] .mobile-bottom-sheet { height: auto; min-height: var(--mobile-sheet-height); grid-template-rows: auto 0; }
  html[data-mobile-sheet-state="collapsed"] .mobile-sheet-body {
    visibility: hidden;
    padding-block: 0;
    border-top-width: 0;
  }
  html[data-mobile-sheet-state="open"] { --mobile-sheet-height: min(40dvh, calc(var(--mobile-map-height) - 160px)); }
  .mobile-bottom-sheet {
    position: fixed;
    inset: auto 0 0;
    z-index: 850;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: var(--mobile-sheet-height);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    overflow: hidden;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    background: var(--panel);
    box-shadow: 0 -4px 12px rgb(0 0 0 / 18%);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: height 180ms ease-out;
  }
  html[data-display-mode="standalone"] .mobile-bottom-sheet {
    right: env(safe-area-inset-right, 0px);
    left: env(safe-area-inset-left, 0px);
  }
  .mobile-sheet-header {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 52px;
    padding: 16px 18px 4px;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
  }
  .mobile-sheet-header:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: -4px; }
  .mobile-sheet-handle {
    position: absolute;
    top: 5px;
    left: 50%;
    width: 8px;
    height: 8px;
    border: solid var(--muted-2);
    border-width: 2px 0 0 2px;
    transform: translateX(-50%) rotate(45deg);
  }
  .mobile-sheet-header[aria-expanded="true"] .mobile-sheet-handle {
    transform: translateX(-50%) rotate(225deg);
  }
  .mobile-sheet-summary { min-width: 0; font-weight: 800; overflow-wrap: anywhere; }
  .mobile-sheet-body { min-height: 0; padding: 4px 0 18px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; border-top: 1px solid var(--line); }
  .mobile-sheet-body > p { margin: 14px 0; color: var(--muted); }
  .mobile-sheet-call-list { max-height: none; overflow: visible; border-top: 1px solid var(--line); }
  .mobile-sheet-call-list > .call-list { max-height: none; overflow: visible; }
  .mobile-sheet-call-list > .disruption-list { max-height: none; overflow: visible; }
  .mobile-sheet-call-list > .disruption-list > .disruption-item { padding: 16px; }
  .incident-card--list {
    content-visibility: auto;
    contain-intrinsic-block-size: auto 190px;
  }
  .map-panel .leaflet-bottom.leaflet-right { bottom: var(--mobile-map-sheet-overlap, 0px); }
  .map-panel .leaflet-control-attribution {
    box-sizing: border-box;
    width: max-content;
    max-width: calc(100vw - 20px);
    line-height: 1.25;
    white-space: nowrap;
  }
  .map-info { margin-top: 8px; }
  .map-info > summary { min-height: 44px; padding: 0 12px; }
  .map-info .desktop-map-info-label,
  .map-info > summary .map-status { display: none; }
  .map-info .mobile-map-info-label,
  .map-info .mobile-map-located { display: block; }
  .map-info .map-coverage { display: block; color: var(--muted); }
  main :is(button, a, .incident-card, #dispatchMap) { scroll-margin-top: 12px; }
  .mobile-map-focus-toggle {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 600;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 2px 8px rgb(0 0 0 / 18%);
    font: 700 20px/1 "DM Sans", sans-serif;
    cursor: pointer;
  }
  .mobile-map-focus-toggle:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
  .mobile-map-focus-icon { display: block; line-height: 1; }
  /* Story 40D: read-only applied-filter summary, shown only in focus mode.
     Story 43: like the map info, this floating chrome must size to its content.
     A fixed/absolute element with both top and bottom insets and no height fills
     the whole gap between them, so the one-line summary rendered as a tall empty
     box over the map. Anchor it below the navigation band and let it grow to its
     content, bounded by a sensible max-height. */
  .mobile-focus-filter-summary {
    position: absolute;
    /* Story 40D/40E: sit below the floating navigation band, which itself tracks
       the focus button's real position. */
    /* Story 44: anchor to the navigation band's real measured bottom edge (plus
       an 8px gap) instead of a hardcoded offset, so a taller focus button or a
       wrapped navigation band cannot push the summary into the map info. */
    /* Clamp the top so a taller layer row cannot push the summary down into the
       bottom chrome (attribution / sheet) on short landscape viewports. */
    top: min(
      calc(var(--mobile-nav-bottom, calc(var(--mobile-layer-row-bottom, 64px) + 108px)) + 8px + env(safe-area-inset-top, 0px)),
      calc(100dvh - var(--mobile-sheet-height-actual, var(--mobile-sheet-height, 52px)) - 48px - 16px - env(safe-area-inset-bottom, 0px))
    );
    bottom: auto;
    left: calc(8px + env(safe-area-inset-left, 0px));
    right: calc(8px + env(safe-area-inset-right, 0px));
    height: auto;
    max-height: min(
      30dvh,
      calc(100dvh - var(--mobile-nav-bottom, calc(var(--mobile-layer-row-bottom, 64px) + 108px)) - 8px - env(safe-area-inset-top, 0px) - var(--mobile-sheet-height-actual, var(--mobile-sheet-height, 52px)) - 48px - env(safe-area-inset-bottom, 0px))
    );
    z-index: 600;
    margin: 0;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    color: var(--muted);
    box-shadow: 0 2px 8px rgb(0 0 0 / 18%);
    font: 600 11px/1.35 "Space Mono", monospace;
    overflow-wrap: anywhere;
    overflow: auto;
  }
  .mobile-focus-filter-summary[hidden] { display: none; }
  /* Focus mode: hide the pre-map page stack and let the map fill the usable viewport. */
  html[data-mobile-focus="on"] .topbar,
  html[data-mobile-focus="on"] .offline-status,
  html[data-mobile-focus="on"] .nearby-feature,
  html[data-mobile-focus="on"] .siren-results,
  html[data-mobile-focus="on"] .controls-card,
  html[data-mobile-focus="on"] .event-filters,
  html[data-mobile-focus="on"] .view-actions,
  html[data-mobile-focus="on"] .nearby-summary,
  html[data-mobile-focus="on"] footer { display: none; }
  /* Story 40C: keep the existing Map / Calls / Disruptions navigation reachable in focus mode. */
  html[data-mobile-focus="on"] .radius-controls {
    position: fixed;
    /* Story 40E: clear the focus button (its top tracks the layer row's real
       bottom edge) with a visible gap. Story 44: derive the offset from the
       focus button's real measured height instead of a hardcoded 48px, so a
       taller button cannot overlap the navigation band. */
    top: calc(var(--mobile-layer-row-bottom, 64px) + var(--mobile-focus-height, 48px) + 8px + env(safe-area-inset-top, 0px));
    left: 50%;
    z-index: 800;
    width: min(360px, calc(100vw - 16px));
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    transform: translateX(-50%);
  }
  html[data-mobile-focus="on"] .radius-controls > .section-kicker,
  html[data-mobile-focus="on"] .radius-controls .radius-toggle-group { display: none; }
  /* Story 40F: in focused Calls/Disruptions the map-only controls (Road closures,
     Police divisions, the fullscreen × control) are hidden, so the navigation band
     must move to the top of the usable viewport instead of reserving their space. */
  html[data-mobile-focus="on"]:is([data-mobile-view="calls"], [data-mobile-view="disruptions"]) .radius-controls {
    top: calc(8px + env(safe-area-inset-top, 0px));
  }
  html[data-mobile-focus="on"] .mobile-view-toggle { width: 100%; max-width: 100%; }
  html[data-mobile-focus="on"][data-mobile-view="map"] {
    /* Focus mode fills the usable viewport; the sheet heights below derive from it. */
    --mobile-map-height: 100vh;
    --mobile-map-height: 100dvh;
    overflow-x: hidden;
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] .map-stage {
    position: fixed;
    inset: 0;
    z-index: 700;
    margin: 0;
    padding: 0;
    max-width: 100vw;
    overflow: hidden;
    background: var(--map-background);
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] .map-panel {
    height: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] .map-wrap {
    min-height: 100vh;
    min-height: 100dvh;
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] #dispatchMap {
    height: 100vh;
    height: 100dvh;
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] .map-panel .leaflet-top { top: calc(8px + env(safe-area-inset-top, 0px)); }
  html[data-mobile-focus="on"][data-mobile-view="map"] .map-layer-toggle { top: var(--police-control-bottom, 56px); right: calc(8px + env(safe-area-inset-right, 0px)); left: auto; }
  html[data-mobile-focus="on"][data-mobile-view="map"] .ttc-overlay-toggle { top: var(--road-control-bottom, 104px); }
  html[data-mobile-focus="on"][data-mobile-view="map"] .mobile-map-focus-toggle { top: calc(8px + env(safe-area-inset-top, 0px)); left: calc(8px + env(safe-area-inset-left, 0px)); }
  html[data-mobile-focus="on"][data-mobile-view="map"] .map-panel .leaflet-top.leaflet-right { top: calc(8px + env(safe-area-inset-top, 0px)); right: calc(8px + env(safe-area-inset-right, 0px)); left: auto; }
  /* Story 40D: keep the map info & legend reachable in focus mode. It is a
     sibling of the fixed map stage, so float it above the map and the summary.
     Story 43: the panel must size to its content, not stretch. A fixed element
     with both top and bottom insets and no height fills the whole gap between
     them, so the collapsed disclosure covered nearly the entire map. Anchor it
     to the bottom (above the sheet and attribution) and let it grow upward to
     its content, bounded by a sensible max-height so the expanded panel scrolls
     internally instead of covering the map. */
  html[data-mobile-focus="on"][data-mobile-view="map"] .map-info {
    position: fixed;
    top: auto;
    /* Clear the bottom sheet and the attribution vertically. Story 44: anchor
       above the attribution's real measured clearance from the viewport bottom
       (plus a 13px gap) instead of a hardcoded 28px, so a taller attribution
       cannot be covered. */
    bottom: calc(var(--mobile-attribution-clearance, calc(var(--mobile-sheet-height-actual, var(--mobile-sheet-height, 52px)) + 28px)) + 13px + env(safe-area-inset-bottom, 0px));
    left: calc(8px + env(safe-area-inset-left, 0px));
    /* Clear the zoom control, which sits in the lower-right chrome, by stopping
       the panel short of its real measured clearance from the viewport right
       edge (plus an 8px gap) instead of a hardcoded 34px column width. */
    right: calc(var(--mobile-zoom-clearance, calc(8px + 34px + 8px)) + 8px + env(safe-area-inset-right, 0px));
    height: auto;
    max-height: min(
      60dvh,
      calc((100dvh - var(--mobile-attribution-clearance, calc(var(--mobile-sheet-height-actual, var(--mobile-sheet-height, 52px)) + 28px))) - var(--mobile-summary-bottom, calc(var(--mobile-layer-row-bottom, 64px) + 152px)) - 13px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))
    );
    z-index: 750;
    margin: 0;
    overflow: auto;
  }
  /* Story 40C/40F: focused Calls keeps the existing calls surface clear of the
     top-aligned navigation band (44px control + 8px gap), not the map-only chrome. */
  html[data-mobile-focus="on"]:is([data-mobile-view="calls"], [data-mobile-view="disruptions"]) main { padding-top: calc(8px + 44px + 8px + env(safe-area-inset-top, 0px)); }
}

/* Story 50: short landscape viewports need a top navigation/close row, a
   separate right-hand layer column, and bounded bottom chrome. Reuse the
   measured control dimensions so an expanded sheet cannot clip Map info or
   lift zoom into the filter summary and layer controls. */
@media (max-width: 950px) and (max-height: 500px) and (pointer: coarse) {
  html[data-mobile-focus="on"][data-mobile-view="map"] .radius-controls {
    top: calc(8px + env(safe-area-inset-top, 0px));
    left: calc(72px + env(safe-area-inset-left, 0px));
    width: min(360px, calc(100vw - 96px - var(--mobile-layer-control-width, 170px) - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    transform: none;
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] .mobile-map-focus-toggle {
    top: calc(8px + env(safe-area-inset-top, 0px));
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] .mobile-focus-filter-summary {
    /* Share the second row with the layer stack, reserving its measured width. */
    top: calc(max(var(--mobile-nav-bottom, 52px), calc(8px + var(--mobile-focus-height, 48px) + env(safe-area-inset-top, 0px))) + 8px);
    right: calc(var(--mobile-layer-control-width, 170px) + 24px + env(safe-area-inset-right, 0px));
    max-height: 40px;
  }
  /* Grow upward only into the space below both top-control columns. */
  html[data-mobile-focus="on"][data-mobile-view="map"] .map-info {
    min-height: 46px;
    max-height: min(
      60dvh,
      calc(100dvh - var(--mobile-attribution-clearance, calc(var(--mobile-sheet-height-actual, var(--mobile-sheet-height, 52px)) + 28px)) - max(var(--mobile-summary-bottom, 104px), var(--mobile-layer-row-bottom, 104px)) - 21px - env(safe-area-inset-bottom, 0px))
    );
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] .mobile-bottom-sheet {
    /* Reserve the top controls, Map info, zoom and attribution before allowing
       the sheet to grow. Browser toolbars can leave only ~340px of height. */
    max-height: calc(100dvh - max(var(--mobile-summary-bottom, 104px), var(--mobile-layer-row-bottom, 104px)) - 120px - env(safe-area-inset-bottom, 0px));
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] .mobile-sheet-body {
    padding-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-bottom-sheet { transition: none; }
  .incident-change-badge,
  .incident-status { animation: none; }
}

.call-explanation { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; }
.call-explanation[hidden] { display: none; }

.location-confidence { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; }

.disruption-item { padding: 14px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.disruption-item h4 { margin: 0 0 8px; }
.disruption-item p { margin: 6px 0; font-size: 13px; line-height: 1.5; }
.disruption-item.selected { background: var(--accent-soft); box-shadow: inset 4px 0 var(--accent), inset 0 0 0 1px var(--accent-line); }

/* Leaflet popup overrides — the single home for bubble styles (Story 74).
   Chrome classes shared across contexts (list, sheet, popup) are scoped here
   per context; never extend a shared class rule elsewhere in a way that can
   win over these overrides (see the Story 74 cascade-override precedent). */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip { background: var(--panel-2); color: var(--text); }
.leaflet-popup-content { margin: 0; }
.leaflet-popup-content .closure-detail { width: 100%; padding: 16px; }
.leaflet-popup-content .disruption-item { border-bottom: 0; }
.incident-card--popup { width: 280px; }
.leaflet-popup-content .incident-card { border: 0; min-height: 0; cursor: default; }
.leaflet-popup-content .call-main { padding: 16px; }
.leaflet-popup-content .show-map-hint { display: none; }
.leaflet-popup-close-button { color: var(--muted) !important; }
.leaflet-popup-close-button:hover,
.leaflet-popup-close-button:focus-visible { color: var(--text) !important; }

.disruptions-panel { margin: 20px 0; }
.disruptions-panel > p, .disruptions-panel > label { margin: 14px 20px; }
.disruption-note { color: var(--muted); font-size: 12px; line-height: 1.6; }
.disruptions-panel details { padding: 14px 20px; border-top: 1px solid var(--line); }
.disruptions-panel summary { cursor: pointer; font-weight: 600; }
.disruption-list { max-height: 420px; overflow-y: auto; }
.road-overlay-toggle { align-items: center; gap: 8px; font-size: 13px; }
.road-key { width: 24px; height: 0; border-top: 4px dashed var(--road-marker); display: inline-block; }
.road-key-wrap, .ttc-key-wrap { display: inline-flex; align-items: center; gap: 4px; }
.road-sign, .ttc-sign { font-size: 13px; line-height: 1; }
.police-key { width: 24px; height: 0; border-top: 4px dashed var(--boundary-marker); display: inline-block; }
.police-key-wrap { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; margin: 0 4px; }
.police-sign { font-size: 13px; line-height: 1; }

.view-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 16px 0; }
.view-actions button { background: var(--accent); color: var(--on-accent); border: 0; border-radius: 8px; padding: 10px 16px; font: inherit; cursor: pointer; }

@media (max-width: 950px) and (max-height: 500px) and (pointer: coarse), (max-width: 680px) {
  .view-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .view-actions.secondary-filter-control { display: none; }
  .mobile-filters-open .view-actions.secondary-filter-control { display: grid; }
  .view-actions > :not(button) { grid-column: 1 / -1; }
  .view-actions button { width: 100%; min-height: 44px; }
  .controls-card .secondary-filter-control,
  .event-filters.secondary-filter-control,
  .view-actions.secondary-filter-control { display: none; }
  .mobile-filters-open .controls-card .secondary-filter-control,
  .mobile-filters-open .event-filters.secondary-filter-control,
  .mobile-filters-open .view-actions.secondary-filter-control { display: grid; }
}

.call-cluster { display: grid; place-items: center; border-radius: 50%; background: var(--cluster-background); border: 2px solid var(--cluster-border); color: var(--cluster-text); font: bold 13px "Space Mono", monospace; text-shadow: 0 1px 2px rgba(0, 0, 0, .72); box-shadow: 0 0 0 3px var(--cluster-ring), 0 3px 10px var(--marker-shadow); }

.show-map-hint { display: inline-block; margin-top: 10px; color: var(--accent-2); font-size: 12px; }
.show-map-hint[hidden] { display: none; }

.incident-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.incident-actions .show-map-hint { margin-top: 0; }
.share-incident { padding: 4px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--control-bg); color: var(--accent-2); font: 700 11px/1.3 "DM Sans", sans-serif; cursor: pointer; }
.share-incident:hover { border-color: var(--accent); }
.share-incident:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.incident-share-status { color: var(--muted); font-size: 11px; }
.shared-incident-status { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--warning-line); border-radius: 8px; background: var(--warning-soft); color: var(--text); }
.shared-incident-status[hidden] { display: none; }

#shareLink { flex: 1 1 260px; min-width: 0; max-width: 100%; padding: 10px; color: var(--text); background: var(--control-bg); border: 1px solid var(--line); border-radius: 8px; }
#shareStatus, #filterSummary { overflow-wrap: anywhere; }

.source-time { font-variant-numeric: tabular-nums; }

.source-times-help { grid-column: 1 / -1; color: var(--accent); text-underline-offset: 3px; }
#source-timestamps { scroll-margin-top: 24px; margin-block: 24px; }
#source-timestamps h3 { font-size: 16px; }
.source-times-table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.5; }
.source-times-table th, .source-times-table td { padding: 10px 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.source-times-table th { color: var(--text); }
.source-times-table td { color: var(--muted); }
.source-times-table th:first-child { width: 30%; }

/* TTC geometry uses shape as well as colour; no filters or theme rebuilds.
   One deliberately non-red palette: dashed marks declared affected sections,
   solid marks observed diversion paths. */
.ttc-line--scheduled, .ttc-line--affected { stroke: #2251a8; }
.ttc-line--diversion { stroke: #2251a8; }
[data-theme="dark"] .ttc-line--scheduled, [data-theme="dark"] .ttc-line--affected { stroke: #8ab4e8; }
[data-theme="dark"] .ttc-line--diversion { stroke: #8ab4e8; }
.ttc-hit { cursor: pointer; }
.ttc-key.ttc-key-solid { border-top-style: solid; }
.ttc-detail { min-width: 0; overflow-wrap: anywhere; }
.ttc-detail h5 { font-size: 1em; margin: 12px 0 4px; }
.ttc-detail p { margin-block: 8px; }
#observedDiversionsList .incident-card { min-height: 0; }
#observedDiversionsList .call-main { padding: 16px 18px 15px; }
/* Story 57: the retained-evidence cue stays on the always-visible card body. */
#observedDiversionsList .call-main > .ttc-evidence-status { margin: 6px 0 0; }
#observedDiversionsList .call-details-body .ttc-detail { padding: 0; border-bottom: 0; }
#observedDiversionsList .call-details-body .ttc-detail h4 { margin: 0 0 6px; }


/* The layer disclosure stays in the same map corner at every breakpoint. */
.mobile-map-panel-toggle,
.mobile-map-controls-panel { display: none; }
#mobileMapLayersToggle {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 750;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.mobile-map-controls-panel:not([hidden]) {
  position: absolute;
  top: 56px;
  right: 8px;
  z-index: 760;
  display: block;
  width: min(300px, calc(100% - 16px));
  max-height: calc(100% - 64px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.mobile-map-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px 4px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
  font: 700 16px/1.4 "DM Sans", sans-serif;
}
.mobile-map-info-heading { display: none; }
.mobile-map-panel-heading button {
  flex: none;
  width: 44px;
  height: 44px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
  font: 700 22px/1 "DM Sans", sans-serif;
  cursor: pointer;
}
.mobile-map-panel-heading button:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: -3px; }

.map-info-body .source-updated { font: inherit; }
.map-info-body #source-timestamps { margin: 12px 0 0; }
.map-info-body #source-timestamps h3 { font-size: inherit; }
.map-info-body .source-times-table { margin-block: 8px; font: inherit; }
.map-line-legend {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.map-line-legend li { display: flex; align-items: center; gap: 8px; }
.map-line-legend li[hidden] { display: none; }
:is(.map-line-legend, #mobileMapLayersBody) :is(.police-key-wrap, .road-key-wrap, .ttc-key-wrap) {
  flex: none;
  gap: 4px;
  margin: 0;
}
:is(.map-line-legend, #mobileMapLayersBody) :is(.police-key, .road-key, .ttc-key) { width: 24px; }
:is(.map-line-legend, #mobileMapLayersBody) :is(.police-sign, .road-sign, .ttc-sign) { font-size: 13px; }
#mobileMapLayersBody :is(.map-layer-toggle, .leaflet-control-layers) {
  position: static;
  float: none;
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--panel);
  color: var(--text);
  padding: 4px 12px;
}
#mobileMapLayersBody .leaflet-control-layers { box-sizing: border-box; }
#mobileMapLayersBody > :not([hidden]) ~ :not([hidden]) { border-top: 1px solid var(--line); }
#mobileMapLayersBody :is(.map-layer-toggle, .leaflet-control-layers-overlays label) {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 44px;
  font: 600 14px/1.4 "DM Sans", sans-serif;
}
#mobileMapLayersBody input { flex: none; margin: 0; }
#mobileMapLayersBody #ttcLayerControl { align-items: flex-start; }
#mobileMapLayersBody #ttcOverlay { margin-top: 3px; }
.ttc-map-legend { display: grid; gap: 6px; }
.ttc-map-legend-title { font-weight: 700; }
.ttc-map-legend-sample {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 400;
}
#mobileMapLayersBody .leaflet-control-layers-overlays label > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
#mobileMapLayersBody .leaflet-control-layers-overlays label[data-mobile-label]::after { font: inherit; }
#mobileMapLayersBody .map-layer-toggle[hidden] { display: none; }
.mobile-nearby-toggle { display: none; }
.mobile-filter-select { display: none; }
#mobileNearbySurface { display: contents; }
#mobileFilterDropdowns { display: none; }
@media (max-width: 680px), (max-width: 950px) and (max-height: 500px) and (pointer: coarse) {
  html[data-mobile-focus="on"][data-mobile-view="map"] .radius-controls {
    top: calc(8px + env(safe-area-inset-top, 0px));
    left: calc(64px + env(safe-area-inset-left, 0px));
    right: calc(64px + env(safe-area-inset-right, 0px));
    width: auto;
    transform: none;
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] .mobile-map-focus-toggle {
    top: calc(8px + env(safe-area-inset-top, 0px));
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] .mobile-focus-filter-summary {
    top: calc(var(--mobile-nav-bottom, 56px) + 8px);
    right: calc(8px + env(safe-area-inset-right, 0px));
    max-height: min(56px, 15dvh);
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] .mobile-bottom-sheet,
  html[data-mobile-focus="on"][data-mobile-view="map"] .map-note,
  html[data-mobile-focus="on"][data-mobile-view="map"] .mobile-map-data-warning { display: none; }
  html[data-mobile-focus="on"][data-mobile-view="map"] .mobile-map-panel-toggle {
    position: absolute;
    top: calc(var(--mobile-summary-bottom, 88px) + 8px);
    right: calc(8px + env(safe-area-inset-right, 0px));
    z-index: 750;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--panel);
    color: var(--text);
    font: 700 24px/1 "DM Sans", sans-serif;
    box-shadow: 0 2px 8px rgb(0 0 0 / 18%);
    cursor: pointer;
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] #mobileMapInfoToggle {
    top: calc(var(--mobile-summary-bottom, 88px) + 60px);
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] #mobileMapLayersToggle {
    top: calc(8px + env(safe-area-inset-top, 0px));
    right: calc(8px + env(safe-area-inset-right, 0px));
    display: grid;
    padding: 0;
    border-radius: 50%;
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] .mobile-map-panel-toggle:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: -3px; }
  html[data-mobile-focus="on"][data-mobile-view="map"] :is(.mobile-map-controls-panel, .map-info) {
    position: fixed;
    top: calc(var(--mobile-summary-bottom, 88px) + 8px);
    bottom: auto;
    left: calc(8px + env(safe-area-inset-left, 0px));
    right: calc(64px + env(safe-area-inset-right, 0px));
    height: auto;
    min-height: 0;
    max-height: calc(100dvh - var(--mobile-summary-bottom, 88px) - var(--mobile-attribution-clearance, 28px) - 24px);
    z-index: 760;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    overflow: auto;
    overscroll-behavior: contain;
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] .mobile-map-controls-panel:not([hidden]) { display: block; }
  html[data-mobile-focus="on"][data-mobile-view="map"] .mobile-map-controls-panel { width: auto; }
  html[data-mobile-focus="on"][data-mobile-view="map"] .map-info:not([open]),
  html[data-mobile-focus="on"][data-mobile-view="map"] .map-info > summary { display: none; }
  html[data-mobile-focus="on"][data-mobile-view="map"] .mobile-map-panel-heading {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] .map-info-body {
    border-top: 0;
    padding: 12px;
  }
  html[data-mobile-focus="on"][data-mobile-view="map"] #mobileMapLayersBody .map-layer-toggle {
    white-space: normal;
  }
}

/* Keep the repaired-source disclosure on one line on narrow phones, while
   preserving the fullscreen launcher and panel's existing hit targets. */
@media (max-width: 360px) {
  .map-layer-toggle { font-size: 10px; gap: 4px; padding-inline: 6px; }
  .map-layer-toggle input { width: 16px; height: 16px; margin: 0; }
  .map-layer-toggle :is(.road-key, .ttc-key) { width: 16px; }
}

@media (max-width: 680px), (max-width: 950px) and (max-height: 500px) and (pointer: coarse) {
  .app-shell > .topbar,
  html[data-mobile-focus="on"] #mobileNearbyHeader,
  html:not(.mobile-nearby-open) #mobileNearbyHeader .topbar,
  html:not([data-mobile-focus="on"]):not(.mobile-nearby-open) #nearbyPanel,
  html:not([data-mobile-focus="on"]):not(.mobile-nearby-search-open) #nearbySearchControls {
    display: none;
  }

  html:not([data-mobile-focus="on"]) #mobileNearbyHeader {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 900;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
    align-items: center;
    gap: 4px;
    background: var(--panel);
  }
  html.mobile-nearby-isolated #mobileNearbyHeader { top: 0; }
  #mobileNearbyHeader .mobile-view-toggle {
    grid-area: 2 / 1 / 3 / -1;
    padding-bottom: 4px;
  }
  html:not([data-mobile-focus="on"]) {
    scroll-padding-top: calc(112px + env(safe-area-inset-top, 0px));
  }
  html.mobile-nearby-isolated { overflow: hidden; }
  .mobile-nearby-isolated #mobileNearbySurface {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: block;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: env(safe-area-inset-top, 0px) max(11px, env(safe-area-inset-right, 0px))
      calc(12px + env(safe-area-inset-bottom, 0px)) max(11px, env(safe-area-inset-left, 0px));
    scroll-padding-top: 112px;
    background: var(--bg);
  }
  .mobile-nearby-isolated :is(#mobileNearbySurface ~ *, #offlineStatus, .app-shell > footer) {
    visibility: hidden;
  }
  #nearbyPanel :is(.nearby-options, #nearStatus[data-idle]) { display: none; }
  #nearbySearchControls :is(.controls-card .secondary-filter-control, .event-filters) { display: none; }
  .mobile-filters-open #mobileFilterDropdowns {
    display: grid;
    gap: 6px;
    margin-top: 8px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
  }
  #mobileFilterDropdowns select {
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: var(--control-bg);
    font: inherit;
  }
  #mobileNearbyHeader .topbar { display: contents; }
  #mobileNearbyHeader .brand { grid-area: 1 / 1; gap: 4px; }
  #mobileNearbyHeader .brand-mark { width: 32px; height: 32px; }
  #mobileNearbyHeader h1 { font-size: 16px; margin: 0; }
  #mobileNearbyHeader :is(.brand-kicker, .topbar-photo, .refresh-info, .theme-control > span) { display: none; }
  #mobileNearbyHeader .topbar-tools { grid-area: 1 / 3; justify-self: end; min-width: 0; }
  #mobileNearbyHeader #themePreference { max-width: 100%; min-height: 44px; }
  #mobileNearbyToggle { grid-area: 1 / 2; }

  #nearbySearchControls .control-group { min-width: 0; }
  #nearbySearchControls select { width: 100%; min-width: 0; min-height: 44px; }
  #nearbySearchControls #filterSummary {
    grid-column: 1 / -1;
    font-weight: 700;
    overflow-wrap: anywhere;
  }
  #nearbySearchControls :is(.event-toggle-group, .radius-toggle-group) { display: none; }
  #nearbySearchControls .mobile-filter-select { display: block; }
  html:not([data-mobile-focus="on"]) #nearbySearchControls .radius-controls,
  html[data-mobile-focus="on"] #mobileFilterDropdowns { display: none; }

  html:not([data-mobile-focus="on"]) .mobile-nearby-toggle {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 8px auto;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--panel);
    color: var(--text);
    font: 700 24px/1 "DM Sans", sans-serif;
    cursor: pointer;
  }

  .mobile-nearby-toggle:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
  }

  #mobileNearbyToggle[aria-expanded="false"] {
    justify-self: center;
    width: 56px;
    height: 56px;
    margin: 2px 0;
    border-color: transparent;
    background: transparent;
  }

  .nearby-launcher-art { position: relative; width: 54px; height: 54px; }
  .nearby-launcher-art::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 2px solid var(--status-danger);
    border-radius: 50%;
    pointer-events: none;
    animation: nearby-outline-blink 1.3s step-end infinite;
  }
  .nearby-spaghetti-photo {
    display: block;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 25%;
  }
  .nearby-siren-icon {
    position: absolute;
    right: -4px;
    bottom: -3px;
    z-index: 1;
    opacity: .88;
  }
  .nearby-siren-icon img { display: block; }
  #mobileNearbyToggle[aria-expanded="false"] .nearby-close-icon,
  #mobileNearbyToggle[aria-expanded="true"] .nearby-launcher-art { display: none; }

  #mobileNearbySearchToggle span { animation: nearby-control-blink 1.4s ease-in-out infinite; }

  html:not([data-mobile-focus="on"])[data-mobile-view="map"] {
    --mobile-map-height: max(280px, calc(100dvh - 112px - env(safe-area-inset-top, 0px)));
  }
  html:not([data-mobile-focus="on"])[data-mobile-view="map"] #dispatchMap {
    height: var(--mobile-map-height);
  }
  html:not([data-mobile-focus="on"])[data-mobile-view="map"] .map-wrap {
    min-height: var(--mobile-map-height);
  }
}

@keyframes nearby-control-blink {
  50% { opacity: .35; }
}

@keyframes nearby-outline-blink {
  46.15% { opacity: .25; }
}

@media (prefers-reduced-motion: reduce) {
  .nearby-launcher-art::after,
  #mobileNearbySearchToggle span { animation: none; }
}

/* One non-modal feed disclosure replaces repeated warning banners. */
#callsFeedStatus, #mobileCallsFeedStatus, #mobileMapDataWarning, .feed-warning-replaced { display: none; }
.feed-warning { position: fixed; top: 12px; right: 16px; z-index: 1100; }
.feed-warning[hidden], .feed-warning-panel[hidden] { display: none; }
.feed-warning-toggle {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--status-warning); border-radius: 50%; background: var(--panel);
  color: var(--status-warning); font-size: 24px; cursor: pointer;
}
.feed-warning-panel {
  position: absolute; top: 52px; right: 0; width: min(360px, calc(100vw - 22px));
  max-height: min(60dvh, calc(100dvh - 100px - env(safe-area-inset-bottom, 0px)));
  overflow-y: auto; overscroll-behavior: contain; padding: 12px;
  border: 2px solid var(--status-warning); border-radius: 14px; background: var(--panel);
  color: var(--text); box-shadow: 0 4px 18px rgb(0 0 0 / 18%);
  animation: feed-warning-pulse 1.5s ease-in-out infinite;
}
.feed-warning-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.feed-warning-heading h2 { margin: 0; font-size: 16px; }
.feed-warning-heading button {
  width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 50%;
  background: var(--panel); color: var(--text); font-size: 24px; cursor: pointer;
}
.feed-warning-panel ul { margin: 8px 0; padding: 0; list-style: none; }
.feed-warning-panel li { display: grid; gap: 4px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.feed-warning-panel p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.feed-warning-active .topbar { padding-right: 68px; }
@keyframes feed-warning-pulse { 50% { border-color: var(--line); } }
@media (prefers-reduced-motion: reduce) { .feed-warning-panel { animation: none; } }
@media (max-width: 680px), (max-width: 950px) and (max-height: 500px) and (pointer: coarse) {
  .feed-warning { top: calc(8px + env(safe-area-inset-top, 0px)); right: max(11px, env(safe-area-inset-right, 0px)); }
  html.mobile-nearby-open.feed-warning-active #mobileNearbyHeader {
    grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1.3fr);
  }
  html.mobile-nearby-open.feed-warning-active #mobileNearbyHeader .topbar-tools { padding-right: 52px; }
  html.mobile-nearby-open.feed-warning-active #themePreference { padding-inline: 6px; width: 100%; }
  html[data-mobile-focus="on"] .feed-warning {
    top: calc(var(--mobile-summary-bottom, 88px) + 8px);
    right: calc(8px + env(safe-area-inset-right, 0px));
  }
  html[data-mobile-focus="on"] .feed-warning-panel {
    max-height: calc(100dvh - var(--mobile-summary-bottom, 88px) - 84px - env(safe-area-inset-bottom, 0px));
  }
}
