/* =========================================================================
   SafeWalkr — map app
   Same light street-hardware system as the front page (tokens in theme.css):
   paper ground, white grouped panels, hairline separators, one accent.
   Chrome floats over the map as frosted panels. Gold stays the school pin.
   ========================================================================= */

* {
  box-sizing: border-box;
}

/* The [hidden] attribute must win over component display rules (flex/grid),
   so mode toggling (walkOnly / attendanceOnly / the pickers) hides reliably. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font-text);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

.app {
  height: 100%;
  display: grid;
  grid-template-columns: 384px 1fr;
}

:where(a, button, input, select):focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

::selection {
  background: var(--accent-wash-line);
}

/* ---------- Sidebar shell ---------- */
.panel {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.brandHeader {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

/* The brand block is the way back to the front page. */
.brandHome {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink);
  transition: background-color 0.15s;
}

.brandHome:hover {
  background: var(--line-soft);
}

.brandMark {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: block;
}

.brandMark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.brandMark .markTile {
  fill: var(--accent-fill);
  transition: fill 0.25s;
}
.brandMark .markRing {
  stroke: var(--on-accent);
  opacity: 0.55;
}
.brandMark .markInk {
  fill: var(--on-accent);
}

.brandText {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brandText h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brandSub {
  margin: 2px 0 0;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-quiet);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brandHomeHint {
  margin-left: auto;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--ink-quiet);
  white-space: nowrap;
  transition: color 0.15s, transform 0.18s var(--ease-out);
}

.brandHomeHint svg {
  width: 16px;
  height: 16px;
}

.brandHomeHintText {
  font-size: 0.74rem;
  font-weight: 600;
}

.brandHome:hover .brandHomeHint {
  color: var(--accent);
  transform: translateX(-2px);
}

.panelBody {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.lede {
  margin: 0 0 14px;
  color: var(--ink-quiet);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ---------- Grouped panels (macOS-settings style) ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-1);
}

.cardTitle {
  margin: 0 0 11px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-quiet);
}

/* ---------- Fields ---------- */
.fieldLabel {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-quiet);
  margin-bottom: 6px;
}

.searchRow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

input[type="text"] {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--paper);
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

input[type="text"]::placeholder {
  color: #99a29f;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.searchResults {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--shadow-2);
}

.searchResultItem {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  margin: 0;
  padding: 9px 12px;
  text-align: left;
  background: #fff;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.3;
  cursor: pointer;
  font-family: inherit;
}

.searchResultItem:last-child {
  border-bottom: 0;
}

.searchResultItem:hover,
.searchResultItem:focus-visible {
  outline: none;
  background: var(--accent-wash);
}

.searchResultMeta {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--ink-quiet);
}

/* ---------- Select & check rows ---------- */
.selectRow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  padding: 8px 0;
}

.selectRow + .selectRow,
.selectRow + .checkRow,
.checkRow + .checkRow {
  border-top: 1px solid var(--line-soft);
}

.selectRow select {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.selectRow select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.checkRow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  padding: 9px 0;
  cursor: pointer;
}

/* ---------- Switches ----------
   Every checkbox in the panel renders as a switch: track + knob, accent when
   on. Same control everywhere, like a settings pane. */
.checkRow input[type="checkbox"],
.optionToggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  flex: 0 0 auto;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: #d5dbd8;
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s var(--ease-out);
}

.checkRow input[type="checkbox"]::after,
.optionToggle input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 28, 26, 0.3);
  transition: transform 0.2s var(--ease-out);
}

.checkRow input[type="checkbox"]:checked,
.optionToggle input[type="checkbox"]:checked {
  background: var(--accent-fill);
}

.checkRow input[type="checkbox"]:checked::after,
.optionToggle input[type="checkbox"]:checked::after {
  transform: translateX(16px);
}

.checkRow input[type="checkbox"] {
  margin-left: auto;
  order: 2;
}
.checkRow > span {
  order: 1;
}

/* ---------- Preference toggles ---------- */
.preferenceGroup {
  display: grid;
}

.optionToggle {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  cursor: pointer;
}

.optionToggle + .optionToggle {
  border-top: 1px solid var(--line-soft);
}

.optionToggle input[type="checkbox"] {
  order: 2;
  margin-left: auto;
}

.optionText {
  order: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.optionName {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
}

.optionHint {
  font-size: 0.78rem;
  color: var(--ink-quiet);
}

/* ---------- Buttons ---------- */
.buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 2px 0 14px;
}

.btn {
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 0.15s, border-color 0.15s, color 0.15s,
    transform 0.12s var(--ease-out), box-shadow 0.15s;
}

.btnIcon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  grid-column: 1 / -1;
  background: var(--accent-fill);
  color: var(--on-accent);
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 12px;
  box-shadow: var(--shadow-1);
}

.btn-primary:hover {
  background: var(--accent-strong);
  color: #fff;
}

html[data-accent="gold"] .btn-primary:hover {
  background: #e6a300;
  color: var(--on-accent);
}

.btn-secondary {
  border-color: var(--accent-wash-line);
  background: var(--accent-wash);
  color: var(--accent-strong);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.btn-ghost {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink-quiet);
}

.btn-ghost:hover {
  border-color: var(--ink-quiet);
  color: var(--ink);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- Status & metrics ---------- */
.status {
  min-height: 20px;
  font-size: 0.9rem;
  color: var(--ink-quiet);
  padding: 2px 2px 0;
}

.metrics {
  margin-top: 10px;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.btn-location {
  margin-top: 8px;
  width: 100%;
}

.metricRow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
}

.metricRow span {
  color: var(--ink-quiet);
}

.metricRow strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.metricNote {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--ink-quiet);
}

.metrics:not(:empty) {
  padding: 13px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--accent-wash-line);
  background: var(--accent-wash);
}

.directions {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  counter-reset: step;
}

.directions:not(:empty) {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 12px;
  box-shadow: var(--shadow-1);
}

.directionStep {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0 8px 30px;
  position: relative;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.88rem;
}

.directionStep:last-child {
  border-bottom: 0;
}

.directionStep::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-fill);
  color: var(--on-accent);
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.directionStreet {
  font-weight: 500;
  color: var(--ink);
}

.directionMeta {
  flex: 0 0 auto;
  color: var(--ink-quiet);
  font-size: 0.8rem;
  white-space: nowrap;
}

.directionArrive {
  font-weight: 600;
  color: var(--accent-strong);
}

.directionArrive::before {
  content: "★";
  background: var(--gold);
  color: #3a2a00;
}

.coords {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--ink-quiet);
}

.printInstructionsBtn {
  width: 100%;
  margin-top: 10px;
}

/* ---------- Developer mode ---------- */
.devZone {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.devUnlockBtn {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-quiet);
  padding: 9px 12px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: border-color 0.15s, color 0.15s;
}

.devUnlockBtn:hover {
  border-color: var(--ink-quiet);
  color: var(--ink);
}

.devPanel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

.devHint {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: var(--ink-quiet);
  line-height: 1.4;
}

.devButtons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

/* Draggable gold destination pin (dev mode) */
.devDestPin span {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(20, 28, 26, 0.4);
  cursor: grab;
}

.devDestPin:active span {
  cursor: grabbing;
}

/* Draggable boundary vertex handle (dev mode) */
.devBoundaryHandle span {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff5a3c;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  cursor: grab;
}

.devBoundaryHandle:active span {
  cursor: grabbing;
}

/* ---------- Map ---------- */
.mapWrap {
  position: relative;
  height: 100%;
  width: 100%;
}

#map {
  height: 100%;
  width: 100%;
  background: #e8ebe8;
}

#map .leaflet-container,
#map .leaflet-tile-pane {
  background: transparent;
}

/* ---- Frosted floating chrome shared by every map control ---- */
.mapTopRightControl {
  position: absolute;
  top: 12px;
  right: 12px;
  max-width: calc(100% - 24px);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.mapSelect {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100vw - 24px);
  min-width: 0;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 8px 7px 12px;
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: var(--shadow-1);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-quiet);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mapSelectLabel {
  flex: 0 0 auto;
  white-space: nowrap;
}

.areaField {
  position: relative;
  min-width: 0;
}

.areaTrigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: min(240px, 46vw);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 10px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.areaTrigger:hover {
  border-color: var(--accent);
}

.areaTrigger:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.areaTriggerText {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.areaChevron {
  flex: 0 0 auto;
  width: 12px;
  height: 8px;
  color: var(--ink-quiet);
  transition: transform 0.18s ease;
}

.areaTrigger[aria-expanded="true"] .areaChevron {
  transform: rotate(180deg);
}

.areaMenu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  margin: 0;
  padding: 5px;
  list-style: none;
  width: max-content;
  min-width: 100%;
  max-width: min(320px, calc(100vw - 24px));
  max-height: min(58vh, 360px);
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-2);
  z-index: 40;
}

.areaMenuItem {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
}

.areaMenuItem:hover,
.areaMenuItem:focus-visible {
  outline: none;
  background: var(--accent-wash);
  color: var(--accent-strong);
}

.areaMenuItem.isSelected {
  background: var(--accent-fill);
  color: var(--on-accent);
  font-weight: 600;
}

.srOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- Boundary-type mode toggle: a segmented control ---- */
.zoneModeToggle {
  display: flex;
  gap: 2px;
  margin: 0;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 3px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}

.zoneModeBtn {
  flex: 1 1 auto;
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  background: transparent;
  color: var(--ink-quiet);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s var(--ease-out), color 0.18s;
}

.zoneModeBtn:hover {
  color: var(--ink);
}

.zoneModeBtn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.zoneModeBtn.isActive {
  background: var(--accent-fill);
  color: var(--on-accent);
  box-shadow: 0 1px 3px rgba(20, 28, 26, 0.25);
}

