/* ─── Reset & base ───────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:     #1a73e8;
  --dark:     #1b1b1b;
  --surface:  #ffffff;
  --border:   #e0e0e0;
  --text:     #333;
  --muted:    #777;
  --topbar-h: 52px;
  --search-h: 0px;   /* grows when search is open */
  --filter-h: 44px;
}

html, body, #app { height: 100%; width: 100%; overflow: hidden; }
body { font-family: system-ui, -apple-system, sans-serif; color: var(--text); }

/* Single GPU-batched drop-shadow for every parking marker. Cheaper than baking
   `filter: drop-shadow()` into each marker's inline SVG (which was being parsed
   and rendered 500+ times at z9 in dense areas). */
.lkw-pin { filter: drop-shadow(0 1px 1px rgba(0,0,0,0.35)); will-change: transform; }

/* ─── Top bar ────────────────────────────────────── */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--topbar-h);
  background: var(--dark); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px;
}
.logo { font-size: 1.05rem; font-weight: 700; letter-spacing: 0.5px; }

.topbar-actions { display: flex; gap: 6px; align-items: center; }

/* shared button style */
.topbar-actions button {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: background 0.15s; padding: 0;
}
.topbar-actions button svg { width: 18px; height: 18px; }
.topbar-actions button:hover { background: rgba(255,255,255,0.2); }

#btn-add  { background: var(--blue); border-color: transparent; }
#btn-add.active { background: #e53935; }

/* Night mode icon swap — pure CSS, no JS innerHTML */
#btn-night .icon-sun  { display: none; }
body.night #btn-night .icon-moon { display: none; }
body.night #btn-night .icon-sun  { display: block; }

/* Account button: glow when logged in */
#btn-account.logged-in { background: rgba(91,125,177,0.4); border-color: rgba(91,125,177,0.6); }

/* ─── Search bar ─────────────────────────────────── */
#search-bar {
  position: fixed; top: var(--topbar-h); left: 0; right: 0; z-index: 999;
  background: var(--dark);
  max-height: 0; overflow: hidden;
  transition: max-height 0.2s ease, padding 0.2s ease;
}
#search-bar.open {
  max-height: 320px;
  padding: 8px 12px 6px;
}
#search-input {
  width: 100%;
  background: rgba(255,255,255,0.95); border: 1px solid rgba(255,255,255,0.4);
  color: #000 !important; -webkit-text-fill-color: #000;
  border-radius: 8px; padding: 11px 40px 11px 14px;
  font-size: 16px;          /* 16px prevents iOS zoom-on-focus */
  font-weight: 500;
  outline: none;
  -webkit-appearance: none;  /* kill iOS default styling */
}
#search-input::placeholder { color: #888; -webkit-text-fill-color: #888; }
#search-input:focus { border-color: var(--blue); background: #fff; }

#search-clear {
  position: absolute; right: 22px; top: 18px;
  background: rgba(0,0,0,0.08); border: none; color: #555;
  width: 26px; height: 26px; border-radius: 50%;
  font-size: 0.95rem; font-weight: 700;
  cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
#search-input:placeholder-shown + #search-clear { display: none; }   /* hide when empty */

#search-results {
  position: fixed; z-index: 1100;
  background: var(--surface); border-radius: 10px;
  max-height: 60vh; overflow-y: auto;
  box-shadow: 0 6px 22px rgba(0,0,0,0.25);
}
#search-results.hidden { display: none; }
/* Close-X bar at top of results */
#search-results::before {
  content: "✕  close";
  display: block;
  text-align: right;
  padding: 8px 14px;
  font-size: 0.78rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: #fafafa;
  cursor: pointer;
  font-weight: 600;
}

.result-item {
  padding: 10px 14px; font-size: 0.85rem; cursor: pointer; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px; overflow: hidden;
}
.result-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-item:last-child { border-bottom: none; }
.result-item:hover { background: #f0f8ff; }
.result-empty { padding: 12px 14px; font-size: 0.85rem; color: var(--muted); text-align: center; }
.coord-result { color: var(--blue); font-weight: 600; }

/* ─── Map ────────────────────────────────────────── */
#map {
  position: fixed;
  top: var(--topbar-h); left: 0; right: 0; bottom: var(--filter-h);
}
/* nudge map down when search open — JS sets CSS var */
body.search-open #map { top: calc(var(--topbar-h) + var(--search-h)); }

/* ─── Filter bar ─────────────────────────────────── */
#filters {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
  height: var(--filter-h); background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; overflow-x: auto;
}
.filter-btn {
  flex-shrink: 0; background: #f0f0f0; border: none; border-radius: 20px;
  padding: 6px 12px; font-size: 0.82rem; cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: flex; align-items: center; gap: 5px;
}
.filter-btn.active { background: var(--blue); color: #fff; }

/* ─── Panels ─────────────────────────────────────── */
.panel {
  position: fixed; bottom: var(--filter-h); left: 0; right: 0; z-index: 900;
  background: var(--surface); border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  padding: 12px 16px 24px;
  transition: transform 0.25s ease;
  max-height: 70vh; overflow-y: auto;
}
.panel.hidden { transform: translateY(110%); }

.panel-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--border); margin: 0 auto 12px;
}

