/* Sporta. Il mondo: le etichette delle vecchie cassette della frutta. Inchiostri pieni e piatti,
   un inchiostro per reparto, barra cobalto, limone per l'azione principale, slab grasso solo per
   marchio, titoli e reparti. Tutto il resto è il sans del telefono. */

@font-face {
  font-family: 'Alfa Slab One';
  src: url('../fonts/alfa-slab-one-latin-400-normal.woff2') format('woff2');
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Alfa Slab One';
  src: url('../fonts/alfa-slab-one-latin-ext-400-normal.woff2') format('woff2');
  font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --slab: 'Alfa Slab One', Rockwell, 'Roboto Slab', Georgia, serif;

  --ground: #ecf0f8;
  --surface: #ffffff;
  --surface-2: #e1e7f3;
  --line: #d6ddec;
  --field: #f3f6fb;
  --text: #111a35;
  --text-2: #445079;
  --text-3: #5b6690;
  --shell: #1c3687;
  --on-shell: #ffffff;
  --on-shell-2: #cbd6fa;
  --lemon: #ffc52e;
  --lemon-press: #f2b000;
  --on-lemon: #17213f;
  --danger: #b3261e;
  --focus: #1c3687;
  --toast: #111a35;
  --shadow-sm: 0 1px 2px rgb(17 26 53 / 0.07), 0 2px 8px -2px rgb(17 26 53 / 0.08);
  --shadow-up: 0 -1px 0 rgb(17 26 53 / 0.06), 0 -8px 24px -6px rgb(17 26 53 / 0.18);

  /* Inchiostri dei reparti: --ink regge il testo bianco, --pop è la versione accesa per il cobalto
     della barra e per il buio, --hi è quella che si usa sul fondo della pagina. */
  --ink-frutta: #2e7d32;      --pop-frutta: #7fd683;
  --ink-pane: #8f5a12;        --pop-pane: #f2b45f;
  --ink-gastronomia: #a8324e; --pop-gastronomia: #ff92a8;
  --ink-carne: #c0281f;       --pop-carne: #ff7d6d;
  --ink-pesce: #0b62a8;       --pop-pesce: #62c6f2;
  --ink-latticini: #2d4fc4;   --pop-latticini: #a3bcff;
  --ink-pasta: #8a6a00;       --pop-pasta: #f5d04a;
  --ink-dispensa: #5a6618;    --pop-dispensa: #cadb70;
  --ink-colazione: #b8430a;   --pop-colazione: #ffa461;
  --ink-surgelati: #0a7487;   --pop-surgelati: #66dce6;
  --ink-bevande: #7b2f9e;     --pop-bevande: #daa2f5;
  --ink-igiene: #a62b7a;      --pop-igiene: #ff8dcc;
  --ink-casa: #11735c;        --pop-casa: #62d9b0;
  --ink-animali: #7a4a2a;     --pop-animali: #e2a77d;
  --ink-altro: #55607d;       --pop-altro: #bcc4dc;
  --hi-frutta: var(--ink-frutta); --hi-pane: var(--ink-pane); --hi-gastronomia: var(--ink-gastronomia);
  --hi-carne: var(--ink-carne); --hi-pesce: var(--ink-pesce); --hi-latticini: var(--ink-latticini);
  --hi-pasta: var(--ink-pasta); --hi-dispensa: var(--ink-dispensa); --hi-colazione: var(--ink-colazione);
  --hi-surgelati: var(--ink-surgelati); --hi-bevande: var(--ink-bevande); --hi-igiene: var(--ink-igiene);
  --hi-casa: var(--ink-casa); --hi-animali: var(--ink-animali); --hi-altro: var(--ink-altro);
}

