:root {
  --bg: #0f1412;
  --surface: #161d1a;
  --surface-2: #1d2622;
  --surface-3: #25302b;
  --line: #2b3631;
  --ink: #e7ece9;
  --muted: #94a49c;
  --accent: #7cc48a;
  --accent-soft: #1f3526;
  --on-accent: #0f1412;
  --vd: #ff7a63;
  --vd-soft: #43221c;
  --mhd: #f0b440;
  --mhd-soft: #3a2f16;
  --frozen: #8fb8ff;
  --frozen-soft: #1c2a44;
  --radius: 12px;
  --nav-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); -webkit-tap-highlight-color: transparent; }
body.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); }
code { font-size: .88em; background: var(--surface-2); padding: 2px 6px; border-radius: 5px; overflow-wrap: anywhere; }
.boot { padding: 40px 16px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.top-in { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 12px; min-height: 52px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.top h1 { font-size: 1.1rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sync { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: .5; }
.sync.busy { background: var(--mhd); opacity: 1; }

main.wrap { max-width: 1100px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(var(--nav-h) + 96px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 16px; }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.nav-in { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h); }
.nav button { appearance: none; border: 0; background: none; color: var(--muted); font: inherit; font-size: .72rem; font-weight: 600; display: grid; justify-items: center; align-content: center; gap: 3px; cursor: pointer; position: relative; }
.nav button svg { width: 24px; height: 24px; }
.nav button[aria-current="page"] { color: var(--accent); }
.nav .badge { position: absolute; top: 8px; left: calc(50% + 6px); background: var(--vd); color: #fff; font-size: .65rem; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.fab { position: fixed; z-index: 31; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom, 0px)); appearance: none; border: 0; border-radius: 28px; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 700; padding: 0 20px 0 16px; height: 52px; display: flex; align-items: center; gap: 8px; box-shadow: 0 6px 20px rgb(0 0 0 / .45); cursor: pointer; }
.fab svg { width: 24px; height: 24px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card.login { width: 100%; max-width: 380px; display: grid; gap: 14px; justify-items: start; }
.card.login > * { width: 100%; }
.card.login img { width: 56px; border-radius: 14px; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.grid2 > * { min-width: 0; }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.spacer { flex: 1; }

label { display: grid; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--muted); align-content: end; min-width: 0; }
label.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 500; color: var(--ink); }
label.check input { width: 20px; height: 20px; accent-color: var(--accent); }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 80px; }
input[type="range"] { padding: 0; accent-color: var(--accent); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn { appearance: none; font: inherit; font-weight: 650; font-size: .92rem; border-radius: 10px; padding: 9px 14px; cursor: pointer; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; min-height: 40px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.danger { color: var(--vd); }
.btn.ghost { background: none; }
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: .84rem; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.confirm { background: var(--vd); color: #fff; border-color: var(--vd); }
.icon { appearance: none; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; font: inherit; display: inline-grid; place-items: center; min-width: 34px; min-height: 34px; }
.icon:hover { color: var(--ink); background: var(--surface-2); }
.icon svg { width: 20px; height: 20px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { appearance: none; font: inherit; font-size: .84rem; font-weight: 600; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); border-radius: 999px; padding: 6px 12px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.chip .n { color: var(--muted); font-weight: 500; }
.tag { display: inline-flex; align-items: center; font-size: .72rem; font-weight: 700; letter-spacing: .03em; border-radius: 6px; padding: 2px 6px; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.tag.vd { background: var(--vd-soft); color: var(--vd); }
.tag.mhd { background: var(--mhd-soft); color: var(--mhd); }
.tag.kaufland { background: #3a1d1d; color: #ff9b8a; }
.tag.lidl { background: #1b2a45; color: #ffd84d; }
.tag.ok { background: var(--accent-soft); color: var(--accent); }

.note { padding: 10px 12px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); font-size: .9rem; }
.note.good { background: var(--accent-soft); border-color: transparent; }
.note.bad { background: var(--vd-soft); border-color: transparent; }
.note.warn { background: var(--mhd-soft); border-color: transparent; }

.days { font-weight: 700; font-size: .82rem; border-radius: 8px; padding: 4px 8px; white-space: nowrap; font-variant-numeric: tabular-nums; text-align: center; min-width: 64px; }
.t-bad { background: var(--vd-soft); color: var(--vd); }
.t-warn { background: var(--mhd-soft); color: var(--mhd); }
.t-ok { background: var(--accent-soft); color: var(--accent); }
.t-none { background: var(--surface-3); color: var(--muted); }
.t-frozen { background: var(--frozen-soft); color: var(--frozen); }

.list { display: grid; }
.item { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; color: inherit; font: inherit; width: 100%; }
.item:last-child { border-bottom: 0; }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--surface-3); display: grid; place-items: center; font-weight: 700; color: var(--muted); font-size: .95rem; overflow: hidden; }
.item .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rest { height: 4px; background: var(--surface-3); border-radius: 2px; margin-top: 5px; overflow: hidden; max-width: 140px; }
.rest i { display: block; height: 100%; background: var(--accent); }
.section-t { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 14px 0 2px; }
.section-t:first-child { margin-top: 0; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }

.tonight { display: grid; gap: 10px; border-left: 3px solid var(--accent); }
.tonight .meal { font-size: 1.25rem; font-weight: 700; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 2px; cursor: pointer; text-align: left; color: inherit; font: inherit; }
.kpi b { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.kpi span { font-size: .78rem; color: var(--muted); font-weight: 600; }

.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-head h2 { flex: 1; min-width: 140px; }
.tray { display: grid; gap: 8px; }
.drag { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.pchip { display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; padding: 7px 10px; font-size: .84rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); cursor: grab; white-space: nowrap; max-width: 220px; }
.pchip > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.pchip.item-vd { border-color: color-mix(in srgb, var(--vd) 60%, transparent); }
.pchip.item-mhd { border-color: color-mix(in srgb, var(--mhd) 50%, transparent); }
.pchip.recipe { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.mchip { display: flex; align-items: center; gap: 6px; border-radius: 9px; padding: 6px 9px; font-size: .86rem; font-weight: 650; background: var(--accent-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); cursor: grab; min-width: 0; }
.mchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mchip .warn { color: var(--vd); font-weight: 800; }
.xchip { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 600; border-radius: 6px; padding: 2px 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xchip.vd { background: var(--vd-soft); color: var(--vd); }
.xchip.mhd { background: var(--mhd-soft); color: var(--mhd); }

.week { display: grid; gap: 8px; }
.wday { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 10px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-height: 64px; }
.wday.today { border-color: var(--accent); }
.wday.past { opacity: .6; }
.wday .dl { display: grid; line-height: 1.15; }
.wday .dl b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.wday .dl span { font-size: .75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.wday .body { display: grid; gap: 6px; min-width: 0; }
.wday .x { display: flex; gap: 4px; flex-wrap: wrap; }
.drop-hot { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft) !important; }

.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mh { font-size: .72rem; color: var(--muted); font-weight: 700; text-align: center; padding: 4px 0; text-transform: uppercase; }
.mcell { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; min-height: 92px; padding: 5px; display: grid; align-content: start; gap: 3px; cursor: pointer; min-width: 0; text-align: left; color: inherit; font: inherit; }
.mcell.other { opacity: .4; }
.mcell.today { border-color: var(--accent); }
.mcell .dn { font-size: .78rem; font-weight: 700; color: var(--muted); }
.mcell.today .dn { color: var(--accent); }
.mcell .mchip { padding: 3px 5px; font-size: .74rem; border-radius: 6px; }
.dots { display: flex; gap: 3px; flex-wrap: wrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; }
.dot.vd { background: var(--vd); }
.dot.mhd { background: var(--mhd); }
@media (max-width: 640px) {
  .mcell { min-height: 64px; padding: 3px; }
  .mcell .mchip { font-size: .68rem; padding: 2px 4px; }
  .mcell .xchip { display: none; }
}
@media (min-width: 641px) { .mcell .dots { display: none; } }

.drag-ghost { position: fixed; z-index: 100; pointer-events: none; transform: translate(-50%, -60%) rotate(-2deg); box-shadow: 0 10px 30px rgb(0 0 0 / .5); opacity: .95; }
body.dragging { cursor: grabbing; }
body.dragging * { cursor: grabbing !important; }

.recipe { display: grid; gap: 10px; }
.recipe .ing { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.recipe .ing li { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.recipe .ing li input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.recipe .ing .have { color: var(--accent); font-weight: 700; font-size: .78rem; }
.recipe ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: .92rem; }
.busy-box { display: flex; gap: 12px; align-items: center; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin 1s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.shop { display: grid; }
.sitem { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.sitem:last-child { border-bottom: 0; }
.sitem .box { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--muted); display: grid; place-items: center; cursor: pointer; background: none; padding: 0; color: var(--on-accent); }
.sitem.done .box { background: var(--accent); border-color: var(--accent); }
.sitem.done .nm { text-decoration: line-through; color: var(--muted); }
.sitem .nm { font-weight: 600; cursor: pointer; overflow-wrap: anywhere; }
.sitem .sub { font-size: .78rem; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.offer { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.offer:last-child { border-bottom: 0; }
.offer .t { font-weight: 600; overflow-wrap: anywhere; }
.offer .sub { font-size: .78rem; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.price { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.price s { display: block; color: var(--muted); font-weight: 500; font-size: .78rem; }

.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / .55); display: grid; align-items: end; justify-items: center; }
.sheet { width: 100%; max-width: 640px; max-height: calc(100vh - 30px - env(safe-area-inset-top, 0px)); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 14px; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px; border-bottom: 1px solid var(--line); max-height: 88vh; } }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); justify-self: center; }
.sheet-h { display: flex; align-items: center; gap: 10px; position: sticky; top: -8px; background: var(--surface); padding: 6px 0; z-index: 2; }
.sheet-h h2 { flex: 1; min-width: 0; }
.acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px 14px; margin: 0; }
.facts div { display: grid; gap: 1px; min-width: 0; }
.facts dt { font-size: .74rem; color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 12px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { appearance: none; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 650; font-size: .86rem; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); }
.seg.type button[aria-pressed="true"][data-v="vd"] { background: var(--vd-soft); color: var(--vd); }
.seg.type button[aria-pressed="true"][data-v="mhd"] { background: var(--mhd-soft); color: var(--mhd); }

.scan { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.scan .ph { display: grid; gap: 6px; align-content: start; }
.scan .ph img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; }
.scan .ph .more { display: flex; gap: 4px; }
.scan .ph .more img { width: 24px; height: 24px; border-radius: 5px; }
.scan .f { display: grid; gap: 10px; min-width: 0; }
.scan.saved { opacity: .55; }
.alts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: .82rem; }
.pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pickers .btn { min-height: 56px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 80px + env(safe-area-inset-bottom, 0px)); z-index: 120; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 650; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgb(0 0 0 / .4); }
.toast.bad { background: var(--vd); color: #fff; }
.copy { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy code { flex: 1 1 220px; padding: 8px 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
details > summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; align-items: center; gap: 8px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "▾"; color: var(--muted); margin-left: auto; }
details[open] > summary::after { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }
