/* Foodka mini app. --accent is the restaurant's brand colour; surfaces follow the customer's Telegram theme. */
:root {
  --accent: #e5603f;
  --bg: var(--tg-theme-secondary-bg-color, #f2f2f4);
  --card: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #141416);
  --muted: var(--tg-theme-hint-color, #8b8b93);
  --soft: color-mix(in srgb, var(--text) 5%, var(--card));
  --line: color-mix(in srgb, var(--text) 10%, transparent);
  --nav: #17171b;
  --ok: #1f9d55;
  --danger: #e0352b;
  --r: 22px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-tg]) { --bg: #0f0f12; --card: #1b1b20; --text: #f2f2f4; --muted: #9a9aa3; --nav: #000; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior-y: none;
}
body.lock { overflow: hidden; }
button, a { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; text-decoration: none; }
input, textarea { font: inherit; color: var(--text); }
img { display: block; max-width: 100%; }
.ic { flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.accent { color: var(--accent); }
.err { color: var(--danger); font-size: 13px; display: block; margin-top: 6px; }
.center { text-align: center; }
.wide { width: 100%; }
.grow { flex: 1; min-width: 0; }
.pad { padding: 16px; }
.gap { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

#app { padding-bottom: 24px; min-height: 100vh; }
#app.has-nav { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
#app.page-cart, #app.page-checkout, #app.page-address { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }

.demo { background: #fff4d6; color: #7a5400; font-size: 12px; text-align: center; padding: 6px; }
.loading, .empty { min-height: 40vh; display: grid; place-items: center; align-content: center; gap: 10px; text-align: center; padding: 28px 24px; }
.empty h3 { margin: 4px 0 0; font-size: 20px; font-weight: 800; }
.empty p { margin: 0; color: var(--muted); max-width: 280px; }
.empty .btn { margin-top: 8px; }
.empty-ic { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* cards & headers */
.card { background: var(--card); border-radius: var(--r); margin: 8px 0; padding: 16px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; background: var(--card);
  padding: 14px 16px; border-radius: 0 0 var(--r) var(--r); box-shadow: 0 2px 10px rgba(0, 0, 0, .04); }
.topbar h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.topbar .sub { font-size: 14px; font-weight: 600; color: var(--muted); }
.topbar-text { flex: 1; min-width: 0; }
.head-ic { color: var(--accent); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.icon-btn.small { width: 34px; height: 34px; color: var(--muted); }
.sec-title { margin: 0 0 12px; font-size: 18px; font-weight: 800; letter-spacing: -.2px; }
.sec-title.big { font-size: 24px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px;
  border-radius: 18px; background: var(--accent); color: #fff; font-weight: 700; font-size: 16px; }
.btn:disabled { opacity: .6; }
.btn.ghost { background: var(--soft); color: var(--text); }
.btn.ghost.done { color: var(--ok); }
.btn.danger { background: color-mix(in srgb, var(--danger) 10%, var(--card)); color: var(--danger); }
.btn:active, .item:active, .cat-tile:active, .list-row:active { transform: scale(.98); }

/* home */
.hero { margin-top: 0; border-radius: 0 0 var(--r) var(--r); }
.hero-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.logo { width: 52px; height: 52px; border-radius: 16px; object-fit: cover; flex: none; background: var(--soft); }
.logo-txt { display: grid; place-items: center; font-size: 24px; font-weight: 800; color: #fff; background: var(--accent); }
.hero-name h1 { margin: 0; font-size: 20px; font-weight: 800; }
.hero-name a { color: var(--muted); font-size: 14px; }
.addr-line { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 2px 12px; }
.addr-line > div { flex: 1; min-width: 0; }
.addr-line b, .addr-line span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.addr-line b { font-weight: 700; }
.addr-line span { color: var(--muted); font-size: 13px; }
.addr-line .ic:first-child { color: var(--accent); }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--soft); padding: 5px; border-radius: 20px; }
.type-btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border-radius: 16px;
  font-weight: 800; font-size: 15px; color: var(--muted); }
.type-btn.on { background: var(--card); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .06); }
.type-btn.on .type-ic { color: var(--accent); }
.search { display: flex; align-items: center; gap: 10px; background: var(--soft); border-radius: 18px; padding: 0 16px; height: 50px;
  width: 100%; color: var(--muted); }
.search input { flex: 1; border: 0; outline: 0; background: none; height: 100%; font-size: 16px; min-width: 0; }
.search.fake { text-align: left; margin-bottom: 14px; }
.cat-tiles { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.cat-tiles::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
.cat-tile { flex: none; width: 92px; display: grid; justify-items: center; gap: 6px; text-align: center; }
.cat-img { width: 92px; height: 92px; border-radius: 22px; overflow: hidden; background: var(--soft); display: grid; place-items: center; }
.cat-img img { width: 100%; height: 100%; object-fit: cover; }
.cat-emoji { font-size: 40px; }
.cat-name { font-size: 13px; font-weight: 700; line-height: 1.2; }

/* menu */
.menu-head { position: sticky; top: 0; z-index: 20; background: var(--card); padding: 12px 16px 10px; border-radius: 0 0 var(--r) var(--r);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .04); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 10px -16px 0; padding: 0 16px; }
.chip { flex: none; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px 0 6px; border-radius: 16px;
  background: var(--soft); font-weight: 700; font-size: 14px; white-space: nowrap; }
.chip img { width: 36px; height: 36px; border-radius: 12px; object-fit: cover; }
.chip:not(:has(img)) { padding-left: 16px; }
.chip.on { background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--accent); }
.menu-body { padding-top: 6px; }
.menu-sec { padding-top: 10px; }
.menu-sec + .menu-sec { margin-top: 10px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 12px; }
.grid.pad { padding-top: 6px; }
.wide { grid-column: 1 / -1; }
.item { min-width: 0; cursor: pointer; }
.item-img { position: relative; aspect-ratio: 1; border-radius: 20px; overflow: hidden; background: var(--soft); }
.item-img img { width: 100%; height: 100%; object-fit: cover; }
.noimg { width: 100%; height: 100%; display: grid; place-items: center; font-size: 42px; }
.noimg.big { font-size: 80px; }
.item.off .item-img img, .item.off .noimg { opacity: .45; filter: grayscale(.6); }
.add { position: absolute; right: 8px; bottom: 8px; width: 44px; height: 44px; border-radius: 50%; background: var(--card);
  display: grid; place-items: center; box-shadow: 0 3px 10px rgba(0, 0, 0, .14); }
.fav { position: absolute; right: 8px; top: 8px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--card) 80%, transparent); color: var(--muted); backdrop-filter: blur(4px); }
.fav.on { color: var(--danger); }
.fav.on svg { fill: currentColor; }
.fav.big { width: 42px; height: 42px; right: 60px; top: 14px; }
.badge { position: absolute; left: 8px; bottom: 8px; background: rgba(20, 20, 22, .82); color: #fff; font-size: 12px; font-weight: 700;
  padding: 5px 10px; border-radius: 10px; }
.badge.static { position: static; }
.item-price { margin-top: 8px; font-weight: 800; font-size: 17px; }
.item-name { font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.stepper { display: inline-flex; align-items: center; background: var(--soft); border-radius: 16px; height: 44px; flex: none; }
.stepper button { width: 42px; height: 44px; display: grid; place-items: center; }
.stepper b { min-width: 20px; text-align: center; font-size: 16px; }
.stepper.mini { position: absolute; right: 8px; bottom: 8px; left: 8px; justify-content: space-between; background: var(--card);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .14); height: 42px; }

/* bottom navigation */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; gap: 10px; align-items: center;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); pointer-events: none; }
.nav-pill { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--nav); border-radius: 30px; padding: 6px;
  pointer-events: auto; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.nav-btn { position: relative; display: grid; justify-items: center; gap: 2px; padding: 8px 2px; border-radius: 24px; color: #8d8d96;
  font-size: 11px; font-weight: 600; }
.nav-btn.on { color: #fff; background: color-mix(in srgb, var(--accent) 30%, var(--nav)); }
.nav-btn.on .ic { color: var(--accent); filter: brightness(1.25); }
.nav-btn .dot { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--danger);
  color: #fff; font-size: 11px; font-style: normal; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.nav-me { pointer-events: auto; width: 64px; height: 64px; border-radius: 50%; background: var(--nav); color: #8d8d96; display: grid;
  place-items: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); flex: none; }
.nav-me.on { color: var(--accent); }
.cart-pill { position: fixed; right: 14px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 29; display: flex; align-items: center;
  gap: 10px; height: 54px; padding: 0 22px; border-radius: 27px; background: var(--accent); color: #fff; font-size: 17px;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 45%, transparent); animation: pop .25s ease; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }

/* sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 40; animation: fade .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--card); border-radius: 26px 26px 0 0;
  max-height: 92vh; overflow-y: auto; animation: up .25s ease; padding-bottom: env(safe-area-inset-bottom); }
.sheet-img { position: relative; aspect-ratio: 4 / 3; background: var(--soft); }
.sheet-img img { width: 100%; height: 100%; object-fit: cover; }
.sheet-x { position: absolute; right: 14px; top: 14px; width: 42px; height: 42px; border-radius: 50%; background: var(--card); display: grid; place-items: center; }
.sheet-body { padding: 18px 16px 20px; }
.sheet-body h2 { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.sheet.small .sheet-body h2 { margin-bottom: 12px; }
.sheet.small .btn { margin-top: 14px; }
.combo { background: var(--soft); border-radius: 14px; padding: 10px 12px; margin: 10px 0; font-size: 14px; }
.combo b { display: block; margin-bottom: 4px; }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.price-lg { font-size: 22px; font-weight: 800; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* cart */
.lines { padding: 6px 16px; }
.line { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.line + .line { border-top: 1px solid var(--line); }
.line-img { width: 72px; height: 72px; border-radius: 18px; overflow: hidden; background: var(--soft); flex: none; display: grid; place-items: center; font-size: 28px; }
.line-img img { width: 100%; height: 100%; object-fit: cover; }
.line-img.plain { width: 30px; height: 30px; background: none; color: var(--accent); }
.line-info { flex: 1; min-width: 0; }
.line-info b { display: block; margin-top: 3px; font-size: 16px; }
.line.off { opacity: .6; }
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-radius: 26px 26px 0 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(0, 0, 0, .07); }
.sum-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; font-size: 16px; }
.sum-row b { font-size: 18px; }
.sum-row b.big { font-size: 22px; font-weight: 800; }

