:root {
  --inchiostro: #14263a;
  --testo: #3c4a59;
  --tenue: #6b7785;
  --linea: #e3e7ec;
  --fondo: #ffffff;
  --arancio: #e86f00;
  --arancio-chiaro: #fff3e6;
  --blu: #1f5fa8;
  --mare: #dce7f1;
  --pannello-w: 380px;
  --raggio: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--testo);
  background: var(--mare);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
#mappa { position: fixed; inset: 0 0 0 var(--pannello-w); }

#cartello {
  position: fixed; top: 14px; left: calc(var(--pannello-w) + 14px); right: 64px; z-index: 1; margin: 0;
  width: fit-content; max-width: 520px; padding: 9px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, .94); box-shadow: 0 4px 18px rgba(20, 38, 58, .12);
  font-size: 13.5px; line-height: 1.4; color: var(--testo);
}
#cartello strong { color: var(--inchiostro); }

/* ---------- pannello laterale ---------- */
#pannello {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--pannello-w);
  background: var(--fondo);
  border-right: 1px solid var(--linea);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 28px 26px 24px;
  display: flex; flex-direction: column; gap: 26px;
  z-index: 2;
}
#maniglia { display: none; }
.logo img { display: block; height: 40px; width: auto; }
.occhiello {
  margin: 22px 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--arancio);
}
h1 {
  margin: 0; color: var(--inchiostro); font-size: 26px; line-height: 1.15; font-weight: 700;
  letter-spacing: -.01em; text-wrap: balance;
}
.sotto { margin: 10px 0 0; font-size: 14px; line-height: 1.5; }
.sotto strong { color: var(--inchiostro); }

.numeri { display: flex; flex-direction: column; gap: 12px; }
.numero {
  background: #f6f8fa; border-radius: var(--raggio); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.numero.grande { background: var(--inchiostro); color: #c9d3de; padding: 18px 18px 16px; }
.numero .valore {
  font-size: 26px; font-weight: 700; color: var(--inchiostro); line-height: 1.05;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.numero.grande .valore { font-size: 44px; color: #fff; }
.numero .valore small { font-size: 14px; font-weight: 600; margin-left: 4px; color: var(--arancio); }
.numero .etichetta { font-size: 12.5px; line-height: 1.4; }
.numero.grande .etichetta { font-size: 13.5px; }
.numero em { font-style: normal; color: var(--tenue); }
.numero.totale { background: var(--arancio-chiaro); }
.numero.totale .valore { font-size: 34px; color: #a14a00; }
.numero.totale .etichetta { color: #7a3c00; }
.numero .valore small.prima { margin: 0 6px 0 0; color: var(--tenue); font-weight: 500; }
.coppia { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.frase {
  margin: 2px 0 0; font-size: 13px; line-height: 1.5; padding: 12px 14px;
  background: var(--arancio-chiaro); border-radius: var(--raggio); color: #7a3c00;
}
.frase:empty { display: none; }

h2 {
  margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--inchiostro);
  text-transform: uppercase; letter-spacing: .06em;
}
h2 span { color: var(--tenue); font-weight: 500; text-transform: none; letter-spacing: 0; }

.cerca label { display: block; font-size: 15px; font-weight: 600; color: var(--inchiostro); margin-bottom: 8px; }
.campo { position: relative; }
.campo input {
  width: 100%; font: inherit; font-size: 16px; padding: 11px 14px;
  border: 1.5px solid var(--linea); border-radius: 12px; outline: none; color: var(--inchiostro);
  background: #fff; transition: border-color .15s;
}
.campo input:focus { border-color: var(--arancio); }
#suggerimenti {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px;
  list-style: none; background: #fff; border: 1px solid var(--linea); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(20, 38, 58, .12); z-index: 5; max-height: 240px; overflow-y: auto;
}
#suggerimenti li { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
#suggerimenti li span { color: var(--tenue); }
#suggerimenti li[aria-selected="true"], #suggerimenti li:hover { background: #f2f5f8; }
#esito-ricerca { margin: 10px 0 0; font-size: 13.5px; line-height: 1.5; }
#esito-ricerca:empty { display: none; }
#esito-ricerca strong { color: var(--inchiostro); }

  all: unset; box-sizing: border-box; width: 100%; cursor: pointer;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px;
  padding: 6px 8px; border-radius: 8px; font-size: 13.5px;
}

  position: absolute; top: -18px; left: 0; right: 0; text-align: center;
  font-size: 12px; font-weight: 600; color: var(--inchiostro); font-variant-numeric: tabular-nums;
}

.piede { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.bottone {
  display: block; text-align: center; text-decoration: none; font-weight: 600; font-size: 15px;
  background: var(--arancio); color: #fff; padding: 13px 16px; border-radius: 12px;
  transition: background .15s, transform .1s;
}
.bottone:hover { background: #d46400; }
.bottone:active { transform: scale(.98); }
.nota { margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--tenue); }

/* ---------- scheda impianto ---------- */
.maplibregl-popup-content {
  border-radius: var(--raggio); padding: 14px 16px 12px; font-family: inherit;
  box-shadow: 0 12px 34px rgba(20, 38, 58, .2);
}
.maplibregl-popup-close-button { font-size: 18px; padding: 2px 8px; color: var(--tenue); }
.scheda { min-width: 230px; }
.scheda .dove { margin: 0 24px 6px 0; font-size: 12px; color: var(--tenue); }
.scheda .modello { margin: 0 0 10px; display: flex; flex-direction: column; }
.scheda .nome { font-size: 20px; font-weight: 700; color: var(--inchiostro); line-height: 1.15; }
.scheda .nome em { font-style: normal; color: var(--arancio); }
.scheda .spiega { font-size: 12px; color: var(--tenue); }
.scheda dl { margin: 0; display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--linea); padding-top: 10px; }
.scheda dl div { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }
.scheda dt { font-size: 12.5px; }
.scheda dd { margin: 0; font-weight: 700; color: var(--inchiostro); font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.maplibregl-ctrl-attrib { font-size: 10px; }
.maplibregl-ctrl-group { border-radius: 10px !important; }

/* ---------- telefono ---------- */
@media (max-width: 760px) {
  #mappa { inset: 0 0 34vh 0; }
  #cartello { left: 12px; right: 60px; top: 12px; font-size: 12.5px; padding: 8px 12px; }
  #pannello {
    top: auto; width: 100%; height: 86vh; border-right: 0; border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 30px rgba(20, 38, 58, .15);
    transform: translateY(calc(86vh - 34vh)); transition: transform .35s cubic-bezier(.2, .8, .2, 1);
    padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  }
  #pannello.aperto { transform: translateY(0); }
  #pannello.aperto ~ #mappa, body.aperto #mappa { bottom: 0; }
  #maniglia {
    display: flex; justify-content: center; align-items: center; border: 0; background: none;
    width: 100%; height: 22px; cursor: pointer; flex: none; margin-bottom: -10px;
  }
  #maniglia span { width: 44px; height: 5px; border-radius: 3px; background: #cfd6de; }
  .logo img { height: 32px; }
  .occhiello { margin-top: 12px; }
  h1 { font-size: 22px; }
  .numero.grande .valore { font-size: 38px; }
  .numero .valore { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
