/* v4.30 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ─── Variables ──────────────────────────────────────────────────────────── */
:root {
  --bg: #f8fafc;
  --bg2: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border2: #cbd5e1;
  --text: #0f172a;
  --text2: #334155;
  --text3: #64748b;
  --text4: #94a3b8;
  --header-bg: #9b1c1c;
  --header-text: #ffffff;
  --shadow: 0 1px 4px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);
  --radius: 8px;
  --radius-sm: 5px;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
}

/* ─── Prevent browser page zoom on non-map elements (Item 2 v5.32b) ─────── */
/* Leaflet handles map touch events independently — pinch-to-zoom still works */
body, #header, .sidebar, .controls {
  touch-action: pan-x pan-y;
}
#map {
  touch-action: none; /* Leaflet manages this */
}

/* ─── Offline Banner ─────────────────────────────────────────────────────── */
#offline-banner {
  display: none;
  background: #7c2d12;
  color: #fed7aa;
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  z-index: 200;
  flex-shrink: 0;
}
#offline-banner.visible { display: block; }

/* ─── Header ─────────────────────────────────────────────────────────────── */
#header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.header-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 14px;
  gap: 10px;
}
.header-stats-row {
  display: flex;
  align-items: center;
  padding: 3px 14px 5px;
  background: rgba(0,0,0,0.2);
  min-height: 0;
  gap: 10px;
}
/* v6.25: Divider between leaderboard chips and progress bar on desktop.
   Hidden on mobile portrait (the leaderboard chip lives in header-row2 there). */
