/* Shiftmap — two-column shell (list + map on desktop) with mobile toggle. */

:root {
  /* Abound Health brand palette */
  --brand-dark-purple: #1a1348;
  --brand-green:       #5abe8d;
  --brand-orange:      #dc755d;
  --brand-light-blue:  #b1dffc;
  --brand-light-purple: #a36dc2;

  /* Neutral chrome */
  --ink: #1c1e21;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #ffffff;
  --warn: #b45309;
  --warn-bg: #fef3c7;

  /* Semantic assignments — change these to re-theme, not usages downstream */
  --accent: var(--brand-green);
  --accent-hover: #4ba879;
  --filter-bg: var(--brand-orange);
  --filter-bg-hover: #c86449;
  --filter-text: #ffffff;
  --badge-bg: var(--brand-dark-purple);
  --badge-text: #ffffff;
  --chip-selected-bg: var(--brand-light-purple);
  --chip-selected-text: #ffffff;
  --link-color: var(--brand-dark-purple);
  --title-color: var(--brand-dark-purple);
  --focus-ring: var(--brand-dark-purple);
  --selected-bg: #f3ebfa;   /* light purple tint for selected list row */
  --list-width: 380px;
  --mobile-breakpoint: 768px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

body {
  display: flex;
  flex-direction: column;
}

/* --- Header ------------------------------------------------------------ */

header {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.brand-logo {
  height: 36px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  display: block;
}

header h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--title-color);
  letter-spacing: -0.01em;
}

.subhead {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Header subhead is redundant with the list panel's "N of M shifts" counter.
   Kept in the DOM so the JS that writes it doesn't need branching. */
#subhead { display: none; }

/* Mobile info button — desktop-hidden, opens the "how it works" sheet on phones. */
.info-btn {
  display: none;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--brand-dark-purple);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.info-btn:hover { background: #f6f4fb; }
.info-btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* --- Main shell: 2-column desktop (list + map) ------------------------- */

main {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  position: relative;
}

.list-panel {
  flex: 0 0 var(--list-width);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.list-header {
  padding: 0.9rem 1rem 0.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 2;
}
.list-count {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}
.list-intro {
  margin: 0.25rem 0 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.list-how {
  margin: 0.25rem 0 0;
}
.list-how summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--link-color);
  font-weight: 600;
  padding: 0.15rem 0;
}
.list-how summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 3px; }
.list-how ul {
  margin: 0.4rem 0 0.25rem 0;
  padding-left: 1.15rem;
  font-size: 0.82rem;
  color: var(--ink);
  line-height: 1.4;
}
.list-how li { margin: 0.15rem 0; }
.list-how strong { color: var(--brand-dark-purple); }

.shift-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.shift-list li { margin: 0; }

/* Sortable column headers — matches the 3-column row grid, nested inside the
   sticky .list-header so they stay pinned together while the list scrolls. */
.list-sort-header {
  display: grid;
  grid-template-columns: 72px 1fr 54px;
  gap: 0.6rem;
  align-items: center;
  padding: 0.4rem 0 0.1rem;
  margin-top: 0.4rem;
  border-top: 1px solid var(--line);
}
.list-sort-col {
  background: none;
  border: 0;
  padding: 0.1rem 0.1rem;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}
.list-sort-col:hover { color: var(--brand-dark-purple); }
.list-sort-col.active { color: var(--brand-dark-purple); }
.list-sort-col:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 2px; }

.list-item {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bg);
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  transition: background 0.1s ease-out;
}
.list-item:hover,
.list-item:focus-visible {
  background: #f8fafc;
  outline: none;
}
.list-item.selected {
  background: var(--selected-bg);
  border-left: 3px solid var(--brand-light-purple);
  padding-left: calc(1rem - 3px);
}

/* 3-column row — identical grid to the sort header so columns align. */
.list-item-row {
  display: grid;
  grid-template-columns: 72px 1fr 54px;
  gap: 0.6rem;
  align-items: baseline;
}
.list-col { min-width: 0; }
.list-col-code {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--brand-dark-purple);
  font-variant-numeric: tabular-nums;
}
.list-col-city {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-col-hours {
  text-align: right;
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.list-item-meta {
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 0.2rem;
  overflow-wrap: anywhere;
}

.list-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.list-empty p { margin: 0 0 0.75rem; }

/* --- Map wrapper + on-map overlays ------------------------------------ */

.map-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
  overflow: hidden;
}
#map {
  position: absolute;
  inset: 0;
}

.map-overlay-tl {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 400;
}

.map-caption {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 400;
  margin: 0;
  padding: 0.3rem 0.6rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 0.72rem;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  max-width: 60%;
  pointer-events: none;
}

