/* =========================================================
   FuelAlert — CSS
   Mobile-first, dark-themed control surfaces, clean map
   ========================================================= */

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

:root {
  /* Palette — vibrant fuel theme */
  --bg-dark: #0c0f1a;
  --bg-card: #141829;
  --bg-input: #1a2038;
  --bg-glass: rgba(14, 17, 30, 0.85);
  --accent: #ff6b35;
  --accent-hover: #ff8c5a;
  --accent-glow: rgba(255, 107, 53, 0.35);
  --green: #22d97f;
  --green-glow: rgba(34, 217, 127, 0.25);
  --yellow: #ffc233;
  --yellow-glow: rgba(255, 194, 51, 0.25);
  --red: #ff3b5c;
  --red-glow: rgba(255, 59, 92, 0.25);
  --gray: #5a6680;
  --text: #edf0f7;
  --text-muted: #7b8599;
  --border: rgba(255,255,255,0.07);
  --border-light: rgba(255,255,255,0.12);
  --shadow: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);
  --radius: 14px;
  --radius-sm: 8px;
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);

  /* Sizing */
  --header-h: 56px;
  --sidebar-w: 350px;
  --fab-size: 58px;
  --ad-h: 0px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg-dark);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* --- Typography --- */
h1 { font-size: 1.2rem; font-weight: 700; line-height: 1.1; }
h2 { font-size: 1.05rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
.text-muted { color: var(--text-muted); font-size: 0.82rem; }
.required::after { content: ' *'; color: var(--accent); }

/* --- Header --- */
#app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: linear-gradient(135deg, #0c0f1a 0%, #161b30 50%, #1a1230 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 1100;
  border-bottom: 1px solid var(--border-light);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-icon {
  width: 32px;
  height: 32px;
  color: var(--accent);
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.header-brand h1 {
  color: #fff;
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}
.tagline { font-size: 0.72rem; color: var(--text-muted); letter-spacing: 0.04em; }

/* --- Icon Buttons --- */
.icon-btn {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  flex-shrink: 0;
  -webkit-tap-highlight-color: rgba(255,255,255,0.1);
  touch-action: manipulation;
}
.icon-btn:hover, .icon-btn:focus-visible { background: rgba(255,255,255,0.1); }
.icon-btn:active { background: rgba(255,255,255,0.15); }
.icon-btn svg { width: 22px; height: 22px; }

/* --- Ad Banner --- */
.ad-banner {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1099;
  border-bottom: 1px solid var(--border);
  padding: 4px 40px 4px 14px;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  max-height: 100px;
}
/* When ad banner is visible */
:root.ad-visible { --ad-h: 34px; }

/* In-map bottom ad */
.ad-map-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1040;
  background: var(--bg-dark);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 4px 0;
  max-height: 100px;
  overflow: hidden;
}
.ad-banner.ad-hidden { max-height: 0; padding: 0; border: none; }
.ad-content { text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-link { color: var(--accent); text-decoration: none; }
.ad-link:hover { text-decoration: underline; }
.ad-close {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.ad-close:hover { color: var(--text); }

/* --- Map --- */
#map {
  position: fixed;
  top: calc(var(--header-h) + var(--ad-h, 0px));
  left: 0; right: 0; bottom: 0;
  z-index: 1;
}

/* override leaflet popup styling */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  padding: 0 !important;
}
.leaflet-popup-content {
  margin: 0 !important;
  font-family: inherit !important;
  font-size: 0.88rem !important;
  line-height: 1.45 !important;
  min-width: 220px;
  max-width: 300px;
}
.leaflet-popup-tip { box-shadow: none !important; }

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: calc(var(--header-h) + var(--ad-h, 0px));
  left: 0;
  width: var(--sidebar-w);
  bottom: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-light);
  z-index: 1050;
  overflow-y: auto;
  overflow-x: hidden;
  transform: translateX(0);
  transition: transform var(--transition);
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
}
.sidebar.collapsed { transform: translateX(-100%); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 6px;
}

.sidebar-section {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-section:last-child { border-bottom: none; }
.section-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.sidebar-footer { margin-top: auto; }

.support-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--transition);
}
.support-link:hover {
  border-color: rgba(255,107,53,0.4);
  background: rgba(255,107,53,0.08);
}
.support-icon { font-size: 1.1rem; }

