/* ============================================================
   PARRILLA TANO CHEICO — estilos
   ============================================================ */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #1d2129;
  --text-muted: #667085;
  --text-soft: #98a2b3;

  --accent: #c0392b;          /* rojo brasa */
  --accent-hover: #a5281c;
  --accent-soft: #fdecea;

  --ok: #16a34a;   --ok-soft: #dcfce7;
  --warn: #d97706; --warn-soft: #fef3c7;
  --danger: #dc2626; --danger-soft: #fee2e2;
  --info: #2563eb; --info-soft: #dbeafe;

  --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --shadow-md: 0 4px 12px rgba(16,24,40,.08), 0 2px 4px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 40px rgba(16,24,40,.16);

  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 240px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
  --bg: #0f1117;
  --surface: #171a21;
  --surface-2: #1e222b;
  --border: #2a2f3a;
  --border-strong: #3a4150;
  --text: #e7e9ee;
  --text-muted: #9aa1ad;
  --text-soft: #6b7280;

  --accent: #e05a4b;
  --accent-hover: #ec7365;
  --accent-soft: #2a1613;

  --ok: #22c55e; --ok-soft: #14261b;
  --warn: #f59e0b; --warn-soft: #2a2011;
  --danger: #ef4444; --danger-soft: #2a1616;
  --info: #3b82f6; --info-soft: #10203a;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 6px 18px rgba(0,0,0,.45);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
svg.ico { width: 16px; height: 16px; flex: none; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }

/* ---------- Layout con sidebar ---------- */
#app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
#app.no-sidebar { grid-template-columns: 1fr; }

.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border); z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 16px 16px; border-bottom: 1px solid var(--border); }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; border-radius: 9px; flex: none; font-size: 18px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; overflow: hidden; }
.brand-text strong { font-size: 14px; }
.brand-text small { color: var(--text-soft); font-size: 11.5px; }

.nav { flex: 1; overflow-y: auto; padding: 10px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 12px; border: 0; background: transparent; color: var(--text-muted);
  border-radius: 10px; font-size: 15.5px; font-weight: 550; cursor: pointer; text-align: left;
  transition: background .12s, color .12s;
}
.nav-item + .nav-item { margin-top: 2px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.nav-item .ico { width: 20px; height: 20px; flex: none; }
.nav-admin-groups { display: flex; gap: 6px; margin: 0 2px 12px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.nav-admin-group { display: flex; align-items: center; justify-content: center; flex: 1; min-width: 0; padding: 9px 3px; border: 0; border-radius: 9px; background: transparent; color: var(--text-muted); font-family: var(--font-num); font-size: 12px; font-weight: 750; text-align: center; text-transform: uppercase; letter-spacing: .015em; line-height: 1.1; white-space: normal; overflow-wrap: anywhere; cursor: pointer; }
.nav-admin-group:hover { color: var(--text); }
.nav-admin-group.active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.14); }
.nav-admin-items[hidden] { display: none; }

