body { margin: 0; padding: 0; }

#map {
  position: absolute;
  top: var(--nav-height);
  bottom: 0;
  width: 100%;
}

.popup-report-btn {
  display: block;
  margin: 10px 0 0 auto;
  padding: 6px 12px;
  font-size: 12px;
}

.popup-building-status {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 6px;
}
.popup-building-status--empty {
  color: var(--danger);
}

/* ── Buttons & controls ── */

.overlay-toggle {
  background: var(--surface);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.overlay-toggle:hover {
  background: var(--bg);
  border-color: #c8ced8;
  box-shadow: var(--shadow-xs);
}
.overlay-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.overlay-toggle:disabled { opacity: 0.45; cursor: not-allowed; }
.overlay-toggle-spaced { margin-left: 0; }

/* ── Popover menus ── */

.popover-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 4;
  background: var(--surface);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-lg);
  font-family: inherit;
  font-size: 13px;
  min-width: 180px;
}
.popover-menu.open { display: block; }
.popover-menu .note {
  font-size: 12px;
  margin-top: 6px;
  max-width: 220px;
  color: var(--text-muted);
  padding: 0 4px;
}

.draw-action-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.draw-action-btn:hover {
  background: var(--accent-light);
  color: var(--accent-darker);
}
.draw-action-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.draw-action-btn + .draw-action-btn { margin-top: 1px; }

.boundary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 8px;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  transition: background 0.12s var(--ease);
}
.boundary-row:hover { background: rgba(0, 0, 0, 0.02); }
.boundary-row + .boundary-row {
  border-top: 1px solid var(--border-soft);
  margin-top: 2px;
}
.boundary-row-label { font-size: 13px; font-weight: 500; }

.visibility-btn {
  background: none;
  border: none;
  padding: 4px;
  margin: 0;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  border-radius: var(--radius-xs);
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.visibility-btn:hover {
  color: var(--accent);
  background: var(--accent-light);
}
.visibility-btn.hidden-state { color: var(--text-faint); }

/* ── Info badge ── */

.info-badge {
  position: absolute;
  left: 16px;
  top: calc(var(--nav-height) + 12px);
  z-index: 1;
  background: var(--surface-overlay);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-darker);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-soft);
  letter-spacing: -0.01em;
}

/* ── Boundary overlay control ── */

.boundary-overlay-control {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 3;
}
.boundary-overlay-control .overlay-toggle {
  box-shadow: var(--shadow-md);
  background: var(--surface-overlay);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.boundary-overlay-control .popover-menu {
  top: auto;
  bottom: calc(100% + 8px);
  left: 0;
}

/* ── Side rail ── */

.side-rail {
  position: fixed;
  left: -47px;
  top: var(--nav-height);
  bottom: 0;
  width: 52px;
  z-index: 6;
  background: var(--surface-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  border-right: 1px solid var(--border-soft);
  transition: left 0.22s var(--ease);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 16px;
  box-sizing: border-box;
}
.side-rail.open { left: 0; }

.side-rail-tab {
  position: absolute;
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 44px;
  background: var(--surface-overlay);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-soft);
  border-left: none;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  box-shadow: var(--shadow-md);
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.side-rail-tab:hover {
  background: var(--surface);
  color: var(--accent);
}

.side-rail-icon-wrap { position: relative; }

.side-rail-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.15s var(--ease-spring);
}
.side-rail-icon-btn:hover {
  background: var(--accent-light);
  border-color: rgba(209, 69, 15, 0.25);
  box-shadow: var(--shadow-xs);
  transform: scale(1.05);
}
.side-rail-icon-wrap .popover-menu {
  top: 0;
  left: calc(100% + 10px);
}

.nested-menu-wrap { position: relative; }
.nested-menu-wrap > .popover-menu { top: 0; left: calc(100% + 6px); }
.menu-item-hidden { display: none; }

/* ── Search (side-rail flyouts: icon button -> popover with the input, results nested below it).
   Shared by the neighborhood search and the address/business search. ── */

.search-flyout-popover {
  min-width: 260px;
}
.search-flyout-popover.open {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.search-flyout-popover input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 13px;
  background: var(--surface);
  box-sizing: border-box;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.search-flyout-popover input::placeholder { color: var(--text-faint); }
.search-flyout-popover input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
/* Overrides the generic `.side-rail-icon-wrap .popover-menu` fly-out-to-the-right positioning
   (higher specificity via the class) so the results list drops directly below the search input
   instead of flying out to the side like a sibling flyout would. */
.search-flyout-popover .popover-menu {
  position: static;
  top: auto;
  left: auto;
  box-shadow: none;
  border: none;
  padding: 0;
  margin: 0;
}
.search-flyout-popover .popover-menu.open { margin-top: 4px; }
.search-flyout-popover .draw-action-btn { white-space: normal; }

/* ── Side panels ── */

.side-panel {
  position: absolute;
  top: calc(var(--nav-height) + 12px);
  z-index: 1;
  width: 260px;
  max-height: 60vh;
  background: var(--surface-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-soft);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.side-panel.visible { display: flex; }

.side-panel-header {
  padding: 12px 14px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.5);
}
.side-panel-scroll { overflow-y: auto; }

.side-panel table { width: 100%; border-collapse: collapse; }
.side-panel th, .side-panel td { text-align: left; padding: 7px 12px; }
.side-panel thead th {
  position: sticky;
  top: 0;
  background: #f8f9fb;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-soft);
}
.side-panel tbody tr:nth-child(even) { background: rgba(0, 0, 0, 0.015); }
.side-panel tbody tr:hover { background: rgba(209, 69, 15, 0.04); }

.pop-table { left: 16px; }
.risk-analytics-panel { right: 16px; width: 280px; }
.risk-analytics-panel-body { padding: 12px; font-size: 13px; line-height: 1.5; }

.drawn-area-zip-list-label {
  padding: 10px 12px 0;
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* ── Responsive ── */

@media (max-width: 768px) {
  .overlay-toggle { font-size: 12px; padding: 7px 10px; }
  .popover-menu { font-size: 12px; }
  .side-panel { width: 190px; font-size: 12px; }
}
