:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #16181d; --muted: #6b7280; --line: #e5e7eb;
  --brand: #0f766e; --brand-ink: #ffffff; --brand-soft: color-mix(in srgb, var(--brand) 16%, white);
  --warn: #b45309; --warn-soft: #fef3c7; --danger: #b91c1c; --danger-soft: #fee2e2;
  --ok: #15803d; --ok-soft: #dcfce7; --info: #1d4ed8; --info-soft: #dbeafe;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1013; --card: #181b20; --text: #eef0f3; --muted: #9aa3af; --line: #2a2f37;
    --brand: #2dd4bf; --brand-ink: #062925; --brand-soft: color-mix(in srgb, var(--brand) 22%, #0e1013);
    --warn: #fbbf24; --warn-soft: #3a2c0b; --danger: #f87171; --danger-soft: #3b1414;
    --ok: #4ade80; --ok-soft: #0f3320; --info: #93c5fd; --info-soft: #14284d;
    --shadow: 0 1px 2px rgba(0,0,0,.4); }
}
.till { --brand: #4338ca; --brand-ink: #ffffff; --brand-soft: color-mix(in srgb, var(--brand) 14%, white); }
@media (prefers-color-scheme: dark) { .till { --brand: #a5b4fc; --brand-ink: #14123a; --brand-soft: color-mix(in srgb, var(--brand) 22%, #0e1013); } }
.demo-note { background: var(--warn-soft); border-radius: 12px; padding: 10px 12px; font-size: .88rem; }
.demo-note a { font-weight: 600; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
a { color: var(--brand); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .tiny { font-size: .78rem; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.center { text-align: center; }

.topbar { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line);
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 12px; }
.topbar .title { font-weight: 700; font-size: 1.1rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--ok); }

main { max-width: 760px; margin: 0 auto; padding: 16px; padding-bottom: calc(96px + var(--safe-b)); }
.wide main { max-width: 1280px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.banner { border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.banner.info { background: var(--info-soft); } .banner.warn { background: var(--warn-soft); } .banner.ok { background: var(--ok-soft); }
.banner .grow { font-size: .92rem; }

.btn { appearance: none; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px 16px;
  min-height: 44px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger { color: var(--danger); } .btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.ok { color: #052e14; } }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.block { width: 100%; } .btn.sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: default; }

label.field { display: block; } label.field > span { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=tel], input[type=password], input[type=number], input[type=time], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 12px 14px; min-height: 48px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; min-height: 80px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.pin { letter-spacing: .5em; text-align: center; font-size: 1.4rem; }
.error { color: var(--danger); font-size: .9rem; min-height: 1.2em; }

.tabs-bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line);
  display: flex; padding-bottom: var(--safe-b); }
.tabs-bottom button { flex: 1; border: 0; background: none; padding: 10px 4px 8px; display: flex; flex-direction: column; align-items: center;
  gap: 2px; font-size: .75rem; font-weight: 600; color: var(--muted); cursor: pointer; position: relative; }
.tabs-bottom button svg { width: 24px; height: 24px; }
.tabs-bottom button.active { color: var(--brand); }
.badge { background: var(--danger); color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 700; min-width: 18px; height: 18px;
  padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; }
.tabs-bottom .badge { position: absolute; top: 4px; left: calc(50% + 6px); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; position: sticky; top: 57px; z-index: 10; background: var(--bg); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: .9rem; cursor: pointer; }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .name { font-weight: 600; } .item .price { font-weight: 700; white-space: nowrap; }
.item.off { opacity: .5; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; flex: none; }
.stepper button { width: 42px; height: 42px; border: 0; background: var(--card); font-size: 1.3rem; font-weight: 700; cursor: pointer; color: var(--brand); }
.stepper span { min-width: 28px; text-align: center; font-weight: 700; }
.add-btn { width: 42px; height: 42px; border-radius: 12px; border: 0; background: var(--brand); color: var(--brand-ink); font-size: 1.5rem; font-weight: 700; cursor: pointer; flex: none; }

.basket-bar { position: fixed; left: 12px; right: 12px; bottom: calc(70px + var(--safe-b)); z-index: 25; max-width: 736px; margin: 0 auto; }
.basket-bar .btn { width: 100%; min-height: 56px; border-radius: 16px; box-shadow: 0 8px 24px rgba(0,0,0,.18); justify-content: space-between; padding: 0 18px; font-size: 1rem; }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 640px; max-height: 92dvh; overflow: auto; border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + var(--safe-b)); animation: up .18s ease-out; }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 20px; } }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }

.status { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.status.new { background: var(--info-soft); color: var(--info); } .status.preparing { background: var(--warn-soft); color: var(--warn); }
.status.ready { background: var(--ok-soft); color: var(--ok); } .status.collected { background: var(--line); color: var(--muted); }
.status.cancelled { background: var(--danger-soft); color: var(--danger); }
.progress { display: flex; gap: 6px; margin: 12px 0 4px; } .progress div { flex: 1; height: 6px; border-radius: 6px; background: var(--line); }
.progress div.on { background: var(--brand); }
.progress-labels { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); }
.lines { margin: 10px 0; padding: 0; list-style: none; } .lines li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.lines li b { margin-right: 6px; }
.total { display: flex; justify-content: space-between; font-weight: 700; border-top: 1px solid var(--line); padding-top: 8px; }

.chat { display: flex; flex-direction: column; height: calc(100dvh - 57px - 70px - var(--safe-b)); }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 80%; padding: 9px 13px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; }
.bubble .t { display: block; font-size: .7rem; opacity: .7; margin-top: 2px; }
.bubble.me { align-self: flex-end; background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 6px; }
.bubble.them { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.chat-input { display: flex; gap: 8px; padding: 10px 12px; background: var(--card); border-top: 1px solid var(--line); }
.chat-input textarea { min-height: 46px; height: 46px; max-height: 120px; resize: none; padding: 11px 14px; border-radius: 23px; }
.chat-input .btn { border-radius: 23px; min-height: 46px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

.toast { position: fixed; left: 50%; top: max(14px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 100; background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: calc(100% - 32px); animation: up .2s; }

.auth { max-width: 420px; margin: 0 auto; padding: 32px 16px; }
.auth .logo { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 14px; display: block; }
.seg { display: flex; background: var(--line); border-radius: 12px; padding: 4px; }
.seg button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* photos */
.thumb { width: 56px; height: 56px; flex: none; border-radius: 10px; object-fit: cover; background: var(--line); }
.cat-head .thumb { width: 40px; height: 40px; }
.photo-pick { display: flex; gap: 12px; align-items: center; }
.photo-prev { width: 96px; height: 96px; flex: none; border-radius: 12px; border: 1px dashed var(--line); display: grid; place-items: center; overflow: hidden; background: var(--bg); }
.photo-prev img { width: 100%; height: 100%; object-fit: cover; }
.photo-pick label.btn { cursor: pointer; }
.hidden { display: none !important; }
.chip.has-img { display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px 4px 4px; }
.chip img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
button.thumb-btn { padding: 0; border: 0; background: none; cursor: zoom-in; flex: none; }
.photo-big { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 12px; background: var(--bg); }
