:root {
  --bg: #0b1220;
  --panel: #0f1a30;
  --card: #0f1a30;
  --card2: #101f3a;
  --text: #eaf0ff;
  --muted: #a9b7d6;
  --line: rgba(255, 255, 255, .08);

  --brand: #4ea3ff;

  --open: #21c06b;
  --limited: #f6b326;
  --none: #ef4a4a;

  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  --radius: 18px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 20% 10%, rgba(78, 163, 255, .18), transparent 55%),
    radial-gradient(900px 500px at 80% 20%, rgba(33, 192, 107, .14), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 18px;
}

/* ── Topbar ─────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(11, 18, 32, .65);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  text-decoration: none;
  color: var(--text);
}
.brand__dot {
  flex-shrink: 0;
  display: inline-block;
}
.brand__text { font-size: 18px; }

.topnav { display: flex; gap: 14px; }
.topnav__link {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}
.topnav__link[aria-current="page"],
.topnav__link--active {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, .04);
}
.topnav__link:hover { color: var(--text); }

/* ── Hero ────────────────────────────────────────── */
.hero { padding: 26px 0 14px; }
.hero h1 {
  margin: 10px 0 8px;
  font-size: clamp(28px, 3.4vw, 42px);
  line-height: 1.05;
}
.hero p {
  margin: 0 0 18px;
  color: var(--muted);
  max-width: 720px;
}

/* ── Controls ────────────────────────────────────── */
.controls {
  display: grid;
  grid-template-columns: 1fr 220px 180px;
  gap: 12px;
  align-items: end;
}
@media (max-width: 900px) { .controls { grid-template-columns: 1fr; } }

.input { display: flex; flex-direction: column; gap: 6px; }
.input__label { font-size: 12px; color: var(--muted); }
.input__field {
  appearance: none;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  outline: none;
  font-size: 14px;
}
.input__field:focus {
  border-color: rgba(78, 163, 255, .55);
  box-shadow: 0 0 0 4px rgba(78, 163, 255, .14);
}
.input__field option { background: #0f1a30; }

/* ── Buttons ─────────────────────────────────────── */
.btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  display: inline-block;
  transition: border-color .15s, background .15s;
}
.btn--primary {
  border-color: rgba(78, 163, 255, .45);
  background: rgba(78, 163, 255, .15);
}
.btn:active { transform: translateY(1px); }
.btn:hover { border-color: rgba(78, 163, 255, .45); }

/* ── Two-column grid ─────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 16px;
  padding: 14px 0 26px;
}
@media (max-width: 980px) { .grid { grid-template-columns: 1fr; } }

/* ── Card ────────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .03));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card__header {
  padding: 16px 16px 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.card__header h2 { margin: 0; font-size: 18px; }
.card__footer { padding: 12px 16px 16px; }

/* ── Mapbox map ──────────────────────────────────── */
.map {
  height: 380px;
  width: 100%;
}

/* ── Pill filter bar ─────────────────────────────── */
.pillbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.pill {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  transition: color .15s, border-color .15s, background .15s;
}
.pill--active, .pill:hover {
  color: var(--text);
  border-color: rgba(78, 163, 255, .4);
  background: rgba(78, 163, 255, .12);
}

/* ── Alley list rows ─────────────────────────────── */
.list { padding: 6px 6px 10px; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.row + .row { margin-top: 6px; }
.row:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, .03);
}
.row.is-highlighted {
  border-color: rgba(78, 163, 255, .45);
  background: rgba(78, 163, 255, .07);
}

.row__left { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }

.badge {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-top: 5px;
  flex-shrink: 0;
}
.badge--open    { background: var(--open);    box-shadow: 0 0 0 4px rgba(33,192,107,.15); }
.badge--limited { background: var(--limited); box-shadow: 0 0 0 4px rgba(246,179,38,.15);  }
.badge--none    { background: var(--none);    box-shadow: 0 0 0 4px rgba(239,74,74,.15);   }

.row__text { min-width: 0; }
.row__name { font-weight: 700; line-height: 1.2; }
.row__meta { margin-top: 3px; font-size: 13px; color: var(--muted); }

