/* Foodwise · styles. Colours live in :root so you can change the brand in one place. */
:root {
  --brand: #d9480f; --brand-ink: #fff; --ink: #1f2933; --muted: #6b7785; --line: #e4e8ee;
  --bg: #f7f8fa; --card: #fff; --ok: #2b8a3e; --ok-bg: #e6f4ea; --bad: #c92a2a; --bad-bg: #fbe9e9;
  --warn-bg: #fff4e0; --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 14px rgba(16,24,40,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ink: #e9edf2; --muted: #9aa6b2; --line: #2c3440; --bg: #12161c; --card: #1a2028; --ok-bg: #173223; --bad-bg: #3a1c1c; --warn-bg: #3a2e16; color-scheme: dark; }
}
:root[data-theme="dark"] { --ink: #e9edf2; --muted: #9aa6b2; --line: #2c3440; --bg: #12161c; --card: #1a2028; --ok-bg: #173223; --bad-bg: #3a1c1c; --warn-bg: #3a2e16; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; overflow-x: hidden; }
a { color: var(--brand); }
h1 { font-size: 24px; margin: 8px 0 12px; }
h2 { font-size: 18px; margin: 4px 0 8px; }
h3 { font-size: 16px; margin: 0 0 2px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.boot { padding: 40px; text-align: center; color: var(--muted); }

/* buttons and pills */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; }
.btn.block { display: flex; width: 100%; margin-top: 12px; }
.btn.add { min-width: 84px; }
.link { background: none; border: 0; padding: 4px; color: var(--brand); font: inherit; cursor: pointer; }
.link.danger { color: var(--bad); }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--line); color: var(--ink); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.off { background: var(--bad-bg); color: var(--bad); }
.pill.big { font-size: 16px; padding: 6px 14px; }
.tag { display: inline-block; font-size: 12px; background: var(--bad-bg); color: var(--bad); padding: 1px 8px; border-radius: 6px; margin-left: 6px; }
.notice { background: var(--warn-bg); padding: 10px 14px; margin: 12px 16px 0; border-radius: var(--radius); }
.err { color: var(--bad); background: var(--bad-bg); padding: 8px 12px; border-radius: 10px; }
.ok-text { color: var(--ok); background: var(--ok-bg); padding: 8px 12px; border-radius: 10px; }
.code { font-size: 22px; font-weight: 800; letter-spacing: .12em; }

/* public header and menu */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .brand { font-weight: 800; font-size: 18px; color: var(--ink); text-decoration: none; margin-right: auto; }
.top-links { display: flex; gap: 14px; }
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; position: sticky; top: 62px; background: var(--bg); z-index: 4; scrollbar-width: none; }
.cats a { white-space: nowrap; padding: 6px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 14px; }
.menu, .narrow { max-width: 760px; margin: 0 auto; padding: 0 16px 120px; }
.cat h2 { margin-top: 22px; }
.item { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 8px 0; box-shadow: var(--shadow); }
.item p { color: var(--muted); font-size: 14px; margin: 2px 0 4px; }
.item.soldout { opacity: .6; }
.item .ctl { flex: 0 0 auto; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--brand); border-radius: 10px; overflow: hidden; }
.stepper button { width: 40px; height: 40px; border: 0; background: var(--brand); color: #fff; font-size: 20px; cursor: pointer; }
.stepper span { min-width: 36px; text-align: center; font-weight: 700; }
.cartbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: var(--ink); color: var(--bg); z-index: 6; }
.cartbar .btn.primary { min-height: 40px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 120px; }

/* cards, forms, cart */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
.form .field { display: block; margin: 12px 0; }
.field > span, .field legend { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--brand); }
fieldset { border: 0; padding: 0; margin: 12px 0; }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.line:last-child { border-bottom: 0; }
.lt { min-width: 80px; text-align: right; }
.totals > div, .row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.totals .grand, .row.grand { font-size: 18px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 10px 0 16px; }
.steps li { flex: 1; text-align: center; font-size: 13px; padding: 8px 4px; border-radius: 8px; background: var(--line); color: var(--muted); }
.steps li.on { background: var(--brand); color: #fff; font-weight: 600; }
.plain { list-style: none; padding: 0; }
.plain li { padding: 4px 0; }

/* auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth .card { width: 100%; max-width: 420px; }
.auth .brand { font-weight: 800; color: var(--brand); }
.demo-note { background: var(--warn-bg); padding: 10px; border-radius: 10px; }

/* admin layout */
.admin { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.side .brand { font-weight: 800; padding: 4px 8px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; display: flex; justify-content: space-between; }
.side nav a.on { background: var(--brand); color: #fff; }
.side nav a[data-badge]::after { content: attr(data-badge); background: var(--bad); color: #fff; border-radius: 999px; padding: 0 8px; font-size: 12px; line-height: 20px; }
.side nav a[data-badge="0"]::after { display: none; }
.who { margin-top: auto; font-size: 14px; display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.who small { color: var(--muted); }
.content { padding: 20px; max-width: 1100px; width: 100%; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; margin: 12px 0; overflow-x: auto; }
.tabs button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--ink); color: var(--bg); }
.order { background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 12px 0; box-shadow: var(--shadow); }
.order.fresh { border-left-color: var(--brand); }
.order.s-preparing { border-left-color: #f59f00; }
.order.s-out { border-left-color: #1c7ed6; }
.order.s-done { border-left-color: var(--ok); }
.order.s-cancelled { border-left-color: var(--bad); opacity: .75; }
.order header { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.order .cols { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px 0; }
.order .sum { min-width: 200px; display: flex; flex-direction: column; gap: 4px; }
.order .sum > div { display: flex; justify-content: space-between; }
.order .sum .grand { font-size: 17px; border-top: 1px solid var(--line); padding-top: 4px; }
.order footer { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; }
.order footer .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lines { list-style: none; padding: 0; margin: 6px 0; }
.lines li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.note { background: var(--warn-bg); padding: 6px 10px; border-radius: 8px; }
.item-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.item-row:last-child { border-bottom: 0; }
.switch { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.switch input { width: 18px; height: 18px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.sheet .actions { justify-content: flex-end; }

/* dialogs and toasts */
.scrim { position: fixed; inset: 0; background: rgba(10,14,20,.5); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 0; }
.sheet { background: var(--card); color: var(--ink); width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 20px; }
.sheet .confirm { font-size: 16px; }
.toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* print ticket (80 mm receipt) */
#ticket { display: none; }
@media print {
  body * { visibility: hidden; }
  #ticket, #ticket * { visibility: visible; }
  #ticket { display: block; position: absolute; left: 0; top: 0; width: 80mm; font: 12px/1.4 monospace; color: #000; }
  #ticket .row { display: flex; justify-content: space-between; }
  #ticket hr { border: 0; border-top: 1px dashed #000; }
}

/* phones */
@media (max-width: 760px) {
  .admin { grid-template-columns: minmax(0, 1fr); }
  .content { min-width: 0; }
  .item-row .grow { min-width: 0; overflow-wrap: anywhere; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px; position: sticky; top: 0; z-index: 4; }
  .side nav { flex-direction: row; overflow-x: auto; flex: 1; }
  .side nav a { white-space: nowrap; }
  .who { flex-direction: row; align-items: center; margin-top: 0; }
  .content { padding: 14px; }
  .order .cols { flex-direction: column; }
  .order .sum { min-width: 0; }
  .top-links { width: 100%; }
  .item { align-items: flex-start; }
  .cats { top: 0; }
}
