/* Cosa mangiamo — palette "Salvia" (grigio appena verde, card bianche, verde bosco come accento) e Plus Jakarta Sans. */
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../fonts/jakarta.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
}

:root {
  --bg: #f2f5f3; --surface: #ffffff; --surface-2: #e8eeea; --surface-3: #dce4df; --line: #e1e8e3;
  --ink: #14201a; --ink-2: #4e5e55; --ink-3: #9aa8a0;
  --accent: #1f7a55; --accent-ink: #ffffff; --accent-soft: #dcf0e5;
  --ok: #2f8f5b; --ok-soft: #dff3e7; --warn: #c47f17; --warn-soft: #fbefd9;
  --danger: #d43f2f; --danger-soft: #fde5e1;
  /* tinte per i tipi di piatto: fondo / inchiostro */
  --t-tomato: #fde6e1; --t-tomato-i: #c2412d;
  --t-saffron: #fdefd3; --t-saffron-i: #a86a06;
  --t-sea: #ddf0ee; --t-sea-i: #22706a;
  --t-olive: #e5efd9; --t-olive-i: #4e6b26;
  --t-wheat: #f2ebdd; --t-wheat-i: #7d6232;
  --t-rose: #fbe3e6; --t-rose-i: #b03e52;
  --t-yolk: #fef4cc; --t-yolk-i: #8c6d00;
  --t-plain: #edf1ee; --t-plain-i: #4e5e55;

  /* Plus Jakarta Sans (OFL) incluso in fonts/, con il font di sistema come ripiego */
  --display: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --r-lg: 22px; --r-md: 16px; --r-sm: 12px;
  --shadow: 0 1px 1px rgb(16 32 24 / .04), 0 6px 20px -8px rgb(16 32 24 / .12);
  --shadow-lift: 0 2px 2px rgb(16 32 24 / .05), 0 18px 40px -16px rgb(16 32 24 / .22);
  --tabbar-h: 62px; --gutter: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121714; --surface: #1a211d; --surface-2: #212a25; --surface-3: #2a342e; --line: #28312c;
    --ink: #e9efeb; --ink-2: #a6b3ab; --ink-3: #6d7a72;
    --accent: #4fbf8b; --accent-ink: #0d1310; --accent-soft: #183327;
    --ok: #5fcf8f; --ok-soft: #1a3326; --warn: #e2ad55; --warn-soft: #3a2f1c;
    --danger: #f07a68; --danger-soft: #3d201c;
    --t-tomato: #3a2320; --t-tomato-i: #f0937a;
    --t-saffron: #382d18; --t-saffron-i: #e9b862;
    --t-sea: #173230; --t-sea-i: #8ccac3;
    --t-olive: #24301c; --t-olive-i: #b4c77d;
    --t-wheat: #302a1f; --t-wheat-i: #d6b27e;
    --t-rose: #3a2226; --t-rose-i: #e59aa6;
    --t-yolk: #353018; --t-yolk-i: #e6c75e;
    --t-plain: #212a25; --t-plain-i: #a6b3ab;
    --shadow: 0 1px 0 rgb(255 255 255 / .03) inset, 0 8px 24px -12px rgb(0 0 0 / .6);
    --shadow-lift: 0 18px 40px -16px rgb(0 0 0 / .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #121714; --surface: #1a211d; --surface-2: #212a25; --surface-3: #2a342e; --line: #28312c;
    --ink: #e9efeb; --ink-2: #a6b3ab; --ink-3: #6d7a72;
    --accent: #4fbf8b; --accent-ink: #0d1310; --accent-soft: #183327;
    --ok: #5fcf8f; --ok-soft: #1a3326; --warn: #e2ad55; --warn-soft: #3a2f1c;
    --danger: #f07a68; --danger-soft: #3d201c;
    --t-tomato: #3a2320; --t-tomato-i: #f0937a;
    --t-saffron: #382d18; --t-saffron-i: #e9b862;
    --t-sea: #173230; --t-sea-i: #8ccac3;
    --t-olive: #24301c; --t-olive-i: #b4c77d;
    --t-wheat: #302a1f; --t-wheat-i: #d6b27e;
    --t-rose: #3a2226; --t-rose-i: #e59aa6;
    --t-yolk: #353018; --t-yolk-i: #e6c75e;
    --t-plain: #212a25; --t-plain-i: #a6b3ab;
    --shadow: 0 1px 0 rgb(255 255 255 / .03) inset, 0 8px 24px -12px rgb(0 0 0 / .6);
    --shadow-lift: 0 18px 40px -16px rgb(0 0 0 / .7);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--sans);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
  -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.i { flex: none; display: block; }
.display { font-family: var(--display); }
.muted { color: var(--ink-2); }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
code { font-size: .85em; background: var(--surface-2); padding: 0 .3em; border-radius: 5px; }

/* ---------------------------------------------------------------- chrome */
.topbar {
  position: sticky; top: 0; z-index: 10;
  padding: calc(env(safe-area-inset-top) + 12px) var(--gutter) 10px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.topbar-inner { max-width: 640px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; }
.title-block { flex: 1; min-width: 0; }
.eyebrow { font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.page-title { font-family: var(--display); font-weight: 750; font-size: 2rem; line-height: 1.05; letter-spacing: -.015em; margin: 2px 0 0; }
.top-actions { display: flex; align-items: center; gap: 2px; padding-bottom: 2px; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 6px; transition: background .3s; }
.sync-dot[data-state="syncing"], .sync-dot[data-state="starting"] { background: var(--warn); animation: pulse 1s ease-in-out infinite; }
.sync-dot[data-state="offline"] { background: var(--ink-3); }
.sync-dot[data-state="error"] { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }

.view { max-width: 640px; margin: 0 auto; padding: 4px var(--gutter) 24px; }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 12; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 90%, transparent); border-top: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
}
.tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-3); font-size: .7rem; font-weight: 600; letter-spacing: .01em; }
.tabbar button[aria-current="page"] { color: var(--accent); }
.tabbar button[aria-current="page"] .i { stroke-width: 2.1; }
.badge-dot { position: relative; }
.badge-dot[data-count]::after { content: attr(data-count); position: absolute; top: -5px; right: -11px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: .62rem; line-height: 16px; text-align: center; font-weight: 700; }

/* ---------------------------------------------------------------- controlli */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: .95rem; text-decoration: none; white-space: nowrap;
  transition: transform .12s ease, background .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.soft { background: var(--surface-2); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: .86rem; }
.btn.block { width: 100%; min-height: 52px; font-size: 1rem; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); flex: none; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.small { width: 32px; height: 32px; }
.link { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 0; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-size: .88rem; font-weight: 600; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(16 32 24 / .12); }
.seg.full { display: flex; } .seg.full button { flex: 1; }
.scroller { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter); }
.scroller::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: .86rem; font-weight: 550; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .count { color: var(--ink-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.chip.on .count { color: inherit; opacity: .6; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 650; letter-spacing: .02em; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tag.new { background: var(--warn-soft); color: var(--warn); }
.tag.special { background: var(--accent-soft); color: var(--accent); }
.tag.done { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.field, .form input, .form select, .form textarea, .inline-form input, .inline-form select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 11px 14px; min-height: 46px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.field:focus, .form :is(input, select, textarea):focus, .inline-form :is(input, select):focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search { position: relative; }
.search .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .field { padding-left: 40px; }
.inline-form { display: flex; gap: 8px; }
.inline-form .btn { flex: none; }
.add-field { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-md); padding: 4px 4px 4px 14px; }
.add-field input { flex: 1; border: 0; background: transparent; min-height: 40px; outline: none; }
.add-field .i { color: var(--ink-3); }
.hint { color: var(--ink-2); font-size: .86rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 10px; }
.section-head h2 { font-family: var(--display); font-weight: 700; font-size: 1.22rem; margin: 0; letter-spacing: -.01em; }

/* icona "piatto" tinta */
.dish-ico { display: grid; place-items: center; flex: none; border-radius: 14px; background: var(--tint, var(--t-plain)); color: var(--tint-i, var(--t-plain-i)); }
.dish-ico.lg { width: 60px; height: 60px; border-radius: 18px; }
.dish-ico.md { width: 44px; height: 44px; border-radius: 13px; }
.dish-ico.sm { width: 34px; height: 34px; border-radius: 10px; }
[data-tint="tomato"] { --tint: var(--t-tomato); --tint-i: var(--t-tomato-i); }
[data-tint="saffron"] { --tint: var(--t-saffron); --tint-i: var(--t-saffron-i); }
[data-tint="sea"] { --tint: var(--t-sea); --tint-i: var(--t-sea-i); }
[data-tint="olive"] { --tint: var(--t-olive); --tint-i: var(--t-olive-i); }
[data-tint="wheat"] { --tint: var(--t-wheat); --tint-i: var(--t-wheat-i); }
[data-tint="rose"] { --tint: var(--t-rose); --tint-i: var(--t-rose-i); }
[data-tint="yolk"] { --tint: var(--t-yolk); --tint-i: var(--t-yolk-i); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--ink-2); font-size: .84rem; }
.meta > span { display: inline-flex; align-items: center; gap: 4px; }

/* ---------------------------------------------------------------- menu */
.week-nav { display: flex; align-items: center; justify-content: space-between; margin: 2px -6px 6px; }
.week-nav .label { font-size: .86rem; color: var(--ink-2); font-weight: 600; }
.week-nav .label b { color: var(--ink); font-weight: 650; }
.days-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day-pill { border: 0; background: transparent; border-radius: 16px; padding: 7px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink-2); position: relative; transition: background .2s, color .2s; }
.day-pill .dn { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.day-pill .dd { font-family: var(--display); font-size: 1.15rem; font-weight: 650; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.day-pill .mark { width: 5px; height: 5px; border-radius: 50%; background: transparent; margin-top: 2px; }
.day-pill.is-today .mark { background: var(--ink); }
.day-pill.has-done .mark { background: var(--ok); }
.day-pill.is-today.has-done .mark { background: var(--ok); }
.day-pill[aria-pressed="true"].is-today .mark { background: var(--bg); }
.day-pill[aria-pressed="true"] { background: var(--ink); color: color-mix(in srgb, var(--bg) 75%, transparent); }
.day-pill[aria-pressed="true"] .dd { color: var(--bg); }
.day-pill.is-empty .dd { color: var(--ink-3); }

.hero {
  margin-top: 16px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lift);
  padding: 20px 20px 18px; position: relative; overflow: hidden;
}
.hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 92px; background: linear-gradient(180deg, var(--tint, var(--t-plain)) 0%, transparent 100%); opacity: .55; pointer-events: none; }
.hero > * { position: relative; }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hero .eyebrow { display: flex; align-items: center; gap: 8px; }
.hero > .dish-ico { float: right; margin: -2px -2px 8px 14px; }
.hero h3 { font-family: var(--display); font-weight: 720; font-size: 1.85rem; line-height: 1.08; letter-spacing: -.02em; margin: 8px 0 4px; text-wrap: pretty; }
.hero .meta, .hero-actions, .rate-row { clear: both; }
.hero .side { font-size: 1.05rem; font-weight: 500; color: var(--ink-2); margin: 0 0 12px; }
.hero .meta { margin-top: 2px; }
.hero-actions { display: flex; gap: 8px; margin-top: 18px; }
.hero-actions .btn.primary { flex: 1; }
.btn.icon-only { width: 44px; padding: 0; }
.meta-link { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-size: .86rem; }
.hero.is-done .hero-actions .btn.primary { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.hero.is-out h3 { color: var(--ink-2); }
.rate-row { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.rate-row .who { display: flex; align-items: center; justify-content: space-between; }
.rate-row .who span { font-weight: 600; }
.thumbs { display: flex; gap: 6px; }
.thumb { width: 44px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--ink-2); transition: background .15s, color .15s, transform .12s; }
.thumb:active { transform: scale(.92); }
.thumb.up.on { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.thumb.down.on { background: var(--danger-soft); border-color: transparent; color: var(--danger); }

.lunches { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.lunch { text-align: left; border: 0; background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow); padding: 14px 14px 13px; display: flex; flex-direction: column; gap: 10px; min-height: 128px; }
.lunch .who { display: flex; align-items: center; justify-content: space-between; font-size: .74rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); }
.lunch .t { font-family: var(--display); font-weight: 650; font-size: 1.05rem; line-height: 1.18; }
.lunch .v { font-size: .84rem; color: var(--ink-2); margin-top: -6px; }
.lunch.is-done { opacity: .62; }
.lunch.is-empty .t { color: var(--ink-3); }

.week-list { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.wrow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; border: 0; background: transparent; text-align: left; border-top: 1px solid var(--line); }
.wrow:first-child { border-top: 0; }
.wrow .wd { width: 38px; flex: none; text-align: center; }
.wrow .wd b { display: block; font-family: var(--display); font-size: 1.1rem; font-weight: 680; line-height: 1; font-variant-numeric: tabular-nums; }
.wrow .wd small { font-size: .66rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.wrow .wt { flex: 1; min-width: 0; }
.wrow .wt .d, .wrow .wt .l { display: block; }
.wrow .wt .d { font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wrow .wt .l { font-size: .8rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.wrow .st { color: var(--ink-3); flex: none; display: flex; align-items: center; }
.wrow.is-sel { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.wrow.is-sel .wd b { color: var(--accent); }
.wrow .ok { color: var(--ok); }
.week-foot { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }

.empty-card { margin-top: 18px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lift); padding: 28px 22px 22px; text-align: center; }
.empty-card .dish-ico { margin: 0 auto 14px; }
.empty-card h3 { font-family: var(--display); font-weight: 720; font-size: 1.5rem; line-height: 1.15; margin: 0 0 8px; letter-spacing: -.01em; }
.empty-card p { color: var(--ink-2); margin: 0 auto 20px; max-width: 32ch; }

/* ---------------------------------------------------------------- spesa */
.progress { margin: 4px 2px 14px; }
.progress .line { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress .fill { height: 100%; background: var(--ok); border-radius: 3px; transition: width .4s cubic-bezier(.2,.8,.2,1); }
.progress .txt { display: flex; justify-content: space-between; font-size: .84rem; color: var(--ink-2); margin-top: 7px; }
.progress .txt b { color: var(--ink); font-variant-numeric: tabular-nums; }
.pantry-check { margin: 14px 0 4px; background: var(--warn-soft); border-radius: var(--r-md); padding: 14px; }
.pantry-check summary { list-style: none; display: flex; align-items: center; justify-content: space-between; font-weight: 650; cursor: pointer; }
.pantry-check summary::-webkit-details-marker { display: none; }
.pantry-check summary .i { color: var(--warn); transition: transform .2s; }
.pantry-check[open] summary .i { transform: rotate(180deg); }
.pantry-check p { margin: 8px 0 10px; font-size: .85rem; color: var(--ink-2); }
.pantry-check .chips-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.pantry-check .chip { background: var(--surface); border-color: transparent; }
.cat { margin-top: 22px; }
.cat-head { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.cat-head .n { margin-left: auto; color: var(--ink-3); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.list-card { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; align-items: center; gap: 4px; padding: 0 6px 0 0; border-top: 1px solid var(--line); transition: opacity .25s; }
.item:first-child { border-top: 0; }
.check { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px 6px 12px 14px; cursor: pointer; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.box { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--surface-3); display: grid; place-items: center; color: transparent; transition: background .2s, border-color .2s, transform .2s cubic-bezier(.3,1.6,.5,1); }
.check input:checked + .box { background: var(--ok); border-color: var(--ok); color: #fff; transform: scale(1.06); }
.check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.item-text { flex: 1; min-width: 0; }
.item-name { font-weight: 560; line-height: 1.25; display: block; }
.item-sub { display: block; font-size: .78rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.item-qty { flex: none; font-size: .9rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.item.is-checked { opacity: .5; }
.item.is-checked .item-name { text-decoration: line-through; text-decoration-color: var(--ink-3); }
.item .icon-btn { color: var(--ink-3); }
.icon-pad { width: 32px; flex: none; }

/* ---------------------------------------------------------------- dispensa */
.pantry-sum { display: flex; align-items: center; justify-content: space-between; margin: 16px 2px 10px; }
.pantry-sum .big { font-family: var(--display); font-size: 1.15rem; font-weight: 700; }
.legend { display: flex; gap: 12px; font-size: .78rem; color: var(--ink-2); margin: 0 2px 14px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.pchips { display: flex; flex-wrap: wrap; gap: 8px; }
.pchip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 13px; font-size: .92rem; font-weight: 550; display: inline-flex; align-items: center; gap: 7px; transition: background .2s, color .2s, border-color .2s, transform .12s; }
.pchip:active { transform: scale(.95); }
.pchip .st { font-size: .7rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.pchip.poco { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.pchip.finito { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.pchip .x { margin-right: -4px; color: var(--ink-3); }
.pgroup + .pgroup { margin-top: 22px; }
.pgroup h4 { margin: 0 2px 10px; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.rec-row { display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 14px; border-top: 1px solid var(--line); }
.rec-row:first-child { border-top: 0; }
.rec-row .t { flex: 1; min-width: 0; }
.rec-row .t b { font-weight: 560; display: block; }
.rec-row .t small { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rec-row.off .t { opacity: .5; }
.switch { position: relative; width: 46px; height: 28px; border-radius: 14px; border: 0; background: var(--surface-3); transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .2); transition: transform .22s cubic-bezier(.3,1.3,.5,1); }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }

/* ---------------------------------------------------------------- ricette */
.rtools { display: grid; gap: 12px; margin-top: 4px; }
.rlist { margin-top: 14px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.rrow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; }
.rrow:first-child { border-top: 0; }
.rrow .t { flex: 1; min-width: 0; }
.rrow .t b { display: block; font-weight: 600; line-height: 1.25; }
.rrow .meta { margin-top: 3px; font-size: .8rem; }
.rrow > .i { color: var(--ink-3); }

/* ---------------------------------------------------------------- sheet */
.sheet { position: fixed; inset: 0; z-index: 30; background: rgb(10 20 14 / 0); transition: background .25s; display: flex; align-items: flex-end; justify-content: center; }
.sheet.open { background: rgb(10 20 14 / .38); }
.sheet-panel {
  position: relative; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; background: var(--bg);
  border-radius: 26px 26px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .32s cubic-bezier(.2,.9,.25,1); overscroll-behavior: contain;
}
.sheet.open .sheet-panel { transform: none; }
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto 14px; }
.sheet-close { position: absolute; top: 12px; right: 12px; background: var(--surface-2); }
.sheet-head { display: flex; gap: 14px; align-items: flex-start; padding-right: 40px; }
.sheet-head .eyebrow { margin-top: 2px; }
.sheet h2 { font-family: var(--display); font-weight: 720; font-size: 1.6rem; line-height: 1.1; letter-spacing: -.015em; margin: 4px 0 2px; text-wrap: balance; }
.sheet .side { color: var(--ink-2); font-size: 1rem; font-weight: 500; }
.sheet h3 { font-size: .76rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin: 24px 2px 10px; }
.sheet-row { display: flex; gap: 8px; margin-top: 16px; }
.sheet-row .btn { flex: 1; }
.action-list { margin-top: 18px; background: var(--surface); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow); }
.action-list button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; font-weight: 550; }
.action-list button:first-child { border-top: 0; }
.action-list button .i { color: var(--ink-2); }
.action-list button.danger, .action-list button.danger .i { color: var(--danger); }
.action-list small { margin-left: auto; color: var(--ink-3); font-weight: 500; }
.ings { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow); }
.ings li { display: flex; align-items: baseline; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.ings li:first-child { border-top: 0; }
.ings li .q { margin-left: auto; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .92rem; }
.ings li.pantry { color: var(--ink-2); }
.ings li.pantry .q { color: var(--ink-3); font-size: .8rem; }
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: baseline; line-height: 1.5; }
.steps li::before { content: counter(s); font-family: var(--display); font-weight: 750; font-size: 1.5rem; color: var(--accent); line-height: 1; }
.form { display: grid; gap: 12px; }
.form label, .form-grid label { display: grid; gap: 5px; font-size: .82rem; font-weight: 650; color: var(--ink-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
details.settings { margin-top: 22px; }
details.settings summary { list-style: none; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 600; cursor: pointer; }
details.settings summary::-webkit-details-marker { display: none; }
details.settings[open] summary .i { transform: rotate(180deg); }
details.settings .form-grid { margin-top: 12px; }
.variants { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
@media (min-width: 720px) {
  .sheet { align-items: center; }
  .sheet-panel { border-radius: 26px; max-height: 86vh; }
}

/* ---------------------------------------------------------------- login */
.login { min-height: 70vh; display: grid; align-content: center; text-align: center; gap: 4px; }
.login .dish-ico { margin: 0 auto 10px; }
.login h1 { font-family: var(--display); font-weight: 760; font-size: 2.4rem; margin: 0; letter-spacing: -.02em; }
.login p { color: var(--ink-2); margin: 4px auto 22px; max-width: 30ch; }
.login .form { max-width: 340px; width: 100%; margin: 0 auto; text-align: left; }
body.logged-out .tabbar, body.logged-out .topbar { display: none; }

/* ---------------------------------------------------------------- toast e movimento */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); transform: translate(-50%, 16px);
  background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 14px; font-size: .9rem; font-weight: 550; opacity: 0;
  pointer-events: none; transition: opacity .2s, transform .25s cubic-bezier(.2,.9,.25,1); z-index: 40; max-width: calc(100% - 32px); text-align: center; box-shadow: var(--shadow-lift);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.enter { animation: rise .36s cubic-bezier(.2,.9,.25,1); }
.enter-2 { animation: rise .42s cubic-bezier(.2,.9,.25,1); }
.fade-in { animation: fade .25s ease; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0s !important; }
}

/* ---------- chi è a casa */
.who-row { display: flex; gap: 8px; justify-content: center; margin: 0 0 18px; flex-wrap: wrap; }
.who-row.compact { justify-content: flex-start; margin: 0; }
.who-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: transparent; color: var(--ink-3); border-radius: 999px; padding: 5px 11px 5px 5px; font-size: .84rem; white-space: nowrap; font-weight: 600; transition: background .2s, color .2s, border-color .2s; }
.who-chip .av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .74rem; font-weight: 750; background: var(--surface-2); color: var(--ink-3); transition: background .2s, color .2s; }
.who-chip:not(.on) .nm { text-decoration: line-through; text-decoration-color: var(--ink-3); }
.who-chip.on { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow); }
.who-chip.on .av { background: var(--accent); color: var(--accent-ink); }
.who-chip.out { padding-left: 11px; margin-left: auto; text-decoration: none; }
.who-chip.out .i { color: var(--ink-3); }
.who-chip.out.on { background: var(--warn-soft); color: var(--warn); border-color: transparent; box-shadow: none; }
.who-chip.out.on .i { color: var(--warn); }
.presence { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; margin-top: 14px; }
.week-who { display: grid; gap: 8px; margin: -2px 2px 14px; font-size: .8rem; font-weight: 650; color: var(--ink-2); }
.lunches.one { grid-template-columns: 1fr; }
.lunches.one .lunch { min-height: 0; }

/* ---------- link da importare */
.inbox-banner { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; margin: 4px 0 12px; padding: 12px 14px; border: 0; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent); }
.inbox-banner span { flex: 1; display: grid; gap: 1px; }
.inbox-banner b { font-weight: 700; }
.inbox-banner small { color: var(--ink-2); font-size: .8rem; }
.rec-row .t small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
