/* === Gesvendi — estilos === */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --primary: #0e7490;
  --primary-600: #0891b2;
  --primary-700: #155e75;
  --primary-50: #ecfeff;
  --accent: #14b8a6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-50: #fef2f2;
  --info: #3b82f6;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 4px 12px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.12);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --sidebar-w: 232px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-600); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* === LOGIN === */
.login-screen {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #0e7490 0%, #0891b2 50%, #14b8a6 100%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 8px;
}
.brand-logo {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 22px;
  box-shadow: var(--shadow);
}
.brand-logo.small { width: 32px; height: 32px; font-size: 16px; border-radius: 8px; }
.brand-title { font-size: 18px; font-weight: 600; }
.brand-subtitle { color: var(--text-muted); font-size: 13px; }
.login-hint {
  text-align: center;
  color: var(--text-soft);
  font-size: 12px;
  margin-top: 4px;
}
.error {
  background: var(--danger-50);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* === FORM PRIMITIVES === */
.field {
  display: flex; flex-direction: column; gap: 6px;
}
.field > span,
.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(8,145,178,.15);
}
input[readonly], input:disabled, select:disabled {
  background: var(--surface-2);
  color: var(--text-muted);
}
textarea { resize: vertical; min-height: 60px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.check {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px;
}
.check input { width: 16px; height: 16px; margin: 0; }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary-600); color: #fff; }
.btn-primary:hover { background: var(--primary); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #0d9488; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-outline { background: transparent; border-color: var(--border-strong); }
.btn-outline:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon {
  padding: 6px;
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
}

/* === APP SHELL === */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
}
.sidebar {
  background: linear-gradient(180deg, #0e7490 0%, #155e75 100%);
  color: #e0f2fe;
  display: flex; flex-direction: column;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand-text {
  font-weight: 600;
  font-size: 16px;
  color: #fff;
}
.side-nav {
  flex: 1; overflow-y: auto;
  padding: 12px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.78);
  cursor: pointer;
  font-size: 14px;
  transition: background .15s, color .15s;
  border: none;
  background: transparent;
  text-align: left;
}
.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.nav-item.active {
  background: rgba(255,255,255,.15);
  color: #fff;
  font-weight: 500;
}
.nav-item .nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-item .nav-shortcut {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.nav-item:hover .nav-shortcut, .nav-item.active .nav-shortcut {
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.18);
}
@media (max-width: 1000px) and (min-width: 721px) {
  .nav-item .nav-shortcut { display: none; }
}
.nav-icon {
  width: 18px; height: 18px;
  display: inline-grid; place-items: center;
  opacity: 0.9;
}
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 13px;
}
.user-name { color: #fff; font-size: 13px; font-weight: 500; }
.user-role { color: rgba(255,255,255,.6); font-size: 11px; }
.sidebar-footer .btn-ghost {
  color: rgba(255,255,255,.85);
}
.sidebar-footer .btn-ghost:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.main {
  display: flex; flex-direction: column;
  overflow: hidden;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-titles { min-width: 0; }
.topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.topbar-right { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* hamburger button — oculto en escritorio */
.btn-menu {
  display: none;
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  place-items: center;
}
.btn-menu:hover { background: var(--surface-2); }
.btn-menu svg { width: 20px; height: 20px; }

/* backdrop del cajon lateral en mobile */
.menu-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 80;
}
.rate-chip {
  background: var(--primary-50);
  color: var(--primary-700);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.view {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* === MAIN MENU TILES === */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all .18s;
  display: flex; flex-direction: column; gap: 10px;
  position: relative;
  overflow: hidden;
  text-align: left;
  font-family: inherit;
  color: inherit;
}
.tile::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--primary-600);
  opacity: 0.7;
  transition: opacity .18s;
}
.tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary-600);
}
.tile:hover::before { opacity: 1; }
.tile-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--primary-50);
  color: var(--primary-700);
  display: grid; place-items: center;
}
.tile-shortcut {
  position: absolute;
  top: 10px; right: 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  letter-spacing: 0.05em;
  line-height: 1.4;
}
.tile:hover .tile-shortcut {
  background: var(--primary-50);
  color: var(--primary-700);
  border-color: var(--primary-600);
}
:root[data-theme="dark"] .tile-shortcut {
  background: rgba(255,255,255,0.04);
}
.tile-title { font-size: 15px; font-weight: 600; }
.tile-desc { font-size: 12px; color: var(--text-muted); }