/* Location search — top-center of the map, between Filters (TL) and Zoom (TR). */
.map-search {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.5rem 0.35rem 0.75rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
  width: min(360px, calc(100% - 240px));
  min-width: 220px;
}
.map-search-icon { color: var(--muted); flex-shrink: 0; }
.map-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  padding: 0.2rem 0;
}
.map-search input::-webkit-search-cancel-button { display: none; }   /* we draw our own × */
.map-search input:focus { outline: none; }
.map-search:focus-within {
  border-color: var(--brand-dark-purple);
  box-shadow: 0 2px 10px rgba(26, 19, 72, 0.18);
}
.map-search-clear {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  padding: 0 0.3rem;
  cursor: pointer;
  border-radius: 999px;
}
.map-search-clear:hover { color: var(--ink); background: #f1f5f9; }

.map-search-error {
  position: absolute;
  top: 54px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  margin: 0;
  padding: 0.35rem 0.7rem;
  background: #fee2e2;
  color: #991b1b;
  font-size: 0.78rem;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  max-width: calc(100% - 32px);
  text-align: center;
}
.map-search-error[hidden] { display: none; }

/* Azure Maps ZoomControl sits top-right by default — nothing to override,
   but reserve a comment so future edits know it's expected. */

/* --- Map pin (HtmlMarker inline SVG) ---------------------------------- */

.brand-pin {
  cursor: pointer;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
  transform-origin: 50% 100%;
  transition: transform 120ms ease-out, filter 120ms ease-out;
  line-height: 0;
}
.brand-pin:hover,
.brand-pin.pin-highlight {
  transform: scale(1.18);
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5));
}
.brand-pin.pin-selected {
  transform: scale(1.25);
  filter: drop-shadow(0 3px 6px rgba(26, 19, 72, 0.6));
}

/* --- Filters button + panel ------------------------------------------- */

.btn-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--filter-bg);
  border: none;
  color: var(--filter-text);
  padding: 0.55rem 1rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(220, 117, 93, 0.35);
  transition: background 0.12s, box-shadow 0.12s, transform 0.05s;
}
.btn-filter:hover { background: var(--filter-bg-hover); box-shadow: 0 3px 10px rgba(220, 117, 93, 0.45); }
.btn-filter:active { transform: translateY(1px); }
.btn-filter:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}
.filter-badge[hidden] { display: none; }

/* Desktop: anchored under the Filters button (top-left of the map wrapper) */
.filter-panel {
  position: absolute;
  top: 60px;
  left: 12px;
  z-index: 500;
  width: 320px;
  max-width: calc(100% - 24px);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.18);
  padding: 0.75rem 1rem 0.75rem;
}
.filter-panel[hidden] { display: none; }

.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
.filter-panel-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
}

.icon-close {
  background: none;
  border: 0;
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-close:hover { background: #f1f5f9; color: var(--ink); }
.icon-close:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.filter-group {
  margin: 0 0 0.9rem;
  border: 0;
  padding: 0;
}
.filter-group > label,
.filter-group > legend {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 0.35rem;
  padding: 0;
}

.filter-panel select {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--ink);
}
.filter-panel select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.day-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.day-chip {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.day-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.day-chip span {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--bg);
  user-select: none;
}
.day-chip input:checked + span {
  background: var(--chip-selected-bg);
  border-color: var(--chip-selected-bg);
  color: var(--chip-selected-text);
}
.day-chip input:focus-visible + span {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.filter-help {
  margin: 0.3rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}
.filter-help em {
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
}

.check-line {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
}
.check-line input { margin: 0; }

.filter-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.4rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--link-color);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.link-btn:hover { filter: brightness(0.9); }
.link-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Mobile view toggle (hidden on desktop) --------------------------- */

.view-toggle {
  display: none;
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 700;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  background: var(--brand-dark-purple);
  color: white;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.view-toggle:focus-visible { outline: 2px solid var(--brand-orange); outline-offset: 2px; }

/* --- Bottom sheet (mobile info + mobile filter panel) ----------------- */

.bottom-sheet {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.bottom-sheet[hidden] { display: none; }
.bottom-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
}
.bottom-sheet-panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: var(--bg);
  border-radius: 12px 12px 0 0;
  padding: 1rem 1.25rem 1.25rem;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.15);
}
.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.bottom-sheet-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--brand-dark-purple);
}
.bottom-sheet-panel ul {
  margin: 0.5rem 0;
  padding-left: 1.15rem;
  font-size: 0.9rem;
  line-height: 1.5;
}
.bottom-sheet-panel strong { color: var(--brand-dark-purple); }

