/* ── Reset & base ── */ /* v2 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-x: hidden; }

/* ── Leaflet protection — prevent global CSS from animating map layers ──────
 * SVG <path> elements inside Leaflet panes must NEVER get will-change:transform
 * (that promotes each path to its own GPU layer and breaks pan sync).
 * Only block transition/animation — let Leaflet handle all transforms itself.
 * ───────────────────────────────────────────────────────────────────────── */
.leaflet-pane,
.leaflet-map-pane,
.leaflet-tile-pane,
.leaflet-overlay-pane,
.leaflet-shadow-pane,
.leaflet-marker-pane,
.leaflet-pane > svg,
.leaflet-pane > svg path,
.leaflet-pane > canvas {
  transition: none !important;
  animation: none !important;
}

body {
  font-family: var(--font-sans);
  background: #f0f4ec;
  color: #1a2e12;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
  padding-top: env(safe-area-inset-top);
  height: calc(56px + env(safe-area-inset-top));
  background: var(--forest-700);
  color: white;
  flex-shrink: 0;
  position: relative;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.header::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

.header-left { display: flex; align-items: center; gap: 12px; }

/* Horizontal nav links — desktop only, collapsed on mobile */
.header-nav-links {
  display: flex;
  gap: 24px;
  margin-left: 4px;
}
.header-nav-links a {
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: color 0.15s;
  white-space: nowrap;
  padding: 4px 0;
  position: relative;
}
.header-nav-links a:hover { color: rgba(255,255,255,0.95); }
.header-nav-links a.active { color: #fff; }
.header-nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0; right: 0;
  height: 2px;
  background: var(--lime-500);
  border-radius: 1px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--lime-500);
}

.tagline {
  font-size: 0.85rem;
  color: #bbf7d0;
  font-style: italic;
  display: none;
}

