/* ============================================================
   Mesita POS — operator console (redesign)
   Warm, minimal, fast. Mesita palette. Inter.
   ============================================================ */

:root {
  /* Paleta Contífico/Siigo — extraída del CSS de producción de siigo.com/ec:
     azul #009DFF (primario) / #007ECC (hover) / #EBF7FF (tinte),
     navy #222B45 / #37465A, verde #619B2E, rojo #D42143, ámbar #FFA532,
     superficies frías #F3F7F9 / #F6F6F6. */
  --brand:        #009DFF;
  --brand-dark:   #007ECC;
  --brand-soft:   #EBF7FF;
  --ok:           #619B2E;
  --ok-soft:      #EFF6E4;
  --bg:           #F3F7F9;
  --surface:      #FFFFFF;
  --muted-surf:   #F6F8FA;
  --ink:          #222B45;
  --ink-mut:      #64748B;
  --line:         #E2EAF0;
  --bad:          #D42143;
  --bad-soft:     #FBE7EA;
  --warn:         #FFA532;
  --warn-soft:    #FFF3E0;

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --sh-sm: 0 1px 2px rgba(34,43,69,.04), 0 1px 3px rgba(34,43,69,.04);
  --sh-md: 0 4px 12px -4px rgba(34,43,69,.08), 0 14px 32px -14px rgba(34,43,69,.12);
  --sh-lg: 0 18px 54px -16px rgba(34,43,69,.24);
  --ease: cubic-bezier(.22,1,.36,1);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- App shell ---------- */
.app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 24px;
  background: rgba(243,247,249,.85);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; flex: 0 0 auto;
  box-shadow: 0 6px 16px -6px rgba(0,157,255,.45);
}
.brand-name { font-weight: 750; font-size: 1.05rem; letter-spacing: -0.02em; line-height: 1; }
.brand-name small { display: block; font-size: .7rem; font-weight: 600; color: var(--ink-mut); letter-spacing: .04em; margin-top: 3px; text-transform: uppercase; }

.topnav { display: flex; gap: 4px; margin-left: 6px; }
.topnav a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 100px;
  font-size: .92rem; font-weight: 600; color: var(--ink-mut);
  text-decoration: none; transition: background .2s, color .2s;
}
.topnav a:hover { background: var(--muted-surf); color: var(--ink); }
.topnav a.on { background: var(--ink); color: #fff; }
.topnav a.on svg { color: #fff; }
.topnav .cnt {
  font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 100px;
  background: var(--brand-soft); color: var(--brand-dark);
}
.topnav a.on .cnt { background: rgba(255,255,255,.22); color: #fff; }

.spacer { flex: 1; }

/* Mesita API connection pill — the integration star */
.api-pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 14px 8px 12px; border-radius: 100px;
  background: var(--ok-soft); border: 1px solid rgba(47,158,115,.22);
  font-size: .82rem; font-weight: 650; color: var(--ok);
  cursor: pointer; transition: filter .2s;
}
.api-pill:hover { filter: brightness(.97); }
.api-pill .qd { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(47,158,115,.5); animation: ping 2.2s infinite; }
.api-pill.off { background: var(--muted-surf); border-color: var(--line); color: var(--ink-mut); }
.api-pill.off .qd { background: var(--ink-mut); animation: none; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(47,158,115,.45); } 70% { box-shadow: 0 0 0 8px rgba(47,158,115,0); } 100% { box-shadow: 0 0 0 0 rgba(47,158,115,0); } }

.icon-btn {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  color: var(--ink-mut); background: transparent; transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--muted-surf); color: var(--ink); }

