/* Menu Digital — shared look for every screen.
   Warm neutrals, one brand color, soft depth. Colors are tokens so the owner's
   brand color and the dark kitchen screen just swap values. */
:root {
  color-scheme: light;
  --bg: #f7f5f2;
  --surface: #ffffff;
  --surface-2: #f3efe9;
  --text: #1c1917;
  --muted: #78716c;
  --line: #ebe5dd;
  --brand: #c2410c;
  --brand-ink: #ffffff;
  --brand-soft: color-mix(in srgb, var(--brand) 10%, transparent);
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #a16207;
  --warn-bg: #fef6d8;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --info: #1d4ed8;
  --info-bg: #e0eaff;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.05), 0 8px 24px -12px rgba(28, 25, 23, 0.14);
  --shadow-lg: 0 2px 6px rgba(28, 25, 23, 0.06), 0 24px 48px -20px rgba(28, 25, 23, 0.28);
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.dark {
  color-scheme: dark;
  --bg: #0f0f10;
  --surface: #1a1a1c;
  --surface-2: #252528;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --line: #2e2e33;
  --brand: #f97316;
  --brand-ink: #1a0d04;
  --ok: #4ade80;
  --ok-bg: #12301d;
  --warn: #fbbf24;
  --warn-bg: #33270a;
  --bad: #f87171;
  --bad-bg: #3a1414;
  --info: #93c5fd;
  --info-bg: #172a4a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 40px -16px rgba(0, 0, 0, 0.7);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
@media (pointer: fine) { html { overscroll-behavior: none; } }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea, label { touch-action: manipulation; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; letter-spacing: -0.01em; }
p { text-wrap: pretty; }
a { color: var(--brand); text-underline-offset: 3px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
code { font-size: .88em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }

/* keyboard focus: always visible, never on mouse click */
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--ring); }
a:focus-visible { border-radius: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(28, 25, 23, 0.04);
  transition: background-color .15s ease, border-color .15s ease, box-shadow .2s ease, transform .42s var(--spring), opacity .15s ease;
}
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--text) 16%, var(--line)); transform: translateY(-1px); }
/* anticipation: a quick squash on press, then the spring overshoots back on release */
.btn:active { transform: scale(0.93); transition-duration: .15s, .15s, .2s, .07s, .15s; transition-timing-function: ease, ease, ease, ease-in, ease; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--brand) 70%, transparent); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); border-color: transparent; }
.btn-ok { background: var(--ok); color: #fff; border-color: transparent; box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--ok) 70%, transparent); }
.btn-ok:hover { background: color-mix(in srgb, var(--ok) 88%, #000); border-color: transparent; }
.dark .btn-ok { color: #052e12; }
.dark .btn-ok:hover { background: color-mix(in srgb, var(--ok) 85%, #fff); }
.btn-bad { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn-bad:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn-lg { min-height: 52px; padding: 13px 20px; font-size: 1.05rem; border-radius: 14px; }
.btn-block { width: 100%; }

/* ---------- form fields ---------- */
.input, textarea.input, select.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.input:hover { border-color: color-mix(in srgb, var(--text) 18%, var(--line)); }
.input:focus-visible, .input:focus { border-color: var(--brand); box-shadow: var(--ring); }
select.input { background-color: var(--surface); color: var(--text); }
textarea.input { resize: vertical; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }

/* ---------- staff screens ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 20px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 1.15rem; font-weight: 800; }
.topbar .spacer { flex: 1; }
.topbar .btn { min-height: 38px; padding: 7px 12px; font-size: .9rem; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; color: var(--muted); padding: 3px 10px; border-radius: 999px; background: var(--surface-2); }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.conn.on { color: var(--ok); background: var(--ok-bg); }
.conn.on::before { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }

.ticket {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px;
  min-width: 0;
}
.ticket-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ticket-table { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; }
.ticket-num { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.ticket-time { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; font-size: .9rem; }
.ticket ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ticket li { display: flex; gap: 8px; align-items: baseline; }
.ticket li .q { font-weight: 800; min-width: 2.2em; font-variant-numeric: tabular-nums; }
.ticket li .n { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ticket .line-note { display: block; color: var(--warn); font-size: .85rem; font-style: italic; }
.ticket .order-note { background: var(--warn-bg); color: var(--warn); padding: 9px 12px; border-radius: 10px; font-size: .9rem; overflow-wrap: anywhere; }
.ticket-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ticket-actions .btn { flex: 1; }
.ticket.new { border: 2px solid var(--brand); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: var(--shadow), 0 0 0 0 color-mix(in srgb, var(--brand) 30%, transparent); }
  50% { box-shadow: var(--shadow), 0 0 0 8px color-mix(in srgb, var(--brand) 0%, transparent); }
}
.empty { padding: 22px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line); border-radius: var(--radius); font-size: .92rem; background: color-mix(in srgb, var(--surface) 50%, transparent); }

/* ---------- modal / overlay ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 16, 12, 0.5);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  overscroll-behavior: contain;
  animation: fade .18s ease-out;
}
.modal {
  background: var(--surface);
  border-radius: 22px;
  padding: 24px;
  width: 100%; max-width: 440px;
  display: flex; flex-direction: column; gap: 14px;
  max-height: 90vh; overflow: auto; overscroll-behavior: contain;
  box-shadow: var(--shadow-lg);
  animation: modal-in .38s var(--spring);
}
.modal h2 { font-size: 1.25rem; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.pin-input { font-size: 2rem; text-align: center; letter-spacing: 0.5em; }

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #1c1917; color: #fff; padding: 12px 18px; border-radius: 14px;
  z-index: 200; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px);
  font-weight: 500; animation: rise .2s ease-out;
}
.offline-banner {
  position: sticky; top: 0; z-index: 50;
  background: var(--bad); color: #fff; padding: 12px 20px; font-size: .95rem; line-height: 1.4;
}

/* ---------- people who prefer less motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- motion ----------
   Snappy timing, slow-in/slow-out easing, a little overshoot for appeal.
   Everything calms down for people who ask their phone for less motion. */
:root {
  --spring: cubic-bezier(.34, 1.56, .64, 1);   /* overshoots, then settles */
  --ease-out: cubic-bezier(.16, 1, .3, 1);      /* fast start, soft landing */
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);  /* slow in, slow out */
}
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(.96); } 60% { opacity: 1; } to { opacity: 1; transform: none; } }
@keyframes modal-in { 0% { opacity: 0; transform: translateY(24px) scale(.9); } 100% { opacity: 1; transform: none; } }
@keyframes grow-x { from { transform: scaleX(0); } }
/* exaggerated feedback */
@keyframes bump { 0% { transform: scale(1); } 22% { transform: scale(.78); } 58% { transform: scale(1.28); } 100% { transform: scale(1); } }
@keyframes wiggle { 0%, 100% { transform: none; } 20% { transform: translateY(-5px) rotate(-3deg); } 45% { transform: translateY(1px) rotate(2.5deg); } 70% { transform: translateY(-2px) rotate(-1deg); } }
@keyframes shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.bump { animation: bump .48s var(--ease-out); }
.wiggle { animation: wiggle .55s var(--ease-out); }
.shake { animation: shake .42s var(--ease-in-out); }
.toast { animation: toast-in .42s var(--spring) both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 20px) scale(.9); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- confirm pop-up ---------- */
.ask-wrap { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px; background: rgba(27, 39, 66, .42); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); animation: fade .2s ease-out; }
.ask-box { width: 100%; max-width: 400px; background: var(--surface, #fffaf2); color: var(--text); border-radius: 28px; padding: 26px 24px 22px; text-align: center; box-shadow: 0 30px 80px -24px rgba(27, 39, 66, .6); animation: modal-in .42s var(--spring) both; }
.ask-ic { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--brand, #b21423) 12%, transparent); color: var(--brand, #b21423); animation: ask-pop .6s var(--spring) .12s both; }
.ask-box.danger .ask-ic { background: color-mix(in srgb, var(--bad, #c0392b) 13%, transparent); color: var(--bad, #c0392b); }
.ask-box.danger .ask-ic svg { animation: wiggle .55s var(--ease-out) .35s; }
.ask-box h2 { font-size: 1.2rem; line-height: 1.3; letter-spacing: -0.01em; margin: 0 0 6px; }
.ask-box p { margin: 0; color: var(--muted); font-size: .95rem; line-height: 1.5; }
.ask-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.ask-btns .btn { min-height: 50px; }
.ask-box .ask-btns .btn-danger { background: var(--bad, #c0392b); color: #fff; border-color: transparent; }
.ask-box .ask-btns .btn-danger:hover { background: color-mix(in srgb, var(--bad, #c0392b) 85%, #000); }
.ask-box .ask-btns .btn-primary { background: var(--brand, #b21423); color: var(--brand-ink, #fff); border-color: transparent; }
.ask-box .ask-btns [data-no] { background: color-mix(in srgb, var(--text, #1b2742) 8%, transparent); color: var(--text, #1b2742); border-color: transparent; }
.btn-danger { background: var(--bad, #c0392b); color: #fff; border-color: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--bad, #c0392b) 85%, #000); border-color: transparent; }
.ask-wrap.closing { animation: fade .17s ease-in reverse forwards; }
.ask-wrap.closing .ask-box { animation: none; transition: transform .17s ease-in, opacity .17s ease-in; transform: scale(.9) translateY(10px); opacity: 0; }
@keyframes ask-pop { from { transform: scale(0) rotate(-30deg); } to { transform: none; } }
html[data-theme=dark] .ask-box { background: #18203a; }