.admin-tag {
  background: var(--lime-500);
  color: var(--forest-700);
  font-style: normal;
  font-weight: 700;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.header-right { display: flex; gap: 8px; }

/* ── Buttons ── */
.btn-icon {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1;
  touch-action: manipulation;
}
.btn-emoji { display: inline-flex; align-items: center; justify-content: center; }
.btn-label { display: inline-flex; align-items: center; }
.btn-icon:hover { background: rgba(255,255,255,0.25); }
.btn-icon.danger { background: rgba(239,68,68,0.3); border-color: rgba(239,68,68,0.5); }
.btn-icon.danger:hover { background: rgba(239,68,68,0.5); }

.btn-primary {
  background: var(--forest-700);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  width: 100%;
  transition: background 0.2s;
  touch-action: manipulation;
}
.btn-primary:hover { background: var(--forest-600); }

.btn-secondary {
  background: #e5e7eb;
  color: #374151;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  flex: 1;
  transition: background 0.2s;
  touch-action: manipulation;
}
.btn-secondary:hover { background: #d1d5db; }

.btn-danger {
  background: #fee2e2;
  color: var(--danger);
  border: 1px solid #fca5a5;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  flex: 1;
  transition: background 0.2s;
  touch-action: manipulation;
}
.btn-danger:hover { background: #fca5a5; }

/* ── Map ── */
#adminPanel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#map {
  flex: 1;
  width: 100%;
  z-index: 1;
  min-height: 0;
  position: relative;
}

/* ── Legend ── */
.legend {
  position: absolute;
  bottom: max(32px, calc(12px + env(safe-area-inset-bottom)));
  right: max(12px, env(safe-area-inset-right));
  background: white;
  border-radius: 10px;
  padding: 12px 16px;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  font-size: 0.85rem;
}

.legend-title {
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--forest-700);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  white-space: nowrap;
}

/* ── Status dots ── */
.dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.easy         { background: #22c55e; }
.dot.medium       { background: #f97316; }
.dot.hard         { background: #ef4444; }
.dot.not_passable { background: var(--text-faint); }
.dot.no_bike      { background: #6366f1; }

/* ── Filter panel ── */
.filter-panel {
  position: absolute;
  top: 64px;
  right: 12px;
  background: white;
  border-radius: 12px;
  padding: 16px;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  min-width: 200px;
}

.filter-panel h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.filter-panel hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 12px 0;
}

.filter-group { display: flex; flex-direction: column; gap: 8px; }

.filter-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

/* ── Path count ── */
.path-count {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,77,20,0.85);
  color: white;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 1000;
  pointer-events: none;
}

/* ── Contact chip (map page) ── */
.contact-chip {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 1000;
  background: rgba(255,255,255,0.92);
  color: var(--forest-700);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 7px 16px;
  border: none;
  font-family: inherit;
  cursor: pointer;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  backdrop-filter: blur(4px);
  transition: background 0.15s, transform 0.15s;
}
.contact-chip:hover { background: var(--forest-100); transform: translateY(-1px); }

/* ── Contact link (routes sidebar) ── */
.sidebar-contact {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.sidebar-contact a {
  color: var(--forest-700);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}
.sidebar-contact a:hover { text-decoration: underline; }

/* ── Path form (admin) ── */
.path-form {
  position: absolute;
  top: 64px;
  left: 12px;
  background: white;
  border-radius: 12px;
  padding: 20px;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.path-form h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--forest-700);
}

.path-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-field {
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  width: 100%;
  color: #1a2e12;
  background: #ffffff;
}
.input-field:focus { border-color: var(--forest-700); }

[data-theme="dark"] .input-field             { background: #1c2a20; border-color: #334d3b; color: #d4edbc; }
[data-theme="dark"] .input-field:focus       { border-color: var(--lime-500); }
[data-theme="dark"] .input-field::placeholder { color: #6b7f64; }

.form-buttons { display: flex; gap: 8px; }

/* ── Admin status bar ── */
.admin-status {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 1001;
  pointer-events: none;
  transition: opacity 0.3s;
}
.admin-status.success { background: #dcfce7; color: #166534; }
.admin-status.error   { background: #fee2e2; color: #991b1b; }

/* ── Login screen ── */
.admin-body { overflow-y: auto; overflow-x: hidden; }

.login-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--forest-700) 0%, var(--forest-600) 50%, #1a3a0e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.login-card h2 { font-size: 1.4rem; color: var(--forest-700); }

.login-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 8px; }

.error-msg {
  color: var(--danger);
  background: #fee2e2;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
}

/* ── Popup ── */
.popup { display: flex; flex-direction: column; gap: 6px; min-width: 140px; }
.popup strong { font-size: 1rem; }
.popup-status {
  color: white;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  width: fit-content;
}
.popup-notes { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.popup-cond-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

/* ── Edit mode status bar ── */
#editModeBar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: var(--forest-700);
  color: white;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  pointer-events: none;
  animation: hintFadeIn 0.25s ease;
}

/* ── Path-edit hint chip (silver+) ── */
#pathEditHint {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: var(--forest-700);
  color: white;
  padding: 9px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: hintFadeIn 0.3s ease;
}
#pathEditHint button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 2px;
  line-height: 1;
}
#pathEditHint button:hover { color: white; }
@keyframes hintFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Live location dot ── */
.location-dot-icon {
  overflow: visible !important;
  background: none !important;
  border: none !important;
}
.location-dot-inner {
  width: 16px;
  height: 16px;
  background: #3b82f6;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  position: relative;
  z-index: 1;
}
.location-dot-pulse {
  display: none;
}

/* ── Difficulty picker (silver+) ── */
.popup-difficulty-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.popup-difficulty-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.popup-difficulty-btns {
  display: flex;
  gap: 8px;
}
.diff-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, border-color 0.15s;
}
.diff-btn:hover { transform: scale(1.15); }
.diff-btn.active { border-color: var(--forest-700); box-shadow: 0 0 0 2px rgba(30,77,20,0.25); }
.popup-difficulty-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.popup-grade-quota {
  margin-top: 6px;
  font-size: 0.74rem;
  color: var(--text-muted);
  text-align: center;
}
.popup-grade-quota:has(span) { color: var(--danger); font-weight: 600; }
.popup-difficulty-locked {
  margin-top: 8px;
  padding: 6px 10px;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-faint);
}
.lock-tag {
  background: #e5e7eb;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}
.popup-report-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.popup-report-section .popup-fallen-btn { margin-top: 0; }
.popup-report-section .popup-report-btn { margin-top: 0; }
.popup-delete-path-btn {
  margin-top: 8px;
  width: 100%;
  padding: 7px 12px;
  background: #fff1f2;
  border: 1.5px solid #ef4444;
  border-radius: 8px;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.popup-delete-path-btn:hover { background: #fee2e2; }

/* ── Color popup (admin) ── */
.admin-popup .leaflet-popup-content-wrapper {
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  padding: 0;
}

.admin-popup .leaflet-popup-content {
  margin: 0;
  width: min(260px, calc(100vw - 40px)) !important;
}

.color-popup {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.color-popup-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--forest-700);
}

.color-popup-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.color-popup-btns {
  display: flex;
  gap: 10px;
}

.color-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  font-size: 1.1rem;
  color: white;
  font-weight: 700;
  transition: transform 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.color-btn:hover {
  transform: scale(1.15);
}

.color-btn.active {
  border-color: #1e293b;
  transform: scale(1.1);
}

.color-popup-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.72rem;
  color: #374151;
}

/* ── Condition tags ── */
.condition-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.cond-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 11px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: white;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.cond-tag:hover { border-color: var(--text-faint); color: #374151; }
.cond-tag.active {
  border-color: var(--forest-700);
  background: var(--forest-100);
  color: var(--forest-700);
}

/* Conditions shown in popup */
.popup-conditions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f3f4f6;
}

.popup-cond-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px;
  background: var(--forest-100);
  border: 1px solid #c8e6b0;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--forest-700);
}

.color-popup-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid #f3f4f6;
}

.popup-edit-btn {
  flex: 1;
  padding: 7px;
  background: #f3f4f6;
  border: none;
  border-radius: 7px;
  font-size: 0.82rem;
  cursor: pointer;
  color: #374151;
  font-weight: 600;
}
.popup-edit-btn:hover { background: #e5e7eb; }

.popup-split-btn {
  padding: 7px 10px;
  background: #fef3c7;
  border: none;
  border-radius: 7px;
  font-size: 0.82rem;
  cursor: pointer;
  color: #92400e;
  font-weight: 600;
}
.popup-split-btn:hover { background: #fde68a; }

.popup-delete-btn {
  padding: 7px 10px;
  background: #fee2e2;
  border: none;
  border-radius: 7px;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--danger);
  font-weight: 600;
}
.popup-delete-btn:hover { background: #fca5a5; }

/* ── Report FAB button ── */
.report-fab {
  position: fixed;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  background: white;
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #b45309;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.report-fab:hover { transform: translateX(-50%) translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,0.22); }

/* ── Report modal ── */
.report-modal {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  width: min(420px, calc(100vw - 32px));
  background: white;
  border-radius: 18px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.report-modal h3 { margin: 0; font-size: 1.1rem; color: var(--forest-700); }
.report-hint { margin: 0; font-size: 0.83rem; color: var(--text-muted); }

.report-types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.rtype-btn {
  padding: 7px 13px;
  border: 1.5px solid #e5e7eb;
  border-radius: 999px;
  background: white;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  color: #374151;
}
.rtype-btn:hover { border-color: var(--forest-700); color: var(--forest-700); }
.rtype-btn.active { background: var(--forest-700); color: white; border-color: var(--forest-700); }

.report-modal-actions { display: flex; gap: 10px; }
.report-modal-actions .btn-primary  { flex: 1; }
.report-modal-actions .btn-secondary { flex-shrink: 0; }

/* ── Report markers on map ── */
.report-marker { background: none; border: none; }
.report-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  border: 2px solid #f97316;
}

/* ── Popup fallen tree button ── */
.popup-fallen-btn {
  margin-top: 10px;
  width: 100%;
  padding: 8px 12px;
  background: #f0fdf4;
  border: 1.5px solid #22c55e;
  border-radius: 8px;
  color: #15803d;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.popup-fallen-btn:hover { background: #dcfce7; }

/* ── Popup report button ── */
.popup-report-btn {
  margin-top: 6px;
  width: 100%;
  padding: 7px 12px;
  background: #fff7ed;
  border: 1.5px solid #f97316;
  border-radius: 8px;
  color: #c2410c;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.popup-report-btn:hover { background: #ffedd5; }

.popup-report-path { font-size: 0.8rem; color: var(--text-muted); margin: 2px 0 8px; }

.rtype-inline-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.rtype-inline-btn {
  padding: 5px 10px;
  border: 1.5px solid #e5e7eb;
  border-radius: 999px;
  background: white;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: #374151;
  transition: all 0.15s;
}
.rtype-inline-btn:hover { border-color: #f97316; color: #c2410c; }
.rtype-inline-btn.active { background: #f97316; color: white; border-color: #f97316; }

.popup-report-note {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-family: inherit;
  resize: none;
  margin-bottom: 8px;
}
.popup-report-actions { display: flex; gap: 8px; }
.popup-submit-btn {
  flex: 1;
  padding: 7px 12px;
  background: var(--forest-700);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.popup-submit-btn:hover { background: var(--forest-600); }
.popup-cancel-btn {
  padding: 7px 12px;
  background: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.popup-cancel-btn:hover { background: #e5e7eb; }

/* ── Admin quick-action buttons in color popup ── */
.admin-quick-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.admin-resolved-btn {
  width: 100%;
  padding: 8px 12px;
  background: #f0fdf4;
  border: 1.5px solid #22c55e;
  border-radius: 8px;
  color: #15803d;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.admin-resolved-btn:hover { background: #dcfce7; }

/* ── Admin report section in color popup ── */
.popup-reports-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #fee2e2;
}
.popup-reports-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 6px;
}
.popup-report-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
  color: #374151;
  margin-bottom: 4px;
}
.popup-resolve-btn {
  flex-shrink: 0;
  padding: 3px 8px;
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 6px;
  color: #166534;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.popup-resolve-btn:hover { background: #bbf7d0; }

/* ── Generic modal styles ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  padding: 16px;
  backdrop-filter: blur(2px);
}
.modal-card {
  background: white;
  border-radius: 18px;
  padding: 28px 24px;
  width: min(440px, 100%);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  position: relative;
}
.contact-modal-card h3 { margin-bottom: 6px; color: var(--forest-700); font-size: 1.15rem; }
.modal-close-x {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s;
}
.modal-close-x:hover { background: #f3f4f6; color: var(--forest-700); }

/* ── Report photo upload ── */
.photo-upload-label {
  display: block;
  padding: 7px 12px;
  background: #f0f9ff;
  border: 1.5px dashed #7dd3fc;
  border-radius: 8px;
  color: #0369a1;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  margin-bottom: 6px;
  transition: background 0.15s;
}
.photo-upload-label:hover { background: #e0f2fe; }

.report-photo-preview {
  width: 100%;
  border-radius: 8px;
  max-height: 160px;
  object-fit: cover;
  margin-bottom: 6px;
  display: block;
}
.report-photo-preview.hidden { display: none; }

.report-popup-photo {
  width: 100%;
  border-radius: 8px;
  max-height: 180px;
  object-fit: cover;
  margin-top: 6px;
  display: block;
}

/* ── Toast notification ── */
.map-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30,77,20,0.92);
  color: white;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}
.map-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Map search bar ── */
.map-search-wrap {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: min(340px, calc(100vw - 100px));
}

.map-search-box {
  display: flex;
  align-items: center;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.18);
  padding: 0 10px;
  gap: 6px;
  height: 42px;
}

.map-search-icon { font-size: 1rem; color: var(--text-faint); flex-shrink: 0; }

.map-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.88rem;
  font-family: inherit;
  color: #1a2e12;
  background: transparent;
  min-width: 0;
}
.map-search-input::placeholder { color: var(--text-faint); }

.map-search-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-faint);
  font-size: 0.8rem;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
}
.map-search-clear:hover { background: #f3f4f6; color: #374151; }

.map-search-results {
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  margin-top: 6px;
  overflow: hidden;
}

.map-search-item {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid #f3f4f6;
}
.map-search-item:last-child { border-bottom: none; }
.map-search-item:hover { background: var(--forest-100); }

.search-item-name { font-size: 0.87rem; font-weight: 600; color: #1a2e12; }
.search-item-sub  { font-size: 0.75rem; color: var(--text-faint); margin-top: 1px; }

/* ── Bottom map buttons row ── */
.map-bottom-btns {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.map-bottom-btns > * { pointer-events: all; }

/* ── Locate me button ── */
.map-locate-btn {
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: none;
  background: white;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--forest-700);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.15s, transform 0.15s, box-shadow 0.2s;
}
.map-locate-btn:hover { background: var(--forest-100); transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,0.22); }
.map-locate-btn:disabled { opacity: 0.5; cursor: default; transform: none; }

/* ── Select current path button ── */
.map-select-path-btn {
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: none;
  background: white;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--forest-700);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.15s, transform 0.15s, box-shadow 0.2s;
}
.map-select-path-btn:hover { background: var(--forest-100); transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,0.22); }

/* ── GPS distance tracker button (shared: map + admin) ── */
.map-track-btn.tracking {
  background: #1e4d14;
  color: #fff;
  box-shadow: 0 0 0 3px #10b981, 0 2px 12px rgba(16,185,129,0.4);
  animation: locate-pulse 2s ease-in-out infinite;
}
.map-track-btn.tracking:hover { background: #163a0f; transform: translateY(-2px); }
.gps-tracker-toast {
  position: fixed;
  left: 50%;
  bottom: 78px;
  transform: translateX(-50%) translateY(10px);
  background: rgba(30,77,20,0.96);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(0,0,0,0.28);
  opacity: 0;
  pointer-events: none;
  z-index: 1300;
  transition: opacity 0.2s, transform 0.2s;
}
.gps-tracker-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.map-locate-btn.locate-following {
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 0 0 3px #3b82f6, 0 2px 12px rgba(59,130,246,0.35);
  animation: locate-pulse 2s ease-in-out infinite;
}
.map-locate-btn.locate-watching {
  background: #f8faff;
  color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.35), 0 2px 12px rgba(59,130,246,0.12);
}
.map-locate-btn.locate-watching:hover {
  background: #eff6ff;
  /* This button is a flex child of .map-bottom-btns (not centred via left:50%),
     so it must only lift on hover — a translateX(-50%) here would slide it left
     on top of the neighbouring "Mon chemin" button. */
  transform: translateY(-2px);
}
.map-locate-btn.locate-searching {
  animation: locate-spin 1s linear infinite;
}

@keyframes locate-pulse {
  0%, 100% { box-shadow: 0 0 0 3px #3b82f6, 0 2px 12px rgba(59,130,246,0.35); }
  50%       { box-shadow: 0 0 0 6px rgba(59,130,246,0.25), 0 2px 12px rgba(59,130,246,0.2); }
}
@keyframes locate-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Locate toast */
.locate-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: rgba(30, 77, 20, 0.92);
  color: white;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.83rem;
  font-weight: 500;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
}
.locate-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.locate-toast.locate-toast-error {
  background: rgba(185, 28, 28, 0.92);
}

/* ── Path hover tooltip ── */
.path-tooltip {
  background: rgba(30, 77, 20, 0.9);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  white-space: nowrap;
}
.path-tooltip::before { display: none; }
.leaflet-tooltip.path-tooltip { pointer-events: none; }

/* ── Carrefour markers (dot + name) — classic French cartographic style ── */
.carrefour-marker {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  white-space: nowrap;
  /* fade in smoothly when they appear */
  animation: carrefour-fade-in 0.25s ease-out;
}

@keyframes carrefour-fade-in {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

.carrefour-dot {
  width: 6px;
  height: 6px;
  background: #1e3a5f;
  border: 1.5px solid white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.45);
  flex-shrink: 0;
}

.carrefour-name {
  /* IGN-style label: italic serif, like real French topographic maps */
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 11px;
  font-weight: 600;
  color: #1e3a5f;
  letter-spacing: 0.15px;
  /* dense white halo so the label is readable on any background */
  text-shadow:
     1px  0   2px white,  -1px  0   2px white,
     0    1px 2px white,   0   -1px 2px white,
     1.5px 1.5px 2px white,-1.5px 1.5px 2px white,
     1.5px -1.5px 2px white,-1.5px -1.5px 2px white;
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ════════════════════════════════════════════════
   MOBILE — all pages
════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* Header — icon-only buttons, hide nav links */
  .btn-label { display: none; }
  .header-nav-links { display: none; }

  .header {
    padding: 0 10px;
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(54px + env(safe-area-inset-top, 0px));
    gap: 4px;
  }

  .logo { font-size: 1.35rem; letter-spacing: 1.5px; }

  .header-right {
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
  }

  .btn-icon {
    padding: 8px 10px;
    font-size: 0.95rem;
    min-width: 38px;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
  }
  .btn-emoji { font-size: 1.05rem; line-height: 1; }

  /* Admin panel carries ~10 tool buttons — far more than a phone-width bar can
     hold in one row. Let its toolbar wrap onto multiple rows so every tool
     stays reachable instead of overflowing off-screen. */
  #adminPanel .header {
    height: auto;
    min-height: calc(54px + env(safe-area-inset-top, 0px));
    flex-wrap: wrap;
    row-gap: 6px;
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
    padding-bottom: 6px;
  }
  #adminPanel .header-right {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  /* Larger touch targets for inputs and buttons */
  .input-field {
    font-size: 1rem;       /* prevents iOS auto-zoom on focus */
    padding: 12px 14px;
    min-height: 44px;
  }

  .btn-primary,
  .btn-secondary,
  .btn-danger {
    padding: 13px 16px;
    min-height: 44px;
    font-size: 0.95rem;
  }

  /* Filter panel — full-width sheet from top, clear the notch */
  .filter-panel {
    left: 8px;
    right: 8px;
    top: calc(54px + env(safe-area-inset-top, 0px) + 4px);
    min-width: 0;
    border-radius: 14px;
    max-height: calc(80dvh - env(safe-area-inset-top, 0px));
    overflow-y: auto;
  }

  .filter-label { font-size: 1rem; padding: 4px 0; }
  .filter-check { width: 18px; height: 18px; }

  /* Legend — smaller and tucked in corner */
  .legend {
    bottom: 12px;
    right: 8px;
    padding: 7px 10px;
    font-size: 0.72rem;
    border-radius: 10px;
  }
  .legend-title { font-size: 0.7rem; }
  .legend-item { gap: 5px; }

  /* Contact chip — hide on mobile to save space */
  .contact-chip { display: none; }

  /* Report FAB + locate button — stacked above bottom nav */
  .report-fab {
    bottom: max(138px, calc(86px + env(safe-area-inset-bottom)));
    padding: 9px 18px;
    font-size: 0.82rem;
  }

  .map-bottom-btns {
    bottom: max(80px, calc(68px + env(safe-area-inset-bottom)));
  }
  .map-locate-btn,
  .map-select-path-btn {
    font-size: 0.82rem;
    padding: 0 14px;
  }

  /* Admin path form — full width at bottom */
  .path-form {
    left: 8px;
    right: 8px;
    top: auto;
    bottom: 0;
    border-radius: 16px 16px 0 0;
    max-height: 80vh;
    overflow-y: auto;
    min-width: 0;
  }

  /* Condition tags — wrap nicely */
  .cond-tag {
    padding: 8px 12px;
    font-size: 0.82rem;
    min-height: 40px;
  }

  /* Popup — bigger text & buttons for fat fingers */
  .leaflet-popup-content { min-width: 220px; }
  .color-btn { width: 34px; height: 34px; }
  .popup-edit-btn, .popup-split-btn, .popup-delete-btn { min-height: 40px; }

  /* User dropdown */
  .user-dropdown { min-width: 170px; right: 0; }
  .user-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
    min-height: 38px;
  }
  .user-avatar { width: 26px; height: 26px; font-size: 0.7rem; }

  /* Map search bar — fit better */
  .map-search-wrap {
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-width: none !important;
    transform: none !important;
  }


  /* Locate toast — push above the bottom nav on mobile */
  .locate-toast {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }

  /* Toast — push above the bottom nav */
  .map-toast {
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }

  /* Admin status — bottom bar fit */
  .admin-status {
    left: 8px;
    right: 8px;
    bottom: 8px;
    font-size: 0.8rem;
  }

  /* Legend — smaller on mobile */

  /* Carrefour labels — slightly smaller on mobile */
  .carrefour-name { font-size: 0.68rem; }

  /* Photo upload + preview — better on mobile */
  .photo-upload-label { font-size: 0.9rem; padding: 10px 12px; }
  .report-photo-preview, .report-popup-photo { max-height: 140px; }
}

/* ── Nav drawer ── */
.nav-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1100;
  opacity: 0;
  transition: opacity 0.22s;
}
.nav-drawer-overlay.hidden { display: none; }
.nav-drawer-overlay.open { display: block; opacity: 1; }

.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(280px, 80vw);
  background: #fff;
  z-index: 1101;
  box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
}
.nav-drawer.hidden { display: none; }
.nav-drawer.open { display: flex; transform: translateX(0); }

.nav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  padding-top: max(20px, env(safe-area-inset-top));
  height: calc(60px + env(safe-area-inset-top));
  background: var(--forest-700);
  flex-shrink: 0;
}
.nav-drawer-logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--lime-500);
}
.nav-drawer-close {
  background: none;
  border: none;
  color: #bbf7d0;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  border-radius: 6px;
}
.nav-drawer-close:hover { background: rgba(255,255,255,0.15); }

.nav-drawer-links {
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  flex: 1;
  overflow-y: auto;
}
.nav-drawer-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  text-decoration: none;
  color: #374151;
  font-size: 0.95rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s;
}
.nav-drawer-item:hover { background: #f0f4ec; color: var(--forest-700); }
.nav-drawer-item.active {
  color: var(--forest-700);
  font-weight: 700;
  border-left-color: var(--forest-700);
  background: #f0f4ec;
}
.nav-drawer-icon { width: 28px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
button.nav-drawer-item { background: none; border: none; width: 100%; text-align: left; cursor: pointer; font-family: inherit; }

/* ── Bottom navigation bar ── */
.bottom-nav { display: none; }

@media (max-width: 768px) {
  /* Shrink map so Leaflet doesn't render behind the fixed bottom nav */
  #map {
    margin-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }

  /* Legend — push above bottom nav */
  .legend {
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  /* On the map page the centred "Ma position / Mon chemin" buttons sit at the
     bottom; the bottom-right legend would otherwise overlap (and half-hide) the
     right button. Lift the legend clear above that button row. Scoped to
     .map-body so the admin legend (no bottom buttons) is unaffected. */
  .map-body .legend {
    bottom: calc(128px + env(safe-area-inset-bottom, 0px));
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: white;
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    z-index: 900;
  }

  /* Extend white background below the nav to fill any gap
     that appears when the iOS Safari toolbar slides in */
  .bottom-nav::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -80px;
    height: 80px;
    background: white;
  }

  .bnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-faint);
    padding: 8px 0 4px;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
  }

  .bnav-item.active { color: var(--forest-700); }
  .bnav-item:active { opacity: 0.7; }

  .bnav-icon { display: flex; align-items: center; justify-content: center; }
  .bnav-label {
    font-size: 0.63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
}