.main { flex: 1; }
.page { max-width: 1280px; margin: 0 auto; padding: 28px 24px 64px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px;
  font-size: .92rem; font-weight: 650; letter-spacing: -0.01em;
  transition: transform .05s, background .2s, border-color .2s, box-shadow .2s, color .2s;
  white-space: nowrap; border: 1px solid transparent;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 20px -10px rgba(0,157,255,.55); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-ok { background: var(--ok); color: #fff; box-shadow: 0 8px 20px -10px rgba(47,158,115,.6); }
.btn-ok:hover:not(:disabled) { filter: brightness(.96); }
.btn-ghost { background: transparent; color: var(--ink-mut); }
.btn-ghost:hover:not(:disabled) { background: var(--muted-surf); color: var(--ink); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-outline:hover:not(:disabled) { background: var(--muted-surf); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger-soft { background: var(--bad-soft); color: var(--bad); }
.btn-danger-soft:hover:not(:disabled) { background: #f7dede; }
.btn-lg { padding: 15px 24px; font-size: 1rem; border-radius: 14px; }
.btn-sm { padding: 7px 12px; font-size: .82rem; border-radius: 9px; }
.btn-block { width: 100%; }

/* ---------- Page header ---------- */
.page-head { display: flex; flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 22px; }
.page-head-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.7rem; font-weight: 780; letter-spacing: -0.03em; }
.page-head p { color: var(--ink-mut); font-size: .95rem; margin-top: 4px; }
.add-table-btn { flex-shrink: 0; min-height: 44px; padding-inline: 18px; }
.create-table-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.create-table-form .full { grid-column: 1 / -1; }

/* legend */
.legend { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 100px; font-size: .76rem; font-weight: 700;
}
.badge .d { width: 7px; height: 7px; border-radius: 50%; }
.badge.L { background: var(--ok-soft); color: var(--ok); } .badge.L .d { background: var(--ok); }
.badge.O { background: var(--brand-soft); color: var(--brand-dark); } .badge.O .d { background: var(--brand); }
.badge.P { background: var(--warn-soft); color: #B97A14; } .badge.P .d { background: var(--warn); }
.badge.C { background: var(--muted-surf); color: var(--ink-mut); } .badge.C .d { background: var(--ink-mut); }

/* ---------- Floor ---------- */
.zone { margin-bottom: 30px; }
.zone-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.zone-h .nm { font-size: .82rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-mut); }
.zone-h .ct { font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 100px; background: var(--muted-surf); color: var(--ink-mut); }
.zone-h .ln { flex: 1; height: 1px; background: var(--line); }

.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.tcard-wrap { position: relative; }
.tcard-delete-btn {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(214,69,69,.25);
  background: var(--bad-soft);
  color: var(--bad);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s var(--ease), background .15s var(--ease);
}
.tcard-wrap:hover .tcard-delete-btn,
.tcard-delete-btn:focus-visible { opacity: 1; }
.tcard-delete-btn:hover:not(:disabled) { background: #f7dede; }
.tcard {
  position: relative; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px; min-height: 152px; display: flex; flex-direction: column; gap: 7px;
  box-shadow: var(--sh-sm); cursor: pointer;
  transition: transform .12s var(--ease), box-shadow .2s, border-color .2s;
}
.tcard:hover { transform: translateY(-3px); box-shadow: var(--sh-md); border-color: #d9cdbe; }
.tcard .badge { position: absolute; top: 14px; right: 14px; }
.tcard .tnm {
  font-size: 1.35rem; font-weight: 780; letter-spacing: -0.02em;
  /* The estado badge floats top-right (absolute) — reserve its lane so the
     title row (name + DEMO chip on Mesa 12) can never run underneath it. */
  padding-right: 96px;
}
.tcard .tmeta { font-size: .82rem; color: var(--ink-mut); display: flex; align-items: center; gap: 6px; }
.tcard .tfoot { margin-top: auto; }
.tcard .ttotal { font-size: 1.18rem; font-weight: 780; }
.tcard .thint { font-size: .8rem; color: var(--ink-mut); font-weight: 500; }
.tcard .tprog { height: 6px; border-radius: 100px; background: var(--muted-surf); overflow: hidden; margin-top: 9px; }
.tcard .tprog i { display: block; height: 100%; border-radius: 100px; background: var(--ok); transition: width .8s var(--ease); }
.tcard.is-P { border-color: rgba(242,169,59,.5); }
.tcard.is-paid { border-color: rgba(47,158,115,.55); box-shadow: 0 0 0 3px var(--ok-soft); }
@keyframes turn { 0% { transform: scale(1); } 45% { transform: scale(.92); } 100% { transform: scale(1); } }
.tcard.turning { animation: turn .8s var(--ease); }

@media (max-width: 680px) {
  .add-table-btn { width: 100%; justify-content: center; }
  .create-table-form { grid-template-columns: 1fr; }
  .create-table-form .full { grid-column: auto; }
}

/* ---------- POS / order screen ---------- */
.order-wrap { position: fixed; inset: 0; top: 63px; display: grid; grid-template-columns: 1fr 440px; background: var(--bg); }
.menu-pane { overflow-y: auto; padding: 20px 24px; }
.menu-back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.searchbar { position: relative; margin-bottom: 16px; }
.searchbar input {
  width: 100%; padding: 13px 14px 13px 42px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); font-size: .95rem; color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
.searchbar input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.searchbar .si { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-mut); }

.cats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.cat {
  padding: 9px 15px; border-radius: 100px; font-size: .88rem; font-weight: 650;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-mut); transition: all .18s;
}
.cat:hover { border-color: #d9cdbe; color: var(--ink); }
.cat.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.prods { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.pcard {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 15px; display: flex; flex-direction: column; gap: 4px; min-height: 118px;
  transition: transform .1s var(--ease), box-shadow .18s, border-color .18s;
}
.pcard:hover { transform: translateY(-2px); box-shadow: var(--sh-md); border-color: var(--brand); }
.pcard:active { transform: translateY(0) scale(.985); }
.pcard .pi { font-size: 1.6rem; line-height: 1; }
.pcard .pn { font-weight: 700; font-size: .95rem; line-height: 1.25; }
.pcard .pd { font-size: .78rem; color: var(--ink-mut); flex: 1; line-height: 1.35; }
.pcard .pp { font-weight: 780; color: var(--brand-dark); font-size: 1.02rem; margin-top: 2px; }
.pcard { position: relative; }
.pcard.syncing { border-color: var(--warn); opacity: .92; }
.pcard.synced { border-color: var(--ok); }
.pcard-sync { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); box-shadow: var(--sh-sm); font-size: .72rem; font-weight: 800; color: var(--warn); }
.pcard-sync.ok { color: var(--ok); background: var(--ok-soft); }
.pending-dot { color: var(--warn); font-weight: 700; }
.li.pending-line { opacity: .85; }
.order-closing { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; gap: 12px; color: var(--ink-mut); }
.load-title { font-weight: 700; font-size: 1rem; color: var(--ink); }
.c-load-spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: rot .7s linear infinite; }
.c-load-spinner.sm { width: 14px; height: 14px; border-width: 2px; }

/* ---------- Precuenta sidebar ---------- */
.bill { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; height: 100%; }
.bill-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.bill-head .bt { font-size: 1.2rem; font-weight: 780; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.bill-head .bsub { font-size: .8rem; color: var(--ink-mut); margin-top: 3px; }
.diners { display: inline-flex; align-items: center; gap: 7px; margin-top: 11px; padding: 6px 6px 6px 12px; border-radius: 100px; background: var(--muted-surf); font-size: .84rem; font-weight: 650; }
.diners .step { width: 28px; height: 28px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; }
.diners .step:hover { border-color: var(--brand); color: var(--brand); }

.bill-items { flex: 1; overflow-y: auto; padding: 8px 12px; }
.li { display: flex; gap: 12px; padding: 12px 10px; border-radius: 12px; transition: background .15s; }
.li:hover { background: var(--muted-surf); }
.li .lpi { font-size: 1.3rem; line-height: 1; margin-top: 2px; }
.li .lmain { flex: 1; min-width: 0; }
.li .lnm { font-weight: 650; font-size: .94rem; }
.li .lnote { font-size: .78rem; color: var(--brand-dark); font-style: italic; margin-top: 2px; }
.li .qty { display: inline-flex; align-items: center; gap: 9px; margin-top: 8px; }
.li .qb { width: 27px; height: 27px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; display: grid; place-items: center; }
.li .qb:hover { border-color: var(--brand); color: var(--brand); }
.li .qv { min-width: 18px; text-align: center; font-weight: 700; }
.li .qx { font-size: .76rem; color: var(--ink-mut); margin-left: 4px; }
.li .lright { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.li .lp { font-weight: 700; }
.li .ldel { width: 28px; height: 28px; border-radius: 8px; color: var(--ink-mut); display: grid; place-items: center; }
.li .ldel:hover { background: var(--bad-soft); color: var(--bad); }

.bill-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; color: var(--ink-mut); padding: 40px; }
.bill-empty .be { font-size: 2.6rem; opacity: .5; }
.bill-empty .bh { font-weight: 700; color: var(--ink); }

.totals { padding: 14px 20px; border-top: 1px solid var(--line); background: var(--muted-surf); }
.totals .tr { display: flex; justify-content: space-between; font-size: .9rem; color: var(--ink-mut); padding: 3px 0; }
.totals .tr.grand { font-size: 1.3rem; font-weight: 800; color: var(--ink); margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--line); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.actions .pay { grid-column: 1 / -1; }

/* ---------- Modal ---------- */
.scrim { position: fixed; inset: 0; z-index: 100; background: rgba(31,25,20,.5); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--surface); border-radius: 22px; box-shadow: var(--sh-lg); width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; animation: rise .24s var(--ease); }
@keyframes rise { from { transform: translateY(14px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal.lg { max-width: 720px; }
.modal-h { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-h h3 { font-size: 1.12rem; font-weight: 780; letter-spacing: -0.02em; }
.modal-h .sub { font-size: .82rem; color: var(--ink-mut); margin-top: 2px; }
.modal-b { padding: 22px; overflow-y: auto; }
.modal-f { padding: 16px 22px; border-top: 1px solid var(--line); background: var(--muted-surf); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Cobro ---------- */
.sum3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-bottom: 18px; }
.sbox { background: var(--muted-surf); border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 15px; }
.sbox .l { font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-mut); }
.sbox .v { font-size: 1.55rem; font-weight: 800; margin-top: 3px; }
.sbox.saldo { background: var(--warn-soft); border-color: rgba(255,165,50,.4); } .sbox.saldo .v { color: #B97A14; }
.sbox.saldo.zero { background: var(--ok-soft); border-color: rgba(47,158,115,.4); } .sbox.saldo.zero .v { color: var(--ok); }
.sbox.vuelto .v { color: var(--brand-dark); }

.seg { display: flex; gap: 5px; padding: 5px; background: var(--muted-surf); border-radius: 13px; margin-bottom: 16px; }
.seg button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 11px 6px; border-radius: 9px; font-size: .86rem; font-weight: 700; color: var(--ink-mut); transition: all .2s; }
.seg button .ic { font-size: 1.15rem; line-height: 1; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--sh-sm); }
.seg button.on.mqr { color: var(--brand-dark); }

.qrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 9px; margin-bottom: 14px; }
.qbtn { padding: 12px 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); display: flex; flex-direction: column; align-items: center; gap: 2px; transition: all .15s; }
.qbtn:hover { border-color: var(--brand); background: var(--brand-soft); }
.qbtn .ql { font-size: .72rem; font-weight: 600; color: var(--ink-mut); }
.qbtn .qa { font-size: 1rem; font-weight: 750; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .8rem; font-weight: 650; color: var(--ink-mut); }
.field input, .field select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); font-size: .95rem; color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.field input.err { border-color: var(--bad); }
.addrow { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; background: var(--muted-surf); padding: 13px; border-radius: 13px; }
.addrow.three { grid-template-columns: 1fr 1fr 1fr auto; }
.addrow .btn { height: 44px; }

.ptable { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: .88rem; }
.ptable th { text-align: left; padding: 8px 6px; font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-mut); border-bottom: 1px solid var(--line); }
.ptable td { padding: 11px 6px; border-bottom: 1px solid var(--line); }
.ptable .r { text-align: right; }
.ptable .meth { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 100px; background: var(--muted-surf); font-size: .78rem; font-weight: 700; }
.ptable .xb { color: var(--ink-mut); padding: 4px; } .ptable .xb:hover { color: var(--bad); }
.empty-pay { text-align: center; padding: 18px; color: var(--ink-mut); font-size: .88rem; background: var(--muted-surf); border-radius: 11px; margin-top: 12px; }

.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fgrid .full { grid-column: 1 / -1; }

.choice { display: flex; gap: 10px; }
.choice button { flex: 1; text-align: left; padding: 13px 15px; border-radius: 13px; border: 1.5px solid var(--line); background: var(--surface); transition: all .2s; }
.choice button .ct { font-weight: 700; font-size: .92rem; }
.choice button .cs { font-size: .78rem; color: var(--ink-mut); margin-top: 2px; }
.choice button.on { border-color: var(--brand); background: var(--brand-soft); }
.choice button.on .cs { color: var(--brand-dark); }

/* ---------- MesitaQR live panel ---------- */
.mqr { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 4px 0 2px; }
.mqr-card {
  width: 100%; border-radius: 20px; padding: 22px; background: var(--brand-soft);
  border: 1px solid rgba(0,157,255,.25); display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.mqr-brand { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 700; color: var(--brand-dark); }
.qr {
  width: 188px; height: 188px; background: #fff; border-radius: 16px; padding: 14px;
  box-shadow: var(--sh-md); position: relative;
}
.qr svg { width: 100%; height: 100%; display: block; }
.qr .qr-scan { position: absolute; left: 16px; right: 16px; height: 3px; border-radius: 4px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  box-shadow: 0 0 12px 2px rgba(0,157,255,.55); animation: qscan 2.4s var(--ease) infinite; }
@keyframes qscan { 0%,100% { top: 18px; } 50% { top: 158px; } }
.mqr-status { display: inline-flex; align-items: center; gap: 9px; padding: 8px 15px; border-radius: 100px; background: var(--surface); font-size: .86rem; font-weight: 650; }
.mqr-status .sd { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: .4; } 50% { opacity: 1; } }
.mqr-status.paid { color: var(--ok); } .mqr-status.paid .sd { background: var(--ok); animation: none; }

/* table coverage meter (diners paying via Mesita) */
.cover { width: 100%; }
.cover-top { display: flex; justify-content: space-between; align-items: baseline; font-size: .82rem; margin-bottom: 8px; }
.cover-top .ck { font-weight: 700; color: var(--ink-mut); text-transform: uppercase; letter-spacing: .04em; font-size: .72rem; }
.cover-top .cv { font-weight: 750; }
.cover-bar { height: 11px; border-radius: 100px; background: var(--muted-surf); overflow: hidden; }
.cover-bar i { display: block; height: 100%; border-radius: 100px; background: var(--ok); transition: width .8s var(--ease); }
.cover-list { width: 100%; margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.cover-row { display: flex; align-items: center; gap: 11px; padding: 10px 13px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: .9rem; transition: background .3s, border-color .3s; }
.cover-row.paid { background: var(--ok-soft); border-color: rgba(47,158,115,.3); }
.cover-row .cav { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: .78rem; font-weight: 700; flex: 0 0 auto; }
.cover-row .cnm { flex: 1; font-weight: 600; text-align: left; }
.cover-row .cam { font-weight: 700; color: var(--ink-mut); }
.cover-row.paid .cam { color: var(--ok); }
.cover-row .cst { font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: 100px; }
.cover-row .cst.w { background: var(--warn-soft); color: #B97A14; }
.cover-row .cst.k { background: var(--ok-soft); color: var(--ok); }

/* ---------- Success ---------- */
.success { text-align: center; padding: 14px 0; }
.ok-ring { width: 78px; height: 78px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; background: var(--ok-soft); animation: okpop .55s var(--ease) both; }
.ok-ring .disc { width: 54px; height: 54px; border-radius: 50%; background: var(--ok); display: grid; place-items: center; color: #fff; }
@keyframes okpop { 0% { transform: scale(.5); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
.success h2 { font-size: 1.35rem; font-weight: 780; margin: 14px 0 4px; }
.success p { color: var(--ink-mut); }
.success .chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.success .chip { font-size: .8rem; font-weight: 650; padding: 5px 12px; border-radius: 100px; background: var(--muted-surf); }

/* ---------- History ---------- */
.hist-toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.hist-toolbar .grow { flex: 1; min-width: 220px; position: relative; }
.hist-toolbar .grow input { width: 100%; padding: 12px 14px 12px 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: .92rem; }
.hist-toolbar .grow input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.hist-toolbar .grow .si { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-mut); }
.hist-toolbar select { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: .92rem; font-weight: 600; }

.day-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 10px; }
.day-head .dt { font-size: 1.02rem; font-weight: 750; }
.day-head .dm { font-size: .82rem; color: var(--ink-mut); }
.day-head .dtot { font-size: 1.05rem; font-weight: 800; color: var(--brand-dark); }
.htable { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--sh-sm); }
.htable th { background: var(--muted-surf); padding: 12px 16px; text-align: left; font-size: .74rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-mut); }
.htable td { padding: 14px 16px; border-top: 1px solid var(--line); font-size: .92rem; }
.htable tr.lnk { cursor: pointer; } .htable tr.lnk:hover td { background: var(--muted-surf); }
.htable .r { text-align: right; }
.pill-doc { display: inline-block; padding: 2px 9px; border-radius: 100px; font-size: .72rem; font-weight: 700; background: var(--ok-soft); color: var(--ok); }
.pill-doc.PRE { background: var(--warn-soft); color: #B97A14; }
.pill-doc.mqr { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- Empty / skeleton ---------- */
.empty { text-align: center; padding: 70px 20px; color: var(--ink-mut); }
.empty .be { font-size: 2.8rem; opacity: .5; margin-bottom: 10px; }
.empty .bh { font-weight: 700; color: var(--ink); font-size: 1.05rem; }
.skel { background: linear-gradient(90deg, var(--muted-surf) 25%, #efe7dc 50%, var(--muted-surf) 75%); background-size: 200% 100%; animation: shim 1.3s linear infinite; border-radius: 10px; }
@keyframes shim { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 9px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 250px; max-width: 380px; padding: 12px 16px; border-radius: 13px; background: var(--surface); box-shadow: var(--sh-md); border-left: 4px solid var(--ink-mut); font-size: .9rem; font-weight: 550; animation: slidein .25s var(--ease); }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.ok { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--bad); }
.toast.mqr { border-left-color: var(--brand); }
.toast .te { font-size: 1.1rem; }

.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .65s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }

@media (max-width: 1000px) {
  .order-wrap { grid-template-columns: 1fr; position: static; }
  .bill { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .topnav a span { display: none; }
  .sum3 { grid-template-columns: 1fr; }
  .addrow.three { grid-template-columns: 1fr; }
  .fgrid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .08s !important; }
}

/* ---------- Print ---------- */
.print-region { display: none; }
@media print {
  .app > *:not(.print-region) { display: none !important; }
  .topbar, .toasts, .scrim { display: none !important; }
  body { background: #fff; }
  .print-region {
    display: block; color: #000;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    max-width: 320px; margin: 0 auto; padding: 8px;
  }
  @page { margin: 12mm; }
}

/* ---------- First-load boot screen ----------
   Shared by the static shell inside #root (index.html / pos-v2.html — paints
   before ANY JavaScript) and AuthGate's loading state, so the handoff from
   "HTML shell" → "React loader" is pixel-identical and nothing flashes. */
.pos-boot {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  background: var(--bg);
  color: var(--ink-mut);
  font-family: Inter, system-ui, sans-serif;
  text-align: center;
}
.pos-boot-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 157, 255, 0.22);
  animation: posBootBreathe 1.8s ease-in-out infinite;
}
.pos-boot-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.pos-boot-name small {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mut);
}
.pos-boot-bar {
  position: relative;
  width: 128px;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.pos-boot-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--ok));
  animation: posBootSlide 1.15s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
.pos-boot-msg {
  font-size: 13px;
  font-weight: 500;
  min-height: 18px; /* both boot messages share one line — no layout shift */
}
@keyframes posBootBreathe {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.92; }
}
@keyframes posBootSlide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(290%); }
}
@media (prefers-reduced-motion: reduce) {
  .pos-boot-logo, .pos-boot-bar::before { animation: none !important; }
}
