/* ==========================================================================
   POS v2.3 — Estilos (tema oscuro por defecto + tema claro)
   Sin dependencias externas: todo el diseño vive en este archivo.
   ========================================================================== */
:root {
  --bg: #0b111c;
  --bg-2: #0f1724;
  --panel: #131c2b;
  --panel-2: #182335;
  --panel-3: #1e2a3f;
  --border: #243249;
  --border-2: #2f3f5a;
  --text: #e7ecf3;
  --text-2: #b4bfcf;
  --muted: #7f8ca1;
  --primary: #2f6fed;
  --primary-2: #3b7cff;
  --primary-soft: rgba(47, 111, 237, .16);
  --accent: #f5a524;
  --accent-ink: #1b1204;
  --ok: #19b47a;
  --warn: #eab308;
  --alert: #f97316;
  --danger: #ef4444;
  --free: #5d6b80;
  --served: #6c7a90;
  --canvas: #101826;
  --canvas-dot: rgba(148, 163, 184, .13);
  --wood: #7a3d12;
  --wood-2: #a3541c;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #eef2f7;
  --bg-2: #f6f8fb;
  --panel: #ffffff;
  --panel-2: #f6f8fb;
  --panel-3: #eef2f7;
  --border: #dde3ec;
  --border-2: #cbd4e1;
  --text: #0f1726;
  --text-2: #344256;
  --muted: #66758b;
  --primary: #1f5fe0;
  --primary-2: #2f6fed;
  --primary-soft: rgba(31, 95, 224, .1);
  --canvas: #f8fafc;
  --canvas-dot: rgba(100, 116, 139, .18);
  --free: #94a3b8;
  --served: #8a97ab;
  --shadow: 0 10px 30px rgba(15, 23, 38, .12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary-2); }
code, .mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Botones e inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text);
  font-weight: 600; font-size: 13px; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { filter: brightness(1.06); background: var(--accent); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-danger { background: transparent; border-color: rgba(239, 68, 68, .5); color: #f87171; }
.btn-danger:hover { background: rgba(239, 68, 68, .12); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-2); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text-2);
}
.icon-btn:hover { color: var(--text); background: var(--panel-3); }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.input, input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], input[type=tel], input[type=url], select, textarea {
  width: 100%; min-height: 38px; padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--bg-2); color: var(--text); outline: none;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; color: var(--text); font-size: 13px; }
label.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.span-2 { grid-column: span 2; }

/* ---------- Layout principal ---------- */
.app { display: grid; grid-template-rows: 64px 1fr; grid-template-columns: minmax(0, 1fr); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px;
  padding: 0 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }
.brand small { font-weight: 500; color: var(--muted); font-size: 12px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--text-2); font-size: 11px; font-weight: 800; color: var(--text);
}
.brand-lg { font-size: 20px; margin-bottom: 18px; }
.brand-mark.has-logo { border: 0; border-radius: 8px; width: auto; min-width: 34px; max-width: 120px; background: transparent; }
.brand-mark.has-logo img { display: block; max-height: 36px; max-width: 120px; object-fit: contain; }
.brand-lg .brand-mark.has-logo img { max-height: 56px; max-width: 180px; }
.brand-lg .brand-mark.has-logo { max-width: 180px; }
:root:not([data-theme="light"]) .brand-mark.has-logo { background: rgba(255, 255, 255, .94); padding: 3px 6px; }
.login-card .brand-lg { flex-direction: column; align-items: flex-start; gap: 12px; }
.logo-box { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-preview { width: 160px; height: 100px; border-radius: 12px; border: 1px dashed var(--border-2); display: grid; place-items: center; overflow: hidden;
  background-color: var(--bg-2); background-image: linear-gradient(45deg, var(--panel-3) 25%, transparent 25%, transparent 75%, var(--panel-3) 75%), linear-gradient(45deg, var(--panel-3) 25%, transparent 25%, transparent 75%, var(--panel-3) 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.topnav { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.topnav::-webkit-scrollbar { display: none; }
.navgroup { display: flex; gap: 2px; padding: 3px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.navpill {
  padding: 7px 12px; border-radius: 9px; border: 0; background: transparent; color: var(--text-2);
  font-size: 13px; font-weight: 600; white-space: nowrap; text-decoration: none;
}
.navpill:hover { color: var(--text); background: var(--panel-2); }
.navpill.active { background: var(--primary); color: #fff; }
.navpill .badge { margin-left: 6px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.conn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(25, 180, 122, .18); }
.conn.off::before { background: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, .2); }
.role-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px;
  border: 1px solid rgba(25, 180, 122, .45); color: #34d399; background: rgba(25, 180, 122, .08); font-size: 12px; font-weight: 700; white-space: nowrap;
}
.user-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--panel); color: var(--text); font-weight: 600; font-size: 13px; max-width: 220px;
}
.user-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu {
  position: absolute; right: 16px; top: 58px; min-width: 220px; padding: 6px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--border-2); box-shadow: var(--shadow); z-index: 60;
}
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 10px; border: 0; background: transparent; border-radius: 8px; text-align: left; font-size: 13px; }
.menu button:hover { background: var(--panel-2); }
.menu .menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

