/* Layout and components. Colors/sizes come from tokens.css only. Mobile first (360-430px). */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--c-cream); color: var(--c-ink);
  font: var(--fs-m)/1.45 var(--font);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
body.has-sheet { overflow: hidden; }
#app { max-width: var(--maxw); margin: 0 auto; min-height: 100vh; min-height: 100dvh; background: var(--c-cream); }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }
h1:focus { outline: none; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--c-muted); font-size: var(--fs-s); }
.selectable { -webkit-user-select: text; user-select: text; }
.pad { padding: var(--sp-2) var(--sp-2) var(--sp-3); display: grid; gap: var(--sp-2); }
.screen { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.screen > .pad { flex: 1; align-content: start; }
.is-mock::before { content: 'PRÓBA ÜZEMMÓD (mock)'; display: block; text-align: center; background: var(--c-info); color: #fff; font-size: var(--fs-s); padding: 2px; }

/* ---- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-1);
  min-height: var(--tap); padding: 0 var(--sp-3); border: 2px solid var(--c-brand); border-radius: var(--radius-pill);
  background: var(--c-brand); color: var(--c-on-brand); font-weight: 700; font-size: var(--fs-m);
  cursor: pointer; text-decoration: none; transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:hover:not(:disabled) { background: var(--c-brand-strong); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-wide { width: 100%; }
.btn-small { min-height: 40px; padding: 0 var(--sp-2); font-size: var(--fs-s); }
.btn-secondary { background: transparent; color: var(--c-brand); }
.btn-secondary:hover:not(:disabled) { background: var(--c-brand-soft); }
.btn-danger { background: var(--c-danger); border-color: var(--c-danger); }
.btn-danger:hover:not(:disabled) { background: #8e1c16; }
.btn-danger-outline { background: transparent; color: var(--c-danger); border-color: var(--c-danger); }
.btn-danger-outline:hover:not(:disabled) { background: var(--c-danger-soft); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-1); }
.link-btn { background: none; border: 0; padding: var(--sp-1) 0; min-height: 40px; color: var(--c-brand); font-weight: 600; text-decoration: underline; cursor: pointer; text-align: left; }
.link-btn.danger { color: var(--c-danger); }
.link-btn:disabled { opacity: 0.5; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); border: 0; border-radius: var(--radius-pill); background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--c-brand-soft); }
.icon-btn:disabled { opacity: 0.35; }
.icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.badge-count {
  position: absolute; top: 2px; right: 0; min-width: 21px; height: 21px; padding: 0 5px; border-radius: var(--radius-pill);
  background: var(--c-accent); color: var(--c-ink); font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
}

/* ---- header bars */
.topbar { display: flex; align-items: center; gap: var(--sp-1); padding: var(--sp-1) var(--sp-1); background: var(--c-cream); position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--c-line); }
.topbar-title { flex: 1; font-size: var(--fs-l); font-family: var(--font-display); line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.topbar-spacer { width: var(--tap); flex: none; }
.brandbar { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-1) var(--sp-2); background: var(--c-brand); color: var(--c-on-brand); }
.brandbar .icon-btn:hover:not(:disabled) { background: rgb(255 255 255 / 16%); }
.brand { font-family: var(--font-display); font-size: var(--fs-l); font-weight: 800; letter-spacing: 0.2px; }
.brandbar-actions { display: flex; }

/* ---- menu */
.chips { display: flex; gap: var(--sp-1); overflow-x: auto; padding: var(--sp-2); scrollbar-width: none; position: sticky; top: 0; background: var(--c-cream); z-index: 4; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 44px; padding: 0 var(--sp-3); border: 2px solid var(--c-line); border-radius: var(--radius-pill); background: var(--c-surface); font-weight: 700; cursor: pointer; }
.chip[aria-pressed='true'] { background: var(--c-brand); border-color: var(--c-brand); color: var(--c-on-brand); }
.cards { display: grid; gap: var(--sp-2); padding: 0 var(--sp-2) var(--sp-3); flex: 1; align-content: start; }
.card { background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: grid; }
.card-special { border: 2px dashed var(--c-brand); box-shadow: none; background: var(--c-brand-soft); }
.card-main { display: grid; grid-template-columns: 89px 1fr; gap: var(--sp-2); text-align: left; background: none; border: 0; padding: var(--sp-2); min-height: 89px; cursor: pointer; align-items: center; }
.card-photo { width: 89px; height: 89px; border-radius: var(--radius-s); overflow: hidden; background: var(--c-brand-soft); display: flex; align-items: center; justify-content: center; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-ph { font-family: var(--font-display); font-size: var(--fs-xl); color: var(--c-brand); font-weight: 800; }
.card-text { display: grid; gap: 4px; min-width: 0; }
.card-name { font-weight: 800; overflow-wrap: anywhere; }
.card-desc { color: var(--c-muted); font-size: var(--fs-s); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-price { font-weight: 800; color: var(--c-brand); }
.card-allergen { justify-self: end; margin: 0 var(--sp-2) var(--sp-1); font-size: var(--fs-s); min-height: 36px; }
.cart-bar-wrap { position: sticky; bottom: 0; padding: var(--sp-1) var(--sp-2) calc(var(--sp-1) + env(safe-area-inset-bottom)); }
.cart-bar-wrap:empty { padding: 0; }
.cart-bar { width: 100%; min-height: var(--tap); display: flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-3); border: 0; border-radius: var(--radius-pill); background: var(--c-brand); color: var(--c-on-brand); font-weight: 800; box-shadow: var(--shadow-up); cursor: pointer; }
.cart-bar-text { flex: 1; text-align: left; }

/* promos (GET /api/home) */
.promos { display: grid; gap: var(--sp-1); padding: var(--sp-2) var(--sp-2) 0; }
.promo { display: grid; grid-template-columns: auto 1fr auto; gap: var(--sp-2); align-items: center; background: var(--c-surface); border-left: 5px solid var(--c-accent); border-radius: var(--radius); padding: var(--sp-2); box-shadow: var(--shadow); }
.promo-img { width: 55px; height: 55px; object-fit: cover; border-radius: var(--radius-s); }
.promo-text { display: grid; gap: 2px; min-width: 0; }
.promo-body { font-size: var(--fs-s); color: var(--c-muted); }
.badge { justify-self: start; background: var(--c-accent); color: var(--c-ink); font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: var(--radius-pill); text-transform: uppercase; }
.popup { display: grid; gap: var(--sp-2); }
.popup-img { border-radius: var(--radius); width: 100%; max-height: 233px; object-fit: cover; }

/* ---- product / forms */
.hero { width: 100%; height: 233px; background: var(--c-brand-soft); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.product-desc { color: var(--c-muted); }
.fields, .form { display: grid; gap: var(--sp-2); }
.field { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: var(--sp-1); }
.field-legend { font-weight: 800; padding: 0; margin-bottom: 2px; }
.req { color: var(--c-danger); }
.opt { font-weight: 400; color: var(--c-muted); font-size: var(--fs-s); }
.choice { display: flex; align-items: center; gap: var(--sp-2); min-height: 52px; padding: 6px var(--sp-2); background: var(--c-surface); border: 2px solid var(--c-line); border-radius: var(--radius); cursor: pointer; }
.choice input { width: 22px; height: 22px; flex: none; accent-color: var(--c-brand); margin: 0; }
.choice-label { flex: 1; overflow-wrap: anywhere; }
.choice-price { color: var(--c-muted); font-size: var(--fs-s); white-space: nowrap; }
.choice:has(input:checked) { border-color: var(--c-brand); background: var(--c-brand-soft); }
.choice:focus-within { outline: 3px solid var(--c-accent); outline-offset: 1px; }
.choice.is-disabled { opacity: 0.5; cursor: not-allowed; }
.input, .select, .textarea { width: 100%; min-height: var(--tap); padding: 8px var(--sp-2); border: 2px solid var(--c-line); border-radius: var(--radius); background: var(--c-surface); font-size: 16px; }
.textarea { resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--c-brand); }
.input-code { font-size: 28px; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; }
.has-error .choice, .has-error .select { border-color: var(--c-danger); }
.field-error { color: var(--c-danger); font-size: var(--fs-s); font-weight: 700; }
.field-problems:empty { display: none; }
.qty-row { display: flex; align-items: center; justify-content: space-between; }
.qty-label { font-weight: 800; }
.stepper { display: inline-flex; align-items: center; gap: var(--sp-1); }
.stepper-btn { background: var(--c-surface); border: 2px solid var(--c-line); }
.stepper-value { min-width: 34px; text-align: center; font-weight: 800; font-size: var(--fs-l); font-variant-numeric: tabular-nums; }
.sticky-bar { position: sticky; bottom: 0; display: grid; gap: var(--sp-1); padding: var(--sp-2) var(--sp-2) calc(var(--sp-2) + env(safe-area-inset-bottom)); background: var(--c-surface); box-shadow: var(--shadow-up); z-index: 5; }
.price-live { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); min-height: 28px; }
.price-amount { font-size: var(--fs-l); font-weight: 800; color: var(--c-brand); font-variant-numeric: tabular-nums; }
.price-note { color: var(--c-muted); }
.price-each { color: var(--c-muted); font-size: var(--fs-s); }

/* notices */
.notice { padding: var(--sp-2); border-radius: var(--radius); font-size: var(--fs-m); }
.notice-info { background: var(--c-info-soft); color: var(--c-info); }
.notice-ok { background: var(--c-ok-soft); color: var(--c-ok); }
.notice-warn { background: var(--c-warn-soft); color: var(--c-warn); }
.notice-error { background: var(--c-danger-soft); color: var(--c-danger); }
.empty { display: grid; gap: var(--sp-2); justify-items: start; padding: var(--sp-3) var(--sp-2); }

/* ---- cart / checkout */
.cart-lines { display: grid; gap: var(--sp-1); }
.cart-line { background: var(--c-surface); border-radius: var(--radius); padding: var(--sp-2); display: grid; gap: var(--sp-1); box-shadow: var(--shadow); }
.cart-line.is-invalid { outline: 2px solid var(--c-danger); }
.cart-line-head { display: flex; justify-content: space-between; gap: var(--sp-2); }
.cart-line-text { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.cart-line-price { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cart-line-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); }
.cart-options { display: grid; gap: var(--sp-2); }
.segmented { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-1); }
.segmented .field-legend { grid-column: 1 / -1; }
.seg { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: var(--tap); border: 2px solid var(--c-line); border-radius: var(--radius-pill); background: var(--c-surface); font-weight: 800; }
.seg input:checked + span { background: var(--c-brand); border-color: var(--c-brand); color: var(--c-on-brand); }
.seg input:focus-visible + span { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.note-count { text-align: right; }
.note-count.over { color: var(--c-danger); font-weight: 800; }
.totals { display: grid; gap: var(--sp-1); }
.total-row { display: flex; justify-content: space-between; gap: var(--sp-2); font-variant-numeric: tabular-nums; }
.total-grand { font-size: var(--fs-l); padding-top: var(--sp-1); border-top: 2px solid var(--c-ink); }
.gift { color: var(--c-ok); font-weight: 700; }
.section-title { font-size: var(--fs-l); font-family: var(--font-display); }
.phone-row { display: flex; gap: var(--sp-1); align-items: stretch; }
.phone-prefix { display: inline-flex; align-items: center; padding: 0 var(--sp-2); border: 2px solid var(--c-line); border-radius: var(--radius); background: var(--c-brand-soft); font-weight: 800; }
.row-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2); }
.offer { display: grid; gap: var(--sp-1); background: var(--c-surface); border-radius: var(--radius); padding: var(--sp-2); box-shadow: var(--shadow); }
.offer-lines { display: grid; gap: 6px; }
.offer-line { display: flex; justify-content: space-between; gap: var(--sp-2); font-variant-numeric: tabular-nums; }
.offer-line-name { overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--sp-2); font-size: var(--fs-s); margin-top: var(--sp-1); }
.facts dt { color: var(--c-muted); }