/* Extra narrow phones */
@media (max-width: 380px) {
  .btn-icon { padding: 7px 9px; min-width: 36px; }
  .logo { font-size: 1.2rem; }
  .header { padding: 0 8px; padding-top: env(safe-area-inset-top, 0px); gap: 3px; }
}

/* Ultra-narrow phones (≤340px): the map/admin headers carry up to six icon
   buttons, so shrink the buttons, gap and avatar enough that the toolbar still
   fits on one row instead of pushing the user menu off-screen. */
@media (max-width: 340px) {
  .header-right { gap: 4px; }
  .btn-icon { padding: 6px 7px; min-width: 32px; }
  .user-avatar { width: 30px; height: 30px; }
}

/* ── PWA iOS install modal ── */
#pwa-ios-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#pwa-ios-modal.pwa-ios-visible {
  opacity: 1;
  pointer-events: auto;
}
.pwa-ios-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.pwa-ios-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 20px 20px max(20px, env(safe-area-inset-bottom));
  transform: translateY(40px);
  transition: transform 0.3s cubic-bezier(0.34,1.2,0.64,1);
  color: #1a2e12;
}
#pwa-ios-modal.pwa-ios-visible .pwa-ios-sheet {
  transform: translateY(0);
}
.pwa-ios-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.pwa-ios-appicon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
}
.pwa-ios-header > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pwa-ios-header strong {
  font-size: 1rem;
  font-weight: 700;
  color: #1a2e12;
}
.pwa-ios-header span {
  font-size: 0.82rem;
  color: #555;
}
.pwa-ios-close {
  background: #f0f0f0;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 0.85rem;
  cursor: pointer;
  color: #555;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.pwa-ios-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pwa-ios-steps li {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.9rem;
  color: #333;
  line-height: 1.4;
}
.pwa-ios-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--forest-700);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pwa-ios-safari-hint {
  text-align: center;
  padding: 8px 0 4px;
  color: #333;
  font-size: 0.9rem;
  line-height: 1.5;
}
.pwa-ios-safari-icon { font-size: 2.5rem; margin-bottom: 8px; }
.pwa-ios-safari-hint p { margin: 4px 0; }
.pwa-ios-copy-btn {
  margin-top: 14px;
  background: var(--forest-700);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 11px 28px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pwa-ios-share-svg {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  color: #007aff;
}

/* ── PWA install banner ── */
#pwa-install-banner {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 55px;
  z-index: 1050;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--forest-700);
  color: white;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transform: translateY(calc(100% + 70px));
  transition: transform 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
}

#pwa-install-banner.pwa-banner-visible {
  transform: translateY(0);
}

/* Sit above the bottom nav on mobile */
@media (max-width: 768px) {
  #pwa-install-banner {
    bottom: calc(66px + env(safe-area-inset-bottom));
    left: 8px;
    right: 8px;
    padding-bottom: 12px;
    border-radius: 16px 16px 0 0;
  }
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
}

.pwa-banner-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.15);
}

.pwa-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
  line-height: 1.3;
  min-width: 0;
}

.pwa-banner-text strong {
  font-size: 0.95rem;
  font-weight: 700;
}

.pwa-banner-text span {
  opacity: 0.85;
}

.pwa-share-icon {
  font-size: 1rem;
  vertical-align: middle;
}

.pwa-banner-install {
  flex-shrink: 0;
  background: var(--lime-500);
  color: #1a2e12;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.pwa-banner-install:active { opacity: 0.85; }

.pwa-banner-dismiss {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1rem;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.pwa-banner-dismiss:hover { color: white; }

/* ── Offline pill ─────────────────────────────────────────────────────────── */
#offline-pill {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  opacity: 0;
  visibility: hidden;
  background: #92400e;
  color: #fef3c7;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  z-index: 9000;
  transition: transform 0.3s cubic-bezier(0.34, 1.2, 0.64, 1),
              opacity 0.25s ease, visibility 0.25s;
  pointer-events: none;
  white-space: nowrap;
}
#offline-pill.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

/* ── Sync spinner ─────────────────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.sync-icon { display: inline-block; }
.syncing .sync-icon { animation: spin 0.8s linear infinite; }

/* ── Skeleton shimmer ─────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
  color: transparent !important;
  min-width: 48px;
  min-height: 1.2em;
  display: inline-block;
}

/* ══════════════════════════════════════════════════
   DARK MODE — global shared components
   Triggered by [data-theme="dark"] on <html>
   Set/unset by js/theme.js via localStorage
══════════════════════════════════════════════════ */
[data-theme="dark"] body {
  background: #0e1a11;
  color: #c8dcc0;
}

/* ── Legend dash items (forest boundaries) ── */
.legend-dash {
  display: inline-block;
  width: 22px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-dash.deployed-dash {
  border-top: 2.5px dashed #16a34a;
  height: 0;
}
.legend-dash.nearby-dash {
  border-top: 1.5px dashed #78716c;
  height: 0;
}

/* ── Forest boundary labels ── */
.forest-deployed-label,
.forest-nearby-label {
  background: none;
  border: none;
  white-space: nowrap;
  pointer-events: none;
}
.forest-deployed-label span {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #15803d;
  background: rgba(240, 244, 236, 0.82);
  border: 1.5px dashed #16a34a;
  border-radius: 4px;
  padding: 2px 7px;
  backdrop-filter: blur(2px);
}
.forest-nearby-label span {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #57534e;
  background: rgba(240, 244, 236, 0.75);
  border-radius: 4px;
  padding: 2px 6px;
  backdrop-filter: blur(2px);
}
[data-theme="dark"] .forest-deployed-label span {
  color: #4ade80;
  background: rgba(22, 32, 26, 0.85);
  border-color: #4ade80;
}
[data-theme="dark"] .forest-nearby-label span {
  color: #a8a29e;
  background: rgba(22, 32, 26, 0.75);
}

/* ── Map tiles dark mode ── */
[data-theme="dark"] .leaflet-tile-pane {
  filter: invert(100%) hue-rotate(180deg) brightness(88%) contrast(88%) saturate(85%);
}

/* ── Legend ── */
[data-theme="dark"] .legend              { background: #16201a; box-shadow: 0 2px 12px rgba(0,0,0,0.4); }
[data-theme="dark"] .legend-title        { color: var(--lime-500); }
[data-theme="dark"] .legend-item         { color: #c8dcc0; }

/* ── Filter panel ── */
[data-theme="dark"] .filter-panel        { background: #16201a; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
[data-theme="dark"] .filter-panel h3     { color: #8fa887; }
[data-theme="dark"] .filter-panel hr     { border-top-color: #2a3a30; }
[data-theme="dark"] .filter-label        { color: #c8dcc0; }

/* ── Path form (admin) ── */
[data-theme="dark"] .path-form           { background: #16201a; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
[data-theme="dark"] .path-form h3        { color: #d4edbc; }
[data-theme="dark"] .path-form label     { color: #8fa887; }

/* ── Buttons ── */
[data-theme="dark"] .btn-secondary       { background: #2a3a30; color: #c8dcc0; }
[data-theme="dark"] .btn-secondary:hover { background: #334d3b; }
[data-theme="dark"] .btn-danger          { background: #3d1515; color: #fca5a5; border-color: #6b2222; }
[data-theme="dark"] .btn-danger:hover    { background: #4d1a1a; }

/* ── Map search ── */
[data-theme="dark"] .map-search-box      { background: #16201a; box-shadow: 0 2px 16px rgba(0,0,0,0.4); }
[data-theme="dark"] .map-search-input    { color: #d4edbc; }
[data-theme="dark"] .map-search-input::placeholder { color: #6b7f64; }
[data-theme="dark"] .map-search-icon     { color: #6b7f64; }
[data-theme="dark"] .map-search-clear:hover { background: #2a3a30; color: #c8dcc0; }
[data-theme="dark"] .map-search-results  { background: #16201a; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
[data-theme="dark"] .map-search-item     { border-bottom-color: #2a3a30; }
[data-theme="dark"] .map-search-item:hover { background: #1c2a20; }
[data-theme="dark"] .search-item-name    { color: #d4edbc; }
[data-theme="dark"] .search-item-sub     { color: #6b7f64; }

/* ── Contact chip ── */
[data-theme="dark"] .contact-chip        { background: rgba(22,32,26,0.92); color: var(--lime-500); }
[data-theme="dark"] .contact-chip:hover  { background: #1c2a20; }

/* ── Locate / select-path buttons ── */
[data-theme="dark"] .map-locate-btn,
[data-theme="dark"] .map-select-path-btn      { background: #16201a; color: var(--lime-500); box-shadow: 0 4px 20px rgba(0,0,0,0.4); }
[data-theme="dark"] .map-locate-btn:hover,
[data-theme="dark"] .map-select-path-btn:hover { background: #1c2a20; }

/* ── Report FAB ── */
[data-theme="dark"] .report-fab          { background: #16201a; color: #fbbf24; box-shadow: 0 4px 20px rgba(0,0,0,0.4); }

/* ── Report modal ── */
[data-theme="dark"] .report-modal        { background: #16201a; box-shadow: 0 8px 40px rgba(0,0,0,0.5); }
[data-theme="dark"] .report-modal h3     { color: #d4edbc; }
[data-theme="dark"] .report-hint         { color: #8fa887; }
[data-theme="dark"] .rtype-btn           { background: #1c2a20; border-color: #334d3b; color: #c8dcc0; }
[data-theme="dark"] .rtype-btn:hover     { border-color: var(--lime-500); color: var(--lime-500); }
[data-theme="dark"] .rtype-btn.active    { background: var(--forest-600); border-color: var(--forest-600); color: white; }
[data-theme="dark"] .rtype-inline-btn   { background: #1c2a20; border-color: #334d3b; color: #c8dcc0; }
[data-theme="dark"] .rtype-inline-btn.active { background: #f97316; border-color: #f97316; }
[data-theme="dark"] .popup-report-note  { background: #1c2a20; border-color: #334d3b; color: #d4edbc; }
[data-theme="dark"] .popup-cancel-btn   { background: #2a3a30; color: #c8dcc0; }
[data-theme="dark"] .popup-cancel-btn:hover { background: #334d3b; }
[data-theme="dark"] .popup-submit-btn:hover { background: #3a8428; }

/* ── Generic modal ── */
[data-theme="dark"] .modal-card          { background: #16201a; }
[data-theme="dark"] .modal-close-x       { color: #8fa887; }
[data-theme="dark"] .modal-close-x:hover { background: #2a3a30; color: #d4edbc; }
[data-theme="dark"] .contact-modal-card h3 { color: #d4edbc; }

/* ── Color popup (admin) ── */
[data-theme="dark"] .color-popup-name    { color: #d4edbc; }
[data-theme="dark"] .color-popup-label   { color: #8fa887; }
[data-theme="dark"] .color-popup-legend  { color: #c8dcc0; }
[data-theme="dark"] .color-popup-actions { border-top-color: #2a3a30; }
[data-theme="dark"] .popup-edit-btn      { background: #2a3a30; color: #c8dcc0; }
[data-theme="dark"] .popup-edit-btn:hover { background: #334d3b; }
[data-theme="dark"] .popup-split-btn     { background: #3d2a00; color: #fcd34d; }
[data-theme="dark"] .popup-split-btn:hover { background: #512f00; }
[data-theme="dark"] .popup-delete-btn    { background: #3d1515; color: #fca5a5; }
[data-theme="dark"] .popup-delete-btn:hover { background: #4d1a1a; }
[data-theme="dark"] .popup-delete-path-btn { background: #3d1515; border-color: #6b2222; color: #fca5a5; }
[data-theme="dark"] .popup-delete-path-btn:hover { background: #4d1a1a; }

/* ── Popup general ── */
[data-theme="dark"] .popup-notes         { color: #8fa887; }
[data-theme="dark"] .popup-report-path   { color: #8fa887; }
[data-theme="dark"] .popup-conditions    { border-bottom-color: #2a3a30; }
[data-theme="dark"] .popup-cond-tag      { background: #1c3020; border-color: #2d5c30; color: var(--lime-500); }
[data-theme="dark"] .popup-difficulty-section { border-top-color: #2a3a30; }
[data-theme="dark"] .popup-difficulty-label   { color: #8fa887; }
[data-theme="dark"] .popup-difficulty-locked  { background: #1c2a20; border-color: #334d3b; color: #6b7f64; }
[data-theme="dark"] .lock-tag             { background: #2a3a30; color: #8fa887; }
[data-theme="dark"] .popup-difficulty-legend  { color: #8fa887; }
[data-theme="dark"] .popup-grade-quota    { color: #8fa887; }
[data-theme="dark"] .popup-report-section { border-top-color: #2a3a30; }
[data-theme="dark"] .popup-reports-section   { border-top-color: #4d1a1a; }
[data-theme="dark"] .popup-reports-title  { color: #fca5a5; }
[data-theme="dark"] .popup-report-row     { color: #c8dcc0; }

/* ── Condition tags ── */
[data-theme="dark"] .cond-tag            { background: #1c2a20; border-color: #334d3b; color: #8fa887; }
[data-theme="dark"] .cond-tag:hover      { border-color: #6b7f64; color: #c8dcc0; }
[data-theme="dark"] .cond-tag.active     { border-color: var(--lime-500); background: #1c3020; color: var(--lime-500); }

/* ── Nav drawer ── */
[data-theme="dark"] .nav-drawer          { background: #16201a; }
[data-theme="dark"] .nav-drawer-item     { color: #c8dcc0; }
[data-theme="dark"] .nav-drawer-item:hover    { background: #1c2a20; color: var(--lime-500); }
[data-theme="dark"] .nav-drawer-item.active   { background: #1c2a20; color: var(--lime-500); border-left-color: var(--lime-500); }

/* ── Bottom navigation ── */
[data-theme="dark"] .bottom-nav          { background: #16201a; border-top-color: #2a3a30; box-shadow: 0 -2px 12px rgba(0,0,0,0.4); }
[data-theme="dark"] .bottom-nav::after   { background: #16201a; }
[data-theme="dark"] .bnav-item           { color: #6b7f64; }
[data-theme="dark"] .bnav-item.active    { color: var(--lime-500); }

/* ── Login card ── */
[data-theme="dark"] .login-card          { background: #16201a; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
[data-theme="dark"] .login-card h2       { color: #d4edbc; }
[data-theme="dark"] .login-subtitle      { color: #8fa887; }

/* ── Sidebar contact ── */
[data-theme="dark"] .sidebar-contact     { border-bottom-color: #2a3a30; }
[data-theme="dark"] .sidebar-contact a   { color: var(--lime-500); }

/* ── Admin status bar ── */
[data-theme="dark"] .admin-status.success { background: #1c3020; color: #4ade80; }
[data-theme="dark"] .admin-status.error   { background: #3d1515; color: #fca5a5; }

/* ── PWA sheet ── */
[data-theme="dark"] .pwa-ios-sheet       { background: #16201a; color: #c8dcc0; }
[data-theme="dark"] .pwa-ios-header strong { color: #d4edbc; }
[data-theme="dark"] .pwa-ios-header span { color: #8fa887; }
[data-theme="dark"] .pwa-ios-steps li    { color: #c8dcc0; }
[data-theme="dark"] .pwa-ios-close       { background: #2a3a30; color: #8fa887; }
[data-theme="dark"] .pwa-ios-safari-hint { color: #c8dcc0; }

/* ── Skeleton shimmer (dark) ── */
[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #2a3a30 25%, #334d3b 50%, #2a3a30 75%);
  background-size: 200% 100%;
}

/* ── Notification bell ── */
.notif-bell-wrap {
  position: relative;
}
.notif-bell-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 10px;
  transition: background 0.15s;
  line-height: 1;
}
.notif-bell-btn:hover { background: rgba(0,0,0,0.06); }
.notif-bell-icon { font-size: 1.2rem; }
.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #fff;
  animation: notif-pulse 2s ease-in-out infinite;
}
@keyframes notif-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.3); opacity: 0.8; }
}
.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 2000;
  overflow: hidden;
}
.notif-dropdown.is-open { display: block; }
.notif-hdr {
  padding: 12px 14px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid #f3f4f6;
}
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
}
.notif-item-icon { font-size: 1.6rem; flex-shrink: 0; }
.notif-item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.notif-item-title { font-size: 0.9rem; color: #1e293b; }
.notif-item-sub   { font-size: 0.78rem; color: #6b7280; }
.notif-item-link  {
  font-size: 0.78rem;
  font-weight: 600;
  color: #1e4d14;
  text-decoration: none;
  margin-top: 4px;
}
.notif-item-link:hover { text-decoration: underline; }
.notif-item-desc {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: #374151;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 120px;
  overflow-y: auto;
}
.notif-empty {
  margin: 0;
  padding: 14px;
  font-size: 0.84rem;
  color: #9ca3af;
  text-align: center;
}
[data-theme="dark"] .notif-bell-btn:hover { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .notif-dot            { border-color: #16201a; }
[data-theme="dark"] .notif-dropdown       { background: #16201a; border-color: #2a3a30; }
[data-theme="dark"] .notif-hdr            { color: #8fa887; border-bottom-color: #2a3a30; }
[data-theme="dark"] .notif-item-title     { color: #e2e8f0; }
[data-theme="dark"] .notif-item-sub       { color: #8fa887; }
[data-theme="dark"] .notif-item-link      { color: #a3e635; }
[data-theme="dark"] .notif-empty          { color: #6b7280; }