.body { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 0; }
.body.collapsed { grid-template-columns: 64px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; padding: 18px 12px;
  border-right: 1px solid var(--border); background: var(--bg);
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 10px; }
.side-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.side-group { margin-top: 14px; }
.side-group h6 { margin: 0 0 6px; padding: 0 10px; font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.side-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2);
  text-decoration: none; font-size: 13.5px; font-weight: 500; border: 1px solid transparent; white-space: nowrap; overflow: hidden;
}
.side-link:hover { background: var(--panel); color: var(--text); }
.side-link.active { background: var(--primary); color: #fff; border-color: rgba(255, 255, 255, .55); box-shadow: 0 0 0 1px var(--primary); }
.side-link .badge { margin-left: auto; }
.side-link span:not(.badge) { overflow: hidden; text-overflow: ellipsis; }
.body.collapsed .side-link span, .body.collapsed .side-group h6, .body.collapsed .side-title { display: none; }
.body.collapsed .side-link { justify-content: center; padding: 10px; }
.main { padding: 20px; min-width: 0; }
.backdrop { display: none; }

/* ---------- Tarjetas ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.card-pad { padding: 16px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 0; }
.card-title { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.card-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.page-title { margin: 0 0 4px; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; }
.badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--panel-3); color: var(--text-2);
}
.badge-red { background: var(--danger); color: #fff; }
.badge-blue { background: var(--primary-soft); color: var(--primary-2); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: var(--panel-3); color: var(--text-2); white-space: nowrap;
}
.chip-ok { background: rgba(25, 180, 122, .15); color: #34d399; }
.chip-warn { background: rgba(234, 179, 8, .15); color: #facc15; }
.chip-alert { background: rgba(249, 115, 22, .16); color: #fb923c; }
.chip-danger { background: rgba(239, 68, 68, .16); color: #f87171; }
.chip-blue { background: var(--primary-soft); color: #7aa7ff; }
.chip-accent { background: rgba(245, 165, 36, .16); color: var(--accent); }
:root[data-theme="light"] .chip-ok { color: #047857; }
:root[data-theme="light"] .chip-warn { color: #a16207; }
:root[data-theme="light"] .chip-alert { color: #c2410c; }
:root[data-theme="light"] .chip-danger { color: #b91c1c; }
:root[data-theme="light"] .chip-blue { color: #1d4ed8; }
:root[data-theme="light"] .chip-accent { color: #b45309; }
:root[data-theme="light"] .role-chip { color: #047857; }

.seg { display: inline-flex; gap: 2px; padding: 4px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--text-2); white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--primary); color: #fff; }
.seg.seg-accent button.active { background: var(--accent); color: var(--accent-ink); }
.seg.seg-sm button { padding: 6px 10px; font-size: 12px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.dot-ok { background: var(--ok); } .dot-warn { background: var(--warn); } .dot-alert { background: var(--alert); } .dot-danger { background: var(--danger); } .dot-free { background: var(--free); }

/* ---------- Mesas ---------- */
.mesas-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; margin-bottom: 16px; }
.mesas-top .row-wrap { gap: 8px; }
.mesas-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(360px, 1fr); gap: 16px; align-items: start; }
.mesas-grid > *, .carta-grid > *, .dual > *, .panel-mesa > *, .catalog, .catalog > * { min-width: 0; }
.plan-card { padding: 14px; }
.plan-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.clock { font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.canvas {
  position: relative; width: 100%; min-width: 0; height: 520px; border-radius: 12px; overflow: hidden; touch-action: pan-x pan-y;
  background-color: var(--canvas); border: 1px solid var(--border);
  background-image: radial-gradient(var(--canvas-dot) 1px, transparent 1px); background-size: 22px 22px;
}
.canvas.editing { outline: 2px dashed var(--accent); outline-offset: -2px; touch-action: none; }
.canvas-scroll { overflow-x: auto; border-radius: 12px; -webkit-overflow-scrolling: touch; }
.canvas-label { position: absolute; right: 14px; bottom: 10px; font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; pointer-events: none; }
.deco { position: absolute; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.deco-barra { background: linear-gradient(180deg, var(--wood-2), var(--wood)); border-radius: 4px; color: #fde7cf; font-size: 10.5px; font-weight: 800; letter-spacing: .12em; }
.deco-toldo { border: 2px dashed rgba(245, 165, 36, .55); border-radius: 12px; background: rgba(245, 165, 36, .05); align-items: flex-start; }
.deco-toldo span { margin-top: -1px; padding: 3px 12px; background: rgba(245, 165, 36, .85); color: var(--accent-ink); border-radius: 0 0 8px 8px; font-size: 10.5px; font-weight: 800; letter-spacing: .14em; }
.deco-pared { background: var(--border-2); border-radius: 3px; }
.mesa {
  position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 12px; border: 1.5px solid var(--border-2); background: var(--panel-2); color: var(--text);
  text-align: center; user-select: none; padding: 4px; transition: box-shadow .15s, border-color .15s; z-index: 2;
}
.mesa:hover { border-color: var(--text-2); }
.mesa .n { font-size: 19px; font-weight: 800; line-height: 1.05; }
.mesa .t { font-family: var(--mono); font-size: 11px; font-weight: 700; line-height: 1.2; }
.mesa .s { font-size: 10.5px; color: var(--text-2); line-height: 1.2; }
.mesa.round { border-radius: 50%; }
.mesa.stool { border-radius: 50%; }
.mesa.sel { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(59, 124, 255, .45), 0 0 18px rgba(59, 124, 255, .35); z-index: 3; }
.mesa.st-abierta { border-color: var(--primary-2); }
.mesa.st-ok { background: color-mix(in srgb, var(--ok) 22%, var(--panel-2)); border-color: var(--ok); }
.mesa.st-warn { background: color-mix(in srgb, var(--warn) 22%, var(--panel-2)); border-color: var(--warn); }
.mesa.st-alert { background: color-mix(in srgb, var(--alert) 24%, var(--panel-2)); border-color: var(--alert); }
.mesa.st-danger { background: color-mix(in srgb, var(--danger) 26%, var(--panel-2)); border-color: var(--danger); }
.mesa.st-servida { background: var(--panel-3); border-color: var(--served); }
.mesa.blink { animation: blink 1.1s ease-in-out infinite; }
.mesa.listo::after { content: "LISTO"; position: absolute; top: -9px; right: -8px; background: var(--ok); color: #fff; font-size: 9px; font-weight: 800; padding: 2px 5px; border-radius: 6px; letter-spacing: .05em; }
.mesa.reservada::before { content: "R"; position: absolute; top: -8px; left: -8px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 800; }
.mesa .chair { position: absolute; background: var(--border-2); border-radius: 3px; }
.editing .mesa { cursor: grab; border-style: dashed; }
.editing .mesa.dragging { cursor: grabbing; box-shadow: var(--shadow); }
@keyframes blink { 0%, 100% { filter: none; } 50% { filter: brightness(1.35); } }
.plan-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.plan-foot .info { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--muted); }

.panel-mesa { padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.mesa-head { padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-2); }
.mesa-head h3 { margin: 0; font-size: 17px; font-weight: 800; }
.mesa-head .total { font-family: var(--mono); font-size: 20px; font-weight: 800; }
.stepper { display: flex; align-items: center; border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--bg-2); height: 38px; }
.stepper button { width: 38px; height: 100%; border: 0; background: transparent; font-size: 18px; color: var(--text-2); }
.stepper input { border: 0; background: transparent; text-align: center; min-height: 0; height: 100%; padding: 0; box-shadow: none !important; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0; font-size: 13.5px; font-weight: 700; }
.section-title small { font-weight: 500; color: var(--muted); font-size: 12px; }
.lines { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.line { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--border); font-size: 13px; }
.line:first-child { border-top: 0; }
.line .q { font-weight: 800; font-family: var(--mono); }
.line .name { font-weight: 600; text-transform: none; min-width: 0; }
.line .name small { display: block; font-weight: 500; color: var(--accent); font-size: 11.5px; }
.line .p { font-family: var(--mono); color: var(--text-2); }
.line.anulado .name, .line.anulado .p { text-decoration: line-through; opacity: .55; }
.line .st { font-size: 11px; font-weight: 700; }
.line .st.Entregado { color: var(--muted); text-decoration: line-through; }
.line .st.Listo { color: #34d399; }
.line .st.Preparando { color: var(--warn); }
.line .st.Pendiente { color: var(--text-2); }
.line-actions { display: flex; gap: 6px; align-items: center; }
.empty { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.draft { border: 1px solid rgba(59, 124, 255, .45); background: var(--primary-soft); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.draft-line { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; font-size: 13px; }
.draft-line .qbtns { display: flex; align-items: center; gap: 4px; }
.draft-line .qbtns button { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border-2); background: var(--panel); }
.draft-line input { min-height: 30px; padding: 4px 8px; font-size: 12px; }
.catalog { display: flex; flex-direction: column; gap: 10px; }
.tipos-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tipos-grid button { justify-content: center; white-space: normal; text-align: center; line-height: 1.2; }
.chips-scroll { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.chip-btn { padding: 7px 12px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--panel-2); font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--text-2); }
.chip-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 420px; overflow-y: auto; padding-right: 2px; }
.prod {
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 92px; padding: 10px 12px; text-align: left;
  border-radius: 12px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text);
}
.prod:hover { border-color: var(--primary); }
.prod .meta { display: flex; justify-content: space-between; gap: 6px; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.prod .meta b { font-family: var(--font); font-size: 10.5px; font-weight: 700; }
.prod .meta b.pack { color: var(--accent); } .prod .meta b.comb { color: #a78bfa; }
.prod .nm { font-weight: 700; font-size: 13px; line-height: 1.25; }
.prod .bottom { display: flex; justify-content: space-between; align-items: center; }
.prod .pr { font-family: var(--mono); font-weight: 800; color: #7aa7ff; }
:root[data-theme="light"] .prod .pr { color: var(--primary); }
.prod .add { font-size: 11.5px; color: var(--text-2); font-weight: 600; }

/* ---------- Cocina (KDS) ---------- */
.kds-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 14px; margin-bottom: 16px; }
.kds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.ticket { border-radius: 14px; border: 1px solid var(--border); background: var(--panel); overflow: hidden; }
.ticket-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; color: #fff; }
.ticket-head h4 { margin: 0; font-size: 16px; font-weight: 800; }
.ticket-head .sub { font-size: 11.5px; opacity: .9; }
.ticket-head .timer { font-family: var(--mono); font-size: 18px; font-weight: 800; }
.ticket.st-ok .ticket-head { background: #11845a; }
.ticket.st-warn .ticket-head { background: #a17a06; }
.ticket.st-alert .ticket-head { background: #c2570e; }
.ticket.st-danger .ticket-head { background: #c02626; }
.ticket.st-danger.blink { animation: blink 1.1s ease-in-out infinite; }
.ticket-body { padding: 6px 0; }
.kitem { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; width: 100%; padding: 10px 14px; border: 0; background: transparent; text-align: left; border-top: 1px solid var(--border); }
.kitem:first-child { border-top: 0; }
.kitem:hover { background: var(--panel-2); }
.kitem .q { font-family: var(--mono); font-weight: 800; font-size: 16px; }
.kitem .nm { font-weight: 700; font-size: 14px; }
.kitem .nota { display: block; margin-top: 2px; font-size: 12px; font-weight: 700; color: var(--accent); }
.kitem .est { font-size: 11px; color: var(--muted); }
.kitem.Preparando { background: rgba(234, 179, 8, .08); }
.kitem.Listo { background: rgba(25, 180, 122, .1); }
.kitem.Listo .nm { text-decoration: line-through; opacity: .7; }
.ticket-foot { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }
.dual { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.dual .kds-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.sala-list { display: flex; flex-direction: column; gap: 10px; }
.sala-row { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); padding: 10px 12px; }
.sala-row h5 { margin: 0 0 6px; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }

/* ---------- Tablas y formularios ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { position: sticky; top: 0; text-align: left; padding: 10px 12px; font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--panel-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
.table .num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.table tr.off td { opacity: .5; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { padding: 14px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--border); }
.tile .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile .v { margin-top: 4px; font-family: var(--mono); font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; padding: 14px; margin-bottom: 16px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { padding: 10px 14px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--primary); }
.perm-table td:not(:first-child), .perm-table th:not(:first-child) { text-align: center; }
.perm-table input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ---------- Carta ---------- */
.carta-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.carta-cat { padding: 16px; }
.carta-cat h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.carta-item { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px dashed var(--border); }
.carta-item:first-of-type { border-top: 0; }
.carta-item .d { font-size: 12px; color: var(--muted); }
.carta-item .p { font-family: var(--mono); font-weight: 800; white-space: nowrap; }
.menu-dia {
  border-radius: 16px; padding: 22px; color: #3a2510; text-align: center;
  background: linear-gradient(180deg, #f7ecd6, #efdfc0); border: 1px solid #d9c39b;
}
.menu-dia h3 { margin: 0; font-size: 24px; font-weight: 900; letter-spacing: .04em; color: #1f3a6e; }
.menu-dia .fecha { font-size: 13px; color: #7a5a35; margin-bottom: 10px; }
.menu-dia h4 { margin: 14px 0 4px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: #9a3412; }
.menu-dia p { margin: 2px 0; font-size: 14px; }
.menu-dia .precio { margin-top: 16px; display: inline-block; padding: 8px 18px; border-radius: 999px; background: #1f3a6e; color: #fff; font-family: var(--mono); font-weight: 800; font-size: 20px; }
.menu-dia .nota { margin-top: 10px; font-size: 11.5px; color: #7a5a35; }
.laminas { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.lamina { border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--panel-2); }
.lamina img { width: 100%; height: 120px; object-fit: cover; display: block; background: var(--panel-3); }
.lamina div { padding: 8px 10px; font-size: 12px; }

/* ---------- Modales, avisos ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(3, 7, 15, .66); backdrop-filter: blur(2px); }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; border-radius: 16px; background: var(--panel); border: 1px solid var(--border-2); box-shadow: var(--shadow); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); }
.box { padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border); }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 13px; }
.kv b { font-family: var(--mono); }
.kv.big b { font-size: 20px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.confirm-box { padding: 14px; border-radius: 12px; border: 1px solid rgba(245, 165, 36, .55); background: rgba(245, 165, 36, .08); text-align: center; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border-2); box-shadow: var(--shadow); font-size: 13px; font-weight: 600; animation: in .2s ease-out; }
.toast.ok { border-color: rgba(25, 180, 122, .6); }
.toast.err { border-color: rgba(239, 68, 68, .7); }
@keyframes in { from { transform: translateY(8px); opacity: 0; } }
.alert { padding: 12px 14px; border-radius: 12px; font-size: 13px; border: 1px solid var(--border-2); background: var(--panel-2); margin: 12px 0; }
.alert-warn { border-color: rgba(234, 179, 8, .55); background: rgba(234, 179, 8, .08); }
.alert-danger { border-color: rgba(239, 68, 68, .6); background: rgba(239, 68, 68, .08); }

/* ---------- Login e instalador ---------- */
.login-page, .install-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 20% -10%, rgba(47, 111, 237, .18), transparent), var(--bg); }
.login-card { width: 100%; max-width: 400px; padding: 28px; border-radius: 18px; background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.install-card { width: 100%; max-width: 760px; padding: 28px; border-radius: 18px; background: var(--panel); border: 1px solid var(--border); }
.install-card h1 { margin: 0 0 6px; font-size: 22px; }
.install-card h2 { margin: 26px 0 10px; font-size: 15px; }
.install-form { display: flex; flex-direction: column; gap: 12px; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 13px; }
.checks .ok { color: #34d399; } .checks .bad { color: #f87171; font-weight: 700; }
.install-list { margin: 8px 0 14px; }
.radios { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 1440px) {
  .topnav .navgroup.secondary { display: none; }
}
@media (max-width: 1280px) {
  .mesas-grid { grid-template-columns: minmax(0, 1fr) minmax(340px, .9fr); }
}
@media (max-width: 1080px) {
  .mesas-grid, .carta-grid, .dual { grid-template-columns: 1fr; }
  .body, .body.collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 64px; z-index: 50; width: 260px; transform: translateX(-100%); transition: transform .2s; background: var(--bg); }
  .body.drawer .sidebar { transform: none; box-shadow: var(--shadow); }
  .body.drawer .backdrop { display: block; position: fixed; inset: 64px 0 0; background: rgba(0, 0, 0, .45); z-index: 45; }
  .body.collapsed .side-link span, .body.collapsed .side-group h6, .body.collapsed .side-title { display: initial; }
  .body.collapsed .side-link { justify-content: flex-start; padding: 10px 12px; }
  .topnav { display: none; }
}
@media (max-width: 640px) {
  .main { padding: 12px; }
  .topbar { gap: 8px; padding: 0 10px; }
  .brand > span:last-child, .role-chip, .conn span { display: none; }
  .user-btn span { display: none; }
  .canvas { height: 460px; min-width: 680px; }
  .mesas-top .legend { display: none; }
  .products { grid-template-columns: 1fr 1fr; max-height: 360px; }
  .tipos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .mesas-grid { grid-template-columns: 1fr; }
  .plan-foot .info { margin-left: 0; width: 100%; }
  .modal-wrap { padding: 0; align-items: end; }
  .modal { max-height: 92vh; border-radius: 16px 16px 0 0; }
}

/* ---------- Impresión de tickets ---------- */
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { position: absolute; left: 0; top: 0; }
}