/* --- Status banner (still used for stale-data warning) ---------------- */

.status {
  margin: 0.5rem 1.25rem 0;
  padding: 0.55rem 0.85rem;
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 6px;
  font-size: 0.85rem;
}

/* --- Footer ----------------------------------------------------------- */

footer {
  padding: 0.5rem 1.25rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  flex-shrink: 0;
}

/* --- Popup (Azure Maps atlas.Popup wraps our .popup) ------------------ */
/*
 * Azure Maps injects our content into .atlas-popup-content-container and
 * ships its own padding, background, and shadow. We reset those and own
 * the card entirely in .popup, so the shadow is symmetric and long service
 * names wrap inside a card with a proper max-width.
 */

.atlas-popup .atlas-popup-content-container,
.atlas-popup-content-container {
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  overflow: visible !important;
  /* Cap the atlas-owned wrapper so .popup inside it has a definite
     containing block — otherwise grid `1fr` columns in .popup dl have
     nothing to resolve against and long schedule strings bleed out. */
  max-width: min(340px, calc(100vw - 32px)) !important;
}
/* Azure Maps also draws a triangular tip element; give it the same fill so
   the whole balloon reads as one piece. Selectors deliberately broad — the
   V3 build has been observed to name this either .atlas-popup-arrow or
   .atlas-popup-tip depending on release; targeting both is safe. */
.atlas-popup .atlas-popup-arrow,
.atlas-popup .atlas-popup-tip {
  background: var(--bg) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}
/* Bump the close button hit area (SDK draws it small). */
.atlas-popup .atlas-popup-close-button {
  min-width: 32px;
  min-height: 32px;
  padding: 4px 8px;
}

.popup {
  background: var(--bg);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 6px 16px rgba(0, 0, 0, 0.12);
  padding: 0.85rem 1rem;
  /* Fixed width (not max-width) so inner dl's `minmax(0, 1fr)` column has
     a definite width to wrap the schedule strings against. */
  width: min(340px, calc(100vw - 32px));
  box-sizing: border-box;
}

.popup h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  padding-right: 1.75rem;   /* leave room for atlas's built-in × */
  color: var(--brand-dark-purple);
  overflow-wrap: anywhere;
}

.popup .location {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.popup dl {
  margin: 0.4rem 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);   /* minmax(0,1fr) prevents overflow */
  gap: 0.2rem 0.75rem;
  font-size: 0.85rem;
  align-items: baseline;
}

.popup dt {
  color: var(--muted);
  font-weight: 500;
  min-width: 0;
}

.popup dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Schedule as a plain list — each day on its own line, text wraps freely.
   Not a grid, because the long concatenated time strings must wrap inside
   the popup's fixed width without any column constraint fighting us. */
.popup ul.schedule {
  list-style: none;
  margin: 0.15rem 0 0;
  padding: 0;
  font-size: 0.85rem;
  display: block;
  width: 100%;
  max-width: 100%;
}
.popup ul.schedule li {
  margin: 0 0 0.2rem;
  padding: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  line-height: 1.35;
}
.popup ul.schedule li strong {
  color: var(--muted);
  font-weight: 500;
  margin-right: 0.4rem;
}

.popup .cta {
  margin-top: 0.75rem;
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.popup .cta:hover { filter: brightness(1.05); }
.popup .cta:disabled { opacity: 0.6; cursor: not-allowed; }

/* --- Modal (shift request) -------------------------------------------- */

.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.modal-panel {
  position: relative;
  background: var(--bg);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  padding: 1.5rem 1.5rem 1.25rem;
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}
.modal-close:hover { color: var(--ink); }

.modal-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--brand-dark-purple);
}
.modal-panel .subhead { margin-bottom: 1rem; }

/* Confirm view — the gate screen that opens before the request form. */
#request-confirm-view[hidden] { display: none; }
.confirm-schedule-wrap {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  margin: 0 0 1rem;
}
.confirm-schedule-label {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.confirm-schedule {
  margin: 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.25rem 0.75rem;
  font-size: 0.9rem;
  align-items: baseline;
}
.confirm-schedule dt {
  font-weight: 600;
  color: var(--brand-dark-purple);
}
.confirm-schedule dd {
  margin: 0;
  min-width: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.confirm-statement {
  margin: 0 0 1rem;
  padding: 0.65rem 0.8rem;
  background: var(--brand-light-blue);
  border-left: 3px solid var(--brand-dark-purple);
  border-radius: 0 6px 6px 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--ink);
}

#request-form label {
  display: block;
  margin-bottom: 0.85rem;
}
#request-form label > span {
  display: block;
  font-size: 0.85rem;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 0.25rem;
}
#request-form label em {
  color: var(--muted);
  font-style: normal;
  font-weight: 400;
  font-size: 0.8rem;
}
#request-form input[type="text"],
#request-form input[type="email"],
#request-form input[type="tel"],
#request-form textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--ink);
}
#request-form input:focus,
#request-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
#request-form textarea { resize: vertical; min-height: 4.5rem; }

.radio-group {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.65rem 0.75rem 0.5rem;
  margin: 0 0 0.85rem;
}
.radio-group legend { font-size: 0.85rem; font-weight: 500; padding: 0 0.4rem; }
.radio-group .inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 1rem 0.25rem 0;
  font-size: 0.9rem;
  cursor: pointer;
}
.radio-group input[type="radio"] { margin: 0; }

.form-error {
  background: #fee2e2;
  color: #991b1b;
  padding: 0.55rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
  margin: 0.5rem 0 0.75rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn-primary,
.btn-secondary {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: none;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-secondary:hover { background: #f8fafc; }

#request-success-view p { margin: 0.5rem 0; line-height: 1.4; }
#request-receipt {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: #f1f5f9;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

/* --- Mobile (< 768px) ------------------------------------------------- */

@media (max-width: 767.98px) {
  /* Header: shrink brand, reveal info button */
  .brand-logo { height: 28px; max-width: 100px; }
  header h1 { font-size: 1rem; }
  .info-btn { display: inline-flex; }

  /* One view at a time — list OR map, driven by data-view on <main> */
  main[data-view="map"] .list-panel { display: none; }
  main[data-view="list"] .map-wrap  { display: none; }

  .list-panel { flex-basis: 100%; border-right: none; }

  .view-toggle { display: inline-block; }

  /* Filter panel becomes a bottom sheet on mobile */
  .filter-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 12px 12px 0 0;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.2);
    z-index: 950;
  }

  /* Popup takes full-width breathing room */
  .popup {
    width: calc(100vw - 32px);
  }
  .atlas-popup .atlas-popup-content-container,
  .atlas-popup-content-container {
    max-width: calc(100vw - 32px) !important;
  }

  /* Search bar drops below the Filters button on narrow phones so it doesn't
     collide with Filters (TL) or Zoom (TR). */
  .map-search {
    top: 66px;              /* clears the Filters button height + padding */
    width: calc(100% - 24px);
    max-width: none;
  }
  .map-search-error {
    top: 108px;             /* keeps below the moved search bar */
  }
}

/* --- State picker modal + header state indicator ----------------------- */

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.state-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.25rem 0.6rem;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.state-indicator strong {
  color: var(--brand-dark-purple);
  font-weight: 600;
}
.change-state-link {
  color: var(--brand-dark-purple);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.state-indicator[hidden], .change-state-link[hidden] { display: none; }
.change-state-link:hover { text-decoration-thickness: 2px; }
.change-state-link:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 2px; }

/* The state picker sits above every other UI (map, filters, header) until
   a state is picked. z-index must beat the shift-request modal (which uses
   its own stacking) so a stray-open path can't trap the user. */
.state-picker {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.state-picker[hidden] { display: none; }
.state-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 19, 72, 0.72);  /* brand-dark-purple at ~72% */
  backdrop-filter: blur(2px);
}
.state-picker-panel {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 2rem 2.25rem 2.25rem;
  width: min(520px, calc(100% - 2rem));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  text-align: center;
}
.state-picker-panel h2 {
  margin: 0 0 0.4rem;
  color: var(--brand-dark-purple);
  font-size: 1.6rem;
}
.state-picker-sub {
  margin: 0 0 1.4rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.state-picker-video {
  margin: 1.1rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}
.state-picker-video a {
  color: var(--brand-dark-purple);
  font-weight: 600;
}
.state-picker-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.state-btn {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  border: 2px solid var(--brand-dark-purple);
  background: #fff;
  color: var(--brand-dark-purple);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, transform 80ms ease;
}
.state-btn:hover {
  background: var(--brand-dark-purple);
  color: #fff;
}
.state-btn:focus-visible {
  outline: 2px solid var(--brand-light-purple);
  outline-offset: 3px;
}
.state-btn:active { transform: scale(0.98); }

@media (max-width: 480px) {
  .state-picker-panel {
    padding: 1.5rem 1.25rem 1.75rem;
  }
  .state-picker-panel h2 { font-size: 1.35rem; }
  .state-indicator {
    font-size: 0.78rem;
    padding: 0.2rem 0.5rem;
  }
}

/* DSP map: footnote under popup details (replaces shiftmap's CTA button). */
.popup .popup-note {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #555;
}
