/* Spesa Chiara · stile «D» (utile, sobria)
   Riferimenti: Zara (sobrieta', tipografia), NBA (numeri grandi), Amazon (azione chiara).
   File Figma «Spesa Chiara · direzioni grafiche», righe D (Home, Dove conviene, Lista,
   Chiedi, Dopo la spesa, Tu) e tavola «D · Fondamenta».
   Regole:
   - bianco, inchiostro, una linea da 1 px tra le cose: niente schede con ombra, niente vetro
   - verde per stato e scelta consigliata, rosso solo per le offerte, ambra per le stime deboli
   - un solo pulsante giallo per schermata
   - numeri grandi per i prezzi, etichette piccole in maiuscolo
   - margini laterali 24 px, accessibile: testo scalabile, contrasto, mai solo colore */

:root {
  --bg: #FFFFFF;
  --ink: #111111;
  --mute: #6B6B6B;
  --line: #E6E6E3;
  --soft: #F4F4F2;
  --green: #0F5C45;
  --green-soft: #E7F0EC;
  --yellow: #FFD24C;
  --on-yellow: #111111;
  --red: #C4122F;
  --amber: #A35400;
  --tick: #BDBDB8;
  --bar: #D8D8D4;
  --f: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --g: 24px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  /* nomi vecchi usati negli stili scritti nel codice */
  --surface: var(--bg); --surface-2: var(--soft); --muted: var(--mute); --ink-2: var(--mute);
  --mint: var(--green); --mint-soft: var(--green-soft); --tomato: var(--red); --tomato-soft: var(--soft);
  --sea: var(--green); --sea-soft: var(--green-soft); --lilac: var(--green); --lilac-soft: var(--soft); --lemon: var(--yellow);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111111; --ink: #F2F2EF; --mute: #9C9C97; --line: #2A2A28; --soft: #1D1D1B;
    --green: #6CC9A2; --green-soft: #17302A; --red: #FF7A8A; --amber: #E9A55A; --tick: #55554F; --bar: #3A3A36;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111111; --ink: #F2F2EF; --mute: #9C9C97; --line: #2A2A28; --soft: #1D1D1B;
  --green: #6CC9A2; --green-soft: #17302A; --red: #FF7A8A; --amber: #E9A55A; --tick: #55554F; --bar: #3A3A36;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.45 var(--f); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; }
svg[viewBox="0 0 24 24"] { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3, h4 { margin: 0; }

.app { height: 100dvh; display: grid; grid-template-rows: minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); max-width: 640px; margin: 0 auto; }

/* ------------------------------------------------ viste */
.views { position: relative; min-height: 0; }
.view { position: absolute; inset: 0; display: none; }
.view.active { display: grid; grid-template-columns: minmax(0, 1fr); }
.feed, .msg, .msg > * { min-width: 0; }
.view.page { overflow-y: auto; overscroll-behavior: contain; padding: calc(env(safe-area-inset-top) + 16px) var(--g) 32px; align-content: start; }
.view.chat { grid-template-rows: auto minmax(0, 1fr) auto; }
.view-inner { display: grid; gap: 0; align-content: start; }
.view-inner > *, .card-b > *, .card > * { min-width: 0; }
body[data-view="chat"] .tabs { display: none; }

/* titolo di schermata */
.title { padding: 0 0 14px; display: grid; gap: 2px; }
.title-r { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.title h1 { font-size: 30px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.title .sub { margin: 0; color: var(--mute); font-size: 14px; }
.nav, .backrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.nav { padding: calc(env(safe-area-inset-top) + 10px) 18px 6px; }
.backrow { margin: -4px 0 8px -6px; }
.back { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 6px; font-size: 15px; font-weight: 500; }
.back svg { width: 22px; height: 22px; }
.nav-sub { color: var(--mute); font-size: 13px; }
.link { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 6px 0; color: var(--green); font-weight: 600; font-size: 14px; text-decoration: none; }
.link svg { width: 18px; height: 18px; }
.label, .section-t, .group-h { font-size: 11px; font-weight: 500; color: var(--mute); text-transform: uppercase; letter-spacing: .1em; }
.section-row { display: flex; justify-content: space-between; align-items: baseline; padding: 22px 0 10px; }
.meta { color: var(--mute); font-size: 13px; }
.hair { height: 1px; background: var(--line); border: 0; margin: 0; }

/* numeri */
.bignum { font-size: 56px; font-weight: 600; letter-spacing: -.02em; line-height: 1.02; font-variant-numeric: tabular-nums; }
.bignum.m { font-size: 44px; }
.bignum small { font-size: .55em; margin-left: .12em; font-weight: 600; }
.big-num { font-size: 44px; font-weight: 600; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.num { font-weight: 600; font-variant-numeric: tabular-nums; }
.circa { color: var(--amber); }
.bignum .pre { font-size: .32em; font-weight: 500; color: var(--mute); margin: 0 .25em 0 0; letter-spacing: 0; }

/* prezzo: non piu' cartellino, solo tipografia */
.tag { display: inline-flex; align-items: baseline; font-weight: 600; font-size: 24px; letter-spacing: -.02em; line-height: 1.1; white-space: nowrap; color: var(--ink); font-variant-numeric: tabular-nums; }
.tag.sm { font-size: 17px; }
.tag.stima { color: var(--ink); }

/* affidabilita' */
.rel { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--mute); }
.rel .seg { display: inline-flex; gap: 3px; }
.rel .seg i { width: 14px; height: 4px; border-radius: 2px; background: var(--line); }
.rel[data-l="1"] .seg i:nth-child(-n+1) { background: var(--amber); }
.rel[data-l="2"] .seg i:nth-child(-n+2) { background: var(--amber); }
.rel[data-l="3"] .seg i { background: var(--green); }

/* ------------------------------------------------ pulsanti, chip, campi */
.btn { border: 1px solid var(--line); border-radius: 24px; padding: 12px 20px; font-weight: 600; font-size: 15px; background: var(--bg); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; text-decoration: none; transition: transform .15s var(--ease), background .15s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--yellow); border-color: var(--yellow); color: var(--on-yellow); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--green); padding-inline: 4px; }
.btn.w { width: 100%; }
.btn:disabled { opacity: .4; cursor: default; }
.mini { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 6px 12px; font-size: 13px; font-weight: 500; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 14px; font-size: 14px; font-weight: 500; min-height: 40px; white-space: nowrap; }
.chip:active { background: var(--soft); }
.chip.on { border-color: var(--ink); }

.inp, .field input, .add input { display: block; width: 100%; min-width: 0; border: 0; border-radius: 12px; padding: 13px 14px; font: inherit; background: var(--soft); color: var(--ink); }
.inp { margin-top: 6px; }
.inp:focus, .field input:focus, .add input:focus { outline: 2px solid var(--ink); outline-offset: 0; }
.field { display: flex; gap: 8px; padding: 0 0 14px; min-width: 0; }
.field .btn { min-height: 46px; }
.add { display: flex; gap: 8px; align-items: center; margin: 0 0 6px; }
.add-btn { flex: none; width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); display: grid; place-items: center; }
.add-btn svg { width: 20px; height: 20px; }