/* Buio: cobalto di notte, gli inchiostri accesi diventano quelli di pagina. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --ground: #0a1127;
    --surface: #121b39;
    --surface-2: #1b2648;
    --line: #26325a;
    --field: #0e1631;
    --text: #e9edfa;
    --text-2: #a9b4d8;
    --text-3: #8f9ac2;
    --shell: #172c70;
    --on-shell-2: #b9c6f2;
    --focus: #ffc52e;
    --toast: #2a3866;
    --danger: #ff8a80;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-up: 0 -1px 0 rgb(255 255 255 / 0.05), 0 -8px 24px -6px rgb(0 0 0 / 0.5);
    --hi-frutta: var(--pop-frutta); --hi-pane: var(--pop-pane); --hi-gastronomia: var(--pop-gastronomia);
    --hi-carne: var(--pop-carne); --hi-pesce: var(--pop-pesce); --hi-latticini: var(--pop-latticini);
    --hi-pasta: var(--pop-pasta); --hi-dispensa: var(--pop-dispensa); --hi-colazione: var(--pop-colazione);
    --hi-surgelati: var(--pop-surgelati); --hi-bevande: var(--pop-bevande); --hi-igiene: var(--pop-igiene);
    --hi-casa: var(--pop-casa); --hi-animali: var(--pop-animali); --hi-altro: var(--pop-altro);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --ground: #0a1127;
  --surface: #121b39;
  --surface-2: #1b2648;
  --line: #26325a;
  --field: #0e1631;
  --text: #e9edfa;
  --text-2: #a9b4d8;
  --text-3: #8f9ac2;
  --shell: #172c70;
  --on-shell-2: #b9c6f2;
  --focus: #ffc52e;
  --toast: #2a3866;
  --danger: #ff8a80;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
  --shadow-up: 0 -1px 0 rgb(255 255 255 / 0.05), 0 -8px 24px -6px rgb(0 0 0 / 0.5);
  --hi-frutta: var(--pop-frutta); --hi-pane: var(--pop-pane); --hi-gastronomia: var(--pop-gastronomia);
  --hi-carne: var(--pop-carne); --hi-pesce: var(--pop-pesce); --hi-latticini: var(--pop-latticini);
  --hi-pasta: var(--pop-pasta); --hi-dispensa: var(--pop-dispensa); --hi-colazione: var(--pop-colazione);
  --hi-surgelati: var(--pop-surgelati); --hi-bevande: var(--pop-bevande); --hi-igiene: var(--pop-igiene);
  --hi-casa: var(--pop-casa); --hi-animali: var(--pop-animali); --hi-altro: var(--pop-altro);
}

/* Il filetto delle etichette litografiche: una riga chiara stampata dentro il bordo.
   Va dichiarato dove c'è --ink (sull'elemento), non su :root dove --ink non esiste. */
.dept__label,
.lrow__badge,
.swatch {
  --frame: inset 0 0 0 3px var(--ink), inset 0 0 0 4.5px rgb(255 255 255 / 0.72);
}

/* --- Base ------------------------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  accent-color: var(--shell);
  caret-color: var(--shell);
  scrollbar-color: color-mix(in srgb, var(--text-2) 45%, transparent) transparent;
  scroll-padding-top: var(--bar-h, 56px);
}
:root[data-theme='dark'],
:root:not([data-theme='light']) {
  caret-color: auto;
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--text);
  font: 400 1rem/1.4 var(--font);
  -webkit-tap-highlight-color: transparent;
}
::selection {
  background: var(--lemon);
  color: var(--on-lemon);
}
input,
button,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button {
  -webkit-user-select: none;
  user-select: none;
}
a {
  color: inherit;
  text-underline-offset: 3px;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.vh {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.ico {
  width: 24px;
  height: 24px;
  flex: none;
}
.num,
.item__price,
.dept__n,
.cart__n,
.bar__count,
.lrow__meta {
  font-variant-numeric: tabular-nums;
}

/* --- Barra ---------------------------------------------------------------------------------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top);
  background: var(--shell);
  color: var(--on-shell);
  box-shadow: 0 6px 18px -10px rgb(8 16 48 / 0.6);
}
.bar :focus-visible {
  outline-color: var(--lemon);
}
.bar__in {
  max-width: 680px;
  margin: 0 auto;
  min-height: 60px;
  padding: 0 6px 0 4px;
  display: flex;
  align-items: center;
  gap: 2px;
}
.wordmark {
  margin: 0 auto 0 12px;
  font-family: var(--slab);
  font-weight: 400;
  font-size: 1.875rem;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--lemon);
}
.bar__title {
  flex: 1;
  min-width: 0;
  margin: 0 4px;
  font-family: var(--slab);
  font-weight: 400;
  font-size: 1.375rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar__status {
  max-width: 680px;
  margin: -4px auto 0;
  padding: 0 16px 4px;
}
.bar__count {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--on-shell-2);
}
.bar__sync {
  display: contents;
}
.sync {
  display: grid;
  place-items: center;
  width: 32px;
  height: 44px;
  color: var(--on-shell-2);
}
.sync .ico {
  width: 20px;
  height: 20px;
}
.sync--off {
  color: var(--lemon);
}

/* --- La fila di cassette ------------------------------------------------------------------- */