.support-donate {
  background: linear-gradient(135deg, rgba(255,107,53,0.1) 0%, rgba(255,107,53,0.04) 100%);
  border-color: rgba(255,107,53,0.25);
  color: var(--accent);
}
.support-donate:hover {
  background: linear-gradient(135deg, rgba(255,107,53,0.18) 0%, rgba(255,107,53,0.08) 100%);
  border-color: var(--accent);
}
.support-share {
  color: var(--text-muted);
}
.support-share:hover {
  color: var(--text);
}

/* --- Search --- */
.search-row {
  display: flex;
  gap: 6px;
}
.search-row input {
  flex: 1;
  min-width: 0;
}
.search-results {
  margin-top: 6px;
  max-height: 180px;
  overflow-y: auto;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}
.search-results.hidden { display: none; }
.search-result-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  transition: background var(--transition);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover, .search-result-item:focus { background: var(--bg-input); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent) 0%, #ff8c5a 100%); color: #fff; box-shadow: 0 2px 12px var(--accent-glow); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 4px 20px var(--accent-glow); transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover:not(:disabled) { border-color: var(--text-muted); background: rgba(255,255,255,0.05); }
.btn-block { width: 100%; }
.btn-icon { padding: 10px; min-width: 42px; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-svg { width: 18px; height: 18px; flex-shrink: 0; }

/* --- Inputs --- */
input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}
::placeholder { color: var(--text-muted); opacity: 0.7; }

/* --- Filter Chips --- */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.chip:hover { border-color: var(--text-muted); background: rgba(255,255,255,0.03); }
.chip.active {
  border-color: var(--accent);
  color: #fff;
  background: linear-gradient(135deg, rgba(255,107,53,0.15) 0%, rgba(255,107,53,0.08) 100%);
  box-shadow: 0 0 12px rgba(255,107,53,0.15);
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-all { background: var(--text-muted); }
.dot-available { background: var(--green); }
.dot-low { background: var(--yellow); }
.dot-out { background: var(--red); }
.dot-unknown { background: var(--gray); }

/* --- Legend --- */
.legend { display: flex; flex-direction: column; gap: 6px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; }
.legend-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  flex-shrink: 0;
}
.marker-available { background: var(--green); }
.marker-low { background: var(--yellow); }
.marker-out { background: var(--red); }
.marker-unknown { background: var(--gray); }

/* --- Stats --- */
.stats { display: flex; gap: 8px; }
.stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.stat:hover { border-color: var(--border-light); }
.stat-num { font-size: 1.4rem; font-weight: 800; }
.stat-label { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-green { color: var(--green); text-shadow: 0 0 12px var(--green-glow); }
.stat-yellow { color: var(--yellow); text-shadow: 0 0 12px var(--yellow-glow); }
.stat-red { color: var(--red); text-shadow: 0 0 12px var(--red-glow); }

/* --- Floating locate button (mobile) --- */
.locate-float {
  display: none;
  position: fixed;
  bottom: 28px;
  left: 16px;
  z-index: 1060;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-light);
  color: var(--text);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transition: all var(--transition);
  touch-action: manipulation;
}
.locate-float:active { transform: scale(0.92); }
.locate-float svg { width: 22px; height: 22px; }

/* --- FAB --- */
.fab {
  position: fixed;
  bottom: 28px;
  right: 20px;
  z-index: 1060;
  width: auto;
  height: var(--fab-size);
  padding: 0 24px 0 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, #ff8c5a 100%);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 28px var(--accent-glow), 0 0 40px rgba(255,107,53,0.15);
  transition: all var(--transition);
  letter-spacing: 0.02em;
}
.fab:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 10px 40px var(--accent-glow), 0 0 60px rgba(255,107,53,0.2); }
.fab:active { transform: translateY(0) scale(0.98); }
.fab svg { width: 24px; height: 24px; }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  background: var(--bg-dark);
  border: 1px solid var(--border-light);
  border-radius: 20px 20px 0 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: slideUp 0.3s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 -8px 60px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 10px;
  position: sticky;
  top: 0;
  background: var(--bg-dark);
  z-index: 1;
}

.form-section { padding: 10px 20px; }
.form-actions {
  display: flex;
  gap: 10px;
  padding: 16px 20px 24px;
  position: sticky;
  bottom: 0;
  background: var(--bg-dark);
}
.form-actions .btn { flex: 1; }

/* Status cards */
.status-options {
  display: flex;
  gap: 8px;
}
.status-option { flex: 1; }
.status-option input { display: none; }
.status-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}
.status-card svg { width: 28px; height: 28px; }
.status-available svg { color: var(--green); }
.status-low svg { color: var(--yellow); }
.status-out svg { color: var(--red); }

.status-option input:checked + .status-available { border-color: var(--green); background: var(--green-glow); box-shadow: 0 0 16px var(--green-glow); }
.status-option input:checked + .status-low { border-color: var(--yellow); background: var(--yellow-glow); box-shadow: 0 0 16px var(--yellow-glow); }
.status-option input:checked + .status-out { border-color: var(--red); background: var(--red-glow); box-shadow: 0 0 16px var(--red-glow); }

/* Checkbox group */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.checkbox-label:has(input:checked) { border-color: var(--accent); background: rgba(233,69,96,0.1); }
.checkbox-label input { accent-color: var(--accent); }

/* Price grid */
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.price-field label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }

/* Queue options */
.queue-options { display: flex; gap: 6px; flex-wrap: wrap; }
.queue-option { flex: 1; min-width: 70px; }
.queue-option input { display: none; }
.queue-card {
  display: block;
  text-align: center;
  padding: 8px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all var(--transition);
}
.queue-option input:checked + .queue-card { border-color: var(--accent); background: rgba(255,107,53,0.12); color: #fff; }
.queue-warn { color: var(--red) !important; }
.queue-option input:checked + .queue-warn { border-color: var(--red); background: var(--red-glow); }

/* Selected station in form */
.selected-station {
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}
.selected-station .station-name { font-weight: 600; }
.selected-station .station-address { font-size: 0.8rem; color: var(--text-muted); }

/* --- Station Detail Panel --- */
.station-detail {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 1080;
  background: var(--bg-dark);
  border: 1px solid var(--border-light);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
  max-height: 55vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(0);
  transition: transform var(--transition);
  animation: slideUp 0.25s ease;
}
.station-detail.hidden { display: none; }

.station-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 8px;
  position: sticky;
  top: 0;
  background: var(--bg-dark);
}
.station-detail-body { padding: 4px 18px 10px; }
.station-detail-actions { padding: 10px 18px 20px; position: sticky; bottom: 0; background: var(--bg-dark); }

/* Detail content helpers */
.detail-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
}
.badge-available { background: var(--green-glow); color: var(--green); }
.badge-low { background: var(--yellow-glow); color: var(--yellow); }
.badge-out { background: var(--red-glow); color: var(--red); }
.badge-unknown { background: rgba(90,102,128,0.2); color: var(--gray); }

.detail-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 0.85rem; }
.detail-row .label { color: var(--text-muted); }
.detail-time { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; }
.detail-notes { font-size: 0.85rem; margin-top: 8px; padding: 8px 10px; background: var(--bg-card); border-radius: var(--radius-sm); }
.detail-stale { opacity: 0.55; }

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: calc(var(--header-h) + 10px);
  right: 14px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  max-width: 320px;
  pointer-events: auto;
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 3.2s forwards;
  border-left: 3px solid var(--accent);
}
.toast.toast-success { border-left-color: var(--green); }
.toast.toast-error { border-left-color: var(--red); }

/* --- Loading --- */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(26,26,46,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-overlay.hidden { display: none; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* --- Sidebar handle (mobile) --- */
.sidebar-handle {
  display: none;
}

/* --- Brand Logos --- */
.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: contain;
  background: #fff;
  padding: 2px;
  flex-shrink: 0;
}
.popup-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.detail-brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
  padding: 3px;
  float: right;
  margin: 0 0 8px 10px;
}

/* --- FuelPrice.io Price Tags --- */
.fp-prices {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0;
}
.fp-price-tag {
  display: inline-block;
  padding: 3px 8px;
  background: #e3f2fd;
  color: #1565c0;
  border-radius: 4px;
  font-size: 0.72rem;
  white-space: nowrap;
}
.fp-price-tag b { font-weight: 700; }
.fp-prices.dark .fp-price-tag {
  background: rgba(33,150,243,0.15);
  color: #64b5f6;
}
.fp-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin: 6px 0 3px;
}
.fp-section-label.dark { color: var(--text-muted); }
.fp-tomorrow .fp-price-tag { background: #fff3e0; color: #e65100; }
.fp-tomorrow.dark .fp-price-tag { background: rgba(255,152,0,0.12); color: #ffb74d; }
.fp-up { color: #c62828 !important; }
.fp-down { color: #2e7d32 !important; }
.fp-tomorrow.dark .fp-up { color: var(--red) !important; }
.fp-tomorrow.dark .fp-down { color: var(--green) !important; }

/* --- Popup content (Leaflet) --- */
.popup-inner { padding: 14px; }
.popup-inner h4 { font-size: 0.95rem; margin-bottom: 2px; color: #222; }
.popup-inner .popup-brand { font-size: 0.78rem; color: #888; margin-bottom: 8px; }
.popup-inner .popup-status { margin: 6px 0; }
.popup-inner .popup-meta { font-size: 0.8rem; color: #666; }
.popup-inner .popup-meta span { display: block; margin: 2px 0; }
.popup-inner .popup-actions { margin-top: 10px; }
.popup-inner .popup-btn {
  display: inline-block;
  padding: 7px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s;
}
.popup-inner .popup-btn:hover { background: var(--accent-hover); }
.popup-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
}
.popup-badge-available { background: #e8f5e9; color: #2e7d32; }
.popup-badge-low { background: #fff8e1; color: #f9a825; }
.popup-badge-out { background: #ffebee; color: #c62828; }
.popup-badge-unknown { background: #eceff1; color: #546e6a; }

/* --- Fuel Breakdown (popup & detail) --- */
.fuel-breakdown {
  margin: 8px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.fuel-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.fuel-row:last-child { border-bottom: none; }
.fuel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-available { background: var(--green); }
.dot-low { background: var(--yellow); }
.dot-out { background: var(--red); }
.fuel-name { flex: 1; font-weight: 500; }
.fuel-status-text { font-weight: 600; font-size: 0.75rem; min-width: 28px; text-align: center; }
.fuel-st-available { color: #2e7d32; }
.fuel-st-low { color: #f9a825; }
.fuel-st-out { color: #c62828; }
.fuel-price { font-size: 0.75rem; color: #888; min-width: 50px; text-align: right; }

/* Popup fuel breakdown (light bg) */
.popup-inner .fuel-breakdown { background: #f5f5f5; padding: 6px 8px; border-radius: 6px; }
.popup-inner .fuel-row { border-color: rgba(0,0,0,0.08); }

/* Detail panel fuel breakdown (dark bg) */
.station-detail .fuel-breakdown { background: var(--bg-card); padding: 8px 10px; margin-top: 8px; }
.station-detail .fuel-name { color: var(--text); }
.station-detail .fuel-price { color: var(--text-muted); }

/* --- Quick status buttons --- */
.quick-status {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.quick-btn {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  touch-action: manipulation;
}
.quick-ok:hover, .quick-ok:active { border-color: var(--green); background: var(--green-glow); color: var(--green); }
.quick-out:hover, .quick-out:active { border-color: var(--red); background: var(--red-glow); color: var(--red); }

.derived-status {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.derived-available { color: var(--green); }
.derived-low { color: var(--yellow); }
.derived-out { color: var(--red); }

/* --- Fuel Grid Form (report modal) --- */
.fuel-grid { display: flex; flex-direction: column; gap: 8px; }
.fuel-grid-row {
  display: grid;
  grid-template-columns: 90px 1fr 70px;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.fuel-grid-row:last-child { border-bottom: none; }
.fuel-grid-label { font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.fuel-grid-status { display: flex; gap: 4px; flex-wrap: nowrap; }

.mini-radio input { display: none; }
.mini-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  min-width: 32px;
  text-align: center;
}
.mini-radio input:checked + .mini-chip { border-color: var(--text-muted); background: rgba(255,255,255,0.1); color: #fff; }
.mini-radio input:checked + .mini-ok { border-color: var(--green); background: rgba(0,200,83,0.15); color: var(--green); }
.mini-radio input:checked + .mini-low { border-color: var(--yellow); background: rgba(255,214,0,0.15); color: var(--yellow); }
.mini-radio input:checked + .mini-out { border-color: var(--red); background: rgba(255,23,68,0.15); color: var(--red); }

.fuel-price-input {
  width: 70px !important;
  padding: 6px 8px !important;
  font-size: 0.8rem !important;
  text-align: right;
}

/* --- Wait time badges --- */
.wait-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
}
.wait-none { background: var(--green-glow); color: var(--green); }
.wait-short { background: var(--green-glow); color: var(--green); }
.wait-long { background: var(--yellow-glow); color: var(--yellow); }
.wait-danger {
  background: var(--red-glow);
  color: var(--red);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Popup wait badge (light bg) */
.popup-inner .wait-none, .popup-inner .wait-short { background: #e8f5e9; color: #2e7d32; }
.popup-inner .wait-long { background: #fff8e1; color: #f9a825; }
.popup-inner .wait-danger { background: #ffebee; color: #c62828; }

/* --- Toggle row --- */
.toggle-row { margin-bottom: 8px; }
.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}
.toggle-label input { accent-color: var(--accent); width: 16px; height: 16px; }

/* --- Outage summary bar --- */
.outage-summary { margin-top: 10px; }
.outage-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-input);
}
.bar-seg { transition: width 0.5s ease; min-width: 0; }
.bar-green { background: var(--green); }
.bar-yellow { background: var(--yellow); }
.bar-red { background: var(--red); }
.outage-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}
.ol-green { color: var(--green); }
.ol-yellow { color: var(--yellow); }
.ol-red { color: var(--red); }

/* --- Fuel type filter chip icon --- */
.chip-icon { font-size: 0.7rem; }

/* --- Mobile floating stats bar --- */
.mobile-stats {
  display: none;
  position: fixed;
  top: calc(var(--header-h) + var(--ad-h, 0px) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1050;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: 100px;
  padding: 7px 18px;
  gap: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  font-size: 0.8rem;
  font-weight: 700;
}
.ms-item { display: flex; align-items: center; gap: 4px; }
.ms-dot { width: 8px; height: 8px; border-radius: 50%; }
.ms-dot-all { background: var(--text-muted); }
.ms-dot-green { background: var(--green); }
.ms-dot-yellow { background: var(--yellow); }
.ms-dot-red { background: var(--red); }

/* --- Zoom hint --- */
.zoom-hint {
  position: fixed;
  top: calc(var(--header-h) + var(--ad-h, 0px) + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1050;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: 100px;
  padding: 10px 22px;
  font-size: 0.82rem;
  color: var(--text-muted);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  white-space: nowrap;
  pointer-events: none;
}
.zoom-hint.hidden { display: none; }

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0.5; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(60px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   Responsive — Mobile
   ========================================================= */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 100%;
    --header-h: 50px;
  }

  .tagline { display: none; }

  /* Sidebar becomes bottom sheet */
  .sidebar {
    top: auto !important;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 70vh;
    border-right: none;
    border-top: 1px solid var(--border-light);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
    background: var(--bg-dark);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  .sidebar.open { transform: translateY(0) !important; }
  .sidebar.collapsed { transform: translateY(100%) !important; }

  .sidebar-handle {
    display: block;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1049;
    text-align: center;
    padding: 8px 0;
    background: var(--bg-dark);
    border-radius: 20px 20px 0 0;
    border-top: 1px solid var(--border-light);
  }
  .sidebar-handle.hidden { display: none; }
  .handle-bar {
    width: 40px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
    margin: 0 auto;
    opacity: 0.5;
  }

  .mobile-stats { display: flex; }
  .locate-float { display: flex; }

  .ad-banner .ad-content ins { width: 320px !important; height: 50px !important; }
  .ad-map-bottom { display: none; } /* hide bottom ad on mobile — too cramped */

  .fab { bottom: 24px; right: 16px; }
  .fab-label { display: none; }
  .fab { padding: 0; width: var(--fab-size); justify-content: center; }

  .modal {
    max-height: 95vh;
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .price-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }

  .toast-container { left: 14px; right: 14px; }
  .toast { max-width: 100%; }
}

/* Desktop: sidebar always visible, no handle */
@media (min-width: 769px) {
  #map { left: var(--sidebar-w); }
  .sidebar { transform: translateX(0) !important; }
  #btn-toggle-sidebar,
  #btn-close-sidebar { display: none; }
  .sidebar-handle { display: none !important; }
  .modal { border-radius: var(--radius); align-self: center; }
  .modal-overlay { align-items: center; }
}

/* --- Utility --- */
.hidden { display: none !important; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }
