:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --border: #ebe9e4;
  --ink: #15161a;
  --ink-soft: #6c7076;
  --ink-faint: #9a9da3;
  --accent: #ff5a36;
  --accent-dark: #e0431f;
  --accent-soft: #fff1ec;
  --accent-ink: #ffffff;
  --success: #16a34a;
  --success-soft: #eafaf1;
  --info: #2f6fed;
  --info-soft: #ecf2ff;
  --warn: #6c7076;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(20,21,26,0.05);
  --shadow-md: 0 10px 30px rgba(20,21,26,0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
body.ordering { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }

.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* =====================================================================
   Design system compartido: botones, inputs, paneles, tablas, pills.
   Usado por onboarding.html, qrs.html, kitchen.html, menu-admin.html,
   admin.html — así todo el panel de administración se ve consistente.
   ===================================================================== */

body.shell {
  display: flex;
  justify-content: center;
  padding: 40px 16px;
  min-height: 100vh;
}

/* ---------- Wide admin pages (qrs, menu-admin, admin maestro) ---------- */
body.page { padding: 32px 24px 56px; max-width: 1040px; margin: 0 auto; }
.page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.page-title { display: flex; align-items: center; gap: 12px; }
.page-title .step-icon { width: 36px; height: 36px; background: var(--accent-soft); color: var(--accent-dark); border: none; }
.page-title h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.2px; }
.page-title .venue-tag { color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.qr-card {
  border: 1.5px dashed var(--border); border-radius: var(--radius-lg);
  padding: 18px; text-align: center; page-break-inside: avoid; background: var(--surface);
}
.qr-card h2 { margin: 0 0 4px; font-size: 21px; font-weight: 700; }
.qr-card .sub { color: var(--ink-faint); font-size: 12px; margin-bottom: 10px; }
.qr-card svg { width: 150px; height: 150px; }
@media print {
  .page-header, .hint-text { display: none; }
  body.page { padding: 0; max-width: none; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-md);
}
.panel + .panel { margin-top: 20px; }
.panel.wide { max-width: 920px; }
.panel-stack { max-width: 920px; width: 100%; display: flex; flex-direction: column; }

.panel-title { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.panel h1 { font-size: 20px; margin: 0 0 6px; letter-spacing: -0.2px; font-weight: 700; }
.panel h2 { font-size: 15px; margin: 0 0 16px; font-weight: 700; letter-spacing: -0.1px; }
.panel p.sub { color: var(--ink-soft); font-size: 13.5px; margin: 0 0 22px; line-height: 1.5; }

/* ---------- Steps (onboarding) ---------- */
.steps { display: flex; flex-direction: column; }
.step { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.step:last-of-type { border-bottom: none; }
.step-icon {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg); color: var(--ink-soft); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.step.done .step-icon { background: var(--success); color: #fff; border-color: var(--success); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: var(--radius-sm); padding: 13px 18px;
  font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform 0.1s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(255,90,54,.28); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary.done { background: var(--success); box-shadow: none; cursor: default; }
.btn-secondary { background: var(--bg); color: var(--ink); border: 1px solid var(--border); }
.btn-secondary:hover { background: #eee; }
.btn-ghost { background: transparent; color: var(--ink-soft); padding: 10px 14px; }
.btn-ghost:hover { color: var(--ink); }
.btn-sm { padding: 9px 14px; font-size: 13px; }
.btn[disabled] { opacity: 0.4; cursor: default; pointer-events: none; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.input, textarea.input {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 14px; font-family: inherit;
  color: var(--ink); background: var(--surface); width: 100%;
}
.input:focus, textarea.input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea.input { resize: vertical; font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; }
.input-row { display: flex; gap: 10px; align-items: center; }
.input-row .input { flex: 1; }

/* ---------- Pills / status ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; }
.pill-mock { background: #fff3cd; color: #8a6800; }
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-error { background: #fdecea; color: #c0392b; }
.pill-neutral { background: var(--bg); color: var(--ink-soft); border: 1px solid var(--border); }

.status-msg { font-size: 13.5px; margin-top: 12px; display: flex; align-items: center; gap: 6px; }
.status-msg.ok { color: var(--success); }
.status-msg.error { color: #c0392b; }
.status-msg .icon { flex-shrink: 0; }

.hint-text { color: var(--ink-faint); font-size: 12px; margin-top: 10px; }

/* ---------- Selector de tarjetas (onboarding: cocina propia vs Fudo) ---------- */
.choice-cards { display: flex; flex-direction: column; gap: 10px; }
.choice-card {
  display: flex; align-items: flex-start; gap: 12px; text-align: left;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); padding: 14px 16px; cursor: pointer;
  font-family: inherit; width: 100%; transition: border-color 0.15s ease, background 0.15s ease;
}
.choice-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.choice-card.selected { border-color: var(--success); background: var(--success-soft); }
.choice-card .step-icon { margin-top: 1px; }
.choice-card .choice-title { font-weight: 700; font-size: 14.5px; margin-bottom: 2px; }
.choice-card .choice-desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }

.guide-box {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; margin: 14px 0; font-size: 13px; color: var(--ink-soft); line-height: 1.6;
}
.guide-box ol { margin: 6px 0 0; padding-left: 18px; }
.guide-box b { color: var(--ink); }

.step-link { font-size: 12.5px; font-weight: 600; color: var(--accent-dark); text-decoration: none; white-space: nowrap; }
.step-link:hover { text-decoration: underline; }
.step-extra { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 10px; }

/* ---------- Editor visual de carta (menu-admin.html) ---------- */
.menu-upload-box {
  border: 1.5px dashed var(--border); border-radius: var(--radius-sm);
  padding: 24px; text-align: center; margin-bottom: 20px; background: var(--bg);
}
.menu-upload-box .icon-slot { color: var(--ink-faint); }
.menu-upload-box p { font-size: 13px; color: var(--ink-soft); margin: 10px 0 14px; line-height: 1.5; }
.menu-upload-box .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.menu-item-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 14px 4px; margin-bottom: 10px; background: var(--surface);
}
.menu-item-row .field.full { grid-column: 1 / -1; }
.menu-item-row .row-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; margin: -4px 0 6px; }
@media (max-width: 560px) { .menu-item-row { grid-template-columns: 1fr; } }

.ai-banner {
  display: flex; align-items: center; gap: 10px; background: var(--accent-soft);
  color: var(--accent-dark); border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: 13px; font-weight: 600; margin-bottom: 18px;
}
.ai-banner .icon-slot { flex-shrink: 0; }

/* ---------- Table (admin.html) ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--ink-faint); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.table tr:last-child td { border-bottom: none; }
.table .empty-cell { color: var(--ink-faint); padding: 24px 10px; }

.link-row { display: flex; flex-wrap: wrap; gap: 6px; }
.link-chip {
  font-size: 12px; color: var(--accent-dark); text-decoration: none;
  background: var(--accent-soft); padding: 5px 9px; border-radius: 7px;
  display: inline-flex; align-items: center; gap: 4px; font-weight: 600;
}
.link-chip:hover { background: #ffe3d6; }
.link-chip .icon { width: 13px; height: 13px; }

.local-name { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.local-name .store-mark {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  background: var(--bg); color: var(--ink-soft); display: flex; align-items: center; justify-content: center;
}

/* ---------- Gate (clave admin, link inválido) ---------- */
.gate-icon {
  width: 48px; height: 48px; border-radius: 14px; margin: 0 auto 16px;
  background: var(--accent-soft); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Header ---------- */
header.top {
  padding: 20px 20px 14px;
  position: sticky;
  top: 0;
  background: rgba(247,247,245,0.92);
  backdrop-filter: blur(8px);
  z-index: 10;
  border-bottom: 1px solid var(--border);
  max-width: 480px;
  margin: 0 auto;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
}
header.top h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.2px;
}
header.top .venue {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 1px;
}
header.top .mesa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  margin-top: 10px;
}

main { padding: 16px 20px; max-width: 480px; margin: 0 auto; }

.categoria { margin-top: 22px; }
.categoria:first-child { margin-top: 4px; }
.categoria h2 {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-soft);
  margin: 0 0 10px;
}

.item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.item:hover { box-shadow: var(--shadow-sm); }
.item .info { flex: 1; margin-right: 12px; }
.item .info .nombre { font-weight: 600; font-size: 15px; letter-spacing: -0.1px; }
.item .info .desc { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; line-height: 1.4; }
.item .info .precio { font-size: 13.5px; color: var(--ink); font-weight: 600; margin-top: 6px; }

.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stepper button {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}
.stepper button:active { transform: scale(0.92); }
.stepper button:not(.remove) { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper button.remove { background: var(--surface); color: var(--ink); }
.stepper span { min-width: 18px; text-align: center; font-weight: 600; font-size: 14px; }

.upsell {
  background: var(--accent-soft);
  border: 1px solid #ffd9c9;
  border-radius: var(--radius-md);
  padding: 14px;
  width: calc(100% - 40px);
  max-width: 440px;
  margin: 18px auto;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.upsell.visible { display: flex; }
.upsell .msg { font-size: 13.5px; line-height: 1.4; color: var(--ink); }
.upsell .msg b { color: var(--accent-dark); }
.upsell button {
  background: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.upsell .tag { font-size: 10.5px; color: var(--accent-dark); opacity: 0.75; display:block; margin-top:4px; font-weight: 500; }

footer.cart-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: 0 -6px 20px rgba(20,21,26,0.05);
}
footer.cart-bar .total { font-size: 13.5px; color: var(--ink-soft); }
footer.cart-bar .total b { color: var(--ink); font-size: 16px; display: block; }
footer.cart-bar button {
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 700;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(255,90,54,0.3);
}
footer.cart-bar button:disabled { opacity: 0.35; box-shadow: none; }

.overlay {
  position: fixed; inset: 0;
  background: rgba(20,21,26,0.55);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.overlay.visible { display: flex; }
.overlay .box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.overlay .box h3 { margin-top: 0; font-size: 17px; letter-spacing: -0.2px; }
.overlay #qr-canvas { margin: 18px auto; background: #fff; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); display: inline-block; }
.overlay .estado-pedido {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 10px 0 18px;
  background: var(--bg);
  border-radius: 999px;
  padding: 8px 12px;
  display: inline-block;
}
.overlay button.close { background: none; border: none; color: var(--ink-soft); margin-top: 12px; cursor: pointer; font-size: 13px; }
.overlay button.primary {
  background: var(--accent); border: none; color:#fff; font-weight:700;
  padding: 13px 20px; border-radius: var(--radius-sm); width: 100%; cursor:pointer; font-size:14px;
  box-shadow: 0 6px 16px rgba(255,90,54,0.3);
}
.badge-pagado { color: var(--success); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Modal de edición de local (admin.html) ---------- */
.overlay .box.wide { max-width: 460px; text-align: left; }
.overlay .box.xwide { max-width: 760px; max-height: 86vh; overflow-y: auto; }
.demo-mesas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.demo-mesas-grid .qr-card { padding: 12px; }
.demo-mesas-grid .qr-card svg { width: 110px; height: 110px; }
.demo-mesas-grid .qr-card h2 { font-size: 15px; margin-bottom: 2px; }
.demo-mesas-grid .qr-card .sub { font-size: 10.5px; margin-bottom: 6px; }
.overlay .box.wide h3 { display: flex; align-items: center; gap: 10px; }
.modal-section { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.modal-section:first-of-type { border-top: none; padding-top: 0; margin-top: 4px; }
.modal-section h4 { margin: 0 0 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-faint); }
.modal-row { display: flex; align-items: center; gap: 8px; }
.modal-row .input { flex: 1; }
.token-box {
  font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; word-break: break-all; flex: 1; color: var(--ink-soft);
}
.btn-icon {
  width: 36px; height: 36px; flex-shrink: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  color: var(--ink-soft); cursor: pointer;
}
.btn-icon:hover { background: var(--bg); color: var(--ink); }
.btn-danger { background: #fdecea; color: #c0392b; }
.btn-danger:hover { background: #fbdcd8; }
.row-actions { display: flex; align-items: center; gap: 6px; }
.overlay .box .close-x {
  position: absolute; top: 14px; right: 14px; background: none; border: none;
  color: var(--ink-faint); cursor: pointer; padding: 4px; display: flex;
}
.overlay .box.wide { position: relative; }

/* ---------- Propina ---------- */
.propina-opciones { display: flex; gap: 10px; margin: 18px 0 10px; }
.propina-opciones button {
  flex: 1; padding: 13px 8px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border); background: var(--bg); font-weight: 600; font-size: 14px;
}
.propina-opciones button.destacada {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 6px 16px rgba(255,90,54,0.3);
}

/* ---------- Kitchen panel ---------- */
body.kitchen { padding: 0; }
.kitchen-header {
  padding: 18px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.kitchen-header .brand-row { display: flex; align-items: center; gap: 10px; }
.kitchen-header h1 { margin:0; font-size: 17px; font-weight: 700; }
.kitchen-header .mesa {
  background: var(--ink);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px;
}
.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding: 20px 24px;
}
.ticket {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.ticket.CONFIRMADO { border-left-color: var(--info); }
.ticket.LISTO { border-left-color: var(--success); }
.ticket.ENTREGADO { border-left-color: #c7c9cd; opacity: 0.65; }
.ticket .mesa-title { font-weight: 700; font-size: 16px; margin-bottom: 4px; letter-spacing: -0.2px; }
.ticket .estado-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-soft); margin-bottom: 10px; font-weight: 600; }
.ticket ul { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--ink); line-height: 1.6; }
.ticket .acciones { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.ticket .acciones button {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  border: none; border-radius: var(--radius-sm); padding: 9px 6px;
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.btn-confirmar { background: var(--info-soft); color: var(--info); }
.btn-listo { background: var(--success-soft); color: var(--success); }
.btn-entregado { background: var(--bg); color: var(--ink-soft); border: 1px solid var(--border) !important; }
.empty-state { color: var(--ink-soft); padding: 60px 20px; text-align: center; grid-column: 1/-1; font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
