:root {
  --bg: #f5f5f2;
  --card: #ffffff;
  --line: #e4e4df;
  --text: #1c1c1a;
  --muted: #6d6d68;
  --faint: #a3a39d;
  --green: #2e7d4f;
  --green-dark: #24663f;
  --green-soft: #e6f2ea;
  --blue: #2f5fa8;
  --blue-soft: #e5eefa;
  --red: #b83a32;
  --red-soft: #fbe6e4;
  --amber: #8f5a00;
  --amber-soft: #fff1d9;
  --chip: #ececE8;
  --radius: 14px;
  --nav-h: 74px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100vh; overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { text-decoration: none; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
.hidden { display: none !important; }

#app { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px calc(var(--nav-h) + var(--safe-b) + 90px); }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 18px; }
.top h1 { font-size: 30px; line-height: 1.15; margin: 0; font-weight: 750; letter-spacing: -0.02em; }
.top .actions { display: flex; gap: 8px; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-weight: 600; font-size: 16px; padding: 6px 0; }
.back svg { width: 18px; height: 18px; }
.barrow { display: flex; justify-content: space-between; align-items: center; min-height: 36px; }
.link { color: var(--green); font-weight: 650; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); }
.icon-btn:active { background: var(--chip); }
.icon-btn svg { width: 22px; height: 22px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 650; font-size: 16px; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:active { background: var(--green-dark); }
.btn-outline { background: #fff; border: 1.5px solid #b9d9c4; color: var(--green); }
.btn-ghost { color: var(--green); }
.btn-danger { color: var(--red); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-muted { background: var(--chip); color: var(--muted); }

/* Segmented */
.seg { display: flex; background: var(--chip); border-radius: 14px; padding: 4px; margin-bottom: 16px; }
.seg button { flex: 1; border-radius: 11px; padding: 9px 6px; color: var(--muted); font-weight: 650; line-height: 1.2; }
.seg button small { display: block; font-weight: 500; font-size: 12px; }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.07); }

/* Search */
.search { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; height: 46px; margin-bottom: 14px; }
.search svg { width: 19px; height: 19px; color: var(--muted); flex: none; }
.search input { border: 0; outline: 0; flex: 1; background: transparent; font-size: 16px; min-width: 0; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 15px; font-weight: 550; font-size: 15px; }
.chip.on { background: var(--green); border-color: var(--green); color: #fff; }
.chip.small { padding: 5px 12px; font-size: 14px; }
.chip-x { display: inline-flex; align-items: center; gap: 4px; }
.chips-note { align-self: center; color: var(--muted); font-size: 13px; }

/* Cards / list rows */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 650; font-size: 17px; }
.row .sub { color: var(--green); font-size: 13.5px; margin-top: 3px; }
.row .meta { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.chev { width: 18px; height: 18px; color: var(--muted); flex: none; }
.row.dim { opacity: .55; }
.list-empty { text-align: center; color: var(--muted); padding: 30px 16px; }
.section-title { font-weight: 650; color: var(--muted); font-size: 14.5px; margin: 18px 2px 8px; }
.section-title:first-child { margin-top: 0; }

/* Slots */
.slot { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 14px; margin-bottom: 9px; min-height: 64px; }
.slot .lbl { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.slot .name { font-size: 17px; font-weight: 550; margin-top: 2px; }
.slot.empty { border: 1.5px dashed #9fcfb0; background: transparent; }
.slot.empty .name { color: var(--green); font-weight: 600; }
.slot .name.deleted { text-decoration: line-through; color: var(--muted); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 7px; margin-top: 6px; }
.badge.frozen { background: var(--blue-soft); color: var(--blue); }
.badge.deleted { background: var(--red-soft); color: var(--red); }
.badge.warn { background: var(--amber-soft); color: var(--amber); margin: 0 0 10px; }
.badge.green { background: var(--green-soft); color: var(--green); }
.day-title { font-weight: 650; color: var(--muted); font-size: 15px; margin: 18px 2px 9px; }
.day-title.today { color: var(--green); }

/* Info boxes */
.note { border-radius: 12px; padding: 11px 14px; font-size: 14px; margin-bottom: 14px; line-height: 1.4; }
.note.blue { background: var(--blue-soft); color: var(--blue); }
.note.green { background: var(--green-soft); color: var(--green); }
.note.amber { background: var(--amber-soft); color: #5b3c00; }

/* Frozen */
.stepper { display: flex; align-items: center; gap: 8px; flex: none; }
.stepper button { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 22px; line-height: 1; }
.stepper .minus { background: var(--chip); color: var(--text); }
.stepper .plus { background: var(--green-soft); color: var(--green); }
.stepper .val { min-width: 50px; text-align: center; font-weight: 650; font-size: 15px; line-height: 1.2; }
.frozen-tags { color: var(--blue); font-size: 13.5px; margin-top: 3px; }

/* Forms */
.field { margin-bottom: 16px; }
.field > label, .field-label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }
.field-label .hint { float: right; font-weight: 400; font-size: 12.5px; }
.input, select.input, textarea.input { width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: 0; }
.input:focus { border-color: #9fcfb0; }
textarea.input { min-height: 90px; resize: vertical; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.err { color: var(--red); font-size: 14px; margin: -4px 0 12px; }

.ing-row { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 8px 14px; margin-bottom: 9px; min-height: 52px; }
.ing-row .nm { flex: 1; font-size: 16px; min-width: 0; }
.qty-pill { background: var(--chip); border-radius: 8px; padding: 5px 10px; font-size: 14px; color: var(--muted); min-width: 40px; text-align: center; }
.x-btn { width: 34px; height: 34px; display: grid; place-items: center; color: var(--muted); border-radius: 8px; }
.x-btn svg { width: 18px; height: 18px; }

.ac { position: relative; }
.ac-list { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-top: 6px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.ac-item { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 15.5px; }
.ac-item:last-child { border-bottom: 0; }
.ac-item small { color: var(--muted); }
.ac-item.create { color: var(--green); font-weight: 600; }
.ac-item.hint { background: var(--amber-soft); color: #5b3c00; }

details.more { margin: 6px 0 18px; }
details.more summary { color: var(--green); font-weight: 600; cursor: pointer; list-style: none; padding: 6px 0; }
details.more summary::-webkit-details-marker { display: none; }
.check { display: flex; align-items: center; gap: 10px; font-size: 16px; padding: 6px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }

/* Shopping list */
.shop-meta { color: var(--muted); font-size: 14px; margin: -8px 0 14px; }
.shop-group { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 6px; overflow: hidden; }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid #f0f0ec; }
.shop-item:last-child { border-bottom: 0; }
.cb { width: 26px; height: 26px; border-radius: 7px; border: 2px solid #b9d9c4; flex: none; display: grid; place-items: center; }
.cb.on { background: var(--green); border-color: var(--green); color: #fff; }
.cb svg { width: 16px; height: 16px; }
.shop-item .main { flex: 1; min-width: 0; text-align: left; }
.shop-item .nm { font-size: 16.5px; font-weight: 550; }
.shop-item .src { color: var(--muted); font-size: 13px; margin-top: 2px; }
.shop-item .q { color: var(--text); font-size: 15px; white-space: nowrap; text-align: right; }
.shop-item.done .nm { text-decoration: line-through; color: var(--muted); }
.removed-bar { display: flex; justify-content: space-between; align-items: center; background: var(--chip); border-radius: 12px; padding: 11px 14px; margin-top: 16px; color: var(--muted); font-size: 14.5px; }
.sticky-actions { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); background: var(--bg); border-top: 1px solid var(--line); padding: 10px 16px; z-index: 5; }
.sticky-actions .in { max-width: 528px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Bottom nav */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: #fbfbf9; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); z-index: 10; }
nav.tabs .in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); height: var(--nav-h); }
nav.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 550; }
nav.tabs a svg { width: 24px; height: 24px; }
nav.tabs a.on { color: var(--green); font-weight: 700; }

/* Overlays */
.scrim { position: fixed; inset: 0; background: rgba(20,20,18,.42); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
.scrim.center { align-items: center; padding: 20px; }
.sheet { background: #fff; width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; max-height: 88vh; overflow-y: auto; padding: 10px 20px calc(20px + var(--safe-b)); animation: up .2s ease; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: #d7d7d2; margin: 0 auto 14px; }
.sheet h2, .dialog h2 { margin: 0 0 4px; font-size: 22px; font-weight: 750; }
.sheet .lead, .dialog .lead { color: var(--muted); margin: 0 0 16px; font-size: 15px; line-height: 1.4; }
.dialog { background: #fff; border-radius: 22px; padding: 22px 20px; width: 100%; max-width: 380px; animation: pop .16s ease; }
.dialog .btns { display: grid; gap: 6px; margin-top: 16px; }
.match { display: flex; justify-content: space-between; align-items: center; background: var(--green-soft); border-radius: 10px; padding: 11px 13px; margin-bottom: 8px; width: 100%; text-align: left; }
.match b { color: var(--green); }
.match small { color: var(--green); }
.action-list button { display: block; width: 100%; text-align: left; padding: 15px 4px; border-bottom: 1px solid var(--line); font-size: 17px; }
.action-list button:last-child { border-bottom: 0; }
.action-list .danger { color: var(--red); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 80px); background: #262624; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14.5px; z-index: 80; max-width: calc(100% - 32px); animation: fade .15s ease; }
@keyframes fade { from { opacity: 0 } }
@keyframes up { from { transform: translateY(30px); opacity: .5 } }
@keyframes pop { from { transform: scale(.96); opacity: 0 } }

.dup-box { background: var(--amber-soft); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.dup-box .pair { font-weight: 650; margin: 2px 0 10px; }
.dup-box .row2 { display: flex; gap: 8px; flex-wrap: wrap; }
.dup-box .row2 .btn { flex: 1; min-height: 40px; font-size: 15px; background: #fff; }
.menu-link { color: var(--green); font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 4px; }
.readonly .slot { cursor: default; }
.kv { color: var(--muted); font-size: 14px; margin: 0 0 12px; }

/* Slot s více pokrmy */
.slot.multi { display: block; padding: 11px 14px 6px; }
.slot-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 7px 0; border-top: 1px solid #f0f0ec; }
.slot-item:first-of-type { border-top: 0; padding-top: 2px; }
.slot-item .name { font-size: 17px; font-weight: 550; }
.slot-item .badge { margin-top: 4px; }
.slot-add { display: block; width: 100%; text-align: left; color: var(--green); font-weight: 600; font-size: 14.5px; padding: 8px 0 6px; border-top: 1px dashed #cfe5d7; }
.row.picked { border-color: #9fcfb0; background: var(--green-soft); }
.chosen { background: var(--green-soft); color: var(--green-dark); border-radius: 10px; padding: 9px 12px; font-size: 14px; margin-bottom: 12px; line-height: 1.4; }
.pick-done { position: sticky; bottom: calc(-20px - var(--safe-b)); background: #fff; padding: 10px 0 4px; margin-top: 6px; }
.pick-new { margin-bottom: 12px; min-height: 42px; font-size: 15px; }
.badge.ing { background: var(--amber-soft); color: var(--amber); }

.count-row { display: flex; align-items: center; gap: 10px; margin: 4px 0 18px; }
.count-btn { width: 48px; height: 48px; border-radius: 12px; background: var(--chip); font-size: 26px; display: grid; place-items: center; }
.count-btn.plus { background: var(--green-soft); color: var(--green); }
.count-val { width: 80px; text-align: center; font-size: 20px; font-weight: 650; }
.count-unit { color: var(--muted); font-size: 16px; }
.pdf-preview { display: block; width: 100%; max-width: 360px; margin: 0 auto 16px; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.08); aspect-ratio: 1240 / 1754; }