/* checkout */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--soft); padding: 5px; border-radius: 18px; margin-bottom: 12px; }
.seg button { height: 44px; border-radius: 14px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .06); }
.seg.pad-x { margin: 12px 16px; }
.addr-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--soft); border-radius: 18px;
  padding: 14px; border: 1.5px solid transparent; }
.addr-card.bad { border-color: var(--danger); }
.addr-card > .ic:first-child { color: var(--muted); }
.addr-card > div { flex: 1; min-width: 0; }
.addr-card b, .addr-card span { display: block; }
.addr-card span { color: var(--muted); font-size: 13px; margin-top: 2px; }
.addr-card .ok { color: var(--ok); display: flex; align-items: center; gap: 4px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.field { display: block; margin-top: 10px; }
.field .lbl { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px 4px; }
.field input, .field textarea { width: 100%; border: 1.5px solid var(--line); background: var(--card); border-radius: 16px; padding: 14px;
  outline: 0; font-size: 16px; resize: none; }
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.field.bad input { border-color: var(--danger); }
.field small { color: var(--danger); font-size: 12px; margin: 4px 0 0 4px; display: block; }
.person { display: flex; align-items: center; gap: 12px; background: var(--soft); border-radius: 18px; padding: 12px 8px 12px 14px; }
.person > div { flex: 1; min-width: 0; }
.person b, .person span { display: block; }
.pays { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pay { position: relative; display: grid; gap: 10px; justify-items: start; padding: 14px; border-radius: 18px; background: var(--soft);
  border: 1.5px solid transparent; font-weight: 700; text-align: left; }
.pay.on { border-color: var(--accent); background: var(--card); }
.pay.on .ic:first-child { color: var(--accent); }
.pay i { position: absolute; right: 12px; top: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; }
.totals > div { display: flex; justify-content: space-between; padding: 4px 0; }
.btn.loc { margin-top: 10px; min-height: 46px; font-size: 15px; }

/* lists */
.list { padding: 8px 16px; }
.list .sec-title { margin-top: 8px; }
.list-row { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 0; font-size: 16px; }
.list-row + .list-row { border-top: 1px solid var(--line); }
.list-row > .ic:first-child { color: var(--text); }
.addr-row .grow { display: flex; align-items: center; gap: 12px; text-align: left; }
.addr-row .grow div { min-width: 0; }
.addr-row b, .addr-row span { display: block; }
.addr-row span { color: var(--muted); font-size: 13px; }
.switch { appearance: none; width: 50px; height: 30px; border-radius: 15px; background: var(--line); position: relative; flex: none; transition: .2s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: .2s; }
.switch:checked { background: var(--ok); }
.switch:checked::after { left: 23px; }

/* profile */
.me { display: flex; align-items: center; gap: 14px; }
.me b { display: block; font-size: 20px; font-weight: 800; }
.me span { color: var(--muted); }
.avatar { width: 70px; height: 70px; border-radius: 22px; overflow: hidden; display: grid; place-items: center; font-size: 28px; font-weight: 800;
  color: #fff; background: var(--accent); flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.langs { display: flex; gap: 10px; }
.langs button { min-width: 72px; height: 48px; border-radius: 16px; background: var(--soft); font-weight: 800; }
.langs button.on { background: var(--accent); color: #fff; }

/* orders */
.order-card { display: block; width: calc(100% - 0px); text-align: left; }
.oc-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.oc-top b { font-size: 17px; }
.oc-items { margin-top: 8px; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.oc-total { margin-top: 8px; font-weight: 800; font-size: 17px; }
.chip-st { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 10px; white-space: nowrap; }
.chip-st.live { background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--accent); }
.chip-st.done { background: color-mix(in srgb, var(--ok) 14%, var(--card)); color: var(--ok); }
.chip-st.bad { background: color-mix(in srgb, var(--danger) 12%, var(--card)); color: var(--danger); }
.success { display: flex; align-items: center; gap: 14px; color: var(--ok); }
.success b, .success span { display: block; }
.success b { color: var(--text); font-size: 18px; }
.success span { color: var(--muted); font-size: 14px; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { position: relative; display: flex; align-items: center; gap: 14px; padding: 9px 0; color: var(--muted); font-weight: 600; }
.steps li i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; background: var(--card); z-index: 1; }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 12px; top: 35px; bottom: -9px; width: 2px; background: var(--line); }
.steps li.done { color: var(--text); }
.steps li.done i { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps li.done::after { background: var(--ok); }
.steps li.now { color: var(--text); font-weight: 800; }
.steps li.now i { border-color: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent); background: var(--accent); }
.cancelled { display: flex; align-items: center; gap: 10px; color: var(--danger); font-weight: 800; font-size: 17px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.kv.total { font-weight: 800; font-size: 17px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.kv .wrap { text-align: right; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(110px + env(safe-area-inset-bottom)); z-index: 50; background: rgba(20, 20, 22, .92);
  color: #fff; padding: 13px 16px; border-radius: 16px; text-align: center; font-weight: 600; animation: fade .2s; }

/* On tab pages (cart) the action bar sits above the bottom navigation. */
.has-nav .bottom-bar { bottom: calc(84px + env(safe-area-inset-bottom)); left: 8px; right: 8px; border-radius: 24px;
  padding-bottom: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .1); }
#app.page-cart.has-nav { padding-bottom: calc(240px + env(safe-area-inset-bottom)); }
.type-btn { white-space: nowrap; font-size: 14px; padding: 12px 6px; }