/* Pantallas de ancho completo (Gastos): el menú lateral sale del layout y se abre como cajón con ☰ (solo escritorio; en celular ya es la barra inferior). */
#app.menu-oculto { grid-template-columns: 1fr; }
#app.menu-oculto .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 70; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
#app.menu-oculto .sidebar.open { transform: none; }
#app.menu-oculto .sidebar:not(.open) { box-shadow: none; visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; }   /* cerrado: ni se ve ni recibe el foco del teclado */
#app.menu-oculto .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 65; }
#app.menu-oculto #menu-btn { display: grid; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.ghost-line {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  border-radius: 10px; cursor: pointer; font-size: 14.5px; font-weight: 550;
}
.ghost-line:hover { color: var(--text); border-color: var(--border-strong); }
.ghost-line .ico { width: 18px; height: 18px; }
.who { padding: 6px 4px 2px; font-size: 12.5px; color: var(--text-soft); }
.who b { color: var(--text); display: block; font-size: 13.5px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 13px 22px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.crumb b { color: var(--text); font-weight: 700; font-size: 18px; display: block; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }
.view-host { padding: 22px; max-width: 1200px; width: 100%; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background .12s, border-color .12s, opacity .12s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(.5px); }
.btn .ico { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 8px 13px; font-size: 13.5px; }
.btn-sm .ico { width: 15px; height: 15px; }
.btn-lg { padding: 16px 24px; font-size: 17px; font-weight: 700; border-radius: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm);
  color: var(--text-muted); cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn .ico { width: 17px; height: 17px; }

/* ---------- Cards / grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 17px; }
.card-head .spacer { margin-left: auto; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2,1fr); }
.cols-3 { grid-template-columns: repeat(3,1fr); }
.cols-4 { grid-template-columns: repeat(4,1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Stat tiles ---------- */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 6px; }
.stat-top { display: flex; align-items: center; gap: 9px; color: var(--text-muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.stat-top .ico-wrap { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.stat-value { font-size: 26px; font-weight: 720; letter-spacing: -.02em; }
.stat-foot { font-size: 12.5px; color: var(--text-soft); }
.stat.ok .ico-wrap { background: var(--ok-soft); color: var(--ok); }
.stat.warn .ico-wrap { background: var(--warn-soft); color: var(--warn); }
.stat.info .ico-wrap { background: var(--info-soft); color: var(--info); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .name { font-weight: 600; }
.row-hidden { display: none !important; }
.clickable { cursor: pointer; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: var(--surface-2); color: var(--text-muted); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-plain::before { display: none; }

/* ---------- Forms ---------- */
input, select, textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border-strong);
  border-radius: 10px; background: var(--surface); color: var(--text);
  font-size: 16px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
textarea { resize: vertical; min-height: 60px; }
label.field { display: block; }
label.field > span { display: block; font-size: 14px; font-weight: 650; margin-bottom: 7px; }
label.field > span .req { color: var(--danger); }
.hint { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.form-error { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 550; }

/* ---------- Modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,17,23,.5); display: grid; place-items: center; padding: 3vh 16px; pointer-events: auto; animation: fade .15s ease; }
.modal-backdrop.out { animation: fade .15s ease reverse; }
.modal { width: 100%; max-width: 460px; max-height: 94vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .16s ease; }
.modal-wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; }
.modal-head .icon-btn { margin-left: auto; border: 0; background: transparent; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); }
.modal-foot .btn { padding: 12px 22px; font-size: 15px; }
.confirm-msg { font-size: 15.5px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Toasts ---------- */
.toast-host { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--text-soft); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); padding: 11px 14px; font-size: 13.5px; font-weight: 550; max-width: 360px; animation: slidein .2s ease; }
.toast.out { animation: slidein .2s ease reverse; }
.toast .ico { width: 17px; height: 17px; flex: none; }
.toast-success { border-left-color: var(--ok); } .toast-success .ico { color: var(--ok); }
.toast-error { border-left-color: var(--danger); } .toast-error .ico { color: var(--danger); }
.toast-info { border-left-color: var(--info); } .toast-info .ico { color: var(--info); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---------- Page title / empty ---------- */
.page-title { margin-bottom: 18px; }
.page-title h2 { font-size: 26px; font-weight: 750; }
.page-title p { color: var(--text-muted); font-size: 15.5px; margin-top: 4px; }
.empty { text-align: center; padding: 44px 20px; color: var(--text-muted); font-size: 15px; }
.empty .ico { width: 38px; height: 38px; margin-bottom: 12px; opacity: .6; }
.empty h4 { font-size: 17px; margin-bottom: 6px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar .spacer { margin-left: auto; }
.search { position: relative; display: flex; align-items: center; min-width: 200px; }
.search .ico { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--text-soft); pointer-events: none; }
.search input { padding-left: 32px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters select, .filters input { width: auto; min-width: 130px; padding: 9px 12px; font-size: 14px; }

/* panel de filtros (Ventas, etc.) */
.filtros-panel { margin-bottom: 16px; }
.filtros-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 8px; }
.filtros-grid input, .filtros-grid select { width: 100%; padding: 10px 12px; font-size: 14px; }
.filtros-acc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.filtros-acc .btn { padding: 10px 16px; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-muted); margin-top: 10px; cursor: pointer; }
.check-line input { width: auto; }
tr.fila-anulada { opacity: .55; }
tr.fila-anulada:hover { opacity: 1; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 32px 28px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; text-align: center; }
.login-brand .brand-mark { width: 52px; height: 52px; font-size: 26px; border-radius: 14px; }
.login-brand h1 { font-size: 21px; }
.login-brand p { color: var(--text-muted); font-size: 14px; }
.login-card .form { gap: 16px; }
.login-card .btn-primary { padding: 14px; font-size: 16px; }

/* ============================================================
   MESAS
   ============================================================ */
.mesas-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.mesas-toolbar #refrescar { margin-left: auto; }

.filtro-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.filtro-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-radius: 999px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  color: var(--text-muted); font-size: 13.5px; font-weight: 650;
  cursor: pointer; font-family: inherit; transition: all .12s;
}
.filtro-btn b { font-variant-numeric: tabular-nums; opacity: .7; }
.filtro-btn:hover { border-color: var(--text-muted); color: var(--text); }
.filtro-btn.on { color: #fff; }
.filtro-btn.on b { opacity: .85; }
.filtro-btn.f-libre.on { background: var(--ok); border-color: var(--ok); }
.filtro-btn.f-ocupada.on { background: var(--accent); border-color: var(--accent); }
/* "Comandas": pill de acción (mismo look que los filtros, en color de marca) */
.filtro-btn-link { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
.filtro-btn-link .ico { width: 15px; height: 15px; }
.filtro-btn-link:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.mesa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 12px; }
.mesa {
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  padding: 15px 16px; cursor: pointer; text-align: left; font-family: inherit; color: var(--text);
  display: flex; flex-direction: column; gap: 4px; min-height: 122px;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.mesa:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.mesa .m-top { display: flex; align-items: center; justify-content: space-between; }
.mesa .m-num { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.mesa .m-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--text-soft); flex: none; }
.mesa .m-state { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.mesa .m-total { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.mesa .m-total.m-libre-hint { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.mesa .m-meta { font-size: 12.5px; color: var(--text-muted); margin-top: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mesa .m-meta .ico { width: 13px; height: 13px; }
.mesa .m-mozo { background: var(--surface-2); border-radius: 999px; padding: 1px 8px; font-weight: 600; }
.mesa.libre { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); }
.mesa.libre .m-dot { background: var(--ok); }
.mesa.libre .m-state { color: var(--ok); }
.mesa.ocupada { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.mesa.ocupada .m-dot { background: var(--accent); }
.mesa.ocupada .m-state { color: var(--accent); }

/* Venta al paso (no es una mesa) + agrupar mesas en una sola cuenta */
.mesa.paso { border-color: color-mix(in srgb, var(--info) 55%, var(--border)); background: color-mix(in srgb, var(--info-soft) 55%, var(--surface)); }
.mesa.paso .m-top .ico { width: 20px; height: 20px; color: var(--info); }
.mesa.paso .m-state { color: var(--info); }
.mesa.agrupada { border-left: 5px solid var(--info); }
.mesa .m-grupo { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--info); }
.mesa .m-grupo .ico { width: 13px; height: 13px; }
.mesa.elegible { outline: 2px dashed var(--border-strong); outline-offset: -4px; }
.mesa.no-elegible { opacity: .45; cursor: not-allowed; }
.mesa.sel { outline: 3px solid var(--info); outline-offset: -3px; background: color-mix(in srgb, var(--info-soft) 70%, var(--surface)); }
.agrupar-barra { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--info-soft); color: var(--text); font-size: 14px; }
.agrupar-barra .ico { width: 15px; height: 15px; vertical-align: -2px; }
.agrupar-barra .ab-acciones { display: inline-flex; gap: 8px; }
#agrupar.on { background: var(--info); border-color: var(--info); color: #fff; }
.grupo-banner { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--info) 45%, var(--border)); border-left: 5px solid var(--info); background: color-mix(in srgb, var(--info-soft) 55%, var(--surface)); }
.gb-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gb-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: var(--info); }
.gb-tag .ico { width: 14px; height: 14px; }
.gb-total { margin-left: auto; font-size: 13px; color: var(--text-muted); }
.gb-total b { font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.gb-mesas { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.gb-detalle { background: var(--surface-2); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; font-size: 14px; }
.gb-detalle > div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-variant-numeric: tabular-nums; align-items: center; }
.carne-resumen { display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: 15px; }
.sk-cat-card.sk-ctrl { border-style: dashed; }
.scc-falta { color: var(--danger); font-weight: 800; }
.spc-falt { margin: -2px 0 8px; padding: 7px 9px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--danger) 50%, var(--border)); background: var(--danger-soft); color: var(--danger); font-size: 13px; line-height: 1.3; }
.spc-falt b { display: block; font-weight: 800; letter-spacing: .01em; }
.spc-falt small { display: block; margin-top: 2px; color: var(--text-muted); font-size: 12px; }
.sk-prod-card:has(.spc-falt) { border-color: color-mix(in srgb, var(--danger) 55%, var(--border)); }

/* ============================================================
   PEDIDO  (carga de productos + pedido actual)
   ============================================================ */
.pedido-layout { display: grid; grid-template-columns: 1fr 384px; gap: 18px; align-items: start; }
/* evita el "blowout" de grid: las columnas pueden encogerse por debajo de su contenido
   (si no, la fila de categorías con scroll horizontal estira todo y hay que moverse al costado) */
.pedido-layout > * { min-width: 0; }
.pedido-right { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 74px; min-width: 0; }
.pedido-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.pedido-head h2 { font-size: 23px; font-weight: 800; }
.pedido-head .badge { font-size: 12.5px; }
.pedido-head .ph-spacer { flex: 1; }

/* stepper de personas */
.personas-step { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; padding: 3px; }
.personas-step .ps-btn { width: 34px; height: 34px; border: 0; background: transparent; border-radius: 999px; cursor: pointer; display: grid; place-items: center; color: var(--text); }
.personas-step .ps-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--accent); }
.personas-step .ps-btn:disabled { opacity: .35; cursor: default; }
.personas-step .ps-val { display: inline-flex; align-items: center; gap: 5px; padding: 0 6px; font-size: 15px; font-weight: 750; min-width: 44px; justify-content: center; }
.personas-step .ps-val .ico { width: 15px; height: 15px; color: var(--text-muted); }

.mozo-chip { border: 1px solid var(--border); cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 5px; }
.mozo-chip::before { display: none; }
.mozo-chip .ico { width: 12px; height: 12px; }
.mozo-chip:hover { border-color: var(--accent); color: var(--accent); }
.mozo-chip[hidden] { display: none; }   /* v258 (R-04): «Poner nombre» no se ofrece en una mesa cerrada (el display del chip anulaba el atributo hidden) */

.cat-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; }
.cat-tab { padding: 9px 15px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); font-size: 14px; font-weight: 650; cursor: pointer; white-space: nowrap; font-family: inherit; }
.cat-tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.prod {
  border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface);
  padding: 14px 12px; cursor: pointer; text-align: left; font-family: inherit; color: var(--text);
  display: flex; flex-direction: column; gap: 6px; min-height: 84px; transition: border-color .12s, transform .1s;
}
.prod:hover { border-color: var(--accent); }
.prod:active { transform: scale(.97); }
.prod b { font-size: 14.5px; font-weight: 650; line-height: 1.25; }
.prod .p-price { font-size: 14px; color: var(--text-muted); font-weight: 600; margin-top: auto; }
.prod.no-disp { opacity: .45; pointer-events: none; }

.pedido-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; overflow: hidden; }
.pp-head { padding: 13px 16px; border-bottom: 1px solid var(--border); font-weight: 750; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.pp-head .pp-count { margin-left: auto; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; min-width: 22px; height: 22px; border-radius: 999px; display: grid; place-items: center; padding: 0 6px; }
.pp-items { padding: 4px 12px; overflow-y: auto; max-height: 46vh; }
.pp-empty { padding: 34px 16px; text-align: center; color: var(--text-soft); font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pp-empty .ico { width: 30px; height: 30px; opacity: .5; }

.pi { display: grid; grid-template-columns: 1fr auto auto; gap: 8px 10px; align-items: center; padding: 11px 4px; border-bottom: 1px solid var(--border); }
.pi:last-child { border-bottom: 0; }
.pi-main { min-width: 0; }
.pi-name { font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.pi-name .ico { width: 13px; height: 13px; color: var(--text-soft); }
.pi-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); background: var(--surface-2); border-radius: 999px; padding: 2px 7px; }
.pi-sub { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.pi-obs { font-size: 12.5px; color: var(--accent); margin-top: 3px; }
.pi-obs-btn { font-size: 12px; color: var(--text-soft); background: transparent; border: 0; cursor: pointer; padding: 4px 0 0; display: inline-flex; align-items: center; gap: 4px; font-family: inherit; }
.pi-obs-btn .ico { width: 12px; height: 12px; }
.pi-obs-btn:hover { color: var(--accent); }
.pi-right { display: flex; align-items: center; gap: 10px; }
.pi-qty { display: flex; align-items: center; gap: 2px; background: var(--surface-2); border-radius: 10px; padding: 2px; }
.pi-qty button { width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--text); }
.pi-qty button:hover { background: var(--surface); color: var(--accent); }
.pi-qty .n { min-width: 22px; text-align: center; font-weight: 750; font-variant-numeric: tabular-nums; font-size: 14px; }
.pi-price { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; min-width: 62px; }
.pi-del { border: 0; background: transparent; color: var(--text-soft); cursor: pointer; padding: 4px; }
.pi-del:hover { color: var(--danger); }
.pi-del .ico { width: 15px; height: 15px; }
.pi-auto { background: color-mix(in srgb, var(--surface-2) 70%, transparent); grid-template-columns: 1fr auto; border-radius: 8px; margin: 4px 0; padding: 10px 8px; }

.pp-foot { padding: 14px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 9px; background: var(--surface-2); }
.pp-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.pp-total b { font-size: 25px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.pp-total-sec { font-size: 12.5px; color: var(--text-muted); }
.pp-total.pp-desc span:last-child { color: var(--ok); font-weight: 700; }
.pp-print { font-size: 16px; padding: 14px; }
.pp-hint-print { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 12.5px; color: var(--text-soft); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 10px; padding: 10px; }
.pp-hint-print .ico { width: 15px; height: 15px; }
.pp-cancelar { font-size: 12.5px; padding: 8px; color: var(--text-soft); margin-top: 2px; }
.pp-cancelar:hover { color: var(--danger); }
.pp-cancelar .ico { width: 13px; height: 13px; }

/* barra fija en mobile */
.pedido-sticky { display: none; }

/* comandas enviadas */
.cz-head { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; font-size: 15px; font-weight: 750; }
.cz-head .ico { width: 17px; height: 17px; color: var(--text-muted); }
.cz-head span { background: var(--surface-2); border-radius: 999px; padding: 1px 9px; font-size: 12px; color: var(--text-muted); }
.comanda-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.comanda-card { border: 1px solid var(--border); border-left: 3px solid var(--text-soft); border-radius: 12px; background: var(--surface); overflow: hidden; }
.comanda-card.est-pendiente { border-left-color: var(--warn); }
.comanda-card.est-salio { border-left-color: var(--info); }
.comanda-card.est-servido { border-left-color: var(--ok); }
.cc-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--surface-2); font-size: 12.5px; }
.cc-num { font-weight: 800; }
.cc-estado { font-weight: 650; }
.est-pendiente .cc-estado { color: var(--warn); }
.est-salio .cc-estado { color: var(--info); }
.est-servido .cc-estado { color: var(--ok); }
.cc-hora { margin-left: auto; color: var(--text-soft); font-weight: 600; }
.cc-items { padding: 9px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.ci-line { display: flex; align-items: flex-start; gap: 8px; }
.ci-line .ci-txt { flex: 1; min-width: 0; }
.ci-line .ci-txt b { font-weight: 750; }
.ci-line em { color: var(--accent); font-style: normal; font-size: 12px; }
.ci-anul { display: block; color: var(--danger); font-size: 11.5px; }
.ci-line.anulado .ci-txt { text-decoration: line-through; opacity: .5; }
.ci-line.anulado .ci-anul { text-decoration: none; opacity: 1; }
.ci-muted { color: var(--text-soft); }
.ci-x { flex: none; width: 24px; height: 24px; border: 0; background: var(--surface-2); border-radius: 6px; color: var(--text-soft); cursor: pointer; display: grid; place-items: center; }
.ci-x:hover { background: var(--danger-soft); color: var(--danger); }
.ci-x .ico { width: 13px; height: 13px; }
.cc-actions { display: flex; gap: 6px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--border); }
.cc-actions .btn:first-child { flex: 1; }
.cc-actions [data-reimprimir] { flex: none; padding: 8px 10px; }