/* ---- status */
.status-title { font-size: var(--fs-l); font-family: var(--font-display); }
.status-title.tone-ok { color: var(--c-ok); }
.status-title.tone-warn { color: var(--c-danger); }
.status-title.tone-test { color: var(--c-info); }
.status-text { font-size: var(--fs-m); }
.status-extra { display: grid; gap: var(--sp-2); }
.steps { display: grid; gap: var(--sp-1); counter-reset: s; }
.step { counter-increment: s; display: flex; align-items: center; gap: var(--sp-2); min-height: 40px; color: var(--c-muted); }
.step::before { content: counter(s); flex: none; width: 29px; height: 29px; border-radius: 50%; border: 2px solid var(--c-line); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: var(--fs-s); background: var(--c-surface); }
.step.is-done { color: var(--c-ink); }
.step.is-done::before { content: '\2713'; background: var(--c-ok); border-color: var(--c-ok); color: #fff; }
.step.is-current { color: var(--c-ink); font-weight: 800; }
.step.is-current::before { border-color: var(--c-brand); background: var(--c-brand); color: var(--c-on-brand); }
.callus { display: grid; gap: var(--sp-1); justify-items: start; background: var(--c-warn-soft); border-radius: var(--radius); padding: var(--sp-2); }
.callus-number { font-size: var(--fs-xl); font-weight: 800; letter-spacing: 0.5px; }
.danger-zone { display: grid; gap: var(--sp-2); border-top: 1px solid var(--c-line); padding-top: var(--sp-3); margin-top: var(--sp-2); }
.fatal { text-align: center; justify-items: center; padding-top: var(--sp-5); }

/* ---- sheet */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgb(43 27 22 / 55%); display: flex; align-items: flex-end; justify-content: center; animation: fade var(--dur) var(--ease); }
.sheet { width: 100%; max-width: var(--maxw); max-height: 85vh; max-height: 85dvh; display: flex; flex-direction: column; background: var(--c-cream); border-radius: var(--radius) var(--radius) 0 0; animation: rise var(--dur) var(--ease); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-1); padding: var(--sp-1) var(--sp-1) var(--sp-1) var(--sp-3); border-bottom: 1px solid var(--c-line); }
.sheet-title { font-size: var(--fs-l); font-family: var(--font-display); overflow-wrap: anywhere; }
.sheet-body { overflow-y: auto; padding: var(--sp-3); padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom)); display: grid; gap: var(--sp-2); }
.allergen-list { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.allergen-list li { background: var(--c-warn-soft); color: var(--c-warn); padding: 4px var(--sp-2); border-radius: var(--radius-pill); font-weight: 700; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(34px); opacity: 0; } to { transform: none; opacity: 1; } }
.offer-line-name { display: grid; gap: 2px; }
