:root {
  --bg: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #FF6B35;
  --accent-dark: #c2410c;
  --veggie: #10B981;
  --you: #2563eb;
  --shadow: 0 8px 24px rgba(0,0,0,.14);
  --footer-h: 36px;
}

* { box-sizing: border-box; }
html, body, #map {
  height: 100%;
  width: 100vw;
}

body {
  padding: 0;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
body.drawer-open {
  overflow: hidden;
}
body.modal-open {
  overflow: hidden;
}

#map {
  height: 100%;
  width: 100vw;
}

/* Top shell: counter + hamburger + road chips */
#result-counter {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  z-index: 1100;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(6px);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-dark);
  box-shadow: var(--shadow);
}

#menu-toggle {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  z-index: 1300;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
  color: var(--accent-dark);
  font-size: 26px;
  line-height: 1;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-family: inherit;
}

#filter-bar {
  position: fixed;
  top: calc(max(12px, env(safe-area-inset-top)) + 52px);
  left: 12px;
  right: 12px;
  z-index: 1100;
  display: flex;
  gap: 6px;
  padding: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#filter-bar::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  font-family: inherit;
}
.chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

#menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 1240;
  background: rgba(17, 24, 39, .35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
body.drawer-open #menu-overlay {
  opacity: 1;
  pointer-events: auto;
}

#control-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, calc(100vw - 24px));
  padding: calc(max(16px, env(safe-area-inset-top)) + 4px) 16px calc(max(20px, env(safe-area-inset-bottom)) + 16px);
  z-index: 1250;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(255,255,255,.98);
  backdrop-filter: blur(14px);
  box-shadow: -12px 0 36px rgba(0,0,0,.18);
  transform: translateX(100%);
  transition: transform .24s ease;
  overflow-y: auto;
}
body.drawer-open #control-drawer {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.drawer-header h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

#drawer-close {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-separator {
  width: 100%;
  height: 1px;
  margin: 0;
  border: 0;
  background: var(--border);
}

.drawer-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

#parking-van-toggle,
#show-all-toggle,
#veg-toggle,
#add-restaurant-button,
#install-app-button,
#home-flexo-button {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
#parking-van-toggle.active,
#show-all-toggle.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
#veg-toggle.active {
  background: var(--veggie);
  color: #fff;
  border-color: var(--veggie);
}
#add-restaurant-button {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  color: var(--accent-dark);
  border-color: #fdba74;
}

#veg-subtoggles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 0 0 10px;
}
#veg-subtoggles[hidden] { display: none; }

.veg-chip {
  width: 100%;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.veg-chip.active {
  background: rgba(16, 185, 129, .12);
  color: #065f46;
  border-color: rgba(16, 185, 129, .35);
}
.veg-chip .veg-count { opacity: .75; font-size: 11px; margin-left: 2px; }
.veg-chip.shake { animation: shake .3s; }

/* Sub-toggle brand gasolineras: stessa struttura .veg-chip, palette blu
   coordinata con il marker ⛽ (#2563EB / #1D4ED8). */
#gas-subtoggles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 0 0 10px;
}
#gas-subtoggles[hidden] { display: none; }