/* mini historial */
.hist { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.hist-toggle { width: 100%; display: flex; align-items: center; gap: 8px; padding: 11px 14px; background: transparent; border: 0; cursor: pointer; font-family: inherit; font-size: 13.5px; font-weight: 650; color: var(--text-muted); }
.hist-toggle .ico { width: 15px; height: 15px; }
.hist-toggle > span { background: var(--surface-2); border-radius: 999px; padding: 0 8px; font-size: 11.5px; }
.hist-toggle .hist-caret { margin-left: auto; color: var(--text-soft); }
.hist-body { display: none; padding: 4px 14px 10px; max-height: 240px; overflow-y: auto; }
.hist.open .hist-body { display: block; }
.hist-row { display: grid; grid-template-columns: 16px 1fr auto; gap: 8px; align-items: baseline; padding: 5px 0; font-size: 12.5px; border-top: 1px solid var(--border); }
.hist-row:first-child { border-top: 0; }
.hist-sign { font-weight: 800; text-align: center; }
.hist-row.s-mas .hist-sign { color: var(--ok); }
.hist-row.s-menos .hist-sign { color: var(--danger); }
.hist-row.s-cambio .hist-sign { color: var(--info); }
.hist-txt { color: var(--text); }
.hist-hora { color: var(--text-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }

.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick-chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-size: 13.5px; font-weight: 600; font-family: inherit; color: var(--text); }
.quick-chip:hover, .quick-chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* cobro / pago dividido */
.cobro-total { display: flex; align-items: baseline; justify-content: space-between; background: var(--surface-2); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; font-size: 14px; font-weight: 600; color: var(--text-muted); }
.cobro-total b { font-size: 26px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.pay-row { display: grid; grid-template-columns: 1fr 130px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.pay-row select, .pay-row input { padding: 11px 12px; font-size: 15px; }
.pay-sum { display: flex; justify-content: space-between; font-size: 14px; }
.pay-sum:not(:empty) { padding: 10px 0 0; border-top: 1px solid var(--border); margin-top: 6px; }
.pay-sum.bad { color: var(--danger); font-weight: 700; }
.pay-sum.ok { color: var(--ok); font-weight: 700; }
/* CAJA · ETAPA 1: propina por medio cuando no se puede deducir */
.prop-box { margin: 10px 0; padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: 12px; }
.prop-box .pb-t { font-size: 14px; margin-bottom: 8px; }
.pb-row { grid-template-columns: 1fr 110px auto; }
.pb-row small { color: var(--text-soft); font-weight: 400; }
.pb-res { font-size: 13.5px; font-weight: 700; margin-top: 4px; }
.pb-res.ok { color: var(--ok); } .pb-res.bad { color: var(--danger); }

/* ---------- barras simples (estadísticas) ---------- */
.bar-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; align-items: center; padding: 7px 0; }
.bar-row + .bar-row { border-top: 1px solid var(--border); }
.bar-label { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.bar-val { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--text-soft); }
.kv dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

.result { border-radius: 12px; padding: 14px 16px; font-size: 15px; }
.result.good { background: var(--ok-soft); color: var(--ok); }
.result.bad { background: var(--danger-soft); color: var(--danger); }
.result.warn { background: var(--warn-soft); color: var(--warn); }
.result b { font-weight: 750; }

.only-mobile { display: none; }
.hide-sm { display: inline-flex; }

/* ============================================================
   CAJA
   ============================================================ */
.caja-hero-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.caja-hero {
  border-radius: 16px; padding: 20px 22px; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.caja-hero.destacada { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.caja-hero .ch-label { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.caja-hero .ch-value { font-size: clamp(28px, 5vw, 40px); font-weight: 820; letter-spacing: -.025em; font-variant-numeric: tabular-nums; margin-top: 4px; line-height: 1.1; }
.caja-hero .ch-sub { font-size: 12.5px; color: var(--text-soft); margin-top: 6px; }
/* Total ingresado: franja compacta bajo los importes por medio (Caja abierta, cierre y cierre histórico) */
.caja-ingresado { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: var(--radius, 14px); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); background: linear-gradient(135deg, var(--accent-soft), var(--surface)); }
.caja-ingresado .ci-ico { display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent); color: #fff; flex: none; }
.caja-ingresado .ci-ico svg { width: 18px; height: 18px; }
.caja-ingresado .ci-label { min-width: 0; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.caja-ingresado .ci-value { margin-left: auto; white-space: nowrap; font-size: clamp(22px, 4.5vw, 30px); font-weight: 820; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }

.caja-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.caja-chip { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.caja-chip .cc-l { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); font-weight: 700; }
.caja-chip .cc-v { font-size: 19px; font-weight: 750; font-variant-numeric: tabular-nums; margin-top: 2px; }

.caja-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.caja-actions .btn { padding: 16px; font-size: 15.5px; font-weight: 700; }

.caja-desglose { display: flex; flex-direction: column; }
.caja-desglose .cd-row { display: flex; justify-content: space-between; padding: 9px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
.caja-desglose .cd-row:last-child { border-bottom: 0; }
.caja-desglose .cd-row.cd-total { font-weight: 800; font-size: 15.5px; border-top: 2px solid var(--border-strong); border-bottom: 0; margin-top: 4px; padding-top: 12px; }
.caja-desglose .cd-row span:last-child { font-variant-numeric: tabular-nums; }

.caja-cerrada-cta { text-align: center; padding: 40px 24px; }
.caja-cerrada-cta .ico { width: 44px; height: 44px; color: var(--text-soft); margin-bottom: 12px; }
.caja-cerrada-cta h3 { font-size: 19px; margin-bottom: 6px; }
.caja-cerrada-cta p { color: var(--text-muted); margin-bottom: 18px; }

/* modal cerrar caja: resultado en vivo */
.cierre-campo { margin-bottom: 14px; }
.cierre-campo .cf-l { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); font-weight: 700; margin-bottom: 4px; }
.cierre-campo .cf-v { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cierre-campo input { font-size: 22px; font-weight: 800; padding: 12px 14px; }
.dif-box { border-radius: 12px; padding: 14px 16px; font-size: 15px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.dif-box.ok { background: var(--ok-soft); color: var(--ok); }
.dif-box.falta { background: var(--danger-soft); color: var(--danger); }
.dif-box.sobra { background: var(--warn-soft); color: var(--warn); }
.dif-box b { font-size: 20px; font-variant-numeric: tabular-nums; }

/* detalle de cierre por bloques */
.cierre-bloques { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cierre-bloque { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.cierre-bloque h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-soft); margin-bottom: 8px; }
.cierre-bloque .cb-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13.5px; }
.cierre-bloque .cb-row b { font-variant-numeric: tabular-nums; }
.cierre-bloque.full { grid-column: 1 / -1; }

.cierre-card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.cierre-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface); cursor: pointer; transition: border-color .12s, transform .12s; }
.cierre-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.cierre-card .ck-fecha { font-size: 15px; font-weight: 750; }
.cierre-card .ck-ventas { font-size: 13px; color: var(--text-muted); margin: 4px 0; font-variant-numeric: tabular-nums; }
.cierre-card .ck-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-soft); margin-top: 6px; }

/* ============================================================
   STOCK  (categorías en cuadrados -> productos en cuadrados) + historial
   ============================================================ */
.sk-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; align-items: start; }
.sk-cat-card {
  border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow-sm); padding: 18px 20px;
  cursor: pointer; text-align: left; font-family: inherit; color: var(--text);
  display: flex; flex-direction: column; gap: 3px; min-height: 152px;
  transition: transform .12s, box-shadow .12s;
}
.sk-cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.scc-top { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 780; letter-spacing: -.01em; }
.scc-top .em { font-size: 20px; line-height: 1; }
.scc-label { font-size: 12px; color: var(--text-soft); margin-top: 10px; }
.scc-total { display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; margin: 1px 0 2px; }
.scc-total .n { font-size: 30px; font-weight: 830; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.scc-total .u { font-size: 14px; color: var(--text-muted); font-weight: 650; }
.scc-total .n-multi { font-size: 18px; font-weight: 800; }
.scc-total .n-empty { font-size: 26px; color: var(--text-soft); font-weight: 750; }
.scc-count { font-size: 12px; color: var(--text-soft); margin-top: auto; padding-top: 6px; }

.sk-add-card {
  border: 2px dashed var(--border-strong); border-radius: 16px; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 100px; cursor: pointer; color: var(--text-muted); font-weight: 650; font-size: 13.5px; font-family: inherit;
}
.sk-add-card:hover { border-color: var(--accent); color: var(--accent); }
.sk-add-card .ico { width: 20px; height: 20px; }

.sk-crumb { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.sk-crumb-txt { display: flex; align-items: center; gap: 7px; font-size: 15px; color: var(--text-muted); }
.sk-crumb-txt button { border: 0; background: transparent; color: var(--text-muted); font-family: inherit; font-size: 15px; font-weight: 650; cursor: pointer; padding: 0; }
.sk-crumb-txt button:hover { color: var(--accent); }
.sk-crumb-txt b { color: var(--text); font-weight: 750; }

.sk-prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; align-items: start; }
.sk-prod-card { position: relative; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); padding: 14px 14px 13px; display: flex; flex-direction: column; gap: 4px; }
.spc-menu { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border: 0; background: transparent; color: var(--text-soft); border-radius: 7px; cursor: pointer; display: grid; place-items: center; }
.spc-menu:hover { background: var(--surface-2); color: var(--text); }
.spc-menu .ico { width: 15px; height: 15px; }
.spc-name { font-weight: 700; font-size: 14.5px; padding-right: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spc-label { font-size: 11px; color: var(--text-soft); }
.spc-qty { display: flex; align-items: baseline; gap: 4px; margin: 0 0 8px; }
.spc-qty b { font-size: 23px; font-weight: 830; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.spc-qty span { font-size: 12px; color: var(--text-muted); }
.sk-prod-card-ro .spc-name { padding-right: 0; }
.sk-prod-card-ro .spc-qty { margin-bottom: 0; }

.qty-unit { display: flex; gap: 8px; }
.qty-unit input { flex: 1; min-width: 0; }
.qty-unit select { flex: 0 0 auto; width: auto; min-width: 104px; }

.sk-hist { margin-top: 30px; }
.sk-hist-title { display: flex; align-items: center; gap: 8px; font-size: 17px; margin-bottom: 12px; }
.sk-hist-title .ico { width: 17px; height: 17px; color: var(--text-muted); }
.sk-hist-filtros { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; }
.sk-chip { flex: none; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); font-size: 12.5px; font-weight: 650; cursor: pointer; font-family: inherit; white-space: nowrap; }
.sk-chip:hover { border-color: var(--text-muted); color: var(--text); }
.sk-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.sk-hist-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 2px 16px; }
.sk-mov { padding: 12px 0; border-top: 1px solid var(--border); }
.sk-mov:first-child { border-top: 0; }
.skm-when { font-size: 11.5px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.skm-line { display: flex; align-items: center; gap: 9px; margin-top: 4px; flex-wrap: wrap; }
.skm-badge { font-size: 11.5px; font-weight: 750; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.skm-badge.m-compra { background: var(--accent-soft); color: var(--accent); }
.skm-badge.m-agregado { background: var(--ok-soft); color: var(--ok); }
.skm-badge.m-modificado { background: var(--info-soft); color: var(--info); }
.skm-badge.m-eliminado { background: var(--danger-soft); color: var(--danger); }
.skm-badge.m-cat { background: var(--surface-2); color: var(--text-muted); }
.skm-name { font-weight: 650; font-size: 14px; }
.skm-extra { font-size: 13px; color: var(--text-muted); margin-top: 3px; font-variant-numeric: tabular-nums; }

.sk-pop { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 156px; overflow: hidden; animation: pop .12s ease; }
.sk-pop button { display: block; width: 100%; text-align: left; padding: 11px 14px; border: 0; background: transparent; cursor: pointer; font-size: 14px; font-family: inherit; color: var(--text); }
.sk-pop button + button { border-top: 1px solid var(--border); }
.sk-pop button:hover { background: var(--surface-2); }
.sk-pop button.danger { color: var(--danger); }

.sk-compra { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.sk-compra:last-child { border-bottom: 0; }
.sk-compra span:nth-child(2) { color: var(--text-muted); }
.sk-compra b { font-variant-numeric: tabular-nums; }

/* ============================================================
   COMANDAS (pantalla "Comandas")
   ============================================================ */
.cmd-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.cmd-toolbar #refrescar { margin-left: auto; flex: none; }
.cmd-filtros { display: flex; gap: 8px; flex-wrap: wrap; }
.cmd-fbtn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-radius: 999px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  color: var(--text-muted); font-size: 13.5px; font-weight: 650;
  cursor: pointer; font-family: inherit; transition: all .12s;
}
.cmd-fbtn b { font-variant-numeric: tabular-nums; opacity: .7; }
.cmd-fbtn:hover { border-color: var(--text-muted); color: var(--text); }
.cmd-fbtn.on { color: #fff; }
.cmd-fbtn.on b { opacity: .85; }
.cmd-fbtn.f-todas.on     { background: var(--text-muted); border-color: var(--text-muted); }
.cmd-fbtn.f-pendiente.on { background: var(--warn); border-color: var(--warn); }
.cmd-fbtn.f-salio.on     { background: var(--info); border-color: var(--info); }
.cmd-fbtn.f-servido.on   { background: var(--ok); border-color: var(--ok); }

.cmd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; align-items: start; }

.cmd-card {
  border: 1px solid var(--border); border-top: 4px solid var(--text-soft);
  border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-sm); overflow: hidden; display: flex; flex-direction: column;
}
.cmd-card.est-pendiente { border-top-color: var(--warn); }
.cmd-card.est-salio     { border-top-color: var(--info); }
.cmd-card.est-servido   { border-top-color: var(--ok); }

.cmd-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px 9px; }
.cmd-mesa { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.cmd-badge {
  font-size: 12px; font-weight: 750; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted); white-space: nowrap;
}
.est-pendiente .cmd-badge { background: var(--warn-soft); color: var(--warn); }
.est-salio .cmd-badge     { background: var(--info-soft); color: var(--info); }
.est-servido .cmd-badge   { background: var(--ok-soft); color: var(--ok); }

.cmd-when { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; padding: 0 15px 11px; color: var(--text-muted); font-size: 12.5px; font-weight: 600; }
.cmd-when .ico { width: 14px; height: 14px; }
.cmd-when-sec { color: var(--text-soft); }

.cmd-items { padding: 11px 15px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 5px; flex: 1; }
.cmd-item { display: flex; gap: 8px; font-size: 14px; align-items: baseline; }
.cmd-item .ci-q { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); flex: none; min-width: 26px; }
.cmd-item .ci-n { flex: 1; min-width: 0; }
.cmd-item .ci-p { color: var(--text-muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.cmd-item.anul .ci-n { text-decoration: line-through; opacity: .5; }
.cmd-item.ci-muted, .cmd-item.ci-muted .ci-n { color: var(--text-soft); }
.cmd-obs { font-size: 12.5px; color: var(--accent); padding-left: 34px; margin-top: -2px; }

.cmd-total { display: flex; align-items: center; justify-content: space-between; padding: 11px 15px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 13px; font-weight: 650; color: var(--text-muted); }
.cmd-total b { font-size: 17px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }

.cmd-volver { margin-bottom: 10px; }
.cmd-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 11px 15px; border-top: 1px solid var(--border); align-items: center; }
.cmd-actions .cmd-primary { flex: 1; }
.cmd-actions [data-ver] { margin-left: auto; }
.cmd-lista-ok { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 750; color: var(--ok); }
.cmd-lista-ok .ico { width: 15px; height: 15px; }

.cmd-detalle-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cmd-detalle-head .cmd-when { padding: 4px 0 0; }

@media (max-width: 640px) {
  .cmd-grid { grid-template-columns: 1fr; }
  .cmd-toolbar { gap: 8px; }
  .cmd-toolbar #refrescar { margin-left: 0; width: 100%; justify-content: center; }
  .cmd-filtros { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .cmd-fbtn { justify-content: center; padding: 10px 8px; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .pedido-layout { grid-template-columns: 1fr; }
  .pedido-right { position: static; }
  .pp-items { max-height: none; }
  .cols-4 { grid-template-columns: repeat(2,1fr); }
  .cols-3 { grid-template-columns: repeat(2,1fr); }
  .caja-hero-grid { grid-template-columns: 1fr; }
  .cierre-bloques { grid-template-columns: 1fr; }
  /* barra fija de acciones del pedido */
  .pedido-sticky {
    display: flex; align-items: center; gap: 8px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(0,0,0,.08);
  }
  .pedido-sticky .stk-total { display: flex; flex-direction: column; line-height: 1.15; margin-right: auto; }
  .pedido-sticky .stk-total small { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); font-weight: 700; }
  .pedido-sticky .stk-total b { font-size: 17px; font-variant-numeric: tabular-nums; }
  .pedido-sticky .btn { padding: 11px 14px; }
  .view-host { padding-bottom: 84px; }
}
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .only-mobile { display: grid; }
  .view-host { padding: 16px 14px; }
  .topbar { padding: 11px 14px; }
}
@media (max-width: 640px) {
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .mesa-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .prod-grid { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); }
  .bar-row { grid-template-columns: 110px 1fr; }
  .bar-row .bar-val { grid-column: 2; text-align: right; }
  .hide-sm { display: none !important; }
  .comanda-list { grid-template-columns: 1fr; }
  .caja-actions { grid-template-columns: 1fr; }
  .cierre-card-list { grid-template-columns: 1fr; }
  .pedido-head h2 { font-size: 20px; }
  .pedido-head { gap: 8px; }

  /* ítem del pedido: nombre arriba a todo el ancho, controles debajo */
  .pi { grid-template-columns: 1fr auto; column-gap: 8px; row-gap: 6px; }
  .pi-main { grid-column: 1 / -1; }
  .pi-right { grid-column: 1; }
  .pi-del { grid-column: 2; grid-row: 2; align-self: center; }
  .pi-auto { grid-template-columns: 1fr auto; }
  .page-title h2 { font-size: 22px; }
  .page-title p { font-size: 14px; }

  /* ---- tabla -> tarjetas ---- */
  .table-wrap { overflow-x: visible; }
  table.data { font-size: 14px; }
  table.data thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.data, table.data tbody { display: block; }
  table.data tr {
    display: block; background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px;
    padding: 6px 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm);
  }
  table.data tr:hover { background: var(--surface); }
  table.data td {
    display: flex; justify-content: space-between; align-items: center; gap: 14px;
    padding: 8px 0; border-bottom: 1px solid var(--border); text-align: right;
    white-space: normal; word-break: break-word;
  }
  table.data tr td:last-child { border-bottom: 0; }
  table.data td::before {
    content: attr(data-label); flex: none;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
    color: var(--text-soft); text-align: left;
  }
  table.data td:empty { display: none; }
  table.data td.name, table.data td[data-label=""] { display: block; text-align: left; }
  table.data td.name { font-weight: 750; font-size: 15.5px; padding-top: 10px; }
  table.data td.name::before { display: none; }
  table.data td[data-label=""] { padding: 10px 0 6px; }
  table.data td[data-label=""]::before { display: none; }
  table.data td[data-label=""] .btn { width: 100%; }
  table.data td.num { justify-content: space-between; }
  .row-hidden { display: none !important; }

  /* ---- toolbars / filtros ---- */
  .toolbar { gap: 8px; }
  .toolbar .spacer { display: none; }
  .toolbar .search { flex: 1 1 100%; min-width: 0; }
  .toolbar > .btn, .toolbar .filters .btn { flex: 1 1 calc(50% - 4px); }

  .filtros-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filtros-grid > * { width: 100%; min-width: 0; }
  .filtros-acc { display: flex; gap: 8px; }
  .filtros-acc .btn { flex: 1; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filters select, .filters input { width: 100%; min-width: 0; }
  .filters .btn { grid-column: span 1; }

  /* ---- caja ---- */
  .caja-tabs .cat-tab { flex: 1; text-align: center; }
  .caja-hero { padding: 16px 18px; }
  .caja-chips { grid-template-columns: 1fr 1fr; }

  /* ---- modales ---- */
  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal { max-width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; animation: slideup .2s ease; }
  .modal-wide { max-width: 100%; }
  .modal-body { padding: 18px 16px; }
  .modal-foot { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; padding: 13px 12px; }
  .pay-row { grid-template-columns: 1fr 96px auto; gap: 6px; }
  .pay-row select, .pay-row input { padding: 10px; font-size: 14px; }
  .cierre-bloques { grid-template-columns: 1fr; }
  .dif-box { flex-wrap: wrap; gap: 6px 12px; font-size: 14px; }
  .cobro-total { flex-wrap: wrap; }
}