/* tile color variants */
.tile.accent::before { background: var(--accent); }
.tile.accent .tile-icon { background: #ccfbf1; color: #0f766e; }
.tile.warning::before { background: var(--warning); }
.tile.warning .tile-icon { background: #fef3c7; color: #b45309; }
.tile.info::before { background: var(--info); }
.tile.info .tile-icon { background: #dbeafe; color: #1d4ed8; }
.tile.danger::before { background: var(--danger); }
.tile.danger .tile-icon { background: #fee2e2; color: #b91c1c; }

/* === PAGE / CARD === */
.page-actions {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.page-actions .spacer { flex: 1; }
/* Etiquetas de campo dentro de page-actions: layout inline (label al lado del input) */
.page-actions label.field {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.page-actions label.field > span {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-muted);
  white-space: nowrap;
}
.page-actions label.field input { margin: 0; }
.page-actions label.check { margin: 0; }
.search-box {
  position: relative;
  min-width: 240px;
}
.search-box input { padding-left: 32px; width: 100%; }
.search-box::before {
  content: "🔍";
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-size: 12px;
  pointer-events: none;
  opacity: 0.6;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 10px;
}

/* === TABLE === */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.table th,
table.table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.table th {
  background: var(--surface-2);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
table.table tbody tr:last-child td { border-bottom: none; }
table.table tbody tr:hover { background: var(--surface-2); }
table.table td.num,
table.table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.table td.center,
table.table th.center { text-align: center; }
.row-actions {
  display: inline-flex; gap: 4px;
}

.empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
}
.empty-icon { font-size: 32px; margin-bottom: 8px; opacity: 0.5; }

/* === BADGES === */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-muted);
}
.badge.success { background: #d1fae5; color: #065f46; }
.badge.warning { background: #fef3c7; color: #92400e; }
.badge.danger { background: #fee2e2; color: #991b1b; }
.badge.info { background: #dbeafe; color: #1e40af; }
.badge.primary { background: var(--primary-50); color: var(--primary-700); }

/* === MODAL === */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  display: grid; place-items: center;
  z-index: 100;
  padding: 24px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 600px;
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: pop .18s ease;
  /* min-height: 0 es necesario para que flex children con overflow funcionen */
  min-height: 0;
  /* overflow:hidden previene que CUALQUIER contenido interno se salga del
     modal (clave en móvil donde tablas anchas estaban empujando el modal) */
  overflow: hidden;
}
.modal.wide { max-width: 900px; }
.modal.xl { max-width: 1200px; }
/* Header y footer son altura fija; body se estira y scrollea */
.modal-header { flex-shrink: 0; }
.modal-footer { flex-shrink: 0; }
.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;  /* contenido horizontal debe scrollear DENTRO de table-wrap */
}
@keyframes pop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  background: transparent; border: none;
  font-size: 20px; color: var(--text-muted);
  cursor: pointer;
  width: 30px; height: 30px;
  border-radius: 6px;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* === TOAST === */
#toast-root {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  animation: slideIn .18s ease;
  pointer-events: auto;
}
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast.success { background: var(--success); }
.toast.danger { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* === POS / FACTURACION (estilo punto de venta moderno) === */
.pos-layout {
  display: flex; flex-direction: column;
  gap: 14px;
  padding-bottom: 80px; /* espacio para action bar sticky */
}
.pos-header {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  overflow: hidden;
  padding: 0;
}
.pos-header-form {
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.pos-header-totals {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.pos-factura-num-wrap { display: flex; flex-direction: column; gap: 2px; }
.pos-num-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
  color: rgba(255,255,255,.85);
}
.pos-factura-num {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.pos-totals-rows {
  display: flex; flex-direction: column; gap: 5px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.18);
}
.pos-totals-rows > div {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px;
  color: rgba(255,255,255,.88);
}
.pos-totals-rows > div .num {
  font-variant-numeric: tabular-nums;
}
.pos-totals-rows > div.big {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  border-top: 1px solid rgba(255,255,255,.2);
  padding-top: 8px;
  margin-top: 4px;
}

/* Bloque "EQUIVALE A" (moneda base) en panel de totales */
.pos-totals-base {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255,255,255,.3);
  display: flex; flex-direction: column; gap: 4px;
}
.pos-totals-base-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.65);
  margin-bottom: 2px;
}
.pos-totals-base > div:not(.pos-totals-base-label) {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px;
  color: rgba(255,255,255,.75);
}
.pos-totals-base > div.big {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
}

/* Contadores renglones / artículos al pie */
.pos-totals-counts {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.15);
  display: flex; flex-direction: column; gap: 4px;
}
.pos-totals-counts > div {
  display: flex; justify-content: space-between;
  font-size: 12px;
  color: rgba(255,255,255,.7);
}

/* === TINTAS DE COLUMNAS DE MONEDA EN EL GRID DE VENTAS === */
table.table th.col-tint-base,
table.table td.col-tint-base {
  background: rgba(8, 145, 178, 0.06);
}
table.table th.col-tint-act,
table.table td.col-tint-act {
  background: rgba(245, 158, 11, 0.07);
}
table.table tbody tr:hover td.col-tint-base { background: rgba(8, 145, 178, 0.11); }
table.table tbody tr:hover td.col-tint-act { background: rgba(245, 158, 11, 0.14); }
:root[data-theme="dark"] table.table th.col-tint-base,
:root[data-theme="dark"] table.table td.col-tint-base {
  background: rgba(34, 211, 238, 0.06);
}
:root[data-theme="dark"] table.table th.col-tint-act,
:root[data-theme="dark"] table.table td.col-tint-act {
  background: rgba(252, 211, 77, 0.07);
}
:root[data-theme="dark"] table.table tbody tr:hover td.col-tint-base { background: rgba(34, 211, 238, 0.12); }
:root[data-theme="dark"] table.table tbody tr:hover td.col-tint-act { background: rgba(252, 211, 77, 0.13); }

/* === RECIBO ESTILO SENIAT === */
.rcpt-wrap {
  background: #fff;
  color: #000;
  padding: 20px;
  border-radius: var(--radius-sm);
}
.receipt {
  font-family: ui-monospace, "Courier New", Menlo, Consolas, monospace;
  font-size: 12px;
  max-width: 360px;
  margin: 0 auto;
  color: #000;
  line-height: 1.5;
}
/* Plantillas de impresión */
.receipt.receipt-termica {
  max-width: 280px; font-size: 11px; line-height: 1.35;
}
.receipt.receipt-termica58 {
  max-width: 210px; font-size: 10px; line-height: 1.3;
}
.receipt.receipt-carta {
  max-width: 760px; font-size: 13px; line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
  padding: 20px 30px;
}
.receipt.receipt-carta .rcpt-line { border-top-style: solid; border-top-color: #999; }
.receipt.receipt-carta .rcpt-bold { font-weight: 600; }
.receipt.receipt-carta .rcpt-total { font-size: 18px; padding: 6px 0; border-top: 2px solid #000; border-bottom: 2px solid #000; margin: 8px 0; }
.receipt.receipt-a5 {
  max-width: 540px; font-size: 12px; line-height: 1.45;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
  padding: 14px 20px;
}
.receipt.receipt-a5 .rcpt-line { border-top-style: solid; border-top-color: #999; }
.receipt.receipt-a5 .rcpt-total { font-size: 16px; border-top: 1px solid #000; border-bottom: 1px solid #000; padding: 5px 0; margin: 6px 0; }
.rcpt-center { text-align: center; }
.rcpt-bold { font-weight: 700; }
.rcpt-line {
  border-top: 1px dashed #555;
  margin: 6px 0;
}
.rcpt-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}
/* La descripción (1er span) puede encoger y partir palabras; el precio (último)
   nunca se encoge ni parte — así no se corta a la derecha en térmicas angostas. */
.rcpt-row > span:first-child { min-width: 0; word-break: break-word; }
.rcpt-row > span:last-child { white-space: nowrap; flex-shrink: 0; }
.rcpt-sub {
  font-size: 11px;
  color: #555;
  padding-left: 12px;
}
.rcpt-total {
  font-size: 14px;
}

/* Impresión: cuando hay modal abierto (recibo de factura), imprimir solo el modal */
@media print {
  /* CRÍTICO para térmicas: el body tiene height:100% que en impresión fuerza
     el largo de toda la página (papel en blanco). Forzamos altura automática
     para que el ticket use SOLO el largo del contenido y la térmica corte ahí. */
  html, body {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  body.modal-open .app-shell { display: none !important; }
  body.modal-open #boot-splash,
  body.modal-open #offline-banner,
  body.modal-open #demo-banner,
  body.modal-open #toast-root { display: none !important; }
  body.modal-open .modal-backdrop {
    position: static !important;
    background: none !important;
    padding: 0 !important;
    display: block !important;
    inset: auto !important;
    animation: none !important;
    height: auto !important;
  }
  body.modal-open .modal {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    max-height: none !important;
    height: auto !important;
    margin: 0 !important;
    animation: none !important;
  }
  body.modal-open .modal-header,
  body.modal-open .modal-footer { display: none !important; }
  body.modal-open .modal-body {
    padding: 0 !important;
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
  }
  .rcpt-wrap { padding: 0 !important; height: auto !important; }
  .receipt { max-width: 100% !important; height: auto !important; }
  @page { margin: 8mm; }
}

/* === PALETA DE COMANDOS === */
.cmd-palette { display: flex; flex-direction: column; gap: 10px; }
.cmd-palette > input {
  font-size: 16px;
  padding: 12px 14px;
}
.cmd-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 380px;
  overflow-y: auto;
  margin: 0 -4px;
}
.cmd-item {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
  font-size: 14px;
}
.cmd-item:hover { background: var(--surface-2); }
.cmd-item.selected {
  background: var(--primary-50);
  border-color: var(--primary-600);
  color: var(--primary-700);
}
.cmd-label { font-weight: 500; }
.cmd-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-soft);
}
.cmd-item.selected .cmd-hint { color: var(--primary-700); }

/* Conversión por item (líneas pequeñas debajo del valor principal) */
.num-base {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
/* Celdas con input + conversiones apiladas */
.cell-with-conv {
  display: table-cell;
  vertical-align: top;
}
.cell-with-conv .cell-input { display: block; margin-left: auto; }
.cell-with-conv .num-base { text-align: right; }

.pos-row-label {
  display: flex; flex-direction: column; gap: 4px;
}
.pos-row-label > span:first-child {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rif-row {
  display: grid;
  grid-template-columns: 36px 170px 1fr;
  gap: 8px;
  align-items: stretch;
}
.rif-row .btn-icon { height: auto; }

.pos-row-3 {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
}
.pos-readonly {
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  min-height: 38px;
  display: flex; align-items: center;
}

.pos-items .card-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
}
.fkey-hints {
  font-size: 11px;
  color: var(--text-muted);
  display: flex; gap: 6px; align-items: center;
  flex-wrap: wrap;
}
.fkey-hints kbd {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text);
}

.pos-quick-add {
  display: grid;
  /* 3ra columna = 84px para los DOS botones (lupa + escanear) sin que se tapen */
  grid-template-columns: 110px 1fr 84px 80px 110px auto;
  gap: 8px;
  align-items: end;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
/* Contenedor de los botones lupa+escanear: que ambos quepan lado a lado */
.pos-quick-add > div > .btn-icon { flex: 0 0 auto; }

.cell-input {
  width: 80px;
  padding: 4px 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.pos-items-table table.table td { padding: 8px 12px; }
.pos-items-table .empty-row td {
  padding: 30px 14px;
  text-align: center;
  color: var(--text-muted);
}

.pos-pagos-list { display: flex; flex-direction: column; gap: 8px; }
.pos-pago-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* Tarjeta de pago ya agregado */
.pago-card {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s;
}
.pago-card:hover { border-color: var(--border-strong); }
.pago-card-num {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary-700);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 13px;
}
.pago-card-info { display: flex; flex-direction: column; gap: 2px; }
.pago-card-name { font-size: 14px; font-weight: 600; }
.pago-card-amt { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Resumen de pagos: pagado / total / diferencia */
.pago-summary {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.pago-summary .sep { color: var(--text-soft); }
.pago-summary.ok { background: #d1fae5; color: #065f46; }
.pago-summary.warn { background: #fef3c7; color: #92400e; }
:root[data-theme="dark"] .pago-summary.ok { background: #064e3b; color: #6ee7b7; }
:root[data-theme="dark"] .pago-summary.warn { background: #78350f; color: #fcd34d; }

/* Grid de instrumentos en modal (paso 1) */
.instrumento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.instrumento-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 22px 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: all .15s;
  text-align: center;
}
.instrumento-card:hover {
  border-color: var(--primary-600);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.instrumento-num {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary-50);
  color: var(--primary-700);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 18px;
}
.instrumento-name {
  font-size: 14px;
  font-weight: 500;
}

/* Píldora del instrumento en modal de monto (paso 2) */
.monto-instr-pill {
  display: flex; align-items: center; gap: 14px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--radius);
  margin-bottom: 14px;
}
.monto-info {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.monto-info-val {
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* barra de acciones fija al fondo de la vista */
.pos-action-bar {
  position: sticky;
  bottom: 0;
  display: flex; gap: 8px; align-items: center;
  padding: 14px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 14px rgba(0,0,0,.06);
  margin: 14px -24px -24px;
  z-index: 10;
}

/* responsivo POS */
@media (max-width: 900px) {
  .pos-header { grid-template-columns: 1fr; }
  .pos-row-3 { grid-template-columns: 1fr; }
  .rif-row { grid-template-columns: 36px 1fr; }
  .rif-row > input:last-child { grid-column: 1 / -1; }
  .pos-quick-add {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .pos-quick-add .btn-icon { grid-column: span 2; height: 38px; }
  .pos-quick-add > .btn { grid-column: span 2; }
}
@media (max-width: 720px) {
  .pos-action-bar { margin: 14px -14px -14px; padding: 12px 14px; }
  .pos-action-bar .btn { padding: 8px 12px; }
}

/* === LAYOUT VIEJO (compras y otras pantallas que aun lo usan) === */
.invoice-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  align-items: start;
}
.invoice-main { display: flex; flex-direction: column; gap: 14px; }
.invoice-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; }
.totals-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.totals-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 4px 0;
  font-size: 13px;
  color: rgba(255,255,255,.85);
}
.totals-row.big {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  border-top: 1px solid rgba(255,255,255,.2);
  padding-top: 10px;
  margin-top: 6px;
}
.totals-row .num { font-variant-numeric: tabular-nums; }

.line-add {
  display: grid;
  grid-template-columns: 2fr 90px 110px 110px auto;
  gap: 8px;
  align-items: end;
}
/* Línea de compra con buscador + código de barras (5 columnas distintas) */
.line-add-compra {
  grid-template-columns: 2fr 1.4fr 90px 110px auto;
}
@media (max-width: 720px) {
  .line-add-compra { grid-template-columns: 1fr; }
}

.kbd-hint {
  font-size: 11px; color: var(--text-soft);
  margin-top: 4px;
}

/* === TABS === */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  padding: 9px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--primary-700);
  border-bottom-color: var(--primary-600);
}

/* === STATS === */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* permissions grid */
.perm-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  max-height: 380px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.perm-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.perm-row:hover { background: var(--surface-2); }

/* switch */
.switch {
  position: relative;
  width: 38px; height: 22px;
  background: var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
  box-shadow: var(--shadow-sm);
}
.switch.on { background: var(--success); }
.switch.on::after { transform: translateX(16px); }

/* === RESPONSIVE === */

/* Tablet: sidebar a iconos */
@media (max-width: 1000px) and (min-width: 721px) {
  .app-shell { grid-template-columns: 64px 1fr; }
  .sidebar-brand-text, .nav-item span:not(.nav-icon), .user-meta { display: none; }
  .sidebar-footer .btn-sm { padding: 6px; width: 32px; height: 32px; }
  .sidebar-footer .btn-sm { font-size: 0; }
  .sidebar-footer .btn-sm::before { content: "⏻"; font-size: 14px; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .invoice-layout { grid-template-columns: 1fr; }
  .invoice-side { position: static; }
  .line-add { grid-template-columns: 1fr 1fr; }
}

/* Celular: sidebar como cajon, mas compacto */
@media (max-width: 720px) {
  /* SAFETY NET contra overflow horizontal en móvil — sin romper tablas */
  html, body { overflow-x: hidden; max-width: 100vw; width: 100vw; }
  /* NO usar body * { max-width: 100% !important } porque rompe modales y tablas.
     En cambio, constreñir elementos específicos que sí pueden crecer. */
  img, video, canvas, svg { max-width: 100%; height: auto; }
  /* Tablas NO se modifican (mantienen comportamiento natural).
     El scroll horizontal lo da .table-wrap que ya las envuelve. */
  .table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
  pre, code { overflow-x: auto; word-break: break-word; white-space: pre-wrap; max-width: 100%; }
  input, textarea, select { max-width: 100%; box-sizing: border-box; }
  /* Inputs solo width: 100% en grids/forms — no en TODOS los inputs (rompería buscadores) */
  .form-grid input, .form-grid select, .form-grid textarea,
  .form-grid-2 input, .form-grid-2 select, .form-grid-2 textarea,
  .pos-quick-add input, .pos-quick-add select,
  .pos-header-form input { width: 100%; }
  /* CRUCIAL: todos los hijos de cualquier CSS Grid deben poder shrinkar.
     Sin esto, los inputs y elementos con min-content crecen fuera del grid. */
  [class*="grid"] > *, .pos-quick-add > *, .pos-header > *,
  .form-grid > *, .form-grid-2 > *, .form-grid-3 > *,
  .rif-row > *, .pos-row-3 > *, .tiles > *, .stats-row > * {
    min-width: 0;
  }
  .stat-card, .card, .tile { min-width: 0; }
  .page-actions { flex-wrap: wrap; }
  .modal-body { overflow-x: hidden; word-wrap: break-word; }
  .topbar-right { flex-wrap: wrap; gap: 6px; }

  /* POS específico — fix de inputs que se desbordan */
  .pos-quick-add {
    grid-template-columns: 1fr !important;  /* todo apilado en móvil */
    gap: 10px;
  }
  .pos-quick-add > * { width: 100%; }
  .pos-quick-add .btn-icon { width: 100% !important; height: 40px; }

  /* Inputs dentro del POS: respetar el ancho de su contenedor */
  .pos-header-form input,
  .pos-header-form select,
  .pos-quick-add input,
  .pos-quick-add select {
    width: 100%;
    min-width: 0;
  }

  /* Cards del POS: sin padding lateral extremo */
  .pos-header-form,
  .pos-header-totals,
  .card-body {
    padding: 14px;
  }

  /* Si pos-header tiene 2 columnas, ya el media de 900px lo apila */
  .pos-header { grid-template-columns: 1fr; }

  .app-shell { grid-template-columns: 1fr; }

  /* sidebar drawer */
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    width: 250px;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
  }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open .menu-backdrop { display: block; }

  /* boton hamburguesa visible */
  .btn-menu { display: inline-grid; }

  /* bloquear scroll del fondo cuando el cajon esta abierto */
  body.menu-open { overflow: hidden; }

  /* topbar compacto */
  .topbar { padding: 10px 14px; }
  .topbar h1 { font-size: 15px; }
  .breadcrumb { display: none; }
  .rate-chip { display: none; }
  .theme-toggle { width: 32px; height: 32px; }
  .theme-toggle svg { width: 16px; height: 16px; }

  /* vista mas compacta */
  .view { padding: 14px; }

  /* mosaicos en 2 columnas */
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 14px; }
  .tile-title { font-size: 14px; }
  .tile-desc { font-size: 11px; }
  .tile-icon { width: 30px; height: 30px; }

  /* estadisticas en 2 columnas */
  .stats-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px 14px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 10px; }

  /* formularios apilados */
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; gap: 12px; }

  /* factura apilada y sin sticky */
  .invoice-layout { grid-template-columns: 1fr; }
  .invoice-side { position: static; order: 2; }
  .line-add { grid-template-columns: 1fr; gap: 8px; }

  /* tablas: celdas mas chicas y scroll horizontal evidente */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  table.table th, table.table td { padding: 8px 10px; font-size: 12px; }
  table.table th { font-size: 10px; }

  /* page actions stack si hace falta */
  .page-actions { gap: 8px; }
  .search-box { min-width: 0; width: 100%; }

  /* botones mas compactos */
  .btn { padding: 8px 12px; font-size: 13px; }
  .btn-lg { padding: 10px 16px; font-size: 14px; }

  /* modales casi pantalla completa */
  .modal-backdrop { padding: 8px; }
  .modal {
    max-width: 100%;
    /* svh = "small viewport height": altura sin contar URL bar del navegador
       (cuando está visible). Garantiza que el modal CABE en pantalla en móvil
       sin que se corte el header o footer detrás de la URL bar. */
    max-height: calc(100vh - 16px);
    max-height: calc(100svh - 16px);
  }
  .modal-header, .modal-footer { padding: 12px 14px; }
  .modal-body { padding: 14px; }
  .modal-title { font-size: 15px; }

  /* login */
  .login-card { padding: 22px; border-radius: 12px; }
  .brand-title { font-size: 17px; }

  /* totals card menos llamativo */
  .totals-card { padding: 14px; }
  .totals-row.big { font-size: 20px; }

  /* perm grid: mas espacio */
  .perm-grid { max-height: 280px; }

  /* notas */
  .note-card { grid-template-columns: 1fr; gap: 10px; padding: 12px 14px; }
  .note-actions { flex-wrap: wrap; }
  .note-title { font-size: 14px; }

  /* tabs scrollables */
  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tab { flex-shrink: 0; padding: 9px 12px; font-size: 13px; }
}

/* Telefonos muy chicos */
@media (max-width: 380px) {
  .tiles { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .view { padding: 10px; }
}

/* === IMPRESION === Reglas comunes (al final de styles.css hay reglas mas especificas) === */
@media print {
  body { background: #fff !important; }
  .sidebar, .topbar, .pos-action-bar, .no-print, #toast-root, #menu-backdrop { display: none !important; }
  .view { padding: 0 !important; overflow: visible !important; }
  .app-shell { display: block !important; height: auto !important; grid-template-columns: 1fr !important; }
}

/* === BOTONES ICONO EN TOPBAR (search, stock alert) === */
.topbar-iconbtn {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-grid; place-items: center;
  transition: background .15s, color .15s, border-color .15s;
}
.topbar-iconbtn:hover { background: var(--surface-2); color: var(--text); }
.topbar-iconbtn svg { width: 18px; height: 18px; }
.topbar-iconbtn.warning {
  background: rgba(245,158,11,.1);
  color: var(--warning);
  border-color: rgba(245,158,11,.3);
}
.topbar-iconbtn.warning:hover { background: rgba(245,158,11,.2); }
.topbar-iconbtn.spinning svg { animation: spin-360 0.8s linear infinite; }
@keyframes spin-360 { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* === BARRA DE ACCIONES MASIVAS (multi-select) === */
.bulk-action-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--primary-50);
  border: 1px solid var(--primary-600);
  border-radius: var(--radius-sm);
  margin: 10px 0;
  color: var(--primary-700);
}
.bulk-action-bar .spacer { flex: 1; min-width: 8px; }
:root[data-theme="dark"] .bulk-action-bar {
  background: rgba(14, 116, 144, .2);
  border-color: var(--primary-600);
}

/* === LISTA DE BÚSQUEDA DE PRODUCTOS (cards tappables) === */
.producto-search-list {
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.producto-search-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
  min-width: 0;
  -webkit-tap-highlight-color: rgba(8,145,178,.15);
}
.producto-search-card:last-child { border-bottom: none; }
.producto-search-card:hover { background: var(--surface-2); }
.producto-search-card:active { background: var(--primary-50); }
.producto-search-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.producto-search-nombre {
  font-weight: 600; font-size: 14px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.producto-search-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.producto-search-codigo {
  font-family: ui-monospace, monospace; font-size: 11px;
  background: var(--surface-2); color: var(--text-muted);
  padding: 2px 8px; border-radius: 4px;
}
.producto-search-precio {
  font-weight: 700; font-size: 15px; color: var(--primary-700);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 720px) {
  .producto-search-card { padding: 14px; }
  .producto-search-nombre { font-size: 15px; }
  .producto-search-precio { font-size: 16px; }
}
.stock-badge {
  position: absolute;
  top: -2px; right: -2px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  display: grid; place-items: center;
}
@media (max-width: 720px) {
  .topbar-iconbtn { width: 32px; height: 32px; }
  .topbar-iconbtn svg { width: 16px; height: 16px; }
}

/* === BANNER DE COTIZACIÓN === */
.cotizacion-banner {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #fbbf24;
  border-left: 4px solid #f59e0b;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 14px;
  color: #78350f;
}
.cotizacion-banner-title { font-weight: 700; font-size: 15px; }
.cotizacion-banner-desc { font-size: 13px; margin-top: 4px; line-height: 1.5; }
:root[data-theme="dark"] .cotizacion-banner {
  background: linear-gradient(135deg, #422a0c, #523213);
  border-color: #f59e0b;
  color: #fcd34d;
}
:root[data-theme="sepia"] .cotizacion-banner {
  background: linear-gradient(135deg, #f0dba8, #e8c373);
  border-color: #a67323;
  color: #5a3a0e;
}

/* === BADGE DE VENCIMIENTO EN CXC === */
.vencimiento-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.vencimiento-badge.al-dia { background: #d1fae5; color: #065f46; }
.vencimiento-badge.por-vencer { background: #fef3c7; color: #92400e; }
.vencimiento-badge.vencida { background: #fee2e2; color: #991b1b; }
:root[data-theme="dark"] .vencimiento-badge.al-dia { background: #064e3b; color: #6ee7b7; }
:root[data-theme="dark"] .vencimiento-badge.por-vencer { background: #78350f; color: #fcd34d; }
:root[data-theme="dark"] .vencimiento-badge.vencida { background: #7f1d1d; color: #fca5a5; }

/* === MINI-DASHBOARD (gráficos SVG en Inicio) === */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.dash-card h3 {
  margin: 0 0 12px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dash-chart svg { display: block; width: 100%; height: 140px; }
.dash-bar { fill: var(--primary-600); }
.dash-bar:hover { fill: var(--primary); }
.dash-axis text { fill: var(--text-soft); font-size: 10px; font-family: var(--mono); }
.dash-list { display: flex; flex-direction: column; gap: 8px; }
.dash-list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.dash-list-bar-wrap {
  position: relative;
  height: 22px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.dash-list-bar {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: linear-gradient(90deg, var(--primary-600), var(--accent));
}
.dash-list-name { padding-left: 8px; line-height: 22px; position: relative; z-index: 1; font-weight: 500; }
.dash-list-val { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 12px; }

/* === MODO TÁCTIL === */
body.touch-mode .btn,
body.touch-mode button.btn { padding: 12px 18px; font-size: 15px; min-height: 44px; }
body.touch-mode .btn-sm { padding: 8px 14px; font-size: 13px; min-height: 36px; }
body.touch-mode input, body.touch-mode select, body.touch-mode textarea {
  padding: 12px 14px; font-size: 15px; min-height: 44px;
}
body.touch-mode .cell-input { padding: 8px 10px; font-size: 14px; min-height: 36px; }
body.touch-mode .tile { padding: 24px; }
body.touch-mode .nav-item { padding: 12px 14px; font-size: 15px; }
body.touch-mode table.table th,
body.touch-mode table.table td { padding: 14px 16px; font-size: 14px; }

/* === BÚSQUEDA GLOBAL (dropdown bajo el input) === */
.search-results {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 360px; overflow-y: auto;
  margin-top: 8px;
}
.search-result-group {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  padding: 8px 10px 4px;
  font-weight: 600;
}
.search-result-item {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  font-size: 13px;
  text-align: left;
}
.search-result-item:hover { background: var(--surface-2); }
.search-result-item.selected {
  background: var(--primary-50);
  border-color: var(--primary-600);
  color: var(--primary-700);
}
.search-result-meta { font-size: 11px; color: var(--text-soft); font-family: var(--mono); }

/* === CHIP TASA DE CAMBIO (TOPBAR) === */
.rate-chip-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.rate-chip-btn:hover { border-color: var(--primary-600); }
.rate-chip-label { opacity: 0.75; font-weight: 500; }
.rate-chip-value { font-weight: 600; font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .rate-chip-btn {
  background: var(--surface-2);
  color: var(--primary-700);
  border-color: var(--border);
}
@media (max-width: 720px) {
  .rate-chip-label { display: none; }
  .rate-chip-btn { padding: 4px 10px; font-size: 11px; }
}

/* Conversión en vivo dentro del modal de monto */
.monto-conv-preview {
  margin-top: 8px;
  font-size: 13px;
  color: var(--primary-700);
  font-variant-numeric: tabular-nums;
  min-height: 16px;
}
.monto-conv-preview strong { color: var(--text); }

/* Línea de conversión en tarjeta de pago divisa */
.pago-card-conv {
  font-size: 11px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.pago-card-credit {
  background: rgba(245, 158, 11, 0.08);
  border-color: var(--warning);
}
.pago-card-credit .pago-card-num {
  background: var(--warning);
  color: #fff;
}

/* === PANEL DE CRÉDITO DEL CLIENTE === */
.credit-panel {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.credit-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.credit-panel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.credit-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.credit-cell-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.credit-cell-base {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.credit-cell-act {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.credit-cell-ok { border-color: var(--success); }
.credit-cell-ok .credit-cell-base { color: var(--success); }
.credit-cell-warning { border-color: var(--warning); }
.credit-cell-warning .credit-cell-base { color: var(--warning); }
.credit-cell-danger { border-color: var(--danger); }
.credit-cell-danger .credit-cell-base { color: var(--danger); }
@media (max-width: 720px) {
  .credit-panel-grid { grid-template-columns: 1fr; }
}

/* === THEME TOGGLE === */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.theme-toggle:hover {
  background: var(--surface-2);
  color: var(--text);
}
.theme-toggle svg { width: 18px; height: 18px; }

/* === NOTAS / ACTUALIZACIONES === */
.note-list {
  display: flex; flex-direction: column; gap: 10px;
}
.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
  align-items: start;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s;
}
.note-card:hover { border-color: var(--border-strong); }
.note-card.done { opacity: 0.6; }
.note-card.done .note-title { text-decoration: line-through; }
.note-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.note-title { font-weight: 600; font-size: 15px; }
.note-desc { color: var(--text-muted); font-size: 13px; white-space: pre-wrap; margin-top: 4px; }
.note-meta { color: var(--text-soft); font-size: 12px; margin-top: 6px; }
.note-actions { display: flex; gap: 4px; align-items: center; }
.priority-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-soft);
}
.priority-dot.alta { background: var(--danger); }
.priority-dot.media { background: var(--warning); }
.priority-dot.baja { background: var(--info); }

/* === SEPIA THEME (luz cálida, descansa la vista) === */
:root[data-theme="sepia"] {
  --bg: #f1e7ce;
  --surface: #faf3df;
  --surface-2: #ebe0c2;
  --border: #d9c89e;
  --border-strong: #b8a376;
  --text: #3d2e1c;
  --text-muted: #7a6448;
  --text-soft: #a8916a;
  --primary: #0e7490;
  --primary-600: #0e7490;
  --primary-700: #155e75;
  --primary-50: #d8e6dd;
  --accent: #b6603d;
  --success: #5f7a3a;
  --warning: #a67323;
  --danger: #a23a2a;
  --danger-50: #f3dad2;
  --info: #4a6e8a;
  --shadow-sm: 0 1px 2px rgba(95,70,30,.08);
  --shadow: 0 4px 12px rgba(95,70,30,.10), 0 1px 2px rgba(95,70,30,.06);
  --shadow-lg: 0 12px 32px rgba(95,70,30,.18);
}
:root[data-theme="sepia"] body { color-scheme: light; }

/* badges en sepia */
:root[data-theme="sepia"] .badge { background: #ebe0c2; color: #7a6448; }
:root[data-theme="sepia"] .badge.success { background: #dfe6c8; color: #4a5f2a; }
:root[data-theme="sepia"] .badge.warning { background: #f0dba8; color: #7a5318; }
:root[data-theme="sepia"] .badge.danger { background: #f0d4c8; color: #7a2a1a; }
:root[data-theme="sepia"] .badge.info { background: #d6dee4; color: #2c4a5e; }
:root[data-theme="sepia"] .badge.primary { background: #c8d8d2; color: #155e75; }

/* tile icons en sepia */
:root[data-theme="sepia"] .tile-icon { background: #ebe0c2; color: #7a4e2a; }
:root[data-theme="sepia"] .tile.accent .tile-icon { background: #e8c7a8; color: #7a4e2a; }
:root[data-theme="sepia"] .tile.warning .tile-icon { background: #f0dba8; color: #7a5318; }
:root[data-theme="sepia"] .tile.info .tile-icon { background: #d6dee4; color: #2c4a5e; }
:root[data-theme="sepia"] .tile.danger .tile-icon { background: #f0d4c8; color: #7a2a1a; }

/* inputs en sepia */
:root[data-theme="sepia"] input,
:root[data-theme="sepia"] select,
:root[data-theme="sepia"] textarea {
  background: #faf3df;
  color: var(--text);
  border-color: var(--border);
}
:root[data-theme="sepia"] input[readonly],
:root[data-theme="sepia"] input:disabled,
:root[data-theme="sepia"] select:disabled {
  background: var(--bg);
  color: var(--text-muted);
}

/* botones en sepia */
:root[data-theme="sepia"] .btn-primary { background: var(--primary-600); color: #faf3df; }
:root[data-theme="sepia"] .btn-success { background: var(--success); color: #faf3df; }
:root[data-theme="sepia"] .btn-danger { background: var(--danger); color: #faf3df; }
:root[data-theme="sepia"] .btn-accent { background: var(--accent); color: #faf3df; }

/* toast */
:root[data-theme="sepia"] .toast { background: #3d2e1c; color: #faf3df; }
:root[data-theme="sepia"] .toast.success { background: #5f7a3a; color: #faf3df; }
:root[data-theme="sepia"] .toast.danger { background: #a23a2a; color: #faf3df; }
:root[data-theme="sepia"] .toast.warning { background: #a67323; color: #faf3df; }

/* tarjeta de pago summary */
:root[data-theme="sepia"] .pago-summary.ok { background: #dfe6c8; color: #4a5f2a; }
:root[data-theme="sepia"] .pago-summary.warn { background: #f0dba8; color: #7a5318; }

/* vencimiento badges */
:root[data-theme="sepia"] .vencimiento-badge.al-dia { background: #dfe6c8; color: #4a5f2a; }
:root[data-theme="sepia"] .vencimiento-badge.por-vencer { background: #f0dba8; color: #7a5318; }
:root[data-theme="sepia"] .vencimiento-badge.vencida { background: #f0d4c8; color: #7a2a1a; }

/* === DARK THEME === */
:root[data-theme="dark"] {
  --bg: #0a0f1c;
  --surface: #131c2e;
  --surface-2: #1e2a40;
  --border: #2a3a55;
  --border-strong: #3a4d6b;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-soft: #64748b;
  --primary: #22d3ee;
  --primary-600: #06b6d4;
  --primary-700: #67e8f9;
  --primary-50: #164e63;
  --accent: #2dd4bf;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --danger-50: #4c1d1d;
  --info: #60a5fa;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 4px 12px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
}
:root[data-theme="dark"] body { color-scheme: dark; }

/* badges en dark */
:root[data-theme="dark"] .badge.success { background: #064e3b; color: #6ee7b7; }
:root[data-theme="dark"] .badge.warning { background: #78350f; color: #fcd34d; }
:root[data-theme="dark"] .badge.danger { background: #7f1d1d; color: #fca5a5; }
:root[data-theme="dark"] .badge.info { background: #1e3a8a; color: #93c5fd; }
:root[data-theme="dark"] .badge.primary { background: #164e63; color: #67e8f9; }

/* tile icon backgrounds en dark */
:root[data-theme="dark"] .tile-icon { background: var(--surface-2); color: var(--primary); }
:root[data-theme="dark"] .tile.accent .tile-icon { background: #134e4a; color: #2dd4bf; }
:root[data-theme="dark"] .tile.warning .tile-icon { background: #78350f; color: #fcd34d; }
:root[data-theme="dark"] .tile.info .tile-icon { background: #1e3a8a; color: #93c5fd; }
:root[data-theme="dark"] .tile.danger .tile-icon { background: #7f1d1d; color: #fca5a5; }

/* inputs en dark */
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
:root[data-theme="dark"] input[readonly],
:root[data-theme="dark"] input:disabled,
:root[data-theme="dark"] select:disabled {
  background: var(--bg);
  color: var(--text-muted);
}

/* toast en dark */
:root[data-theme="dark"] .toast { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
:root[data-theme="dark"] .toast.success { background: #064e3b; color: #6ee7b7; }
:root[data-theme="dark"] .toast.danger { background: #7f1d1d; color: #fca5a5; }
:root[data-theme="dark"] .toast.warning { background: #78350f; color: #fcd34d; }

/* search box icon en dark */
:root[data-theme="dark"] .search-box::before { opacity: 0.5; }

/* error box en dark */
:root[data-theme="dark"] .error {
  background: rgba(248,113,113,.15);
  color: #fca5a5;
}

/* rate chip en dark */
:root[data-theme="dark"] .rate-chip {
  background: var(--primary-50);
  color: var(--primary-700);
}

/* botones en dark — texto */
:root[data-theme="dark"] .btn { background: var(--surface-2); color: var(--text); border-color: var(--border); }
:root[data-theme="dark"] .btn:hover { background: var(--bg); }
:root[data-theme="dark"] .btn-ghost { background: transparent; border-color: transparent; }
:root[data-theme="dark"] .btn-ghost:hover { background: var(--surface-2); }
:root[data-theme="dark"] .btn-outline { background: transparent; }
:root[data-theme="dark"] .btn-primary { background: var(--primary-600); color: #0a0f1c; border-color: var(--primary-600); }
:root[data-theme="dark"] .btn-primary:hover { background: var(--primary); }
:root[data-theme="dark"] .btn-success { background: var(--success); color: #052e1a; }
:root[data-theme="dark"] .btn-danger { background: var(--danger); color: #4a0f0f; }
:root[data-theme="dark"] .btn-accent { background: var(--accent); color: #052e23; }

/* table en dark — quitar transparencias */
:root[data-theme="dark"] table.table tbody tr:hover { background: var(--surface-2); }

/* totals card mantiene gradiente con primary actual */
:root[data-theme="dark"] .totals-card {
  background: linear-gradient(135deg, var(--primary-50) 0%, #134e4a 100%);
}
:root[data-theme="dark"] .totals-row.big,
:root[data-theme="dark"] .totals-row {
  color: var(--primary-700);
}
:root[data-theme="dark"] .totals-row.big { color: #fff; border-top-color: rgba(255,255,255,.15); }
:root[data-theme="dark"] .totals-row span:first-child { color: rgba(255,255,255,.7); }

/* switch off en dark un poco mas visible */
:root[data-theme="dark"] .switch { background: var(--border-strong); }

/* ============================================================================
   MESAS — grilla de mesas del restaurant
   ============================================================================ */
.mesas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.mesa-card {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 18px 14px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: transform .1s, box-shadow .15s, border-color .15s;
  display: flex; flex-direction: column; gap: 4px;
}
.mesa-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15,23,42,.08);
}
.mesa-card.libre { border-color: #10b981; background: rgba(16,185,129,.04); }
.mesa-card.libre:hover { border-color: #059669; }
.mesa-card.ocupada { border-color: #f59e0b; background: rgba(245,158,11,.06); }
.mesa-card.ocupada:hover { border-color: #d97706; }

.mesa-nombre { font-weight: 700; font-size: 18px; }
.mesa-zona { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.mesa-cap { font-size: 13px; color: var(--muted); }
.mesa-estado { margin-top: 4px; }
.mesa-total { font-weight: 700; font-size: 14px; color: #92400e; margin-top: 4px; }

/* ============================================================================
   TABS — usado en módulos con varias pestañas (Menú, Cuentas, etc.)
   ============================================================================ */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 2px solid var(--border);
  padding: 0;
  margin-bottom: 0;
}
.tab-btn {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 0;
  transition: color .12s, border-color .12s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--primary-600);
  border-bottom-color: var(--primary-600);
}

/* ============================================================================
   COMANDAS — vista de cuenta de mesa
   ============================================================================ */
.cuenta-layout {
  display: grid;
  /* Izquierda (cuenta): estrecha, solo para ver la lista de items.
     Derecha (menú): amplia, con más columnas de platos visibles. */
  grid-template-columns: 380px 1fr;
  gap: 20px;
  min-height: calc(100vh - 220px);
}
@media (max-width: 1100px) { .cuenta-layout { grid-template-columns: 340px 1fr; } }
@media (max-width: 900px) { .cuenta-layout { grid-template-columns: 1fr; } }
.cuenta-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 14px;
}
.cuenta-header .info { display: flex; gap: 12px; align-items: center; }
.cuenta-header .info .nombre { font-size: 18px; font-weight: 700; }
.cuenta-header .info .zona { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cuenta-items {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; min-height: 300px;
}
.cuenta-item {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center;
  padding: 10px 8px; border-bottom: 1px dashed var(--border);
}
.cuenta-item:last-child { border-bottom: 0; }
.cuenta-item .qty {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 8px; font-weight: 700; min-width: 28px; text-align: center;
}
.cuenta-item .nombre { font-weight: 600; }
.cuenta-item .mods { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cuenta-item .precio { font-weight: 700; }
.cuenta-item .estado-badge { font-size: 10px; padding: 2px 6px; border-radius: 999px; font-weight: 700; text-transform: uppercase; }
.cuenta-item .estado-borrador { background: #e2e8f0; color: #475569; }
.cuenta-item .estado-enviado { background: #fef3c7; color: #92400e; }
.cuenta-item .estado-preparando { background: #dbeafe; color: #1e40af; }
.cuenta-item .estado-listo { background: #d1fae5; color: #065f46; }
.cuenta-item .estado-servido { background: #f3e8ff; color: #6b21a8; }

.menu-picker {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; display: flex; flex-direction: column;
}
.menu-picker-cats {
  display: flex; gap: 4px; overflow-x: auto;
  padding: 10px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.menu-picker-cat {
  padding: 6px 12px; border-radius: 999px;
  background: transparent; border: 1px solid var(--border); color: var(--text);
  cursor: pointer; white-space: nowrap; font-size: 13px; font-weight: 600;
}
.menu-picker-cat.active { background: var(--primary-600); color: #fff; border-color: var(--primary-600); }
.menu-picker-search {
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.menu-picker-search input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; outline: none; font-family: inherit;
}
.menu-picker-search input:focus { border-color: var(--primary-600); box-shadow: 0 0 0 3px rgba(8,145,178,.1); }
.menu-picker-items {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px; padding: 12px;
  /* Aprovecha el alto de la ventana en vez de un tope fijo — con el panel
     derecho ancho ahora se muestran muchas más columnas y filas de platos */
  overflow-y: auto; max-height: calc(100vh - 260px);
  align-content: start;  /* evita que la única fila se estire vertical */
  grid-auto-rows: min-content;
}
.menu-picker-item {
  position: relative;
  padding: 8px 6px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); cursor: pointer; text-align: center;
  transition: transform .1s, border-color .12s;
  min-height: 60px;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.menu-picker-item:hover { border-color: var(--primary-600); transform: translateY(-1px); }
.menu-picker-item .n { font-size: 12px; font-weight: 600; line-height: 1.2; }
.menu-picker-item .p { font-size: 11px; color: var(--muted); }
.menu-picker-item .mod-dot {
  position: absolute; top: 4px; right: 5px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary-600);
}
.menu-picker-item .mod-dot::after {
  content: "modificadores"; position: absolute; bottom: 12px; right: -6px;
  background: rgba(0,0,0,.8); color: #fff;
  font-size: 10px; padding: 3px 6px; border-radius: 4px;
  white-space: nowrap; display: none;
}
.menu-picker-item:hover .mod-dot::after { display: block; }

/* ============================================================================
   KDS — pantalla de cocina
   ============================================================================ */
.kds-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.kds-card {
  background: var(--surface); border: 2px solid var(--border); border-radius: 12px;
  padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.kds-card.reciente { border-color: #f59e0b; }
.kds-card.pausado  { border-color: #6b7280; opacity: .7; }
.kds-card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.kds-card-mesa { font-size: 16px; font-weight: 700; }
.kds-card-tiempo { font-size: 12px; color: var(--muted); }
.kds-line {
  display: grid; grid-template-columns: 32px 1fr auto; gap: 8px; align-items: center;
  padding: 6px 4px;
}
.kds-line .qty { text-align: center; font-weight: 700; background: var(--surface-2); border-radius: 4px; padding: 2px 4px; }
.kds-line .nombre { font-size: 14px; font-weight: 500; }
.kds-line .mods { font-size: 11px; color: var(--muted); margin-top: 2px; }
.kds-line .btn-estado { font-size: 11px; padding: 4px 8px; }