/* ─── Spot detail panel content ──────────────────── */
.panel-top-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  margin-bottom: 4px;
}
.panel-top-row h2 { font-size: 1.1rem; flex: 1; }
.panel-close-btn {
  flex-shrink: 0; background: #f0f0f0; border: none; border-radius: 50%;
  width: 28px; height: 28px; font-size: 0.85rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  transition: background 0.15s;
}
.panel-close-btn:hover { background: #e0e0e0; color: var(--text); }

/* Larger, always-visible close button — used on the spot panel so it's obvious to
   logged-out users (who don't see the fav button next to it). 38px tap target. */
.panel-close-big {
  width: 38px; height: 38px;
  font-size: 1.05rem; font-weight: 700;
  background: #d95050; color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.panel-close-big:hover { background: #b03d3d; color: #fff; }

/* ─── Suggest-facilities form ────────────────────── */
.suggest-btn {
  display: block; width: 100%;
  background: #e8f5e9; color: #2e7d32;
  border: 1px solid #c5e1c8;
  padding: 10px 14px; border-radius: 10px;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  margin-top: 4px;
}
.suggest-btn:hover { background: #d8edd9; }
.suggest-form {
  background: #f7f9f7; border: 1px solid #d8e4d8;
  border-radius: 10px; padding: 12px;
  margin-top: 8px;
}
.suggest-form.hidden { display: none; }
.suggest-hint { font-size: 0.82rem; color: var(--muted); margin-bottom: 8px; }
.suggest-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px;
  margin-bottom: 10px;
}
.suggest-check {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.85rem; cursor: pointer;
  padding: 4px 6px; border-radius: 6px;
}
.suggest-check:hover { background: rgba(0,0,0,0.04); }
.suggest-check input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }
.suggest-cap-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; margin-bottom: 8px;
}
.suggest-cap-row input { flex: 1; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.85rem; }
.suggest-form textarea {
  width: 100%; min-height: 50px;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.85rem; font-family: inherit; resize: vertical;
  margin-bottom: 8px;
}
.confirm-suggest-btn {
  width: 100%; background: #2e7d32; color: #fff;
  border: none; border-radius: 8px;
  padding: 9px 14px; font-size: 0.9rem; font-weight: 600;
  cursor: pointer;
}
.confirm-suggest-btn:hover { background: #1f5c23; }
.confirm-suggest-btn:disabled { background: #999; cursor: wait; }
.suggest-note { font-size: 0.72rem; color: var(--muted); text-align: center; margin-top: 6px; }

/* ─── Admin suggestion rows (inside the Account → Suggestions tab) ────── */
.suggest-label { font-size: 0.72rem; color: var(--muted); margin-right: 4px; }
.suggest-current-line, .suggest-row {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 4px; margin: 4px 0;
}
.fac-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: 10px;
  font-size: 0.72rem; line-height: 1.4;
  border: 1px solid transparent;
}
.fac-chip.current-yes  { background: #e6f4ea; color: #2e7d32; border-color: #c5e1c8; }
.fac-chip.suggested-yes{ background: #fff3cd; color: #8a6d3b; border-color: #ffe49a; }
.fac-chip-empty        { font-size: 0.72rem; color: var(--muted); font-style: italic; }
.suggest-cap-line   { font-size: 0.82rem; margin: 4px 0; }
.suggest-notes-line { font-size: 0.82rem; color: var(--text); font-style: italic;
                      background: #f4f4f4; padding: 4px 8px; border-radius: 6px;
                      margin: 4px 0; }
.admin-meta-line    { display: block; font-size: 0.7rem; color: var(--muted); margin-top: 4px; }
.admin-suggest-view, .admin-suggest-apply, .admin-suggest-dismiss {
  font-size: 0.78rem; padding: 5px 10px; border-radius: 6px; border: none;
  cursor: pointer; margin-left: 4px; white-space: nowrap;
}
.admin-suggest-view    { background: #e3f2fd; color: #1565c0; }
.admin-suggest-apply   { background: #2e7d32; color: #fff; }
.admin-suggest-dismiss { background: #f5f5f5; color: var(--muted); }
.admin-suggest-apply:hover   { background: #1f5c23; }
.admin-suggest-dismiss:hover { background: #e0e0e0; color: var(--text); }
.admin-suggest-view:hover    { background: #c5e0f5; }
.admin-suggest-apply:disabled,
.admin-suggest-dismiss:disabled { opacity: 0.6; cursor: wait; }

/* ─── Recovery code UI ────────────────────────────── */
.security-row {
  margin: 10px 0 14px;
  padding: 10px 12px;
  background: #fff8e1;
  border: 1px solid #ffe49a;
  border-radius: 8px;
}
.btn-recovery {
  display: block; width: 100%;
  background: #f9a825; color: #fff;
  border: none; border-radius: 8px;
  padding: 9px 14px; font-size: 0.9rem; font-weight: 600;
  cursor: pointer;
}
.btn-recovery:hover { background: #d88e1f; }
.btn-recovery:disabled { background: #999; cursor: wait; }

/* Change password */
.btn-change-pw {
  display: block; width: 100%;
  background: var(--blue); color: #fff;
  border: none; border-radius: 8px;
  padding: 9px 14px; font-size: 0.9rem; font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
}
.btn-change-pw:hover { background: #1557b0; }
.change-pw-form {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 12px;
}
.change-pw-form.hidden { display: none; }
.change-pw-form input {
  display: block; width: 100%;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
}
.cp-save-btn {
  width: 100%;
  background: #2e7d32; color: #fff;
  border: none; border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.88rem; font-weight: 600;
  cursor: pointer;
}
.cp-save-btn:hover { background: #1f5c23; }
.cp-save-btn:disabled { background: #999; cursor: wait; }
.recovery-display {
  margin-top: 10px; padding: 10px;
  background: #fff; border: 2px dashed #f9a825;
  border-radius: 8px;
  display: flex; align-items: center; gap: 8px;
}
.recovery-display.hidden { display: none; }
#recovery-code-value {
  flex: 1; font-family: 'Courier New', monospace;
  font-size: 0.95rem; font-weight: bold;
  color: #d35400; word-break: break-all; user-select: all;
}
.copy-recovery-btn {
  background: var(--blue); color: #fff;
  border: none; border-radius: 6px;
  padding: 6px 12px; font-size: 0.82rem; cursor: pointer;
}
.copy-recovery-btn:hover { background: #1557b0; }

/* ─── Security panel (audit log + login attempts) ─── */
.security-alert {
  background: #fff3cd; color: #856404; border: 1px solid #ffe49a;
  padding: 8px 12px; border-radius: 8px; margin-bottom: 10px;
  font-size: 0.85rem;
}
.security-ok {
  background: #e6f4ea; color: #2e7d32; border: 1px solid #c5e1c8;
  padding: 8px 12px; border-radius: 8px; margin-bottom: 10px;
  font-size: 0.85rem;
}
.sec-pill {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 0.75rem; margin: 0 4px 4px 0; font-family: monospace;
}
.sec-pill.bad { background: #fdecea; color: #d32f2f; border: 1px solid #f5c6cb; }
.sec-h {
  margin: 14px 0 6px; font-size: 0.9rem; color: var(--muted);
  border-top: 1px solid var(--border); padding-top: 10px;
}
.sec-table-wrap { overflow-x: auto; max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }
.sec-table {
  width: 100%; border-collapse: collapse; font-size: 0.78rem;
}
.sec-table th, .sec-table td {
  padding: 5px 8px; text-align: left; border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
}
.sec-table th {
  background: #fafafa; font-weight: 600; color: var(--muted);
  position: sticky; top: 0;
}
.sec-when { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.sec-ip   { font-family: monospace; color: var(--muted); }
.sec-action { background: #f0f0f0; padding: 1px 5px; border-radius: 3px; font-size: 0.72rem; }
.sec-detail { font-size: 0.7rem; color: var(--muted); }
.sec-fail { background: #fffafa; }
.sec-fail td:last-child { color: #d32f2f; font-weight: 600; }
.sec-ok   td:last-child { color: #2e7d32; }

.coords { font-size: 0.75rem; color: var(--muted); margin-bottom: 10px; }

/* Status dot (replaces emoji) */
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block;
}

/* Status badge */
.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid; border-radius: 12px;
  padding: 3px 10px; font-size: 0.8rem; font-weight: 600;
  margin-bottom: 12px;
}
.status-unknown { background: #f5f5f5; color: var(--muted); border-color: #ddd; }

/* Status buttons */
.status-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.status-btn {
  flex: 1; min-width: 80px;
  background: color-mix(in srgb, var(--sc) 10%, white);
  border: 1px solid color-mix(in srgb, var(--sc) 30%, white);
  color: var(--sc); border-radius: 8px;
  padding: 7px 6px; font-size: 0.82rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.status-btn:hover { background: color-mix(in srgb, var(--sc) 20%, white); }

.facilities { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.facility-tag {
  background: #f0f8ff; border: 1px solid #c0dcf0;
  border-radius: 12px; padding: 4px 10px; font-size: 0.78rem;
}
.facility-tag.missing { background: #f5f5f5; border-color: #ddd; color: var(--muted); }
.capacity-line { font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; }

.section-divider { border: none; border-top: 1px solid var(--border); margin: 14px 0 10px; }
.section-label { font-size: 0.82rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }

/* ─── Top rating badge (always visible) ─────────────── */
.rating-top {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px;
  flex-wrap: wrap;
}
.rating-top-stars { font-size: 1.1rem; color: #ddd; letter-spacing: 2px; }
.rating-top-text  { font-size: 0.82rem; color: var(--muted); flex: 1; }
.rating-top-write {
  background: var(--blue); color: #fff; border: none; border-radius: 20px;
  padding: 4px 12px; font-size: 0.78rem; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.rating-top-write:hover { background: #1558b0; }

/* ─── Reviews header ─────────────────────────────────── */
.reviews-header { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.avg-stars-lg   { font-size: 1.05rem; color: #f4a800; letter-spacing: 2px; }

/* ─── Reviews ────────────────────────────────────── */
.reviews-loading { font-size: 0.8rem; color: var(--muted); }
.no-reviews { font-size: 0.85rem; color: var(--muted); font-style: italic; }
.avg-rating { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.avg-stars { color: #f4a800; font-size: 1.1rem; letter-spacing: 1px; }
.avg-num { font-weight: 700; font-size: 0.95rem; }
.avg-count { font-size: 0.8rem; color: var(--muted); }
.review-item { display: flex; gap: 8px; margin-bottom: 5px; align-items: flex-start; }
.rv-stars { color: #f4a800; font-size: 0.9rem; flex-shrink: 0; }
.rv-comment { font-size: 0.85rem; }

/* ─── Star picker ────────────────────────────────── */
.rate-section { margin-top: 4px; }
.rate-section.hidden { display: none; }
.stars { display: flex; gap: 4px; font-size: 1.8rem; margin-bottom: 8px; cursor: pointer; }
.star { color: #ddd; transition: color 0.1s; line-height: 1; }
.star.active { color: #f4a800; }
.rate-section textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 0.9rem; font-family: inherit;
  resize: vertical; min-height: 54px; margin-bottom: 8px;
}
.submit-review-btn {
  background: var(--blue); color: #fff; border: none; border-radius: 8px;
  padding: 8px 18px; font-size: 0.9rem; cursor: pointer;
}

/* ─── Report ─────────────────────────────────────── */
.report-btn {
  background: none; border: none; color: var(--muted); font-size: 0.8rem;
  cursor: pointer; padding: 0; text-decoration: underline;
}
.report-form { margin-top: 10px; }
.report-form.hidden { display: none; }
.report-form select {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 0.9rem; background: #fff; margin-bottom: 8px;
}
.report-form textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 0.9rem; font-family: inherit;
  resize: vertical; min-height: 50px; margin-bottom: 8px;
}
.confirm-report-btn {
  background: #e53935; color: #fff; border: none; border-radius: 8px;
  padding: 8px 16px; font-size: 0.85rem; cursor: pointer;
}

/* ─── Add-spot panel ─────────────────────────────── */
.add-panel-title { font-size: 1.05rem; margin-bottom: 4px; }
.add-hint {
  position: fixed; top: calc(var(--topbar-h) + 12px); left: 50%; transform: translateX(-50%);
  z-index: 1001; background: #e53935; color: #fff;
  padding: 8px 20px; border-radius: 20px; font-size: 0.9rem; font-weight: 600;
  pointer-events: none; white-space: nowrap;
}
.add-hint.hidden { display: none; }

.form-row { margin-bottom: 12px; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.form-row input, .form-row textarea {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 0.95rem; font-family: inherit; width: 100%;
}
.form-row textarea { resize: vertical; min-height: 60px; }
.form-group { margin-bottom: 12px; }
.form-label { font-size: 0.82rem; font-weight: 600; color: var(--muted); margin-bottom: 8px; }

.fac-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; }
.fac-check {
  display: flex; align-items: center; gap: 5px;
  background: #f5f5f5; border-radius: 8px; padding: 7px 8px;
  font-size: 0.82rem; cursor: pointer; user-select: none;
}
.fac-check input { width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }
.fac-check:has(input:checked) { background: #e8f0fe; color: var(--blue); font-weight: 600; }

.form-actions { display: flex; gap: 10px; margin-top: 14px; }
.btn-primary {
  flex: 1; background: var(--blue); color: #fff; border: none;
  border-radius: 10px; padding: 12px; font-size: 1rem; font-weight: 600; cursor: pointer;
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary {
  background: #f0f0f0; color: var(--text); border: none;
  border-radius: 10px; padding: 12px 20px; font-size: 1rem; cursor: pointer;
}

/* ─── Zoom hint ──────────────────────────────────── */
.zoom-hint {
  position: fixed; top: calc(var(--topbar-h) + 12px); left: 50%; transform: translateX(-50%);
  z-index: 1000; background: rgba(0,0,0,0.65); color: #fff;
  padding: 6px 16px; border-radius: 20px; font-size: 0.85rem; pointer-events: none;
}
.zoom-hint.hidden { display: none; }

/* ─── Icon picker modal ──────────────────────────── */
.picker-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center;
}
.picker-modal {
  background: var(--surface); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 520px;
  padding: 16px 16px 32px;
  max-height: 80vh; overflow-y: auto;
}
.picker-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.picker-header h3 { font-size: 1rem; }
.picker-close {
  background: #f0f0f0; border: none; border-radius: 50%;
  width: 30px; height: 30px; font-size: 0.9rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
/* ─── Map layer picker grid ──────────────────────────── */
.layer-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 8px;
}
.layer-item {
  background: none; border: 2px solid var(--border); border-radius: 10px;
  overflow: hidden; cursor: pointer; text-align: left;
  transition: border-color 0.15s;
  padding: 0;
}
.layer-item:hover  { border-color: #aaa; }
.layer-item.selected { border-color: var(--blue); }
.layer-thumb {
  width: 100%; height: 90px; object-fit: cover; display: block;
  background: #eee;
}
.layer-meta { padding: 7px 9px; }
.layer-meta strong { display: block; font-size: 0.82rem; color: var(--text); }
.layer-meta span   { font-size: 0.7rem; color: var(--muted); }
.layer-item.selected .layer-meta strong { color: var(--blue); }

/* ─── Marker icon picker grid ────────────────────────── */
.picker-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px;
}
.picker-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: #f5f5f5; border: 2px solid transparent; border-radius: 12px;
  padding: 14px 8px; cursor: pointer; transition: border-color 0.15s, background 0.15s;
  font-size: 0.8rem; font-weight: 600; color: var(--muted);
}
.picker-item:hover { background: #e8f0fe; }
.picker-item.selected { border-color: var(--blue); background: #e8f0fe; color: var(--blue); }
.picker-icon-preview { display: flex; align-items: center; justify-content: center; min-height: 36px; }

.picker-note { font-size: 0.8rem; color: var(--muted); margin-bottom: 12px; text-align: center; }
.picker-status-legend { display: flex; flex-direction: column; gap: 6px; }
.legend-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.82rem; color: var(--text);
}

/* ─── Night mode body overrides ──────────────────── */
body.night { background: #121212; }
body.night .panel,
body.night #add-panel,
body.night #filters,
body.night #search-bar,
body.night .side-panel {
  background: #1e1e1e; color: #e0e0e0;
  border-color: #333;
}
body.night .filter-btn { background: #2a2a2a; color: #ccc; }
body.night .filter-btn.active { background: var(--blue); color: #fff; }
body.night .panel-close-btn,
body.night .panel-share-btn { background: #2a2a2a; color: #aaa; }
body.night .facility-tag { background: #1a2a3a; border-color: #2a4a6a; color: #9ac; }
body.night .facility-tag.missing { background: #2a2a2a; border-color: #333; color: #666; }
body.night .section-divider { border-color: #333; }
body.night .form-row input,
body.night .form-row textarea,
body.night .report-form select,
body.night .report-form textarea,
body.night .rate-section textarea { background: #2a2a2a; border-color: #444; color: #e0e0e0; }
body.night #search-input { color: #e0e0e0; }

/* ─── Route filter button ────────────────────────── */
.route-filter-btn { margin-left: auto; }
.route-filter-btn.active { background: #1a73e8; color: #fff; }

/* ─── Side panel (route) ─────────────────────────── */
.side-panel {
  position: fixed; top: var(--topbar-h); right: -360px; bottom: var(--filter-h);
  width: 340px; z-index: 800;
  background: var(--surface);
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  display: flex; flex-direction: column;
  transition: right 0.3s ease;
  overflow: hidden;
}
.side-panel.open { right: 0; }

.side-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.side-panel-header h2 { font-size: 1rem; }
.side-panel-header button {
  background: #f0f0f0; border: none; border-radius: 50%;
  width: 28px; height: 28px; cursor: pointer; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
}

.route-input-group { padding: 10px 16px 0; flex-shrink: 0; position: relative; }
.route-input-label { font-size: 0.75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 5px; }
.route-input-wrap { position: relative; }
.route-input-wrap input { padding-right: 36px; }

#route-use-location {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 1.1rem; padding: 2px;
}

.side-panel input[type="text"] {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font-size: 0.9rem; font-family: inherit; outline: none;
}
.side-panel input:focus { border-color: var(--blue); }

.route-results {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  margin-top: 4px; max-height: 180px; overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12); z-index: 10; position: relative;
}
.route-results.hidden { display: none; }

.route-btns { display: flex; gap: 8px; padding: 12px 16px 4px; flex-shrink: 0; }
.route-btns .btn-primary { flex: 1; padding: 10px; font-size: 0.95rem; }
.route-btns .btn-secondary { padding: 10px 16px; font-size: 0.95rem; }

.route-info { padding: 6px 16px 4px; font-size: 0.85rem; color: var(--muted); font-weight: 600; flex-shrink: 0; min-height: 24px; }

.route-spot-list { flex: 1; overflow-y: auto; padding: 8px 16px 16px; }
.route-no-spots { font-size: 0.85rem; color: var(--muted); text-align: center; padding: 20px 0; }

.route-spot-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.route-spot-item:last-child { border-bottom: none; }
.route-spot-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.route-spot-info { flex: 1; min-width: 0; }
.route-spot-name { font-size: 0.88rem; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-spot-meta { font-size: 0.75rem; color: var(--muted); }
.route-spot-view {
  flex-shrink: 0; background: var(--blue); color: #fff; border: none;
  border-radius: 6px; padding: 5px 10px; font-size: 0.8rem; cursor: pointer;
}

/* ─── Panel share button ─────────────────────────── */
.panel-top-btns { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.panel-share-btn {
  background: #f0f0f0; border: none; border-radius: 50%;
  width: 28px; height: 28px; font-size: 0.85rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.panel-share-btn:hover { background: #e0e0e0; }

/* ─── Download area panel ───────────────────────── */
.download-filter-btn { margin-left: 4px; }

.download-panel {
  position: fixed; bottom: calc(var(--filter-h) + 10px);
  left: 50%; transform: translateX(-50%);
  width: min(360px, calc(100vw - 24px));
  background: var(--surface); border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  padding: 14px 16px 16px; z-index: 1500;
}
.download-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.download-info { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.download-stat { display: flex; justify-content: space-between; font-size: 0.85rem; }
.ds-label { color: var(--muted); }
.ds-val   { font-weight: 600; }
.download-actions { display: flex; gap: 10px; }
.download-actions .btn-primary   { flex: 1; padding: 10px; }
.download-actions .btn-secondary { padding: 10px 18px; }

.dl-bar-track {
  height: 6px; background: #e0e0e0; border-radius: 3px; overflow: hidden; margin-bottom: 8px;
}
.dl-bar {
  height: 100%; background: var(--blue); border-radius: 3px;
  width: 0%; transition: width 0.3s ease;
}
.dl-status { font-size: 0.8rem; color: var(--muted); text-align: center; }

/* ─── GPS + Refresh Leaflet controls ────────────── */
.lkw-map-btns a {
  display: flex !important;
  align-items: center;
  justify-content: center;
  color: #333 !important;
  text-decoration: none;
}

/* ─── Live zoom level indicator ─────────────────── */
.zoom-level {
  position: fixed;
  bottom: calc(var(--filter-h) + 10px);
  left: 10px;
  z-index: 900;
  background: rgba(27,27,27,0.82);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  padding: 4px 9px;
  border-radius: 6px;
  pointer-events: none;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* ─── GPS location dot marker ───────────────────── */
.loc-dot {
  width: 18px; height: 18px;
  background: #1a73e8;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(26,115,232,0.5);
  position: relative;
}
.loc-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: rgba(26,115,232,0.2);
  animation: loc-pulse 2s ease-out infinite;
}
@keyframes loc-pulse {
  0%   { transform: scale(0.7); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ─── Leaflet overrides ──────────────────────────── */
.leaflet-div-icon { background: none !important; border: none !important; }

/* ─── Offline banner ────────────────────────────────── */
.offline-banner {
  position: fixed; top: var(--topbar-h); left: 0; right: 0; z-index: 1100;
  background: #e65100; color: #fff; text-align: center;
  padding: 6px 12px; font-size: 0.85rem; font-weight: 600;
}
.offline-banner.hidden { display: none; }

/* ─── Auth overlay ───────────────────────────────────── */
.auth-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.4);
  pointer-events: auto;
}
.auth-modal {
  background: var(--surface);
  border-radius: 14px;                    /* all corners now */
  width: 92%; max-width: 460px;
  padding: 0 0 24px;
  max-height: 88vh; overflow-y: auto;
  position: absolute;                     /* floats, draggable */
  box-shadow: 0 12px 40px rgba(0,0,0,0.22);
  user-select: none;                      /* no text select while dragging */
}
.auth-modal-header {
  cursor: move;                           /* shows grab cursor on header */
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  border-radius: 14px 14px 0 0;
  background: #fafafa;
}
/* Offset inner content now that header is separated */
.auth-modal > :not(.auth-modal-header):not(.auth-footer) {
  padding: 0 16px;
}
.auth-modal > .auth-tab-bar    { padding: 10px 16px 0; }
.auth-modal > .auth-tab-content { padding: 8px 16px 0; }
.auth-modal > .display-name-row { padding: 12px 16px; border-bottom: 1px solid var(--border); margin-bottom: 0; }
.auth-modal > .auth-subtitle   { padding: 10px 16px 0; }
.auth-modal > form              { padding: 0 16px; }
.auth-footer { padding: 14px 16px 0; margin-top: 6px; }
.auth-modal-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.auth-modal-header h3 { font-size: 1.05rem; }
.auth-close {
  background: #f0f0f0; border: none; border-radius: 50%;
  width: 30px; height: 30px; cursor: pointer; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
}
.auth-subtitle { font-size: 0.85rem; color: var(--muted); margin-bottom: 14px; }
.auth-tab-bar { display: flex; gap: 6px; margin-bottom: 16px; }
.auth-tab { flex: 1; background: #f0f0f0; border: none; border-radius: 20px; padding: 8px; font-size: 0.85rem; cursor: pointer; }
.auth-tab.active { background: var(--blue); color: #fff; }
.auth-tab-content.hidden { display: none; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-field input {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 11px 14px; font-size: 0.95rem; font-family: inherit; outline: none;
}
.auth-field input:focus { border-color: var(--blue); }
.auth-note { font-size: 0.78rem; color: var(--muted); }
.auth-error { color: #c62828; font-size: 0.82rem; }
.auth-loading, .auth-empty { color: var(--muted); font-size: 0.85rem; padding: 16px 0; text-align: center; line-height: 1.6; }
.auth-footer { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 14px; }
.btn-logout { width: 100%; background: #f5f5f5; border: none; border-radius: 8px; padding: 11px; color: #c62828; font-size: 0.95rem; cursor: pointer; font-weight: 600; }
.auth-spot-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); gap: 8px; }
.auth-spot-row:last-child { border-bottom: none; }
.auth-spot-row strong { font-size: 0.88rem; display: block; }
.auth-spot-coords { font-size: 0.75rem; color: var(--muted); }
.auth-view-btn { flex-shrink: 0; background: var(--blue); color: #fff; border-radius: 6px; padding: 5px 12px; font-size: 0.8rem; text-decoration: none; }
.auth-status-chip { font-size: 0.72rem; padding: 2px 7px; border-radius: 10px; margin-left: 6px; }
.auth-status-chip.approved { background: #e8f5e9; color: #2e7d32; }
.auth-status-chip.pending  { background: #fff3e0; color: #e65100; }

/* ─── Admin badge + panel styles ────────────────────── */
/* ─── User management panel ─────────────────────────── */
.admin-search-row { margin-bottom: 10px; }
.admin-user-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border);
}
.admin-user-row:last-child { border-bottom: none; }
.admin-user-info  { flex: 1; min-width: 0; }
.admin-user-name  { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 2px; }
.admin-user-name strong { font-size: 0.9rem; }
.admin-user-handle { font-size: 0.75rem; color: var(--muted); }
.admin-user-meta   { font-size: 0.72rem; color: var(--muted); }
.admin-user-actions { display: flex; flex-direction: column; gap: 5px; flex-shrink: 0; }

.user-badge {
  font-size: 0.65rem; padding: 1px 6px; border-radius: 8px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.user-badge.admin  { background: #e8f0fe; color: #1a73e8; }
.user-badge.banned { background: #fce8e6; color: #d95050; }

.ua-btn {
  font-size: 0.75rem; padding: 4px 8px; border: none; border-radius: 6px;
  cursor: pointer; white-space: nowrap; font-weight: 600;
  background: #f0f0f0; color: var(--text);
  transition: background 0.12s;
}
.ua-btn:hover       { background: #e0e0e0; }
.ua-ban             { background: #fce8e6; color: #d95050; }
.ua-ban:hover       { background: #f5c6c2; }
.ua-unban           { background: #e8f5e9; color: #5aaa60; }
.ua-unban:hover     { background: #c8e6c9; }
.ua-promote         { background: #e8f0fe; color: #1a73e8; }
.ua-promote:hover   { background: #c5d8f8; }
.ua-demote          { background: #fff3e0; color: #f08c30; }
.ua-demote:hover    { background: #ffe0b2; }
.ua-delete          { background: #fce8e6; color: #d95050; }
.ua-delete:hover    { background: #f5c6c2; }

/* ─── Display name editor ────────────────────────────── */
.display-name-row {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 14px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.display-name-input {
  flex: 1; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 0.9rem; font-family: inherit; outline: none;
}
.display-name-input:focus { border-color: var(--blue); }
.display-name-save-btn {
  flex-shrink: 0; background: var(--blue); color: #fff; border: none;
  border-radius: 8px; padding: 8px 14px; font-size: 0.85rem;
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.display-name-save-btn:hover { background: #1558b0; }

/* ─── Admin badge + panel styles ────────────────────── */
.admin-badge {
  background: #d95050; color: #fff; font-size: 0.65rem; font-weight: 700;
  padding: 1px 6px; border-radius: 8px; margin-left: 6px; vertical-align: middle;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.admin-section { margin-bottom: 16px; }
.admin-section-title {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--muted); margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.admin-count {
  background: #d95050; color: #fff; border-radius: 10px;
  font-size: 0.7rem; padding: 1px 7px; font-weight: 700;
}
.admin-item {
  background: #f9f9f9; border-radius: 8px; padding: 10px 12px;
  margin-bottom: 8px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}
.admin-item-info { font-size: 0.82rem; display: flex; flex-direction: column; gap: 2px; }
.admin-item-info strong { font-size: 0.9rem; }
.admin-item-info span { color: var(--muted); font-size: 0.75rem; }
.admin-notes { font-style: italic; color: var(--text) !important; }
.admin-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
/* ─── Admin map popup (approve/reject on pin) ────────── */
.admin-map-popup .leaflet-popup-content-wrapper {
  border-radius: 10px; padding: 0; overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.admin-map-popup .leaflet-popup-content { margin: 0; }
.amp-title  { font-size: 0.9rem; font-weight: 700; padding: 10px 14px 2px; }
.amp-coords { font-size: 0.72rem; color: #888; padding: 0 14px 10px; }
.amp-actions {
  display: flex; border-top: 1px solid #eee;
}
.amp-approve, .amp-reject {
  flex: 1; padding: 10px 8px; border: none; cursor: pointer;
  font-size: 0.85rem; font-weight: 700;
}
.amp-approve { background: #5aaa60; color: #fff; border-right: 1px solid #eee; }
.amp-approve:hover { background: #4a9a50; }
.amp-reject  { background: #d95050; color: #fff; }
.amp-reject:hover  { background: #c04040; }

.admin-view-map {
  background: #e8f0fe; color: #1a73e8; border: none; border-radius: 6px;
  padding: 4px 8px; font-size: 0.75rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 4px; white-space: nowrap;
}
.admin-view-map:hover { background: #c5d8f8; }
.admin-preview-pin { filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4)); }
.admin-approve { background: #5aaa60; color: #fff; border: none; border-radius: 6px; padding: 6px 10px; font-size: 0.78rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.admin-reject  { background: #d95050; color: #fff; border: none; border-radius: 6px; padding: 6px 10px; font-size: 0.78rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.admin-resolve { background: #5b7db1; color: #fff; border: none; border-radius: 6px; padding: 6px 10px; font-size: 0.78rem; font-weight: 600; cursor: pointer; white-space: nowrap; }

/* Admin inline buttons in spot panel */
.admin-panel-actions { display: flex; gap: 8px; margin-top: 4px; }
.admin-approve-inline { background: #5aaa60; color: #fff; border: none; border-radius: 8px; padding: 8px 16px; font-size: 0.88rem; font-weight: 700; cursor: pointer; flex: 1; }
.admin-reject-inline  { background: #d95050; color: #fff; border: none; border-radius: 8px; padding: 8px 16px; font-size: 0.88rem; font-weight: 700; cursor: pointer; flex: 1; }

/* Status age */
.status-age { font-size: 0.7rem; color: var(--muted); margin-left: 6px; font-weight: 400; }

/* ─── Drive buttons (Maps + Waze) ───────────────────── */
.drive-row {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.drive-btn {
  flex: 1;
  color: white; border: none; border-radius: 10px;
  padding: 12px 8px; font-size: 0.92rem; font-weight: 700;
  cursor: pointer; text-decoration: none;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: filter 0.15s, transform 0.05s;
}
.drive-btn:hover  { filter: brightness(0.92); }
.drive-btn:active { transform: translateY(1px); }
.drive-gmaps { background: #1a73e8; }   /* Google blue */
.drive-waze  { background: #33ccff; color: #003a5e; }   /* Waze cyan */
.drive-waze svg { color: #003a5e; }

/* ─── Navigation bar ─────────────────────────────────── */
.nav-bar {
  position: fixed; top: var(--topbar-h); left: 0; right: 0; z-index: 1200;
  background: #1a73e8; color: white;
  padding: 10px 14px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.3);
}
.nav-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nav-left  { flex: 1; min-width: 0; }
.nav-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.nav-instr { font-size: 0.9rem; font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-meta  { font-size: 0.78rem; opacity: 0.85; margin-top: 2px; display: flex; gap: 4px; }
.nav-sep   { opacity: 0.5; }

.nav-ext-btn {
  display: flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3);
  color: white; border-radius: 6px; padding: 5px 9px; font-size: 0.78rem;
  text-decoration: none; font-weight: 600; white-space: nowrap;
  transition: background 0.15s;
}
.nav-ext-btn:hover { background: rgba(255,255,255,0.3); }

.nav-stop-btn {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3);
  color: white; border-radius: 50%; width: 28px; height: 28px;
  font-size: 0.8rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.nav-stop-btn:hover { background: rgba(255,255,255,0.3); }

/* ─── Panel favourite button ─────────────────────────── */
.panel-fav-btn {
  background: #f0f0f0; border: none; border-radius: 50%;
  width: 28px; height: 28px; font-size: 0.85rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.panel-fav-btn:hover { background: #e0e0e0; }

/* ─── Toast ──────────────────────────────────────── */
.toast {
  position: fixed; bottom: calc(var(--filter-h) + 12px); left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(0,0,0,0.85); color: #fff;
  padding: 10px 20px; border-radius: 20px; font-size: 0.9rem;
  opacity: 0; transition: opacity 0.2s, transform 0.2s;
  z-index: 3000; pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