.stats-divider { display: none; width: 1px; align-self: stretch; background: rgba(255,255,255,0.22); flex-shrink: 0; margin: 2px 0; }
/* Desktop/landscape-mobile: show the stats-row leaderboard chip, hide the row2 one */
@media (min-width: 681px) {
  #top3-bar { display: none !important; }
  .top3-bar-stats { display: flex !important; }
  .stats-divider { display: block; }
  /* 2.4: Collapse row1 + row2 side-by-side on desktop — one strip instead of two */
  #header { flex-direction: row; flex-wrap: wrap; }
  .header-row1 { flex: 1 1 auto; min-width: 0; }
  .header-row2 {
    flex: 0 0 auto;
    background: transparent;
    border-left: 1px solid rgba(255,255,255,0.18);
    padding-left: 12px;
  }
  #header-stats-row { flex: 0 0 100%; order: 3; }
  /* 2.1: Add-home sheet — constrained width, centered in map pane */
  #add-home-sheet {
    left: max(12px, calc(50vw - 370px));
    right: auto;
    width: 420px;
    border-radius: 12px;
  }
}
@media (max-height: 500px) and (min-width: 480px) {
  #top3-bar { display: none !important; }
  .top3-bar-stats { display: flex !important; }
  .stats-divider { display: block; }
}
/* Mobile portrait: hide stats-row duplicate, keep behavior unchanged */
@media (max-width: 680px) and (min-height: 501px) {
  .top3-bar-stats { display: none !important; }
  .stats-divider { display: none !important; }
}
.header-row2 {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 7px;
  background: rgba(0,0,0,0.2);
  flex-wrap: nowrap;
  overflow: hidden;
}
.header-left { display: flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden; }
.header-left > div { min-width: 0; overflow: hidden; }
.header-logo { font-size: 22px; line-height: 1; }
.header-title { font-size: 15px; font-weight: 800; letter-spacing: -0.3px; }
.header-sub { font-size: 12px; font-weight: 600; opacity: 0.9; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.header-right-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.header-credit { font-size: 9px; opacity: 0.45; font-style: italic; }
.hdr-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
/* Icon-only buttons — square, equal padding */
.hdr-btn.icon-btn {
  padding: 6px;
  width: 30px;
  height: 30px;
}
/* Hide map button on desktop */
.desktop-hide { display: none !important; }
.hdr-btn:hover { background: rgba(255,255,255,0.22); }
.hdr-btn.active-btn { background: #2d9e5f; border-color: #2d9e5f; }
#loc-btn.active-btn svg { stroke: #fff; filter: drop-shadow(0 0 3px rgba(45,158,95,0.8)); }
/* mobile-chat-btn hidden on desktop, shown on mobile */
.mobile-chat-btn { display: none; }
.list-toggle-btn { display: none; font-size: 12px; font-weight: 700; padding: 3px 10px; letter-spacing: 0.3px; }
.sidebar-close-btn {
  display: none; align-items: center; gap: 5px;
  background: none; border: none; color: var(--text-muted);
  font-size: 13px; font-weight: 600; padding: 6px 12px 4px;
  cursor: pointer; font-family: inherit; text-align: left;
  border-bottom: 1px solid var(--border); width: 100%;
}
.sidebar-close-btn:hover { color: var(--text); background: var(--bg2); }
.admin-badge { background: #c9831a; color: #fff; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }

/* ─── Row2 admin controls ────────────────────────────────────────────────── */
.row2-right { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
#admin-row2 { display: none; align-items: center; gap: 5px; flex-wrap: wrap; }
.admin-badge-row2 {
  display: flex; align-items: center; gap: 4px;
  background: rgba(0,0,0,0.25); border-radius: 20px;
  padding: 3px 8px; margin-right: 4px;
}
.admin-shield { font-size: 11px; font-weight: 700; color: #fde68a; white-space: nowrap; }
.admin-field-btn {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3);
  color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 10px; cursor: pointer; font-family: inherit; white-space: nowrap;
  transition: background 0.15s;
}
.admin-field-btn:hover { background: rgba(255,255,255,0.28); }
#logout-hdr-btn { font-size: .75rem; padding: 3px 8px; }

/* ─── Top-3 leaderboard chip ─────────────────────────────────────────────── */
.top3-bar {
  display: flex; align-items: center; gap: 5px;
  flex: 1 1 auto; min-width: 0;
  padding: 0 4px; overflow: hidden;
}
.top3-label { font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.55); white-space: nowrap; }
/* Trophy icon button: no text, square, emoji-sized */
.top3-lb-btn { font-size: 16px !important; padding: 4px !important; font-weight: 700; width: 30px; height: 30px; flex-shrink: 0; }
.top3-chip {
  font-size: 11px; font-weight: 600; color: #fff; white-space: nowrap;
  background: rgba(0,0,0,0.2); border-radius: 12px; padding: 3px 8px;
  letter-spacing: 0.01em;
}
.top3-chip strong { font-weight: 800; }

.top3-more-btn {
  background: none; border: none; color: rgba(255,255,255,0.5);
  font-size: 13px; cursor: pointer; padding: 0 2px; line-height: 1;
  transition: color 0.15s;
}
.top3-more-btn:hover { color: #fff; }
/* Mobile: compress chips to fit all 3 at narrow widths */
@media (max-width: 420px) {
  .top3-bar { gap: 2px; }
  .top3-chip { font-size: 9px; padding: 2px 4px; }
}

/* ─── Stats Bar ──────────────────────────────────────────────────────────── */
.stats-bar { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; flex: 1 1 auto; min-width: 0; overflow: hidden; }
.stat-group { display: flex; align-items: center; gap: 5px; }
.stat-divider { width: 1px; height: 14px; background: rgba(255,255,255,0.25); flex-shrink: 0; }
.stat-chip {
  background: rgba(0,0,0,0.25); color: #fff;
  padding: 2px 8px; border-radius: 12px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.stat-chip-label { font-weight: 400; opacity: 0.8; }
.stat-track-wrap { display: flex; align-items: center; gap: 5px; }
.stat-track { display: flex; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.15); width: 72px; overflow: hidden; }
.stat-seg { height: 100%; transition: width 0.6s ease; }
.stat-pct { font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.8); }
/* v6.27a: Dual bars on one row, smaller */
.stat-dual-bars { display: flex; flex-direction: row; gap: 10px; flex: 1 1 auto; min-width: 0; align-items: center; }
.stat-dual-row { display: flex; align-items: center; gap: 5px; flex: 1 1 0; min-width: 0; }
.stat-dual-label { font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.82); white-space: nowrap; min-width: 52px; letter-spacing: 0.02em; }
.stat-track-wide { flex: 1 1 auto; min-width: 0; width: auto; height: 5px; border-radius: 3px; }
.stat-dual-count { font-size: 9px; font-weight: 600; color: rgba(255,255,255,0.7); white-space: nowrap; }

/* ─── Version badge ──────────────────────────────────────────────────────── */
.header-version {
  font-size: 10px; font-weight: 700; color: rgba(0,0,0,0.75);
  background: rgba(255,255,255,0.88); border-radius: 8px;
  padding: 1px 6px; white-space: nowrap; flex-shrink: 0; letter-spacing: 0.02em;
}

/* ─── Sync indicator ─────────────────────────────────────────────────────── */
.sync-indicator { font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.6); white-space: nowrap; }
.sync-indicator.syncing { color: #fbbf24; }
.sync-indicator.ok { color: #6ee7b7; }
.sync-indicator.error { color: #fca5a5; }

/* ─── Presence avatars ───────────────────────────────────────────────────── */
.presence-bar { display: flex; gap: 4px; align-items: center; }
.presence-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: #fff;
  cursor: default; flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}


/* ─── Layout ─────────────────────────────────────────────────────────────── */
.container { flex: 1; display: flex; overflow: hidden; }
#map-wrap { flex: 1; position: relative; }
#map { width: 100%; height: 100%; }
#sidebar {
  width: 320px;
  min-width: 260px;
  max-width: 380px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

/* ─── Loading overlay ───────────────────────────────────────────────────── */
#loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(248,250,252,0.85);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 500;
}
.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--header-bg);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading-text { font-size: 13px; font-weight: 600; color: var(--text3); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Sidebar Header ─────────────────────────────────────────────────────── */
#sidebar-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px;
  flex-shrink: 0;
  z-index: 10;
}
.sb-filter-row { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
#view-mode-sel { min-width: 72px; flex-shrink: 0; }
.sb-filter-row select {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.admin-tools {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.admin-label { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text4); letter-spacing: 0.5px; margin-right: 2px; }
.admin-btn {
  padding: 4px 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  font-family: inherit;
}
.admin-btn:hover { background: var(--border); }

/* Dedicated admin toolbar row */
#admin-dedicated-row {
  display: none;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #1a1a2e;
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-wrap: wrap;
  min-height: 42px;
}
.admin-badge-pill {
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Item 7: high-contrast active draw state with pulse ring */
.admin-btn.active-admin-btn {
  background: #f97316;
  border-color: #ea580c;
  color: #fff;
  font-weight: 700;
  animation: draw-btn-pulse 1.6s ease-in-out infinite;
}
@keyframes draw-btn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(249,115,22,0.55); }
  50%       { box-shadow: 0 0 0 5px rgba(249,115,22,0); }
}

/* ─── Turf List ──────────────────────────────────────────────────────────── */
#turf-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.turf-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.turf-header {
  display: flex; align-items: center; gap: 8px; padding: 10px;
  cursor: pointer; border-left: 4px solid var(--tc, #94a3b8);
  border-radius: var(--radius) var(--radius) 0 0;
  transition: background 0.12s; user-select: none;
}
.turf-block:not(.turf-expanded) .turf-header { border-radius: var(--radius); }
.turf-header:hover { background: var(--bg2); }
.turf-letter-badge {
  width: 30px; height: 30px; border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; flex-shrink: 0;
}
.turf-knock { border-left: 3px solid #b3a8c8; }
.turf-knock .turf-header { --tc: #b3a8c8 !important; }
.knock-badge { border-radius: 4px; transform: rotate(45deg); font-size: 11px; }
.turf-info { flex: 1; min-width: 0; }
.turf-volunteer { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.turf-progress-row { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.turf-prog-track { position: relative; flex: 0 1 140px; max-width: 140px; height: 14px; background: #9ca3af; border-radius: 4px; overflow: hidden; }
.turf-prog-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.turf-prog-inline { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; color: #fff; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,0.7); pointer-events: none; letter-spacing: 0.02em; }
@media (max-width: 680px) { .turf-prog-track { flex: 1; max-width: none; } }
.turf-pct { font-size: 11px; color: var(--text3); white-space: nowrap; font-weight: 600; }
.turf-chevron { font-size: 14px; color: var(--text4); flex-shrink: 0; }
.turf-action-btn {
  width: 22px; height: 22px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg); color: var(--text3);
  font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; padding: 0;
}
.turf-action-btn:hover { background: var(--border); }
.turf-action-btn.danger:hover { background: #fee2e2; color: #c44848; border-color: #c44848; }
.turf-houses { display: block; padding: 4px 6px 6px; }

/* ─── House Cards ────────────────────────────────────────────────────────── */
.house-card {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.12s;
  border: 1px solid transparent; position: relative;
}
.house-card:hover { background: var(--bg2); border-color: var(--border); }
.house-card.house-done { opacity: 0.85; }
.house-num {
  width: 22px; height: 22px; border-radius: 50%; color: #fff;
  font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.house-body { flex: 1; min-width: 0; }
.house-addr { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.house-name { font-size: 11px; color: var(--text3); }
.house-notes { font-size: 11px; color: var(--text3); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.house-footer { margin-top: 3px; }
.house-badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.house-badge.unvisited { background: var(--bg2); color: var(--text4); }
.house-quick { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }
.quick-btn {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--qc, #94a3b8); background: #fff; color: var(--qc);
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, transform 0.1s; padding: 0;
}
.quick-btn:hover { background: var(--qbg, #f0f1f3); transform: scale(1.1); }
.quick-btn.qbtn-active { background: var(--qbg, #f0f1f3); border-width: 2.5px; }
.house-del-btn {
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px;
  border: none; background: transparent; color: var(--text4);
  font-size: 11px; cursor: pointer; opacity: 0;
  display: flex; align-items: center; justify-content: center;
}
.house-card:hover .house-del-btn { opacity: 1; }
.house-del-btn:hover { color: #c44848; }
.sb-empty, .sb-empty-turf { padding: 16px; color: var(--text4); font-size: 13px; text-align: center; line-height: 1.6; }

/* ─── Leaflet.draw toolbar ───────────────────────────────────────────────── */
.leaflet-draw { z-index: 1000 !important; }
.leaflet-draw-toolbar a { z-index: 1001 !important; }

/* ─── Turf label ─────────────────────────────────────────────────────────── */
.turf-label {
  width: 40px; height: 40px; border-radius: 50%; color: #fff;
  font-size: clamp(14px, 1.8vw, 22px); font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid rgba(255,255,255,0.9);
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  position: relative; z-index: 1;
}
.turf-label-wrap { position: relative; width: 40px; height: 40px; overflow: visible; }
.turf-label-complete-badge {
  position: absolute;
  bottom: -8px; right: -18px;
  background: #2d9e5f;
  color: #fff;
  font-size: 12px; font-weight: 800;
  padding: 2px 6px;
  border-radius: 11px;
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,0.45);
  display: inline-flex; align-items: center; gap: 2px;
  line-height: 1;
  z-index: 2;
  white-space: nowrap;
  pointer-events: none;
}
.tlc-check { font-size: 11px; }

/* ─── Map Legend ─────────────────────────────────────────────────────────── */
.map-legend {
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  color: var(--text2);
  box-shadow: var(--shadow-md);
  min-width: 130px;
}
.legend-row { display: flex; align-items: center; gap: 7px; padding: 2px 0; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-diamond { border-radius: 2px; transform: rotate(45deg); width: 9px; height: 9px; }
.legend-label { font-size: 11px; }

/* ─── Location dot ───────────────────────────────────────────────────────── */
.loc-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: #3b82f6; border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.3);
  position: relative;
}
.loc-pulse {
  position: absolute; inset: -6px; border-radius: 50%;
  background: rgba(59,130,246,0.25);
  animation: locpulse 1.8s ease-out infinite;
}
@keyframes locpulse { 0%{transform:scale(0.6);opacity:1} 100%{transform:scale(1.8);opacity:0} }

/* ─── House Popup ────────────────────────────────────────────────────────── */
.house-popup-wrap .leaflet-popup-content-wrapper {
  border-radius: var(--radius) !important;
  padding: 0 !important;
  box-shadow: var(--shadow-md) !important;
  overflow: hidden;
  border: 1px solid var(--border);
}
.house-popup-wrap .leaflet-popup-content { margin: 0 !important; width: 290px !important; }
.house-popup-wrap .leaflet-popup-tip { background: #fff; }
.house-popup { font-family: 'Inter', sans-serif; }
.popup-header {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 12px; border-bottom: 3px solid #ddd; background: #f8fafc;
}
.popup-turf-badge { color: #fff; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 700; white-space: nowrap; flex-shrink: 0; margin-top: 2px; }
/* Allow full zone name + address to wrap — never cut off on mobile */
.popup-name { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.3; white-space: normal; word-break: break-word; }
.popup-addr { min-width: 0; }
.popup-sub { font-size: 11px; color: var(--text3); margin-top: 1px; white-space: normal; word-break: break-word; }
/* Registered Voters section — compact single-row per voter */
.popup-voters { padding: 6px 12px 4px; border-bottom: 1px solid var(--border); background: #f8fafc; }
.popup-voters-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text3); margin-bottom: 4px; }
.voter-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-bottom: 2px; line-height: 1.3; }
.voter-name { font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap; }
.voter-stars { font-size: 11px; letter-spacing: 1px; white-space: nowrap; }
.voter-stars-red  { color: #dc2626; }
.voter-stars-blue { color: #2563eb; }
.popup-status { padding: 6px 12px; font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--border); }
.popup-status.unpopulated { color: var(--text4); background: var(--bg); }
.popup-result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 8px; border-bottom: 1px solid var(--border); }
.popup-result-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 8px 4px;
  border: 1.5px solid var(--rc, #94a3b8); border-radius: var(--radius-sm);
  background: #fff; color: var(--rc);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background 0.12s, transform 0.1s;
  text-align: center; position: relative;
}
.popup-result-btn:hover { background: var(--rbg); transform: scale(1.03); }
.popup-result-btn.active { background: var(--rbg); border-width: 2.5px; }
.pbtn-icon { font-size: 16px; }
.pbtn-label { font-size: 10px; font-weight: 600; line-height: 1.2; }
.pbtn-check { font-size: 10px; color: var(--rc); }
.popup-notes-row { display: flex; gap: 5px; padding: 8px 8px 4px; }
.popup-notes-input {
  flex: 1; padding: 5px 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12px; font-family: inherit; color: var(--text);
}
.popup-notes-input:focus { outline: none; border-color: #2e6ec2; }
.popup-notes-save {
  padding: 5px 10px; background: #2e6ec2; color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.popup-chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 8px 8px; }
.note-chip {
  padding: 2px 7px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 12px;
  font-size: 10px; color: var(--text2); cursor: pointer;
  transition: background 0.12s;
}
.note-chip:hover { background: var(--border2); }
.popup-clear-btn {
  display: block; width: calc(100% - 16px); margin: 0 8px 8px;
  padding: 5px; background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text3); font-size: 11px; cursor: pointer; text-align: center;
}
.popup-clear-btn:hover { background: var(--bg2); color: #c44848; border-color: #c44848; }
/* Popup footer action row — wraps clear/list/move/delete together */
.popup-actions { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 8px 8px; }
.popup-actions .popup-clear-btn,
.popup-actions .popup-list-btn,
.popup-actions .popup-move-btn,
.popup-actions .popup-delete-btn { display: inline-flex; align-items: center; justify-content: center; width: auto; flex: 1; margin: 0; }

/* ─── Popup: compact layout for iPhone SE / narrow screens (≤ 400px) ─────── */
@media (max-width: 400px) {
  .house-popup-wrap .leaflet-popup-content { width: calc(100vw - 32px) !important; max-width: 340px !important; }
  /* Header */
  .popup-header { padding: 8px 10px; gap: 6px; }
  .popup-name { font-size: 13px; }
  .popup-turf-badge { font-size: 10px; padding: 1px 6px; }
  .popup-sub { font-size: 10px; }
  /* Voters: already compact single-row — just tighten spacing */
  .popup-voters { padding: 4px 10px 2px; }
  .popup-voters-title { margin-bottom: 2px; }
  .voter-row { gap: 4px; margin-bottom: 1px; }
  .voter-stars { font-size: 10px; }
  /* Status */
  .popup-status { padding: 4px 10px; font-size: 11px; }
  /* Result buttons */
  .popup-result-grid { gap: 3px; padding: 5px; }
  .popup-result-btn { padding: 5px 2px; gap: 1px; }
  .pbtn-icon { font-size: 14px; }
  .pbtn-label { font-size: 9px; line-height: 1.1; }
  .pbtn-check { font-size: 9px; }
  .popup-activity-label { font-size: 10px; margin-bottom: 2px; }
  /* No Soliciting */
  .popup-nosol-btn { padding: 6px; font-size: 12px; margin: 3px 0; }
  /* Notes */
  .popup-notes-row { padding: 5px 6px 3px; gap: 4px; }
  .popup-notes-input { font-size: 11px; padding: 3px 7px; }
  .popup-notes-save { padding: 4px 8px; font-size: 10px; }
  .popup-chips { padding: 0 6px 5px; gap: 3px; }
  .note-chip { padding: 2px 5px; font-size: 9px; }
  /* Footer action buttons: inline compact row */
  .popup-actions { padding: 3px 6px 6px; gap: 4px; }
  .popup-actions .popup-clear-btn,
  .popup-actions .popup-list-btn,
  .popup-actions .popup-move-btn,
  .popup-actions .popup-delete-btn { padding: 4px 6px; font-size: 10px; }
}

/* ─── Login ──────────────────────────────────────────────────────────────── */
#login-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.login-card {
  background: var(--surface); border-radius: 12px; padding: 32px;
  width: 340px; box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  text-align: center; border: 1px solid var(--border);
}
.login-logo { font-size: 40px; margin-bottom: 8px; }
.login-title { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; }
.login-sub { font-size: 13px; color: var(--text3); margin-bottom: 24px; margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.login-label { font-size: 12px; font-weight: 600; color: var(--text2); }
.login-input { padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: 14px; font-family: inherit; color: var(--text); transition: border-color 0.15s; }
.login-input:focus { outline: none; border-color: #2e6ec2; }
.login-name-fields { display: flex; gap: 8px; margin-top: 4px; }
.login-name-fields .login-input { flex: 1; min-width: 0; }
.login-btn { padding: 11px; background: var(--header-bg); color: #fff; border: none; border-radius: var(--radius); font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 4px; transition: opacity 0.15s; font-family: inherit; }
.login-btn:hover { opacity: 0.88; }
.login-admin-toggle { background: none; border: none; color: #2e6ec2; font-size: 12px; font-weight: 600; cursor: pointer; text-align: left; padding: 0; font-family: inherit; }
.login-error { color: #c44848; font-size: 12px; min-height: 16px; }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
#modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.45); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 9000; }
.modal-card { background: var(--surface); border-radius: 10px; width: 400px; max-width: 95vw; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 15px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 18px; color: var(--text4); cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.modal-cancel { padding: 8px 16px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; font-family: inherit; color: var(--text2); }
.modal-confirm { padding: 8px 16px; background: var(--header-bg); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }
.modal-confirm.danger { background: #c44848; }
.modal-confirm:hover { opacity: 0.9; }
.f-label { font-size: 12px; font-weight: 600; color: var(--text2); }
.f-input, .f-textarea { width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; color: var(--text); background: var(--surface); }
.f-input:focus, .f-textarea:focus { outline: none; border-color: #2e6ec2; }
.f-textarea { resize: vertical; }
.f-hint { font-size: 11px; color: var(--text3); line-height: 1.5; }
.f-hint code { background: var(--bg2); padding: 1px 4px; border-radius: 3px; font-size: 10px; }
.import-example { background: var(--bg2); border: 1px solid var(--border); border-radius: 4px; padding: 6px 8px; font-size: 10px; overflow-x: auto; white-space: pre; color: var(--text2); }
.geocode-btn { padding: 8px 12px; background: var(--bg2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--text2); font-family: inherit; transition: background 0.15s; }
.geocode-btn:hover { background: var(--border); }
.geocode-btn:disabled { opacity: 0.5; cursor: wait; }
.color-row { display: flex; gap: 6px; flex-wrap: wrap; }
.color-swatch { width: 24px; height: 24px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: transform 0.1s; }
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: var(--text); transform: scale(1.15); }

/* ─── Toast ──────────────────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; z-index: 9999; pointer-events: none; }
.toast { padding: 8px 18px; border-radius: 20px; font-size: 13px; font-weight: 600; color: #fff; background: #1c355e; box-shadow: 0 4px 16px rgba(0,0,0,0.2); opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; white-space: nowrap; }
.toast.toast-show { opacity: 1; transform: translateY(0); }
.toast.toast-success { background: #166534; }
.toast.toast-error { background: #991b1b; }
.toast.toast-info { background: #1e40af; }

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
#turf-list::-webkit-scrollbar { width: 5px; }
#turf-list::-webkit-scrollbar-track { background: transparent; }
#turf-list::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ─── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  #sidebar { width: 100%; max-width: none; border-left: none; border-top: 1px solid var(--border); max-height: 45vh; }
  .container { flex-direction: column-reverse; }
  #map-wrap { flex: 1; min-height: 0; }
  .stats-bar { gap: 4px; }
  .presence-bar { display: none; }
  .stat-pills { display: flex; }
  .map-legend { margin-left: 10px; }
  .leaflet-bottom.leaflet-right { margin-bottom: 8px; margin-right: 8px; }
  .leaflet-bottom.leaflet-left { margin-bottom: 8px; margin-left: 8px; }
  .app-footer { bottom: 2px; right: 6px; font-size: 9px; }
}

/* ─── Leaflet.draw overrides ─────────────────────────────────────────────── */
.leaflet-draw-toolbar a { border-radius: 4px !important; }

/* Item 5: bright yellow vertex dots and guide line for in-progress polygon */
.leaflet-div-icon.leaflet-editing-icon {
  background: #FFE600 !important;
  border: 2px solid #1a1a1a !important;
  border-radius: 50% !important;
  width: 10px !important; height: 10px !important;
  margin-left: -5px !important; margin-top: -5px !important;
  box-shadow: 0 0 0 1.5px rgba(0,0,0,0.5) !important;
}
/* Guide (rubber-band) line from last vertex to cursor */
.leaflet-draw-guide-dash {
  background: #FFE600 !important;
  border: none !important;
  box-shadow: 0 0 2px 1px rgba(0,0,0,0.45) !important;
}
/* Tooltip shown while drawing */
.leaflet-draw-tooltip {
  background: rgba(30,30,30,0.85) !important;
  color: #FFE600 !important;
  font-weight: 600 !important;
  border: 1px solid #FFE600 !important;
  border-radius: 5px !important;
}
.leaflet-draw-tooltip::before { border-right-color: #FFE600 !important; }

/* ─── v3 additions ─────────────────────────────────────────────────────────── */
.pop-count-row { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.pop-count-badge { font-size:2rem; font-weight:700; color:var(--accent); line-height:1; }
.pop-count-label { font-size:.95rem; color:var(--text-muted); }
.pop-excl-row { display:flex; align-items:center; gap:10px; font-size:.85rem; padding:6px 10px; background:var(--bg-secondary); border-radius:6px; margin-bottom:4px; }
.pop-excl-count { color:var(--text-muted); }
.pop-excl-toggle { display:flex; align-items:center; gap:5px; cursor:pointer; color:var(--text); }
.pop-excl-toggle input { cursor:pointer; }
.diff-summary { display:flex; flex-direction:column; gap:6px; }
.diff-row { display:flex; align-items:center; gap:10px; padding:8px 12px; border-radius:7px; font-size:.9rem; }
.diff-icon { font-weight:700; font-size:1rem; width:18px; text-align:center; }
.diff-add { background:#e6f7ee; color:#1a7a3e; }
.diff-remove { background:#fde8e8; color:#b91c1c; }
.diff-keep { background:#e8f0fc; color:#1a4db5; }
.diff-excl { background:var(--bg-secondary); color:var(--text-muted); }
.edit-boundary-banner { position:fixed; top:0; left:0; right:0; z-index:9000; background:#1a4db5; color:#fff; display:flex; align-items:center; justify-content:space-between; padding:10px 16px; font-size:.9rem; font-weight:500; box-shadow:0 2px 8px rgba(0,0,0,.3); }

/* ─── Draw toolbar ───────────────────────────────────────────────────────── */
.draw-toolbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9000;
  background: #2d6a1e; color: #fff;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; font-size: 0.85rem; font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.dt-hint { flex: 1; opacity: 0.85; font-size: 0.8rem; }
.dt-btn {
  background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.5);
  color: #fff; padding: 5px 14px; border-radius: 6px; cursor: pointer;
  font-size: 0.8rem; font-weight: 600; white-space: nowrap;
}
.dt-btn:hover { background: rgba(255,255,255,0.3); }
.dt-cancel { background: rgba(255,80,80,0.3); border-color: rgba(255,120,120,0.6); }
.dt-cancel:hover { background: rgba(255,80,80,0.5); }
.dt-btn:disabled { opacity: 0.35; cursor: default; }
.dt-btn:disabled:hover { background: rgba(255,255,255,0.2); }

/* Item 7: persistent "Drawing Zone" indicator pill below toolbar */
.draw-mode-banner {
  position: fixed; top: 44px; left: 50%; transform: translateX(-50%);
  z-index: 8990;
  background: rgba(30,30,30,0.88); color: #FFE600;
  border: 1.5px solid #FFE600; border-radius: 20px;
  padding: 4px 14px; font-size: 12px; font-weight: 700;
  white-space: nowrap; pointer-events: none;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.ebb-btns { display:flex; gap:8px; }
.ebb-save { background:#fff; color:#1a4db5; border:none; padding:5px 14px; border-radius:5px; font-weight:600; cursor:pointer; }
.ebb-cancel { background:rgba(255,255,255,.2); color:#fff; border:1px solid rgba(255,255,255,.5); padding:5px 14px; border-radius:5px; cursor:pointer; }
.parcel-results { max-height:180px; overflow-y:auto; border:1px solid var(--border); border-radius:7px; margin-top:4px; background:var(--bg-card); }
.parcel-result-row { padding:8px 10px; cursor:pointer; border-bottom:1px solid var(--border); transition:background .15s; }
.parcel-result-row:last-child { border-bottom:none; }
.parcel-result-row:hover { background:var(--bg-secondary); }
.pr-addr { font-size:.9rem; font-weight:500; color:var(--text); }
.pr-owner { font-size:.78rem; color:var(--text-muted); }
.parcel-no-results { padding:10px; text-align:center; color:var(--text-muted); font-size:.85rem; }
.parcel-selected { margin-top:6px; }
.parcel-selected-row { display:flex; align-items:center; gap:8px; padding:8px 10px; background:#e6f7ee; border-radius:7px; border:1px solid #a7f3c1; }
.ps-check { color:#1a7a3e; font-weight:700; font-size:1rem; }
.ps-clear { margin-left:auto; background:none; border:none; color:#6b7280; cursor:pointer; font-size:1rem; padding:0 4px; }
.turf-action-btn[title="Edit boundary"] { color:#2e6ec2; }
.turf-action-btn[title="Re-sort walk order"] { color:#2d9e5f; }
.owner-line { font-style:italic; font-size:.78rem; color:var(--text-muted); }
.logout-btn { background:rgba(255,255,255,.2); border:1px solid rgba(255,255,255,.4); color:#fff; font-size:.75rem; padding:3px 8px; border-radius:4px; cursor:pointer; margin-left:6px; }


/* ─── App footer credit ─────────────────────────────────────────────────────── */
.app-footer {
  position: fixed; bottom: 20px; left: 8px; z-index: 500;
  font-size: 10px; color: rgba(255,255,255,0.65); font-style: italic;
  pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,0.8); letter-spacing: 0.01em;
}
@media (max-width: 680px) { .app-footer { bottom: 2px; left: 6px; font-size: 9px; } }

/* ─── Mobile polygon draw banner ───────────────────────────────────────────── */
.mobile-poly-banner {
  position: fixed; top: var(--mobile-header-h, 90px); left: 0; right: 0;
  z-index: 9001; background: #1a4db5; color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px;
  font-size: .82rem; font-weight: 600; box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.mobile-poly-banner .mpb-btns { display: flex; gap: 6px; flex-shrink: 0; }
.mobile-poly-banner button {
  background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.5);
  color: #fff; padding: 5px 12px; border-radius: 6px; cursor: pointer;
  font-size: .8rem; font-weight: 600;
}
.mobile-poly-banner button:active { background: rgba(255,255,255,.35); }
/* ─── Finish Zone FAB ──────────────────────────────────────────────────────── */
.finish-zone-btn {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 9002; background: #2d9e5f; color: #fff;
  border: none; border-radius: 28px; padding: 14px 32px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
  animation: finish-zone-pop 0.25s ease-out;
  font-family: inherit; letter-spacing: 0.3px;
}
.finish-zone-btn:active { transform: translateX(-50%) scale(0.95); }
@keyframes finish-zone-pop { from { transform: translateX(-50%) scale(0.7); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

/* ─── Turf draw populate modal — auto-letter display ───────────────────────── */
.pop-letter-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; }
.pop-letter-label { font-size: 12px; font-weight: 600; color: var(--text2); }
.pop-letter-badge { font-size: 20px; font-weight: 800; color: var(--header-bg); background: var(--bg2); border-radius: 6px; padding: 2px 12px; border: 2px solid var(--border); }
.note-star {
  font-size: 10px;
  color: #2e6ec2;
  font-style: normal;
  margin-left: 3px;
  font-weight: 700;
}

/* ─── House dot number label ────────────────────────────────────────────────
   Street number shown inside hanger circles (turf markers and parcel-only
   dots at zoom 17+). Not shown for knock diamonds (too small) or apartment
   complex badges (use cbadge-id instead).
   White text-shadow gives the dark number a glow so it reads on any
   background color — especially on #9ca3af (legend "Not visited" grey). */
.house-dot-num {
  font-size: 9px;
  font-weight: 800;
  color: #1f2937;
  text-shadow: 0 0 3px rgba(255,255,255,0.95), 0 0 2px rgba(255,255,255,0.9);
  line-height: 1;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.4px;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

/* ─── House dot ─────────────────────────────────────────────────────────────── */
.house-dot {
  width: var(--dot-size, 20px); height: var(--dot-size, 20px); border-radius: 50%;
  background: var(--dc, #9ca3af);  /* fallback = legend "Not visited" grey */
  border: 2px solid rgba(255,255,255,0.95);
  display: flex; align-items: center; justify-content: center;
  opacity: var(--dot-opacity, 0.95);
  transition: transform 0.15s, opacity 0.15s;
  cursor: pointer;
  position: relative; z-index: 2;
  will-change: transform;
}
.house-dot.done { opacity: min(calc(var(--dot-opacity, 0.55) + 0.2), 1); }
.house-dot:hover { transform: scale(1.3); opacity: 1 !important; z-index: 9999; }
/* Knock diamond — rendered alone at each address (no offset). */
/* Diamond: same styling as circle, rotated 45deg. Text counter-rotated so numbers read normally. */
.house-dot.diamond { transform: rotate(45deg); border-radius: 2px; }
.house-dot.diamond .house-dot-num { transform: rotate(-45deg); display: block; font-size: 9px; font-weight: 800; }
.house-dot.diamond:hover { transform: rotate(45deg) scale(1.3); }
/* Parcel-only markers live in a fixed 32x32 Leaflet icon wrapper in addrPane.
   Center the dot within that wrapper as --dot-size scales with zoom. Non-
   interactive: pointer-events are disabled on the pane and the marker. */
.house-dot.parcel-only {
  margin-left: calc((32px - var(--dot-size, 20px)) / 2);
  margin-top:  calc((32px - var(--dot-size, 20px)) / 2);
  cursor: default;
  pointer-events: none;
}

/* ─── Plain text address label (v5.26) ──────────────────────────────────────
   Non-zone parcels show just the house number as plain dark text — no circle
   badge, no background, no border. Keeps the map navigable while reducing
   clutter from thousands of irrelevant parcel circles. */
.addr-text-only {
  font-size: 9px;
  font-weight: 700;
  color: #1f2937;
  text-shadow: 0 0 3px rgba(255,255,255,0.95), 0 0 6px rgba(255,255,255,0.8);
  line-height: 1;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.3px;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

/* ─── Mode toggle ───────────────────────────────────────────────────────────── */

.login-mode-row { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 4px; }
.login-mode-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; }

/* ─── Mode badge in popup ───────────────────────────────────────────────────── */
.mode-badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 10px; margin-top: 3px; }
.mode-badge.hanger { background: #e8f0fc; color: #2e6ec2; }
.mode-badge.knock { background: #f3f0f8; color: #8b5e9e; }

/* ─── Hide done toggle ──────────────────────────────────────────────────────── */
.hide-done-toggle { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text3); cursor: pointer; white-space: nowrap; padding: 4px 6px; }
.hide-done-toggle input { cursor: pointer; }

/* ─── Map hidden ────────────────────────────────────────────────────────────── */
#map-wrap.map-hidden { display: none; }

/* ─── Legend divider ────────────────────────────────────────────────────────── */
.legend-divider { border-top: 1px solid rgba(0,0,0,0.12); margin: 4px 0; }

/* ─── Next door highlight ───────────────────────────────────────────────────── */
.next-door-ring {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid #f59e0b;
  display: flex; align-items: center; justify-content: center;
  animation: pulse-ring 1.2s ease-out infinite;
  background: transparent;
}
.next-door-label { font-size: 7px; font-weight: 800; color: #f59e0b; letter-spacing: 0.5px; }
@keyframes pulse-ring { 0%{box-shadow:0 0 0 0 rgba(245,158,11,0.5)} 70%{box-shadow:0 0 0 10px rgba(245,158,11,0)} 100%{box-shadow:0 0 0 0 rgba(245,158,11,0)} }
.house-card.next-door { border-color: #f59e0b; background: #fffbeb; }

/* ─── Turf complete ─────────────────────────────────────────────────────────── */
.turf-complete .turf-header { background: linear-gradient(90deg, rgba(45,158,95,0.08), transparent); }
.turf-complete-badge { font-size: 11px; font-weight: 700; color: #2d9e5f; background: #e6f7ee; padding: 1px 6px; border-radius: 10px; margin-left: 4px; }

/* ─── House attribution ─────────────────────────────────────────────────────── */
.house-attr { font-size: 10px; color: var(--text4); margin-top: 2px; font-style: italic; }

/* ─── House script ──────────────────────────────────────────────────────────── */
.house-script { font-size: 10px; color: var(--text3); margin-top: 2px; border-left: 2px solid var(--border2); padding-left: 5px; }

/* ─── House del button — more visible ──────────────────────────────────────── */
.house-del-btn {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px;
  border: 1px solid var(--border); background: var(--bg2); color: var(--text3);
  font-size: 11px; cursor: pointer; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s;
}
.house-card:hover .house-del-btn { opacity: 1; }
.house-del-btn:hover { background: #fee2e2; color: #c44848; border-color: #c44848; }

/* ─── Clear turf row ────────────────────────────────────────────────────────── */
.clear-turf-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.clear-turf-btn { padding: 6px 12px; background: #fee2e2; border: 1px solid #fca5a5; color: #c44848; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; }
.clear-turf-btn:hover { background: #fecaca; }
.clear-turf-hint { font-size: 11px; color: var(--text3); }

/* ─── Leaderboard ───────────────────────────────────────────────────────────── */
.lb-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.lb-tab { flex: 1; padding: 6px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; color: var(--text2); }
.lb-tab.active { background: var(--header-bg); color: #fff; border-color: var(--header-bg); }
.lb-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: auto; }
.lb-table th { padding: 5px 8px; text-align: left; font-size: 10px; color: var(--text3); border-bottom: 1px solid var(--border); font-weight: 600; text-transform: uppercase; white-space: nowrap; }
.lb-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
/* Name column: full name on desktop, initials on mobile */
.lb-col-name { white-space: normal; word-break: break-word; }
.lb-name-full { display: inline; }
.lb-name-init { display: none; font-weight: 600; }
.lb-col-last { width: 90px; font-size: 10px; color: var(--text3); white-space: nowrap; }
.lb-gold td { background: #fffbeb; }
.lb-silver td { background: #f8fafc; }
.lb-bronze td { background: #fff7ed; }
.lb-empty { padding: 20px; text-align: center; color: var(--text4); font-size: 13px; }
.lb-footnote { padding: 8px 10px 2px; font-size: 10px; color: var(--text4); text-align: right; }
/* Mobile: swap to initials to avoid cramping */
@media (max-width: 480px) {
  .lb-name-full { display: none; }
  .lb-name-init { display: inline; }
  .lb-col-last { width: 70px; }
  .lb-table td { padding: 6px 5px; font-size: 11px; }
  .lb-table th { padding: 4px 5px; font-size: 9px; }
}

/* ─── Chat panel ────────────────────────────────────────────────────────────── */
#chat-panel {
  position: fixed; top: 0; right: -340px; width: 320px; bottom: 0;
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 8000;
  box-shadow: -4px 0 20px rgba(0,0,0,0.12);
  transition: right 0.25s ease;
}
#chat-panel.open { right: 0; }
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--header-bg); color: #fff; flex-shrink: 0; }
.chat-title { font-size: 14px; font-weight: 700; }
.chat-close { background: none; border: none; color: rgba(255,255,255,0.8); font-size: 16px; cursor: pointer; padding: 2px 6px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.chat-empty { text-align: center; color: var(--text4); font-size: 13px; padding: 30px 0; }
.chat-date-bar { text-align: center; margin: 8px 0 4px; }
.chat-date-bar span { font-size: 10px; font-weight: 600; color: var(--text4); background: var(--bg2); padding: 2px 10px; border-radius: 10px; }
.chat-msg { display: flex; flex-direction: column; max-width: 85%; }
.chat-mine { align-self: flex-end; align-items: flex-end; }
.chat-theirs { align-self: flex-start; align-items: flex-start; }
.chat-name { font-size: 10px; font-weight: 600; color: var(--text3); margin-bottom: 2px; }
.chat-bubble { padding: 7px 11px; border-radius: 14px; font-size: 13px; line-height: 1.4; word-break: break-word; }
.chat-mine .chat-bubble { background: var(--header-bg); color: #fff; border-bottom-right-radius: 4px; }
.chat-theirs .chat-bubble { background: var(--bg2); color: var(--text); border-bottom-left-radius: 4px; }
.chat-time { font-size: 9px; color: var(--text4); margin-top: 2px; }
.chat-input-row { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--border); flex-shrink: 0; }
.chat-input { flex: 1; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 20px; font-size: 13px; font-family: inherit; color: var(--text); }
.chat-input:focus { outline: none; border-color: var(--header-bg); }
.chat-send { padding: 8px 14px; background: var(--header-bg); color: #fff; border: none; border-radius: 20px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; }
.chat-unread { display: inline-block; background: #ef4444; color: #fff; border-radius: 10px; font-size: 9px; font-weight: 800; padding: 0 4px; min-width: 14px; text-align: center; vertical-align: top; margin-top: -2px; }

/* ─── Sidebar pinned chat strip (desktop) ──────────────────────────────────── */
#sidebar-chat {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  max-height: 280px;
}
.sc-header {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--header-bg);
  color: #fff;
  flex-shrink: 0;
}
.sc-title { font-size: 12px; font-weight: 700; flex: 1; }
.sc-messages {
  overflow-y: auto; padding: 6px 10px;
  display: flex; flex-direction: column; gap: 3px;
  height: 180px;
  flex-shrink: 0;
}
.sc-msg { font-size: 12px; line-height: 1.4; word-break: break-word; display: flex; flex-direction: column; gap: 1px; padding: 3px 0; }
.sc-mine { color: var(--text2); }
.sc-theirs { color: var(--text); }
.sc-msg-header { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.sc-name { font-weight: 700; font-size: 11px; color: var(--header-bg); }
.sc-mine .sc-name { color: var(--text3); }
.sc-bubble { font-size: 12px; color: var(--text); padding-left: 2px; }
.sc-time { font-size: 10px; color: var(--text4); flex-shrink: 0; }
.sc-input-row { display: flex; gap: 5px; padding: 6px 8px; border-top: 1px solid var(--border); flex-shrink: 0; }
.sc-input {
  flex: 1; padding: 5px 9px; border: 1.5px solid var(--border);
  border-radius: 14px; font-size: 12px; font-family: inherit; color: var(--text);
  background: var(--bg);
}
.sc-input:focus { outline: none; border-color: var(--header-bg); }
.sc-send {
  padding: 5px 10px; background: var(--header-bg); color: #fff;
  border: none; border-radius: 14px; font-size: 11px; font-weight: 700;
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.sc-send:hover { opacity: 0.88; }
.desktop-only { display: flex; flex-direction: column; }


/* ─── School labels ─────────────────────────────────────────────────────────── */
.school-label {
  background: rgba(255,255,255,0.95);
  color: #7f1d1d;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 3px;
  white-space: nowrap;
  border: 1.5px solid rgba(127,29,29,0.55);
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  pointer-events: none;
  letter-spacing: 0.1px;
}
.school-label-hs { font-size: 11px; font-weight: 900; border-width: 2px; }
.school-label-ms { font-size: 10px; font-weight: 800; }
.school-label-es { font-size: 9px;  font-weight: 700; }
/* Mobile school label overrides moved to end of file for specificity */
/* Tile opacity 0.65 on all devices — set in map.js */

/* ─── Mobile chat ───────────────────────────────────────────────────────────── */
#chat-panel {
  position: fixed; top: 0; right: -100%; width: 100%; bottom: 0;
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 8000;
  box-shadow: -4px 0 20px rgba(0,0,0,0.12);
  transition: right 0.25s ease;
}
#chat-panel.open { right: 0; }
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--header-bg); color: #fff; flex-shrink: 0; }
.chat-title { font-size: 14px; font-weight: 700; }
.chat-close { background: none; border: none; color: rgba(255,255,255,0.8); font-size: 18px; cursor: pointer; padding: 4px 8px; line-height: 1; }
.chat-messages { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.chat-empty { text-align: center; color: var(--text4); font-size: 13px; padding: 30px 0; }
.chat-date-bar { text-align: center; margin: 8px 0 4px; }
.chat-date-bar span { font-size: 10px; font-weight: 600; color: var(--text4); background: var(--bg2); padding: 2px 10px; border-radius: 10px; }
.chat-msg { display: flex; flex-direction: column; max-width: 85%; }
.chat-mine { align-self: flex-end; align-items: flex-end; }
.chat-theirs { align-self: flex-start; align-items: flex-start; }
.chat-name { font-size: 10px; font-weight: 600; color: var(--text3); margin-bottom: 2px; }
.chat-bubble { padding: 7px 11px; border-radius: 14px; font-size: 13px; line-height: 1.4; word-break: break-word; }
.chat-mine .chat-bubble { background: var(--header-bg); color: #fff; border-bottom-right-radius: 4px; }
.chat-theirs .chat-bubble { background: var(--bg2); color: var(--text); border-bottom-left-radius: 4px; }
.chat-time { font-size: 9px; color: var(--text4); margin-top: 2px; }
.chat-input-row { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--border); flex-shrink: 0; background: var(--surface); }
.chat-input { flex: 1; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 20px; font-size: 13px; font-family: inherit; color: var(--text); background: var(--bg); }
.chat-input:focus { outline: none; border-color: var(--header-bg); }
.chat-send { padding: 8px 14px; background: var(--header-bg); color: #fff; border: none; border-radius: 20px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; }
.chat-unread { display: inline-block; background: #ef4444; color: #fff; border-radius: 10px; font-size: 9px; font-weight: 800; padding: 0 4px; min-width: 14px; text-align: center; vertical-align: top; margin-top: -2px; }

/* ─── Location button (SVG locate icon, no crosshair div needed) ─────────── */

/* ─── Other zone dots (faded) ───────────────────────────────────────────────── */
.house-dot.other-zone { opacity: 0.25; }

/* ─── Apartment complex marker ─────────────────────────────────────────────── */
.house-dot.complex-marker {
  width: 34px; height: 34px;
  background: rgba(124, 77, 204, 0.15);
  border: 2px solid var(--dc, #7c4dcc);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: transform 0.15s;
}
.house-dot.complex-marker:hover { transform: scale(1.15); }
.house-dot.complex-marker.done {
  background: rgba(124, 77, 204, 0.35);
  border-width: 3px;
}

/* Complex badge in sidebar card */
.complex-badge {
  display: inline-block; background: #f3eeff; color: #7c4dcc;
  border: 1px solid #c4a8f0; border-radius: 4px;
  padding: 1px 6px; font-size: 11px; font-weight: 600;
  margin-bottom: 2px;
}
.house-card.complex-house { border-left: 3px solid #7c4dcc; }

/* Complex mode badge in popup */
.mode-badge.complex { background: #f3eeff; color: #7c4dcc; border: 1px solid #c4a8f0; }

/* ─── Map tap mode ──────────────────────────────────────────────────────────── */
#map-wrap.tap-mode { cursor: crosshair !important; }
#map-wrap.tap-mode #map { cursor: crosshair !important; }

/* ─── Zone creating overlay ─────────────────────────────────────────────────── */
#creating-overlay {
  position: absolute; inset: 0; z-index: 600;
  background: rgba(248,250,252,0.88); backdrop-filter: blur(3px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.creating-spinner {
  width: 44px; height: 44px;
  border: 4px solid var(--border); border-top-color: var(--header-bg);
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
.creating-text { font-size: 14px; font-weight: 700; color: var(--text2); }

/* ─── Auto color swatch ──────────────────────────────────────────────────────── */
.color-swatch.color-auto {
  background: conic-gradient(#e05c4b, #c9831a, #2d9e5f, #2e6ec2, #8b5e9e, #e05c4b);
  font-size: 11px; color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}


/* ─── Mobile legend info button ──────────────────────────────────────────── */
.legend-info-btn { background: transparent; }
.legend-btn {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 50%;
  font-size: 16px; font-weight: 700;
  color: var(--header-bg);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.legend-btn:hover { background: #fff; }

/* ─── Claim zone button ──────────────────────────────────────────────────── */
.claim-zone-btn {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  color: #1d4ed8;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  vertical-align: middle;
}
.claim-zone-btn:hover { background: #bfdbfe; }

/* ─── User dropdown + color preview ─────────────────────────────────────── */
.user-dropdown { background: var(--surface); }
.volunteer-color-preview {
  width: 16px; height: 16px;
  border-radius: 50%;
  margin-top: 4px;
  border: 2px solid rgba(0,0,0,0.1);
  display: none;
}

@media (max-width: 680px) {
  .mobile-chat-btn { display: inline-flex !important; }
  .desktop-only { display: none !important; }
  .desktop-hide { display: inline-flex !important; }
  .list-toggle-btn { display: none !important; }
  .sidebar-close-btn { display: flex !important; }
  #admin-row2 { flex-wrap: wrap; }
  .header-row2 { gap: 5px; }
  .stats-bar { gap: 5px; }
  .stat-track { width: 44px; height: 4px; }
  .stat-pct { font-size: 9px; }
  .header-credit { display: none; }
  #lock-btn { background: none !important; border: none !important; box-shadow: none !important; }
}

/* ─── Compact header at 375px (iPhone SE — smallest common phone) ─────────── */
@media (max-width: 420px) {
  .header-row1 { padding: 4px 8px; gap: 6px; }
  .header-row2 { padding: 3px 8px 4px; gap: 4px; }
  .header-logo { font-size: 18px; }
  .header-title { font-size: 13px; }
  .header-sub { font-size: 10px; }
  .hdr-btn { font-size: 11px; padding: 4px 8px; }
  .hdr-btn.icon-btn { padding: 4px; width: 26px; height: 26px; }
  .top3-lb-btn { width: 26px !important; height: 26px !important; font-size: 14px !important; }
  .top3-chip { font-size: 10px; padding: 2px 5px; }
  .stat-chip { font-size: 11px; padding: 2px 6px; }
  .addr-search-input { width: 110px; font-size: 11px; }
  #logout-hdr-btn { font-size: 10px; padding: 3px 6px; }
  .header-right-top { gap: 4px; flex-wrap: nowrap; } /* prevent logout from breaking to new row */
  .header-sub { font-size: 10px; }                   /* smaller sub ensures Place 5 fits on one line */
}

/* ─── #11 House dot pointer-events fix — divIcon className:'' strips leaflet-interactive ── */
.leaflet-marker-icon { pointer-events: auto !important; cursor: pointer; }

/* ─── #7 Address search bar ──────────────────────────────────────────────── */
.addr-search-wrap {
  position: relative;
  flex-shrink: 0;
}
.addr-search-input {
  height: 28px; padding: 0 10px; border: 1.5px solid var(--border);
  border-radius: 14px; font-size: 12px; font-family: inherit;
  color: var(--text); background: var(--bg);
  width: 200px; outline: none;
}
.addr-search-input:focus { border-color: var(--header-bg); }
.addr-search-results {
  position: absolute; top: 32px; left: 0; z-index: 9100;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  min-width: 260px; max-height: 114px; overflow-y: auto;
}
.asr-row { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.asr-row:last-child { border-bottom: none; }
.asr-row:hover { background: var(--bg2); }
.asr-addr { font-size: 12px; font-weight: 600; color: var(--text); }
.asr-owner { font-size: 11px; color: var(--text3); }
.asr-empty { padding: 10px 12px; font-size: 12px; color: var(--text4); }

/* ─── #14 Inline volunteer assign dropdown ───────────────────────────────── */
.turf-inline-assign {
  font-size: 11px; padding: 2px 5px; border: 1px solid var(--border);
  border-radius: 5px; background: var(--bg); color: var(--text);
  font-family: inherit; cursor: pointer;
  width: 100%; box-sizing: border-box;
}
.turf-inline-assign:focus { outline: none; border-color: var(--header-bg); }

/* ─── #16 User color swatches ────────────────────────────────────────────── */
.color-swatch-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.euc-sw { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid rgba(0,0,0,0.1); transition: outline 0.1s; }
.euc-sw:hover { outline: 2px solid rgba(0,0,0,0.4); }

/* ─── #20 Mobile: map default, sidebar full-screen slide-out ─────────────── */
@media (max-width: 680px) {
  .container { flex-direction: column; }
  #map-wrap { flex: 1; min-height: 55vh; display: flex; }
  #map { flex: 1; }
  #sidebar {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; max-width: none; max-height: none;
    z-index: 7500; background: var(--surface);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    border-top: none;
    display: flex !important;
    flex-direction: column;
  }
  #sidebar.sidebar-open {
    transform: translateY(0);
  }
  .map-toggle-btn-wrap { display: flex; }
}

/* ─── #23 Top bar mobile — keep stats + trophy on one row ───────────────── */
@media (max-width: 680px) {
  .header-row2 {
    flex-wrap: nowrap;
    gap: 4px;
    padding: 4px 8px;
    overflow: hidden;
  }
  .row2-right {
    margin-left: 0;
    flex-shrink: 0;
  }
  #admin-row2 {
    flex-wrap: wrap;
    gap: 4px;
  }
  .admin-btn { font-size: 11px; padding: 4px 8px; }
  .addr-search-input { width: 140px; }
  .addr-search-results { min-width: 200px; }
}

/* ─── #2 Mobile chat fix — white bg, inline strip format ─────────────────── */
@media (max-width: 680px) {
  #chat-panel {
    background: var(--surface) !important;
  }
  .chat-messages {
    background: var(--surface);
  }
  .chat-msg {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 4px;
    background: transparent;
    align-self: unset;
    padding: 2px 0;
  }
  .chat-mine .chat-bubble,
  .chat-theirs .chat-bubble {
    background: transparent;
    color: var(--text);
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 12px;
  }
  .chat-input-row { background: var(--surface); }
}

/* ─── Import Modal ──────────────────────────────────────────────────────────── */
.import-section { margin-bottom: 14px; }
.import-step-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.import-template-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg2); border: 1.5px solid var(--border);
  color: var(--text); font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 6px; cursor: pointer;
  font-family: inherit; transition: background .15s; margin-bottom: 5px;
}
.import-template-btn:hover { background: var(--bg-secondary); }
.import-file-input { display: none; }
.import-file-label {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 600;
  padding: 6px 14px; border-radius: 6px; cursor: pointer;
  font-family: inherit; transition: background .15s; margin-bottom: 5px;
}
.import-file-label:hover { background: #1a5cb5; }
.import-preview {
  border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; margin-top: 8px; max-height: 220px; overflow-y: auto;
}
.import-summary {
  display: flex; gap: 12px; align-items: center;
  padding: 7px 12px; background: var(--bg2);
  font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--border);
}
.import-ok   { color: #2d9e5f; }
.import-warn { color: #c9831a; }
.import-row-list { display: flex; flex-direction: column; }
.import-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.import-row:last-child { border-bottom: none; }
.imp-ok        { background: #f0fdf4; }
.imp-miss      { background: #fef2f2; }
.imp-nominatim { background: #fffbeb; }
.imp-err       { background: #fef2f2; }
.import-err    { color: #c44848; }
.imp-icon { font-size: 11px; font-weight: 700; width: 14px; flex-shrink: 0; }
.imp-ok        .imp-icon { color: #2d9e5f; }
.imp-miss      .imp-icon { color: #c44848; }
.imp-nominatim .imp-icon { color: #c9831a; }
.imp-err       .imp-icon { color: #c44848; }
.imp-addr { flex: 1; color: var(--text); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-type { font-size: 10px; color: var(--text-muted); flex-shrink: 0; }
.imp-more { padding: 5px 12px; font-size: 11px; color: var(--text-muted); font-style: italic; }
.imp-vol { font-size: 10px; padding: 1px 5px; border-radius: 3px; background: #e8f0fc; color: #2e6ec2; flex-shrink: 0; }
.imp-vol.imp-vol-bad { background: #fde8e8; color: #c44848; }
.imp-vol-err { font-size: 10px; color: #c44848; flex-shrink: 0; }
.imp-nominatim-label { font-size: 10px; color: #c9831a; flex-shrink: 0; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-confirm-btn, .imp-reject-btn { font-size: 10px; padding: 1px 5px; border-radius: 3px; cursor: pointer; border: 1px solid; flex-shrink: 0; }
.imp-confirm-btn { background: #e6f7ee; color: #2d9e5f; border-color: #2d9e5f; }
.imp-confirm-btn:hover { background: #2d9e5f; color: #fff; }
.imp-reject-btn  { background: #fde8e8; color: #c44848; border-color: #c44848; }
.imp-reject-btn:hover  { background: #c44848; color: #fff; }

/* Hide zone number badge when zoomed in enough to show address chips */
#map.hide-turf-labels .turf-label { display: none; }

/* ─── Deletable note chips (admin popup) ────────────────────────────────────── */
.popup-chips-existing { margin-bottom: 2px; }
.note-chip-deletable {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 5px 2px 7px;
  background: #ede9f5; border: 1px solid #c9bee0; border-radius: 12px;
  font-size: 10px; color: #5a4d72;
}
.note-chip-x {
  background: none; border: none; cursor: pointer; padding: 0 1px;
  font-size: 9px; color: #9b80c4; line-height: 1;
  display: flex; align-items: center;
}
.note-chip-x:hover { color: #c44848; }

/* ─── Personal progress bar ─────────────────────────────────────────────────── */
.my-progress-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 10px; background: rgba(255,255,255,0.12);
  border-radius: 6px; flex-shrink: 0;
}
.my-prog-label {
  font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.75);
  white-space: nowrap; text-transform: uppercase; letter-spacing: 0.04em;
}
.my-prog-track {
  position: relative;
  width: 140px; height: 14px; background: rgba(255,255,255,0.2);
  border-radius: 4px; overflow: hidden; display: flex; flex-shrink: 0;
}
.my-prog-seg { height: 100%; transition: width 0.4s ease; }
.my-prog-inline {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: #fff; white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.55);
  pointer-events: none; letter-spacing: 0.02em;
}
@media (max-width: 680px) {
  .my-progress-bar { padding: 2px 6px; gap: 4px; }
  .my-prog-track { width: 90px; height: 12px; }
  .my-prog-label { display: none; }
  .my-prog-inline { font-size: 9px; }
}

/* ─── Popup delete marker button (admin) ────────────────────────────────────── */
.popup-delete-btn {
  display: block; width: calc(100% - 16px); margin: 0 8px 8px;
  padding: 5px; background: transparent;
  border: 1px solid #fca5a5; border-radius: var(--radius-sm);
  color: #c44848; font-size: 11px; cursor: pointer; text-align: center;
}
.popup-delete-btn:hover { background: #fee2e2; border-color: #c44848; }

/* ─── Zone creation queue banner ────────────────────────────────────────────── */
.zone-queue-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 8500;
  background: #1c355e; color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.25);
}
.zqb-count {
  background: rgba(255,255,255,0.2); border-radius: 10px;
  padding: 1px 8px; font-size: 11px; font-weight: 700;
}

/* ─── Pending zone saves — sidebar indicator ────────────────────────────────── */
.zone-pending-bar {
  display: flex; align-items: center; gap: 6px;
  background: #fefce8; border-bottom: 1px solid #fde047;
  color: #713f12; font-size: 12px; font-weight: 600;
  padding: 6px 12px;
}
.zpb-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #eab308;
  animation: zpb-pulse 1.2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes zpb-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

/* ─── Mobile list FAB ───────────────────────────────────────────────────────── */
.mobile-list-fab {
  display: none;
}
@media (max-width: 680px) {
  .mobile-list-fab {
    display: flex; align-items: center; justify-content: center;
    position: fixed; bottom: 8px; right: 8px; z-index: 8000;
    width: 46px; height: 46px; border-radius: 50%;
    background: var(--header-bg); color: #fff;
    border: none; font-size: 20px; cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    transition: transform 0.15s, box-shadow 0.15s;
  }
  .mobile-list-fab:active { transform: scale(0.92); box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
  /* Hide old header list button on mobile — FAB replaces it */
  .list-toggle-btn { display: none !important; }
}

/* ─── Zone stats popup ──────────────────────────────────────────────────────── */
.zsb-breakdown { display: flex; flex-direction: column; gap: 4px; }
.zsb-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.zsb-row:last-child { border-bottom: none; }
.turf-label { cursor: pointer; transition: transform 0.1s, box-shadow 0.1s; }
.turf-label:hover { transform: scale(1.12); box-shadow: 0 4px 14px rgba(0,0,0,0.5); }

/* ─── Mobile map filter overlay ─────────────────────────────────────────────── */
.mobile-map-filter { display: none; }
@media (max-width: 680px) {
  /* Filter bar sits fixed just below the header — uses CSS var set by JS */
  .mobile-map-filter {
    display: flex; gap: 5px;
    position: fixed;
    top: var(--mobile-header-h, 90px);
    left: 0; right: 0;
    z-index: 2000;
    pointer-events: auto; flex-wrap: nowrap;
    padding: 5px 8px;
    background: rgba(255,255,255,0.97);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  }
  .mobile-map-filter select {
    flex: 1; min-width: 0; font-size: 11px; padding: 4px 3px;
    border: 1px solid var(--border); border-radius: 6px;
    background: var(--surface); color: var(--text);
    font-family: inherit; cursor: pointer;
    -webkit-appearance: auto;
  }
  /* Push Leaflet zoom controls below the filter bar */
  .leaflet-top.leaflet-left { margin-top: 52px !important; margin-left: 8px; }
  /* Push map content down so filter bar doesn't overlap markers */

}

/* ═══ FINAL MOBILE OVERRIDES — must stay at end of file ═══════════════════════ */
@media (max-width: 680px) {
  .stat-label-text { display: none; }
  .stat-dual-label { min-width: 18px; }

  /* School labels: fully opaque white pill, dark red text — matches desktop exactly */
  .school-label {
    background: #ffffff !important;
    color: #7f1d1d !important;
    border: 1.5px solid rgba(127,29,29,0.8) !important;
    box-shadow: 0 1px 6px rgba(0,0,0,0.55) !important;
    font-weight: 800 !important;
  }
  /* Aerial tile: force 0.65 opacity on mobile to match desktop */
  .leaflet-tile-pane img { opacity: 0.65 !important; }
  /* Marker wrappers: always transparent regardless of dark mode */
  .leaflet-pane.leaflet-shadow-pane,
  .leaflet-marker-pane > div { background: transparent !important; }
}

/* ─── Multi-select ───────────────────────────────────────────────────────────── */
.ms-bar { padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--bg2); }
.ms-start-btn { font-size: 12px; font-weight: 600; color: var(--accent); background: none; border: 1.5px solid var(--accent); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.ms-start-btn:hover { background: rgba(44,110,194,0.08); }
.ms-active-bar { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.ms-street-wrap { flex: 1; min-width: 100px; }
.ms-street-sel { font-size: 11px; padding: 3px 5px; border: 1px solid var(--border); border-radius: 5px; background: var(--bg); color: var(--text); width: 100%; }
.ms-btn { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 5px; cursor: pointer; border: none; white-space: nowrap; }
.ms-all  { background: #e8f0fc; color: #2e6ec2; }
.ms-none { background: var(--bg2); color: var(--text3); border: 1px solid var(--border); }
.ms-apply { background: #2d9e5f; color: #fff; }
.ms-cancel { background: none; color: var(--text3); border: 1px solid var(--border); }
.ms-mode { cursor: pointer; position: relative; }
.ms-selected { outline: 2px solid #2e6ec2; outline-offset: 1px; background: rgba(46,110,194,0.07) !important; }
.ms-num { border: 2px dashed #9ca3af; color: #fff; font-weight: 800; font-size: 13px; transition: background 0.15s, border-color 0.15s; }
.ms-num-selected { border: 2px solid #2d9e5f; background: #2d9e5f !important; }

/* Map marker multi-select states
   v6.26: Keep the underlying status color (var(--dc)) and the house-dot-num
   visible. Unselected in ms-mode = dashed dark ring + soft white halo so the
   marker clearly signals "tappable selection target" without blanking out the
   existing knock/hanger result color. Selected = solid green ring + corner
   check badge; no full background swap. */
/* v6.26c: white dashed border keeps the underlying status color (--dc) fully
   visible. The previous dark (#1a1a1a) border muddied green/grey fills. */
.ms-dot { border: 2px dashed rgba(255,255,255,0.9) !important; box-shadow: 0 0 0 2px rgba(0,0,0,0.4); cursor: pointer; }
.ms-dot-selected { border: 3px solid #2d9e5f !important; box-shadow: 0 0 0 2px #fff, 0 0 10px rgba(45,158,95,0.65); }
/* Corner check badge on selected markers — counter-rotated on diamonds so it
   stays upright regardless of the dot's 45deg rotation. */
.ms-check {
  position: absolute;
  top: -6px; right: -6px;
  background: #2d9e5f;
  color: #fff;
  border-radius: 50%;
  width: 14px; height: 14px;
  font-size: 10px; line-height: 14px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
  pointer-events: none;
  z-index: 3;
}
.house-dot.diamond .ms-check { transform: rotate(-45deg); }

/* Floating bar — appears anchored above the map/sidebar boundary in multi-select mode */
#ms-float-bar {
  position: fixed;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: rgba(17, 24, 39, 0.93);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 28px;
  z-index: 800;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  white-space: nowrap;
}
/* v6.26b: On mobile, anchor the float bar below BOTH the header AND the
   filter bar (Hangers/Volunteers/Results row). Previously it used only
   --mobile-header-h which placed it behind the filter bar (z-index 2000 vs
   800), making Skip/Cancel invisible. Now uses --mobile-controls-h which JS
   sets to header + filter-bar height combined. Default 138px = ~96px header
   + ~42px filter bar. Row wraps when many buttons show. */
@media (max-width: 680px) {
  #ms-float-bar {
    top: calc(var(--mobile-controls-h, 138px) + 8px);
    bottom: auto;
    max-width: calc(100vw - 16px);
    padding: 6px 12px;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    white-space: normal;
  }
  .ms-float-applyb { font-size: 12px; padding: 5px 10px; }
  .ms-float-cancelb { font-size: 12px; padding: 5px 8px; }
}
/* v6.25: Desktop — center the float bar within the map pane (left of the 320px
   sidebar) and cap its size so it cannot bleed into the sidebar or stretch
   full-width when many action buttons are shown. */
@media (min-width: 681px) {
  #ms-float-bar {
    left: calc((100vw - 320px) / 2);
    transform: translateX(-50%);
    max-width: calc(100vw - 360px);
    max-height: 72px;
    flex-wrap: wrap;
    white-space: normal;
    overflow-x: auto;
    padding: 8px 16px;
    gap: 8px;
    row-gap: 6px;
  }
}
.ms-float-label { color: #e5e7eb; font-size: 13px; font-weight: 700; width: 100%; text-align: center; }
.ms-float-applyb { font-size: 13px; padding: 6px 16px; }
.ms-float-cancelb { font-size: 13px; padding: 6px 12px; background: rgba(255,255,255,0.12); color: #e5e7eb; border-color: rgba(255,255,255,0.2); }
.ms-result-grid { display: flex; flex-direction: column; gap: 5px; }
.ms-result-opt { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px; background: var(--rc, var(--bg2)); cursor: pointer; font-size: 13px; color: var(--rcc, var(--text)); border: 1.5px solid transparent; }
.ms-result-opt:has(input:checked) { border-color: var(--rcc, #2e6ec2); font-weight: 700; }
.ms-result-opt input { margin: 0; }

/* ─── Unclaim button ─────────────────────────────────────────────────────────── */
.unclaim-zone-btn { font-size: 11px; color: #9ca3af; background: none; border: 1px solid #d1d5db; border-radius: 4px; padding: 1px 6px; cursor: pointer; margin-left: 4px; }
.unclaim-zone-btn:hover { color: #c44848; border-color: #c44848; }

/* ─── Undo toast ─────────────────────────────────────────────────────────────── */
.toast-undo { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.toast-undo-btn { background: rgba(255,255,255,0.25); border: 1px solid rgba(255,255,255,0.5); color: #fff; border-radius: 4px; padding: 2px 8px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.toast-undo-btn:hover { background: rgba(255,255,255,0.4); }

/* ─── Complex building marker badges (Item 1) ──────────────────────────────── */
.complex-marker { display: flex; align-items: center; justify-content: center; gap: 2px; border-radius: 6px; background: var(--dc, #7c4dcc); color: #fff; font-size: 10px; font-weight: 700; white-space: nowrap; padding: 2px 6px; box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.complex-marker .cbadge-id { font-size: 10px; }
.complex-marker .cbadge-units { font-size: 9px; opacity: 0.85; margin-left: 2px; }
.complex-marker.done { opacity: 0.6; }

/* ─── "Show in List" button in house popup (Item 8) ─────────────────────────── */
.popup-list-btn { width: 100%; padding: 6px 0; margin-top: 4px; background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; font-size: 12px; color: var(--text2); cursor: pointer; }
.popup-list-btn:hover { background: #e8f0fc; color: #2e6ec2; border-color: #2e6ec2; }

/* ─── House card highlight pulse (Item 8) ───────────────────────────────────── */
@keyframes highlightPulse {
  0%   { outline: 3px solid #2e6ec2; background: rgba(46,110,194,0.12); }
  100% { outline: 3px solid transparent; background: transparent; }
}
.highlight-pulse { animation: highlightPulse 2s ease-out; }

/* ─── Chat backdrop for click-outside-to-close (Item 7) ─────────────────────── */
.chat-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 7999; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.chat-backdrop.active { opacity: 1; pointer-events: auto; }
.chat-close { background: none; border: none; color: rgba(255,255,255,0.9); font-size: 20px; cursor: pointer; padding: 4px 10px; line-height: 1; z-index: 1; position: relative; }
.chat-close:hover { color: #fff; }

/* ─── Mobile vertex dot for draggable drawing (Item 5) ──────────────────────── */
.mobile-vertex-dot { width: 18px; height: 18px; border-radius: 50%; background: #FFE600; border: 2px solid #1a1a1a; box-shadow: 0 1px 4px rgba(0,0,0,0.3); cursor: grab; }

/* ─── Add-Home FAB ─────────────────────────────────────────────────────────── */
#add-home-fab {
  position: fixed;
  bottom: 68px; right: 12px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #1e3a5f;
  border: 2px solid rgba(255,255,255,0.25);
  color: #fff;
  font-size: 22px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0,0,0,0.4);
  z-index: 9000; /* above chat panel (8000) and backdrop (7999) */
  transition: background 0.15s, transform 0.12s, right 0.25s ease, bottom 0.25s ease;
}
/* Desktop: FAB at bottom-left of map pane so it clears the bottom-right
   Leaflet layer control. When chat is open, keep it in the same spot. */
@media (min-width: 681px) {
  #add-home-fab { left: 12px; right: auto; bottom: 68px; }
  body.chat-open #add-home-fab { left: 12px; right: auto; bottom: 100px; }
}
/* Mobile: keep FAB visible above chat input bar when chat is full-screen */
@media (max-width: 680px) {
  body.chat-open #add-home-fab { bottom: 80px; right: 12px; }
}
#add-home-fab:hover { background: #2a5298; }
#add-home-fab.drop-active { background: #d97706; border-color: #fbbf24; }
#add-home-fab.hidden { display: none; }
/* Rotate + → ✕ when the action menu is open */
#add-home-fab.fab-open { transform: rotate(45deg); background: #2a5298; }

/* ─── Add-Home FAB action menu (v6.26) ─────────────────────────────────────── */
#add-home-fab-menu {
  position: fixed;
  bottom: 120px; right: 12px;
  display: flex; flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 8999; /* just below the main FAB (9000) */
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease, right 0.25s ease, bottom 0.25s ease;
}
#add-home-fab-menu.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
#add-home-fab-menu.hidden { display: none; }
/* Match the desktop/chat FAB repositions so the menu stays aligned with its FAB */
@media (min-width: 681px) {
  #add-home-fab-menu { left: 12px; right: auto; bottom: 120px; align-items: flex-start; }
  body.chat-open #add-home-fab-menu { left: 12px; right: auto; bottom: 152px; }
}
@media (max-width: 680px) {
  body.chat-open #add-home-fab-menu { bottom: 132px; right: 12px; }
  #add-home-fab-menu { bottom: 120px; } /* clear the FAB button (bottom:68px + 44px height + 8px gap) */
}
.fab-action {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 8px;
  border-radius: 22px;
  background: #1e3a5f;
  border: 2px solid rgba(255,255,255,0.25);
  color: #fff;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  white-space: nowrap;
  transition: background 0.15s, transform 0.12s;
}
.fab-action:hover { background: #2a5298; transform: translateX(-2px); }
.fab-action.hidden { display: none; }
.fab-action-icon {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  font-size: 15px;
}
.fab-action-label { padding-right: 4px; }

/* Pending multi-drop marker style */
.pending-multi {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #d97706;
  border: 2px solid #fbbf24;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  animation: pulse-pending 1.2s infinite;
}

/* Drop mode: crosshair cursor on map */
body.drop-mode #map { cursor: crosshair !important; }

/* ─── Pending (optimistic) house marker ────────────────────────────────────── */
.house-marker-pending {
  opacity: 0.6;
  animation: pending-pulse 1.5s ease-in-out infinite;
}
@keyframes pending-pulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 0.9; }
}

/* Blocked (duplicate) click in multi-drop — short-lived red X marker */
.house-marker-blocked {
  color: #fff !important;
  font-weight: 700;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  animation: blocked-fade 1.5s ease-out forwards;
}
@keyframes blocked-fade {
  0%   { opacity: 1;   transform: scale(1.2); }
  80%  { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0;   transform: scale(0.9); }
}

/* ─── Add-Home confirmation sheet ─────────────────────────────────────────── */
#add-home-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #1e293b;
  border-top: 2px solid #334155;
  padding: 16px 16px 24px;
  z-index: 9000;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
  animation: slideUp 0.2s ease-out;
}
#add-home-sheet h3 {
  margin: 0 0 12px;
  font-size: 15px; color: #e2e8f0;
  font-weight: 700;
}
#add-home-sheet label {
  display: block; font-size: 11px; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 4px; margin-top: 10px;
}
.add-home-addr-row { display: flex; gap: 6px; align-items: stretch; }
.add-home-addr-row #add-home-addr-input { flex: 1; width: auto; }
#add-home-edit-addr-btn {
  background: rgba(255,255,255,0.08); border: 1px solid #475569;
  color: #94a3b8; border-radius: 6px; padding: 0 10px;
  cursor: pointer; font-size: 15px; flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
#add-home-edit-addr-btn:hover { background: rgba(255,255,255,0.15); color: #e2e8f0; }
#add-home-addr-input {
  width: 100%; box-sizing: border-box;
  background: #0f172a; border: 1px solid #475569;
  color: #e2e8f0; border-radius: 6px;
  padding: 8px 10px; font-size: 14px;
}
#add-home-zone-info {
  font-size: 13px; color: #94a3b8;
  margin-top: 6px;
}
.add-home-btns {
  display: flex; gap: 8px; margin-top: 14px;
}
.add-home-btns button {
  flex: 1; padding: 10px;
  border-radius: 8px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
#add-home-confirm-btn { background: #2d9e5f; color: #fff; }
#add-home-confirm-btn:disabled { background: #374151; color: #9ca3af; }
#add-home-more-btn    { background: #2e6ec2; color: #fff; }
#add-home-cancel-btn  { background: #374151; color: #e2e8f0; }
@keyframes slideUp {
  from { transform: translateY(100%); } to { transform: translateY(0); }
}
.mobile-vertex-dot:active { cursor: grabbing; }

/* ─── Popup activity rows & No-solicitation button ─────────────────────────── */
.popup-activity-row { margin: 6px 0; }
.popup-activity-label { font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; padding-left: 2px; }
.popup-nosol-btn { width: 100%; padding: 8px; margin: 6px 0; background: #fde8e8; color: #ef4444; border: 1px solid #ef4444; border-radius: 6px; font-weight: 600; font-size: 13px; cursor: pointer; }
.popup-nosol-btn:hover { background: #ef4444; color: white; }
.popup-move-btn { width: 100%; padding: 6px; margin: 2px 0; background: #e8f0fc; color: #2e6ec2; border: 1px solid #2e6ec2; border-radius: 6px; font-weight: 600; font-size: 12px; cursor: pointer; }
.popup-move-btn:hover { background: #2e6ec2; color: white; }

/* ─── Phone landscape mode ────────────────────────────────────────────────────
   Targets phones held sideways: ~390–932px wide, ≤ 500px tall.
   Goal: compact header, map fills height, sidebar/FABs accessible.        */
@media (max-height: 500px) and (min-width: 480px) {
  /* ── Header: collapse both rows into one compact strip ───────────────── */
  #header {
    flex-direction: row;
    align-items: center;
    padding: 0 10px;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    overflow: hidden;
  }
  .header-row1 {
    flex: 1; padding: 0; gap: 6px; min-width: 0;
    border-bottom: none;
  }
  .header-row2 {
    flex: 0 0 auto; padding: 0 0 0 6px; background: transparent;
    border-left: 1px solid rgba(255,255,255,0.2);
    max-width: 55%;
    overflow: hidden;
  }
  .header-logo { font-size: 18px; }
  .header-title { font-size: 13px; }
  .header-sub { display: none; }
  .header-credit { display: none; }
  .hdr-btn { padding: 4px 8px; font-size: 11px; }
  .hdr-btn.icon-btn { width: 28px; height: 28px; padding: 4px; }
  .top3-bar { gap: 3px; }
  .top3-chip { font-size: 10px; padding: 1px 5px; }
  .stat-chip { font-size: 10px; padding: 1px 5px; }
  .stat-track { width: 40px; height: 4px; }
  .stat-pct { font-size: 9px; }
  /* ── Layout: map fills all available height ──────────────────────────── */
  .container { flex-direction: row; }
  #map-wrap { flex: 1; }
  /* ── Sidebar: narrower panel on right, not full-screen overlay ────────── */
  #sidebar {
    width: 200px !important;
    min-width: 0 !important;
    max-width: 200px !important;
    font-size: 11px;
  }
  .turf-header { padding: 6px 8px; }
  .turf-letter-badge { width: 24px; height: 24px; font-size: 11px; }
  .turf-volunteer { font-size: 11px; }
  .house-card { padding: 5px; }
  .house-addr { font-size: 11px; }
  /* Mobile sidebar override: in landscape reset the full-screen slide */
  @media (max-width: 680px) {
    #sidebar {
      position: relative !important;
      transform: none !important;
      top: auto !important; left: auto !important;
      right: auto !important; bottom: auto !important;
      z-index: auto !important;
      height: 100% !important;
      border-left: 1px solid var(--border) !important;
      border-top: none !important;
    }
    #sidebar.sidebar-open { transform: none !important; }
    .sidebar-close-btn { display: none !important; }
  }
  /* ── Filter dropdowns: smaller so selects stay tappable ─────────────── */
  .mobile-map-filter { display: none !important; } /* sidebar is visible; no overlay needed */
  .sb-filter-row select { font-size: 11px; padding: 3px 5px; }
  /* ── Floating buttons: tuck them tighter ─────────────────────────────── */
  #add-home-fab { bottom: 8px; right: 8px; width: 38px; height: 38px; font-size: 18px; }
  #add-home-fab-menu { right: 8px; bottom: 54px; }
  .mobile-list-fab { display: none !important; }
  /* ── Sync bar: hide to save space ────────────────────────────────────── */
  #sync-bar { display: none; }
  /* ── Chat: never auto-show in landscape; button still works ──────────── */
  #chat-panel:not(.open) { right: -100% !important; }
}

/* ── Change Address button in popup ──────────────────────────────────────── */
.popup-change-addr-btn {
  font-size: 11px; padding: 4px 8px; border-radius: 6px;
  background: #f0f4ff; color: #1e40af; border: 1px solid #bfdbfe;
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.popup-change-addr-btn:hover { background: #dbeafe; }
