/* Sistema de diseño neutro de la plataforma. La marca del restaurante (colores, tipografía,
   logo) llega desde el tenant como variables (--accent, --brand-2, --brand-dark, --font-display)
   y la clase .branded; nada de la marca Bogo está fijo aquí. */

:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #ececea;
  --ink: #16181d;
  --ink-2: #4a4f59;
  --ink-3: #737885;
  --line: #d9d9d5;
  --accent: #2f6fde;
  --accent-ink: #ffffff;
  --ok: #1d7a46;
  --warn: #9a5b00;
  --danger: #b42318;
  --radius: 14px;
  --tap: 56px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font);
  --brand-2: var(--accent);
  --brand-dark: #16181d;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1a1d23;
    --surface-2: #23272f;
    --ink: #f1f2f4;
    --ink-2: #b9bdc6;
    --ink-3: #8d929d;
    --line: #2f343d;
    --ok: #4cc283;
    --warn: #e0a23b;
    --danger: #f2766b;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.boot { padding: 48px; text-align: center; color: var(--ink-3); }

/* ---------- Ingreso ---------- */

.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
}
.login-card h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.01em; }
.login-card .sub { margin: 0 0 24px; color: var(--ink-2); }
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.staff-btn {
  min-height: 84px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 12px;
  text-align: left;
  display: flex; flex-direction: column; justify-content: space-between;
}
.staff-btn strong { font-size: 17px; }
.staff-btn span { color: var(--ink-3); font-size: 14px; }
.staff-btn:active { transform: scale(0.98); }

.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 8px 0 22px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-3); }
.pin-dots i.on { background: var(--ink); border-color: var(--ink); }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pinpad button {
  height: 68px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: 26px; font-weight: 600;
}
.pinpad button:active { background: var(--line); }
.pinpad .muted { font-size: 16px; font-weight: 500; color: var(--ink-2); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 14px; color: var(--ink-2); }
.field input {
  height: var(--tap); padding: 0 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.field small { color: var(--ink-3); }
.btn {
  height: var(--tap); padding: 0 22px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); font-weight: 600;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }
.link { background: none; border: 0; color: var(--ink-2); text-decoration: underline; padding: 12px 0; }
.error { color: var(--danger); min-height: 22px; margin: 10px 0 0; font-weight: 500; }

/* ---------- Aplicación ---------- */

.shell { min-height: 100%; display: grid; grid-template-rows: auto auto 1fr; }
.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand::before { content: ""; width: 12px; height: 12px; border-radius: 4px; background: var(--accent); }
.meta { color: var(--ink-2); font-size: 14px; }
.spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); font-size: 14px; font-weight: 600;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.chip.ok .dot { background: var(--ok); }
.chip.warn { color: var(--warn); }
.chip.warn .dot { background: var(--warn); }
.chip.danger { color: var(--danger); }
.chip.danger .dot { background: var(--danger); }
.user { font-size: 14px; color: var(--ink-2); }
.user strong { color: var(--ink); }