.crates {
  display: flex;
  gap: 3px;
}
.crates--empty {
  height: 12px;
  border-radius: 3px;
  background: rgb(255 255 255 / 0.12);
}
.crate {
  flex: 1 1 0;
  min-width: 12px;
  display: flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
}
.bar .crate {
  height: 36px;
  cursor: pointer;
}
.crate__track {
  display: block;
  width: 100%;
  height: 12px;
  border-radius: 3px;
  overflow: hidden;
  /* Come il cerchio dei prodotti: la cassetta vuota è un contorno, quella presa è piena. */
  box-shadow: inset 0 0 0 2px var(--pop);
}
.crate__fill {
  display: block;
  height: 100%;
  background: var(--pop);
  transform-origin: left center;
  transform: scaleX(var(--p));
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bar .crate:hover .crate__track {
  box-shadow: 0 0 0 2px rgb(255 255 255 / 0.35);
}
.bar .crate:focus-visible {
  outline-offset: 0;
  border-radius: 4px;
}

/* --- Pagina --------------------------------------------------------------------------------- */

.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 4px 12px calc(var(--adder-h, 80px) + var(--kb, 0px) + 28px);
}

/* --- Le liste ------------------------------------------------------------------------------- */

.home__lists {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lrow {
  display: flex;
  align-items: center;
  padding-right: 4px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.lrow__main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 8px 14px 14px;
  border-radius: 14px;
  text-decoration: none;
}
.lrow__main:hover .lrow__name {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--hi);
}
.lrow__badge {
  flex: none;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-family: var(--slab);
  font-size: 1.625rem;
  line-height: 1;
  box-shadow: var(--frame);
}
.lrow__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lrow__name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.125rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.lrow__shared {
  display: inline-grid;
  color: var(--hi);
}
.lrow__shared .ico {
  width: 18px;
  height: 18px;
}
.lrow__meta {
  font-size: 0.875rem;
  color: var(--text-2);
}
.lrow .crates {
  margin-top: 7px;
}
.lrow .crates--empty {
  height: 8px;
  background: none;
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.lrow .crate__track {
  height: 8px;
  box-shadow: inset 0 0 0 1.5px var(--hi);
}
.lrow .crate__fill {
  background: var(--hi);
}

/* Invito a installare: una riga in fondo alle liste, chiudibile per sempre. */
.install {
  margin-top: 14px;
  padding: 14px 4px 14px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.install__icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 10px;
}
.install__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.install__text {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.9375rem;
  line-height: 1.35;
  color: var(--text-2);
}
.install__text strong {
  font-size: 1rem;
  color: var(--text);
}
.install__x {
  margin-top: -8px;
  color: var(--text-2);
}

/* --- Reparti -------------------------------------------------------------------------------- */

.dept {
  scroll-margin-top: calc(var(--bar-h, 60px) + 8px);
}
.dept__label {
  position: sticky;
  top: calc(var(--bar-h, 60px) + 8px);
  z-index: 5;
  margin: 18px 0 6px;
  min-height: 44px;
  padding: 6px 16px 6px 7px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-family: var(--slab);
  font-weight: 400;
  font-size: 0.8125rem;
  line-height: 1.1;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  box-shadow: var(--frame), 0 3px 8px -4px rgb(8 16 48 / 0.45);
}
/* Un colletto del colore del fondo: incollata sotto la barra, l'etichetta non lascia vedere le righe. */
.dept__label::before {
  content: '';
  position: absolute;
  left: -12px;
  right: -12px;
  bottom: 100%;
  height: 10px;
  background: var(--ground);
}
.dept__name {
  flex: 1;
  min-width: 0;
}
.dept__n {
  font-family: var(--font);
  font-weight: 800;
  font-size: 0.9375rem;
  letter-spacing: 0;
}
.dept--flat {
  margin-top: 14px;
}

/* L'emblema del reparto: lo stesso disegno a ogni misura. Sull'etichetta è un medaglione bianco,
   altrove un tondo d'inchiostro. */
.emb {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
}
.dept__label .emb,
.cart__toggle .emb {
  width: 32px;
  height: 32px;
  box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3.5px var(--ink);
}
.cart__toggle .emb--cart {
  box-shadow: inset 0 0 0 2px var(--shell), inset 0 0 0 3.5px rgb(255 255 255 / 0.72);
}
.emb .ico {
  width: 18px;
  height: 18px;
}
.emb--sm {
  width: 32px;
  height: 32px;
  background: var(--ink);
  color: #fff;
}
.emb--cart {
  background: var(--shell);
  color: #fff;
}

/* --- Prodotti ------------------------------------------------------------------------------- */

.items {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.item {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: calc(var(--bar-h, 60px) + 64px);
  scroll-margin-bottom: calc(var(--adder-h, 80px) + var(--kb, 0px) + 12px);
}
.item:last-child {
  border-bottom: 0;
}
.item__main {
  flex: 1;
  min-width: 0;
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 4px 8px 14px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.item__main:focus-visible {
  outline-offset: -3px;
  border-radius: 12px;
}
.tick {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 2.5px solid var(--hi);
  border-radius: 50%;
  color: #fff;
  transition: background-color 0.16s ease-out, border-color 0.16s ease-out, transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.tick .ico {
  width: 18px;
  height: 18px;
  stroke-width: 3.2;
  opacity: 0;
  transform: scale(0.3);
  transition: opacity 0.12s ease-out, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.is-done .tick,
.is-ticking .tick {
  background: var(--ink);
  border-color: var(--ink);
}
.is-done .tick .ico,
.is-ticking .tick .ico {
  opacity: 1;
  transform: none;
}
.is-ticking .tick {
  transform: scale(1.06);
}
.is-unticking .tick {
  background: none;
  border-color: var(--hi);
}
.is-unticking .tick .ico {
  opacity: 0;
  transform: scale(0.3);
}
.is-moving .item__text,
.is-moving .item__nums {
  opacity: 0.35;
  transform: translateY(6px);
  transition: opacity 0.16s 0.08s ease-out, transform 0.2s 0.06s ease-out;
}
.item__main:active .tick {
  transform: scale(0.9);
}
.item__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.item__name {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.item__detail {
  font-size: 0.875rem;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.item__nums {
  flex: none;
  margin-left: 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}
.item__qty {
  font-size: 1rem;
  font-weight: 700;
}
.item__price {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-2);
}
.item__qty + .item__price {
  font-weight: 500;
}
.item__edit {
  margin-right: 4px;
  color: var(--text-2);
}
.item__edit .ico {
  width: 20px;
  height: 20px;
}
.is-done .item__qty {
  color: var(--text-2);
}
.is-done .item__name {
  color: var(--text-2);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: color-mix(in srgb, var(--hi) 75%, transparent);
}
.is-new {
  animation: arrive 1.1s ease-out;
}
@keyframes arrive {
  from {
    background: color-mix(in srgb, var(--hi) 24%, var(--surface));
  }
}

/* --- Carrello ------------------------------------------------------------------------------- */

.cart {
  margin-top: 26px;
  scroll-margin-top: calc(var(--bar-h, 60px) + 8px);
}
.cart__head {
  margin: 0;
  font: inherit;
}
.cart__toggle {
  width: 100%;
  min-height: 44px;
  padding: 5px 12px 5px 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--slab);
  font-size: 0.8125rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
}
.cart__title {
  flex: 1;
}
.cart__n {
  font-family: var(--font);
  font-weight: 800;
  font-size: 0.9375rem;
  letter-spacing: 0;
}
.cart__chev {
  transition: transform 0.2s ease-out;
}
.cart.is-closed .cart__chev {
  transform: rotate(-90deg);
}
.cart.is-closed .cart__body {
  display: none;
}
.cart__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 0;
}

/* --- Campo per aggiungere ------------------------------------------------------------------- */

.adder {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--kb, 0px);
  z-index: 20;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  box-shadow: var(--shadow-up);
}
.adder__form {
  position: relative;
  max-width: 656px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.adder__input {
  flex: 1;
  min-width: 0;
  height: 54px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--field);
  font-size: 1.0625rem;
}
.adder__form:has(.adder__mic:not([hidden])) .adder__input {
  padding-right: 54px;
}
.adder__input::placeholder,
.input::placeholder {
  color: var(--text-3);
  opacity: 1;
}
.adder__input:focus,
.input:focus {
  outline: none;
  border-color: var(--focus);
  background: var(--surface);
}
.adder__go {
  flex: none;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  border-radius: 14px;
  background: var(--lemon);
  color: var(--on-lemon);
  cursor: pointer;
}
.adder__go:hover {
  background: var(--lemon-press);
}
.adder__go:active,
.btn--primary:active {
  background: var(--lemon-press);
}
.adder__go .ico {
  width: 28px;
  height: 28px;
  stroke-width: 2.6;
}
.adder__mic {
  position: absolute;
  right: 67px;
  top: 50%;
  translate: 0 -50%;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 11px;
  background: none;
  color: var(--text-2);
  cursor: pointer;
}
.adder__mic:hover {
  background: var(--surface-2);
}
.adder__mic.is-on {
  background: var(--ink-carne);
  color: #fff;
  animation: listening 1.4s ease-in-out infinite;
}
@keyframes listening {
  50% {
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--ink-carne) 25%, transparent);
  }
}

/* Suggerimenti: sopra il campo, così il pollice non deve andare in cima. */
.suggest {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 12px 8px;
}
.suggest:not([hidden]) {
  display: block;
}
.suggest__head {
  margin: 0;
  padding: 10px 14px 4px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-2);
}
.suggest__list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: min(46dvh, 340px);
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 14px;
}
.suggest__head + .suggest__list {
  border-radius: 0 0 14px 14px;
  padding-top: 0;
}
.suggest__box {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 -10px 28px -10px rgb(17 26 53 / 0.3);
  overflow: hidden;
}
/* Con i suggerimenti aperti l'avviso si fa da parte: torna quando si chiudono. */
body.has-sug #toast {
  opacity: 0;
  pointer-events: none;
}
.sug {
  width: 100%;
  min-height: 50px;
  padding: 6px 10px 6px 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.sug:hover,
.sug.is-active {
  background: color-mix(in srgb, var(--hi) 13%, var(--surface));
}
.sug__name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.sug__name mark {
  background: none;
  color: var(--text-2);
  font-weight: 500;
}
.sug__qty {
  font-weight: 500;
  color: var(--text-2);
}
.sug__state {
  flex: none;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--hi);
  text-align: right;
}

/* --- Vuoto ---------------------------------------------------------------------------------- */

.empty {
  padding: 44px 8px 24px;
  text-align: center;
}
.empty__title {
  margin: 0 0 8px;
  font-family: var(--slab);
  font-weight: 400;
  font-size: 1.75rem;
  line-height: 1.15;
}
.empty__text {
  max-width: 36ch;
  margin: 0 auto 22px;
  color: var(--text-2);
  line-height: 1.5;
}
.empty--done {
  padding: 28px 8px 0;
}
.empty--done .empty__text {
  margin-bottom: 0;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 460px;
  margin: 0 auto;
}
.chip {
  min-height: 44px;
  padding: 0 16px 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--hi);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 700;
  cursor: pointer;
}
.chip .ico {
  width: 18px;
  height: 18px;
  color: var(--hi);
  stroke-width: 2.6;
}
.chip:hover {
  background: color-mix(in srgb, var(--hi) 12%, var(--surface));
}

/* --- Pulsanti e campi ----------------------------------------------------------------------- */

.btn {
  min-height: 48px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}
.btn .ico {
  width: 20px;
  height: 20px;
}
.btn--primary {
  background: var(--lemon);
  color: var(--on-lemon);
}
.btn--primary:hover {
  background: var(--lemon-press);
}
.btn--ghost {
  background: var(--surface-2);
  color: var(--text);
}
.btn--ghost:hover {
  background: color-mix(in srgb, var(--text) 12%, var(--surface-2));
}
.btn--danger {
  background: var(--danger);
  color: #fff;
}
:root[data-theme='dark'] .btn--danger {
  color: #2a0905;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .btn--danger {
    color: #2a0905;
  }
}
.btn--danger-text,
.btn--danger-text .ico {
  color: var(--danger);
}
.btn--small {
  min-height: 40px;
  padding: 0 12px;
  font-size: 0.875rem;
}
.btn--small .ico {
  width: 18px;
  height: 18px;
}
.btn--wide {
  width: 100%;
}
.btn:disabled {
  opacity: 0.55;
  cursor: progress;
}
.iconbtn {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: none;
  color: inherit;
  cursor: pointer;
}
.iconbtn:hover {
  background: color-mix(in srgb, currentColor 10%, transparent);
}
.iconbtn:disabled {
  opacity: 0.28;
  cursor: default;
  background: none;
}
.iconbtn--bar {
  color: var(--on-shell);
}

.field {
  min-width: 0;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 0;
}
.field__label {
  padding: 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-2);
}
.field__hint {
  min-height: 1.25em;
  font-size: 0.875rem;
  color: var(--text-2);
}
.field__hint:empty {
  display: none;
}
.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  font-size: 1rem;
}
select.input {
  padding-right: 8px;
}
.input--area {
  height: auto;
  padding: 12px 14px;
  line-height: 1.5;
  resize: vertical;
}
.input--num {
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 12px;
}
.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
}
.stepper .iconbtn {
  background: var(--surface-2);
}
.money {
  position: relative;
  display: block;
}
.money .input {
  padding-right: 38px;
  text-align: left;
}
.money__sym {
  position: absolute;
  right: 14px;
  top: 50%;
  translate: 0 -50%;
  font-weight: 700;
  color: var(--text-2);
}

.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-2);
}
.seg__opt {
  position: relative;
  flex: 1;
}
.seg__opt input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.seg__opt span {
  min-height: 40px;
  padding: 4px 8px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: var(--text-2);
}
.seg__opt input:checked + span {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.seg__opt input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 3px;
}
.swatch {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--ink);
  box-shadow: var(--frame);
  cursor: pointer;
}
.swatch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.swatch:has(input:checked) {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}
.swatch:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.dgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
}
.dchip {
  position: relative;
  min-height: 46px;
  padding: 5px 10px 5px 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
.dchip input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.dchip .emb--sm {
  width: 30px;
  height: 30px;
}
.dchip:has(input:checked) {
  border-color: var(--hi);
  background: color-mix(in srgb, var(--hi) 13%, var(--surface));
}
.dchip:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* --- Fogli dal basso ------------------------------------------------------------------------ */

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 -12px 40px rgb(0 0 0 / 0.28);
  overflow: auto;
  overscroll-behavior: contain;
  animation: rise 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet::backdrop {
  background: rgb(6 12 34 / 0.55);
  animation: fade 0.2s ease-out;
}
.sheet.is-closing {
  animation: sink 0.18s ease-in forwards;
}
@media (min-width: 720px) {
  .sheet {
    margin: auto;
    border-radius: 20px;
  }
}
@keyframes rise {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}
@keyframes sink {
  to {
    transform: translateY(40px);
    opacity: 0;
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.sheet__in {
  padding: 6px 20px calc(20px + env(safe-area-inset-bottom));
}
.sheet__head {
  min-height: 56px;
  margin-right: -10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sheet__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-family: var(--slab);
  font-weight: 400;
  font-size: 1.25rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.sheet__text {
  margin: 0 0 16px;
  color: var(--text-2);
  line-height: 1.5;
}
.sheet__foot {
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.sheet__foot .btn--primary {
  min-width: 120px;
}

.menu {
  margin: 0 -10px;
  display: flex;
  flex-direction: column;
}
.menu__item {
  min-height: 52px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 0;
  border-radius: 10px;
  background: none;
  font-size: 1.0625rem;
  text-align: left;
  cursor: pointer;
}
.menu__item:hover {
  background: var(--surface-2);
}
.menu__item .ico {
  color: var(--text-2);
}
.menu__item--danger,
.menu__item--danger .ico {
  color: var(--danger);
}
.menu__group {
  padding: 4px 12px 14px;
}
.menu__label {
  margin: 0 0 8px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-2);
}

.live {
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.live__title {
  margin: 0 0 6px;
  font-size: 1.0625rem;
}
.linkbox {
  margin-bottom: 10px;
  display: flex;
  gap: 6px;
}
.linkbox .input {
  font-size: 0.875rem;
}
.linkbox .iconbtn {
  height: 48px;
  background: var(--surface-2);
}

/* --- Avviso --------------------------------------------------------------------------------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--adder-h, 0px) + var(--kb, 0px) + 12px);
  z-index: 40;
  width: max-content;
  max-width: min(560px, calc(100vw - 24px));
  min-height: 48px;
  padding: 6px 6px 6px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  background: var(--toast);
  color: #fff;
  box-shadow: 0 8px 28px -6px rgb(0 0 0 / 0.4);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.18s ease-out, transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#toast.is-on {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
.toast__msg {
  padding: 6px 0;
  line-height: 1.35;
}
.toast__msg:only-child {
  padding-right: 10px;
}
.toast__act {
  flex: none;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--lemon);
  font-weight: 800;
  cursor: pointer;
}
.toast__act:hover {
  background: rgb(255 255 255 / 0.1);
}
.toast__act:focus-visible {
  outline-color: var(--lemon);
}

/* --- Impostazioni e link d'invito ----------------------------------------------------------- */

.settings {
  padding-top: 14px;
}
.set {
  margin-bottom: 12px;
  padding: 16px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.set__title {
  margin: 0 0 4px;
  font-size: 1.0625rem;
  font-weight: 700;
}
.set__title:only-child,
.set__title + .seg {
  margin-bottom: 10px;
}
.set__hint {
  margin: 0 0 12px;
  color: var(--text-2);
  font-size: 0.9375rem;
  line-height: 1.45;
}
.set__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.set__row label.btn {
  position: relative;
}
.set__row label.btn:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.order {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.order__row {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.order__row:last-child {
  border-bottom: 0;
}
.order__name {
  flex: 1;
  font-weight: 600;
}
.credits {
  margin: 24px 0;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-2);
}

.join {
  padding-top: 32px;
}
.joincard {
  max-width: 420px;
  margin: 0 auto 18px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
}
.joincard__name {
  margin: 0;
  font-family: var(--slab);
  font-weight: 400;
  font-size: 1.375rem;
}
.joincard__meta {
  margin: 2px 0 0;
  color: var(--text-2);
}
.join .btn--wide {
  max-width: 420px;
}

/* --- Schermi larghi ------------------------------------------------------------------------- */

@media (min-width: 720px) {
  .page {
    padding-left: 20px;
    padding-right: 20px;
  }
  .bar__status {
    padding-left: 24px;
    padding-right: 24px;
  }
  .item__edit {
    opacity: 0.55;
  }
  .item:hover .item__edit,
  .item__edit:focus-visible {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
