:root {
  --bg: #faf7f2; --card: #fff; --ink: #1f1b16; --muted: #6b6259; --line: #e8e1d6;
  --brand: #c2410c; --brand-ink: #fff; --ok: #15803d; --warn: #b45309; --bad: #b91c1c; --wa: #128c7e;
  --r: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.4; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }
.muted { color: var(--muted); font-size: .92em; }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.btn { appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px; padding: 10px 14px; font-size: 1rem; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); border-color: #f1c7c7; }
.btn.small { padding: 6px 10px; font-size: .9rem; }
.btn.block { width: 100%; }
label { display: block; font-weight: 600; font-size: .92rem; margin: 10px 0 4px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; background: #fff; color: var(--ink); font-family: inherit; }
textarea { min-height: 64px; resize: vertical; }
input[type=checkbox] { width: auto; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; margin: 10px 0; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .8rem; font-weight: 700; background: #eee; }
.pill.nuevo { background: #fde68a; } .pill.en_cocina { background: #fed7aa; } .pill.en_camino { background: #bfdbfe; }
.pill.entregado { background: #bbf7d0; } .pill.cancelado { background: #fecaca; }

/* Menú público */
.hero { background: var(--brand); color: #fff; padding: 22px 16px 18px; }
.hero .wrap { padding: 0 16px; }
.hero p { margin: 4px 0 0; opacity: .92; }
.closed { background: #fee2e2; color: var(--bad); font-weight: 700; text-align: center; padding: 10px; }
.cat { margin: 18px 0 8px; font-size: 1.1rem; }
.item { display: flex; gap: 12px; align-items: flex-start; }
.item img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; flex: none; }
.item .info { flex: 1; min-width: 0; }
.item .name { font-weight: 700; }
.qty { display: inline-flex; align-items: center; gap: 10px; }
.qty button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 1.2rem; font-weight: 700; cursor: pointer; }
.qty b { min-width: 18px; text-align: center; }
.cartbar { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }
.cartbar .btn { max-width: 728px; margin: 0 auto; display: flex; width: 100%; padding: 14px; font-size: 1.05rem; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet .panel { background: var(--bg); width: 100%; max-width: 760px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
.line { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.total { font-size: 1.15rem; font-weight: 800; }
.big { font-size: 2.2rem; font-weight: 800; }
.steps { display: flex; gap: 6px; margin: 14px 0; }
.steps div { flex: 1; text-align: center; font-size: .8rem; padding: 8px 4px; border-radius: 8px; background: #eee; color: var(--muted); font-weight: 600; }
.steps div.on { background: var(--brand); color: #fff; }
.pad-bottom { height: 90px; }

/* Panel */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar .wrap { padding: 10px 16px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 0 16px; max-width: 760px; margin: 0 auto; }
.tabs button { border: 0; background: none; padding: 10px 12px; font-weight: 700; font-size: .95rem; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-color: var(--brand); }
.order.nuevo { border-left: 5px solid #f59e0b; }
.order.en_cocina { border-left: 5px solid #fb923c; }
.order.en_camino { border-left: 5px solid #3b82f6; }
.order .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.stat b { display: block; font-size: 1.4rem; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: .95rem; }
#qr canvas { width: 220px; height: 220px; }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: #1f1b16; color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: .2s; pointer-events: none; z-index: 50; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%); }
.version { text-align: center; font-size: .75rem; margin: 24px 0 110px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }
