:root {
  --brand: #d9480f; --brand-d: #b03a0a; --brand-l: #fff1e8;
  --ink: #1f2328; --muted: #6b7280; --line: #e6e2dc; --bg: #f7f5f2; --card: #fff;
  --ok: #2b8a3e; --ok-l: #e6f6ea; --warn: #e67700; --warn-l: #fff4e0; --bad: #c92a2a; --bad-l: #fdecec; --info: #1c7ed6; --info-l: #e7f1fc;
  --r: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; color: var(--ink); background: var(--bg); -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 560px; margin: 0 auto; padding: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar .inner { max-width: 1240px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.logo { font-weight: 800; letter-spacing: -.02em; color: var(--brand); text-decoration: none; font-size: 18px; display: inline-flex; align-items: center; gap: 8px; }
.logo img { height: 30px; width: 30px; border-radius: 7px; object-fit: contain; background: #fff; }
.brand-logo { width: 56px; height: 56px; border-radius: 14px; object-fit: contain; background: #fff; flex: none; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.poweredby { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 0 8px; }
.btn { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { border-color: #cfc8bf; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.lg { padding: 14px 20px; font-size: 17px; }
.input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); width: 100%; }
.input.big { font-size: 22px; text-align: center; letter-spacing: .2em; padding: 14px; }
.input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
label.f { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.err { color: var(--bad); min-height: 1.2em; font-size: 14px; margin: 8px 0; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.pill.QUEUED { background: var(--info-l); color: var(--info); }
.pill.PREPARING { background: var(--warn-l); color: var(--warn); }
.pill.READY { background: var(--ok-l); color: var(--ok); }
.pill.COLLECTED, .pill.COMPLETED { background: #eee; color: #555; }
.pill.CANCELLED { background: var(--bad-l); color: var(--bad); }
.pill.ACTIVE { background: var(--info-l); color: var(--info); }
.veg { width: 14px; height: 14px; border: 1.5px solid var(--ok); display: inline-grid; place-items: center; border-radius: 3px; flex: none; }
.veg::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.veg.non { border-color: var(--bad); }
.veg.non::after { background: var(--bad); }
.banner { padding: 12px 14px; border-radius: 12px; margin: 10px 0; font-weight: 600; }
.banner.bad { background: var(--bad-l); color: var(--bad); }
.banner.ok { background: var(--ok-l); color: var(--ok); }
.banner.info { background: var(--info-l); color: var(--info); }
.banner.warn { background: var(--warn-l); color: #a35400; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); background: #222; color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: .25s; z-index: 100; pointer-events: none; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
.modal-wrap { position: fixed; inset: 0; background: rgba(20,16,12,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.login-card { width: min(380px, 100%); text-align: center; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.scroll-x { overflow-x: auto; }

/* ---------- customer app ---------- */
.hero { background: linear-gradient(135deg, var(--brand), var(--brand-2, #f08c00)); color: #fff; padding: 22px 16px 18px; }
.hero h1 { font-size: 22px; margin: 0; }
.hero .sub { opacity: .9; font-size: 14px; }
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; position: sticky; top: 0; background: var(--bg); z-index: 5; scrollbar-width: none; }
.cats button { white-space: nowrap; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.cats button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border: 0; }
.item .info { flex: 1; min-width: 0; }
.item .name { font-weight: 700; display: flex; gap: 8px; align-items: center; }
.item .desc { color: var(--muted); font-size: 13px; margin: 2px 0 6px; }
.item .meta { font-size: 12px; color: var(--muted); }
.item .price { font-weight: 700; }
.item.soldout { opacity: .5; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--brand); border-radius: 10px; overflow: hidden; background: #fff; }
.stepper button { border: 0; background: transparent; color: var(--brand); font-size: 20px; font-weight: 700; width: 36px; height: 36px; cursor: pointer; }
.stepper span { min-width: 26px; text-align: center; font-weight: 800; color: var(--brand); }
.addbtn { border: 1.5px solid var(--brand); color: var(--brand); background: #fff; border-radius: 10px; padding: 7px 18px; font-weight: 800; cursor: pointer; font: inherit; font-weight: 800; }
.cartbar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); z-index: 30; display: none; }
.cartbar.show { display: block; }
.cartbar .btn { width: 100%; max-width: 560px; margin: 0 auto; display: flex; justify-content: space-between; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: none; align-items: flex-end; justify-content: center; }
.sheet.show { display: flex; }
.sheet .panel { background: #fff; width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; }
.otp-boxes { display: flex; gap: 8px; justify-content: center; }
.install-card { border: 2px dashed var(--brand); background: var(--brand-l); }

/* order status */
.ticket { border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); margin-bottom: 14px; }
.ticket .head { padding: 12px 14px; display: flex; gap: 10px; align-items: center; border-bottom: 1px dashed var(--line); }
.ticket .qbig { font-size: 26px; font-weight: 900; letter-spacing: -.02em; }
.ticket .body { padding: 14px; display: grid; grid-template-columns: 1fr; gap: 12px; justify-items: center; text-align: center; }
.ticket .qr { width: 220px; height: 220px; image-rendering: pixelated; }
.ticket.READY { border: 3px solid var(--ok); }
.ticket.READY .head { background: var(--ok-l); }
.ticket.COLLECTED .qr-zone, .ticket.CANCELLED .qr-zone { opacity: .35; filter: grayscale(1); }
.progress { height: 8px; background: #eee; border-radius: 99px; overflow: hidden; width: 100%; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--warn), var(--ok)); transition: width 1s linear; }
.steps { display: flex; justify-content: space-between; width: 100%; font-size: 12px; color: var(--muted); }
.steps .on { color: var(--ink); font-weight: 700; }
.used-stamp { font-size: 20px; font-weight: 900; color: var(--bad); border: 3px solid var(--bad); padding: 4px 14px; border-radius: 8px; transform: rotate(-8deg); }

/* ---------- dark boards (kitchen / display / counter) ---------- */
body.dark { --bg: #121417; --card: #1b1e23; --line: #2c3037; --ink: #eef0f3; --muted: #9aa3ad; --info-l: #13283d; --warn-l: #3a2a10; --ok-l: #12301b; --bad-l: #3a1515; --brand-l: #3a2015; }
body.dark .input, body.dark select { background: #121417; color: var(--ink); }
.kcols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .kcols { grid-template-columns: 1fr; } }
.kcol h3 { display: flex; gap: 8px; align-items: center; font-size: 15px; text-transform: uppercase; letter-spacing: .05em; }
.kcard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; border-left: 5px solid var(--info); }
.kcard.PREPARING { border-left-color: var(--warn); }
.kcard.READY { border-left-color: var(--ok); }
.kcard.late { border-left-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.kcard .q { font-size: 22px; font-weight: 900; }
.kcard .it { font-size: 17px; font-weight: 700; margin: 4px 0; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 20px; }
.timer.late { color: var(--bad); }

.board { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; min-height: calc(100vh - 110px); }
.board section { background: var(--card); border-radius: 18px; padding: 18px; border: 1px solid var(--line); }
.board h2 { font-size: 28px; text-transform: uppercase; letter-spacing: .06em; }
.tokens { display: flex; flex-wrap: wrap; gap: 12px; }
.tok { padding: 12px 18px; border-radius: 12px; background: var(--warn-l); color: #ffc078; font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; }
.tok small { display: block; font-size: 13px; font-weight: 600; opacity: .8; }
.board .ready .tok { background: var(--ok-l); color: #8ce99a; font-size: 44px; }
.tok.new { animation: pulse 1s ease-in-out 6; }
@keyframes pulse { 50% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(140,233,154,.35); } }

.scan-result { border-radius: 18px; padding: 28px 18px; text-align: center; font-size: 20px; font-weight: 700; min-height: 180px; display: grid; place-items: center; }
.scan-result.ok { background: #1f6f33; color: #fff; }
.scan-result.bad { background: #a51d1d; color: #fff; }
.scan-result.idle { background: var(--card); border: 2px dashed var(--line); color: var(--muted); }
.scan-result .big { font-size: 40px; font-weight: 900; }
#reader { width: 100%; border-radius: 14px; overflow: hidden; }

/* ---------- admin ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi .v { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 0; background: none; font: inherit; font-weight: 600; padding: 10px 14px; border-bottom: 3px solid transparent; cursor: pointer; color: var(--muted); white-space: nowrap; }
.tabs button.on { color: var(--brand); border-color: var(--brand); }
.bar { height: 10px; background: #eee; border-radius: 99px; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.switch { display: inline-block; position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #ccc; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(20px); }
.cell-in { width: 80px; padding: 6px 8px; }
.qr-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.qr-sheet .card { text-align: center; }
.qr-sheet img { width: 100%; max-width: 220px; }
@media print { .noprint { display: none !important; } body { background: #fff; } .qr-sheet .card { break-inside: avoid; box-shadow: none; } }