.gas-chip {
  width: 100%;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.gas-chip.active {
  background: rgba(37, 99, 235, .12);
  color: #1e3a8a;
  border-color: rgba(37, 99, 235, .45);
}
.gas-chip .gas-count { opacity: .75; font-size: 11px; margin-left: 2px; }

/* "Solo económicas": stessa forma .gas-chip, palette verde quando attivo
   coerente con il marker cheap (#16A34A). Separato dai brand da margin-top. */
.gas-chip-cheap { margin-top: 4px; }
.gas-chip-cheap.active {
  background: rgba(22, 163, 74, .14);
  color: #064e3b;
  border-color: rgba(22, 163, 74, .55);
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* Marker veg: cerchio --veggie con glifo 🌱 bianco al centro. */
.veg-marker { background: transparent !important; border: none !important; }
.veg-marker-inner {
  width: 28px;
  height: 28px;
  background: var(--veggie);
  border: 2px solid #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}

/* Cluster veg: tonalità --veggie, distinto dal cluster blu truck. */
.veg-cluster-wrapper { background: transparent !important; }
.veg-cluster {
  width: 40px;
  height: 40px;
  background: var(--veggie);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* Badge tipo veg nel sheet */
.veg-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-vegan       { background: var(--veggie); color: #fff; }
.badge-vegetarian  { background: #84cc16; color: #fff; }
.badge-vegfriendly { background: #d1fae5; color: #065f46; }

.road-badge {
  display: inline-block;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

/* Orari collassabili nel sheet veg */
.opening-hours { margin: 8px 0 4px; font-size: 13px; color: var(--text); }
.opening-hours summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.opening-hours ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.opening-hours li { margin: 2px 0; }

/* Pulsante "Abrir en Google Maps" verde per il sheet veg */
.btn-veg { background: var(--veggie); color: #fff; }

#map-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 10px;
  row-gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
#map-legend span { display: flex; align-items: center; gap: 6px; }
#map-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.1);
}
#map-legend .dot-general    { background: #F97316; }
#map-legend .dot-vegetarian { background: #86EFAC; }
#map-legend .dot-vegan      { background: #15803D; }
#map-legend .dot-veg        { background: var(--veggie); }

/* Voce legenda veg: visibile solo quando il layer 🌱 è attivo. */
#legend-veg { display: none; }
body.veg-active #legend-veg { display: flex; }

/* Voci legenda gasolineras: visibili solo quando il layer ⛽ è attivo.
   Tre tonalità che rispecchiano 1:1 GAS_TIER_COLORS in app.js. */
.legend-gas-row { display: none; }
body.gas-active .legend-gas-row { display: flex; }
#map-legend .dot-gas-cheap     { background: #16A34A; }
#map-legend .dot-gas-mid       { background: #2563EB; }
#map-legend .dot-gas-expensive { background: #DC2626; }

/* Marker 🎸 RESTAUROCK & ROLL (mappa) + swatch legenda. Disco viola con glifo chitarra. */
.restaurock-marker {
  display: flex; align-items: center; justify-content: center;
  background: #7C3AED;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
  line-height: 1;
}
#map-legend .dot-restaurock {
  width: 16px; height: 16px;
  background: #7C3AED;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; line-height: 1;
}

/* Hint testuale del tier nel sheet (accanto al prezzo gasóleo A). */
.gas-tier-hint { font-size: 12px; font-weight: 600; margin-left: 4px; }

/* Parking furgonetas (orientativo) — marker teal #0D9488 con glifo 🚐 + legenda. */
.parking-marker-inner {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
  font-size: 14px; line-height: 1;
}
.parking-cluster-wrapper { background: transparent; }
.parking-cluster {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: #0D9488; color: #fff; font-weight: 700; font-size: 12px;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.legend-parking-row { display: none; }
body.parking-active .legend-parking-row { display: flex; }
#map-legend .dot-parking { background: #0D9488; }
.parking-disclaimer {
  margin-top: 8px; padding: 8px 10px; border-radius: 8px;
  background: #ccfbf1; color: #115e59; font-size: 12.5px; line-height: 1.4;
}
.gas-tier-cheap     { color: #16A34A; }
.gas-tier-mid       { color: #2563EB; }
.gas-tier-expensive { color: #DC2626; }

/* Marker gasolineras: pittogramma ⛽ su fondo blu (distinto dal veg verde
   e dai marker arancioni dei ristoranti). */
.gas-marker { background: transparent !important; border: none !important; }
.gas-marker-inner {
  width: 26px;
  height: 26px;
  background: #2563EB;
  border: 2px solid #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}

/* Cluster gasolineras: stessa tonalità del marker, distinto dal cluster
   ristoranti (anch'esso blu ma con palette ".tapeo-cluster-*"). Forma
   pill rettangolare per evitare confusione visiva nelle aree dove i due
   cluster si sovrappongono a basso zoom. */
.gas-cluster-wrapper { background: transparent !important; }
.gas-cluster {
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  background: #1D4ED8;
  color: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* FABs */
#fab-list, #fab-locate {
  position: fixed;
  right: 16px;
  z-index: 1000;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  border-radius: 999px;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-family: inherit;
}
#fab-list {
  bottom: calc(max(20px, env(safe-area-inset-bottom)) + var(--footer-h));
  padding: 14px 22px;
  font-size: 15px;
}
#fab-locate {
  bottom: calc(max(20px, env(safe-area-inset-bottom)) + var(--footer-h) + 64px);
  width: 44px;
  height: 44px;
  background: #fff;
  color: var(--you);
  font-size: 22px;
  line-height: 1;
  padding: 0;
}

/* FAB asistente de voz — angolo basso-sinistra (l'angolo opposto è già occupato
   da fab-list + fab-locate). 64px per essere prominente e cliccabile in guida. */
#fab-voice {
  position: fixed;
  left: 16px;
  bottom: calc(max(20px, env(safe-area-inset-bottom)) + var(--footer-h));
  z-index: 1000;
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  padding: 0;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-family: inherit;
  transition: transform .15s, box-shadow .15s, background-color .15s;
}
#fab-voice:active { transform: scale(.96); }

/* Etichetta scopribilità accanto al FAB voce (sempre visibile da idle). */
#fab-voice-label {
  position: fixed;
  left: 88px; /* 16 (FAB left) + 64 (FAB width) + 8 gap */
  bottom: calc(max(20px, env(safe-area-inset-bottom)) + var(--footer-h) + 18px);
  z-index: 1000;
  background: rgba(255, 255, 255, .94);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#fab-voice.listening {
  background: #dc2626;
  animation: voice-pulse 1.1s ease-in-out infinite;
}
#fab-voice.thinking {
  background: #2563eb;
  opacity: .75;
}
#fab-voice[disabled] {
  background: #9ca3af;
  cursor: not-allowed;
  opacity: .7;
}

@keyframes voice-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(220, 38, 38, .55); }
  70%  { box-shadow: 0 0 0 18px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Toast inline sopra il FAB voce per mostrare lo stato (Escuchando…,
   trascrizione, risposta, errori). Limitato a width per non coprire la mappa. */
#voice-toast {
  position: fixed;
  left: 16px;
  bottom: calc(max(20px, env(safe-area-inset-bottom)) + var(--footer-h) + 80px);
  z-index: 1001;
  max-width: min(360px, calc(100vw - 110px));
  background: rgba(17, 24, 39, .92);
  color: #fff;
  font-size: 14px;
  line-height: 1.35;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  pointer-events: none;
}
#voice-toast.interactive {
  pointer-events: auto;
}
.voice-toast-message {
  margin: 0;
}
.voice-toast-actions {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-top: 12px;
}
.voice-toast-nav,
.voice-toast-close {
  border: 0;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
}
.voice-toast-nav {
  flex: 1 1 auto;
  min-height: 48px;
  padding: 12px 16px;
  background: #2563eb;
  color: #fff;
  font-size: 16px;
  text-align: center;
}
.voice-toast-close {
  flex: 0 0 48px;
  min-height: 48px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

/* Banner */
#banner {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 80px;
  z-index: 1000;
  background: #fef3c7;
  color: #78350f;
  border: 1px solid #fde68a;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
}

/* Loader */
#loader {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
#loader span {
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(max(20px, env(safe-area-inset-bottom)) + var(--footer-h) + 80px);
  transform: translateX(-50%);
  z-index: 1300;
  background: #111827;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity .25s ease;
}
#toast.visible { opacity: 1; }

/* Add restaurant modal */
#add-restaurant-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
}
#add-restaurant-modal[hidden] { display: none; }
#add-restaurant-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, .48);
  backdrop-filter: blur(2px);
}
#add-restaurant-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(560px, calc(100vw - 24px));
  max-height: min(88vh, 760px);
  overflow-y: auto;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.24);
  padding: 22px 18px 18px;
  -webkit-overflow-scrolling: touch;
}
#add-restaurant-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}
#add-restaurant-title {
  margin: 0 32px 6px 0;
  font-size: 22px;
  line-height: 1.2;
}
.add-restaurant-intro {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
#detect-restaurant-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}
#detect-restaurant-status {
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.45;
}
.detect-restaurant-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
#detect-restaurant-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detected-restaurant-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  padding: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,.05);
}
.detected-restaurant-name {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 4px;
}
.detected-restaurant-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 10px;
}
.detected-restaurant-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
#add-restaurant-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#add-restaurant-form[hidden] { display: none; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-field span {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.form-field legend {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.form-field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  font-family: inherit;
}
.form-field input:focus {
  outline: none;
  border-color: #fb923c;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, .15);
}
.radio-group {
  display: grid;
  gap: 10px;
}
.radio-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.radio-group input {
  width: auto;
  margin: 0;
}
.location-box {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff7ed;
  padding: 14px;
}
.location-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
#selected-location-label {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}
#selected-location-coords {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}
.location-box-actions,
.form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
#add-restaurant-error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
}

