/* ═══════════════════════════════════════════════
   RESET & BASE
════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:        #6B8F5E;
  --amber:        #A67C52;
  --blue:         #7B9E87;
  --red:          #C0392B;
  --surface:      #F2EDE3;
  --card:         #FAF7F0;
  --text-primary: #2D2015;
  --text-secondary: #7D6B58;
  --border:       #D8CEBD;
  --border-light: #ECE7DC;
  --sidebar-w:    220px;
  --shadow-sm:    0 2px 8px rgba(80,50,20,0.07);
  --shadow-md:    0 4px 20px rgba(80,50,20,0.10);
  --radius-sm:    10px;
  --radius-md:    14px;
  --radius-lg:    20px;
}

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

/* ═══════════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 16px 24px;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 28px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.logo-icon { font-size: 22px; }
.logo-text  { font-size: 17px; font-weight: 800; color: var(--text-primary); }

.nav-links { list-style: none; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 4px;
}

.nav-link svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }

.nav-link:hover { background: var(--surface); color: var(--text-primary); }
.nav-link.active { background: rgba(107,143,94,0.12); color: var(--green); }

/* ═══════════════════════════════════════════════
   BOTTOM NAV (mobile only)
════════════════════════════════════════════════ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--card);
  border-top: 1px solid var(--border);
  z-index: 200;
  justify-content: space-around;
  align-items: center;
}

.bnav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  flex: 1;
  padding: 6px 0;
  transition: color 0.15s;
}

.bnav-link svg { width: 22px; height: 22px; fill: currentColor; }
.bnav-link.active { color: var(--green); }

/* ═══════════════════════════════════════════════
   MAIN CONTENT
════════════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  position: relative;
}

/* ═══════════════════════════════════════════════
   PAGES
════════════════════════════════════════════════ */
.page { display: none; }
.page.active { display: block; }

/* Finder + Settings share the same padded inner */
.page-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ═══════════════════════════════════════════════
   PAGE HEADER
════════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.header-icon {
  width: 44px; height: 44px;
  background: rgba(107,143,94,0.12);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}

.header-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════
   WEIGHT BADGE
════════════════════════════════════════════════ */
.weight-badge {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: linear-gradient(135deg, rgba(107,143,94,0.08), rgba(166,124,82,0.06));
  border: 1px solid rgba(107,143,94,0.2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 22px;
}

.weight-info { flex: 1; }
.weight-info strong { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }

.weight-bars { display: flex; gap: 14px; flex-wrap: wrap; }

.mini-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}

.mini-bar-label { color: var(--text-secondary); }

.mini-bar-track {
  width: 48px; height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.mini-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.mini-bar-fill.green { background: var(--green); }
.mini-bar-fill.blue  { background: var(--blue); }
.mini-bar-pct { font-weight: 700; font-size: 11px; }
.mini-bar-pct.green { color: var(--green); }
.mini-bar-pct.blue  { color: var(--blue); }

/* ═══════════════════════════════════════════════
   CARDS
════════════════════════════════════════════════ */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

/* ═══════════════════════════════════════════════
   INPUT CARD
════════════════════════════════════════════════ */
.input-card { padding: 20px; }

.field-group { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }

.field-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: visible;
  position: relative;
  transition: border-color 0.15s;
}

.field-wrap:focus-within { border-color: var(--green); }
.field-wrap.half { flex: 1; }

.field-icon {
  width: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.field-icon svg { width: 18px; height: 18px; fill: currentColor; }
.field-icon.green  { color: var(--green); }
.field-icon.muted  { color: var(--text-secondary); }

.field-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 16px; /* 16px minimum prevents iOS auto-zoom on focus */
  font-weight: 500;
  color: var(--text-primary);
  background: transparent;
  padding: 13px 14px 13px 0;
  min-width: 0;
}

.field-input::placeholder { color: var(--text-secondary); font-weight: 400; }

.field-select {
  appearance: none;
  cursor: pointer;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%236B7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 18px;
}

