/* FoodTrack — design system (Material 3 inspired), shared by the app, the admin portal and the other pages.
 *
 * Tokens:      colors (light/dark), radii, elevation
 * Components:  app bar, navigation bar, FAB, card, list row, tile (leading icon), status chip, banner,
 *              buttons, text fields, search bar, segmented button, chips, bottom sheet, menu, snackbar, empty state
 */
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('fonts/inter-latin-wght-normal.woff2') format('woff2-variations'), url('fonts/inter-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('fonts/inter-latin-ext-wght-normal.woff2') format('woff2-variations'), url('fonts/inter-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --primary: #3D8B40;
  --on-primary: #FFFFFF;
  --primary-container: #C8EBC5;
  --on-primary-container: #0A3A10;
  --brand: #4CAF50;              /* FoodTrack green: logo, accents, splash */
  --bg: #F5F7F4;
  --surface: #FFFFFF;
  --surface-1: #FFFFFF;          /* cards */
  --surface-2: #EDF1EB;          /* hover / pressed / inputs */
  --surface-3: #E4EAE2;
  --card-border: rgba(25, 40, 25, .07);
  --card-shadow: 0 1px 2px rgba(16, 32, 16, .05), 0 2px 8px rgba(16, 32, 16, .04);
  --text: #1A1C19;
  --muted: #5C6459;
  --outline: #8F978C;
  --outline-variant: #CDD5CA;
  --danger: #BA1A1A;
  --danger-container: #FFDAD6;
  --on-danger-container: #410002;
  --warn: #8A5A00;
  --warn-container: #FFE7AE;
  --on-warn-container: #2E2000;
  --ok: #2E7D32;
  --scrim: rgba(0,0,0,.42);
  --shadow-1: 0 1px 2px rgba(0,0,0,.12), 0 1px 3px 1px rgba(0,0,0,.06);
  --shadow-3: 0 4px 8px 3px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.16);
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 28px;
  --nav-h: 76px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #8FD88B; --on-primary: #00390A; --primary-container: #1D5221; --on-primary-container: #C8EBC5;
    --brand: #66BB6A;
    --bg: #0F120F; --surface: #171A16; --surface-1: #1A1F1A; --surface-2: #252B24; --surface-3: #2E352D; --card-border: rgba(255,255,255,.06); --card-shadow: none;
    --text: #E1E4DD; --muted: #A9B2A5; --outline: #8A9386; --outline-variant: #3F473D;
    --danger: #FFB4AB; --danger-container: #93000A; --on-danger-container: #FFDAD6;
    --warn: #F4C25B; --warn-container: #5C4200; --on-warn-container: #FFE7AE; --ok: #8FD88B;
    --scrim: rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --primary: #8FD88B; --on-primary: #00390A; --primary-container: #1D5221; --on-primary-container: #C8EBC5;
  --brand: #66BB6A;
  --bg: #0F120F; --surface: #171A16; --surface-1: #1A1F1A; --surface-2: #252B24; --surface-3: #2E352D; --card-border: rgba(255,255,255,.06); --card-shadow: none;
  --text: #E1E4DD; --muted: #A9B2A5; --outline: #8A9386; --outline-variant: #3F473D;
  --danger: #FFB4AB; --danger-container: #93000A; --on-danger-container: #FFDAD6;
  --warn: #F4C25B; --warn-container: #5C4200; --on-warn-container: #FFE7AE; --ok: #8FD88B;
  --scrim: rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font: 15px/1.5 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  letter-spacing: -.006em;
  background: var(--bg); color: var(--text);
  min-height: 100vh; min-height: 100dvh;
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
.ic { width: 24px; height: 24px; fill: currentColor; flex: none; }
svg.pic { width: 26px; height: 26px; flex: none; color: inherit; overflow: visible; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.center { text-align: center; }
.spacer { height: 12px; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }

/* ---------- Layout ---------- */
#app { max-width: 720px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); position: relative; }
main.view { flex: 1; padding: 16px 16px calc(var(--nav-h) + 96px + env(safe-area-inset-bottom)); }
main.view.no-nav { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
main.view.no-fab { padding-bottom: calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
@media (min-width: 721px) { body { background: var(--surface-1); } #app { box-shadow: var(--shadow-1); } }

/* ---------- App bar (clean surface, green accents) ---------- */
.appbar {
  position: sticky; top: 0; z-index: 20; color: var(--text);
  background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  padding: calc(env(safe-area-inset-top) + 10px) 10px 10px 18px; display: flex; align-items: flex-end; gap: 4px; min-height: 64px;
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
body.scrolled .appbar { border-bottom-color: var(--outline-variant); }
.appbar .titles { flex: 1; min-width: 0; }
.appbar .brand { display: flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 600; color: var(--primary); }
.appbar .brand img { width: 18px; height: 18px; }
.appbar h1 { margin: 6px 0 0; font-size: 1.75rem; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar.small { align-items: center; padding-left: 6px; }
.appbar.small h1 { font-size: 1.15rem; font-weight: 650; letter-spacing: -.015em; margin: 0 0 0 4px; }
.appbar .icon-btn { color: inherit; }
.household-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-container); border: 0; color: var(--on-primary-container); border-radius: 999px; padding: 2px 9px 2px 7px; font-size: .74rem; font-weight: 600; cursor: pointer; max-width: 50vw; letter-spacing: 0; }
.household-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.household-chip .ic { width: 14px; height: 14px; }

.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #66BB6A, #2E7D32); color: #fff; display: grid; place-items: center; font-weight: 650; font-size: .88rem; border: 0; cursor: pointer; flex: none; letter-spacing: 0; }
.appbar .avatar { margin: 0 4px 2px 6px; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--primary-container); }
.avatar.lg { width: 60px; height: 60px; font-size: 1.35rem; }

/* ---------- Navigation bar & FAB ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; color: var(--muted);
  background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--outline-variant);
  display: flex; justify-content: space-around; padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  max-width: 720px; margin: 0 auto;
}
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: inherit; font-size: .74rem; font-weight: 600; }
.bottomnav a .pill { width: 60px; height: 32px; border-radius: 999px; display: grid; place-items: center; transition: background .2s, color .2s; }
.bottomnav a.active { color: var(--text); }
.bottomnav a.active .pill { background: var(--primary-container); color: var(--on-primary-container); }
.fab {
  position: fixed; z-index: 25; right: max(16px, calc(50vw - 360px + 16px)); bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 10px; height: 56px; padding: 0 20px 0 16px; border: 0; border-radius: var(--r-lg);
  background: var(--primary); color: var(--on-primary); font-weight: 650; font-size: .95rem; cursor: pointer;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--primary) 35%, transparent), 0 2px 6px rgba(0,0,0,.12);
}
.fab:hover { filter: brightness(.97); }
.no-nav ~ .fab, .fab.low { bottom: calc(20px + env(safe-area-inset-bottom)); }

/* ---------- Typography helpers ---------- */
.section-title { display: flex; align-items: center; gap: 8px; font-size: 1.08rem; font-weight: 700; letter-spacing: -.015em; margin: 26px 4px 10px; }
.section-title:first-child { margin-top: 4px; }
.section-title .count { font-size: .76rem; font-weight: 650; color: var(--on-primary-container); background: var(--primary-container); border-radius: 999px; padding: 1px 8px; }
.section-title .grow + .btn { margin: -6px 0; }
.lead { font-size: .92rem; margin: 0 0 12px; }
.helper { font-size: .8rem; color: var(--muted); margin: 6px 4px 0; }

/* ---------- Card & list row ---------- */
.card {
  background: var(--surface-1); border-radius: 20px; border: 1px solid var(--card-border); box-shadow: var(--card-shadow); width: 100%; text-align: left; color: inherit;
  display: block; padding: 0; position: relative; overflow: hidden;
}
.card.clickable, button.card { cursor: pointer; transition: background .15s; }
.card.clickable:hover, button.card:hover { border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.card.clickable:active, button.card:active { transform: scale(.995); }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 6px 12px 14px; min-height: 64px; width: 100%; background: transparent; border: 0; text-align: left; color: inherit; text-decoration: none; }
button.list-row, a.list-row { cursor: pointer; }
.list-row .body { flex: 1; min-width: 0; }
.list-row .title { font-size: 1rem; font-weight: 600; letter-spacing: -.01em; margin: 0; overflow-wrap: anywhere; line-height: 1.3; }
.list-row .sub { font-size: .84rem; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.list-row .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.list-row .trail { display: flex; align-items: center; color: var(--muted); }
.list-row.big { padding: 16px 6px 16px 16px; }
.list-row.big .title { font-size: 1.12rem; font-weight: 650; }
.list-row.done .title { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--muted); }
.list-row.danger, .list-row.danger .tile { color: var(--danger); }
.list-row.danger .tile { background: var(--danger-container); color: var(--on-danger-container); }
.group { background: var(--surface-1); border-radius: 20px; overflow: hidden; border: 1px solid var(--card-border); box-shadow: var(--card-shadow); }
.group > .list-row + .list-row { border-top: 1px solid var(--outline-variant); }
.group > button.list-row:hover, .group > a.list-row:hover { background: var(--surface-2); }

/* Leading tile: same container for pictograms and Material icons */
.tile { width: 44px; height: 44px; border-radius: var(--r-md); background: var(--primary-container); color: var(--on-primary-container); display: grid; place-items: center; flex: none; }
.tile svg.pic { width: 28px; height: 28px; }
.tile .ic { width: 22px; height: 22px; }
.tile-lg { width: 56px; height: 56px; border-radius: var(--r-lg); }
.tile-lg svg.pic { width: 34px; height: 34px; }
.tile-xl { width: 80px; height: 80px; border-radius: 24px; }
.tile-xl svg.pic { width: 46px; height: 46px; }
.tile-xl .ic { width: 36px; height: 36px; }
.tile-sm { width: 36px; height: 36px; border-radius: 10px; }
.tile-sm svg.pic { width: 22px; height: 22px; }
.tile-sm .ic { width: 20px; height: 20px; }

/* Status chip */
.status { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: .75rem; font-weight: 650; letter-spacing: 0; white-space: nowrap; }
.status .ic { width: 14px; height: 14px; }
.status.danger { background: var(--danger-container); color: var(--on-danger-container); }
.status.warn { background: var(--warn-container); color: var(--on-warn-container); }
.status.ok { background: var(--primary-container); color: var(--on-primary-container); }
.status.neutral { background: var(--surface-2); color: var(--muted); }
.status.neutral { background: var(--surface-2); }

/* Recipe card */
.recipe-card .cover { height: 168px; background: var(--surface-2) center/cover no-repeat; }
.recipe-card .list-row { padding-top: 10px; }
.hero-img { margin: -16px -16px 16px; height: 220px; background: var(--surface-2) center/cover no-repeat; }
.meta-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 6px; }

/* Numbered steps (procedure) */
.step { display: flex; gap: 14px; padding: 12px 14px; align-items: flex-start; }
.step .num { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-container); color: var(--on-primary-container); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.step p { margin: 3px 0 0; font-size: .93rem; }
.group > .step + .step { border-top: 1px solid var(--outline-variant); }

/* ---------- Banner ---------- */
.banner { display: flex; gap: 12px; border-radius: 20px; padding: 14px 14px 8px 16px; margin-bottom: 12px; }
.banner > .ic { margin-top: 1px; }
.banner .b-body { flex: 1; min-width: 0; }
.banner h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 600; }
.banner p { margin: 0; font-size: .88rem; line-height: 1.45; }
.banner .b-actions { display: flex; justify-content: flex-end; gap: 4px; margin: 6px -6px 0 0; flex-wrap: wrap; }
.banner .btn-text { color: inherit; }
.banner.danger { background: var(--danger-container); color: var(--on-danger-container); }
.banner.warn { background: var(--warn-container); color: var(--on-warn-container); }
.banner.info { background: var(--primary-container); color: var(--on-primary-container); }
.banner.danger .btn-filled { background: var(--danger); color: #fff; }
.banner.warn .btn-filled { background: var(--warn); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .banner.danger .btn-filled, :root:not([data-theme="light"]) .banner.warn .btn-filled { color: #1A1C19; } }
:root[data-theme="dark"] .banner.danger .btn-filled, :root[data-theme="dark"] .banner.warn .btn-filled { color: #1A1C19; }
.banner.info .btn-filled { background: var(--primary); color: var(--on-primary); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 0 22px; height: 42px; font-weight: 650; letter-spacing: -.005em; font-size: .9rem; cursor: pointer; transition: filter .15s, background .15s; white-space: nowrap; }
.btn .ic { width: 18px; height: 18px; margin-left: -4px; }
.btn-filled { background: var(--primary); color: var(--on-primary); }
.btn-filled:hover { filter: brightness(1.06); box-shadow: var(--shadow-1); }
.btn-tonal { background: var(--primary-container); color: var(--on-primary-container); }
.btn-tonal:hover { filter: brightness(.97); }
.btn-outline { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 1px var(--outline); }
.btn-outline:hover, .btn-text:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.btn-text { background: transparent; color: var(--primary); padding: 0 12px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-text { background: transparent; color: var(--danger); padding: 0 12px; }
.btn-danger-text:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn:disabled { opacity: .45; cursor: default; filter: none; box-shadow: none; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading .ic { opacity: 0; }
.btn.loading::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--on-primary); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn-text.loading::after, .btn-outline.loading::after, .btn-tonal.loading::after { border-color: var(--primary); border-right-color: transparent; }
.btn-block { width: 100%; height: 48px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: inherit; flex: none; }
.icon-btn:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.icon-btn.sm { width: 36px; height: 36px; }
.icon-btn.sm .ic { width: 20px; height: 20px; }
.icon-btn.tonal { background: var(--primary-container); color: var(--on-primary-container); }
.icon-btn.fav-on { color: #D93025; }
.appbar .icon-btn.fav-on { color: #D93025; }

/* ---------- Text fields (outlined) ---------- */
.field { position: relative; margin: 12px 0; }
.field .input {
  width: 100%; border: 1px solid transparent; border-radius: 14px; background: var(--surface-2); padding: 18px 14px 7px; min-height: 56px; outline: none; font-size: .98rem; transition: border-color .15s, background .15s;
}
.field .input:hover { background: var(--surface-3); }
.field textarea.input { resize: vertical; min-height: 88px; padding-top: 20px; }
.field select.input { appearance: none; padding-right: 40px; cursor: pointer; }
.field .chev { position: absolute; right: 12px; top: 15px; pointer-events: none; color: var(--muted); }
.field select.input option { background: var(--surface); color: var(--text); }
.field label {
  position: absolute; left: 14px; top: 16px; color: var(--muted); pointer-events: none; transition: all .15s; font-size: .98rem;
  max-width: calc(100% - 28px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.field .input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.field .input:focus + label, .field .input:not(:placeholder-shown) + label, .field select.input + label, .field input[type=date].input + label { top: 7px; font-size: .72rem; font-weight: 600; }
.field .input:focus + label { color: var(--primary); }
.field .input[readonly] { background: transparent; border-color: var(--outline-variant); }
.field .hint { font-size: .76rem; margin: 4px 14px 0; color: var(--muted); }
.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; gap: 14px; padding: 10px 2px; cursor: pointer; font-size: .95rem; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; margin: 0; }
.check.right { justify-content: space-between; }
.label { font-size: .78rem; font-weight: 600; color: var(--muted); margin: 14px 2px 6px; }

/* Search bar */
.searchbar { display: flex; align-items: center; gap: 4px; background: var(--surface-1); border: 1px solid var(--card-border); box-shadow: var(--card-shadow); border-radius: var(--r-xl); height: 52px; padding: 0 6px 0 16px; margin-bottom: 4px; }
.searchbar > .ic { color: var(--muted); }
.searchbar input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; height: 100%; padding: 0 8px; font-size: 1rem; }
.searchbar:focus-within { box-shadow: inset 0 0 0 2px var(--primary); }
.sheet .searchbar { background: var(--surface-2); box-shadow: none; border-color: transparent; }

/* Segmented button */
.seg { display: flex; gap: 4px; background: var(--surface-2); border-radius: 14px; padding: 4px; margin: 12px 0; height: 44px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 10px; padding: 0 6px; color: var(--muted); cursor: pointer; font-size: .84rem; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg button.sel { background: var(--surface); color: var(--text); font-weight: 650; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.seg button .ic { width: 16px; height: 16px; }

/* Filter / input chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--outline-variant); background: var(--surface-1); border-radius: 999px; height: 32px; padding: 0 12px; font-size: .84rem; font-weight: 500; cursor: pointer; color: inherit; }
.chip.sel { background: var(--primary-container); border-color: transparent; color: var(--on-primary-container); }
.chip .ic { width: 16px; height: 16px; }
.chip .x { display: inline-grid; margin-right: -6px; opacity: .7; }

/* Icon picker & Nutri-Score */
.icon-picker { max-width: 100%; display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 4px 0; scrollbar-width: thin; }
.icon-picker button { flex: none; width: 56px; height: 56px; border-radius: var(--r-md); border: 0; background: var(--surface-2); display: grid; place-items: center; cursor: pointer; }
.icon-picker button.sel { background: var(--primary-container); box-shadow: inset 0 0 0 2px var(--primary); }
.icon-picker svg.pic { width: 32px; height: 32px; }
.icon-picker button { color: var(--muted); }
.icon-picker button.sel { color: var(--on-primary-container); }
.icon-picker.grid { flex-wrap: wrap; max-height: 200px; overflow-y: auto; }
.nutri { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 6px 0 12px; }
.nutri button { border: 0; height: 40px; font-weight: 700; color: #fff; cursor: pointer; font-size: 1rem; border-radius: 6px; opacity: .5; transition: opacity .15s, transform .15s; }
.nutri button:first-child { border-radius: 999px 6px 6px 999px; } .nutri button:last-child { border-radius: 6px 999px 999px 6px; }
.nutri button.sel { opacity: 1; transform: scaleY(1.12); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.nutri.none button { opacity: .8; }
.nutri button:disabled { cursor: default; }
.nutri .A { background: #038141; } .nutri .B { background: #85BB2F; } .nutri .C { background: #FECB02; color: #222; } .nutri .D { background: #EE8100; } .nutri .E { background: #E63E11; }

/* Read-only detail rows (product / list item detail) */
.details { background: var(--surface-2); border-radius: var(--r-lg); padding: 4px 16px; margin-bottom: 12px; }
.details .d { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; font-size: .92rem; }
.details .d + .d { border-top: 1px solid var(--outline-variant); }
.details .d span:first-child { color: var(--muted); }
.details .d span:last-child { font-weight: 600; text-align: right; overflow-wrap: anywhere; }

/* ---------- Bottom sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0); display: flex; align-items: flex-end; justify-content: center; transition: background .22s; }
.sheet-backdrop.open { background: var(--scrim); }
.sheet {
  width: 100%; max-width: 640px; max-height: 92vh; max-height: 92dvh; background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 0 20px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .24s cubic-bezier(.2,.8,.2,1);
}
.sheet-backdrop.open .sheet { transform: translateY(0); }
.sheet-handle { width: 32px; height: 4px; border-radius: 2px; background: var(--outline); opacity: .6; margin: 0 auto; padding: 11px 24px; background-clip: content-box; box-sizing: content-box; cursor: grab; touch-action: none; }
.sheet-title { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; margin: 2px 0 14px; text-align: left; }
.sheet-body { overflow-y: auto; overflow-x: hidden; flex: 1; padding: 2px; margin: 0 -2px; min-width: 0; }
.sheet-text { margin: 0 0 12px; font-size: .92rem; color: var(--muted); }
.sheet-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding-top: 14px; flex-wrap: wrap; }
.sheet-actions .btn-danger-text, .sheet-actions .push-left { margin-right: auto; }
.menu { margin: 0; }
.menu-item { display: flex; align-items: center; gap: 16px; width: 100%; min-width: 0; border: 0; background: transparent; padding: 0 12px; height: 52px; font-size: 1rem; cursor: pointer; border-radius: var(--r-md); text-align: left; }
.menu-item:hover { background: var(--surface-2); }
.menu-item .ic { color: var(--muted); }
.menu-item.danger, .menu-item.danger .ic { color: var(--danger); }
.menu-item.selected { font-weight: 600; color: var(--primary); }
.menu-item.selected .ic { color: var(--primary); }
.menu-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

/* ---------- Plan ---------- */
.week-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; background: var(--surface-1); border: 1px solid var(--card-border); border-radius: 20px; padding: 6px; }
.week-nav .center strong { display: block; font-size: 1rem; }
.day { margin-bottom: 8px; }
.day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.day .day-head { display: flex; align-items: center; padding: 8px 6px 4px 16px; }
.day .day-head strong { flex: 1; text-transform: capitalize; font-weight: 600; }
.day .list-row { min-height: 52px; padding-top: 8px; padding-bottom: 8px; border-top: 1px solid var(--outline-variant); }
.day .none { padding: 0 16px 12px; font-size: .84rem; color: var(--muted); }

/* ---------- Empty state ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 32px 16px 20px; gap: 10px; }
.empty .tile-xl { background: var(--surface-2); color: var(--muted); }
.empty strong { font-size: 1.05rem; font-weight: 600; }
.empty p { margin: 0; font-size: .9rem; color: var(--muted); max-width: 340px; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.auth-top { color: var(--text); padding: calc(env(safe-area-inset-top) + 56px) 24px 28px; text-align: center;
  background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--brand) 26%, transparent) 0%, transparent 70%); }
.auth-top .logo { width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center; margin: 0 auto; background: var(--surface); box-shadow: 0 8px 28px color-mix(in srgb, var(--brand) 30%, transparent); }
.auth-top .logo img { width: 52px; height: 52px; }
.auth-top h1 { margin: 18px 0 4px; font-size: 2rem; font-weight: 750; letter-spacing: -.03em; }
.auth-top p { margin: 0; color: var(--muted); }
.auth-body { padding: 20px 20px 40px; max-width: 460px; width: 100%; margin: 0 auto; }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .82rem; margin: 18px 0 6px; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--outline-variant); }
.google-slot { display: flex; justify-content: center; min-height: 44px; margin: 8px 0; }
.features { margin: 24px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.features li { display: flex; gap: 14px; align-items: center; font-size: .9rem; }
.err-box { display: flex; gap: 10px; align-items: flex-start; background: var(--danger-container); color: var(--on-danger-container); border-radius: var(--r-md); padding: 10px 12px; font-size: .9rem; margin: 8px 0; }
.err-box .ic { width: 20px; height: 20px; }
.code-box { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.6rem; letter-spacing: .18em; text-align: center; background: var(--surface-2); border-radius: var(--r-lg); padding: 16px; font-weight: 700; user-select: all; }

/* ---------- Scanner ---------- */
.scanner { position: relative; background: #000; border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 4/3; margin-bottom: 8px; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner::after { content: ''; position: absolute; left: 12%; right: 12%; top: 50%; height: 2px; background: var(--primary); box-shadow: 0 0 10px var(--primary); }

/* ---------- Snackbar & loader ---------- */
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 90px + env(safe-area-inset-bottom)); transform: translate(-50%, 24px); opacity: 0; pointer-events: none; z-index: 200; background: #2F312D; color: #F0F1EC; padding: 0 8px 0 16px; min-height: 48px; border-radius: var(--r-sm); box-shadow: var(--shadow-3); transition: all .2s; display: flex; align-items: center; gap: 8px; max-width: min(560px, calc(100vw - 32px)); width: max-content; font-size: .9rem; }
#toast span { padding: 12px 8px 12px 0; }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast.error { background: var(--danger); color: #fff; }
#toast button { background: transparent; border: 0; color: #9EE29A; font-weight: 700; cursor: pointer; font-size: .88rem; padding: 8px; }
.loader { display: grid; place-items: center; min-height: 60vh; }
.loader::after { content: ''; width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--primary); border-right-color: transparent; animation: spin .8s linear infinite; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: .01s !important; } }

/* Misc components */
.page-title { margin: 0 0 6px; font-size: 1.55rem; font-weight: 750; letter-spacing: -.025em; line-height: 1.2; }
.tile.photo { background-size: cover; background-position: center; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 10px -16px 4px; padding: 0 16px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.scroll .chip { flex: none; }
.switch { width: 44px; height: 26px; border-radius: 999px; background: var(--surface-3); position: relative; transition: background .2s; margin-right: 10px; box-shadow: inset 0 0 0 1.5px var(--outline); }
.switch::after { content: ''; position: absolute; top: 5px; left: 5px; width: 16px; height: 16px; border-radius: 50%; background: var(--outline); transition: all .2s; }
.switch.on { background: var(--primary); box-shadow: none; }
.switch.on::after { left: 23px; top: 3px; width: 20px; height: 20px; background: var(--on-primary); }

/* ---------- Tutorial ---------- */
.tour-ovl { position: fixed; inset: 0; z-index: 150; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; transition: opacity .2s; }
.tour-ovl.open { opacity: 1; }
.tour { width: 100%; max-width: 420px; max-height: calc(100dvh - 32px); background: var(--surface); border-radius: 28px; padding: 14px 20px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; box-shadow: 0 24px 64px rgba(0,0,0,.3); transform: translateY(12px); transition: transform .2s; overflow: hidden; }
.tour-ovl.open .tour { transform: none; }
@media (max-width: 480px) { .tour-ovl { padding: 0; align-items: stretch; } .tour { max-width: none; max-height: none; border-radius: 0; padding-top: calc(14px + env(safe-area-inset-top)); } }
.tour-top { display: flex; justify-content: flex-end; min-height: 40px; }
.tour-stage { flex: 1; overflow-y: auto; touch-action: pan-y; }
.tour-slide { animation: tourIn .25s ease; text-align: center; }
@keyframes tourIn { from { opacity: 0; transform: translateX(16px); } }
.tour-slide h2 { font-size: 1.4rem; font-weight: 750; letter-spacing: -.02em; margin: 18px 0 8px; }
.tour-slide p { margin: 0 auto; color: var(--muted); max-width: 340px; }
.illo { position: relative; height: 230px; border-radius: 22px; background: radial-gradient(120% 100% at 50% 0%, var(--primary-container), var(--surface-2)); display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 16px; }
.illo.col { flex-direction: column; gap: 8px; }
.tour-logo { width: 104px; height: 104px; border-radius: 30px; background: var(--surface); display: grid; place-items: center; box-shadow: 0 10px 30px color-mix(in srgb, var(--brand) 35%, transparent); }
.tour-logo img { width: 66px; height: 66px; }
.illo .float { position: absolute; animation: bob 3s ease-in-out infinite; }
.illo .float .tile { box-shadow: var(--shadow-1); background: var(--surface); }
.illo .f1 { left: 16%; top: 18%; } .illo .f2 { right: 16%; top: 22%; animation-delay: .6s; } .illo .f3 { left: 22%; bottom: 16%; animation-delay: 1.2s; } .illo .f4 { right: 20%; bottom: 18%; animation-delay: 1.8s; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.tour-card { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 300px; background: var(--surface); border-radius: 16px; padding: 8px 12px 8px 8px; box-shadow: var(--shadow-1); text-align: left; }
.tour-card > div { flex: 1; min-width: 0; }
.tour-card strong { display: block; font-size: .9rem; }
.tour-card small { color: var(--muted); font-size: .74rem; }
.tour-card .meta { margin-top: 3px; display: flex; gap: 4px; }
.tour-card .status { height: 20px; font-size: .68rem; }
.tour-card > .ic { color: var(--primary); }
.tour-card.done strong { text-decoration: line-through; color: var(--muted); }
.tour-card .tile { width: 38px; height: 38px; }
.tour-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--primary); color: var(--on-primary); border-radius: 999px; padding: 6px 14px; font-weight: 650; font-size: .82rem; }
.tour-pill .ic { width: 18px; height: 18px; }
.tour-banner { width: 100%; max-width: 320px; margin: 0; text-align: left; padding: 10px 12px; }
.tour-banner h3 { font-size: .86rem; } .tour-banner p { font-size: .76rem; }
.tour-recipe { width: 100%; max-width: 300px; background: var(--surface); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-1); }
.tour-recipe .cover { height: 84px; background: center/cover; }
.tour-recipe .meta { display: flex; gap: 4px; padding: 8px; flex-wrap: wrap; }
.tour-avatars { display: flex; }
.tour-avatars .avatar { width: 54px; height: 54px; font-size: 1rem; border: 3px solid var(--surface); margin-left: -12px; }
.tour-avatars .avatar:first-child { margin-left: 0; }
.tour-code { font-size: 1.2rem; padding: 8px 16px; background: var(--surface); }
.tour-dots { display: flex; justify-content: center; gap: 6px; margin: 18px 0 14px; }
.tour-dots button { width: 8px; height: 8px; border-radius: 999px; border: 0; background: var(--outline-variant); padding: 0; cursor: pointer; transition: width .2s, background .2s; }
.tour-dots button.on { width: 24px; background: var(--primary); }
.tour-actions { display: flex; justify-content: space-between; gap: 8px; }
.tour-actions .btn-filled { min-width: 140px; height: 46px; }

/* Illustrated cover for recipes without a photo */
.cover-ill { --hue: 140; display: flex !important; align-items: center; justify-content: center; gap: 14px; position: relative; overflow: hidden;
  background: radial-gradient(circle at 20% 20%, hsl(var(--hue) 70% 88% / .9), transparent 60%), radial-gradient(circle at 85% 80%, hsl(calc(var(--hue) + 60) 70% 85% / .9), transparent 55%), var(--primary-container) !important; }
.cover-ill .ci-icon { width: 64px; height: 64px; border-radius: 20px; background: var(--surface); display: grid; place-items: center; color: var(--primary); box-shadow: var(--shadow-1); }
.cover-ill .ci-icon .ic { width: 32px; height: 32px; }
.cover-ill .ci-flags { display: flex; gap: 8px; }
.cover-ill .ci-flags img.flag { width: 64px; height: 48px; }
.thumb.cover-ill .ci-icon { width: 26px; height: 26px; border-radius: 8px; box-shadow: none; } .thumb.cover-ill .ci-icon .ic { width: 16px; height: 16px; }
.thumb.cover-ill .ci-flags img.flag { width: 20px; height: 15px; } .thumb.cover-ill .ci-flags { gap: 2px; } .thumb.cover-ill { gap: 4px; }
.hero-img.cover-ill .ci-icon { width: 80px; height: 80px; } .hero-img.cover-ill .ci-flags img.flag { width: 80px; height: 60px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cover-ill { background: radial-gradient(circle at 20% 20%, hsl(var(--hue) 40% 30% / .8), transparent 60%), radial-gradient(circle at 85% 80%, hsl(calc(var(--hue) + 60) 40% 25% / .8), transparent 55%), var(--primary-container) !important; } }
:root[data-theme="dark"] .cover-ill { background: radial-gradient(circle at 20% 20%, hsl(var(--hue) 40% 30% / .8), transparent 60%), radial-gradient(circle at 85% 80%, hsl(calc(var(--hue) + 60) 40% 25% / .8), transparent 55%), var(--primary-container) !important; }
.flag-tile { background: var(--surface-2); }
.flag-tile img.flag { width: 24px; height: 18px; }
/* SVG flags (assets/flags) */
img.flag { display: inline-block; width: 20px; height: 15px; border-radius: 3px; object-fit: cover; vertical-align: -2px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); flex: none; }
img.flag.big { border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.origin { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; vertical-align: middle; }
.origin .oc { display: inline-flex; align-items: center; gap: 5px; }
.status img.flag { width: 16px; height: 12px; margin-left: -2px; }
