/* Mini App гостя «Зерно». Прокручивается только .scroller (и тело открытого экрана), чтобы
   в Telegram на iOS не «уезжало» окно; нижние вкладки и кнопка действия — всегда на месте. */
html, body { height: 100%; overflow: hidden; }
.app { --tabs-h: calc(64px + env(safe-area-inset-bottom)); --cta-h: 0px; position: fixed; inset: 0; max-width: 560px; margin: 0 auto; overflow: hidden; background: var(--bg); }
@media (min-width: 600px) { body { background: var(--surface-2); } .app { border-inline: 1px solid var(--line); } }
.scroller { position: absolute; inset: 0 0 var(--tabs-h); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.scroller::-webkit-scrollbar, .sheet-body::-webkit-scrollbar { display: none; }
.view { padding: calc(14px + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)) 16px calc(var(--cta-h) + 28px); }
.view-title { margin: 6px 0 18px; font-size: 30px; line-height: 1.05; font-weight: 800; letter-spacing: -.01em; font-variation-settings: "FLAR" 100, "VOLM" 40; }

/* ---------- шапка кофейни ---------- */
.shop-row { display: flex; align-items: center; gap: 12px; }
.logo { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); }
.logo svg { width: 32px; height: 32px; }
.logo-lid, .logo-cup { fill: var(--surface); stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; }
.logo-sleeve { fill: var(--accent); }
.shop-id { flex: 1; min-width: 0; }
.shop-name { font-size: 24px; line-height: 1; }
.shop-sub { margin-top: 3px; font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.open-chip { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 6px 10px; border-radius: 99px; background: var(--ok-soft); color: var(--ok); font: 600 12px/1.2 var(--f-mono); }
.open-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.open-chip.is-closed { background: var(--surface-2); color: var(--muted); }
.open-chip.is-paused { background: var(--warn-soft); color: var(--warn); }
.hello { margin-top: 22px; font-size: 32px; line-height: 1.02; font-weight: 800; letter-spacing: -.015em; font-variation-settings: "FLAR" 100, "VOLM" 40; }
.wait { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 15px; }
.wait b { color: var(--ink); font-weight: 700; }
.wait .icon { width: 18px; height: 18px; color: var(--accent-ink); }
.paused { display: flex; gap: 10px; margin-top: 14px; padding: 12px 14px; border-radius: var(--r); background: var(--warn-soft); color: var(--ink); font-size: 14.5px; line-height: 1.4; }
.paused .icon { color: var(--warn); margin-top: 1px; }
.repeat { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 16px; padding: 12px 14px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); text-align: left; }
.repeat .icon { color: var(--accent-ink); }
.repeat span { flex: 1; min-width: 0; font-size: 14.5px; line-height: 1.35; color: var(--muted); }
.repeat b { display: block; color: var(--ink); font-size: 15.5px; }
.repeat .price { font: 600 14.5px var(--f-mono); color: var(--ink); }

/* ---------- категории: липкие вкладки ---------- */
.cats { position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; margin: 18px -16px 0; padding: 10px 16px; overflow-x: auto; scrollbar-width: none; background: var(--bg); }
.cats::-webkit-scrollbar { display: none; }
.cats.stuck { box-shadow: 0 1px 0 var(--line); }
.cat-btn { flex: none; min-height: 40px; padding: 0 16px; border-radius: 99px; font-weight: 700; font-size: 15px; color: var(--muted); background: var(--surface-2); transition: background-color .15s, color .15s; }
.cat-btn[aria-current="true"] { background: var(--ink); color: var(--bg); }

/* ---------- позиции меню ---------- */
.cat { scroll-margin-top: 64px; }
.cat-title { display: flex; align-items: baseline; gap: 8px; margin: 18px 0 2px; font-size: 20px; font-weight: 800; }
.cat-title small { font: 500 13px var(--f-mono); color: var(--muted); }
.item { position: relative; display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 14px; align-items: center; width: 100%; padding: 12px 0; border-bottom: 1px solid var(--line); text-align: left; }
.item:last-child { border-bottom: 0; }
.item-pic { position: relative; display: grid; place-items: end center; width: 58px; height: 78px; }
.item-pic .cup { width: 58px; height: 78px; }
.item-pic .cup--pastry { width: 58px; height: 58px; align-self: center; }
.item-body { display: grid; gap: 2px; min-width: 0; }
.item-body b { font-size: 16.5px; font-weight: 700; line-height: 1.2; }
.item-desc { color: var(--muted); font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-meta { font: 500 12px/1.3 var(--f-mono); color: var(--muted); }
.item-side { display: grid; justify-items: end; gap: 8px; }
.item-price { font: 600 14.5px/1 var(--f-mono); white-space: nowrap; }
.item-add { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); }
.item-add .icon { width: 18px; height: 18px; stroke-width: 2.4; }
.item .in-cart { position: absolute; top: 2px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent); color: var(--on-accent); font: 600 12px/22px var(--f-mono); text-align: center; }
.item[aria-disabled="true"] .item-pic, .item[aria-disabled="true"] .item-body { opacity: .5; }
.item .out { font: 600 12px/1 var(--f-mono); color: var(--warn); }
.menu-foot { margin-top: 18px; font: 500 12.5px/1.4 var(--f-mono); color: var(--muted); }

/* ---------- нижние вкладки ---------- */
.tabs { position: absolute; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); height: var(--tabs-h); padding: 6px 8px env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
.tab { position: relative; display: grid; justify-items: center; align-content: center; gap: 3px; border-radius: 12px; color: var(--muted); font-size: 12px; font-weight: 700; }
.tab .icon { width: 24px; height: 24px; }
.tab[aria-selected="true"] { color: var(--accent-ink); }
.tab[aria-selected="true"]::before { content: ""; position: absolute; top: -7px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.badge { position: absolute; top: 2px; left: calc(50% + 7px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font: 600 11px/18px var(--f-mono); }

/* ---------- экраны поверх: напиток, корзина, заказ ---------- */
.sheet { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; background: var(--bg); transform: translateX(100%); visibility: hidden; transition: transform .34s var(--ease), visibility 0s .34s; }
.sheet.open { transform: none; visibility: visible; transition: transform .34s var(--ease), visibility 0s; }
.sheet.open.covered { transform: translateX(-16%); }
.sheet.instant { transition: none !important; }
.sheet-head { flex: none; display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; min-height: 54px; padding: calc(4px + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)) 6px 4px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { text-align: center; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; outline: 0; }
.back { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--ink); }
.back:hover { background: var(--surface-2); }
.tg .back { visibility: hidden; } /* в Telegram — системная кнопка «Назад» */
.head-link { justify-self: end; min-height: 44px; padding: 0 10px; color: var(--muted); font-weight: 600; font-size: 14.5px; }
.head-link:hover { color: var(--warn); }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding: 0 16px calc(var(--cta-h) + 28px); }

/* ---------- напиток ---------- */
.drink-fig { margin: 10px -8px 0; padding: 4px 0; border-bottom: 1px dashed var(--line-2); view-transition-name: cup; }
.drink-fig .cup--detail { max-height: 300px; }
.drink-fig .cup--pastry { max-width: 280px; margin: 8px auto 12px; }
.drink-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 16px; }
.drink-name { font-size: 28px; line-height: 1.05; font-weight: 800; letter-spacing: -.01em; font-variation-settings: "FLAR" 100, "VOLM" 40; }
.drink-price { font-size: 20px; font-weight: 600; }
.drink-desc { margin-top: 6px; color: var(--muted); font-size: 15px; }
.out-note { margin-top: 12px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--ink); font-size: 14.5px; }
.opts { display: grid; gap: 20px; margin-top: 22px; }
.opt-title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 15px; font-weight: 700; }
.opt-title small { font: 500 12.5px var(--f-mono); color: var(--muted); }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.opt-row > span { display: grid; gap: 2px; font-weight: 700; font-size: 15px; }
.opt-row small { font: 500 12.5px var(--f-mono); color: var(--muted); font-weight: 500; }
button.opt-row { width: 100%; text-align: left; }

/* ---------- корзина ---------- */
.lines { margin-top: 8px; }
.line { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line-pic .cup { width: 40px; height: 54px; }
.line-pic .cup--pastry { height: 40px; }
.line-body { display: grid; gap: 2px; min-width: 0; text-align: left; }
.line-body b { font-size: 15.5px; }
.line-body span { font: 500 12.5px/1.35 var(--f-mono); color: var(--muted); }
.line-body .line-price { color: var(--ink); font-weight: 600; }
.line.is-out .line-body span.warn { color: var(--warn); }
.line .stepper { background: transparent; border: 1.5px solid var(--line); }
.field { display: grid; gap: 8px; margin-top: 20px; }
.field > span, .field > .field-label { font-size: 15px; font-weight: 700; }
.field input, .field textarea { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--surface); font-size: 16px; resize: none; }
.field input:focus, .field textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.field textarea::placeholder, .field input::placeholder { color: var(--muted); }
.pickup { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 4px; scrollbar-width: none; }
.pickup::-webkit-scrollbar { display: none; }
.pickup .chip { flex: none; }
.gift { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 20px; padding: 12px 14px; border-radius: var(--r); background: var(--accent-soft); text-align: left; }
.gift .icon { color: var(--accent-ink); }
.gift span { flex: 1; display: grid; gap: 2px; font-size: 15px; font-weight: 700; }
.gift small { font: 500 12.5px var(--f-mono); color: var(--muted); font-weight: 500; }
.pay-row { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--line); font-weight: 600; }
.pay-row .icon { color: var(--ok); }
.note { font-size: 13px; line-height: 1.4; color: var(--muted); }
.totals { display: grid; gap: 6px; margin: 22px 0 0; padding-top: 14px; border-top: 1.5px dashed var(--line-2); }
.totals div { display: flex; justify-content: space-between; font-size: 15px; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; font-family: var(--f-mono); font-weight: 600; }
.totals .sum { margin-top: 4px; font-size: 18px; font-weight: 800; }
.totals .sum dt { color: var(--ink); }
.totals .gift-line dd { color: var(--ok); }
.empty { display: grid; justify-items: center; gap: 12px; padding: 48px 12px; text-align: center; color: var(--muted); }
.empty .cup { width: 84px; height: 112px; opacity: .5; }
.empty b { color: var(--ink); font-size: 18px; }

