/* ─────────────────────────────────────────────────────────────
   FIRE WATCH USA  —  strict black & white interface
   ───────────────────────────────────────────────────────────── */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  overflow: hidden;
  /* Lock the whole UI: only single-finger taps work outside the map.
     Pinch / double-tap zoom on UI chrome is disabled. Leaflet itself
     re-enables touch gestures on the map via its own handlers. */
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -ms-touch-action: pan-x pan-y;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  color: #000;
  background: #fff;
  -webkit-font-smoothing: antialiased;
  /* Belt-and-suspenders: prevent iOS Safari rubber-band scroll on
     anything outside Leaflet's tile pane. */
  overscroll-behavior: none;
}
/* The Leaflet map fully owns its touch input — pinch zoom, double
   tap, drag, etc. all happen here and nowhere else. */
.leaflet-container,
#map {
  touch-action: none !important;
}

/* ── Layout ─────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-rows: 56px 1fr;
  grid-template-columns: 420px 1fr;
  grid-template-areas:
    'top top'
    'side map';
  height: 100vh;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: #000;
  color: #fff;
  border-bottom: 1px solid #000;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { font-size: 20px; }
.brand h1 {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 4px;
}

.topnav { display: flex; align-items: center; gap: 10px; margin-left: 24px; }
.topnav .who {
  font: 700 10px 'JetBrains Mono', monospace; letter-spacing: 1.5px;
  color: #aaa; margin-right: 8px;
}
.topnav .who .role {
  background: #444; color: #fff; padding: 2px 6px; margin-left: 6px;
  font-size: 9px; letter-spacing: 2px;
}
.topnav .who .role.admin   { background: #d11; }
.topnav .who .role.manager { background: #06f; }
.topnav .who .role.sales   { background: #777; }
.topnav .nav-btn {
  background: transparent; border: 1px solid #fff; color: #fff;
  padding: 5px 12px; font: 700 10px 'Inter', sans-serif; letter-spacing: 2px;
  text-decoration: none; cursor: pointer;
}
.topnav .nav-btn:hover { background: #fff; color: #000; }

/* ── TOOLS dropdown in the header ────────────────────────────────────
   Collapses CANVASS / TRACKER / REPORTS / PROPERTIES into one button
   so the topbar isn't a wall of buttons. JS in mobile.js toggles
   .is-open on click and click-outside / Esc closes. */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle .chev {
  display: inline-block;
  margin-left: 3px;
  font: 700 9px 'JetBrains Mono', monospace;
  transition: transform 0.12s ease;
}
.nav-dropdown.is-open .nav-dropdown-toggle .chev { transform: rotate(180deg); }
.nav-dropdown.is-open .nav-dropdown-toggle {
  background: #fff; color: #000;
}
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: #111;
  border: 1px solid #fff;
  z-index: 800;
  padding: 4px 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.nav-dropdown.is-open .nav-dropdown-menu { display: block; }
.nav-dropdown-item {
  display: block;
  padding: 9px 16px;
  font: 700 10px 'Inter', sans-serif;
  letter-spacing: 2px;
  color: #fff;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.nav-dropdown-item:hover {
  background: #fff;
  color: #000;
  border-left-color: #06f;
}

/* Same dropdown used inside the admin pages' .topbar .actions row.
   The admin pages style their nav locally, so reset margins and let
   the dropdown sit inline with the surrounding buttons. */
.topbar .actions .nav-dropdown { margin-left: 8px; }
.topbar .actions .nav-dropdown .nav-dropdown-toggle {
  margin-left: 0;
}
.topbar .actions .nav-dropdown-menu {
  background: #000;
  border: 1px solid #fff;
  min-width: 200px;
}
.topbar .actions .nav-dropdown-item {
  background: #000;
  color: #fff;
  border-left-color: transparent;
  text-align: left;
}
.topbar .actions .nav-dropdown-item:hover {
  background: #fff;
  color: #000;
  border-left-color: #06f;
}
.topnav .nav-btn.admin-only { border-color: #d11; color: #d11; }
.topnav .nav-btn.admin-only:hover { background: #d11; color: #fff; }

/* Location-tracking status pill (sales) */
.loc-pill {
  font: 700 10px 'JetBrains Mono', monospace;
  letter-spacing: 1px;
  padding: 5px 10px;
  border: 1px solid #555;
  color: #ddd;
  background: rgba(255,255,255,0.06);
  white-space: nowrap;
}
.loc-pill.ok      { color: #6cf; border-color: #6cf; }
.loc-pill.pending { color: #fc6; border-color: #fc6; }
.loc-pill.warn    { color: #fc6; border-color: #fc6; background: rgba(255, 200, 80, 0.08); }
.loc-pill.err     { color: #f66; border-color: #f66; background: rgba(255,80,80,0.08); }

/* Sales-rep marker on the map (admin / manager view) */
.sales-marker { background: transparent !important; border: none !important; }
.sales-pin {
  width: 28px; height: 28px; border-radius: 50%;
  background: #06f; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font: 700 11px 'JetBrains Mono', monospace; letter-spacing: 0.5px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #06f, 0 2px 6px rgba(0,0,0,0.4);
  position: relative;
}
.sales-pin::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(0, 102, 255, 0.5);
  animation: salesPing 1.8s ease-out infinite;
}
.sales-pin.stale {
  background: #888;
  box-shadow: 0 0 0 2px #888, 0 2px 6px rgba(0,0,0,0.4);
}
.sales-pin.stale::after { animation: none; opacity: 0; }
@keyframes salesPing {
  0%   { transform: scale(1);   opacity: 0.7; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* Privacy banner shown to sales on first visit */
.loc-banner {
  position: fixed;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  background: #000; color: #fff;
  border: 1px solid #d11;
  box-shadow: 4px 4px 0 #d11;
  padding: 14px 18px;
  z-index: 9999;
  display: flex; align-items: center; gap: 20px;
  max-width: 720px;
  font: 12px 'Inter', sans-serif; line-height: 1.4;
}
.loc-banner-body strong {
  display: block; font-size: 11px; letter-spacing: 3px;
  margin-bottom: 4px; color: #fc6;
}
.loc-banner-body span { color: #ddd; }
.loc-banner-close {
  background: #d11; color: #fff; border: 1px solid #d11;
  padding: 8px 14px;
  font: 700 10px 'Inter', sans-serif; letter-spacing: 2px;
  cursor: pointer;
  flex-shrink: 0;
}
.loc-banner-close:hover { background: #fff; color: #d11; }

/* ── Appointments page ──────────────────────────────────────────────── */

/* Map pin for an existing appointment */
.appt-marker { background: transparent !important; border: none !important; }
.appt-pin {
  width: 28px; height: 32px;
  background: #ff8800;
  color: #fff;
  text-align: center;
  line-height: 28px;
  font-size: 18px;
  clip-path: polygon(50% 100%, 0 60%, 0 0, 100% 0, 100% 60%);
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
  text-shadow: 0 0 2px rgba(0,0,0,0.5);
}
.appt-pin.en_route  { background: #06f; }
.appt-pin.arrived   { background: #0a7; }
.appt-pin.completed { background: #888; }
.appt-pin.cancelled { background: #d11; }

/* Sidebar item: one appointment */
.ap-item {
  padding: 11px 16px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}
.ap-item:hover { background: #f5f5f5; }

/* ── Live incidents list (sidebar on appointments.html) ─────────────
   Compact rows: severity dot + title + time, then address, then a
   row of media-presence icons. Designed so reps can scan ~200 rows
   and spot juicy ones (RED + 📸 + 🔊) in seconds. */
.fire-list-item {
  padding: 9px 14px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 0.08s ease;
}
.fire-list-item:hover { background: #f5f7fa; }
.fire-list-item.is-closed { opacity: 0.55; }
.fl-row1 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 2px;
}
.fl-sev {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  font: 800 10px/1 'JetBrains Mono', monospace;
  color: #fff;
  background: #aaa;
}
.fl-sev.sev-red    { background: #d11; }
.fl-sev.sev-yellow { background: #f5a623; }
.fl-sev.sev-grey   { background: #888;   }
.fl-sev.fl-units   { background: #06f; }
.fl-sev.fl-empty   { background: #ddd; color: #999; }
.fl-title {
  flex: 1;
  font: 600 12px/1.25 'Inter', sans-serif;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fl-when {
  flex: 0 0 auto;
  font: 600 10px/1 'JetBrains Mono', monospace;
  color: #888;
  letter-spacing: 0.5px;
}
.fl-addr {
  font: 400 11px/1.35 'Inter', sans-serif;
  color: #666;
  margin-left: 25px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fl-icons {
  margin: 3px 0 0 25px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.fl-ic {
  font: 600 9px/1 'Inter', sans-serif;
  padding: 2px 5px;
  background: #eef2f7;
  color: #444;
  border-radius: 3px;
  letter-spacing: 0.3px;
}
.fl-ic.fl-closed { background: #fdecec; color: #b33; }

.fire-list-more {
  display: block;
  width: 100%;
  padding: 12px 14px;
  text-align: center;
  font: 700 10px 'JetBrains Mono', monospace;
  color: #06f;
  background: #f0f6ff;
  letter-spacing: 1px;
  border: none;
  border-top: 1px solid #d6e6ff;
  cursor: pointer;
  transition: background 0.08s ease, color 0.08s ease;
}
.fire-list-more:hover { background: #06f; color: #fff; }

/* Count pill (tiny number next to "INCIDENTS" header) */
.count-pill {
  display: inline-block;
  font: 800 9px/1 'JetBrains Mono', monospace;
  background: #06f;
  color: #fff;
  padding: 3px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  margin-left: 4px;
}

/* The sort + state dropdowns live in the block-head; keep them tight
   so they don't overflow when the panel is narrow on tablets. */
.fire-list-controls {
  display: flex;
  gap: 4px;
  align-items: center;
}
#fireSort,
#fireState {
  font: 600 10px 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
  background: #fff;
  color: #444;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 3px 6px;
  cursor: pointer;
  max-width: 110px;
}
#fireState { max-width: 78px; }

/* ── Cities sub-filter (appears once a state is picked) ──────────── */
.fire-cities {
  flex: 0 0 auto;            /* never grow — let the fire list expand */
  border-bottom: 1px solid #eee;
  background: #fafbfc;
  padding: 8px 14px 10px;
}
.fire-cities.is-collapsed { padding-bottom: 8px; }
.fire-cities.is-collapsed .fc-body { display: none; }
.fc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font: 700 10px 'Inter', sans-serif;
  letter-spacing: 1.5px;
  color: #555;
}
.fc-toggle:hover { color: #06f; }
.fc-chev {
  display: inline-block;
  width: 10px;
  font: 700 10px 'JetBrains Mono', monospace;
  color: #888;
}
.fc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: 700 10px 'Inter', sans-serif;
  letter-spacing: 1.5px;
  color: #555;
  margin-bottom: 6px;
}
.fc-actions {
  display: flex;
  gap: 4px;
}
.fc-actions .ghost {
  font: 600 9px 'JetBrains Mono', monospace;
  background: #fff;
  border: 1px solid #ddd;
  padding: 2px 7px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  color: #444;
  cursor: pointer;
}
.fc-actions .ghost:hover { background: #06f; color: #fff; border-color: #06f; }
.city-search {
  width: 100%;
  padding: 6px 8px;
  font: 400 11px 'Inter', sans-serif;
  border: 1px solid #ddd;
  border-radius: 3px;
  margin-bottom: 6px;
  box-sizing: border-box;
}
.fc-list {
  max-height: 180px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 3px;
}
.fc-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  font: 500 11px/1.3 'Inter', sans-serif;
  color: #333;
  cursor: pointer;
  border-bottom: 1px solid #f3f3f3;
}
.fc-item:hover { background: #f0f4f9; }
.fc-item:last-child { border-bottom: none; }
.fc-item input[type="checkbox"] {
  flex: 0 0 auto;
  margin: 0;
  cursor: pointer;
}
.fc-item .fc-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fc-item .fc-cnt {
  flex: 0 0 auto;
  font: 600 9px 'JetBrains Mono', monospace;
  color: #888;
  background: #eef2f7;
  padding: 2px 5px;
  border-radius: 2px;
  letter-spacing: 0.3px;
}
.ap-item-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px;
}
.ap-status {
  font: 700 9px 'JetBrains Mono', monospace;
  letter-spacing: 1.5px;
  padding: 2px 7px;
  border: 1px solid;
  text-transform: uppercase;
}
.ap-status.scheduled  { color: #ff8800; border-color: #ff8800; }
.ap-status.en_route   { color: #06f;    border-color: #06f; }
.ap-status.arrived    { color: #0a7;    border-color: #0a7; }
.ap-status.completed  { color: #555;    border-color: #555; background: #eee; }
.ap-status.cancelled  { color: #d11;    border-color: #d11; }
.ap-when {
  font: 700 10px 'JetBrains Mono', monospace;
  color: #555;
}
.ap-addr { font-size: 12px; line-height: 1.3; margin-bottom: 4px; }
.ap-meta {
  display: flex; justify-content: space-between;
  font: 10px 'JetBrains Mono', monospace; color: #777;
}
.ap-note {
  margin-top: 6px;
  padding: 6px 8px;
  background: #f7f4ed;
  border-left: 3px solid #ff8800;
  font: 11px 'Inter', sans-serif;
  color: #555;
  line-height: 1.35;
}
.ap-actions {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px;
}
.ap-status-sel {
  padding: 4px 6px;
  font: 11px 'JetBrains Mono', monospace;
  border: 1px solid #000;
  outline: none;
  flex: 1;
}

.popup-note {
  margin: 6px 0 8px;
  padding: 6px 8px;
  background: #f7f4ed;
  border-left: 3px solid #ff8800;
  font: 11px 'Inter', sans-serif;
  color: #444;
  line-height: 1.3;
}

.ap-closed {
  font: 700 9px 'JetBrains Mono', monospace;
  padding: 1px 6px;
  background: #eee;
  color: #777;
  letter-spacing: 1px;
  margin-left: 6px;
}
.ap-live {
  font: 700 9px 'JetBrains Mono', monospace;
  padding: 1px 6px;
  background: #d11;
  color: #fff;
  letter-spacing: 1px;
  margin-left: 6px;
  animation: pulse-badge 2s infinite;
}

/* Create-appointment modal */
.ap-modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.ap-modal-card {
  width: 420px; max-width: calc(100vw - 32px);
  background: #fff;
  border: 1px solid #000;
  box-shadow: 6px 6px 0 #ff8800;
  padding: 24px 22px;
  position: relative;
}
.ap-modal-card h3 {
  font: 900 14px 'Inter', sans-serif; letter-spacing: 4px;
  margin-bottom: 14px;
}
.ap-modal-close {
  position: absolute; top: 8px; right: 12px;
  background: none; border: none; font-size: 22px; cursor: pointer;
}
.ap-target {
  padding: 10px 12px;
  background: #f7f4ed;
  border-left: 3px solid #ff8800;
  font-size: 12px; line-height: 1.4;
  margin-bottom: 18px;
}
.ap-modal-card label {
  display: block; font: 700 9px 'Inter', sans-serif; letter-spacing: 2px;
  color: #777; margin: 12px 0 4px;
}
.ap-modal-card input, .ap-modal-card select, .ap-modal-card textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #000;
  font: 13px 'JetBrains Mono', monospace; outline: none;
  resize: vertical;
}
.ap-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 18px;
}
.ap-btn {
  padding: 10px 16px; border: 1px solid #000;
  font: 700 11px 'Inter', sans-serif; letter-spacing: 2px;
  cursor: pointer;
}
.ap-btn.primary   { background: #000; color: #fff; }
.ap-btn.primary:hover { background: #ff8800; border-color: #ff8800; }
.ap-btn.secondary { background: #fff; color: #000; }
.ap-btn.secondary:hover { background: #000; color: #fff; }
.ap-err {
  margin-top: 10px;
  color: #d11;
  font: 11px 'JetBrains Mono', monospace;
  min-height: 14px;
}

.stats { display: flex; gap: 28px; align-items: center; }
.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1;
}
.stat .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 700;
}
.stat .lbl {
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: 2px;
  color: #888;
}
.live-dot {
  color: #fff;
  animation: blink 1.5s infinite;
}
@keyframes blink { 50% { opacity: 0.2; } }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  grid-area: side;
  background: #fff;
  border-right: 1px solid #000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.block {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.filters-block { flex: 0 0 42%; border-bottom: 1px solid #000; min-height: 0; }
.filters-block.hidden { display: none; }
.incidents-block { flex: 1 1 0; min-height: 0; }
.incidents-block.hidden { display: none; }
/* In appts-only view (SCHEDULED tab) the appts list takes over the
   whole sidebar since types + incidents blocks are hidden. */
.sidebar.mode-appts #apptsPanel { flex: 1 1 0; }

/* ── Filter tab switcher ────────────────────────────────────────────── */
.filter-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #000;
  border-bottom: 1px solid #000;
}
.filter-tabs .tab {
  background: #000;
  color: #888;
  border: none;
  border-right: 1px solid #222;
  padding: 11px 14px;
  cursor: pointer;
  font: 700 10px 'Inter', sans-serif;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, color .15s;
}
.filter-tabs .tab:last-child { border-right: none; }
.filter-tabs .tab:hover { color: #fff; }
.filter-tabs .tab.active {
  background: #fff;
  color: #000;
}
.filter-tabs .t-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  background: #333;
  color: #fff;
  padding: 1px 6px;
  letter-spacing: 1px;
  min-width: 22px;
  text-align: center;
}
.filter-tabs .tab.active .t-count {
  background: #000;
  color: #fff;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #000;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
}
.block-head small {
  font-family: 'JetBrains Mono', monospace;
  color: #888;
  font-weight: 400;
  letter-spacing: 1px;
}
.block-head .ghost {
  background: transparent;
  border: 1px solid #fff;
  color: #fff;
  font: inherit;
  padding: 2px 8px;
  cursor: pointer;
  letter-spacing: 2px;
}
.block-head .ghost:hover { background: #fff; color: #000; }

.status-toggles { display: flex; gap: 12px; font-size: 9px; letter-spacing: 1px; }
.status-toggles label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.status-toggles input { accent-color: #fff; }

.search-row { padding: 8px 12px; border-bottom: 1px solid #ddd; }
.search-row input[type="text"] {
  width: 100%;
  border: 1px solid #000;
  padding: 6px 10px;
  font: 12px 'Inter', sans-serif;
  outline: none;
}
.search-row input[type="text"]:focus { background: #f5f5f5; }
.inline-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #666;
  letter-spacing: 0.5px;
  cursor: pointer;
}
.inline-toggle input { accent-color: #000; cursor: pointer; }

/* Filter list */
.filter-list { overflow-y: auto; flex: 1; }
.filter {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  font-size: 12px;
  transition: background .1s;
}
.filter:hover { background: #f5f5f5; }
.filter.active { background: #000; color: #fff; }
.filter input { accent-color: #000; cursor: pointer; }
.filter.active input { accent-color: #fff; }
.filter .name { flex: 1; }
.filter .count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  background: #eee;
  padding: 2px 7px;
  min-width: 30px;
  text-align: center;
}
.filter.active .count { background: #fff; color: #000; }

/* Type filters: also surface the raw code (FA, ME, SF, ...) */
.filter .code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: #999;
  letter-spacing: 1px;
  padding: 0 6px;
}
.filter.active .code { color: #aaa; }

/* Agency filter rows: two-line layout (name + city/state) */
.filter.agency { gap: 8px; }
.filter.agency .agency-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.filter.agency .name {
  flex: none;
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filter.agency .sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: #888;
  letter-spacing: 0.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filter.agency.active .sub { color: #bbb; }
.filter.agency.empty-agency .count { background: #f0f0f0; color: #aaa; }

/* Address "approx." badge */
.approx {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: #b00;
  border: 1px solid #b00;
  padding: 0 4px;
  margin-left: 4px;
  letter-spacing: 1px;
  vertical-align: 1px;
}
.incident.selected .approx { color: #ff8a8a; border-color: #ff8a8a; }

/* Incident list */
.incident-list { overflow-y: auto; flex: 1; }
.incident {
  padding: 11px 16px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background .1s;
}
.incident:hover { background: #f5f5f5; }
.incident.selected { background: #000; color: #fff; }
.incident.selected .meta { color: #aaa; }
.incident.selected .badge { border-color: #fff; background: #fff; color: #000; }

.incident .line1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.incident .type {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
}
.incident .badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  padding: 1px 6px;
  border: 1px solid #000;
  letter-spacing: 1px;
  white-space: nowrap;
}
.incident .badge.active {
  background: #000;
  color: #fff;
  animation: pulse-badge 2s infinite;
}
@keyframes pulse-badge { 50% { opacity: 0.5; } }
.incident .address { font-size: 12px; margin-bottom: 4px; line-height: 1.3; }
.incident .meta {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #666;
}

/* ── Map ────────────────────────────────────────────────────── */
.map-wrap { grid-area: map; position: relative; }
#map { width: 100%; height: 100%; background: #fff; }
.leaflet-container { background: #f7f7f7 !important; font-family: inherit; }

/* Map controls (top-right floating panel) */
.map-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}
.map-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid #000;
  font: 700 10px 'Inter', sans-serif;
  letter-spacing: 1.5px;
  cursor: pointer;
  user-select: none;
}
.map-toggle input { accent-color: #000; cursor: pointer; }

/* "show hidden (N)" — restores incidents the rep hid from the map.
   Only visible when at least one incident is hidden. */
.map-unhide {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #d11;
  color: #fff;
  border: 1px solid #d11;
  font: 700 10px 'Inter', sans-serif;
  letter-spacing: 1.5px;
  cursor: pointer;
  user-select: none;
}
.map-unhide:hover { background: #fff; color: #d11; }

/* ── Custom markers ─────────────────────────────────────────────────
   Visual language:
     · default      → white dot, black ring        (medical / non-fire)
     · .live        → solid black, animated ping   (call still active)
     · .fire        → solid red                    (fire-related code)
     · .live.fire   → red + ping
     · .approx      → dashed ring (location is the agency centroid,
                      not the actual address — HIPAA-masked incidents)
   ──────────────────────────────────────────────────────────────────── */
.fire-marker { position: relative; }
.fire-marker .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #000;
  box-sizing: border-box;
}
.fire-marker .dot.live    { background: #000; }
.fire-marker .dot.fire    { background: #d11; border-color: #d11; }
.fire-marker .dot.live.fire { background: #d11; border-color: #d11; }
.fire-marker .dot.approx  { border-style: dashed; opacity: 0.85; }

.fire-marker .dot.live::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid #000;
  transform: translate(-50%, -50%);
  animation: ping 2.2s ease-out infinite;
  pointer-events: none;
}
.fire-marker .dot.live.fire::after { border-color: #d11; }
@keyframes ping {
  0%   { width: 12px; height: 12px; opacity: 0.5; }
  80%  { opacity: 0; }
  100% { width: 28px; height: 28px; opacity: 0; }
}

.fire-marker .dot.alert {
  background: #000;
  border: 2px solid #000;
  width: 16px;
  height: 16px;
  transform: rotate(45deg);
  border-radius: 0;
}

/* Popup */
.leaflet-popup-content-wrapper {
  border-radius: 0;
  background: #fff;
  border: 1px solid #000;
  box-shadow: 4px 4px 0 #000;
  padding: 0;
}
.leaflet-popup-content { margin: 12px 14px; font-family: inherit; min-width: 240px; }
.leaflet-popup-tip { background: #000; }
.leaflet-popup-close-button { color: #000 !important; font-size: 20px !important; }

.popup-type { font-weight: 700; letter-spacing: 1px; font-size: 12px; margin-bottom: 6px; text-transform: uppercase; }
.popup-address { font-size: 13px; margin-bottom: 8px; line-height: 1.3; }
.popup-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #666;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.popup-coord {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #888;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}
.popup-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0 8px;
}

/* Date filter — prev / today / native date input / next */
.date-stat { padding: 0 6px; }
.date-nav {
  display: inline-flex;
  align-items: center;
  background: #0a0a0a;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  overflow: hidden;
  font-family: 'JetBrains Mono', monospace;
}
.date-nav-btn {
  background: transparent;
  color: #ccc;
  border: 0;
  padding: 6px 9px;
  cursor: pointer;
  font: 700 13px 'JetBrains Mono', monospace;
  letter-spacing: 0.4px;
}
.date-nav-btn:hover { background: #1a1a1a; color: #fff; }
.date-nav-today {
  font-size: 10px;
  letter-spacing: 1.2px;
  border-left:  1px solid #2a2a2a;
  border-right: 1px solid #2a2a2a;
}
.date-nav-today.active {
  background: #f60;
  color: #fff;
}
.date-nav input[type="date"] {
  background: transparent;
  color: #fff;
  border: 0;
  padding: 5px 6px;
  font: 600 11px 'JetBrains Mono', monospace;
  cursor: pointer;
  color-scheme: dark;
  width: 130px;
}
.date-nav input[type="date"]:focus { outline: none; }
@media (max-width: 700px) {
  .date-stat { padding: 0; }
  .date-nav { border-radius: 5px; }
  .date-nav-btn { padding: 4px 6px; font-size: 12px; min-width: 22px; }
  .date-nav-today { font-size: 9px; padding: 4px 5px; letter-spacing: 0.6px; }
  .date-nav input[type="date"] {
    width: 95px;
    font-size: 10px;
    padding: 4px 4px;
  }
}
@media (max-width: 420px) {
  /* On narrow phones the brand title eats too much room — shrink it
     so the date picker stays usable. The logo square is kept. */
  .brand h1 { font-size: 9px; letter-spacing: 1px; }
  .date-nav input[type="date"] { width: 82px; }
}
@media (max-width: 360px) {
  /* Tiny screens — drop the brand text entirely. */
  .brand h1 { display: none; }
  .date-nav-today { display: none; }
}

/* "live · 12s ago" status pill (FW_Live.mountStatus) */
/* ── Source toggle (header) ─────────────────────────────────────────
   Three-segment pill that switches the FIRES list/map between Citizen,
   PulsePoint and both. Mirrors the look of `.fw-live-pill` for visual
   consistency. */
.src-stat   { padding: 0 0 0 8px; }
.src-toggle {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}
.src-btn {
  font: 700 9px 'JetBrains Mono', monospace;
  letter-spacing: 0.8px;
  padding: 4px 8px;
  background: #fff;
  border: none;
  color: #666;
  cursor: pointer;
  border-right: 1px solid #eee;
  transition: background 0.08s ease, color 0.08s ease;
}
.src-btn:last-child  { border-right: none; }
.src-btn:hover       { background: #eef2f7; color: #06f; }
.src-btn.is-active   { background: #06f; color: #fff; }
.src-btn.is-active:hover { background: #04c; }

.live-stat { padding: 0 0 0 8px; }
.fw-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid #2a2a2a;
  color: #888;
  padding: 5px 10px;
  border-radius: 999px;
  font: 700 10px 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.fw-live-pill:hover {
  border-color: #444;
  color: #ccc;
}
.fw-live-pill.refreshing {
  animation: fw-live-spin 0.6s ease-out;
}
@keyframes fw-live-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.fw-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #888;
  box-shadow: 0 0 6px currentColor;
  flex: 0 0 8px;
}
.fw-live-label { letter-spacing: 1px; }
.fw-live-ago { color: #aaa; font-weight: 500; }
@media (max-width: 700px) {
  .live-stat { padding-left: 4px; }
  .fw-live-pill { padding: 4px 8px; font-size: 9px; }
  .fw-live-label { display: none; }
}
/* Fire badge on the map — round chip showing dispatched unit count.
   Color tier reflects response size so big fires pop out visually. */
.fire-badge-wrap { background: transparent; border: none; }
.fire-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 800 13px/1 'Inter', sans-serif;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  user-select: none;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.fire-badge:hover { transform: scale(1.15); }
.fire-badge.tier-none   { background: #888;   }
.fire-badge.tier-light  { background: #f5a623; } /* 1-2 units */
.fire-badge.tier-medium { background: #e8721c; } /* 3-4 units */
.fire-badge.tier-heavy  { background: #d11;    font-size: 14px; } /* 5+ units */
/* Closed incidents become hollow — outline only — so they fade visually
   compared to live ones but stay readable. */
.fire-badge.closed {
  background: #fff;
  color: #555;
  border-color: #888;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  opacity: 0.85;
}
.fire-badge.closed.tier-heavy  { color: #d11;    border-color: #d11;    }
.fire-badge.closed.tier-medium { color: #e8721c; border-color: #e8721c; }
.fire-badge.closed.tier-light  { color: #f5a623; border-color: #f5a623; }

.popup-units {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ffe7d6;
  color: #a33500;
  border: 1px solid #f60;
  border-radius: 14px;
  padding: 3px 9px;
  font: 700 11px 'Inter', sans-serif;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.popup-units.no-units {
  background: #f0f0f0;
  color: #888;
  border-color: #ccc;
}
.popup-appt-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #d9f0ff;
  color: #064f7a;
  border: 1px solid #2a8bd0;
  border-radius: 14px;
  padding: 3px 9px;
  font: 700 11px 'Inter', sans-serif;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.popup-precision {
  font: 9px/1.2 'JetBrains Mono', monospace;
  color: #b00;
  margin-bottom: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
/* Forward-geocode (Tier A) result badge. Conflict = PP coords and
   address disagree by > 300 m; refined = pin was snapped to address. */
.popup-geo-conflict {
  display: block;
  font: 700 10px/1.3 'Inter', sans-serif;
  color: #8a4b00;
  background: #fff4d6;
  border: 1px solid #f0c060;
  border-radius: 3px;
  padding: 4px 6px;
  margin: 4px 0 8px;
  letter-spacing: 0.3px;
}
.popup-geo-refined {
  display: block;
  font: 600 10px/1.3 'Inter', sans-serif;
  color: #0a6b3a;
  background: #e8f8ee;
  border: 1px solid #a8d8b8;
  border-radius: 3px;
  padding: 3px 6px;
  margin: 4px 0 8px;
  letter-spacing: 0.2px;
}
/* ── Citizen-source specific UI ──────────────────────────────────────
   Severity grades (red/yellow/grey), confirmation badge, video link,
   and AI summary that only appear when the row was sourced from
   Citizen (not PulsePoint). */
.popup-citizen {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 6px;
  align-items: center;
}
.popup-sev {
  display: inline-block;
  font: 800 9px/1 'JetBrains Mono', monospace;
  letter-spacing: 1.2px;
  padding: 3px 6px;
  border-radius: 3px;
  color: #fff;
}
.popup-sev.sev-red    { background: #d11; }
.popup-sev.sev-yellow { background: #f5a623; }
.popup-sev.sev-grey   { background: #888;   }
.popup-conf {
  display: inline-block;
  font: 800 9px/1 'Inter', sans-serif;
  letter-spacing: 0.8px;
  padding: 3px 6px;
  background: #e8f8ee;
  color: #0a6b3a;
  border: 1px solid #a8d8b8;
  border-radius: 3px;
}
.popup-video {
  display: inline-block;
  font: 700 10px/1.1 'Inter', sans-serif;
  padding: 3px 6px;
  background: #fff;
  color: #d11;
  border: 1px solid #d11;
  border-radius: 3px;
  text-decoration: none;
}
.popup-video:hover { background: #d11; color: #fff; }
.popup-ai {
  font: 400 11px/1.4 'Inter', sans-serif;
  color: #444;
  background: #f7f7f7;
  border-left: 3px solid #888;
  padding: 6px 8px;
  margin: 4px 0 6px;
  border-radius: 0 3px 3px 0;
}
.popup-code {
  font: 400 9px/1.1 'JetBrains Mono', monospace;
  color: #888;
  letter-spacing: 0.5px;
}
.popup-streamers {
  display: inline-block;
  font: 700 9px/1 'Inter', sans-serif;
  padding: 3px 6px;
  background: #fff3f3;
  color: #d11;
  border: 1px solid #f3b8b8;
  border-radius: 3px;
}
.popup-audio {
  display: inline-block;
  font: 700 9px/1 'Inter', sans-serif;
  padding: 3px 6px;
  background: #eef5ff;
  color: #06f;
  border: 1px solid #b8d4f3;
  border-radius: 3px;
}
.popup-level {
  display: inline-block;
  font: 800 9px/1 'JetBrains Mono', monospace;
  padding: 3px 6px;
  background: #333;
  color: #fff;
  border-radius: 3px;
  letter-spacing: 1px;
}

/* ── Scene preview photo (popup + detail) ──────────────────────────── */
.popup-photo-wrap {
  margin: -8px -10px 8px;
  max-width: 280px;
  border-radius: 6px 6px 0 0;
  overflow: hidden;
  background: #000;
}
.popup-photo {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
}

/* ── Detail panel: Citizen media block ─────────────────────────────── */
.ctz-media {
  margin: 8px 0 12px;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  position: relative;
}
.ctz-photo {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
}
.ctz-media-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px;
  background: rgba(0,0,0,0.8);
}
.ctz-chip {
  display: inline-block;
  font: 700 10px/1.2 'Inter', sans-serif;
  padding: 4px 8px;
  border-radius: 3px;
  text-decoration: none;
}
.ctz-chip.live-chip {
  background: #d11;
  color: #fff;
}
.ctz-chip.video-chip {
  background: #fff;
  color: #d11;
  border: 1px solid #d11;
}
.ctz-chip.video-chip:hover { background: #d11; color: #fff; }

/* ── Detail panel: Citizen timeline + audio clips ──────────────────── */
.ctz-timeline {
  margin: 16px 0;
  border-top: 1px solid #eee;
  padding-top: 12px;
}
.ctz-timeline h4 {
  margin: 0 0 10px;
  font: 700 10px/1 'Inter', sans-serif;
  letter-spacing: 1.5px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ctz-cnt {
  background: #06f;
  color: #fff;
  font: 800 9px/1.2 'JetBrains Mono', monospace;
  padding: 2px 6px;
  border-radius: 3px;
}
.ctz-timeline ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ctz-update {
  padding: 10px 0;
  border-bottom: 1px solid #f3f3f3;
}
.ctz-update:last-child { border-bottom: none; }
.ctz-update-time {
  font: 600 10px/1 'JetBrains Mono', monospace;
  color: #888;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}
.ctz-update-text {
  font: 400 13px/1.45 'Inter', sans-serif;
  color: #222;
}
.ctz-clip {
  margin-top: 6px;
  padding: 8px;
  background: #f6f8fc;
  border-left: 3px solid #06f;
  border-radius: 0 3px 3px 0;
}
.ctz-clip audio {
  display: block;
  width: 100%;
  height: 32px;
  margin-bottom: 6px;
}
.ctz-clip-text {
  font: 400 12px/1.45 'Inter', sans-serif;
  color: #333;
  font-style: italic;
}
.ctz-clip-src {
  margin-top: 4px;
  font: 500 9px/1 'JetBrains Mono', monospace;
  color: #888;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.audio-transcript {
  margin-top: 8px;
  padding: 8px;
  background: #f6f8fc;
  border-left: 3px solid #06f;
  border-radius: 0 3px 3px 0;
  font: 400 12px/1.45 'Inter', sans-serif;
  color: #333;
  font-style: italic;
}

/* Detail panel AI summary block */
.detail-ai {
  margin: 8px 0 12px;
  padding: 10px 12px;
  background: #f0f4f8;
  border-left: 4px solid #06f;
  border-radius: 0 4px 4px 0;
}
.detail-ai h4 {
  margin: 0 0 6px;
  font: 700 10px/1 'Inter', sans-serif;
  letter-spacing: 1.5px;
  color: #06f;
}
.detail-ai p {
  margin: 0;
  font: 400 13px/1.5 'Inter', sans-serif;
  color: #333;
}

.popup-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.popup-btn {
  background: #000;
  color: #fff;
  border: 1px solid #000;
  padding: 6px 12px;
  cursor: pointer;
  font: 700 10px 'Inter', sans-serif;
  letter-spacing: 1.5px;
}
.popup-btn:hover { background: #fff; color: #000; }
.popup-btn.secondary { background: #fff; color: #000; }
.popup-btn.secondary:hover { background: #000; color: #fff; }
.popup-btn.pinned   { background: #06f; color: #fff; border-color: #06f; }
.popup-btn.pinned:hover { background: #fff; color: #06f; }
.popup-btn.assign   { background: #fff; color: #d11; border-color: #d11; }
.popup-btn.assign:hover { background: #d11; color: #fff; }
.popup-btn.danger   { background: #fff; color: #d11; border-color: #d11; }
.popup-btn.danger:hover { background: #d11; color: #fff; }

.popup-sales {
  margin: 10px 0; padding: 10px; background: #f7f7f7; border: 1px solid #ddd;
}
.popup-sales .sales-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.popup-sales label {
  font: 700 9px 'Inter', sans-serif; letter-spacing: 2px; color: #777;
  min-width: 60px;
}
.popup-sales select {
  flex: 1; padding: 4px 8px; font: 11px 'JetBrains Mono', monospace;
  border: 1px solid #000; outline: none;
}

.pin-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  background: #06f;
  color: #fff;
  padding: 1px 6px;
  margin-left: 6px;
  letter-spacing: 1px;
  vertical-align: 1px;
}

.incident.pinned {
  background: #f0f6ff;
  border-left: 3px solid #06f;
}
.incident.pinned.selected {
  background: #06f;
  color: #fff;
}
.incident.pinned .meta { color: #335577; }
.incident.pinned.selected .meta { color: #cfe; }

/* ── Detail panel ───────────────────────────────────────────── */
.detail-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 420px;
  max-height: 70vh;
  background: #fff;
  border: 1px solid #000;
  box-shadow: 6px 6px 0 #000;
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}
.detail-panel.open { display: flex; }
.detail-panel .close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #000;
  z-index: 2;
}
#detailBody {
  padding: 20px;
  overflow-y: auto;
}
.detail-head {
  border-bottom: 1px solid #000;
  padding-bottom: 12px;
  margin-bottom: 12px;
}
.detail-head .t {
  font-size: 11px;
  letter-spacing: 3px;
  font-weight: 700;
  margin-bottom: 4px;
}
.detail-head .a { font-size: 15px; font-weight: 600; line-height: 1.3; margin-bottom: 6px; }
.detail-head .m {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #666;
}
.detail-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  padding: 7px 0;
  border-bottom: 1px solid #eee;
  font-size: 12px;
}
.detail-row .k {
  font-size: 9px;
  letter-spacing: 2px;
  color: #999;
  font-weight: 700;
  padding-top: 2px;
}
.detail-row .v {
  font-family: 'JetBrains Mono', monospace;
  word-break: break-word;
}
.detail-units { margin-top: 12px; }
.detail-units h4 {
  font-size: 10px;
  letter-spacing: 3px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #000;
}
.unit {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  border-bottom: 1px dotted #ddd;
}
.detail-audio { margin-top: 16px; }
.detail-audio h4 {
  font-size: 10px;
  letter-spacing: 3px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #000;
}
.detail-audio audio { width: 100%; }
.no-audio {
  font-size: 11px;
  color: #999;
  font-style: italic;
  padding: 8px 0;
}

/* ── Empty / loading ────────────────────────────────────────── */
.empty {
  padding: 40px 20px;
  text-align: center;
  color: #999;
  font-size: 12px;
  letter-spacing: 1px;
}
.loading {
  padding: 20px;
  text-align: center;
  color: #999;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

/* Scrollbars (chrome) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #fff; }
::-webkit-scrollbar-thumb { background: #ddd; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* ──────────────────────────────────────────────────────────────────
   IMMERSIVE NAVIGATION MODE
   ──────────────────────────────────────────────────────────────────
   When the sales rep taps NAVIGATE, JS adds `.nav-mode` to <body>.
   The map fills the screen, all other chrome hides, and the giant
   maneuver panel + EXIT bar are revealed.
   ────────────────────────────────────────────────────────────────── */

/* Hide everything else; keep only the map and our two overlays. */
body.nav-mode .topbar,
body.nav-mode .sidebar,
body.nav-mode .map-controls,
body.nav-mode .fab-directions,
body.nav-mode .loc-banner,
body.nav-mode .loc-pill,
body.nav-mode .burger,
body.nav-mode .topnav { display: none !important; }

body.nav-mode .app {
  grid-template-rows: 1fr;
  grid-template-areas: 'map';
}
body.nav-mode .map-wrap { grid-area: map; }
body.nav-mode #map { width: 100vw !important; height: 100vh !important; }

/* Top maneuver card — big, blue, hard to miss */
.nav-maneuver {
  position: fixed;
  top: env(safe-area-inset-top);
  left: 0; right: 0;
  background: #06f;
  color: #fff;
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 18px;
  box-shadow: 0 6px 0 rgba(0,102,255,0.4), 0 6px 18px rgba(0,0,0,0.3);
  font-family: 'Inter', sans-serif;
}
.nav-maneuver .nm-arrow {
  font-size: 56px;
  line-height: 1;
  font-weight: 700;
  width: 64px;
  text-align: center;
}
.nav-maneuver .nm-text { flex: 1; min-width: 0; }
.nav-maneuver .nm-instruction {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-maneuver .nm-distance {
  font: 700 16px 'JetBrains Mono', monospace;
  opacity: 0.85;
}
.nav-maneuver .nm-eta {
  text-align: center;
  background: rgba(0,0,0,0.25);
  padding: 8px 12px;
  border-radius: 4px;
  min-width: 64px;
}
.nav-maneuver .nm-eta-val {
  display: block;
  font: 900 22px 'JetBrains Mono', monospace;
  line-height: 1;
}
.nav-maneuver .nm-eta small {
  font: 700 10px 'Inter', sans-serif;
  letter-spacing: 1.5px;
  opacity: 0.8;
}

.nav-maneuver.arrived {
  background: #0a7;
  box-shadow: 0 6px 0 rgba(10,170,80,0.4), 0 6px 18px rgba(0,0,0,0.3);
}
.nav-maneuver.arrived .nm-instruction {
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* Bottom destination bar with EXIT button */
.nav-bottom {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #000;
  color: #fff;
  z-index: 2000;
  display: flex;
  align-items: stretch;
  border-top: 2px solid #06f;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-bottom-info {
  flex: 1;
  padding: 14px 18px;
  min-width: 0;
}
.nav-bottom-dest {
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}
.nav-bottom-stats {
  font: 700 12px 'JetBrains Mono', monospace;
  color: #6cf;
  letter-spacing: 1px;
}
.nav-bottom .nb-eta { color: #fc6; }
.nav-bottom .nav-exit {
  background: #d11; color: #fff;
  border: none;
  padding: 0 24px;
  font: 900 12px 'Inter', sans-serif;
  letter-spacing: 3px;
  cursor: pointer;
  min-width: 84px;
}
.nav-bottom .nav-exit:hover { background: #fff; color: #d11; }

/* RECENTER button — appears only when the user has manually moved
   the map away from their current location. */
.nav-recenter {
  position: fixed;
  right: 16px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 2010;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 64px; height: 64px;
  padding: 0;
  background: #06f;
  color: #fff;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), 0 0 0 2px #06f;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.nav-recenter.visible { display: flex; }
.nav-recenter:hover  { background: #fff; color: #06f; }
.nav-recenter .nrc-icon { font-size: 22px; line-height: 1; }
.nav-recenter .nrc-text { font-size: 8px; font-weight: 700; letter-spacing: 1px; }

/* ME arrow marker — rotates with the device heading */
.nav-me-marker { background: transparent !important; border: none !important; }
.nav-me-arrow {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: #06f;
  color: #fff;
  border-radius: 50%;
  border: 3px solid #fff;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 0 0 2px #06f, 0 4px 12px rgba(0,0,0,0.4);
  transition: transform 0.3s ease-out;
}

/* Destination pin (larger version of the orange appt pin) */
.nav-dest-marker { background: transparent !important; border: none !important; }
.nav-dest-pin {
  width: 40px; height: 48px;
  background: #ff8800;
  color: #fff;
  text-align: center;
  line-height: 40px;
  font-size: 26px;
  clip-path: polygon(50% 100%, 0 60%, 0 0, 100% 0, 100% 60%);
  border: 3px solid #fff;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

/* Leaflet polyline custom class — main nav route on sales view */
.leaflet-overlay-pane path.nav-route {
  stroke-dasharray: 0;
  filter: drop-shadow(0 0 6px rgba(0,102,255,0.7));
}

/* Admin / appointments page — dashed link between sales and dest */
.leaflet-overlay-pane path.admin-route {
  stroke-dasharray: 8 8;
  opacity: 0.7;
}

/* On phones, scale everything down a hair so a narrow display
   doesn't crowd the maneuver text. */
@media (max-width: 700px) {
  .nav-maneuver { padding: 14px 14px; gap: 12px; }
  .nav-maneuver .nm-arrow { font-size: 42px; width: 50px; }
  .nav-maneuver .nm-instruction { font-size: 18px; }
  .nav-maneuver .nm-distance { font-size: 14px; }
  .nav-maneuver .nm-eta { padding: 6px 10px; min-width: 56px; }
  .nav-maneuver .nm-eta-val { font-size: 18px; }
  .nav-bottom-info { padding: 12px 14px; }
  .nav-bottom-dest { font-size: 13px; }
  .nav-bottom .nav-exit { padding: 0 18px; min-width: 70px; }
}

/* ── Floating Action Button (sales: next-appointment shortcut) ────── */
/*
  Round red FAB sitting above the bottom-sheet's collapsed handle.
  On desktop it lives in the lower-right corner of the map.
  The icon-only design avoids text being chopped by the sheet.
*/
.fab-directions {
  position: fixed;
  right: 16px;
  bottom: calc(80px + env(safe-area-inset-bottom));
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 64px; height: 64px;
  background: #d11;
  color: #fff;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), 0 0 0 2px #d11;
  font: 700 8px 'Inter', sans-serif;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 0;
  text-align: center;
  line-height: 1.1;
}
.fab-directions:hover { background: #000; box-shadow: 0 4px 12px rgba(0,0,0,0.5), 0 0 0 2px #000; }
.fab-directions .fab-icon { font-size: 22px; line-height: 1; margin-bottom: 2px; }
.fab-directions .fab-text { font-size: 8px; }
.fab-directions.active {
  background: #fc6;
  color: #000;
  border-color: #fc6;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), 0 0 0 2px #d11;
}

/* Segmented status control — replaces dropdown on mobile for sales */
.status-segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-top: 6px;
  border: 1px solid #000;
}
.status-segmented button {
  background: #fff;
  color: #000;
  border: none;
  border-right: 1px solid #ddd;
  padding: 10px 4px;
  font: 700 9px 'Inter', sans-serif;
  letter-spacing: 1px;
  cursor: pointer;
  min-height: 40px;
}
.status-segmented button:last-child { border-right: none; }
.status-segmented button.active { background: #000; color: #fff; }
.status-segmented button.active.scheduled  { background: #ff8800; }
.status-segmented button.active.en_route   { background: #06f; }
.status-segmented button.active.arrived    { background: #0a7; }
.status-segmented button.active.completed  { background: #555; }

/* ── Hamburger menu (visible on mobile only) ─────────────────────── */
.burger {
  display: none;
  width: 40px; height: 40px;
  background: transparent;
  border: 1px solid #fff;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  margin-left: auto;
}
.burger span {
  width: 18px; height: 2px; background: #fff;
  transition: transform 0.2s, opacity 0.2s;
}
.burger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ──────────────────────────────────────────────────────────────────
   MOBILE (≤ 700 px)
   ──────────────────────────────────────────────────────────────────
   On phones the whole layout flips:
     - Top bar shrinks; nav buttons hide behind a hamburger
     - Sidebar turns into a bottom-sheet that drags up
     - Map takes the full viewport
     - All interactive elements pad to a 44px touch target
     - Inputs use 16px font to suppress iOS auto-zoom
   ────────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {

  body { font-size: 14px; }

  /* App layout becomes a stack: topbar + full-screen map.
     The sidebar will be position:fixed (see below). */
  .app {
    grid-template-rows: 48px 1fr;
    grid-template-columns: 1fr;
    grid-template-areas:
      'top'
      'map';
  }

  /* ── Topbar ─────────────────────────────────────────────────── */
  .topbar {
    padding: 0 12px 0 14px;
    padding-top: env(safe-area-inset-top);
    height: calc(48px + env(safe-area-inset-top));
    gap: 8px;
  }
  .brand h1 { font-size: 11px; letter-spacing: 2px; }
  .brand .logo { font-size: 17px; }

  /* Counts are hidden on phone (in-app counters are enough), but the
     date picker MUST stay visible — it's the key per-day filter. */
  .stats {
    display: flex;
    gap: 4px;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
    margin: 0;
    min-width: 0;
  }
  /* On mobile only the date picker + source toggle stay in the
     header — everything else is squeezed for room. */
  .stats > .stat:not(.date-stat):not(.src-stat) { display: none; }
  .date-stat { padding: 0; flex: 0 0 auto; }
  .src-stat  { padding: 0 0 0 4px; flex: 0 0 auto; }
  .src-btn   { padding: 4px 6px; font-size: 9px; }

  /* Let brand shrink/ellipsis instead of pushing the date picker
     off the right edge of the screen on narrow phones. */
  .brand { min-width: 0; flex-shrink: 1; }
  .brand h1 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  /* Burger button is shown on phone, otherwise hidden */
  .burger { display: flex; flex-shrink: 0; }

  /* topnav floats out as a dropdown panel below the topbar */
  .topnav {
    position: absolute;
    top: calc(48px + env(safe-area-inset-top));
    right: 0;
    width: 220px;
    flex-direction: column;
    align-items: stretch !important;
    margin-left: 0;
    background: #000;
    border-left: 1px solid #d11;
    border-bottom: 1px solid #d11;
    padding: 12px;
    gap: 8px !important;
    z-index: 1000;
    transform: translateX(110%);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 4px 0 rgba(209, 17, 17, 0.4);
  }
  .topnav.open { transform: translateX(0); }
  .topnav .who {
    margin: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
    font-size: 11px;
  }
  /* On mobile the TOOLS dropdown drops INLINE inside the burger panel
     instead of floating absolutely off-screen. */
  .topnav .nav-dropdown { width: 100%; }
  .topnav .nav-dropdown-menu {
    position: static;
    width: 100%;
    min-width: 0;
    margin-top: 6px;
    border: 1px solid #333;
    background: #1a1a1a;
    box-shadow: none;
  }
  .topnav .nav-dropdown-item {
    text-align: center;
    padding: 10px 8px;
    font-size: 11px;
    letter-spacing: 1.5px;
  }

  .topnav .nav-btn, .topnav .loc-pill {
    display: block;
    text-align: center;
    padding: 12px 8px;
    min-height: 44px;
    line-height: 20px;
    font-size: 11px;
    width: 100%;
  }

  /* ── Sidebar as a bottom-sheet ──────────────────────────────── */
  .sidebar {
    position: fixed;
    left: 0; right: 0;
    top: 0;
    height: 100vh;
    width: 100vw;
    z-index: 700;
    background: #fff;
    border-right: none;
    border-top: 1px solid #000;
    box-shadow: 0 -6px 0 rgba(209, 17, 17, 0.2);
    transform: translateY(calc(100vh - 56px));   /* JS overrides this */
    will-change: transform;
  }
  /* When fully expanded the sheet must sit above the address search
     bar (z-index 1000) so its drag handle is reachable. */
  .sidebar.sheet-full {
    z-index: 1200;
  }
  /* Push the address-search out of the way when the sheet is fully
     up — keeps the screen clean and prevents accidental taps on the
     map controls that would be hidden behind the sheet anyway. */
  body.sheet-full-mode .addr-search {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
  }

  /* Drag handle injected by mobile.js */
  .sheet-handle {
    position: relative;
    height: 36px;
    background: #000;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    cursor: grab;
    user-select: none;
    touch-action: none;
  }
  .sheet-handle:active { cursor: grabbing; }
  .sheet-grip {
    width: 44px; height: 5px; border-radius: 3px;
    background: #888;
  }
  .sheet-handle::after {
    content: 'FILTERS · INCIDENTS';
    position: absolute; right: 12px;
    font: 700 9px 'Inter', sans-serif; letter-spacing: 2px;
    color: #777;
  }

  /* Tabs / blocks inside the sheet get larger touch targets */
  .filter-tabs .tab { padding: 14px 12px; min-height: 48px; }
  .filter-tabs .t-label { font-size: 11px; }
  .block-head { padding: 12px 16px; font-size: 11px; }
  .block-head .ghost { padding: 6px 12px; min-height: 32px; }

  /* Inputs at 16px to avoid the iOS auto-zoom-on-focus behaviour */
  .search-row input[type="text"],
  .ap-modal-card input, .ap-modal-card select, .ap-modal-card textarea {
    font-size: 16px;
    padding: 12px 14px;
    min-height: 44px;
  }

  /* Filter rows: bigger, more tappable */
  .filter { padding: 12px 16px; min-height: 48px; font-size: 13px; }
  .filter .count { font-size: 11px; min-width: 36px; padding: 3px 8px; }
  .filter.agency .agency-body { gap: 4px; }
  .filter.agency .name { font-size: 13px; }
  .filter.agency .sub { font-size: 10px; }

  /* Incident list items */
  .incident { padding: 14px 16px; }
  .incident .type { font-size: 13px; }
  .incident .address { font-size: 13px; }
  .incident .meta { font-size: 10px; }

  /* Appointments list items */
  .ap-item { padding: 14px 16px; min-height: 80px; }
  .ap-item-head { font-size: 11px; }
  .ap-addr { font-size: 14px; line-height: 1.35; margin-bottom: 6px; }
  .ap-meta { font-size: 11px; }
  .ap-status-sel { padding: 10px 8px; font-size: 13px; min-height: 44px; }
  .ap-actions .popup-btn { padding: 12px 14px; min-height: 44px; flex: 1; }

  /* ── Map ────────────────────────────────────────────────────── */
  /*  !important needed because the JS lockSize() helper from
      desktop sessions may have left inline width/height pixels on
      #map — those would override our CSS. */
  .map-wrap { grid-area: map; position: relative; }
  #map { width: 100% !important; height: 100% !important; }

  /* Move controls into the top-left corner away from the burger */
  .map-controls {
    top: calc(48px + env(safe-area-inset-top) + 8px);
    right: 8px;
    gap: 6px;
  }
  .map-toggle {
    padding: 6px 10px;
    font-size: 10px;
    min-height: 32px;
  }

  /* Leaflet zoom buttons larger for fingers */
  .leaflet-bar a {
    width: 36px !important; height: 36px !important;
    line-height: 36px !important; font-size: 22px !important;
  }

  /* Popup wider, larger touch targets */
  .leaflet-popup-content { margin: 10px 12px; min-width: 220px; max-width: 260px; }
  .leaflet-popup-content .popup-btn {
    padding: 10px 14px; min-height: 40px; font-size: 11px;
  }
  .popup-actions { flex-wrap: wrap; }

  /* Detail panel: full-width on phone */
  .detail-panel {
    right: 0; left: 0; bottom: 0;
    width: 100vw;
    max-height: 80vh;
    box-shadow: 0 -4px 0 #000;
    border-bottom: none;
  }
  #detailBody { padding: 16px; }

  /* Privacy banner — center, takes whole width */
  .loc-banner {
    left: 12px; right: 12px;
    transform: none;
    max-width: none;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
  }
  .loc-banner-close { width: 100%; padding: 14px; min-height: 48px; }

  /* Appointment-creation modal — phone-sized */
  .ap-modal-card {
    width: calc(100vw - 24px);
    margin: 0 12px;
    padding: 20px 16px;
    max-height: 92vh;
    overflow-y: auto;
  }
  .ap-modal-card h3 { font-size: 13px; }
  .ap-btn { padding: 14px 18px; min-height: 48px; font-size: 12px; flex: 1; }

  /* ── Login page ─────────────────────────────────────────────── */
  .wrap { padding: 16px; }
  .card {
    width: 100% !important;
    max-width: 400px;
    padding: 28px 22px !important;
    box-shadow: 6px 6px 0 #d11;
  }
  .card input[type="email"], .card input[type="password"] {
    font-size: 16px; padding: 14px 14px; min-height: 48px;
  }
  .card button { padding: 16px; min-height: 52px; }

  /* ── Admin / users page ─────────────────────────────────────── */
  /* Topbar of /admin/users.html mirrors the main app */
  .topbar .actions {
    position: absolute;
    top: calc(48px + env(safe-area-inset-top));
    right: 0;
    flex-direction: column;
    background: #000;
    padding: 12px;
    border-left: 1px solid #d11;
    border-bottom: 1px solid #d11;
    gap: 8px;
    width: 200px;
    transform: translateX(110%);
    transition: transform 0.22s;
    z-index: 1000;
  }
  .topbar .actions.open { transform: translateX(0); }
  .topbar .actions a, .topbar .actions button {
    margin-left: 0;
    width: 100%;
    text-align: center;
    padding: 12px 8px;
    min-height: 44px;
  }
  .topbar .crumb { display: none; }

  main { padding: 14px 12px; }

  /* Create-user form stacks vertically */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .form-row input, .form-row select {
    font-size: 16px;
    min-height: 44px;
    padding: 12px;
  }
  .form-row button {
    padding: 14px;
    min-height: 48px;
    font-size: 12px;
  }

  /* Users table → card view */
  .card-body table thead { display: none; }
  .card-body table, .card-body table tbody, .card-body table tr,
  .card-body table td {
    display: block;
    width: 100%;
  }
  .card-body table tr {
    border-bottom: 8px solid #fff;
    border-top: 1px solid #eee;
    padding: 12px 16px;
    position: relative;
  }
  .card-body table td {
    padding: 4px 0;
    border-bottom: none;
    font-size: 13px;
  }
  .card-body table td.mono { font-size: 12px; }
  .card-body table td:nth-child(1)::before { content: 'EMAIL: ';   font-weight: 700; color: #999; font-size: 9px; letter-spacing: 1.5px; }
  .card-body table td:nth-child(2)::before { content: 'NAME: ';    font-weight: 700; color: #999; font-size: 9px; letter-spacing: 1.5px; }
  .card-body table td:nth-child(3)::before { content: 'ROLE: ';    font-weight: 700; color: #999; font-size: 9px; letter-spacing: 1.5px; margin-right: 4px; }
  .card-body table td:nth-child(4)::before { content: 'STATUS: ';  font-weight: 700; color: #999; font-size: 9px; letter-spacing: 1.5px; margin-right: 4px; }
  .card-body table td:nth-child(5)::before { content: 'CREATED: '; font-weight: 700; color: #999; font-size: 9px; letter-spacing: 1.5px; }
  .card-body table td:nth-child(6)::before { content: 'LAST LOGIN: '; font-weight: 700; color: #999; font-size: 9px; letter-spacing: 1.5px; }
  .card-body table td:nth-child(7) {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .card-body table td:nth-child(7) .act-btn {
    padding: 10px 12px; min-height: 40px; font-size: 11px; flex: 1; min-width: 100px;
  }

  /* ── Bottom area safe-area on iPhone ───────────────────────── */
  .leaflet-bottom { margin-bottom: env(safe-area-inset-bottom); }
}

/* Larger phones / small tablets (701-900) — keep desktop layout
   but loosen sidebar width so map gets more space. */
@media (min-width: 701px) and (max-width: 900px) {
  .app {
    grid-template-columns: 320px 1fr;
  }
}

/* ── Property lookup popup (Grok live-search) ─────────────────────── */
.lookup-pin .lp-pin-inner {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #06f;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700; font-size: 14px;
}
/* Building outline drawn on top of the satellite tile when the lookup
   popup finds a matching OSM polygon. Pulse subtly so the user can
   tell "yes — THIS is the house you tapped". */
.lookup-building-outline {
  animation: lookupOutlinePulse 1.4s ease-out 1;
}
@keyframes lookupOutlinePulse {
  0%   { stroke-opacity: 0;   fill-opacity: 0;    stroke-width: 1; }
  40%  { stroke-opacity: 1;   fill-opacity: 0.35; stroke-width: 5; }
  100% { stroke-opacity: 0.95; fill-opacity: 0.15; stroke-width: 3; }
}
.leaflet-popup.lookup-leaflet-popup .leaflet-popup-content-wrapper {
  background: #111;
  color: #eee;
  border-radius: 10px;
  box-shadow: 0 6px 22px rgba(0,0,0,0.5);
}
.leaflet-popup.lookup-leaflet-popup .leaflet-popup-content {
  margin: 10px 12px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.35;
  max-height: 70vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
/* Make the popup wrapper not constrain our scrollable area. */
.leaflet-popup.lookup-leaflet-popup .leaflet-popup-content-wrapper {
  padding: 0;
}
/* Custom scrollbar for the popup contents (Chrome/Safari). */
.leaflet-popup.lookup-leaflet-popup .leaflet-popup-content::-webkit-scrollbar {
  width: 5px;
}
.leaflet-popup.lookup-leaflet-popup .leaflet-popup-content::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 3px;
}
.leaflet-popup.lookup-leaflet-popup .leaflet-popup-tip {
  background: #111;
}
.lookup-popup .lp-addr-line {
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
  word-break: break-word;
  padding-right: 28px; /* space for floating X-close */
  position: sticky;
  top: 0;
  z-index: 6;
  background: #111;
  padding-top: 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid #222;
}
/* Floating X-close — visible even when popup is scrolled. */
.lookup-popup .lp-x-close {
  position: absolute;
  top: 6px; right: 6px;
  z-index: 10;
  width: 28px; height: 28px;
  border: 0;
  border-radius: 50%;
  background: #333;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lookup-popup .lp-x-close:hover { background: #d11; }
.lookup-popup .lp-addr {
  font-size: 12.5px;
  color: #ddd;
}
.lookup-popup .lp-actions {
  display: flex; gap: 6px; margin-bottom: 6px;
}
.lookup-popup .lp-btn {
  flex: 1;
  padding: 8px 10px;
  background: #06f;
  color: #fff;
  border: 0;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.3px;
  cursor: pointer;
}
.lookup-popup .lp-btn.lp-close {
  background: #333;
  flex: 0 0 60px;
}
.lookup-popup .lp-btn:disabled { opacity: 0.55; cursor: default; }
.lookup-popup .lp-btn:hover:not(:disabled) { filter: brightness(1.15); }

/* ── Split lookup buttons (FROM DB / ASK GROK) ─────────────────────
   Two stacked rows so the labels and cost hints fit comfortably on
   phones; on wide popups they sit side-by-side. */
.lookup-popup .lp-actions-split {
  display: flex; gap: 6px; margin-bottom: 6px;
}
.lookup-popup .lp-actions-split .lp-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 1px;
  padding: 8px 6px;
  line-height: 1.1;
}
.lookup-popup .lp-actions-split .lp-btn-icon {
  font-size: 16px;
  line-height: 1;
}
.lookup-popup .lp-actions-split .lp-btn-label {
  font-size: 11px;
  letter-spacing: 0.8px;
  font-weight: 800;
}
.lookup-popup .lp-actions-split .lp-btn-sub {
  font-size: 9.5px;
  opacity: 0.85;
  font-weight: 500;
  letter-spacing: 0.2px;
}
.lookup-popup .lp-fetch-db {
  background: #0a7a2e; /* green = free */
}
.lookup-popup .lp-fetch-grok {
  background: #b85e00; /* orange = paid */
}

/* Empty-state when DB has no match for this address. Includes the
   "escalate to Grok" CTA inline. */
.lookup-popup .lp-empty-state {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 14px 10px;
  background: #1a1a1a;
  border-radius: 6px;
  margin-top: 4px;
}
.lookup-popup .lp-empty-icon { font-size: 28px; opacity: 0.7; }
.lookup-popup .lp-empty-title {
  font-weight: 700;
  font-size: 13px;
  color: #ddd;
}
.lookup-popup .lp-empty-msg {
  font-size: 11.5px;
  color: #999;
  text-align: center;
  line-height: 1.4;
}
.lookup-popup .lp-escalate-grok {
  background: #b85e00;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  font: 700 11.5px 'Inter', sans-serif;
  letter-spacing: 0.5px;
  cursor: pointer;
  margin-top: 4px;
}
.lookup-popup .lp-escalate-grok:hover { filter: brightness(1.15); }

/* Source badges shown above the result. Three distinct colours so
   the sales rep can instantly see whether the data is free DB,
   cached Grok, or fresh paid Grok. */
.lookup-popup .lp-source {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font: 700 9.5px 'JetBrains Mono', monospace;
  letter-spacing: 0.6px;
  white-space: nowrap;
}
.lookup-popup .lp-source-db    { background: #0a7a2e; color: #fff; }
.lookup-popup .lp-source-cache { background: #b8860b; color: #000; }
.lookup-popup .lp-source-grok  { background: #b85e00; color: #fff; }

.lookup-popup .lp-loading {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: #aaa; padding: 10px 0;
}
.lookup-popup .lp-loading-msg {
  flex: 1;
  color: #ccc;
}
.lookup-popup .lp-loading-timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #06f;
  font-weight: 700;
}
.lookup-popup .lp-spinner {
  width: 12px; height: 12px;
  border: 2px solid #444;
  border-top-color: #06f;
  border-radius: 50%;
  animation: lp-spin 0.8s linear infinite;
}
@keyframes lp-spin { to { transform: rotate(360deg); } }

.lookup-popup .lp-meta {
  display: flex; gap: 6px; margin-bottom: 6px;
}
.lookup-popup .lp-conf {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.lookup-popup .lp-conf-high   { background: #1a7;  color: #fff; }
.lookup-popup .lp-conf-medium { background: #b80;  color: #fff; }
.lookup-popup .lp-conf-low    { background: #b33;  color: #fff; }
.lookup-popup .lp-cached {
  display: inline-block;
  padding: 2px 6px;
  background: #333;
  color: #aaa;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 600;
}
.lookup-popup .lp-refresh {
  display: inline-block;
  padding: 2px 6px;
  background: #06f;
  color: #fff;
  border: 0;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 600;
  cursor: pointer;
}
.lookup-popup .lp-refresh:hover { background: #04c; }
.lookup-popup .lp-permanent {
  display: inline-block;
  padding: 2px 6px;
  background: linear-gradient(135deg, #1a7 0%, #095 100%);
  color: #fff;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.lookup-popup .lp-summary {
  background: #1a1a1a;
  padding: 6px 8px;
  border-left: 3px solid #06f;
  border-radius: 4px;
  margin-bottom: 6px;
  color: #ddd;
  font-size: 12px;
}
.lookup-popup .lp-rows { margin-bottom: 6px; }
.lookup-popup .lp-row {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 3px 0;
  border-bottom: 1px dotted #2a2a2a;
}
.lookup-popup .lp-row:last-child { border-bottom: 0; }
.lookup-popup .lp-k {
  color: #888;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.lookup-popup .lp-v {
  color: #fff;
  text-align: right;
  word-break: break-word;
  font-size: 12px;
  font-weight: 500;
}
.lookup-popup .lp-sources {
  margin-top: 6px;
  font-size: 10.5px;
  color: #888;
  line-height: 1.45;
}
.lookup-popup .lp-sources a {
  color: #69aaff;
  text-decoration: none;
}
.lookup-popup .lp-sources a:hover { text-decoration: underline; }
.lookup-popup .lp-disclaimer {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #2a2a2a;
  font-size: 10px;
  color: #666;
  font-style: italic;
}
.lookup-popup .lp-empty {
  color: #999;
  font-size: 12px;
  padding: 6px 0;
}
.lookup-popup .lp-error {
  color: #f88;
  background: #2a1414;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
}
.lookup-popup .lp-cost {
  display: inline-block;
  padding: 2px 6px;
  background: #1a3a1a;
  color: #8fa;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 600;
}
.lookup-popup .lp-warning {
  margin-bottom: 6px;
  padding: 5px 8px;
  background: #3a2e10;
  color: #ffd;
  font-size: 11.5px;
  border-radius: 4px;
  border-left: 3px solid #fb0;
}

/* Floating address search box — sits over the top of the map. */
.addr-search {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: stretch;
  gap: 0;
  width: min(420px, calc(100vw - 24px));
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  overflow: hidden;
}
.addr-search input[type="search"] {
  flex: 1;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  color: #111;
  outline: none;
  min-width: 0;
}
.addr-search input[type="search"]::placeholder { color: #888; }
.addr-search input[type="search"]:disabled { opacity: 0.5; }
.addr-search-btn {
  background: #06f;
  color: #fff;
  border: 0;
  width: 44px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.addr-search-btn:hover { background: #04c; }
@media (max-width: 700px) {
  .addr-search {
    top: 8px;
    width: calc(100vw - 16px);
    font-size: 14px;
  }
  .addr-search input[type="search"] { padding: 12px 14px; font-size: 14px; }
  .addr-search-btn { width: 48px; font-size: 18px; }
}

/* ── Batch lookup (admin/mgr desktop) ──────────────────────────── */
.batch-toggle span { font-weight: 700; color: #06f; }
.map-wrap.batch-mode #map, body.batch-mode .leaflet-container {
  cursor: crosshair !important;
}

.batch-pin-marker { background: none !important; border: 0 !important; }
.batch-pin {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  background: #06f;
  color: #fff;
  font: 800 13px 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.batch-pin.resolving { background: #888; color: #fff; animation: batch-pulse 1.2s infinite; }
.batch-pin.loading   { background: #fb0; color: #000; animation: batch-pulse 0.8s infinite; }
.batch-pin.done      { background: #0a7; }
.batch-pin.error     { background: #c33; }
@keyframes batch-pulse { 50% { transform: scale(1.18); } }

.batch-drawer {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1100;
  width: 380px;
  max-height: calc(100vh - 28px);
  background: #fff;
  border: 1px solid #000;
  box-shadow: 4px 4px 0 #000;
  display: flex;
  flex-direction: column;
}
.batch-head {
  padding: 12px 14px;
  background: #06f;
  color: #fff;
  font: 700 12px 'Inter', sans-serif;
  letter-spacing: 2px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.batch-title { display: inline-flex; align-items: center; gap: 4px; }
.batch-close {
  background: transparent;
  border: 1px solid #fff;
  color: #fff;
  width: 24px; height: 24px;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}
.batch-close:hover { background: #fff; color: #06f; }
.batch-hint {
  padding: 8px 14px;
  font: 11px 'Inter', sans-serif;
  color: #555;
  background: #f5f5f5;
  border-bottom: 1px solid #eee;
}
.batch-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.batch-empty { padding: 30px 14px; text-align: center; color: #999; font-size: 12px; }
.batch-row {
  padding: 8px 14px;
  border-bottom: 1px dotted #eee;
  transition: background 0.3s;
}
.batch-row.flash {
  animation: batch-flash 0.7s ease-out 2;
}
@keyframes batch-flash {
  0%   { background: #ffe066; }
  100% { background: transparent; }
}
.batch-row-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.batch-num {
  background: #06f;
  color: #fff;
  font: 700 10px 'JetBrains Mono', monospace;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0;
}
.batch-addr {
  flex: 1;
  font-size: 12.5px;
  color: #222;
  word-break: break-word;
  min-width: 0;
}
.batch-status {
  font: 700 9px 'Inter', sans-serif;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 3px;
  color: #fff;
}
.batch-status.resolving { background: #555; }
.batch-status.queued    { background: #888; }
.batch-status.loading   { background: #fb0; color: #000; }
.batch-status.done      { background: #0a7; }
.batch-status.error     { background: #c33; cursor: help; }
.batch-x {
  background: transparent;
  border: 0;
  color: #c33;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  width: 20px; height: 20px;
}
.batch-x:hover { background: #c33; color: #fff; border-radius: 50%; }
.batch-owner {
  margin-top: 4px;
  font: 600 12px 'Inter', sans-serif;
  color: #222;
  background: #f0f7ff;
  padding: 3px 6px;
  border-left: 2px solid #06f;
}
.batch-phones {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.batch-phone {
  font: 700 11px 'JetBrains Mono', monospace;
  background: #eef;
  border: 1px solid #ccd;
  color: #06f;
  padding: 2px 6px;
  text-decoration: none;
}
.batch-phone:hover { background: #06f; color: #fff; }
.batch-more { font-size: 10.5px; color: #888; padding: 2px 4px; }
.batch-actions {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid #ddd;
  background: #fafafa;
}
.batch-btn {
  flex: 1;
  padding: 9px 8px;
  border: 1px solid #000;
  background: #fff;
  color: #000;
  font: 700 10px 'Inter', sans-serif;
  letter-spacing: 1px;
  cursor: pointer;
}
.batch-btn.primary { background: #06f; color: #fff; border-color: #06f; }
.batch-btn.primary:hover:not(:disabled) { background: #04c; }
.batch-btn.secondary:hover:not(:disabled) { background: #eee; }
.batch-btn:disabled { opacity: 0.4; cursor: default; }

@media (max-width: 900px) {
  .batch-drawer {
    width: calc(100% - 28px);
    top: 60px;
  }
}

/* Colored map pins for knocked houses (Lead / Prospect / Signed) */
.knock-marker { background: none !important; border: 0 !important; }
.knock-pin {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.35);
  color: #fff;
  font: 800 12px 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
  cursor: pointer;
}
.knock-pin.lead     { background: #c90; }
.knock-pin.prospect { background: #d63; }
.knock-pin.signed   { background: #0a7; }
.knock-pin.no_answer      { background: #999; }
.knock-pin.not_interested { background: #444; }

/* Just-saved knock — briefly pulses so the rep sees it landed. */
.knock-pin.fresh {
  animation: knock-pulse 0.7s ease-out 4;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.4),
              0 0 12px 4px currentColor;
}
@keyframes knock-pulse {
  0%   { transform: scale(1);   }
  40%  { transform: scale(1.5); }
  100% { transform: scale(1);   }
}

/* Appointment-link selector inside the property-lookup popup */
.lookup-popup .lp-appt-link {
  margin: 6px 0;
  padding: 8px;
  background: #0f1d2e;
  border: 1px solid #1b3454;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lookup-popup .lp-appt-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #6bb8ff;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.lookup-popup .lp-appt-select {
  flex: 1;
  min-width: 140px;
  padding: 6px 8px;
  background: #061222;
  color: #fff;
  border: 1px solid #2a5688;
  border-radius: 4px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  cursor: pointer;
}
.lookup-popup .lp-appt-select:focus {
  outline: none;
  border-color: #6bb8ff;
  box-shadow: 0 0 0 2px rgba(107, 184, 255, 0.25);
}
.lookup-popup .lp-appt-empty {
  font-size: 11px;
  color: #ffaa66;
  line-height: 1.4;
  padding: 4px;
}

/* Door-knock buttons inside the property-lookup popup */
.lookup-popup .lp-knock-section {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0;
  padding: 8px;
  background: #1a1a1a;
  border-radius: 6px;
}
.lookup-popup .lp-knock-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #888;
  letter-spacing: 0.5px;
}
.lookup-popup .lp-knock-btn {
  flex: 1;
  min-width: 80px;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  cursor: pointer;
  color: #fff;
}
.lookup-popup .lp-knock-btn.lead     { background: #b80; }
.lookup-popup .lp-knock-btn.prospect { background: #c63; }
.lookup-popup .lp-knock-btn.signed   { background: #1a7; }
.lookup-popup .lp-knock-btn:hover    { filter: brightness(1.15); }
.lookup-popup .lp-knock-btn:disabled { opacity: 0.55; cursor: default; }
.lookup-popup .lp-knock-btn.saving   { animation: lp-pulse 0.8s infinite; }
@keyframes lp-pulse {
  50% { filter: brightness(1.4); }
}
.lookup-popup .lp-knock-status {
  margin: 6px 0;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  color: #fff;
}
.lookup-popup .lp-knock-status.lead     { background: #b80; }
.lookup-popup .lp-knock-status.prospect { background: #c63; }
.lookup-popup .lp-knock-status.signed   { background: #1a7; }

/* Outcome segment on the appointment card */
.outcome-segmented {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 6px;
  background: rgba(255, 80, 0, 0.08);
  border-radius: 6px;
  border-left: 3px solid #f60;
}
.outcome-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #888;
  letter-spacing: 0.5px;
  margin-right: 4px;
}
.outcome-btn {
  flex: 1;
  min-width: 80px;
  padding: 7px 8px;
  border: 1px solid #333;
  border-radius: 4px;
  background: #1a1a1a;
  color: #ccc;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
  text-align: center;
}
.outcome-btn:hover { background: #2a2a2a; }
.outcome-btn.active.fire     { background: #c30; color: #fff; border-color: #c30; }
.outcome-btn.active.nofire   { background: #555; color: #fff; border-color: #555; }
.outcome-btn.active.notfound { background: #803; color: #fff; border-color: #803; }

.ap-outcome {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
}
.ap-outcome.fire_confirmed { background: #c30; color: #fff; }
.ap-outcome.no_fire        { background: #555; color: #fff; }
.ap-outcome.not_found      { background: #803; color: #fff; }

/* "Currently canvassing" floating banner */
.active-appt-banner {
  position: fixed;
  bottom: calc(170px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2005;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #06f;
  color: #fff;
  padding: 8px 14px;
  border-radius: 22px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  max-width: calc(100vw - 24px);
  font-weight: 600;
}
.active-appt-banner b {
  font-weight: 800;
  margin: 0 4px;
}
.active-appt-banner button {
  background: rgba(255,255,255,0.2);
  border: 0;
  color: #fff;
  width: 22px; height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.active-appt-banner button:hover { background: rgba(255,255,255,0.35); }
@media (max-width: 700px) {
  .active-appt-banner {
    bottom: calc(160px + env(safe-area-inset-bottom));
    font-size: 11.5px;
  }
}

/* Owner banner — prominent under the address */
.lookup-popup .lp-owner-banner {
  background: #1a2a3a;
  color: #cfe;
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 3px solid #06f;
  margin: 6px 0;
  font-size: 13px;
  word-break: break-word;
}
.lookup-popup .lp-owner-banner b {
  color: #fff;
  font-size: 14px;
}

/* Residents list — v9.4 simplified output */
.lookup-popup .lp-residents {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.lookup-popup .lp-resident {
  background: #1a1a1a;
  padding: 6px 8px;
  border-radius: 6px;
  border-left: 3px solid #06f;
}
.lookup-popup .lp-resident-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.lookup-popup .lp-resident-phones {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 4px;
}
.lookup-popup .lp-phone-big {
  display: inline-block;
  background: #06f;
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.5px;
  text-align: center;
}
.lookup-popup .lp-phone-big:hover { background: #fff; color: #06f; }
.lookup-popup .lp-no-phone {
  font-size: 11px;
  color: #888;
  font-style: italic;
}
.lookup-popup .lp-resident-src {
  font-size: 10px;
  margin-top: 2px;
}

/* Sections for phones / emails / businesses / social */
.lookup-popup .lp-section {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #2a2a2a;
}
.lookup-popup .lp-section-h {
  color: #aaa;
  font-size: 10.5px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}
.lookup-popup .lp-phone-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 3px 0;
  font-size: 12.5px;
  line-height: 1.3;
}
.lookup-popup .lp-phone {
  color: #69aaff;
  text-decoration: none;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}
.lookup-popup .lp-phone:hover { text-decoration: underline; }
.lookup-popup .lp-tag {
  display: inline-block;
  padding: 1px 5px;
  background: #2a2a2a;
  color: #aaa;
  border-radius: 3px;
  font-size: 9.5px;
  font-family: 'JetBrains Mono', monospace;
}
/* Head-of-household chip — owners get a green pill so the rep can spot
   the right person to ask for at the door without reading every line. */
.lookup-popup .lp-tag-head {
  background: #0a7a2e;
  color: #fff;
  font-weight: 700;
}
.lookup-popup .lp-resident.is-head {
  border-left-color: #0a7a2e;
}
.lookup-popup .lp-src {
  color: #666;
  font-size: 10px;
  text-decoration: none;
  margin-left: auto;
}
.lookup-popup .lp-src:hover { color: #aaa; }

/* Mobile: full-width popup, larger touch targets. */
@media (max-width: 700px) {
  .leaflet-popup.lookup-leaflet-popup .leaflet-popup-content-wrapper {
    max-width: calc(100vw - 24px);
  }
  .lookup-popup .lp-btn { padding: 10px 12px; font-size: 12px; }
  .lookup-popup .lp-v   { font-size: 13px; }
  .lookup-popup .lp-phone { font-size: 14px; padding: 3px 0; }
  .lookup-popup .lp-phone-row { padding: 5px 0; }
}