.tabs {
  display: flex; gap: 4px; padding: 8px 12px 0; background: var(--surface);
  border-bottom: 1px solid var(--line); overflow-x: auto;
}
.tabs button {
  min-height: 48px; padding: 0 18px; border: 0; background: none;
  border-bottom: 3px solid transparent; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

main { padding: 20px 16px 40px; max-width: 1100px; width: 100%; margin: 0 auto; }
h2 { margin: 0 0 4px; font-size: 22px; }
.lead { margin: 0 0 18px; color: var(--ink-2); }
.notice {
  border: 1px solid var(--line); border-left: 4px solid var(--warn);
  background: var(--surface); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px;
}

/* Mesas */
.floor {
  display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 12px;
  max-width: 720px;
}
.table-card {
  aspect-ratio: 4 / 3; border-radius: 18px; border: 1px solid var(--line);
  background: var(--surface); padding: 14px; text-align: left;
  display: flex; flex-direction: column; justify-content: space-between;
}
.table-card .num { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.table-card .seats { color: var(--ink-3); font-size: 14px; }
.table-card .state { font-weight: 600; font-size: 14px; color: var(--ok); }
.floor .gap { border: 1px dashed var(--line); border-radius: 18px; }

/* Menú */
.cat-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.cat-tabs button {
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600;
}
.cat-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.product {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.product h3 { margin: 0; font-size: 17px; display: flex; gap: 8px; align-items: baseline; }
.product .code { font: 12px/1 ui-monospace, monospace; color: var(--ink-3); }
.product p { margin: 0; color: var(--ink-2); font-size: 14px; }
.tag { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); }
.variant { display: flex; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 15px; }
.variant .price { text-align: right; font-variant-numeric: tabular-nums; }
.variant .price b { display: block; }
.variant .price small { color: var(--ink-3); }
.note { color: var(--ink-3); font-size: 13px; }

/* Tablas de datos */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row .field { flex: 1; min-width: 200px; margin: 0; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
table.data th { color: var(--ink-3); font-weight: 600; }
table.data td.num { font-variant-numeric: tabular-nums; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px;
  font-weight: 600; max-width: calc(100% - 32px);
}

@media (max-width: 560px) {
  .floor { gap: 8px; }
  .table-card { padding: 10px; border-radius: 14px; }
  .table-card .num { font-size: 21px; white-space: nowrap; }
}

/* Configuración inicial y personal */
.steps { margin: 0 0 20px; padding-left: 20px; color: var(--ink-2); display: grid; gap: 8px; }
select { height: var(--tap); padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font: inherit; color: inherit; }
.panel-title { margin: 0 0 12px; font-size: 17px; }
.staff-list { padding: 4px 18px; }
.staff-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.staff-row:last-child { border-bottom: 0; }
.staff-row.inactive strong { color: var(--ink-3); text-decoration: line-through; }
.staff-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn.small { height: 44px; padding: 0 14px; font-size: 15px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-width: 0; width: 180px; }
.error.inline { margin: 0; min-height: 0; font-size: 14px; }

/* ---------- Punto de venta ---------- */
main.wide { max-width: 1400px; }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.view-head .lead { margin: 0; }
.row.center { align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.empty { color: var(--ink-3); padding: 16px 0; margin: 0; }
.muted { color: var(--ink-3); font-weight: 500; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--warn); color: #fff; }
.tag.ok { color: var(--ok); background: transparent; border: 1px solid currentColor; }
.tag.warn { color: var(--warn); background: transparent; border: 1px solid currentColor; }
.btn.danger { color: var(--danger); }
.btn.big { height: 64px; font-size: 18px; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.link.small { font-size: 13px; padding: 0; }
.icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 18px; }

/* Mesas con estado */
.table-card { position: relative; }
.table-card .tinfo { display: flex; flex-direction: column; gap: 2px; }
.table-card .tamt { font-size: 17px; font-variant-numeric: tabular-nums; }
.table-card .badge { position: absolute; top: 10px; right: 10px; }
.table-card.st-abierto { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.table-card.st-abierto .state { color: var(--accent); }
.table-card.st-por_cobrar { border-color: var(--warn); box-shadow: inset 0 0 0 2px var(--warn); }
.table-card.st-por_cobrar .state { color: var(--warn); }

/* Lista de pedidos */
.order-list { display: grid; gap: 8px; }
.order-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; min-height: 64px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.order-row .o-num { font-weight: 800; font-size: 18px; min-width: 44px; color: var(--ink-2); }
.order-row .o-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.order-row .o-main .note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-row .o-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.order-row.st-por_cobrar { border-left: 5px solid var(--warn); }
.order-row.st-en_camino { border-left: 5px solid var(--accent); }
.order-row.st-anulado { border-left: 5px solid var(--danger); }

/* Pantalla del pedido */
.order-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.order-head .oh-title { flex: 1; min-width: 200px; }
.order-head h2 { margin: 0; }
.order-head p { margin: 2px 0 0; }
.order-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(340px, 1fr); gap: 16px; align-items: start; }
.order-layout > :only-child { grid-column: 1 / -1; max-width: 640px; }
.picker { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.picker .search, main > input.search { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); margin-bottom: 12px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pick { min-height: 78px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 10px; text-align: left; display: flex; flex-direction: column; justify-content: space-between; gap: 4px; }
.pick strong { font-size: 15px; }
.pick-price { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pick:active { transform: scale(0.98); background: var(--line); }
.ticket { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; position: sticky; top: 12px; }
.lines { list-style: none; margin: 0; padding: 0; }
.lines li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.lines li.pending { background: color-mix(in srgb, var(--warn) 6%, transparent); margin: 0 -14px; padding: 10px 14px; }
.lines li.voided { color: var(--ink-3); text-decoration: line-through; font-size: 14px; }
.l-main { display: flex; gap: 8px; align-items: baseline; }
.l-qty { font-weight: 800; min-width: 28px; }
.l-name { flex: 1; }
.l-note { display: block; font-size: 13px; color: var(--warn); font-weight: 600; }
.l-amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.l-actions { display: flex; gap: 6px; align-items: center; margin: 6px 0 0 36px; flex-wrap: wrap; }
.totals { margin: 12px 0 0; }
.trow { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 15px; }
.trow dt, .trow dd { margin: 0; }
.trow dd { font-variant-numeric: tabular-nums; white-space: nowrap; }
.trow.grand { font-weight: 800; font-size: 18px; border-top: 1px solid var(--line); padding-top: 8px; }
.trow.grand.ves { border-top: 0; padding-top: 0; font-size: 22px; }
.pays { list-style: none; padding: 0; margin: 10px 0 0; font-size: 14px; }
.pays li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--line); }
.pays li span { flex: 1; }
.pays li.reversed { text-decoration: line-through; color: var(--ink-3); }
.balance { font-size: 16px; margin: 10px 0 0; }
.actions { display: grid; gap: 8px; margin-top: 14px; }
.actions-more { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.actions-more .btn { height: 48px; flex: 1 1 auto; }

/* Diálogos */
.modal { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100% - 24px)); max-height: calc(100% - 24px); background: var(--surface); color: var(--ink); }
.modal::backdrop { background: rgb(0 0 0 / 0.5); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 0; }
.modal-head h3 { margin: 0; font-size: 20px; }
.modal-body { padding: 14px 18px 18px; }
.modal textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font: inherit; color: inherit; }
.modal .field input, .modal .field select { width: 100%; }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice .btn { height: 52px; }
.methods .btn { flex: 1 1 40%; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper .btn { width: 52px; padding: 0; font-size: 22px; }
.step-val { min-width: 36px; text-align: center; font-size: 22px; font-weight: 800; }
.pay-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.pay-summary > div { background: var(--surface-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; }
.pay-summary strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.pay-summary .due { background: var(--ink); color: var(--bg); }
.pay-summary .due .note { color: inherit; opacity: 0.8; }
.change { font-weight: 700; color: var(--ok); min-height: 22px; }
.change.big { font-size: 28px; text-align: center; margin: 12px 0 20px; }

/* Comandas */
.switch { display: flex; gap: 14px; align-items: flex-start; cursor: pointer; }
.switch input { width: 26px; height: 26px; margin-top: 2px; }

/* Reporte */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.tile strong { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 0 16px; }
table.data tfoot th { color: var(--ink); font-weight: 800; border-top: 2px solid var(--line); }
table.data th.num, table.data td.num { text-align: right; }
input[type="date"] { height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: inherit; font: inherit; }

@media (max-width: 900px) {
  .order-layout { grid-template-columns: 1fr; }
  .ticket { position: static; }
  .report-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .pick-grid { grid-template-columns: repeat(2, 1fr); }
  .pay-summary strong { font-size: 15px; }
  .table-card .badge { display: none; }
}

a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: inherit; }

#offline-bar { position: sticky; top: 0; z-index: 50; background: var(--warn); color: #fff; padding: 10px 16px; font-weight: 700; text-align: center; }

/* v5: agotados, división de cuenta, caja, editor de menú, sin conexión */
.pick.sold-out { opacity: 0.45; cursor: not-allowed; }
.split-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 12px; }
.split-items { display: grid; gap: 8px; margin: 8px 0; max-height: 50vh; overflow: auto; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; }
.check input { width: 22px; height: 22px; }
.tables-choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.inactive { opacity: 0.55; }
.ok-text { color: var(--ok); font-weight: 600; }
.warn-text { color: var(--warn); font-weight: 600; }
.panel.narrow { max-width: 420px; }
.editor-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.product.editor .row { gap: 6px; flex-wrap: wrap; }
.lines li.queued { border-left: 4px solid var(--warn); }
@media (max-width: 520px) { .editor-list { grid-template-columns: 1fr; } }
.panel { overflow-x: auto; }
#main { min-width: 0; }
@media (max-width: 520px) { .panel table.data th, .panel table.data td { padding: 8px 5px; } }

/* ---------- Marca del restaurante ---------- */
h1, h2, h3, .panel-title, .login-card h1, .tile strong, .table-card .num, .pay-summary strong {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0;
}
.brand-logo { display: block; height: 64px; width: auto; margin: 0 auto 18px; }
.login-card { text-align: left; }
.login-title { font-size: 22px; }
.brand.has-logo::before { display: none; }
.brand.has-logo img { height: 36px; width: auto; display: block; }
.branded .topbar { background: var(--brand-dark); border-bottom: 4px solid var(--accent); color: #fff; }
.branded .topbar .meta, .branded .topbar .user { color: rgba(255, 255, 255, 0.78); }
.branded .topbar .user strong { color: #fff; }
.branded .topbar .btn { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.branded .topbar .chip { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.25); color: #fff; }
.branded .topbar .chip.warn, .branded .topbar .chip.danger { background: #fff; }
.branded h2 { color: var(--brand-dark); }
.branded .login { background: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--accent) 18%, var(--bg)), var(--bg)); }
.branded .tile strong { color: var(--brand-dark); }
@media (prefers-color-scheme: dark) {
  .branded h2, .branded .tile strong { color: var(--ink); }
}

/* ---------- Inventario y costos ---------- */
.inv-table td { vertical-align: middle; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.purchase-lines { display: grid; gap: 10px; margin: 8px 0; }
.purchase-line { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: grid; gap: 8px; }
.purchase-line .row { flex-wrap: nowrap; gap: 8px; }
.purchase-line select, .purchase-line input { min-width: 0; }
.purchase-line input[inputmode="decimal"] { width: 7.5em; flex: 0 0 auto; }
.purchase-line > select, .purchase-line .row > select:first-child { flex: 1 1 auto; }
.line-cost { min-width: 4.5em; text-align: right; }
.recipe-total { font-weight: 700; margin: 8px 0; }
.recipe-lines { margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); }
.options-row td { background: var(--surface-2); }
.options-row .btn { margin: 2px 4px 2px 0; }
.btn.warn-outline { border-color: var(--warn); color: var(--warn); }
.tip-row dt, .tip-row dd { color: var(--ink-2); font-size: 14px; }
.tip-choice { margin-bottom: 6px; }
.scroll-x { overflow-x: auto; max-height: 60vh; }
@media (max-width: 520px) {
  .purchase-line .row { flex-wrap: wrap; }
  .purchase-line input[inputmode="decimal"] { width: 6.5em; }
}
.cost-table { table-layout: fixed; }
.cost-table th:nth-child(1) { width: 44%; }
.cost-table th:nth-child(6) { width: 140px; }
@media (max-width: 720px) { .cost-table { table-layout: auto; } }
.other-methods { margin: 8px 0 14px; }
.other-methods summary { cursor: pointer; color: var(--ink-2); min-height: 40px; display: flex; align-items: center; }
.inv-mode { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.inv-mode.off { border-left: 5px solid var(--warn); }
.inv-mode.on { border-left: 5px solid var(--ok); }

/* ---------- v8: secciones, panel, clientes, pedido rápido ---------- */
.tiles.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tiles.compact .tile strong { font-size: 20px; }
.buckets { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-bottom: 16px; }
.bucket .note { margin: 0 0 8px; }
.tile.goal .meter { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 6px 0; }
.tile.goal .meter span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.delta { font-weight: 700; margin-left: 4px; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.alerts { display: grid; gap: 8px; margin-bottom: 14px; }
.alert { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.alert.warn { border-left: 5px solid var(--warn); }
.alert.info { border-left: 5px solid var(--accent); }
.alert .link { margin-left: auto; }
.hbars { display: grid; gap: 6px; margin: 6px 0 10px; }
.hbar { display: grid; grid-template-columns: minmax(70px, 30%) 1fr auto; gap: 10px; align-items: center; min-height: 28px; }
.hbar-label { font-size: 14px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 14px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.hbar-value { font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 600; }
.panel-title.spaced { margin-top: 18px; }
.first-steps .steps-list { margin: 6px 0; padding-left: 20px; display: grid; gap: 6px; }
.first-steps li.done { color: var(--ok); }
.first-steps li { display: flex; gap: 10px; align-items: center; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--surface-2); }
.help ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.customer-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-chip.missing { border-color: var(--warn); color: var(--warn); }
.customer-info { min-height: 1.2em; margin: 0 0 8px; }
.customer-optional { margin: 8px 0 14px; }
.customer-optional summary { cursor: pointer; color: var(--ink-2); min-height: 40px; display: flex; align-items: center; }
.pay-customer { margin-bottom: 12px; border-left: 5px solid var(--warn); }
.quick-amounts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick-amounts:empty { display: none; }
.pick.quick-pick { display: flex; flex-direction: column; align-items: stretch; gap: 8px; text-align: left; cursor: default; }
.pick-name { background: none; border: 0; padding: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.pick-variants { display: flex; flex-wrap: wrap; gap: 6px; }
.pick-variants .btn { flex: 1 1 auto; min-height: 44px; }
.small-check { font-size: 13px; min-height: 32px; padding: 2px 6px; border: 0; }
@media (max-width: 520px) { .hbar { grid-template-columns: 90px 1fr auto; } }
main > input.search { background: var(--surface); max-width: 520px; display: block; font: inherit; }

/* ---------- v9: barra de navegación en dos niveles ---------- */
/* Nivel 1 (secciones): bloques grandes tipo «segmento». Nivel 2 (pestañas): píldoras sobre una franja
   teñida del color de la sección, con la activa rellena. Así se distingue de un vistazo dónde estás. */
.navbar { min-width: 0; max-width: 100vw; --sec: var(--accent); background: var(--surface); border-bottom: 1px solid var(--line); }
.navbar.sec-gestion { --sec: var(--brand-2); }
.navbar.sec-ajustes { --sec: var(--ink-3); }
.groups { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; }
.groups button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: 12px; border: 2px solid var(--line); background: var(--surface-2);
  font: 700 16px/1 var(--font-display); color: var(--ink-2); white-space: nowrap; cursor: pointer;
}
.groups button:hover { border-color: var(--ink-3); color: var(--ink); }
.groups button[aria-pressed="true"] { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; box-shadow: inset 0 -4px 0 var(--sec); }
.groups .g-icon { font-size: 18px; }
.tabs {
  display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; border-bottom: 0;
  background: color-mix(in srgb, var(--sec) 10%, var(--surface));
  border-top: 1px solid color-mix(in srgb, var(--sec) 30%, var(--line));
}
.tabs button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px;
  border-radius: 999px; border: 1px solid transparent; border-bottom: 1px solid transparent; background: transparent;
  font-weight: 600; color: var(--ink-2); white-space: nowrap; cursor: pointer;
}
.tabs button:hover { background: color-mix(in srgb, var(--sec) 14%, transparent); color: var(--ink); }
.tabs button[aria-selected="true"] { background: var(--sec); border-color: var(--sec); color: #fff; font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
.navbar.sec-ajustes .tabs button[aria-selected="true"] { background: var(--ink-2); border-color: var(--ink-2); color: var(--surface); }
.tabs .t-icon { font-size: 16px; line-height: 1; }
@media (prefers-color-scheme: dark) {
  .groups button { background: var(--bg); }
  .groups button[aria-pressed="true"] { background: var(--sec); border-color: var(--sec); color: #fff; box-shadow: none; }
  .navbar.sec-ajustes .groups button[aria-pressed="true"] { background: var(--ink-2); border-color: var(--ink-2); color: var(--bg); }
  .tabs { background: color-mix(in srgb, var(--sec) 14%, var(--surface)); }
  .tabs button { color: var(--ink); }
}
@media (max-width: 560px) {
  .groups { gap: 6px; padding: 8px; }
  .groups button { flex: 1 1 0; justify-content: center; padding: 0 8px; font-size: 14px; }
  .tabs button { padding: 0 12px; }
}

/* ---------- v9: cobro (propina y bancos) ---------- */
.tip-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 6px; }
.tip-card {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left;
  padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit;
}
.tip-card strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.tip-card .t-title { font-weight: 700; color: var(--ink-2); font-size: 14px; }
.tip-card .note { font-size: 13px; }
.tip-card[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.tip-other { margin: 0 0 10px; }
.choice.banks { margin-top: 8px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); align-items: center; }
.choice.banks .lbl { font-size: 14px; color: var(--ink-2); margin-right: 4px; }
@media (max-width: 460px) { .tip-cards { grid-template-columns: 1fr; } }

/* ---------- v9: para llevar y pedidos por confirmar ---------- */
.takeout-lane { margin-top: 18px; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.lane-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.lane-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.lane-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 14px; }
.takeout-card {
  display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 12px; min-height: 110px;
  border-radius: 14px; border: 1px solid var(--line); border-left: 6px solid var(--ok); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer;
}
.takeout-card.quote { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 7%, var(--surface)); }
.takeout-card.st-en_camino { border-left-color: var(--accent); }
.takeout-card .tc-top, .takeout-card .tc-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.takeout-card .tc-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.takeout-card .tc-foot { margin-top: auto; }
.section-title { margin: 6px 0 10px; font-size: 17px; }
.quote-box { border: 1px solid var(--line); border-left: 5px solid var(--warn); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; justify-items: start; background: color-mix(in srgb, var(--warn) 6%, var(--surface)); }
.quote-box p { margin: 0; }
.kitchen-note { width: 100%; }
.copy-box { width: 100%; font: 14px/1.4 ui-monospace, monospace; }
label.check { display: flex; gap: 8px; align-items: center; min-height: 44px; cursor: pointer; }
.checks { display: grid; gap: 2px; }
.quotes-panel { border-left: 5px solid var(--warn); }
.quotes-panel h3 { margin: 0; }
.quote-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.quote-list li { display: grid; grid-template-columns: auto 1fr auto auto auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.quote-list li.late { box-shadow: inset 4px 0 0 var(--danger); }
@media (max-width: 560px) { .quote-list li { grid-template-columns: 1fr auto; } }

/* ---------- v9: adicionales en el pedido ---------- */
.extras-hint { display: block; font-size: 12px; color: var(--accent); font-weight: 700; margin-top: 2px; }
.addon-group label .note { font-weight: 400; margin-left: 4px; }
.pick-total-row { font-size: 18px; margin: 4px 0 10px; }
.cat-tabs .addons-tab { border-style: dashed; }
.tip-cards > .link { grid-column: 1 / -1; justify-self: start; min-height: 36px; }
.order-list > * { min-width: 0; }
@media (max-width: 560px) { .order-row { flex-wrap: wrap; } .order-row .o-main { flex-basis: 60%; } }
.table-card .tname { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.order-row .o-where { font-weight: 500; color: var(--ink-2); }
.paid-box { border-left-color: var(--ok); background: color-mix(in srgb, var(--ok) 7%, var(--surface)); margin-bottom: 10px; }
.takeout-card.st-cerrado { border-left-color: var(--ok); }
.kind-tag { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; margin-right: 6px; vertical-align: 2px; }
.pick-subgroup { grid-column: 1 / -1; margin: 10px 0 0; font-size: 15px; padding-bottom: 4px; border-bottom: 2px solid color-mix(in srgb, var(--accent) 40%, var(--line)); }
.pick-subgroup:first-child { margin-top: 0; }

/* ---------- v12: pedido sin recargar ---------- */
@keyframes just-added { from { background: color-mix(in srgb, var(--accent) 28%, var(--surface)); } to { background: transparent; } }
.lines li.just-added { animation: just-added 1.6s ease-out; }
.order-summary-bar { display: none; }
@media (max-width: 900px) {
  .order-summary-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; bottom: 0; z-index: 5; margin: 10px -16px -40px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--brand-dark); color: #fff; font-weight: 600; box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.18);
  }
  .order-summary-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- v13/v14: aviso de producto agregado dentro de la barra, con «Deshacer» ---------- */
#toast { z-index: 50; }
body:has(.order-summary-bar) #toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
@media (min-width: 901px) { body:has(.order-summary-bar) #toast { bottom: 24px; } }
.order-summary-bar .sb-msg, .order-summary-bar .sb-undo { display: none; }
.order-summary-bar.flash { background: var(--accent); color: #fff; }
.order-summary-bar.flash .sb-normal { display: none; }
.order-summary-bar.flash .sb-msg { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.order-summary-bar.flash .sb-undo:not([hidden]) { display: inline-flex; background: #fff; color: var(--brand-dark); border-color: #fff; }
.open-customer { margin: 8px 0 14px; }
.km-input { max-width: 9em; font-size: 20px; }
.delivery-quote { border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: 12px; padding: 10px 12px; margin: 6px 0 10px; display: grid; gap: 4px; min-height: 52px; }
.delivery-quote .dq-main { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.delivery-quote .dq-main strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.dup-warning { color: var(--warn); font-weight: 600; }
.bank-group { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 8px 0; }
.bank-group summary { display: flex; align-items: center; gap: 6px; cursor: pointer; min-height: 40px; }
.bank-group tr.reversed td { color: var(--ink-3); }
.backup-panel { margin-bottom: 14px; }
.tiers input { max-width: 7em; }

/* ---------- v15 · Análisis y gráficos ---------- */
:root { --chart-cur: #E86A12; --chart-prev: #8A1E5A; }
@media (prefers-color-scheme: dark) { :root { --chart-cur: #E0661A; --chart-prev: #C46A9E; } }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filters .range input { min-height: 40px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; }
.tiles.kpis { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.tiles.kpis .tile strong { font-size: 20px; }
.cat-note { font-size: 12px; }
.kpi-foot { font-size: 13px; }
.kpi .delta { margin-left: 0; }
.chart { display: flex; flex-direction: column; gap: 6px; }
.chart-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 13px; color: var(--ink-2); }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.sw.cur { background: var(--chart-cur); }
.sw.prev { height: 3px; background: var(--chart-prev); border-radius: 2px; }
.sw.ref { height: 0; border-top: 2px dashed var(--ink-3); border-radius: 0; }
.colchart { width: 100%; max-width: 100%; height: auto; display: block; overflow: visible; }
.colchart .grid { stroke: var(--line); stroke-width: 1; }
.colchart .axis { stroke: var(--ink-3); stroke-width: 1; }
.colchart .bar { fill: var(--chart-cur); }
.colchart .prev { stroke: var(--chart-prev); stroke-width: 3; stroke-linecap: round; }
.colchart .ref { stroke: var(--ink-3); stroke-width: 2; stroke-dasharray: 6 5; }
.colchart .reflab { fill: var(--ink-2); font-size: 12px; }
.colchart .ylab { fill: var(--ink-2); font-size: 11px; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.colchart .xlab { fill: var(--ink-3); font-size: 11px; }
.colchart .hit { fill: transparent; }
.colchart .col:hover .hit, .colchart .col:focus .hit { fill: color-mix(in srgb, var(--ink) 6%, transparent); }
.colchart .col:focus { outline: none; }
.chart-table { margin-top: 6px; }
.chart-tip { position: fixed; z-index: 1000; pointer-events: none; background: var(--ink); color: var(--bg); padding: 8px 10px; border-radius: 8px; font-size: 13px; line-height: 1.35; max-width: 260px; box-shadow: 0 4px 16px rgb(0 0 0 / .2); }
.heat { display: grid; grid-template-columns: 38px repeat(var(--cols), minmax(26px, 1fr)); gap: 2px; overflow-x: auto; font-size: 11px; }
.heat .hh { color: var(--ink-3); text-align: center; padding-bottom: 2px; white-space: nowrap; }
.heat .hd { color: var(--ink-2); display: flex; align-items: center; font-weight: 600; }
.heat .hc { min-height: 28px; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--chart-cur) var(--lv), var(--surface-2)); color: var(--ink); }
.heat .hc.hi { color: #fff; }
.heat .hc.empty { background: var(--surface-2); }
.heat-scale { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.heat-scale .ramp { width: 120px; height: 10px; border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--chart-cur) 12%, var(--surface-2)), var(--chart-cur)); }
.share { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; min-width: 110px; }
.share-bar { display: inline-block; height: 8px; border-radius: 0 4px 4px 0; background: var(--chart-cur); max-width: 60px; }
.unsold summary { cursor: pointer; font-weight: 600; margin-top: 8px; }

/* ---------- v16 · Semana a semana, cobro, mesoneros, mesa especial ---------- */
.week-months { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.week-month { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--surface); }
.wm-title { text-transform: capitalize; }
.linechart { width: 100%; height: auto; display: block; overflow: visible; }
.linechart .grid { stroke: var(--line); stroke-width: 1; }
.linechart .axis { stroke: var(--ink-3); stroke-width: 1; }
.linechart .ylab, .linechart .xlab { fill: var(--ink-3); font-size: 11px; }
.linechart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.linechart .dot { stroke: var(--surface); stroke-width: 2; }
.linechart .ln.s-weekday { stroke: var(--chart-cur); }
.linechart .ln.s-weekend { stroke: var(--chart-prev); stroke-dasharray: 6 4; }
.linechart .dot.s-weekday { fill: var(--chart-cur); }
.linechart .dot.s-weekend { fill: var(--chart-prev); }
.linechart .hit { fill: transparent; }
.linechart .col:hover .hit, .linechart .col:focus .hit { fill: color-mix(in srgb, var(--ink) 6%, transparent); }
.linechart .col:focus { outline: none; }
.sw.ln-weekday { height: 3px; background: var(--chart-cur); border-radius: 2px; width: 18px; }
.sw.ln-weekend { height: 0; width: 18px; border-top: 3px dashed var(--chart-prev); border-radius: 0; }
.row.wrap { flex-wrap: wrap; }

.waiter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -4px 0 12px; }
.waiters { display: flex; gap: 6px; flex-wrap: wrap; }
.waiters button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.pay-step1 { display: flex; flex-direction: column; gap: 10px; }
.bill-head { display: flex; flex-direction: column; }
.bill-head strong { font-size: 20px; }
.bill-lines { list-style: none; margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; max-height: 190px; overflow: auto; font-size: 14px; }
.bill-lines li { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.tip-title { margin: 4px 0 0; font-size: 15px; }
.tip-card.other strong { font-size: 15px; }
.tip-other { border: 1px dashed var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.pct-input { width: 70px; }
.small-seg button { min-height: 34px; padding: 0 12px; }
.to-pay { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 2px solid var(--accent); }
.to-pay-ves { font-size: 32px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.to-pay-usd { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.to-pay-break { font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.pay-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface)); margin-bottom: 10px; }
.pay-head strong { font-size: 18px; }
.btn.grow { flex: 1; }

.table-card.st-evento { border-style: dashed; border-color: var(--brand-2); background: color-mix(in srgb, var(--brand-2) 8%, var(--surface)); }
.table-card.st-evento .state { color: var(--brand-2); font-weight: 700; }
.events-lane { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.event-card { border: 2px dashed var(--brand-2); border-radius: var(--radius); padding: 12px; background: var(--surface); }
.order-row.drinks-only { opacity: .7; }