/* ---------- заказ ---------- */
.status { margin-top: 18px; }
.status-kicker { font-size: 13px; color: var(--muted); }
.status-title { margin-top: 4px; font-size: 30px; line-height: 1.05; font-weight: 800; letter-spacing: -.01em; font-variation-settings: "FLAR" 100, "VOLM" 40; }
.status.is-ready .status-title { color: var(--ok); }
.status-sub { margin-top: 6px; font-size: 15.5px; color: var(--muted); }
.status-sub b { color: var(--ink); }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 20px; }
.step { position: relative; display: grid; gap: 3px; padding-top: 22px; font-size: 14px; font-weight: 700; color: var(--muted); }
.step::before { content: ""; position: absolute; top: 5px; left: 12px; right: 0; height: 3px; background: var(--line); }
.step:last-child::before { display: none; }
.step::after { content: ""; position: absolute; top: 0; left: 0; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--line-2); background: var(--bg); }
.step time { font: 500 12.5px var(--f-mono); color: var(--muted); font-weight: 500; }
.step.done { color: var(--ink); }
.step.done::before { background: var(--accent); }
.step.done::after { border-color: var(--accent); background: var(--accent); }
.step.now { color: var(--ink); }
.step.now::after { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.status.is-ready .step.now::after, .status.is-ready .step.done::after { border-color: var(--ok); background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.status.is-ready .step.done::before { background: var(--ok); }
.ticket-wrap { margin-top: 24px; }
.ticket { padding: 18px 18px 30px; font: 500 13.5px/1.5 var(--f-mono); }
.ticket .t-shop { display: flex; justify-content: space-between; align-items: baseline; }
.ticket .t-shop b { font: 800 20px/1 var(--f-text); font-variation-settings: "FLAR" 100; }
.ticket .t-no { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.ticket .t-no b { font-size: 34px; letter-spacing: 0; line-height: 1; }
.ticket .t-meta { color: var(--paper-muted); }
.ticket ul { display: grid; gap: 6px; }
.ticket li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
.ticket li small { grid-column: 1; color: var(--paper-muted); font-size: 12px; line-height: 1.35; }
.ticket .t-sum { display: flex; justify-content: space-between; font-weight: 600; font-size: 15px; }
.ticket .t-gift { display: flex; justify-content: space-between; color: #1D7249; }
.ticket .rule { border-color: var(--paper-line); }
.printing .ticket-wrap { animation: feed 1.1s steps(16) both; }
@keyframes feed { from { clip-path: inset(0 0 100% 0); translate: 0 -14px; } to { clip-path: inset(0 0 -20px 0); translate: 0 0; } }
.status-actions { display: flex; justify-content: center; margin-top: 18px; }
.status-actions .btn-link { color: var(--muted); }
.status-actions .btn-link.confirm { color: var(--warn); }
.stamp-earned { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 12px 14px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); font-size: 14.5px; }
.stamp-earned .ring { width: 40px; height: 40px; flex: none; }

/* ---------- список заказов ---------- */
.o-card { display: grid; gap: 10px; width: 100%; margin-bottom: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); text-align: left; }
.o-card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.o-card-top b { font: 600 20px/1 var(--f-mono); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); font: 600 12px/1.2 var(--f-mono); }
.pill.ready { background: var(--ok-soft); color: var(--ok); }
.o-card p { color: var(--muted); font-size: 14px; line-height: 1.4; }
.o-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.o-bar i { height: 4px; border-radius: 2px; background: var(--line); }
.o-bar i.on { background: var(--accent); }
.o-card.is-ready .o-bar i.on { background: var(--ok); }
.hist-title { margin: 26px 0 6px; font-size: 18px; font-weight: 800; }
.hist { display: grid; }
.hist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.hist .h-main { display: grid; gap: 2px; min-width: 0; }
.hist .h-main b { font-size: 15px; }
.hist .h-main span { font: 500 12.5px/1.35 var(--f-mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist .btn { min-height: 40px; padding: 0 12px; font-size: 14px; border-radius: 10px; }

/* ---------- карта гостя ---------- */
.stamp-wrap { margin-top: 4px; }
.stampcard { padding: 18px 18px 30px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.card-head .sign { font-size: 24px; }
.card-head .mono { font-size: 12.5px; color: var(--paper-muted); text-transform: uppercase; letter-spacing: .08em; }
.stamps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.stamps li { position: relative; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; border: 1.5px dashed var(--paper-line); color: var(--paper-muted); font: 600 13px var(--f-mono); }
.stamps li .ring { position: absolute; inset: -6%; width: 112%; height: 112%; }
.stamps li.on { border-color: transparent; color: transparent; }
.stamps li.gift { border-style: solid; border-color: var(--paper-ink); color: var(--paper-ink); }
.stamps li.gift .icon { width: 26px; height: 26px; }
.stamps li.gift.ready { background: #2743C8; border-color: #2743C8; color: #fff; }
.card-note { margin-top: 16px; font-weight: 700; font-size: 15.5px; }
.card-how { margin-top: 14px; font-size: 14px; line-height: 1.45; color: var(--muted); }
.info { margin-top: 26px; }
.info-title { font-size: 18px; font-weight: 800; }
.info-list { margin-top: 8px; }
.info-list li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.info-list .icon { color: var(--accent-ink); }
.info-list span { display: grid; gap: 2px; font-size: 14px; color: var(--muted); }
.info-list b { color: var(--ink); font-size: 15.5px; }
.demo-note { display: grid; gap: 12px; margin-top: 22px; padding: 14px 16px; border-radius: var(--r); border: 1.5px dashed var(--line-2); font-size: 14px; line-height: 1.45; color: var(--muted); }
.demo-note b { color: var(--ink); }
.demo-note .btn { justify-self: start; min-height: 44px; }

/* ---------- кнопка действия внизу (вне Telegram; в Telegram — MainButton) ---------- */
.cta { position: absolute; left: 0; right: 0; bottom: var(--tabs-h); z-index: 30; padding: 10px 16px; background: var(--bg); border-top: 1px solid var(--line); }
.cta.over-sheet { bottom: 0; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.cta .btn { width: 100%; min-height: 54px; justify-content: space-between; padding: 0 18px; font-size: 16.5px; }
.cta .btn:only-child .price:empty { display: none; }
.cta .btn.solo { justify-content: center; }
.cta-count { display: inline-grid; place-items: center; min-width: 24px; height: 24px; margin-right: 8px; padding: 0 6px; border-radius: 12px; background: color-mix(in srgb, var(--on-accent) 22%, transparent); font: 600 13px/1 var(--f-mono); }
.cta.bump .btn { animation: bump .36s var(--ease); }
@keyframes bump { 40% { transform: scale(1.03); } }
.toast { bottom: calc(var(--tabs-h) + var(--cta-h) + 12px); }

::view-transition-old(cup), ::view-transition-new(cup) { animation-duration: .22s; }

/* вариант из стоп-листа: зачёркнут, с пометкой «нет» */
.chip.is-out::after { content: "нет"; display: inline-block; margin-left: 2px; font: 600 12px/1 var(--f-mono); color: var(--warn); }
.line-pic, .line-body { display: grid; }
