:root {
  --brand: #e4572e;
  --brand-dark: #c4421d;
  --ink: #1f1a17;
  --muted: #7a706a;
  --line: #ece6e1;
  --bg: #faf7f4;
  --card: #fff;
  --ok: #2e7d32;
  --ok-bg: #e8f5e9;
  --warn: #a15c00;
  --warn-bg: #fff3dc;
  --info: #1b5fb4;
  --info-bg: #e5f0ff;
  --danger: #c62828;
  --danger-bg: #fdecea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.4;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 120px; }
.wide { max-width: 1200px; }

/* Header */
.hero {
  background: linear-gradient(135deg, #e4572e, #f08a24); color: #fff;
  padding: 22px 16px 26px; border-radius: 0 0 24px 24px;
}
.hero .wrap { padding-bottom: 0; }
.hero h1 { margin: 0; font-size: 24px; letter-spacing: -.3px; }
.hero p { margin: 4px 0 0; opacity: .92; font-size: 14px; }
.hero .pill { display: inline-block; margin-top: 10px; background: rgba(255,255,255,.2); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 0; }
.topbar h1 { font-size: 20px; margin: 0; }
.topbar .links { display: flex; gap: 8px; flex-wrap: wrap; }

/* Category chips */
.chips { position: sticky; top: 0; z-index: 5; background: var(--bg); display: flex; gap: 8px; overflow-x: auto; padding: 12px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-size: 14px; font-weight: 600; text-decoration: none; color: var(--ink); }

h2.cat { font-size: 18px; margin: 18px 0 8px; }

/* Cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.item { display: flex; gap: 12px; align-items: flex-start; }
.item .emoji { font-size: 34px; width: 54px; height: 54px; flex: none; display: grid; place-items: center; background: #fff4ec; border-radius: 12px; }
.item .body { flex: 1; min-width: 0; }
.item .name { font-weight: 700; }
.item .desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.item .price { font-weight: 700; margin-top: 6px; }
.item .side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.note-input { width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 14px; background: #fcfbfa; }

/* Qty stepper */
.stepper { display: flex; align-items: center; gap: 2px; background: #fff4ec; border-radius: 999px; padding: 3px; }
.stepper button { width: 32px; height: 32px; border: 0; border-radius: 50%; background: #fff; color: var(--brand); font-size: 20px; font-weight: 700; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.stepper span { min-width: 22px; text-align: center; font-weight: 700; }
.add { border: 0; background: var(--brand); color: #fff; border-radius: 999px; width: 36px; height: 36px; font-size: 22px; font-weight: 700; cursor: pointer; }

/* Buttons */
.btn { display: block; width: 100%; border: 0; border-radius: 12px; padding: 14px 16px; font-size: 16px; font-weight: 700; cursor: pointer; text-align: center; text-decoration: none; background: var(--brand); color: #fff; }
.btn:active { transform: scale(.99); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ok { background: var(--ok); }
.btn.dark { background: var(--ink); }
.btn.sm { display: inline-block; width: auto; padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.btn + .btn { margin-top: 10px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; margin-top: 0 !important; }

/* Bottom bar */
.bottombar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, rgba(250,247,244,0)); z-index: 10; }
.bottombar .inner { max-width: 560px; margin: 0 auto; }
.bottombar .btn { display: flex; justify-content: space-between; box-shadow: 0 6px 20px rgba(228,87,46,.35); }

/* Forms */
label.field { display: block; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
label.field input { display: block; width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; font-size: 17px; background: #fff; }
input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.error { background: var(--danger-bg); color: var(--danger); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }

/* Lines / totals */
.line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line .note { color: var(--muted); font-size: 13px; font-style: italic; }
.total { display: flex; justify-content: space-between; font-size: 20px; font-weight: 800; padding-top: 10px; }
.muted { color: var(--muted); font-size: 14px; }
.center { text-align: center; }

/* Status tags */
.tag { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.tag.cocina { background: var(--warn-bg); color: var(--warn); }
.tag.listo { background: var(--info-bg); color: var(--info); }
.tag.entregado { background: var(--ok-bg); color: var(--ok); }
.tag.open { background: var(--ok-bg); color: var(--ok); }
.tag.bill { background: var(--danger-bg); color: var(--danger); }

/* Code screen */
.demo-banner { background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.code-big { font-size: 40px; font-weight: 800; letter-spacing: 14px; text-align: center; background: #fff; border: 2px dashed #f0c89a; border-radius: 14px; padding: 12px 0 12px 14px; margin: 10px 0 16px; }
.code-input { text-align: center; letter-spacing: 12px; font-size: 28px !important; font-weight: 800; }

/* Big icon screens */
.big { text-align: center; padding: 40px 10px 10px; }
.big .icon { font-size: 64px; }
.big h2 { margin: 10px 0 6px; }

/* Payment buttons */
.pay { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.pay button { border: 2px solid var(--line); background: #fff; border-radius: 16px; padding: 22px 10px; font-size: 17px; font-weight: 700; cursor: pointer; }
.pay button .i { display: block; font-size: 36px; margin-bottom: 6px; }

/* Toast */
.toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: drop .25s ease-out; }
.toast.alert { background: var(--danger); }
.toast.good { background: var(--ok); }
@keyframes drop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* Staff */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.acc.bill { outline: 3px solid var(--danger); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { outline-color: rgba(198,40,40,.25); } }
.acc.flash, .ticket.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 6px rgba(228,87,46,.6); } }
.acc h3 { margin: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.round { padding: 8px 0; border-top: 1px solid var(--line); }
.round .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.billbox { background: var(--danger-bg); color: var(--danger); border-radius: 10px; padding: 10px 12px; font-weight: 700; margin: 10px 0; }
.empty { text-align: center; color: var(--muted); padding: 60px 10px; }
.empty .icon { font-size: 48px; }

/* PIN gate */
.gate { max-width: 340px; margin: 12vh auto 0; padding: 0 16px; text-align: center; }
.gate input { text-align: center; letter-spacing: 10px; font-size: 26px; }

/* Kitchen (dark) */
body.kitchen { background: #16130f; color: #f4ede6; }
body.kitchen .topbar h1 { color: #fff; }
body.kitchen .btn.secondary { background: #2a241e; color: #f4ede6; border-color: #3a322a; }
.ticket { background: #fffaf3; color: var(--ink); border-radius: 14px; padding: 14px; border-top: 8px solid #f0a500; }
.ticket.late { border-top-color: var(--danger); }
.ticket h3 { margin: 0; display: flex; justify-content: space-between; font-size: 22px; }
.ticket .meta { color: var(--muted); font-size: 13px; margin: 2px 0 8px; }
.ticket ul { list-style: none; padding: 0; margin: 0 0 12px; font-size: 18px; }
.ticket li { padding: 5px 0; border-bottom: 1px dashed #e6dccf; }
.ticket li .note { display: block; color: var(--danger); font-size: 14px; font-weight: 700; }
body.kitchen .empty { color: #9b9086; }

/* QR page */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.qr-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 18px; text-align: center; break-inside: avoid; }
.qr-card svg { width: 100%; height: auto; max-width: 200px; }
.qr-card h3 { margin: 0 0 2px; font-size: 22px; }
.qr-card .url { font-size: 11px; color: var(--muted); word-break: break-all; }
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .qr-card { box-shadow: none; border: 1px solid #ccc; }
}

/* Landing */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 16px; }
.tile { display: block; background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 18px 14px; text-decoration: none; color: var(--ink); }
.tile .i { font-size: 32px; }
.tile b { display: block; margin-top: 6px; }
.tile span { color: var(--muted); font-size: 13px; }