@keyframes slideup { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

@media (max-width: 380px) {
  .mesa-grid { grid-template-columns: 1fr 1fr; }
  .prod-grid { grid-template-columns: 1fr 1fr; }
  .filtros-grid, .filters { grid-template-columns: 1fr; }
  .caja-chips { grid-template-columns: 1fr; }
  .personas-step .ps-btn { width: 32px; height: 32px; }
  .cat-tab { padding: 8px 12px; font-size: 13px; }
  .view-host { padding: 14px 11px; }
}

/* ============================================================
   IMPRESIÓN DE COMANDA  (impresora térmica ~72-80mm)
   ============================================================ */
#ticket { display: none; }
@media print {
  html, body { height: auto !important; min-height: 0 !important; overflow: visible !important; }
  body { margin: 0 !important; }
  body > :not(#ticket) { display: none !important; }
  #ticket {
    display: block !important; position: static !important; width: 72mm;
    height: auto !important; min-height: 0 !important; max-height: none !important; overflow: visible !important;
    margin: 0;
    padding: 4mm 3mm 0; color: #000; background: #fff;
    font-family: "Courier New", ui-monospace, monospace; font-size: 12px; line-height: 1.35;
  }
  #ticket .t-center { text-align: center; }
  #ticket .t-big { font-size: 15px; font-weight: 700; }
  #ticket .t-hr { border-top: 1px dashed #000; margin: 5px 0; }
  #ticket .t-sacar { font-size: 20px; font-weight: 800; line-height: 1.2; padding: 4px 2px; margin: 4px 0; border: 2px solid #000; }
  #ticket .t-salida { text-align: center; font-size: 15px; font-weight: 800; }
  #ticket .t-salida-hora { font-size: 32px; font-weight: 900; line-height: 1.1; letter-spacing: .04em; }
  #ticket .t-salida-nd { font-size: 16px; letter-spacing: 0; line-height: 1.3; }
  #ticket .t-item { font-size: 13px; font-weight: 700; margin-top: 4px; }
  #ticket .t-obs { font-size: 12px; padding-left: 10px; white-space: pre-line; }
  #ticket .t-picada { text-align: center; border: 3px solid #000; padding: 6px 2px; margin: 0 0 6px; }
  #ticket .t-picada-tit { font-size: 21px; white-space: nowrap; font-weight: 900; line-height: 1.1; letter-spacing: .02em; }
  #ticket .t-picada-hora { font-size: 32px; font-weight: 900; line-height: 1.1; }
  #ticket .t-picada-hora .t-picada-rot { font-size: 14px; letter-spacing: .02em; }
  #ticket .t-picada-sub { font-size: 11px; font-weight: 800; margin-top: 2px; }
  #ticket .t-prep-tit { font-size: 15px; font-weight: 900; text-align: center; padding: 3px 2px; margin: 2px 0 4px; background: #000; color: #fff; letter-spacing: .04em; }
  #ticket .t-acomp-tit { font-size: 13px; font-weight: 800; text-align: center; padding: 2px; margin: 4px 0; border: 2px dashed #000; }
  #ticket .t-info { border-left: 3px dotted #000; padding-left: 6px; margin-top: 2px; }
  #ticket .t-info-item { font-size: 12px; font-weight: 600; margin-top: 3px; }
  #ticket .t-info-obs { font-size: 11px; padding-left: 8px; white-space: pre-line; }
  /* Diseño v2 de la comanda: salida de principales compacta, postres pendientes y acompañamiento informativo del otro sector */
  #ticket .t-picada-hora.t-rango { font-size: 26px; letter-spacing: 0; }
  #ticket .t-ppal { text-align: center; font-size: 14px; font-weight: 800; border-bottom: 2px solid #000; padding: 2px 0 4px; margin: 0 0 2px; }
  #ticket .t-ppal b { font-size: 26px; font-weight: 900; letter-spacing: .03em; }
  #ticket .t-ppal .t-ppal-rot { font-size: 13px; }
  #ticket .t-postres { margin: 8px 0 2px; border-top: 3px double #000; border-bottom: 3px double #000; padding: 3px 0; text-align: center; }
  #ticket .t-postres-tit { font-size: 13px; font-weight: 900; line-height: 1.15; white-space: nowrap; }
  #ticket .t-postres-sub { font-size: 10px; font-weight: 800; letter-spacing: .03em; }
  #ticket .t-postres-pend { border-top-style: dashed; border-bottom-style: dashed; border-width: 2px; }
  #ticket .t-acomp2-tit { font-size: 11px; font-weight: 800; letter-spacing: .05em; border-top: 1px dashed #000; margin-top: 8px; padding-top: 3px; }
  #ticket .t-info2 .t-info-item { font-size: 11px; font-weight: 600; margin-top: 2px; }
  #ticket .t-info2 .t-info-obs { font-size: 10px; }
  #ticket .t-pl { text-align: center; border-top: 2px dashed #000; border-bottom: 2px dashed #000; padding: 4px 2px; margin: 4px 0; }
  #ticket .t-pl-tit { font-size: 18px; font-weight: 900; letter-spacing: .06em; }
  #ticket .t-pl-n { font-size: 22px; font-weight: 900; }
  #ticket .t-mesa-nombre { font-size: 20px; font-weight: 900; line-height: 1.15; overflow-wrap: anywhere; margin: 2px 0; }
  #ticket .t-row { display: flex; justify-content: space-between; gap: 6px; }
  #ticket .t-row span:last-child { text-align: right; min-width: 0; }
  /* Una impresión puede traer dos tickets (Cocina y Parrilla): cada uno es un bloque; el segundo empieza en una página nueva. Nunca hay salto después del último (no sale una página vacía). */
  #ticket .t-sector { font-size: 20px; letter-spacing: .08em; border: 2px solid #000; padding: 3px 2px; margin: 4px 0; }
  #ticket .t-ticket + .t-ticket { break-before: page; page-break-before: always; }
  /* Comandas: un renglón en blanco entre un producto (con sus aclaraciones) y el siguiente. NO aplica a «ACOMPAÑA COCINA/PARRILLA» (usa .t-info-item, compacto) ni a las cuentas. */
  #ticket .t-prod + .t-prod { margin-top: 1.35em; }
  #ticket .t-prod { break-inside: avoid; page-break-inside: avoid; }
  /* una palabra larga sin espacios (nota o nombre) se parte en vez de salirse del papel de 72 mm */
  #ticket, #ticket * { overflow-wrap: anywhere; word-break: break-word; }
  /* El largo del rollo lo determina el formulario del driver; CSS no admite ancho + alto auto. */
  @page { margin: 0; size: auto; }
}

/* Indicador de conexión / sincronización (barra superior) */
.net-badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; margin-left: auto; margin-right: 8px; white-space: nowrap; }
.net-badge[hidden] { display: none; }
.net-badge.net-off { background: var(--warn-soft); color: var(--warn); }
.net-badge.net-pend, .net-badge.net-sync { background: var(--info-soft); color: var(--info); }
.net-badge.net-error { background: var(--danger-soft); color: var(--danger); }

/* ============================================================
   Configuración, Gastos simples, Planilla de carne, filtros de Productos
   ============================================================ */
/* Los controles nativos (barras de desplazamiento, selectores de fecha) siguen el tema: en modo oscuro ya no queda una barra blanca. */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
/* La lista del pedido se desplaza igual (rueda / dedo) pero SIN barra visible al costado. */
.pp-items, .hist-body { scrollbar-width: none; -ms-overflow-style: none; }
.pp-items::-webkit-scrollbar, .hist-body::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* migaja de Configuración (Usuarios / Estadísticas) */
.crumb .crumb-link { border: 0; background: transparent; padding: 0; font: inherit; font-size: 18px; color: var(--text-muted); cursor: pointer; font-weight: 600; }
.crumb .crumb-link:hover { color: var(--accent); }
.crumb .crumb-sep { margin: 0 8px; color: var(--text-soft); }
.crumb .crumb-link, .crumb .crumb-sep, .crumb b { display: inline; }

.config-v { max-width: 560px; }
.cfg-sec h3 { font-size: 16px; margin-bottom: 12px; }
.cfg-tema { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cfg-op { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 12px; border-radius: 12px; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text-muted); font: inherit; font-size: 15px; font-weight: 650; cursor: pointer; }
.cfg-op .ico { width: 20px; height: 20px; }
.cfg-op:hover { border-color: var(--text-muted); color: var(--text); }
.cfg-op.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.cfg-ir { width: 100%; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 0; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; border-radius: var(--radius); }
.cfg-ir:hover { background: var(--surface-2); }
.cfg-ir .ico-wrap { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.cfg-ir .ico-wrap .ico { width: 20px; height: 20px; }
.cfg-ir-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.cfg-ir-txt b { font-size: 16px; }
.cfg-ir-txt small { color: var(--text-muted); font-size: 13px; }
.cfg-ir > .ico { color: var(--text-soft); width: 18px; height: 18px; }

/* Productos: filtros de categoría pegados al buscador */
.prod-cats { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; margin: -6px 0 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.prod-cats::-webkit-scrollbar { display: none; }
.prod-cats .sk-chip { padding: 8px 14px; font-size: 13.5px; }
.prod-cats .sk-chip b { font-weight: 700; opacity: .7; margin-left: 3px; font-variant-numeric: tabular-nums; }
.prod-cats .sk-chip.on b { opacity: .9; }

/* Gastos: cargar un gasto sin pensar */
.gn { display: flex; flex-direction: column; gap: 14px; }
.gn-titulo { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.gn-campo { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 650; color: var(--text-muted); }
.gn-campo small { font-weight: 500; color: var(--text-soft); }
.gn-campo input { font-size: 17px; padding: 13px 14px; }
.gn-monto-in { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--border-strong); border-radius: 12px; padding: 4px 14px; background: var(--surface); }
.gn-monto-in:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.gn-monto-in b { font-size: 24px; color: var(--text-muted); }
.gn-monto-in input { border: 0; box-shadow: none; font-size: 28px; font-weight: 750; padding: 8px 0; background: transparent; width: 100%; font-variant-numeric: tabular-nums; }
.gn-monto-in input:focus { box-shadow: none; }
.gn-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.gn-cat { padding: 11px 16px; border-radius: 12px; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 15px; font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.gn-cat:hover { border-color: var(--text-muted); }
.gn-cat.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.gn-cat-otro { border-style: dashed; color: var(--text-muted); }
.gn-cat-otro.on { border-style: solid; color: #fff; }
.gn-fecha { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--text-muted); }
.gn-fecha .ico { vertical-align: -3px; }
.gn-fecha b { color: var(--text); }
.gn-fecha input[type="date"] { width: auto; padding: 8px 10px; font-size: 14px; }
.gn-link { border: 0; background: transparent; color: var(--accent); font: inherit; font-weight: 650; cursor: pointer; padding: 4px 2px; }
.gn #g-guardar { margin-top: 2px; }
.gl-periodo { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.gl-periodo::-webkit-scrollbar { display: none; }
.gl-lista { display: flex; flex-direction: column; }
.gl-fila { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); }
.gl-fila:first-child { border-top: 0; }
.gl-fila.anulado { opacity: .6; }
.gl-main { flex: 1; min-width: 0; }
.gl-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 15.5px; }
.gl-fecha { font-size: 12.5px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.gl-det { font-size: 14px; color: var(--text); margin-top: 2px; overflow-wrap: anywhere; }
.gl-meta { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.gl-der { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.gl-monto { font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Carne: planilla de cortes (Corte | Kilos) */
.cp-head, .cp-fila { display: grid; grid-template-columns: minmax(0, 1fr) 118px 40px; gap: 8px; align-items: center; }
.cp-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); padding: 0 2px 6px; }
.cp-fila { margin-bottom: 8px; }
.cp-fila select, .cp-kg-in { font-size: 16px; padding: 12px 12px; min-height: 46px; }
.cp-kg { display: flex; align-items: center; gap: 6px; }
.cp-kg span { color: var(--text-muted); font-weight: 650; }
.cp-kg-in { width: 100%; text-align: right; font-variant-numeric: tabular-nums; }
.cp-x { width: 40px; height: 40px; }
.cp-add { margin-top: 4px; }
@media (max-width: 640px) {
  .gl-fila { padding: 12px 14px; }
  .gl-der .btn { padding: 5px 8px; }
  .cp-head, .cp-fila { grid-template-columns: minmax(0, 1fr) 104px 36px; gap: 6px; }
  .gn-cat { padding: 11px 14px; }
}

/* ============================================================
   Barra de navegación inferior — SOLO CELULAR
   (≤ 640 px de ancho, o celular en horizontal: ≤ 950 px de ancho y ≤ 500 px de alto).
   En PC y tablet no existe: se sigue usando el menú lateral de siempre.
   ============================================================ */
:root { --bnav-h: 58px; }
.bottom-nav, .more-scrim, .more-sheet { display: none; }
@media (max-width: 640px), (max-width: 950px) and (max-height: 500px) {
  /* el menú lateral y su botón quedan reemplazados por la barra inferior */
  #app > .sidebar, #app > .scrim, #menu-btn { display: none !important; }
  body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .view-host { padding-bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom) + 38px); }
  .view-host:has(.pedido-sticky:not([hidden])) { padding-bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom) + 110px); }
  /* la barra fija de acciones del pedido pasa a ir justo encima de la barra de navegación */
  .pedido-sticky { bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom)); padding-bottom: 10px; z-index: 40; left: env(safe-area-inset-left); right: env(safe-area-inset-right); }

  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 62;
    height: calc(var(--bnav-h) + env(safe-area-inset-bottom)); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(0,0,0,.08);
  }
  .bn-item {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
    cursor: pointer; position: relative; padding: 6px 2px; -webkit-tap-highlight-color: transparent;
  }
  .bn-item .ico { width: 22px; height: 22px; }
  .bn-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bn-item.active, .bn-item.open { color: var(--accent); font-weight: 750; }
  .bn-item.active::before { content: ""; position: absolute; top: 0; left: 24%; right: 24%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
  .bn-item:active { background: var(--surface-2); }

  .more-scrim { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.42); animation: fade .15s ease; }
  .more-sheet {
    display: block; position: fixed; left: 8px; right: 8px; z-index: 61; bottom: calc(var(--bnav-h) + env(safe-area-inset-bottom) + 8px);
    max-height: calc(100dvh - var(--bnav-h) - env(safe-area-inset-bottom) - 24px); overflow-y: auto; scrollbar-width: none;
    background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 8px; animation: slideup .18s ease;
  }
  .more-sheet::-webkit-scrollbar { display: none; }
  .more-scrim[hidden], .more-sheet[hidden] { display: none; }
  .ms-who { padding: 8px 12px 10px; font-size: 12px; color: var(--text-soft); border-bottom: 1px solid var(--border); margin-bottom: 6px; }
  .ms-who b { display: block; font-size: 15px; color: var(--text); }
  .ms-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 9px 4px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
  .ms-group { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 42px; padding: 5px 4px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); color: var(--text-muted); font-family: var(--font-num); font-size: 13px; font-weight: 800; text-align: center; letter-spacing: .015em; line-height: 1.1; white-space: normal; overflow-wrap: anywhere; }
  .ms-group.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
  .ms-item {
    width: 100%; display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 10px 12px; border: 0; border-radius: 12px;
    background: transparent; color: var(--text); font: inherit; font-size: 16px; font-weight: 600; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .ms-item .ico { width: 22px; height: 22px; color: var(--text-muted); flex: none; }
  .ms-item .ms-go { margin-left: auto; width: 18px; height: 18px; color: var(--text-soft); }
  .ms-item:active { background: var(--surface-2); }
  .ms-item.active { background: var(--accent-soft); color: var(--accent); }
  .ms-item.active .ico { color: var(--accent); }
  .ms-salir { margin-top: 6px; border-top: 1px solid var(--border); border-radius: 0 0 12px 12px; color: var(--danger); }
  .ms-salir .ico { color: var(--danger); }
}