.attendancePickers {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

/* A combo whose menu is open must stack above the combo beneath it, so the
   open Level list is never clipped behind the School selector (and vice versa). */
.mapSelect:has(.areaTrigger[aria-expanded="true"]) {
  z-index: 30;
}

/* ---- Attendance-zone info panel (left sidebar) ---- */
.attendanceInfo {
  margin: 0 0 14px;
  padding: 13px 14px;
  background: var(--accent-wash);
  border: 1px solid var(--accent-wash-line);
  border-radius: var(--radius);
}

.attendanceInfo .attInfoName {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.attendanceInfo .attInfoMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.attendanceInfo .attInfoTag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-strong);
  background: #fff;
  border: 1px solid var(--accent-wash-line);
  border-radius: 999px;
  padding: 3px 10px;
}

.attendanceInfo .attInfoNote {
  margin: 8px 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--ink-quiet);
}

.configTools {
  margin: 4px 0 14px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 0;
}

.configTools summary {
  color: var(--ink-quiet);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.configToolBody {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.configToolBody .btn {
  width: 100%;
}

.configHint {
  color: var(--ink-quiet);
  font-size: 0.78rem;
  line-height: 1.35;
}

.configDestinationList {
  display: grid;
  gap: 6px;
}

.configDestinationRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.76rem;
}

.configDestinationRow span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.configRemoveBtn {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--accent-strong);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 7px;
}

.configRemoveBtn:hover {
  background: var(--accent-wash);
}

/* ---------- Map legends (injected by app.js) ---------- */
.mapLegend {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.8rem;
  color: var(--ink);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}

.mapLegend strong {
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.mapLegend > div {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
}

.mapLegend .swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.mapLegend .swatch.line {
  height: 4px;
  border-radius: 999px;
  border: 0;
}

.mapLegend p {
  margin: 7px 0 0;
  max-width: 190px;
  color: var(--ink-quiet);
  font-size: 0.74rem;
  line-height: 1.3;
}

/* ---------- Leaflet chrome, restyled to match ---------- */
.leaflet-touch .leaflet-bar,
.leaflet-bar {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

.leaflet-bar a,
.leaflet-touch .leaflet-bar a {
  width: 32px;
  height: 32px;
  line-height: 32px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-text);
  font-weight: 500;
  transition: background-color 0.15s;
}

.leaflet-bar a:last-child {
  border-bottom: 0;
}

.leaflet-bar a:hover {
  background: #fff;
  color: var(--accent);
}

.leaflet-bar a.leaflet-disabled {
  color: #b6bebb;
  background: rgba(255, 255, 255, 0.8);
}

.leaflet-container {
  font-family: var(--font-text);
}

.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.75) !important;
  color: var(--ink-quiet);
  font-size: 10px;
  border-radius: 6px 0 0 0;
}

.leaflet-control-attribution a {
  color: var(--accent);
}

.leaflet-tooltip {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-1);
  color: var(--ink);
  font-size: 0.8rem;
  line-height: 1.4;
  padding: 6px 9px;
}

.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
  display: none;
}

/* ---------- Scrollbar ---------- */
.panelBody::-webkit-scrollbar,
.searchResults::-webkit-scrollbar,
.areaMenu::-webkit-scrollbar {
  width: 8px;
}

.panelBody::-webkit-scrollbar-thumb,
.searchResults::-webkit-scrollbar-thumb,
.areaMenu::-webkit-scrollbar-thumb {
  background: #cbd3cf;
  border-radius: 9px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.panelBody::-webkit-scrollbar-thumb:hover {
  background: var(--ink-quiet);
  background-clip: content-box;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  html,
  body,
  .app {
    height: 100dvh;
  }

  .app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(50dvh, 56dvh) 1fr;
  }

  .mapWrap {
    order: 1;
    min-height: 50dvh;
  }

  #map {
    min-height: 50dvh;
  }

  .panel {
    order: 2;
    border-right: 0;
    border-top: 1px solid var(--line);
    max-height: 50dvh;
  }

  .brandHome {
    padding: 10px 14px;
  }

  .brandMark {
    width: 34px;
    height: 34px;
  }

  .panelBody {
    padding: 13px;
  }

  .mapTopRightControl {
    top: 10px;
    right: 10px;
  }

  .mapSelect {
    padding: 6px 7px 6px 10px;
    gap: 7px;
    font-size: 0.72rem;
  }

  .areaTrigger {
    max-width: 52vw;
    font-size: 0.84rem;
    padding: 5px 8px;
  }

}

/* On the app the sidebar owns the bottom-left corner; park the review
   picker over the map, above the attribution strip. */
.accentPicker {
  left: auto;
  right: 14px;
  bottom: 30px;
}

@media (max-width: 900px) {
  .accentPicker {
    right: 10px;
    bottom: 10px;
  }
}

@media (max-width: 520px) {
  .brandText h1 {
    font-size: 1.1rem;
  }

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

  .mapLegend {
    font-size: 0.74rem;
    padding: 8px 9px;
    max-width: 58vw;
  }
}

/* ---------- Motion off ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