/* Bottom sheet */
#sheet {
  position: fixed;
  left: 0; right: 0;
  bottom: var(--footer-h);
  z-index: 1100;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,.18);
  max-height: calc(60vh - var(--footer-h));
  overflow-y: auto;
  padding: 20px 20px max(20px, env(safe-area-inset-bottom));
  transform: translateY(0);
  transition: transform .25s ease;
  -webkit-overflow-scrolling: touch;
}
#sheet[hidden] {
  display: block !important;
  transform: translateY(110%);
  pointer-events: none;
}
#sheet-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  font-family: inherit;
}
#sheet-close:hover { background: #f3f4f6; }

.sheet-name {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 32px 6px 0;
}
.sheet-meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}
.sheet-rating {
  font-size: 14px;
  font-weight: 600;
  color: #b45309;
  margin-bottom: 14px;
}
.sheet-eta {
  display: inline-block;
  background: #f3f4f6;
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
}
.sheet-eta.error { color: var(--muted); }
.sheet-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.tag {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.tag-voted, .tag-merged {
  background: var(--accent);
  color: #fff;
}
.tag-seed {
  background: transparent;
  border: 1.5px solid var(--accent);
  color: var(--accent-dark);
}

/* User rating widget */
.user-rating {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-bottom: 16px;
}
.user-rating-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.stars {
  display: flex;
  gap: 4px;
}
.stars button {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  line-height: 0;
  font-family: inherit;
}
.stars svg {
  width: 28px;
  height: 28px;
  display: block;
  transition: transform .12s ease;
}
.stars button:active svg { transform: scale(.9); }
.star-fill { fill: #FBBF24; }
.star-empty { fill: #E5E7EB; }
.user-rating-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.sheet-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn {
  flex: 1 1 auto;
  min-width: 120px;
  padding: 12px 16px;
  border-radius: 12px;
  border: none;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: #f3f4f6; color: var(--text); }
.btn-tertiary { background: #fff; color: var(--accent-dark); border: 1.5px solid var(--accent); }

.sheet-extra {
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
  line-height: 1.4;
}
.sheet-extra a { color: var(--you); word-break: break-all; }

/* List view */
#list-view {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: #fff;
  display: flex;
  flex-direction: column;
}
#list-view[hidden] { display: none; }
#list-view header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--border);
}
#list-view h2 { margin: 0; font-size: 18px; }
#list-close {
  border: none;
  background: transparent;
  font-size: 28px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  font-family: inherit;
}
#list-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
}
.card-name {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
}
.card-meta { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.card-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.card-distance { font-weight: 700; color: var(--accent-dark); }
.card-rating { color: #b45309; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }

/* User location marker */
.you-marker {
  width: 18px; height: 18px;
  background: var(--you);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--you), 0 2px 6px rgba(0,0,0,.3);
}

/* Footer Flexo */
#flexo-footer {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  height: var(--footer-h);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #666;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-top: 1px solid var(--border);
  padding: 0 12px;
  text-align: center;
}
#flexo-footer a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}
#flexo-footer .footer-short { display: none; }
@media (max-width: 380px) {
  #flexo-footer .footer-long { display: none; }
  #flexo-footer .footer-short { display: inline; }
}

/* Leaflet attribution: spostala sopra il footer */
.leaflet-bottom.leaflet-right { bottom: var(--footer-h); }

/* Promo banner Flexoapp (card mobile sopra footer e safe area) */
#promo-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--footer-h) + max(12px, env(safe-area-inset-bottom, 0px)));
  z-index: 1060;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 12px 12px 14px;
  background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
  border: 1px solid #fdba74;
  border-radius: 16px;
  color: #7c2d12;
  font-size: 14px;
  font-weight: 750;
  box-shadow: 0 10px 28px rgba(124, 45, 18, .18);
}
#promo-banner[hidden] { display: none !important; }
#promo-banner-link {
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  line-height: 1.25;
}
#promo-banner-link:active { opacity: .82; }
#promo-banner-close {
  width: 38px;
  height: 38px;
  border: none;
  background: rgba(255,255,255,.58);
  color: #7c2d12;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 999px;
  padding: 0;
  font-family: inherit;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#promo-banner-close:hover,
