/* =========================================================
   Richiami Alimentari 33% — design system
   Palette dal brand trentatrepercento.com
   ========================================================= */
:root {
  --brand: #2e7d32;
  --brand-600: #276c2b;
  --brand-700: #1b5e20;
  --brand-900: #1a3d1a;
  --brand-100: #e8f5e9;
  --brand-50: #f1f8e9;
  --lime: #84cc16;
  --sky: #1e88e5;
  --accent: #f9a825;
  --accent-600: #f29100;

  --bg: #f5f7f3;
  --surface: #ffffff;
  --surface-2: #eef3ec;
  --text: #13221a;
  --muted: #5d6d63;
  --border: #e1e8df;
  --shadow-sm: 0 1px 2px rgba(19, 34, 26, .06), 0 1px 1px rgba(19, 34, 26, .04);
  --shadow: 0 10px 30px -12px rgba(27, 94, 32, .25), 0 2px 6px rgba(19, 34, 26, .05);
  --radius: 18px;
  --radius-sm: 12px;
  --header-h: 68px;
  --tabbar-h: 64px;

  --c-micro: #e53935;
  --c-allergeni: #f59e0b;
  --c-chimico: #8e24aa;
  --c-fisico: #1e88e5;
  --c-materiali: #00897b;
  --c-altro: #607d8b;
  --c-revoca: #2e7d32;
  --c-avviso: #283593;

  --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: 46, 125, 50;
  --bs-link-hover-color: var(--brand-700);
  --bs-link-hover-color-rgb: 27, 94, 32;
  --bs-border-color: var(--border);
  --bs-primary: var(--brand);
  --bs-primary-rgb: 46, 125, 50;
}

[data-bs-theme="dark"] {
  --bg: #0c130f;
  --surface: #131d17;
  --surface-2: #1a2620;
  --text: #e5eee8;
  --muted: #9aab9f;
  --border: #25332b;
  --brand-100: #173321;
  --brand-50: #13261a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
  --c-avviso: #7986cb;
  --c-chimico: #ba68c8;
  --c-revoca: #66bb6a;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-link-color: #81c784;
  --bs-link-color-rgb: 129, 199, 132;
  --bs-link-hover-color: #a5d6a7;
  --bs-border-color: var(--border);
  --bs-secondary-color: var(--muted);
}

html { scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  overflow-x: clip;
  font-family: var(--bs-body-font-family);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-main { flex: 1 0 auto; padding-bottom: 2.5rem; }
a { text-underline-offset: 3px; }
.text-brand { color: var(--brand) !important; }
.text-avviso { color: var(--c-avviso) !important; }
.text-body-secondary { color: var(--muted) !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn { font-weight: 600; }
.btn-brand { --bs-btn-color: #fff; --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--brand-700); --bs-btn-hover-border-color: var(--brand-700); --bs-btn-active-bg: var(--brand-900); --bs-btn-active-color: #fff; --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-brand { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand-700); --bs-btn-active-color: #fff; }
[data-bs-theme="dark"] .btn-outline-brand { --bs-btn-color: #81c784; --bs-btn-border-color: #4f8f53; }
.btn-accent { --bs-btn-color: #1a1a1a; --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent-600); --bs-btn-hover-border-color: var(--accent-600); --bs-btn-hover-color: #111; --bs-btn-active-bg: var(--accent-600); }
.btn-soft { --bs-btn-color: var(--text); --bs-btn-bg: var(--surface-2); --bs-btn-border-color: var(--border); --bs-btn-hover-bg: var(--brand-100); --bs-btn-hover-color: var(--brand-700); --bs-btn-hover-border-color: var(--brand-100); }
[data-bs-theme="dark"] .btn-soft { --bs-btn-hover-color: #a5d6a7; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 1.1rem; text-decoration: none;
  transition: background .15s, color .15s;
}
.icon-btn:hover, .icon-btn.active { background: var(--brand-100); color: var(--brand-700); }
[data-bs-theme="dark"] .icon-btn:hover, [data-bs-theme="dark"] .icon-btn.active { color: #a5d6a7; }

/* ---------- Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 1030; height: var(--header-h);
  display: flex; align-items: center; padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); flex-shrink: 0; }
.brand-logo { border-radius: 50%; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.brand-sub { font-size: .78rem; color: var(--muted); font-weight: 600; }
.brand-sub b { color: var(--brand); }
.main-nav { gap: .25rem; margin-left: 1.25rem; }
.main-nav a {
  display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .85rem; border-radius: 999px;
  color: var(--muted); font-weight: 600; font-size: .93rem; text-decoration: none; transition: background .15s, color .15s;
}
.main-nav a:hover { color: var(--text); background: var(--surface-2); }
.main-nav a.active { color: var(--brand-700); background: var(--brand-100); }
[data-bs-theme="dark"] .main-nav a.active { color: #a5d6a7; }
.nav-count { background: var(--brand); color: #fff; font-size: .7rem; border-radius: 999px; padding: .05rem .4rem; }
.header-search { position: relative; align-items: center; }
.header-search i { position: absolute; left: .85rem; color: var(--muted); }
.header-search input {
  width: 260px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 999px; padding: .5rem 1rem .5rem 2.3rem; font-size: .9rem; transition: width .2s, background .2s;
}
.header-search input:focus { outline: none; width: 320px; background: var(--surface); border-color: var(--brand); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff; padding: 3rem 0 3.25rem;
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(132, 204, 22, .35), transparent 60%),
    radial-gradient(700px 380px at -10% 120%, rgba(30, 136, 229, .30), transparent 60%),
    linear-gradient(135deg, var(--brand-700) 0%, var(--brand) 55%, #3c8f2f 100%);
}
.hero::after {
  content: ""; position: absolute; right: -120px; top: -120px; width: 420px; height: 420px; border-radius: 50%;
  border: 46px solid rgba(255, 255, 255, .06); pointer-events: none;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: .5rem; font-size: .8rem; font-weight: 700; letter-spacing: .02em;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2); padding: .35rem .8rem; border-radius: 999px;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #b9f6ca; box-shadow: 0 0 0 0 rgba(185, 246, 202, .8); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(185, 246, 202, 0); } 100% { box-shadow: 0 0 0 0 rgba(185, 246, 202, 0); } }
.hero-title { font-weight: 800; font-size: clamp(2rem, 5vw, 3.3rem); letter-spacing: -.035em; line-height: 1.05; margin: 1rem 0 .8rem; }
.hero-title span { color: #d6f5a3; }
.hero-lead { font-size: 1.08rem; opacity: .92; max-width: 560px; }
.hero-search {
  position: relative; display: flex; align-items: center; background: #fff; border-radius: 999px; padding: .35rem;
  max-width: 580px; box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .45); margin-top: 1.4rem;
}
.hero-search i { position: absolute; left: 1.15rem; color: #6b7a70; font-size: 1.1rem; }
.hero-search input { flex: 1; border: 0; outline: 0; padding: .7rem .8rem .7rem 2.8rem; font-size: 1.02rem; background: transparent; color: #13221a; min-width: 0; }
.hero-search .btn { border-radius: 999px; padding: .6rem 1.4rem; }
.hero-sync { font-size: .85rem; opacity: .8; margin: .9rem 0 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.kpi {
  display: flex; flex-direction: column; gap: .15rem; padding: 1.1rem 1.2rem; border-radius: var(--radius);
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); color: #fff; text-decoration: none;
  backdrop-filter: blur(6px);
}
.kpi-main { grid-column: 1 / -1; background: #fff; color: var(--brand-900); transition: transform .15s; }
.kpi-main:hover { transform: translateY(-2px); color: var(--brand-900); }
.kpi-label { font-size: .82rem; font-weight: 600; opacity: .85; }
.kpi-value { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.kpi-main .kpi-value { font-size: 3rem; color: var(--brand); }
.kpi-delta { font-size: .82rem; font-weight: 700; }
.kpi-delta.up { color: #c62828; }
.kpi-delta.down { color: var(--brand); }

/* ---------- Chips ---------- */
.chip-scroller { display: flex; gap: .5rem; overflow-x: auto; padding: 1.25rem 0 .25rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chip-scroller::-webkit-scrollbar { display: none; }
.chip-scroller-tight { padding: .75rem 0 0; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  --chip: var(--brand);
  display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; padding: .5rem .95rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 600; font-size: .88rem;
  text-decoration: none; box-shadow: var(--shadow-sm); transition: all .15s; cursor: pointer; user-select: none;
}
.chip i { color: var(--chip); }
.chip:hover { border-color: var(--chip); color: var(--text); }
.chip.active, .chip-check:has(input:checked) { background: var(--chip); border-color: var(--chip); color: #fff; }
.chip.active i, .chip-check:has(input:checked) i { color: #fff; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-micro { --chip: var(--c-micro); } .chip-allergeni { --chip: var(--c-allergeni); } .chip-chimico { --chip: var(--c-chimico); }
.chip-fisico { --chip: var(--c-fisico); } .chip-materiali { --chip: var(--c-materiali); } .chip-altro { --chip: var(--c-altro); }
.chip-revoca { --chip: var(--c-revoca); } .chip-avviso { --chip: var(--c-avviso); }

/* ---------- Category colors ---------- */
.cat-micro { --cat: var(--c-micro); } .cat-allergeni { --cat: var(--c-allergeni); } .cat-chimico { --cat: var(--c-chimico); }
.cat-fisico { --cat: var(--c-fisico); } .cat-materiali { --cat: var(--c-materiali); } .cat-altro { --cat: var(--c-altro); }
.cat-revoca { --cat: var(--c-revoca); } .cat-avviso { --cat: var(--c-avviso); }
.bg-cat-micro { background: var(--c-micro); } .bg-cat-allergeni { background: var(--c-allergeni); } .bg-cat-chimico { background: var(--c-chimico); }
.bg-cat-fisico { background: var(--c-fisico); } .bg-cat-materiali { background: var(--c-materiali); } .bg-cat-altro { background: var(--c-altro); }
.bg-cat-revoca { background: var(--c-revoca); } .bg-cat-avviso { background: var(--c-avviso); }
.cat-badge {
  display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 700; padding: .22rem .6rem; border-radius: 999px;
  color: var(--cat); background: color-mix(in srgb, var(--cat) 12%, transparent); border: 1px solid color-mix(in srgb, var(--cat) 22%, transparent);
}
.new-badge { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: .2rem .5rem; border-radius: 6px; background: var(--accent); color: #1a1a1a; }
.arch-badge { font-size: .7rem; font-weight: 700; padding: .2rem .5rem; border-radius: 6px; background: var(--surface-2); color: var(--muted); }

/* ---------- Sections ---------- */
.section { margin-top: 2rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-head h2 { font-weight: 800; letter-spacing: -.02em; margin: 0; }
.section-head h2:not([class*="h"]) { font-size: 1.5rem; }
.section-link { font-weight: 700; text-decoration: none; font-size: .92rem; white-space: nowrap; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.35rem; box-shadow: var(--shadow-sm); }
.panel-title { font-size: 1.1rem; font-weight: 800; letter-spacing: -.01em; margin-bottom: .25rem; }
.panel-sub { color: var(--muted); font-size: .88rem; margin-bottom: 1rem; }
.page-head { padding: 2rem 0 .5rem; }
.page-title { font-weight: 800; letter-spacing: -.035em; font-size: clamp(1.8rem, 4vw, 2.5rem); margin-bottom: .3rem; }
.page-sub { color: var(--muted); margin-bottom: 0; max-width: 680px; }

/* ---------- Recall card ---------- */
.rcard {
  position: relative; height: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease, border-color .18s; overflow: hidden;
}
.rcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 25%, var(--border)); }
.rcard-link { display: flex; gap: .95rem; padding: .9rem; height: 100%; color: inherit; text-decoration: none; }
.rcard-link:hover { color: inherit; }
.rcard-media {
  flex: 0 0 96px; height: 96px; border-radius: 14px; overflow: hidden; display: grid; place-items: center;
  background: color-mix(in srgb, var(--cat) 10%, var(--surface-2)); color: var(--cat); font-size: 2rem;
}
.rcard-media img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.rcard-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: .3rem; padding-right: 1.6rem; }
.rcard-meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.rcard-date { font-size: .78rem; color: var(--muted); font-weight: 600; margin-left: auto; }
.rcard-title { font-size: 1rem; font-weight: 700; line-height: 1.3; margin: .1rem 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; letter-spacing: -.01em; }
.rcard-brand { font-size: .85rem; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rcard-lotto { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: auto; }
.rcard-lotto span { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); background: var(--surface-2); padding: .05rem .35rem; border-radius: 5px; }
.fav-btn {
  position: absolute; top: .55rem; right: .55rem; width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: transparent; color: var(--muted); display: grid; place-items: center; font-size: 1.05rem; z-index: 2; transition: all .15s;
}
.fav-btn:hover { background: var(--surface-2); color: var(--brand); }
.fav-btn.saved { color: var(--brand); }
.fav-btn.saved i::before { content: "\f199"; } /* bookmark-fill */
.pantry-flag { display: none; font-size: .75rem; font-weight: 700; color: #8a5a00; background: #fff4d6; border-radius: 6px; padding: .15rem .45rem; align-self: flex-start; }
[data-bs-theme="dark"] .pantry-flag { background: #3a2f12; color: #ffd54f; }
.rcard.in-pantry { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.rcard.in-pantry .pantry-flag { display: inline-flex; gap: .3rem; align-items: center; }
.load-more-wrap { text-align: center; padding-top: 1rem; }

/* ---------- Mini list ---------- */
.mini-list { list-style: none; padding: 0; margin: 0; }
.mini-list li + li { border-top: 1px solid var(--border); }
.mini-list a { display: flex; flex-direction: column; padding: .7rem 0; text-decoration: none; color: inherit; }
.mini-list a:hover .mini-title { color: var(--brand); }
.mini-title { font-weight: 700; font-size: .95rem; line-height: 1.3; }
.mini-meta { font-size: .8rem; color: var(--muted); }

/* ---------- Promo ---------- */
.promo { display: flex; align-items: center; gap: 1rem; padding: 1.2rem 1.35rem; border-radius: var(--radius); text-decoration: none; transition: transform .15s; height: 100%; }
.promo:hover { transform: translateY(-2px); }
.promo strong { display: block; font-size: 1.05rem; }
.promo span { font-size: .88rem; opacity: .9; }
.promo-icon { font-size: 1.6rem; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; }
.promo-brand { background: linear-gradient(135deg, var(--brand-700), var(--brand)); color: #fff; }
.promo-brand:hover { color: #fff; }
.promo-brand .promo-icon { background: rgba(255, 255, 255, .16); }
.promo-light { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.promo-light:hover { color: var(--text); }
.promo-light .promo-icon { background: #fff4d6; color: #b07a00; }
[data-bs-theme="dark"] .promo-light .promo-icon { background: #3a2f12; color: #ffd54f; }

/* ---------- Filters ---------- */
.filters-bar {
  position: sticky; top: var(--header-h); z-index: 1020; padding: .75rem 0 .6rem; margin-bottom: 1rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.filters { display: flex; gap: .5rem; }
.filters-search { position: relative; flex: 1; min-width: 0; }
.filters-search i { position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filters-search input, .filters .form-select {
  height: 46px; border-radius: 14px; border: 1px solid var(--border); background-color: var(--surface); color: var(--text); font-weight: 500;
}
.filters-search input { width: 100%; padding: 0 1rem 0 2.5rem; }
.filters-search input:focus, .filters .form-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }
.filters .form-select { width: auto; max-width: 170px; }
.filters-submit { border-radius: 14px; height: 46px; padding: 0 1rem; }
.chip-scroller-tight .chip { padding: .38rem .8rem; font-size: .82rem; box-shadow: none; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 4rem 1rem; max-width: 520px; margin: 0 auto; }
.empty-state > i { font-size: 3rem; color: var(--brand); display: inline-grid; place-items: center; width: 88px; height: 88px; border-radius: 50%; background: var(--brand-100); margin-bottom: 1rem; }
.empty-state h1, .empty-state h2 { font-weight: 800; font-size: 1.5rem; }
.empty-state p { color: var(--muted); }

/* ---------- Detail ---------- */
.detail { padding-top: 1.25rem; }
.back-link { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; text-decoration: none; margin-bottom: 1rem; color: var(--muted); }
.back-link:hover { color: var(--brand); }
.gallery { position: sticky; top: calc(var(--header-h) + 1rem); }
.gallery-main { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; aspect-ratio: 4 / 3.2; display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.gallery-main img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.gallery-thumbs { display: flex; gap: .5rem; margin-top: .6rem; }
.gallery-thumbs button { width: 72px; height: 60px; padding: 0; border-radius: 10px; border: 2px solid var(--border); overflow: hidden; background: #fff; }
.gallery-thumbs button.active { border-color: var(--brand); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.gallery-note { font-size: .75rem; color: var(--muted); margin: .5rem 0 0; }
.gallery-placeholder {
  aspect-ratio: 4 / 3; border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem;
  background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--cat) 22%, transparent), transparent 60%), color-mix(in srgb, var(--cat) 9%, var(--surface));
  color: var(--cat); border: 1px solid color-mix(in srgb, var(--cat) 20%, var(--border)); font-weight: 700; text-align: center; padding: 1rem;
}
.gallery-placeholder i { font-size: 4.5rem; }
.detail-kicker { color: var(--muted); font-size: .9rem; font-weight: 600; margin: .3rem 0 .2rem; }
.detail-title { font-weight: 800; letter-spacing: -.03em; font-size: clamp(1.6rem, 3.6vw, 2.3rem); line-height: 1.12; margin-bottom: .35rem; }
.detail-brand { font-size: 1.1rem; font-weight: 600; color: var(--muted); }
.detail-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.1rem 0 1.4rem; }
.detail-actions [data-fav].saved { --bs-btn-bg: var(--brand-700); }
.detail-actions [data-fav].saved i::before { content: "\f199"; }
.callout { display: flex; gap: .9rem; padding: 1rem 1.15rem; border-radius: var(--radius-sm); margin-bottom: 1rem; --cat: var(--c-altro);
  background: color-mix(in srgb, var(--cat) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--cat) 25%, transparent); }
.callout > i { color: var(--cat); font-size: 1.4rem; line-height: 1.2; }
.callout strong { display: block; margin-bottom: .15rem; }
.callout p { margin: 0; }
.callout-micro { --cat: var(--c-micro); } .callout-allergeni { --cat: var(--c-allergeni); } .callout-chimico { --cat: var(--c-chimico); }
.callout-fisico { --cat: var(--c-fisico); } .callout-materiali { --cat: var(--c-materiali); } .callout-altro { --cat: var(--c-altro); }
.callout-revoca { --cat: var(--c-revoca); } .callout-avviso { --cat: var(--c-avviso); } .callout-warning { --cat: var(--accent-600); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.fact { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem .9rem; min-width: 0; }
.fact dt { font-size: .76rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .2rem; }
.fact dt i { color: var(--brand); }
.fact dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.fact-key { grid-column: span 2; background: var(--brand-50); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }
.fact-key dd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.02rem; }
.facts-compact { grid-template-columns: 1fr 1fr; }
.pdf-preview { margin: 1rem 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.pdf-preview summary { padding: .8rem 1rem; font-weight: 700; cursor: pointer; }
.pdf-preview object { width: 100%; height: 720px; border-top: 1px solid var(--border); display: block; }
.detail-source { font-size: .82rem; color: var(--muted); margin-top: 1rem; }

/* ---------- Stats ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; display: flex; flex-direction: column; box-shadow: var(--shadow-sm); }
.stat-label { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; color: var(--brand); line-height: 1.15; }
.stat-sub { font-size: .82rem; color: var(--muted); }
.chart-box { position: relative; height: 300px; }
.chart-box-sm { height: 220px; }
.legend-list { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .35rem; font-size: .88rem; }
.legend-list li { display: flex; align-items: center; gap: .5rem; }
.legend-list b { margin-left: auto; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.bar-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.bar-list li { display: grid; grid-template-columns: minmax(0, 11rem) 1fr 2.5rem; align-items: center; gap: .75rem; font-size: .88rem; }
.bar-label { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: inherit; text-decoration: none; }
a.bar-label:hover { color: var(--brand); }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--lime)); }
.bar-fill-alt { background: linear-gradient(90deg, var(--sky), #4fc3f7); }
.bar-list b { text-align: right; }

/* ---------- Pantry / notifications ---------- */
.seg-tabs { display: inline-flex; gap: .25rem; background: var(--surface-2); padding: .3rem; border-radius: 999px; margin-bottom: 1rem; border: 1px solid var(--border); }
.seg-tabs button { border: 0; background: transparent; color: var(--muted); font-weight: 700; padding: .5rem 1rem; border-radius: 999px; font-size: .9rem; }
.seg-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-count { background: var(--brand); color: #fff; border-radius: 99px; font-size: .7rem; padding: .05rem .4rem; }
.watch-form { position: relative; display: flex; gap: .5rem; align-items: center; }
.watch-form i { position: absolute; left: 1rem; color: var(--brand); font-size: 1.1rem; }
.watch-form input { flex: 1; min-width: 0; height: 48px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); padding: 0 1rem 0 2.6rem; }
.watch-form input:focus { outline: none; border-color: var(--brand); background: var(--surface); }
.watch-form .btn { height: 48px; padding: 0 1.25rem; }
.watch-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .9rem; }
.watch-chip { display: inline-flex; align-items: center; gap: .35rem; background: var(--brand-100); color: var(--brand-700); font-weight: 700; border-radius: 999px; padding: .35rem .45rem .35rem .85rem; font-size: .88rem; }
[data-bs-theme="dark"] .watch-chip { color: #a5d6a7; }
.watch-chip button { border: 0; background: rgba(0, 0, 0, .06); color: inherit; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; }
.watch-group { margin-bottom: 1.5rem; }
.watch-group h3 { font-size: 1rem; font-weight: 800; display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.watch-group h3 .badge { background: var(--surface-2); color: var(--muted); font-weight: 700; }
.notify-status { display: flex; gap: 1rem; align-items: center; }
.notify-status strong { display: block; font-size: 1.1rem; }
.notify-status span:not(.notify-icon) { color: var(--muted); font-size: .9rem; }
.notify-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 1.6rem; background: var(--surface-2); color: var(--muted); flex-shrink: 0; }
.notify-status.on .notify-icon { background: var(--brand-100); color: var(--brand); }
.ios-hint { margin-top: 1.25rem; padding: 1rem; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .9rem; }
.ios-hint ol { margin: .5rem 0 0; padding-left: 1.2rem; }
.pref-group { display: grid; gap: .5rem; margin: 1rem 0 1.25rem; }
.pref-title { font-size: .95rem; font-weight: 800; margin: 1.25rem 0 .6rem; }
.pref-title small { font-weight: 500; color: var(--muted); }
.pref-switch { display: flex; gap: .85rem; align-items: center; padding: .75rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--border); cursor: pointer; background: var(--surface); }
.pref-switch:has(input:checked) { border-color: color-mix(in srgb, var(--brand) 40%, transparent); background: var(--brand-50); }
.pref-switch input { appearance: none; width: 44px; height: 26px; border-radius: 99px; background: var(--border); position: relative; flex-shrink: 0; transition: background .2s; cursor: pointer; }
.pref-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.pref-switch input:checked { background: var(--brand); }
.pref-switch input:checked::after { transform: translateX(18px); }
.pref-switch b { display: block; font-size: .95rem; }
.pref-switch small { color: var(--muted); }
.prose p, .prose li { color: var(--text); }
.prose .panel-title:not(:first-child) { margin-top: 1.25rem; }

/* ---------- Footer ---------- */
.app-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 2.25rem 0 2rem; margin-top: 2rem; }
.app-footer a { text-decoration: none; }
.app-footer li { margin-bottom: .35rem; }
.footer-title { font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .6rem; }

/* ---------- Mobile tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--border);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; text-decoration: none; color: var(--muted); font-size: .68rem; font-weight: 700; }
.tab-icon { position: relative; font-size: 1.3rem; width: 52px; height: 30px; display: grid; place-items: center; border-radius: 99px; transition: background .15s; }
.tabbar a.active { color: var(--brand-700); }
[data-bs-theme="dark"] .tabbar a.active { color: #a5d6a7; }
.tabbar a.active .tab-icon { background: var(--brand-100); }
.tab-badge { position: absolute; top: -2px; right: 6px; background: var(--accent); color: #1a1a1a; font-size: .6rem; font-weight: 800; border-radius: 99px; padding: 0 .3rem; line-height: 1.4; }
.app-toasts { bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 1090; }
.app-toasts .toast { background: var(--text); color: var(--bg); border: 0; border-radius: 999px; box-shadow: var(--shadow); }
.app-toasts .toast-body { padding: .7rem 1.2rem; font-weight: 600; display: flex; gap: .5rem; align-items: center; }

@media (max-width: 991.98px) {
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .app-toasts { bottom: calc(var(--tabbar-h) + 1rem + env(safe-area-inset-bottom)); }
  .app-footer { margin-top: 1rem; }
  .gallery { position: static; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
  :root { --header-h: 60px; }
  .container-xl { --bs-gutter-x: 2rem; }
  .brand-logo { width: 38px; height: 38px; }
  .hero { padding: 2rem 0 2.25rem; }
  .hero-search .btn { padding: .6rem 1rem; }
  .kpi-value { font-size: 1.7rem; }
  .kpi-main .kpi-value { font-size: 2.4rem; }
  .filters { flex-wrap: wrap; }
  .filters-search { flex: 1 1 100%; }
  .filters .form-select { flex: 1; max-width: none; }
  .rcard-media { flex-basis: 84px; height: 84px; }
  .facts { grid-template-columns: 1fr; }
  .fact-key { grid-column: auto; }
  .bar-list li { grid-template-columns: minmax(0, 8rem) 1fr 2rem; }
  .stat-value { font-size: 1.8rem; }
  .section-head h2:not([class*="h"]) { font-size: 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (display-mode: standalone) and (max-width: 991.98px) {
  .app-footer { display: none; }
}
@media (max-width: 575.98px) {
  .kpi { padding: .85rem .9rem; }
  .kpi-value { font-size: 1.45rem; }
  .kpi-label { font-size: .74rem; }
}

/* ---------- Riquadro di stato personale (home) ---------- */
.status-card {
  display: block; border-radius: 20px; padding: 1.1rem; margin-bottom: 1rem; max-width: 580px; text-decoration: none;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .45);
}
.status-head { display: flex; gap: .85rem; align-items: center; }
.status-head h2 { font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; margin: 0 0 .15rem; }
.status-head p { font-size: .9rem; line-height: 1.4; margin: 0; }
.status-head small { display: block; font-size: .78rem; margin-top: .2rem; opacity: .75; }
.status-icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 1.3rem; }
.status-arrow { margin-left: auto; font-size: 1.15rem; flex-shrink: 0; }
.status-invite, .status-ok { background: #fff; color: #14201a; }
.status-invite p, .status-ok p { color: #4a5a50; }
.status-invite .status-icon { background: #e3f1e5; color: var(--brand-700); }
.status-btn-main { margin-top: 1rem; background: var(--brand-700); color: #fff; border-radius: 12px; font-weight: 700; padding: .7rem 1rem; }
.status-btn-main:hover { background: var(--brand-900); color: #fff; }
.status-ok { transition: transform .15s; }
.status-ok:hover { transform: translateY(-2px); color: #14201a; }
.status-ok .status-icon { width: 52px; height: 52px; background: var(--brand-700); color: #fff; font-size: 1.5rem; }
.status-ok h2 { color: var(--brand-700); }
.status-danger { background: #c62828; color: #fff; }
.status-danger .status-icon { background: #fff; color: #c62828; }
.status-danger .status-head p { color: #fde7e5; }
.status-recall {
  display: flex; flex-direction: column; gap: .3rem; background: #fff; color: #14201a; border-radius: 14px; padding: .9rem 1rem;
  margin-top: .9rem; text-decoration: none;
}
.status-recall:hover { color: #14201a; }
.status-recall strong { font-size: 1.02rem; font-weight: 800; line-height: 1.3; }
.status-recall-brand { font-size: .85rem; color: #4a5a50; }
.status-recall-lotto { font-size: .82rem; font-weight: 700; }
.status-recall-lotto code { font-size: .85rem; color: #c62828; background: #fdeceb; border-radius: 6px; padding: .1rem .45rem; margin-left: .25rem; font-weight: 700; }
.status-recall-motivo { font-size: .82rem; color: #c62828; }
.status-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .75rem; }
.status-actions form { margin: 0; }
.status-actions .btn { border-radius: 12px; font-weight: 700; padding: .6rem .5rem; font-size: .9rem; }
.status-btn-light { background: #fff; color: #c62828; border: 1px solid #fff; }
.status-btn-light:hover { background: #fdeceb; color: #a31f1f; }
.status-btn-outline { background: #a31f1f; color: #fff; border: 1px solid rgba(255, 255, 255, .6); }
.status-btn-outline:hover { background: #8e1b1b; color: #fff; }
.status-more { display: inline-block; margin-top: .7rem; color: #fff; font-weight: 700; font-size: .88rem; }
.status-more:hover { color: #fde7e5; }
.nav-count-alert, .tab-badge { background: #c62828 !important; color: #fff !important; }
.chip-dispensa { --chip: #c62828; }
#cosa-fare { scroll-margin-top: calc(var(--header-h) + 1rem); }

/* ---------- Seguiti ---------- */
.btn-brand-dark { --bs-btn-color: #fff; --bs-btn-bg: var(--brand-700); --bs-btn-border-color: var(--brand-700); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--brand-900); --bs-btn-hover-border-color: var(--brand-900); --bs-btn-active-bg: var(--brand-900); --bs-btn-active-color: #fff; }
.follow-form { max-width: 720px; }
.follow-row { display: flex; gap: .5rem; }
.follow-input { position: relative; flex: 1; min-width: 0; }
.follow-input i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.follow-input input { width: 100%; height: 48px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0 1rem 0 2.6rem; }
.follow-input input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }
.follow-row .btn { height: 48px; padding: 0 1.25rem; font-weight: 700; white-space: nowrap; }
.follow-opts { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .6rem; font-size: .85rem; color: var(--muted); }
.opt-pill { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: .25rem .75rem; cursor: pointer; font-weight: 600; color: var(--text); }
.opt-pill input { accent-color: var(--brand); }
.opt-pill:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
.follow-brand { flex: 1 1 200px; height: 34px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0 .9rem; font-size: .85rem; }
.follow-brand:focus { outline: none; border-color: var(--brand); }
.follow-form:not(:has(input[value="prodotto"]:checked)) .follow-brand { display: none; }
.chip-dark.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.follow-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; max-width: 720px; }
.follow-item { display: flex; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: .6rem .6rem .6rem .75rem; box-shadow: var(--shadow-sm); }
.follow-item form { margin: 0; }
.follow-link { display: flex; align-items: center; gap: .8rem; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.follow-link:hover strong { color: var(--brand); }
.follow-avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--brand-50); color: var(--brand-700); font-weight: 800; border: 1px solid var(--border); }
.follow-text { display: flex; flex-direction: column; min-width: 0; }
.follow-text strong { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.follow-text small { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.follow-badge { flex-shrink: 0; font-size: .75rem; font-weight: 800; border-radius: 8px; padding: .25rem .55rem; text-decoration: none; white-space: nowrap; }
.follow-badge-alert { background: #c62828; color: #fff; }
.follow-badge-alert:hover { background: #a31f1f; color: #fff; }
.follow-badge-ok { background: var(--brand-100); color: var(--brand-700); }
[data-bs-theme="dark"] .follow-badge-ok { color: #a5d6a7; }
.follow-remove { border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }
.follow-remove:hover { background: var(--surface-2); color: #c62828; }

/* ---------- Account ---------- */
.auth-card { max-width: 460px; margin: 2.5rem auto 0; padding: 2rem 1.75rem; text-align: left; }
.auth-card h1 { font-weight: 800; letter-spacing: -.02em; margin-top: .8rem; }
.auth-gate { max-width: 560px; margin: 1rem auto; text-align: center; padding: 2.25rem 1.5rem; }
.auth-gate h2 { font-weight: 800; font-size: 1.4rem; margin-top: .9rem; }
.auth-gate p { color: var(--muted); }
.auth-gate-icon { width: 64px; height: 64px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 1.7rem; background: #f5b731; color: #14201a; }
.auth-form .form-control { height: 48px; border-radius: 12px; background: var(--surface); }
.auth-form .form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 1.25rem 0 1.25rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; }
.auth-switch-btn { border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: .9rem; padding: .55rem .5rem; border-radius: 999px; white-space: nowrap; }
.auth-switch-btn.active { background: var(--surface); color: var(--brand-700); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
[data-bs-theme="dark"] .auth-switch-btn.active { color: #a5d6a7; }
.auth-hint { font-size: .82rem; color: var(--muted); margin: .9rem 0 0; }
.auth-divider { display: flex; align-items: center; gap: .75rem; margin: 1.5rem 0 1rem; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-form .code-input { height: 64px; font-size: 1.9rem; font-weight: 800; letter-spacing: .5em; text-align: center; padding-left: .5em; font-variant-numeric: tabular-nums; }
.social-modal { border-radius: 20px; border: 0; }
.social-modal .modal-body { padding: 1.75rem 1.5rem; }
.social-warn-icon { width: 56px; height: 56px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 1.5rem; background: #fdecea; color: #c62828; }
[data-bs-theme="dark"] .social-warn-icon { background: #3a1d1d; color: #ef9a9a; }
.social-btn { border: 1px solid var(--border); background: var(--surface); color: var(--bs-body-color); font-weight: 700; padding: .65rem 1rem; }
.social-btn:hover { background: var(--surface-2); color: var(--bs-body-color); }
.social-btn-google .bi { color: #4285f4; }
.social-btn-facebook .bi { color: #1877f2; }
form.watch-chip { margin: 0; }
.nav-logo { border-radius: 50%; display: block; }
.main-nav .nav-logo { display: inline-block; }
