/* HomeKeeper — modulo Scorte. Tasti grandi, pastelli vivaci, effetto "tasto fisico".
   Campi editabili sempre >= 16px (sotto, iPhone ingrandisce la pagina al tocco). */

:root {
  --sc-font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}

#app.sc-app {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  font-family: var(--sc-font);
}
/* le classi con display:flex/grid scavalcherebbero l'attributo hidden */
.sc-app [hidden] { display: none !important; }

/* ---- barra in alto ---------------------------------------------------- */
.sc-top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: var(--bg);
}
.sc-top h1 { flex: 1; margin: 0; font-size: 1.35rem; text-align: center; line-height: 1.2; }
.sc-top .sc-nav { min-width: 76px; }
.sc-top span.sc-nav { display: block; }

.sc-main {
  flex: 1; display: flex; flex-direction: column;
  width: 100%; max-width: 640px; margin: 0 auto;
  padding: 6px 16px calc(28px + env(safe-area-inset-bottom, 0px));
}

/* ---- tasti ------------------------------------------------------------ */
.sc-btn, .sc-key { --kb: var(--card); --ks: var(--border); --ki: var(--text); }
.c-giallo  { --kb: #FFD84D; --ks: #D4A91A; --ki: #3B2F00; }
.c-verde   { --kb: #7BE0A0; --ks: #3FB56E; --ki: #0B3A1E; }
.c-corallo { --kb: #FF9B8A; --ks: #E0664F; --ki: #4A1409; }
.c-azzurro { --kb: #7CCBFF; --ks: #3E9BDB; --ki: #082E4A; }

.sc-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 60px; margin: 6px 0 14px; padding: 12px 18px;
  border: 0; border-radius: 20px;
  font: inherit; font-size: 1.25rem; font-weight: 700; line-height: 1.2; text-align: center;
  text-decoration: none; cursor: pointer;
  background: var(--kb); color: var(--ki); box-shadow: 0 6px 0 var(--ks);
  transition: transform .06s, box-shadow .06s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.sc-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ks); }
.sc-btn:disabled { opacity: .5; }
.sc-btn.big { min-height: 76px; font-size: 1.45rem; margin-top: 22px; }
.sc-btn.small {
  width: auto; min-height: 46px; margin: 0; padding: 8px 14px;
  font-size: 1.05rem; border-radius: 14px; box-shadow: 0 4px 0 var(--ks);
}
.sc-btn.small:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ks); }
.sc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sc-two .sc-btn { font-size: 1.08rem; }
.sc-two > :only-child { grid-column: 1 / -1; }

/* ---- home a 4 tasti --------------------------------------------------- */
.sc-status { text-align: center; font-size: 1.05rem; margin: 2px 0 16px; min-height: 2.4em; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.sc-pill {
  display: inline-block; padding: 8px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-weight: 700;
}
.sc-pill.warn { background: #FFD84D; border-color: #D4A91A; color: #3B2F00; }
.sc-grid {
  flex: 1; display: grid; gap: 18px;
  grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  min-height: 340px; padding-bottom: 10px;
}
.sc-key {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border-radius: 30px; text-decoration: none;
  font-size: 1.6rem; font-weight: 800;
  background: var(--kb); color: var(--ki); box-shadow: 0 9px 0 var(--ks);
  transition: transform .06s, box-shadow .06s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.sc-key .ic { font-size: 3.4rem; line-height: 1; }
.sc-key:active { transform: translateY(7px); box-shadow: 0 2px 0 var(--ks); }

/* ---- elenchi ---------------------------------------------------------- */
.sc-search { font-size: 20px; padding: 14px 16px; border-radius: 18px; border-width: 2px; margin-bottom: 12px; }
.sc-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; margin-bottom: 6px; -webkit-overflow-scrolling: touch; }
.sc-chip {
  flex: none; padding: 8px 14px; border-radius: 999px;
  border: 2px solid var(--border); background: var(--card); color: var(--text);
  font: inherit; font-size: 1rem; font-weight: 600; cursor: pointer;
}
.sc-chip.on { background: #FFD84D; border-color: #D4A91A; color: #3B2F00; }

.sc-list { display: flex; flex-direction: column; gap: 10px; }
.sc-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 70px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  color: var(--text); text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sc-row:active { background: var(--bg); }
.sc-row .ic { flex: none; width: 2.4rem; font-size: 2rem; text-align: center; line-height: 1; }
.sc-row .bd { flex: 1; min-width: 0; }
.sc-row .qt { flex: none; font-size: 1.2rem; font-weight: 700; white-space: nowrap; text-align: right; }
.sc-row.done .nm { text-decoration: line-through; color: var(--muted); }
.sc-row.late { border-left: 6px solid var(--danger); }
.sc-app .nm { font-size: 1.15rem; font-weight: 700; overflow-wrap: anywhere; }
.sc-app .sub { font-size: .92rem; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }

.sc-badge {
  display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 999px;
  font-size: .78rem; font-weight: 700; vertical-align: middle;
  background: #FF9B8A; color: #4A1409;
}
.sc-badge.warn { background: #FFD84D; color: #3B2F00; }
.sc-warn { color: var(--danger); font-weight: 700; }
.sc-h { font-size: 1.1rem; font-weight: 700; margin: 20px 4px 10px; }
.sc-h0 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.sc-empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 1.1rem; }
.sc-hint { text-align: center; font-size: 1.1rem; color: var(--muted); margin: 12px 0 0; min-height: 1.4em; }
.sc-hint b { color: var(--text); }
.sc-soft { font-weight: 400; color: var(--muted); font-size: .9em; }
.sc-center { text-align: center; }

.sc-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  padding: 14px 16px; margin-bottom: 12px;
}

/* ---- scheda prodotto -------------------------------------------------- */
.sc-prod { display: flex; align-items: center; gap: 14px; margin: 4px 0 14px; }
.sc-prod .ic { font-size: 3rem; line-height: 1; flex: none; }
.sc-prod .nm { font-size: 1.5rem; }
.sc-total { font-size: 2.2rem; font-weight: 800; line-height: 1.2; }
.sc-where + .sc-where { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }
.sc-where .hd { display: flex; justify-content: space-between; gap: 10px; font-size: 1.1rem; }
.sc-where ul { margin: 6px 0 0; padding-left: 1.2em; color: var(--muted); }
.sc-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 14px; }
.sc-dl dt { color: var(--muted); }
.sc-dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.sc-mov { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .95rem; }
.sc-mov:last-child { border-bottom: 0; }
.sc-mov .d { color: var(--muted); white-space: nowrap; }
.sc-mov .v { margin-left: auto; font-weight: 700; white-space: nowrap; }
.sc-mov .plus { color: var(--ok); }
.sc-mov .minus { color: var(--danger); }

/* ---- moduli: quantità, posizioni, data -------------------------------- */
.sc-label { display: block; margin: 20px 2px 8px; font-size: 1.15rem; font-weight: 700; color: var(--text); }
.sc-form input, .sc-form textarea, .sc-card input { font-size: 18px; border-radius: 14px; }

.sc-stepper { display: grid; grid-template-columns: 76px 1fr 76px; gap: 12px; align-items: center; }
.sc-stepper .sc-btn { min-height: 76px; margin: 0; font-size: 2.4rem; }
.sc-stepper input, .sc-amount input {
  height: 76px; padding: 8px; text-align: center;
  font-size: 2.1rem; font-weight: 700; border-radius: 18px; border-width: 2px;
}
.sc-amount { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.sc-amount .u { font-size: 1.6rem; font-weight: 700; min-width: 2.2em; }
.sc-quick { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.sc-locs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.sc-loc {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 88px; padding: 10px 8px;
  border: 3px solid var(--border); border-radius: 18px;
  background: var(--card); color: var(--text);
  font: inherit; font-size: 1.02rem; font-weight: 700; text-align: center; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sc-loc:disabled { opacity: .45; }
.sc-loc .ic { font-size: 1.8rem; line-height: 1.1; }
.sc-loc .q { font-size: .88rem; font-weight: 600; color: var(--muted); }
.sc-loc.on { border-color: #3FB56E; background: #E4F8EC; color: #0B3A1E; box-shadow: 0 4px 0 #3FB56E; }
.sc-locs.corallo .sc-loc.on { border-color: #E0664F; background: #FFE9E5; color: #4A1409; box-shadow: 0 4px 0 #E0664F; }
.sc-loc.on .q { color: inherit; }
.sc-choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.sc-date { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.sc-date input {
  min-width: 0; height: 62px; font-size: 1.3rem; border-radius: 16px; border-width: 2px;
  -webkit-appearance: none; appearance: none; background: var(--card); color: var(--text);
}

.sc-more { margin-top: 10px; }
.sc-more summary { padding: 14px 2px; font-size: 1.1rem; font-weight: 700; cursor: pointer; }

/* ---- lista spesa ------------------------------------------------------ */
.sc-addbar { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; margin-bottom: 8px; }
.sc-addbar input { height: 58px; font-size: 18px; border-radius: 16px; border-width: 2px; }
.sc-addbar .sc-btn { min-height: 58px; min-width: 58px; font-size: 1.6rem; }
.sc-check {
  flex: none; width: 52px; height: 52px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--border); border-radius: 14px; background: var(--card);
  font-size: 1.7rem; cursor: pointer;
}
.sc-row.done .sc-check { border-color: #3FB56E; background: #E4F8EC; }

/* ---- impostazioni ----------------------------------------------------- */
.sc-toggle { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.sc-toggle .bd { flex: 1; min-width: 0; }
.sc-switch {
  flex: none; position: relative; width: 66px; height: 40px; padding: 0;
  border: 0; border-radius: 999px; background: var(--border); cursor: pointer;
}
.sc-switch::after {
  content: ''; position: absolute; top: 5px; left: 5px; width: 30px; height: 30px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .15s;
}
.sc-switch.on { background: #3FB56E; }
.sc-switch.on::after { left: 31px; }
.sc-days { width: 76px !important; height: 52px; text-align: center; font-size: 1.4rem !important; font-weight: 700; }

.sc-locedit { display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; align-items: center; }
.sc-locedit .ic-in { padding: 6px; text-align: center; font-size: 1.5rem; }
.sc-locfoot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sc-loccard.off { opacity: .65; }
.sc-storeedit { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.sc-storemerge { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.sc-storemerge .sc-label { margin-top: 0; }
.sc-storemerge select { width: 100%; font-size: 16px; padding: 10px; border-radius: 12px; }
.sc-storemerge .sub { margin: 6px 0 10px; }

/* ---- foto prodotto ---------------------------------------------------- */
.sc-thumb { width: 2.4rem; height: 2.4rem; object-fit: contain; border-radius: 8px; background: #fff; vertical-align: middle; }
.sc-prod .sc-thumb { width: 3.6rem; height: 3.6rem; border-radius: 12px; }
.sc-off { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 6px; }
.sc-off img { width: 72px; height: 72px; object-fit: contain; border-radius: 12px; background: #fff; border: 1px solid var(--border); }
.sc-off .sub { flex: 1; min-width: 8em; }
.pf-off .sc-hint { text-align: left; }

/* ---- scanner a tutto schermo ------------------------------------------ */
.sc-scanbtn { min-height: 72px; font-size: 1.35rem; margin-top: 4px; }
body.sc-noscroll { overflow: hidden; }
.sc-scan {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg); overflow: hidden;
  font-family: var(--sc-font);
}
.sc-scan video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sc-scan-frame {
  position: absolute; left: 7%; right: 7%; top: 50%; height: 30%;
  transform: translateY(-50%);
  border: 4px solid rgba(255, 255, 255, .92); border-radius: 22px;
  box-shadow: 0 0 0 100vmax rgba(20, 24, 32, .45);
  transition: border-color .15s;
}
.sc-scan-frame i {
  position: absolute; left: 6%; right: 6%; top: 50%; height: 3px; border-radius: 2px;
  background: #FF5A4A; box-shadow: 0 0 10px #FF5A4A;
  animation: sc-laser 1.8s ease-in-out infinite;
}
.sc-scan.hit .sc-scan-frame { border-color: #7BE0A0; }
.sc-scan.hit .sc-scan-frame i { display: none; }
@keyframes sc-laser { 0%, 100% { transform: translateY(-34px); } 50% { transform: translateY(34px); } }
.sc-scan-top {
  position: absolute; left: 0; right: 0; top: 0; text-align: center;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 12px;
}
.sc-scan-msg {
  display: inline-block; max-width: 100%; padding: 10px 16px; border-radius: 16px;
  background: rgba(20, 24, 32, .72); color: #fff;
  font-size: 1.1rem; font-weight: 700; line-height: 1.35;
}
.sc-scan-msg.err { background: #FFE9E5; color: #4A1409; }
.sc-scan-bottom {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 12px 16px calc(18px + env(safe-area-inset-bottom, 0px));
}
.sc-scan-acts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.sc-scan-manual {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-bottom: 12px;
  padding: 12px; border-radius: 18px; background: var(--card); border: 1px solid var(--border);
}
.sc-scan-manual input { height: 54px; font-size: 20px; border-radius: 14px; border-width: 2px; }
.sc-scan [hidden] { display: none !important; }
.sc-scan.nocam .sc-scan-frame { display: none; }
.sc-scan.nocam .sc-scan-top { position: relative; }

/* 0.9.1: niente emoji sui prodotti, solo foto; senza foto lo spazio sparisce */
.sc-row .ic:empty, .sc-prod .ic:empty { display: none; }
.sc-row .ic:not(:empty) { width: 3rem; }
.sc-row .ic .sc-thumb { width: 3rem; height: 3rem; }

/* 0.9.2: prodotti a durata */
.sc-use { border-left: 6px solid #7CCBFF; }
.sc-use .sub b { color: var(--text); }

/* 0.9.3: prezzi */
.sc-chips.sc-wrap { flex-wrap: wrap; overflow: visible; }
.sc-price-line { display: grid; grid-template-columns: 5.6em auto 1fr; gap: 10px; align-items: baseline; padding: 5px 0; }
.sc-price-line b { font-size: 1.15rem; }
.sc-price-line .sub { text-align: right; margin: 0; }
.sc-app input[aria-label="Nome del negozio"] { margin-top: 10px; font-size: 18px; border-radius: 14px; }

/* 0.9.4: scontrini */
.sc-rthumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.sc-rthumb { position: relative; width: 96px; }
.sc-rthumb img { width: 96px; height: 130px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); display: block; }
.sc-rthumb .sc-btn { position: absolute; top: 4px; right: 4px; min-height: 34px; padding: 2px 9px; }
.sc-rline { padding: 12px 14px; }
.sc-rline.off { opacity: .6; }
.sc-rl-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.sc-rl-top code { font-size: .95rem; overflow-wrap: anywhere; }
.sc-rl-sel { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.sc-rl-sel select { flex: 1; min-width: 0; font-size: 16px; padding: 10px; border-radius: 12px; }
.sc-rline input { margin-top: 8px; font-size: 16px; border-radius: 12px; }
.sc-badge.ok { background: #7BE0A0; color: #0B3A1E; }

/* 0.9.6: contenuto della confezione, prezzo al kg ricavato, giro «Confronta», In uso */
.sc-pack { display: grid; grid-template-columns: 1fr 5.5em; gap: 8px; align-items: center; }
.sc-pack select, .sc-select { font-size: 16px; padding: 10px; border-radius: 12px; }
.sc-derived { text-align: center; font-size: 1.15rem; margin: 8px 0 0; }
.sc-derived b { font-size: 1.3rem; }
.sc-rank { gap: 10px; }
.sc-rank .bd { color: inherit; text-decoration: none; }
.sc-rank .qt { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 1.05rem; }
.sc-rank .qt .sub { font-size: .85rem; font-weight: 600; margin: 0; }
.sc-rank.best { border: 2px solid #3FB56E; box-shadow: inset 6px 0 0 #3FB56E; }
.sc-rank > .sc-btn.small { flex: none; min-height: 40px; padding: 4px 10px; }
.sc-usebtn { margin-top: 10px; }
.sc-price-line b small, .sc-mov .v small { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); }
/* 0.9.7: errore della lettura scontrino, visibile finché non si riprova */
.sc-err { border: 2px solid var(--danger); }
.sc-err .nm { font-weight: 700; margin-bottom: 4px; }
/* 0.9.7: foto del prodotto a tutto schermo */
.sc-zoom { position: relative; border: 0; padding: 0; background: none; cursor: zoom-in; }
.sc-prod .sc-zoom .sc-thumb { width: 5rem; height: 5rem; }
.sc-zoom-ic { position: absolute; right: -6px; bottom: -6px; font-size: .85rem; line-height: 1; padding: 4px; border-radius: 50%;
  background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.sc-viewer { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: var(--bg); font-family: var(--sc-font); }
.sc-viewer-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
.sc-viewer-top .nm { flex: 1; min-width: 0; font-weight: 700; font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-viewer-img { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 8px 16px; -webkit-overflow-scrolling: touch; }
.sc-viewer-img img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; border-radius: 12px; cursor: zoom-in; }
.sc-viewer.zoom .sc-viewer-img { display: block; }
.sc-viewer.zoom .sc-viewer-img img { max-width: none; max-height: none; border-radius: 0; cursor: zoom-out; }
.sc-viewer-note { text-align: center; color: var(--muted); padding: 8px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
/* 0.9.8: posizione per riga dello scontrino, sposta */
.sc-rl-where { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.sc-rl-where .sub { flex: none; max-width: 42%; margin: 0; }
.sc-rl-where select { flex: 1; min-width: 0; font-size: 16px; padding: 10px; border-radius: 12px; }
.sc-rl-all { margin: 4px 0 14px; }
.sc-where .hd b { margin-left: auto; }
.sc-where .hd .sc-movebtn { min-height: 34px; padding: 4px 10px; font-size: .9rem; }
.sc-moveform { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.pf-move { margin-top: 10px; }

/* 0.9.9: torta «quanto resta» (colorata) vs «usato» (grigia) nella riga dei prodotti che si consumano poco alla volta */
:root { --pie-ok: #3FB56E; --pie-warn: #E0A500; --pie-low: #E0664F; --pie-used: #E3E7EF; }
@media (prefers-color-scheme: dark) { :root { --pie-ok: #57C983; --pie-warn: #E6B94D; --pie-low: #F08A73; --pie-used: #39414f; } }
.sc-pie { flex: none; width: 34px; height: 34px; }
.sc-pie svg { width: 34px; height: 34px; display: block; }
.sc-pie .bg { fill: var(--pie-used); }
.sc-pie .sl { fill: none; stroke-width: 20; }
.sc-pie-ok .sl { stroke: var(--pie-ok); }
.sc-pie-warn .sl { stroke: var(--pie-warn); }
.sc-pie-low .sl { stroke: var(--pie-low); }

/* 0.9.10: tipo di utilizzo bloccato (unità diversa con giacenza): spento ma toccabile per la spiegazione */
.sc-loc-off { opacity: .5; }
.sc-top .sc-save-top { flex: none; }

/* 0.9.11: correggi la giacenza (rettifica) */
.sc-adjust-grid { display: grid; grid-template-columns: 1fr 5.5em; gap: 8px 10px; align-items: center; }
.sc-adjust-grid input { font-size: 18px; text-align: center; }

/* 0.9.12: azioni per posizione (Correggi/Sposta/Butta) su una riga; butta e annulla */
.sc-where-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sc-where-acts .sc-btn { flex: none; }

/* 0.9.14: banner promemoria «da usare presto» in home */
.sc-remind { display: block; text-decoration: none; color: var(--text); background: #FFF3D6; border: 2px solid #E6B94D; border-radius: 16px; padding: 12px 14px; margin: 0 0 12px; }
.sc-remind.late { background: #FFE4DE; border-color: #E0664F; }
.sc-remind .nm { font-weight: 700; }
.sc-remind .sub { color: var(--muted); margin-top: 3px; }
@media (prefers-color-scheme: dark) { .sc-remind { background: #3a3318; } .sc-remind.late { background: #3a201b; } }

/* 0.9.15 — ⬇️ Usa, contenuto variabile: «oppure le ho ricontate».
   Le due strade (quante ne usi / quante ne restano) si escludono: quella spenta si attenua. */
.sc-dim { opacity: .42; transition: opacity .15s; }
.sc-recount { margin-top: 18px; padding: 14px; border: 3px dashed var(--border); border-radius: 18px; opacity: .42; transition: opacity .15s, border-color .15s; }
.sc-recount.on { opacity: 1; border-style: solid; border-color: #F08A5D; background: #FFF4EE; }
.sc-recount .or { text-align: center; font-size: .95rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: -4px 0 10px; }
.sc-recount .sc-label { margin-top: 0; }
.sc-recount .sc-hint { margin-top: 10px; }
@media (prefers-color-scheme: dark) { .sc-recount.on { background: #3a2a1f; } }

/* 0.9.16 — scelta a due tasti (sotto il minimo: in lista da solo / chiedimelo) */
.sc-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.sc-pick {
  min-height: 62px; padding: 10px 8px;
  border: 3px solid var(--border); border-radius: 16px; background: var(--card); color: var(--text);
  font: inherit; font-size: .98rem; font-weight: 700; text-align: center; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sc-pick.on { border-color: #3FB56E; background: #E4F8EC; color: #0B3A1E; box-shadow: 0 4px 0 #3FB56E; }
@media (prefers-color-scheme: dark) { .sc-pick.on { background: #1d3a28; color: #d6f5e2; } }

/* 0.9.17 — revisione scontrino: quanti pezzi ci sono in questa confezione (contenuto variabile) */
.sc-rl-pcs { margin-top: 8px; }
.sc-rl-pcs input { width: 90px; text-align: center; font-weight: 700; }
.sc-rl-pcs-note { margin-top: 4px; }

/* 0.9.18 — 🔍 Cerca → 🧾 Ultimo scontrino: negozio e data in testa, «+N dallo scontrino» su ogni riga */
.sc-rc-head { margin: 4px 2px 10px; font-size: 1rem; color: var(--muted); }
.sc-rc-head b { color: var(--text); }
.sc-rc-in { color: #2E9A5B; font-weight: 700; }
@media (prefers-color-scheme: dark) { .sc-rc-in { color: #7BE0A0; } }

/* 0.9.19 — Modifica: codice a barre con 📷 accanto al campo */
/* il campo resta uguale agli altri del form; il tasto è alto quanto il campo */
.pf-codebar { margin-bottom: 0; }
.sc-form .pf-codebar input { height: auto; font-size: 18px; border-radius: 14px; border-width: 1px; }
.sc-form .pf-codebar .sc-btn { min-height: 48px; min-width: 64px; margin: 0; font-size: 1.4rem; }

/* 0.9.20 — intestazione: ‹ indietro + 🏠 home Scorte affiancati.
   0.9.21 — griglia «1fr auto 1fr»: il titolo corto resta al centro, quello lungo («🧾 Controlla lo scontrino») prende
   tutto lo spazio tra i tasti invece di finire su 4 righe schiacciato da uno spazio vuoto riservato a destra. */
.sc-top { display: grid; grid-template-columns: 1fr auto 1fr; }
.sc-top > :first-child { justify-self: start; }
.sc-top > :last-child { justify-self: end; }
.sc-top h1 { flex: none; }
.sc-navgrp { display: flex; gap: 6px; flex: none; }
.sc-top .sc-navgrp .sc-nav { min-width: 50px; padding-left: 0; padding-right: 0; }
.sc-top span.sc-navpad { min-width: 0; }

/* 0.9.22 — scheda prodotto: riquadro Open Food Facts (scheda completa salvata sul server) */
.sc-offcard > summary { cursor: pointer; list-style: none; }
.sc-offcard > summary::-webkit-details-marker { display: none; }
.sc-offcard > summary::after { content: ' ›'; color: var(--muted); }
.sc-offcard[open] > summary::after { content: ' ⌄'; }
.sc-nsrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 10px; }
.sc-ns { padding: 4px 10px; border-radius: 999px; font-weight: 800; font-size: .9rem; color: #fff; background: #888; }
.sc-ns.ns-a { background: #038141; } .sc-ns.ns-b { background: #85BB2F; } .sc-ns.ns-c { background: #E6A700; }
.sc-ns.ns-d { background: #EE8100; } .sc-ns.ns-e { background: #E63E11; }
.sc-ns.nova-1 { background: #00AA00; } .sc-ns.nova-2 { background: #C4B000; } .sc-ns.nova-3 { background: #FF6600; } .sc-ns.nova-4 { background: #E60000; }
.sc-offing { margin-top: 10px; font-size: .95rem; line-height: 1.4; }
.sc-nut { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: .95rem; }
.sc-nut caption { text-align: left; font-weight: 700; padding-bottom: 4px; }
.sc-nut td { padding: 3px 0; border-bottom: 1px solid var(--border); }
.sc-nut td:last-child { text-align: right; font-weight: 700; }
.sc-offall { margin-top: 10px; }
.sc-offall > summary { cursor: pointer; font-weight: 700; }
.sc-offkv dd { word-break: break-word; font-size: .85rem; }

/* 0.9.22 — 🏪 Negozi: riga della posizione (📍 Sono qui · 🗺️ Mappe) */
.sc-storepos { margin-top: 8px; gap: 8px; flex-wrap: wrap; }

/* 0.9.23 — scheda del negozio */
.sc-storeic { font-size: 1.6rem; }
.sc-row-flat { box-shadow: none; border: 0; border-top: 1px solid var(--border); border-radius: 0; margin: 0; padding: 10px 0; background: transparent; }
.sc-row-flat:first-of-type { border-top: 0; }
.sc-cardbox .bd { margin-top: 6px; }
.sc-cardimg { display: block; width: 100%; max-height: 240px; object-fit: contain; border-radius: 14px; background: #fff; border: 1px solid var(--border); cursor: zoom-in; }
.sc-cardnum { margin-top: 10px; font: 700 1.5rem/1.2 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .06em; text-align: center; user-select: all; }
/* a tutto schermo: sfondo bianco anche col tema scuro, perché lo scanner della cassa legga il codice */
.sc-cardfull { position: fixed; inset: 0; z-index: 100; background: #fff; color: #111; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 20px; }
.sc-cardfull img { max-width: 100%; max-height: 70vh; object-fit: contain; }
.sc-cardfull .n { font: 700 1.8rem/1.2 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .08em; }
.sc-cardfull .sub { color: #666; }
.sc-vd { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .8rem; font-weight: 800; background: #EEF0F4; color: #444; }
.sc-vd.ok { background: #E4F8EC; color: #0B6B2E; }
.sc-vd.bad { background: #FDE8E4; color: #A3260E; }
.sc-vd.soft { background: transparent; color: var(--muted); padding-left: 0; }
.sc-bars { display: flex; align-items: flex-end; gap: 8px; height: 130px; margin-top: 12px; }
.sc-bars .b { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; }
.sc-bars i { display: block; width: 100%; min-height: 2px; border-radius: 6px 6px 2px 2px; background: #7BC4F2; }
.sc-bars em { font-style: normal; font-size: .72rem; color: var(--muted); white-space: nowrap; }
.sc-bars span { font-size: .8rem; color: var(--muted); }
.sc-herebox { margin-top: 10px; }
.sc-herecard { display: block; text-decoration: none; color: var(--text); border: 3px solid #7BC4F2; }
.sc-herecard .nm { font-weight: 700; }
.sc-herebtn { width: 100%; }
@media (prefers-color-scheme: dark) {
  .sc-vd { background: #2a2e36; color: #ccc; } .sc-vd.ok { background: #1d3a28; color: #9be3b6; } .sc-vd.bad { background: #3a201b; color: #f4a894; }
}

/* 0.9.25 — elenchi prodotti divisi in «In casa» e «Non in casa» */
.sc-listh { margin: 14px 2px 6px; }
.sc-listh:first-child { margin-top: 4px; }

/* 0.9.26 — card «Sei da…»: parte che apre la scheda + tasto della carta fedeltà */
.sc-herelink { display: block; text-decoration: none; color: inherit; }
.sc-herecard .sc-locfoot { margin-top: 10px; }
.sc-herecardbtn { width: 100%; }

/* ---- 0.9.28: categorie e scadenza dopo l'apertura ------------------------ */
.sc-row a.bd { color: inherit; text-decoration: none; }
.sc-choice.three { grid-template-columns: repeat(3, 1fr); }
.sc-form .sc-select, .sc-catform .sc-select, .sc-card .sc-select {
  width: 100%; min-height: 52px; font-size: 18px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--card); color: var(--text);
}
/* «aperta il … ✎»: sembra testo, si tocca per cambiare la data */
.sc-linkbtn {
  display: inline; padding: 0; margin: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
  text-decoration: underline dotted; text-underline-offset: 3px;
}
.sc-opened-edit { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; vertical-align: middle; }
.sc-opened-edit input {
  height: 46px; font-size: 16px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); padding: 0 8px;
}
.sc-opened-edit .sc-btn.small { min-height: 42px; padding: 4px 12px; }
.sc-use .sc-usedate { font-weight: 700; }
.sc-openedon { margin-top: 12px; }
.sc-openedon .sc-label { margin-top: 0; }
.sc-openedon input {
  width: 100%; height: 56px; font-size: 18px; border-radius: 14px; border: 2px solid var(--border);
  -webkit-appearance: none; appearance: none; background: var(--card); color: var(--text);
}
.sc-openedon .sub { margin-top: 6px; }
/* lista spesa per corsie */
.sc-cath { margin: 14px 6px 6px; font-size: .82rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
/* elenco categorie: riga + frecce per l'ordine */
.sc-catrow { margin-bottom: 8px; padding: 10px 10px 10px 14px; }
.sc-catrow .bd { color: inherit; text-decoration: none; }
.sc-catrow.off { opacity: .6; }
.sc-updown { display: flex; flex-direction: column; gap: 6px; }
.sc-updown .sc-btn.small { min-height: 38px; min-width: 44px; padding: 2px 8px; font-size: .95rem; box-shadow: 0 3px 0 var(--ks); }
.sc-catprods { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sc-catprods a {
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg);
  color: var(--text); text-decoration: none; font-size: .95rem;
}

/* ---- 0.9.29: Cerca → «Cosa cerchi?» (categoria) e «Dove cerchi?» (posizioni) -------- */
.sc-filter { margin: 0 0 4px; }
.sc-flabel { display: block; margin: 4px 4px 6px; font-size: 1rem; font-weight: 700; color: var(--muted); }
.sc-select.sc-catfilter {
  width: 100%; min-height: 52px; margin-bottom: 12px; font-size: 18px; border: 2px solid var(--border); border-radius: 18px;
  background: var(--card); color: var(--text);
}

/* ---- 0.9.30: elenco degli scontrini letti (pagina 🧾 Scontrino) ----------------------- */
.sc-rclist { margin-top: 6px; }
.sc-rcrow { margin-bottom: 8px; }
.sc-rcrow .qt { color: var(--muted); font-size: 1.5rem; }
/* ⏳ In uso: nome a tutta larghezza, sotto «da N giorni» e ✓ Finito (su telefono il nome finiva in una colonna stretta) */
.sc-userow { flex-wrap: wrap; row-gap: 8px; margin-bottom: 10px; }
.sc-userow .bd { flex: 1 1 0; min-width: 0; }
.sc-userow-foot { flex: 1 0 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sc-userow-foot b { font-size: 1.05rem; }

/* 0.10.0 — scontrino: come hai pagato (va in 💶 Spese) */
.sc-paycard { border: 2px solid #FFD84D; }
.sc-paychips { display: flex; flex-wrap: wrap; gap: 8px; }
.sc-paychips .sc-paynone { font-weight: 400; color: var(--muted); }
.sc-payhint { margin: 8px 2px 4px; }
.sc-payrow { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.sc-payrow label { flex: 0 0 8.5em; font-weight: 700; font-size: 1rem; }
.sc-payrow select, .sc-payrow input { flex: 1; min-width: 0; font-size: 16px; }

/* 0.10.5 — tessera: codice a barre disegnato (sempre su bianco, anche col tema scuro, per lo scanner della cassa) */
.sc-cardbcbox { cursor: zoom-in; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 12px 10px 8px; margin-top: 10px; }
.sc-cardbc { background: #fff; }
.sc-barcode { display: block; width: 100%; height: 90px; }
.sc-cardbcbox .sc-cardnum { color: #111; }
.sc-cardnum.small { margin-top: 6px; font-size: 1rem; }
.sc-cardfull .sc-cardbc { width: 100%; max-width: 560px; padding: 16px 0; }
.sc-cardfull .sc-barcode { height: 150px; }
.sc-cardfull .n { font-size: 1.2rem; }
.sc-cardfull img { max-height: 40vh; }
/* prezzi in offerta e abbinamento al catalogo */
.sc-offer { display: inline-block; padding: 0 7px; border-radius: 999px; background: #FFF1C2; color: #6B4E00; font-weight: 700; font-size: .8rem; }
.sc-offerchip.on { background: #FFD84D; border-color: #D4A91A; color: #3B2F00; }
.sc-matchbox { border: 2px solid #7CCBFF; margin-top: 12px; }
.sc-matchrow { width: 100%; font: inherit; text-align: left; cursor: pointer; margin-top: 8px; min-height: 58px; }
.sc-matchrow .qt { font-size: .95rem; color: #1f6fd6; }
/* 0.10.6 — prodotto nuovo: nome trovato da solo (niente domanda), con «Correggi il nome» */
.pz-found .nm { font-size: 1.2rem; }
.pz-found .pz-rename { margin-top: 10px; }

/* 0.10.7: ✎ sulle righe dello scontrino (modifica/completa il prodotto prima di salvare) */
.sc-rl-sel .sc-rl-edit { flex: none; min-width: 48px; min-height: 44px; padding: 4px 12px; font-size: 1.15rem; }
.sc-rline.sc-rl-done { box-shadow: inset 6px 0 0 #3FB56E; }
.sc-rc-from { text-align: left; margin: 0 0 12px; }
.sc-rc-from code { overflow-wrap: anywhere; }

/* 0.10.8: prezzo normale dichiarato nelle offerte */
.sc-regular { margin-top: 4px; }
.sc-regular .sc-regsave { margin-top: 6px; min-height: 1.2em; }
/* 0.10.8: riga dello scontrino «Fuori lista» (prezzo sì, in casa no) */
.sc-rline.sc-rl-out { background: #F4F4F6; }
.sc-rl-outnote { margin-top: 6px; }

/* 0.11.0: buoni sconto */
.sc-couprow .sub { line-height: 1.35; }
.sc-couprow.off { opacity: .6; }
.sc-couphead { text-align: center; }
.sc-couphead .t { font-size: 1.45rem; font-weight: 800; line-height: 1.25; margin: 6px 0; }
.sc-couphead .when { margin-top: 8px; font-weight: 800; font-size: 1.1rem; }
.sc-couphead a { color: inherit; }
.sc-coupcode { display: flex; justify-content: center; align-items: center; background: #fff; border-radius: 16px; padding: 14px; min-height: 80px; cursor: pointer; }
.sc-coupcode svg { width: 100%; max-width: 320px; height: auto; display: block; }
.cf-code .sc-coupcode { cursor: default; padding: 8px 0; }
.cf-code .sc-coupcode svg { max-width: 240px; }
.sc-coupcond { white-space: pre-line; line-height: 1.4; }
.sc-couphoto { margin: 6px 0 12px; text-align: center; cursor: zoom-in; }
.sc-couphoto img { max-width: 100%; max-height: 320px; border-radius: 14px; border: 1px solid var(--border); }
.sc-couphoto .sub { margin-top: 4px; }
.cf-nums [hidden], .sc-two > [hidden] { display: none; }
.sc-qr { width: 100%; max-width: 260px; margin: 0 auto; }
.sc-qr svg { width: 100%; height: auto; display: block; }
.sc-cardfull .sc-qr { width: min(86vw, 440px); max-width: none; }
.cf-code .sc-qr { max-width: 200px; }

/* 0.11.2: ultimi acquisti nella scheda prodotto */
.sc-buyrow { color: inherit; text-decoration: none; align-items: start; }
.sc-buyrow small { font-size: .85rem; }
.sc-buyrow .sc-offer { margin-top: 2px; }

/* 0.11.3: scontrino salvato — 🏠 in casa / 🚫 fuori lista in ogni momento */
.sc-rc-casa { margin: 4px 0 12px; width: 100%; }
.sc-rcitem { align-items: center; }
.sc-rcitem.off .nm { color: var(--muted); }
.sc-rcsw { display: flex; gap: 6px; flex: none; }
.sc-rcsw .sc-chip { min-width: 46px; min-height: 44px; font-size: 1.2rem; padding: 4px 8px; }

/* 0.11.4: 🧾 Scontrini ▾ (tendina nella Spesa) */
.sc-dd { position: relative; }
.sc-dd > .sc-btn { margin: 6px 0 14px; }
.sc-ddmenu { position: absolute; right: 0; left: 0; top: calc(100% - 6px); z-index: 20; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.sc-ddmenu a { padding: 14px 16px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.05rem; border-top: 1px solid var(--border); }
.sc-ddmenu a:first-child { border-top: 0; }
.sc-ddmenu a:active { background: var(--bg); }

/* 0.11.5: 📷 Associa i codici */
.sc-codlink { margin-top: 12px; }
.sc-codrow { align-items: center; }
.sc-codacts { display: flex; flex-direction: column; gap: 6px; flex: none; align-items: stretch; }
.sc-codacts .sc-btn.small { min-height: 42px; }
.sc-codacts .sc-codno { font-size: .85rem; padding: 4px 8px; }

/* 0.11.9: 🏠 / 🚫 fuori lista sugli acquisti nella scheda prodotto */
.sc-buyrow { display: flex; align-items: center; gap: 8px; }
.sc-buylink { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: start; color: inherit; text-decoration: none; }
.sc-buylink .v { margin-left: auto; text-align: right; }
.sc-buyrow .sc-rcsw .sc-chip { min-width: 40px; min-height: 40px; font-size: 1.05rem; padding: 2px 6px; }

/* 0.11.11: scontrino — 🏠/🚫 e 💶/✖ a un tocco su ogni riga */
.sc-rl-toggles { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.sc-rl-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sc-rl-pair .sc-chip { justify-content: center; min-height: 40px; font-size: .95rem; }
.sc-rline.sc-rl-noexp .sc-rl-top b { text-decoration: line-through; opacity: .6; }
.sc-payexcl { margin-top: 6px; font-weight: 700; }