.status-label--open    { color: var(--open); }
.status-label--limited { color: var(--limited); }
.status-label--none    { color: var(--none); }

.row__actions { display: flex; gap: 8px; flex-shrink: 0; }
.linkBtn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
  transition: border-color .15s;
}
.linkBtn:hover { border-color: rgba(78, 163, 255, .4); }

/* ── Empty state ─────────────────────────────────── */
.emptyState {
  padding: 32px 16px;
  text-align: center;
}
.emptyState__icon { font-size: 40px; margin-bottom: 12px; }
.emptyState__text { font-size: 16px; font-weight: 600; margin-bottom: 6px; }

/* ── Helpers ─────────────────────────────────────── */
.muted  { color: var(--muted); font-size: 13px; }
.mono   { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }

/* ── Footer ──────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--line);
  padding: 18px 0;
  background: rgba(11, 18, 32, .6);
}
.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer__inner a { text-decoration: none; }
.footer__inner a:hover { color: var(--text); }

/* ── Staff page ──────────────────────────────────── */
.staffShell {
  padding: 18px 0 28px;
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 16px;
}
@media (max-width: 980px) { .staffShell { grid-template-columns: 1fr; } }

.staffCard  { padding: 18px; }
.staffHelp  { padding: 18px; }

.staffCard__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.staffTitle { margin: 0 0 6px; font-size: 28px; }

.chip-select {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  min-width: 160px;
}

.alleyInfo { margin-bottom: 16px; }
.alleyInfo .muted { line-height: 1.6; }