.field-suffix {
  padding-right: 14px;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.field-row { display: flex; gap: 12px; }

.gps-btn {
  width: 42px; height: 42px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.gps-btn svg { width: 18px; fill: currentColor; }
.gps-btn:hover { background: var(--surface); color: var(--green); }
.gps-btn.loading { animation: spin 1s linear infinite; color: var(--green); }

/* ═══════════════════════════════════════════════
   AUTOCOMPLETE
════════════════════════════════════════════════ */
.autocomplete-wrap { flex: 1; position: relative; }

.autocomplete-list {
  position: absolute;
  top: calc(100% + 6px);
  left: -44px; /* align with field-wrap left edge */
  right: -44px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 500;
  list-style: none;
  overflow: hidden;
  display: none;
}

.autocomplete-list.open { display: block; }

.autocomplete-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}

.autocomplete-list li:last-child { border-bottom: none; }
.autocomplete-list li:hover { background: var(--surface); }

.autocomplete-list li svg {
  width: 14px; height: 14px;
  fill: var(--text-secondary);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   BUTTONS
════════════════════════════════════════════════ */
.btn-primary {
  width: 100%;
  padding: 15px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-primary:hover   { opacity: 0.92; }
.btn-primary:active  { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-amber {
  padding: 13px 22px;
  background: var(--amber);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.btn-amber:hover { opacity: 0.9; }

.btn-outline {
  width: 100%;
  padding: 11px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.btn-outline:hover { background: var(--surface); border-color: #d1d5db; }

/* Spinner inside button */
.btn-spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ═══════════════════════════════════════════════
   ERROR BOX
════════════════════════════════════════════════ */
.error-box {
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #DC2626;
  margin-bottom: 12px;
}

.field-error {
  font-size: 12px;
  color: #DC2626;
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════
   RESULTS
════════════════════════════════════════════════ */
.baseline-banner {
  background: var(--text-primary);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}

.route-icon { width: 20px; fill: rgba(255,255,255,0.6); flex-shrink: 0; margin-top: 2px; }

.baseline-text { color: #fff; font-weight: 600; font-size: 14px; }
.baseline-sub  { color: rgba(255,255,255,0.55); font-size: 12px; margin-top: 2px; }

.section-title { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.section-sub   { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }

.cards-grid { display: flex; flex-direction: column; gap: 12px; }

/* ─── Recommendation card ─── */
.rec-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
  position: relative;
  overflow: hidden;
}

.rec-card:hover   { box-shadow: 0 4px 20px rgba(0,0,0,0.08); transform: translateY(-1px); }
.rec-card:active  { transform: scale(0.99); }
.rec-card.recommended { border-color: rgba(107,143,94,0.5); border-width: 2px; box-shadow: 0 4px 16px rgba(107,143,94,0.10); }
.rec-card.picked  { border-width: 2px; }

.rec-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.rec-emoji-box {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.rec-title-group { flex: 1; min-width: 0; }

.rec-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.rec-label { font-size: 16px; font-weight: 800; }

.rec-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
}

.rec-station {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-price-group {
  text-align: right;
  flex-shrink: 0;
}

.rec-price { font-size: 22px; font-weight: 800; line-height: 1; }
.rec-price-unit { font-size: 11px; color: var(--text-secondary); }

.rec-divider {
  height: 1px;
  background: var(--border-light);
  margin: 14px 0;
}

.rec-stats { display: flex; gap: 10px; }

.stat-chip {
  flex: 1;
  background: rgba(80,50,20,0.05);
  border-radius: 10px;
  padding: 8px 10px;
}

.stat-chip-label {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
  display: block;
  margin-bottom: 2px;
}

.stat-chip-value {
  font-size: 14px;
  font-weight: 800;
  display: block;
}

.picked-confirm {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════
   MAP PAGE
════════════════════════════════════════════════ */
#page-map {
  position: relative;
  height: 100vh;
}

#map-container {
  width: 100%;
  height: 100%;
}

.map-controls {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 520px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 14px 16px;
  z-index: 10;
}

.map-ctrl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.map-ctrl-row:last-child { margin-bottom: 0; }

.ctrl-label {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  min-width: 50px;
}

.map-select {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--card);
  color: var(--text-primary);
  cursor: pointer;
}

.station-count {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: auto;
}

.map-refresh-btn {
  width: 32px; height: 32px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background 0.15s;
}

.map-refresh-btn svg { width: 16px; fill: currentColor; }
.map-refresh-btn:hover { background: var(--surface); }

#map-radius {
  flex: 1;
  accent-color: var(--green);
}

.radius-label {
  font-size: 14px;
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}

.map-error-text {
  font-size: 12px;
  color: #DC2626;
  padding-top: 4px;
}

.map-legend {
  position: absolute;
  bottom: 24px;
  left: 16px;
  background: var(--card);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  z-index: 10;
}

.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.green { background: #22C55E; }
.legend-dot.red   { background: #EF4444; }

.map-loading {
  position: absolute;
  bottom: 80px;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  z-index: 10;
}

/* Custom map marker */
.map-marker {
  position: relative;
  cursor: pointer;
}

.map-marker-bubble {
  background: #fff;
  border-radius: 10px;
  border: 2px solid #22C55E;
  display: flex;
  align-items: stretch;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  overflow: hidden;
  min-width: 110px;
  transition: transform 0.15s;
}

.map-marker-bubble:hover { transform: scale(1.05); }

.map-marker-brand {
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  padding: 8px 4px;
}

.map-marker-price {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
}

.map-marker-tail {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 8px solid #22C55E;
}

/* ═══════════════════════════════════════════════
   SETTINGS PAGE
════════════════════════════════════════════════ */
.settings-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 24px;
}

.settings-card {
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-card-tall {
  padding: 18px;
}

.settings-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-card-info strong { font-size: 15px; font-weight: 700; }
.settings-card-info span   { font-size: 13px; color: var(--text-secondary); }

.settings-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.settings-section-header strong { display: block; font-size: 15px; font-weight: 700; }
.settings-section-header span   { font-size: 13px; color: var(--text-secondary); }

.settings-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.settings-icon.amber { background: rgba(255,184,0,0.12); }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 12px;
  transition: background 0.2s;
  cursor: pointer;
}

.toggle-track::before {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-track { background: var(--green); }
.toggle input:checked + .toggle-track::before { transform: translateX(20px); }

/* Consumption row */
.consumption-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.flex1 { flex: 1; }

/* Chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.chip {
  padding: 8px 14px;
  min-height: 38px;
  border-radius: 20px;
  background: var(--border-light);
  border: 1.5px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
}

.chip:hover  { background: #E5E7EB; }
.chip.active {
  background: rgba(166,124,82,0.12);
  border-color: var(--amber);
  color: var(--amber);
  font-weight: 700;
}

/* Prefs section */
.prefs-title { font-size: 16px; font-weight: 800; display: block; margin-bottom: 4px; }
.prefs-desc  { font-size: 13px; color: var(--text-secondary); margin-bottom: 0; }

.weight-visual { margin: 16px 0; }

.wv-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.wv-track {
  flex: 1;
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
}

.wv-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease;
}

.wv-fill.green { background: var(--green); }
.wv-fill.blue  { background: var(--blue); }
.wv-pct { font-size: 13px; font-weight: 800; min-width: 38px; text-align: right; }
.wv-pct.green { color: var(--green); }
.wv-pct.blue  { color: var(--blue); }

.history-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }

.history-chip {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════
   NAV MODAL
════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-sheet {
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 16px 24px calc(40px + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 520px;
  animation: slideUp 0.25s ease;
}

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

.modal-to { font-size: 13px; color: var(--text-secondary); text-align: center; margin-bottom: 4px; }
.modal-station { font-size: 17px; font-weight: 800; text-align: center; margin-bottom: 24px; }

.modal-options { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }

.modal-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 16px;
  transition: background 0.15s;
}

.modal-option:hover { background: var(--surface); }

.modal-opt-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.nav-app-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
}

.map-marker-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 3px;
  display: block;
}

.modal-chevron { width: 18px; fill: var(--text-secondary); margin-left: auto; }

.modal-cancel {
  width: 100%;
  padding: 13px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

/* ═══════════════════════════════════════════════
   SPINNER + UTILITIES
════════════════════════════════════════════════ */
.spinner {
  width: 28px; height: 28px;
  border: 3px solid rgba(107,143,94,0.2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(60px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.hidden { display: none !important; }

/* ═══════════════════════════════════════════════
   RESPONSIVE — tablet collapses sidebar
════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .bottom-nav { display: flex; }
  .main-content {
    margin-left: 0;
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  }
  #page-map {
    height: 100vh; /* fallback */
    height: calc(100dvh - 60px - env(safe-area-inset-bottom, 0px));
  }
  .map-controls { top: 12px; }
  .page-inner { padding: 24px 16px calc(80px + env(safe-area-inset-bottom, 0px)); }

  /* Autocomplete dropdown: clamp to screen edges on mobile */
  .autocomplete-list {
    left: -16px;
    right: -16px;
  }

  /* Larger touch targets for nav links */
  .bnav-link {
    padding: 8px 0;
    min-height: 44px;
    justify-content: center;
  }

  /* Map legend stays above bottom nav */
  .map-legend { bottom: 16px; }
}

@media (max-width: 480px) {
  .field-row { flex-direction: column; }
  .field-wrap.half { flex: none; width: 100%; }

  /* Keep stat chips horizontal but compact */
  .rec-stats { gap: 6px; }
  .stat-chip { padding: 7px 8px; }
  .stat-chip-label { font-size: 9px; }
  .stat-chip-value { font-size: 13px; }
}