/* ------------------------------------------------ superfici: piatte, separate da una linea */
.card { position: relative; background: none; border-top: 1px solid var(--line); min-width: 0; max-width: 100%; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 18px 0 8px; }
.card-h h3 { font-size: 17px; font-weight: 600; }
.card-b { padding: 6px 0 18px; }
.card-f { display: flex; gap: 8px; flex-wrap: wrap; padding: 6px 0 18px; }
.msg .card { border-top: 0; }
.msg .card + .card { border-top: 1px solid var(--line); }
.empty { display: grid; gap: 6px; padding: 28px 0; border-top: 1px solid var(--line); }
.empty b { font-size: 17px; font-weight: 600; }

/* icone a colori disegnate: tolte */
.ic3, .pic, .app-ic, .chip img, .loc-pin { display: none !important; }

/* ------------------------------------------------ Oggi */
.top { display: flex; justify-content: space-between; align-items: center; padding: 0 0 14px; }
.brand { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.search { display: flex; align-items: center; gap: 10px; background: var(--soft); border-radius: 12px; padding: 0 4px 0 14px; min-height: 50px; }
.search > svg { width: 20px; height: 20px; color: var(--mute); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 15px; color: var(--ink); padding: 14px 0; outline: none; }
.search input::placeholder { color: var(--mute); }
.search .icon-btn { width: 42px; height: 42px; }
.loc { margin: 10px 0 0; color: var(--mute); font-size: 13px; }
.hero { margin-top: 18px; padding: 24px 0 26px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.hero .where { font-size: 16px; }
.hero .stat { font-size: 14px; color: var(--green); }
.hero .stat.weak { color: var(--amber); }
.hero .btn { margin-top: 10px; }
.hero .link { justify-self: start; }
.hero h2 { font-size: 30px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.strip { display: flex; gap: 12px; overflow-x: auto; scroll-padding-inline: var(--g); margin: 0 calc(-1 * var(--g)); padding: 0 var(--g) 6px; scroll-snap-type: x proximity; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.otile { flex: 0 0 150px; scroll-snap-align: start; background: var(--soft); border-radius: 12px; padding: 14px; display: grid; gap: 3px; align-content: start; position: relative; min-height: 150px; }
.otile .k { font-size: 11px; font-weight: 600; color: var(--red); text-transform: uppercase; letter-spacing: .1em; }
.otile .nm { font-size: 14px; font-weight: 500; line-height: 1.25; min-height: 36px; padding-right: 22px; }
.otile .pr { font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin-top: 6px; }
.otile .st { font-size: 12px; color: var(--mute); }
.otile .add-o { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); display: grid; place-items: center; font-size: 17px; line-height: 1; }
.otile .add-o.on { background: var(--green); border-color: var(--green); color: #fff; }
.otile .in { font-size: 11px; color: var(--green); font-weight: 600; }
.rows { display: grid; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; width: 100%; padding: 15px 0; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; text-decoration: none; color: inherit; }
.rows > .row:last-child { border-bottom: 1px solid var(--line); }
.row b { display: block; font-size: 15px; font-weight: 600; }
.row span.s { display: block; font-size: 13px; color: var(--mute); }
.row > svg { width: 18px; height: 18px; color: var(--mute); }
.row .count { font-size: 12px; font-weight: 600; color: #fff; background: var(--red); border-radius: 9px; padding: 1px 7px; margin-left: 6px; }
.row.cam { grid-template-columns: 48px 1fr auto; gap: 14px; cursor: pointer; }
.row .sq { width: 48px; height: 48px; border-radius: 10px; background: var(--soft); display: grid; place-items: center; }
.row .sq svg { width: 22px; height: 22px; }

/* ------------------------------------------------ lista */
.list { list-style: none; margin: 0; padding: 0; }
.group-h { padding: 20px 0 6px; display: block; }
.item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 13px 0; border-top: 1px solid var(--line); cursor: pointer; }
.item .nm { font-size: 15px; line-height: 1.3; }
.item .sub { font-size: 12px; color: var(--mute); display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; margin-top: 2px; }
.item .qty { font-size: 14px; color: var(--mute); white-space: nowrap; }
.tick { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--tick); display: grid; place-items: center; transition: background .2s, box-shadow .2s; }
.tick svg { width: 14px; height: 14px; color: #fff; stroke-width: 3; opacity: 0; transition: opacity .2s; }
.item.done .tick { background: var(--green); box-shadow: none; }
.item.done .tick svg { opacity: 1; }
.item.done .nm { text-decoration: line-through; color: var(--mute); }
.offer-note { color: var(--red); font-weight: 500; }
.note { color: var(--mute); }
.by { display: inline-flex; align-items: center; gap: 5px; }
.by .av { width: 16px; height: 16px; font-size: 9px; }
.av { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 600; font-size: 13px; position: relative; flex: none; }
.av .on { position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); border: 2px solid var(--bg); }
.progress { height: 4px; border-radius: 2px; background: var(--soft); overflow: hidden; margin: 4px 0 6px; }
.progress i { display: block; height: 100%; background: var(--green); transition: width .6s var(--ease); }
.progress.over i { background: var(--amber); }
.links { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: none; }
.links::-webkit-scrollbar { display: none; }
.cta-bar { position: sticky; bottom: -32px; margin: 18px calc(-1 * var(--g)) -32px; padding: 10px var(--g) 14px; background: var(--bg); border-top: 1px solid var(--line); display: grid; gap: 8px; z-index: 3; }
.cta-est { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; color: var(--mute); }
.cta-est b { color: var(--ink); font-size: 18px; font-weight: 600; white-space: nowrap; }
.cta-est b.circa { color: var(--amber); }
.bignum .pre { font-size: .32em; font-weight: 500; color: var(--mute); margin: 0 .25em 0 0; letter-spacing: 0; }
.list-card .card-f { padding-top: 14px; }

/* ------------------------------------------------ conversazione (Chiedi) */
.feed { overflow-y: auto; overflow-x: hidden; padding: 8px var(--g) 24px; overscroll-behavior: contain; }
.msg { margin: 0 0 20px; min-width: 0; max-width: 100%; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble { background: var(--soft); color: var(--ink); padding: 10px 14px; border-radius: 18px; max-width: 82%; white-space: pre-wrap; overflow-wrap: anywhere; animation: rise .25s var(--ease); }
.msg.assistant { animation: rise .3s var(--ease); }
.msg.assistant > * + * { margin-top: 10px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.say { margin: 0; max-width: 62ch; font-size: 16px; line-height: 1.45; }
.say strong { font-weight: 600; }
.say.small { color: var(--mute); font-size: 14px; }
.typing-wrap { display: flex; }
.typing { display: inline-flex; gap: 5px; padding: 12px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--mute); animation: dots 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }
.dock { padding: 8px 16px calc(env(safe-area-inset-bottom) + 12px); background: var(--bg); }
.composer { display: flex; align-items: flex-end; gap: 6px; border-radius: 24px; padding: 6px 6px 6px 8px; background: var(--soft); }
.composer:focus-within { outline: 2px solid var(--ink); }
.composer textarea { flex: 1; border: 0; background: transparent; resize: none; font: inherit; font-size: 15px; color: inherit; padding: 9px 2px; max-height: 140px; outline: none; }
.composer textarea::placeholder { color: var(--mute); }
.icon-btn, .send { width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; background: transparent; color: var(--mute); flex: none; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.rec { background: var(--red); color: #fff; }
.send { background: var(--ink); color: var(--bg); }
.send svg { width: 18px; height: 18px; stroke-width: 2.2; }

/* ------------------------------------------------ scelte */
.choice { padding: 6px 0 4px; border-top: 0; }
.grid-t { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 8px; }
@media (max-width: 420px) { .grid-t[data-cols="4"] { --cols: 2 !important; } }
.opt { position: relative; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 12px 10px; display: grid; justify-items: start; gap: 2px; text-align: left; font-weight: 500; font-size: 14px; line-height: 1.25; min-height: 56px; align-content: center; }
.opt small { display: block; font-size: 12px; color: var(--mute); font-weight: 400; margin-top: 2px; }
.opt.on { border-color: var(--ink); box-shadow: inset 0 0 0 .5px var(--ink); }
.opt.wide { grid-column: span 2; }
.choice .hint { font-size: 13px; color: var(--mute); margin: 10px 0 0; }
.logo { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--soft) !important; color: var(--ink) !important; font-weight: 600; font-size: 13px; flex: none; }

/* posizione e permessi */
.loc-hero { position: relative; height: 120px; background: var(--soft); overflow: hidden; border-radius: 12px; }
.loc-hero svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.loc-hero g { color: var(--bg) !important; }
.loc-dot { position: absolute; left: 50%; top: 52%; width: 18px; height: 18px; margin: -9px; border-radius: 50%; background: var(--green); border: 3px solid var(--bg); }
.perm-opts { display: grid; gap: 8px; padding: 12px 0 6px; }
.perm-opt { text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; }
.perm-opt .l { font-weight: 600; font-size: 15px; }
.perm-opt .d { font-size: 13px; color: var(--mute); line-height: 1.35; }
.perm-opt.chosen { border-color: var(--ink); box-shadow: inset 0 0 0 .5px var(--ink); }
.matrix { margin: 6px 0 12px; border-top: 1px solid var(--line); font-size: 13px; }
.matrix summary { padding: 12px 0; font-weight: 500; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.matrix summary::-webkit-details-marker { display: none; }
.matrix summary::after { content: '›'; transform: rotate(90deg); font-size: 18px; line-height: 1; color: var(--mute); }
.matrix[open] summary::after { transform: rotate(-90deg); }
.matrix table { width: 100%; border-collapse: collapse; }
.matrix th, .matrix td { padding: 8px 6px; text-align: center; border-top: 1px solid var(--line); }
.matrix th:first-child, .matrix td:first-child { text-align: left; padding-left: 0; }
.matrix th { font-size: 12px; color: var(--mute); font-weight: 500; }
.y { color: var(--green); font-weight: 600; } .n { color: var(--mute); font-weight: 600; } .p { color: var(--amber); font-weight: 600; }

/* anteprima notifiche */
.lock { padding: 12px; background: var(--soft); border-radius: 14px; display: grid; gap: 8px; }
.banner { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.banner b { display: block; font-size: 13px; font-weight: 600; }
.banner span { font-size: 13px; line-height: 1.35; }
.banner time { font-size: 11px; color: var(--mute); }
.checks { display: grid; padding: 4px 0 14px; }
.check-t { display: grid; grid-template-columns: 1fr 24px; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); font-size: 15px; font-weight: 500; cursor: pointer; }
.check-t small { display: block; color: var(--mute); font-size: 13px; font-weight: 400; }
.check-t input { width: 20px; height: 20px; accent-color: var(--green); }

/* ------------------------------------------------ dove conviene: mappa e scenari */
.map { height: 220px; background: var(--soft); position: relative; border-radius: 12px; overflow: hidden; isolation: isolate; z-index: 0; } /* i livelli di Leaflet restano dentro la mappa */
.map.short { height: 200px; }
.map .fallback { position: absolute; inset: 0; width: 100%; height: 100%; }
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg); display: grid; place-items: center; color: #fff; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.pin span { transform: rotate(45deg); font-weight: 600; font-size: 13px; }
.pin.dim { opacity: .4; filter: grayscale(.8); transform: rotate(-45deg) scale(.8); }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--green); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(15, 92, 69, .18); }
.leaflet-container { font: inherit; background: var(--soft); }
.leaflet-popup-content-wrapper { border-radius: 10px; box-shadow: none; border: 1px solid var(--line); }
.leaflet-popup-content { margin: 10px 12px; font-size: 14px; }
.route-anim { stroke-dasharray: 1600; stroke-dashoffset: 1600; animation: draw 1.2s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.scen-rail { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 12px 0 4px; scrollbar-width: none; }
.scen-rail::-webkit-scrollbar { display: none; }
.scen { flex: 0 0 88%; scroll-snap-align: start; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; text-align: left; }
.scen[aria-current="true"] { border-color: var(--ink); }
.scen .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 0; }
.scen .t { font-weight: 600; font-size: 17px; display: grid; gap: 2px; }
.scen .tag { font-size: 28px; }
.badge { justify-self: start; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--green); }
.badge.sea, .badge.lilac { color: var(--mute); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fact-s { background: var(--soft); border-radius: 10px; padding: 8px 10px; display: grid; }
.fact-s b { font-size: 16px; font-weight: 600; }
.fact-s span { font-size: 11px; color: var(--mute); }
.stops { display: grid; gap: 6px; }
.stop { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; font-size: 14px; }
.stop .n { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.stop small { display: block; color: var(--mute); font-size: 12px; }
.warn, .info { font-size: 13px; line-height: 1.35; display: block; }
.warn { color: var(--amber); }
.info { color: var(--mute); }
.dots-nav { display: flex; justify-content: center; gap: 6px; padding: 6px 0 2px; }
.dots-nav i { width: 6px; height: 6px; border-radius: 3px; background: var(--line); transition: width .3s var(--ease), background .3s; }
.dots-nav i.on { width: 18px; background: var(--ink); }
table.all { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
table.all td, table.all th { padding: 10px 4px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
table.all th { font-size: 11px; color: var(--mute); font-weight: 500; text-transform: uppercase; letter-spacing: .08em; border-top: 0; }
table.all td.r, table.all th.r { text-align: right; white-space: nowrap; }
table.all th:first-child, table.all td:first-child { width: 44%; overflow-wrap: anywhere; padding-left: 0; }
.diff-pos { color: var(--mute); } .diff-zero { color: var(--green); font-weight: 600; }
details.more { padding: 4px 0 10px; }
details.more summary { cursor: pointer; padding: 10px 0; color: var(--green); font-weight: 600; font-size: 14px; }
.open { color: var(--green); } .closed { color: var(--amber); }

/* ------------------------------------------------ comunita' */
.radar-wrap { position: relative; height: 130px; display: grid; place-items: center; background: var(--soft); border-radius: 12px; margin-top: 10px; }
.radar { position: relative; width: 52px; height: 52px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; z-index: 2; border: 1px solid var(--line); }
.radar-wrap .ring { position: absolute; width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid var(--green); animation: ripple 3s ease-out infinite; }
.radar-wrap .ring:nth-child(2) { animation-delay: 1s; } .radar-wrap .ring:nth-child(3) { animation-delay: 2s; }
.radar-wrap.done .ring { display: none; }
@keyframes ripple { from { transform: scale(1); opacity: .6; } to { transform: scale(3.2); opacity: 0; } }
.peer { position: absolute; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 600; border: 2px solid var(--bg); }
.peer.ans::after { content: '✓'; position: absolute; right: -4px; bottom: -4px; width: 14px; height: 14px; border-radius: 50%; background: var(--green); font-size: 9px; display: grid; place-items: center; border: 2px solid var(--bg); }
.result { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 12px; flex-wrap: wrap; }
.why { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--soft); font-size: 13px; color: var(--mute); }
.why b { color: var(--ink); font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0 0 14px; display: grid; }
.timeline li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; font-size: 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.timeline .t { font-size: 12px; color: var(--mute); }
.timeline li > .full { grid-column: 1 / -1; }
.timeline .av { width: 26px; height: 26px; font-size: 11px; }

/* ------------------------------------------------ negozio */
.store-hero { padding: 18px 0 8px; display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: center; background: none !important; color: var(--ink); }
.store-hero .logo { width: 52px; height: 52px; }
.store-hero h3 { font-size: 20px; font-weight: 700; }
.store-hero p { margin: 2px 0 0; color: var(--mute); font-size: 14px; }
.status-pill { display: inline-block; font-size: 13px; margin-top: 4px; }
.facts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; padding: 4px 0 10px; }
.fact { padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; display: grid; gap: 1px; }
.fact b { font-size: 11px; color: var(--mute); font-weight: 500; text-transform: uppercase; letter-spacing: .08em; }

/* ------------------------------------------------ menu */
.week { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(132px, 1fr); gap: 8px; overflow-x: auto; padding: 6px 0 14px; scrollbar-width: none; }
.week::-webkit-scrollbar { display: none; }
.day { background: var(--soft); border-radius: 12px; padding: 12px; display: grid; gap: 8px; align-content: start; }
.day h4 { font-size: 11px; color: var(--mute); font-weight: 500; text-transform: uppercase; letter-spacing: .08em; }
.dish { background: var(--bg); border: 0; border-radius: 10px; padding: 10px; font-size: 14px; font-weight: 500; line-height: 1.25; text-align: left; display: grid; gap: 4px; }
.dish .o { font-size: 11px; color: var(--red); font-weight: 600; }
.dish.off { background: transparent; color: var(--mute); font-weight: 400; }
.day-card .card-h { padding-bottom: 0; }
.slot { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; align-items: center; width: 100%; border: 0; border-top: 1px solid var(--line); background: transparent; padding: 13px 0; text-align: left; font-size: 15px; }
.slot:first-of-type { border-top: 0; }
.slot-l { font-size: 13px; color: var(--mute); }
.slot-v { font-weight: 500; color: var(--green); }
.slot.full .slot-v { color: var(--ink); }
.slot-m { font-size: 12px; color: var(--mute); }
.dish-row { grid-template-columns: 1fr auto; }

/* dispensa: tre stati */
.prow { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.prow .nm { font-weight: 500; }
.prow .sub { font-size: 13px; color: var(--mute); }
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--soft); border-radius: 10px; padding: 3px; gap: 3px; }
.seg3 button { border: 0; background: transparent; border-radius: 8px; padding: 8px 4px; font-size: 13px; font-weight: 500; color: var(--mute); }
.seg3 button.on { background: var(--bg); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.seg3 button[data-v="ho"].on { color: var(--green); }
.seg3 button[data-v="poco"].on { color: var(--amber); }
@media (min-width: 560px) { .prow { grid-template-columns: 1fr 290px; align-items: center; } }

/* famiglia */
.members { display: flex; gap: 16px; padding: 8px 0 14px; flex-wrap: wrap; }
.member { display: grid; justify-items: center; gap: 6px; font-size: 13px; width: 64px; text-align: center; }
.member .av { width: 48px; height: 48px; font-size: 18px; }
.invite { margin: 0 0 16px; border-radius: 12px; padding: 14px; display: grid; gap: 10px; background: var(--soft); }
.invite code { font-size: 28px; font-weight: 600; letter-spacing: .1em; font-family: var(--f); }
.feedline { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.feedline .av { width: 24px; height: 24px; font-size: 10px; }

/* ------------------------------------------------ Tu: grafici */
.wbars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; align-items: end; height: 120px; padding: 8px 0 4px; }
.wbar { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 6px; }
.wbar span { align-self: end; background: var(--bar); border-radius: 3px; min-height: 3px; }
.wbar:last-child span { background: var(--green); }
.wbar small { font-size: 10px; color: var(--mute); text-align: center; }
.bars { display: grid; gap: 10px; padding: 4px 0 14px; }
.bars .row { display: grid; grid-template-columns: 120px 1fr 64px; gap: 10px; align-items: center; font-size: 13px; padding: 0; border: 0; }
.bars .track { height: 4px; border-radius: 2px; background: var(--soft); overflow: hidden; }
.bars .fill { height: 100%; background: var(--green); }

/* ------------------------------------------------ dopo la spesa: speso contro stima */
.spent { display: grid; gap: 6px; padding: 6px 0 14px; }
.range { position: relative; height: 44px; margin-top: 8px; }
.range .base, .range .band { position: absolute; top: 14px; height: 4px; border-radius: 2px; }
.range .base { left: 0; right: 0; background: var(--soft); }
.range .band { background: var(--green); opacity: .35; }
.range .mark { position: absolute; top: 8px; width: 3px; height: 16px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); }
.range .lab { position: absolute; top: 26px; font-size: 12px; color: var(--mute); transform: translateX(-50%); white-space: nowrap; }
.range .lab.l { transform: none; }
.range .lab.r { transform: translateX(-100%); }
.verdict { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--green); }
.verdict svg { width: 18px; height: 18px; stroke-width: 2.2; }
.verdict.out { color: var(--amber); }
.verdict.weak { color: var(--mute); font-weight: 500; }

/* ------------------------------------------------ barra delle schede */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px 20px calc(env(safe-area-inset-bottom) + 10px); border-top: 1px solid var(--line); background: var(--bg); z-index: 5; }
.tabs button { border: 0; background: transparent; padding: 4px 2px; font-weight: 500; font-size: 11px; color: var(--mute); position: relative; display: grid; justify-items: center; gap: 4px; min-height: 48px; align-content: center; }
.tabs button svg { width: 22px; height: 22px; }
.tabs button[aria-current="page"] { color: var(--green); font-weight: 600; }
.tab-count { position: absolute; top: 0; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: 10px; font-weight: 600; display: grid; place-items: center; padding: 0 4px; }
.tab-count.red { background: var(--red); color: #fff; }

/* ------------------------------------------------ pannelli */
.sheet-wrap { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .32); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: relative; width: 100%; max-width: 640px; max-height: 92dvh; background: var(--bg); border-radius: 20px 20px 0 0; display: flex; flex-direction: column; animation: up .35s var(--ease); padding-bottom: env(safe-area-inset-bottom); }
@keyframes up { from { transform: translateY(60%); } }
.grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 0; flex: none; cursor: pointer; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; padding: 10px var(--g) 4px; }
.sheet-h h2 { font-size: 22px; font-weight: 700; }
.close { border: 0; background: none; color: var(--green); font-weight: 600; font-size: 14px; padding: 6px 0; }
.sheet-b { overflow-y: auto; padding: 4px var(--g) 20px; display: grid; gap: 0; }
@media (min-width: 760px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 20px; max-height: 86dvh; } }
.data-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.data-row:first-of-type { border-top: 0; }
.data-row b { display: block; font-size: 11px; color: var(--mute); font-weight: 500; text-transform: uppercase; letter-spacing: .08em; }
.data-row span { font-size: 15px; }
.data-row.missing span { color: var(--mute); }
.notes-l { list-style: none; margin: 0; padding: 0 0 10px; display: grid; }
.notes-l li { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding: 10px 0; font-size: 14px; }
.notes-l small { display: block; color: var(--mute); font-size: 12px; }

/* avvisi in app */
.toasts { position: fixed; top: calc(env(safe-area-inset-top) + 12px); left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 1200; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); border-radius: 14px; padding: 12px 16px; animation: drop .3s var(--ease); cursor: pointer; }
.toast b { display: block; font-size: 13px; font-weight: 600; }
.toast span { font-size: 14px; line-height: 1.35; }
@keyframes drop { from { transform: translateY(-12px); opacity: 0; } }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (min-width: 900px) {
  .map { height: 300px; }
  .scen { flex-basis: 48%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (prefers-contrast: more) {
  :root { --line: #9A9A95; --mute: #3D3D3A; --tick: #6B6B6B; }
}

/* liste: selettore in alto nella scheda Lista (8/11/2026) */
.lists-bar { padding: 0 0 14px; }
.lchip .n { font-size: 12px; font-weight: 600; color: var(--mute); margin-left: 2px; }
.lchip.on { font-weight: 600; }
.lchip.on .n { color: var(--ink); }
/* account: vantaggi in 2-3 righe, errore */
.acc-points { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 15px; }
.acc-points li { padding-left: 14px; position: relative; }
.acc-points li::before { content: ''; position: absolute; left: 0; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.acc-err { color: var(--red); margin: 0 0 10px; }