#promo-banner-close:focus-visible { color: #451a03; background: rgba(255,255,255,.9); }

@media (min-width: 600px) {
  #promo-banner {
    left: 50%;
    right: auto;
    width: min(560px, calc(100vw - 32px));
    transform: translateX(-50%);
    font-size: 14px;
  }
}

@media (max-width: 380px) {
  #promo-banner {
    left: 10px;
    right: 10px;
    gap: 8px;
    padding-left: 12px;
    font-size: 13px;
  }
  #promo-banner-close {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
}

@media (max-width: 520px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  #add-restaurant-card {
    width: calc(100vw - 16px);
    max-height: 90vh;
    padding: 20px 14px 16px;
  }
}

/* Quando il banner è visibile, porta sopra tutti i controlli bottom. */
body.promo-visible .leaflet-bottom.leaflet-right {
  bottom: calc(var(--footer-h) + var(--promo-h, 64px) + max(20px, env(safe-area-inset-bottom, 0px)));
}
body.promo-visible #fab-list,
body.promo-visible #fab-voice {
  bottom: calc(max(20px, env(safe-area-inset-bottom, 0px)) + var(--footer-h) + var(--promo-h, 64px) + 12px);
}
body.promo-visible #fab-locate {
  bottom: calc(max(20px, env(safe-area-inset-bottom, 0px)) + var(--footer-h) + var(--promo-h, 64px) + 76px);
}
body.promo-visible #fab-voice-label {
  bottom: calc(max(20px, env(safe-area-inset-bottom, 0px)) + var(--footer-h) + var(--promo-h, 64px) + 30px);
}
body.promo-visible #voice-toast {
  bottom: calc(max(20px, env(safe-area-inset-bottom, 0px)) + var(--footer-h) + var(--promo-h, 64px) + 92px);
}

/* ── Cluster Toda España: tonalità blu neutra (v23) ─────────────────
   Override del MarkerCluster.Default.css upstream. Le classi tapeo-cluster-*
   non sono mai applicate insieme alle marker-cluster-{small|medium|large},
   quindi vincono per specificità (single class, ma upstream non match). */
.marker-cluster.tapeo-cluster-small  { background: rgba(96, 165, 250, 0.6); }
.marker-cluster.tapeo-cluster-small div { background: rgba(59, 130, 246, 0.85); color: #fff; }
.marker-cluster.tapeo-cluster-medium { background: rgba(59, 130, 246, 0.6); }
.marker-cluster.tapeo-cluster-medium div { background: rgba(37, 99, 235, 0.85); color: #fff; }
.marker-cluster.tapeo-cluster-large  { background: rgba(37, 99, 235, 0.6); }
.marker-cluster.tapeo-cluster-large div { background: rgba(29, 78, 216, 0.9); color: #fff; }

/* Voce legenda "Grupo" */
#map-legend .dot-cluster { background: rgba(37, 99, 235, 0.85); }