.statusButtons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 10px 0 14px;
}
.statusBtn {
  width: 100%;
  border: 3px solid transparent;
  border-radius: 16px;
  padding: 16px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  color: #07101f;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform .1s, box-shadow .15s;
}
.statusBtn:hover  { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.statusBtn:active { transform: translateY(1px); }

.statusBtn__icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, .45);
  font-weight: 900;
  flex-shrink: 0;
}
.statusBtn--open    { background: linear-gradient(180deg, #2de07f, #18b862); }
.statusBtn--limited { background: linear-gradient(180deg, #ffd36a, #f6b326); }
.statusBtn--none    { background: linear-gradient(180deg, #ff6a6a, #ef4a4a); }

.statusBtn.is-active {
  border-color: rgba(78, 163, 255, .6);
  box-shadow: 0 0 0 4px rgba(78, 163, 255, .18);
}

.staffMeta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px;
  border-top: 1px solid var(--line);
}
.currentStatus { font-weight: 800; }

.staffActions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.toast {
  min-height: 18px;
  font-size: 13px;
  color: var(--open);
  transition: opacity .3s;
}

.bullets {
  margin: 10px 0 12px 18px;
  color: var(--muted);
  line-height: 1.8;
}
.bullets li { margin-bottom: 4px; }

/* ── Mapbox popup overrides ──────────────────────── */
.mapboxgl-popup-content {
  background: #0f1a30 !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 14px !important;
  color: #eaf0ff !important;
  padding: 14px 16px !important;
  box-shadow: 0 12px 40px rgba(0,0,0,.4) !important;
  min-width: 200px;
}
.mapboxgl-popup-tip { display: none !important; }
.mapboxgl-popup-close-button {
  color: #a9b7d6 !important;
  font-size: 18px !important;
  right: 8px !important;
  top: 6px !important;
}
.popup__name  { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.popup__meta  { font-size: 12px; color: #a9b7d6; margin-bottom: 8px; }
.popup__status { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.popup__dir {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 8px;
  background: rgba(78,163,255,.18);
  border: 1px solid rgba(78,163,255,.4);
  color: #eaf0ff;
  text-decoration: none;
  font-size: 12px;
}
.popup__dir:hover { background: rgba(78,163,255,.28); }

/* ── Leaflet popup overrides ─────────────────────────────────────────────────*/
.leaflet-popup-content-wrapper {
  background: #0f1a30 !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 14px !important;
  color: #eaf0ff !important;
  box-shadow: 0 12px 40px rgba(0,0,0,.4) !important;
}
.leaflet-popup-tip         { background: #0f1a30 !important; }
.leaflet-popup-close-button { color: #a9b7d6 !important; font-size: 18px !important; }
.leaflet-bar a             { background: #0f1a30 !important; color: #eaf0ff !important; border-color: rgba(255,255,255,.12) !important; }
.leaflet-bar a:hover       { background: #1e2d4a !important; }

.popup__name   { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.popup__meta   { font-size: 12px; color: #a9b7d6; margin-bottom: 6px; }
.popup__status { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.popup__dir {
  display: inline-block; padding: 7px 12px; border-radius: 8px;
  background: rgba(78,163,255,.18); border: 1px solid rgba(78,163,255,.4);
  color: #eaf0ff; text-decoration: none; font-size: 12px;
}
.popup__dir:hover { background: rgba(78,163,255,.28); }

/* ── Locating message ─────────────────────────────────────────────────────── */
.locating-msg {
  font-size: 13px; color: var(--muted);
  display: flex; align-items: center; padding-top: 22px;
}

/* ── Freshness indicator ─────────────────────────────────────────────────────*/
.freshness--fresh { color: var(--open);    font-weight: 600; }
.freshness--ok    { color: var(--limited); font-weight: 600; }
.freshness--stale { color: var(--none);    font-weight: 600; }

/* ── Until / closing soon labels ─────────────────────────────────────────────*/
.open-until    { color: var(--muted); font-size: 12px; }
.closing-soon  { color: var(--limited); font-weight: 700; font-size: 12px; }

/* ── Time picker on staff page ───────────────────────────────────────────────*/
.untilPicker {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 12px 0;
}
.untilPicker__label {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
}
.untilPicker__presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.timePreset {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
}
.timePreset:hover, .timePreset.is-active {
  background: rgba(78,163,255,.15);
  border-color: rgba(78,163,255,.4);
  color: var(--text);
}
.untilPicker__or {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.untilPicker__input {
  max-width: 160px;
  color-scheme: dark;
}

.untilPicker__actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}

/* ── Auth pages ──────────────────────────────────────────────────────────────*/
.authShell {
  display: flex;
  justify-content: center;
  padding: 48px 0;
}
.authCard {
  width: 100%;
  max-width: 420px;
  padding: 32px;
}
.authTitle {
  margin: 0 0 8px;
  font-size: 24px;
}
.authForm {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}
.authSubmit {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
}
.authError {
  background: rgba(239,74,74,.12);
  border: 1px solid rgba(239,74,74,.3);
  color: var(--none);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-top: 12px;
}
.authSuccess {
  background: rgba(33,192,107,.12);
  border: 1px solid rgba(33,192,107,.3);
  color: var(--open);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-top: 12px;
}
.authLinks {
  margin-top: 16px;
  text-align: center;
  font-size: 13px;
}
.authLinks a { color: var(--brand); text-decoration: none; }
.authLinks a:hover { text-decoration: underline; }

/* ── Admin page ──────────────────────────────────────────────────────────────*/
.adminGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 600px) { .adminGrid { grid-template-columns: 1fr; } }
.adminTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.adminTable th {
  text-align: left;
  padding: 8px 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.adminTable td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.adminTable tr:last-child td { border-bottom: none; }

/* ── Location permission prompt ──────────────────────────────────────────────*/
.locationPrompt {
  margin: 0 0 16px;
}
.locationPrompt__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(78, 163, 255, .08);
  border: 1px solid rgba(78, 163, 255, .25);
  border-radius: 14px;
  padding: 14px 16px;
}
.locationPrompt__icon {
  font-size: 24px;
  flex-shrink: 0;
}
.locationPrompt__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}
.locationPrompt__text strong {
  font-size: 14px;
  color: var(--text);
}
.locationPrompt__text span {
  color: var(--muted);
}
.locationPrompt__btn {
  flex-shrink: 0;
  padding: 8px 16px;
  font-size: 13px;
  white-space: nowrap;
}
.locationPrompt__dismiss {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--muted);
  background: transparent;
  border: none;
}
@media (max-width: 500px) {
  .locationPrompt__inner { flex-wrap: wrap; }
  .locationPrompt__btn { width: 100%; text-align: center; }
}

.untilPicker__tz {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 6px;
}