/* ============================================================
   Asistente IA (js/ia.js)
   Un único chat (.ia-chat) que vive en dos lugares:
   - Escritorio, administrador: panel flotante (.ia-panel) debajo del botón de la barra superior.
   - Celular / mozo: página Configuración → IA (.ia-page).
   ============================================================ */
.ia-top-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; margin-left: 4px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--accent);
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.ia-top-btn .ico { width: 16px; height: 16px; }
.ia-top-btn:hover, .ia-top-btn.on { background: var(--accent-soft); border-color: var(--accent); }

.ia-panel {
  position: fixed; top: 62px; right: 16px; z-index: 61;
  width: 400px; max-width: calc(100vw - 24px); height: min(640px, calc(100vh - 80px));
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.ia-panel[hidden] { display: none; }
.ia-chat {
  height: 100%; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.ia-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--border); }
.ia-head-ico { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent); flex: none; }
.ia-head-ico .ico { width: 17px; height: 17px; }
.ia-head-txt { display: flex; flex-direction: column; margin-right: auto; line-height: 1.25; }
.ia-head-txt small { color: var(--text-soft); font-size: 11.5px; }
.ia-head .icon-btn { border: 0; background: transparent; }
.ia-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.ia-msg { max-width: 86%; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; line-height: 1.45; font-size: 14px; }
.ia-user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.ia-bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ia-error { align-self: flex-start; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border); }
.ia-welcome p { margin: 0 0 10px; color: var(--text-muted); font-size: 14px; }
.ia-chips { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.ia-chip { text-align: left; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.ia-chip:hover { border-color: var(--accent); color: var(--accent); }
.ia-typing { display: flex; gap: 4px; padding: 12px 14px; }
.ia-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-soft); animation: ia-dot 1s infinite ease-in-out; }
.ia-typing i:nth-child(2) { animation-delay: .15s; }
.ia-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ia-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ia-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--surface); }
.ia-form textarea {
  flex: 1; resize: none; max-height: 110px; padding: 9px 12px; font: inherit; font-size: 14px;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.ia-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.ia-send { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); background: var(--accent); color: #fff; cursor: pointer; }
.ia-send .ico { width: 17px; height: 17px; }
.ia-form.busy .ia-send { opacity: .5; pointer-events: none; }

/* En la página (Configuración → IA) el chat ocupa el alto disponible; no hay botón de cerrar. */
.ia-page { height: calc(100dvh - 150px); min-height: 380px; max-height: 760px; }
.ia-page .ia-close { display: none; }

/* Configuración: la fila "IA" del administrador solo existe en celular (en escritorio usa el botón de la barra superior). */
.cfg-solo-movil { display: none; }

@media (max-width: 640px), (max-width: 950px) and (max-height: 500px) {
  .ia-top-btn, .ia-panel { display: none !important; }
  .cfg-solo-movil { display: block; }
  /* alto = pantalla − barra superior − barra inferior − márgenes */
  .ia-page { height: calc(100dvh - 56px - var(--bnav-h, 58px) - env(safe-area-inset-bottom) - 40px); min-height: 320px; }
}
@media print { .ia-top-btn, .ia-panel { display: none !important; } }

/* ============================================================
   Productos en celular: tarjetas compactas (la fila entera se toca para editar)
     fila 1: nombre ........ precio
     fila 2: categoría ..... estado
     fila 3: menú · stock vinculado (línea chica)
   ============================================================ */
@media (max-width: 640px) {
  .prod-tabla table.data tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; row-gap: 6px;
    padding: 14px 16px; margin-bottom: 10px; -webkit-tap-highlight-color: transparent;
  }
  .prod-tabla table.data tr:active { background: var(--surface-2); }
  .prod-tabla table.data td { display: block; padding: 0; border: 0; text-align: left; min-width: 0; }
  .prod-tabla table.data td::before { display: none; }
  .prod-tabla table.data td:empty { display: none; }
  /* fila 1 · nombre y precio */
  .prod-tabla table.data td:nth-child(1) { grid-column: 1; grid-row: 1; font-size: 16px; font-weight: 750; line-height: 1.3; overflow-wrap: anywhere; }
  .prod-tabla table.data td:nth-child(3) { grid-column: 2; grid-row: 1; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
  /* fila 2 · categoría y estado */
  .prod-tabla table.data td:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 13.5px; font-weight: 600; color: var(--text-muted); }
  .prod-tabla table.data td:nth-child(6) { grid-column: 2; grid-row: 2; justify-self: end; }
  .prod-tabla table.data td:nth-child(6) .badge { font-size: 12.5px; padding: 3px 10px; }
  /* fila 3 · menú y fila 4 · stock vinculado (líneas chicas) */
  .prod-tabla table.data td:nth-child(4), .prod-tabla table.data td:nth-child(5) { grid-column: 1 / -1; font-size: 12.5px; color: var(--text-soft); }
  .prod-tabla table.data td:nth-child(4) { grid-row: 3; padding-top: 8px; margin-top: 2px; border-top: 1px solid var(--border); }
  .prod-tabla table.data td:nth-child(5) { grid-row: 4; }
  .prod-tabla table.data td:nth-child(5) .badge { font-size: 12px; padding: 3px 10px; max-width: 100%; white-space: normal; text-align: left; }
  .prod-tabla table.data td:has(> .stock-nada), .prod-tabla table.data td:has(> .menu-defecto) { display: none; }   /* lo habitual no se repite en cada tarjeta */
  .prod-tabla table.data td:has(> .menu-defecto) + td:nth-child(5) { padding-top: 8px; margin-top: 2px; border-top: 1px solid var(--border); }
  .prod-tabla table.data td:nth-child(7) { display: none; }   /* "Editar": toda la tarjeta es el botón */
}

/* Productos (tablet / escritorio angosto): el precio nunca se parte en dos líneas */
.prod-tabla table.data td.num, .prod-tabla table.data th.num { white-space: nowrap; }

/* ============================================================
   Celular: zonas táctiles de al menos ~36 px en los controles chicos (auditoría de usabilidad)
   ============================================================ */
@media (max-width: 640px) {
  .pi-del { min-width: 42px; min-height: 42px; display: inline-grid; place-items: center; }
  .pi-del .ico { width: 18px; height: 18px; }
  .pi-obs-btn { min-height: 36px; padding: 8px 4px; font-size: 13px; }
  .sk-chip { min-height: 36px; display: inline-flex; align-items: center; }
  .g-fecha-cambiar { min-height: 36px; padding: 6px 10px; }
  .crumb-stock { padding: 8px 4px; }
}
/* Celular horizontal: poco alto disponible, el chat no exige 320 px de alto mínimo */
@media (max-height: 500px) { .ia-page { min-height: 200px; } }
.net-badge[role="button"] { cursor: pointer; }
.ops-lista { display: grid; gap: 8px; margin: 10px 0; }
.ops-fila { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--border, #d1d5db); border-radius: 12px; background: var(--surface, #fff); }
.ops-fila.est-error { border-color: var(--danger, #c0392b); }
.ops-txt { min-width: 0; flex: 1 1 200px; overflow-wrap: anywhere; }
.ops-estado { font-size: 13px; color: var(--muted, #6b7280); }
.ops-acc { display: flex; gap: 6px; flex-wrap: wrap; }
/* Las ventanas nunca se ensanchan más que la pantalla (celulares angostos): la columna de la grilla no crece con el contenido. */
.modal-backdrop { grid-template-columns: minmax(0, 1fr); }
.modal { min-width: 0; }

/* CAJA · ETAPA 1: pantalla principal simple (tres importes), detalle y cierre */
.caja-estado { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 14px; }
.caja-principal .caja-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cierre-recontar-fila { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .caja-principal .caja-actions .btn { flex: 1 1 46%; }
}

/* Celular: «← Volver» en la barra superior en lugar del botón de tres líneas (el de computadora no cambia) */
.volver-top { display: none; }
@media (max-width: 900px) {
  #menu-btn { display: none !important; }
  .volver-top { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; font-weight: 800; }
  .volver-top[hidden] { display: none; }
  .volver-top .ico { width: 18px; height: 18px; }
}
