#tablaStockBajo thead th {
  background: #c1121f !important;
  color: #fff !important;
}
#tablaStockBajo tbody tr,
#tablaStockBajo tbody td {
  color: #fff !important;
  background: #c1121f !important;
}
#tablaInventario tbody tr.stock-bajo,
#tablaInventario tbody tr.stock-bajo td,
#tablaInventario tbody tr.stock-bajo td *,
#tablaInventario tbody tr.stock-bajo .inv-col-producto span,
#tablaInventario tbody tr.stock-bajo .inv-col-categoria span {
  color: #fff !important;
  background: #c1121f !important;
}
/* =============================
   SELECT TIPO DE VENTA (POS)
============================= */
.pos-venta-select {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 18px;
}
.venta-select {
  background: rgba(255,255,255,0.07);
  border: 1.5px solid #2563eb33;
  border-radius: 10px;
  color: #e0e7ef;
  font-size: 1.13rem;
  padding: 13px 14px;
  font-family: 'Segoe UI', 'Inter', 'Montserrat', Arial, sans-serif;
  font-weight: 700;
  transition: border-color 0.22s, box-shadow 0.22s;
  outline: none;
  min-width: 180px;
}
.venta-select:focus {
  border-color: #22d3ee;
  box-shadow: 0 0 0 3px #22d3ee55;
}
/* =============================
   VENTAS A CRÉDITO — ESTILO
============================= */
.credito-pro {
  background: linear-gradient(135deg, rgba(10,18,38,0.96) 0%, rgba(18,38,58,0.96) 100%);
  border-radius: 16px;
  box-shadow: 0 8px 40px 0 rgba(34,211,238,0.10), 0 1.5px 16px 0 rgba(0,0,0,0.18);
  padding: 38px 36px 28px 36px;
  max-width: 1200px;
  margin: 32px auto 32px auto;
  backdrop-filter: blur(16px) saturate(140%);
  border: 1.5px solid rgba(34,211,238,0.13);
  transition: box-shadow 0.25s, background 0.25s;
}
.credito-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.credito-header h2 {
  margin: 0;
  font-size: 2.3rem;
  color: #a5f3fc;
  font-family: 'Segoe UI', 'Inter', 'Montserrat', Arial, sans-serif;
  font-weight: 900;
  text-shadow: 0 2px 16px rgba(34,211,238,0.10);
}
.credito-filtros {
  display: flex;
  gap: 16px;
}
.credito-filtros input {
  background: rgba(255,255,255,0.07);
  border: 1.5px solid #2563eb33;
  border-radius: 10px;
  color: #e0e7ef;
  font-size: 1.13rem;
  padding: 13px 14px;
  transition: border-color 0.22s, box-shadow 0.22s;
}
.credito-filtros input:focus {
  border-color: #22d3ee;
  box-shadow: 0 0 0 3px #22d3ee55;
}
.credito-table-wrap {
  margin-top: 10px;
  background: rgba(16,24,39,0.92);
  border-radius: 16px;
  box-shadow: 0 2px 18px rgba(34,211,238,0.10);
  padding: 0;
  overflow: hidden;
}
#tablaVentasCredito {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 1.13rem;
  background: transparent;
}
#tablaVentasCredito thead th {
  background: linear-gradient(90deg, #1e293b 60%, #2563eb 100%);
  color: #a5f3fc;
  font-weight: 800;
  text-align: center;
  padding: 8px 6px;
  border: none;
  font-size: 1.01rem;
  letter-spacing: 0.01em;
}
#tablaVentasCredito td {
}

#tablaVentasCredito td:last-child {
  min-width: 80px;
  width: 100%;
  max-width: none;
  white-space: nowrap;
  overflow: visible;
  text-overflow: initial;
  text-align: center;
  padding: 4px 2px;
  border-bottom: 1.5px solid #1e293b;
  background: transparent;
  font-size: 1.01rem;
  color: #e0e7ef;
  transition: background 0.18s;
  vertical-align: middle;
.acciones-credito {
  display: flex;
  gap: 2px;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.acciones-credito .btn-sm {
  /* Eliminar reglas personalizadas, usar .sm global */
}
}
#tablaVentasCredito tr:last-child td {
  border-bottom: none;
}
#tablaVentasCredito tbody tr:hover {
  background: linear-gradient(90deg, #2563eb22 0%, #22d3ee22 100%);
  box-shadow: 0 2px 12px #22d3ee22;
}
.credito-table-wrap button {
  font-size: 0.98rem;
  padding: 5px 10px;
  border-radius: 7px;
  font-weight: 800;
  background: linear-gradient(90deg, #22d3ee 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 2px 12px #22d3ee33;
  border: none;
  transition: background 0.22s, box-shadow 0.22s, transform 0.18s;
  outline: none;
  margin: 0 2px;
}
.credito-table-wrap button:hover {
  background: linear-gradient(90deg, #2563eb 0%, #22d3ee 100%);
  box-shadow: 0 4px 16px #22d3ee55;
  transform: translateY(-2px) scale(1.03);
}
/* Modales */
.modal-credito {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10,18,38,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-credito-content {
  background: linear-gradient(135deg, #101827 0%, #1e293b 100%);
  border-radius: 16px;
  box-shadow: 0 8px 40px 0 rgba(34,211,238,0.13);
  padding: 36px 32px 28px 32px;
  min-width: 320px;
  max-width: 95vw;
  color: #e0e7ef;
  font-family: 'Segoe UI', 'Inter', 'Montserrat', Arial, sans-serif;
}
.modal-credito-content h3 {
  margin-top: 0;
  color: #a5f3fc;
  font-size: 1.5rem;
  font-weight: 900;
}
.modal-credito-content label {
  display: flex;
  flex-direction: column;
  font-size: 1.08rem;
  color: #a5b4fc;
  font-weight: 600;
  margin-bottom: 18px;
}
.modal-credito-content input[type="number"] {
  background: rgba(255,255,255,0.07);
  border: 1.5px solid #2563eb33;
  border-radius: 10px;
  color: #e0e7ef;
  font-size: 1.13rem;
  padding: 13px 14px;
  margin-top: 4px;
  transition: border-color 0.22s, box-shadow 0.22s;
}
.modal-credito-content input[type="number"]:focus {
  border-color: #22d3ee;
  box-shadow: 0 0 0 3px #22d3ee55;
}
.modal-credito-actions {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-top: 10px;
}
.modal-credito-actions button {
  font-size: 1.08rem;
  padding: 8px 18px;
  border-radius: 10px;
  font-weight: 800;
  background: linear-gradient(90deg, #22d3ee 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 2px 12px #22d3ee33;
  border: none;
  transition: background 0.22s, box-shadow 0.22s, transform 0.18s;
  outline: none;
}
.modal-credito-actions button:hover {
  background: linear-gradient(90deg, #2563eb 0%, #22d3ee 100%);
  box-shadow: 0 4px 16px #22d3ee55;
  transform: translateY(-2px) scale(1.03);
}
@media (max-width: 900px) {
  .credito-pro { padding: 12px 2vw 12px 2vw; }
  .credito-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .credito-filtros { flex-direction: column; gap: 10px; }
}
.pos-carrito {
  margin-bottom: 12px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(37,99,235,.07);
  padding: 8px 0 0 0;
}
#tablaPuntoVenta {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 1.08rem;
}
#tablaPuntoVenta th {
  background: linear-gradient(90deg, #2563eb 60%, #60a5fa 100%);
  color: #fff;
  font-weight: 700;
  text-align: center;
  padding: 12px 8px;
  border: none;
}
#tablaPuntoVenta td {
  text-align: center;
  padding: 10px 6px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}
#tablaPuntoVenta tr:last-child td {
  border-bottom: none;
}
.pos-totales {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
  justify-content: flex-end;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: 0 2px 8px rgba(37,99,235,.04);
}
.pos-totales label {
  display: flex;
  flex-direction: column;
  font-size: 15px;
  color: #334155;
  min-width: 160px;
  font-weight: 600;
}
#totalFinalPuntoVenta {
  font-size: 2.1rem;
  font-weight: 900;
  color: #2563eb;
  background: transparent;
  border: none;
  text-align: right;
  margin-top: 2px;
}
.pos-acciones {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-top: 10px;
}
.pos-acciones button {
  font-size: 1.1rem;
  padding: 12px 28px;
  border-radius: 10px;
  font-weight: 700;
}
/* =============================
   POS PREMIUM 2026 — SOLO PUNTO DE VENTA
============================= */
.pos-pro {
  background: linear-gradient(135deg, rgba(10,18,38,0.92) 0%, rgba(18,38,58,0.92) 100%);
  border-radius: 16px;
  box-shadow: 0 8px 40px 0 rgba(34,211,238,0.10), 0 1.5px 16px 0 rgba(0,0,0,0.18);
  padding: 38px 36px 28px 36px;
  max-width: 1200px;
  margin: 32px auto 32px auto;
  backdrop-filter: blur(16px) saturate(140%);
  border: 1.5px solid rgba(34,211,238,0.13);
  transition: box-shadow 0.25s, background 0.25s;
}
.pos-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.pos-header h2 {
  margin: 0;
  font-size: 2.6rem;
  color: #a5f3fc;
  letter-spacing: -1px;
  font-family: 'Segoe UI', 'Inter', 'Montserrat', Arial, sans-serif;
  font-weight: 900;
  text-shadow: 0 2px 16px rgba(34,211,238,0.10);
}
.pos-venta-tabs {
  display: flex;
  gap: 12px;
}
.venta-tab {
  background: rgba(34,211,238,0.10);
  color: #a5f3fc;
  border: 1.5px solid rgba(34,211,238,0.18);
  border-radius: 12px 12px 0 0;
  padding: 13px 36px;
  font-weight: 800;
  font-size: 1.18rem;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(34,211,238,0.08);
  transition: background 0.22s, color 0.22s, box-shadow 0.22s;
  outline: none;
}
.venta-tab.active, .venta-tab:focus {
  background: linear-gradient(90deg, #22d3ee 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 0 12px 2px #22d3ee55;
  border-bottom: 2.5px solid #fff;
}
.pos-datos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px,1fr));
  gap: 22px 32px;
  margin-bottom: 22px;
}
.pos-datos label {
  display: flex;
  flex-direction: column;
  font-size: 1.08rem;
  color: #a5b4fc;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.pos-datos input {
  background: rgba(255,255,255,0.07);
  border: 1.5px solid #2563eb33;
  border-radius: 10px;
  color: #e0e7ef;
  font-size: 1.13rem;
  padding: 13px 14px;
  margin-top: 4px;
  transition: border-color 0.22s, box-shadow 0.22s;
}
.pos-datos input:focus {
  border-color: #22d3ee;
  box-shadow: 0 0 0 3px #22d3ee55;
}
.pos-busqueda {
  margin-bottom: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#buscadorProductoPOS {
  width: 100%;
  font-size: 1.25rem;
  padding: 18px 22px 18px 54px;
  border-radius: 14px;
  border: 1.5px solid #22d3ee55;
  background: rgba(255,255,255,0.10);
  color: #e0e7ef;
  box-shadow: 0 2px 18px rgba(34,211,238,0.10);
  outline: none;
  transition: border-color 0.22s, box-shadow 0.22s;
  font-family: 'Segoe UI', 'Inter', 'Montserrat', Arial, sans-serif;
  position: relative;
  z-index: 30;
}
#buscadorProductoPOS:focus {
  border-color: #22d3ee;
  box-shadow: 0 0 0 4px #22d3ee44;
}
#buscadorProductoPOS::placeholder {
  color: #7dd3fc;
  opacity: 1;
  font-size: 1.13rem;
}
.pos-busqueda::before {
  content: '\1F50D';
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: #22d3ee;
  pointer-events: none;
  opacity: 0.85;
}
.pos-resultados {
  background: rgba(16,24,39,0.98);
  border: 1.5px solid #22d3ee33;
  border-radius: 0 0 14px 14px;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(34,211,238,0.13);
  position: absolute;
  z-index: 25;
  left: 0;
  right: 0;
  top: 100%;
  width: 100%;
  min-width: 320px;
  display: none;
  font-size: 1.13rem;
}
.pos-resultados.active {
  display: block;
}
.pos-resultado-item {
  padding: 14px 22px;
  cursor: pointer;
  border-bottom: 1px solid #1e293b;
  color: #e0e7ef;
  background: transparent;
  transition: background 0.16s, color 0.16s;
}
.pos-resultado-item:last-child {
  border-bottom: none;
}
.pos-resultado-item:hover, .pos-resultado-item.selected {
  background: linear-gradient(90deg, #2563eb33 0%, #22d3ee33 100%);
  color: #a5f3fc;
}
.pos-carrito {
  margin-bottom: 18px;
  background: rgba(16,24,39,0.92);
  border-radius: 16px;
  box-shadow: 0 2px 18px rgba(34,211,238,0.10);
  padding: 0;
  overflow: hidden;
}
#tablaPuntoVenta {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 1.13rem;
  background: transparent;
}
#tablaPuntoVenta thead th {
  background: linear-gradient(90deg, #1e293b 60%, #2563eb 100%);
  color: #a5f3fc;
  font-weight: 800;
  text-align: center;
  padding: 16px 10px;
  border: none;
  font-size: 1.08rem;
  letter-spacing: 0.01em;
}
#tablaPuntoVenta td {
  text-align: center;
  padding: 14px 8px;
  border-bottom: 1.5px solid #1e293b;
  background: transparent;
  font-size: 1.13rem;
  color: #e0e7ef;
  transition: background 0.18s;
}
#tablaPuntoVenta tr:last-child td {
  border-bottom: none;
}
#tablaPuntoVenta tbody tr:hover {
  background: linear-gradient(90deg, #2563eb22 0%, #22d3ee22 100%);
  box-shadow: 0 2px 12px #22d3ee22;
}
#tablaPuntoVenta input[type="number"] {
  width: 70px;
  background: rgba(255,255,255,0.08);
  color: #e0e7ef;
  border: 1.5px solid #2563eb33;
  border-radius: 8px;
  font-size: 1.13rem;
  padding: 7px 8px;
  text-align: center;
  transition: border-color 0.18s, box-shadow 0.18s;
}
#tablaPuntoVenta input[type="number"]:focus {
  border-color: #22d3ee;
  box-shadow: 0 0 0 2px #22d3ee55;
}
#tablaPuntoVenta button.pv-del {
  background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 1.13rem;
  font-weight: 700;
  box-shadow: 0 2px 8px #ef444422;
  cursor: pointer;
  transition: background 0.18s, box-shadow 0.18s;
}
#tablaPuntoVenta button.pv-del:hover {
  background: linear-gradient(90deg, #f87171 0%, #ef4444 100%);
  box-shadow: 0 4px 16px #ef444422;
}
.pos-totales {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px,1fr));
  gap: 18px 32px;
  align-items: center;
  margin-bottom: 18px;
  background: rgba(16,24,39,0.92);
  border-radius: 14px;
  box-shadow: 0 2px 18px rgba(34,211,238,0.10);
  padding: 22px 28px 10px 28px;
}
.pos-totales label {
  display: flex;
  flex-direction: column;
  font-size: 1.13rem;
  color: #a5b4fc;
  font-weight: 700;
  letter-spacing: 0.01em;
}
#totalFinalPuntoVenta {
  font-size: 2.5rem;
  font-weight: 900;
  color: #22d3ee;
  background: transparent;
  border: none;
  text-align: right;
  margin-top: 2px;
  text-shadow: 0 2px 16px #22d3ee33;
}
#vueltoPuntoVenta {
  color: #10b981;
  font-weight: 800;
  font-size: 1.35rem;
  text-shadow: 0 2px 8px #10b98133;
}
.pos-acciones {
  display: flex;
  gap: 24px;
  justify-content: flex-end;
  margin-top: 18px;
}
.pos-acciones button {
  font-size: 1.18rem;
  padding: 16px 38px;
  border-radius: 12px;
  font-weight: 900;
  background: linear-gradient(90deg, #22d3ee 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 4px 24px #22d3ee33;
  border: none;
  transition: background 0.22s, box-shadow 0.22s, transform 0.18s;
  outline: none;
}
.pos-acciones button:hover {
  background: linear-gradient(90deg, #2563eb 0%, #22d3ee 100%);
  box-shadow: 0 8px 32px #22d3ee55;
  transform: translateY(-2px) scale(1.03);
}
@media (max-width: 900px) {
  .pos-pro { padding: 12px 2vw 12px 2vw; }
  .pos-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .pos-datos, .pos-totales { grid-template-columns: 1fr; gap: 12px; }
  .pos-acciones { flex-direction: column; gap: 12px; }
}
@media (max-width: 900px) {
  .pos-datos, .pos-totales { flex-direction: column; gap: 10px; }
  .pos-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}
:root{
  --bg:#0b1220; --card:#101827; --muted:#8da2b5; --text:#e8f0fe;
  --b:#334155; --ok:#10b981; --warn:#f59e0b; --bad:#ef4444;
}
*{box-sizing:border-box}
body{margin:0; font-family:system-ui,Arial; background:var(--bg); color:var(--text)}
header{position:sticky; top:0; background:rgba(16,24,39,.9); backdrop-filter:saturate(140%) blur(6px); border-bottom:1px solid var(--b); z-index:9}
nav.tabs{display:flex; gap:8px; padding:10px; flex-wrap:wrap}
.tab-button{background:#0f172a; color:#cbd5e1; border:1px solid var(--b); padding:8px 12px; border-radius:10px; cursor:pointer}
.tab-button.active{background:#1e293b; color:#fff}
main{max-width:1100px; margin:16px auto; padding:0 12px}
.tab-content{display:none}
.tab-content.active{display:block}
h2,h3{margin:.2rem 0 .6rem}
.muted{color:var(--muted)}
.documento{background:var(--card); border:1px solid var(--b); border-radius:12px; padding:12px; max-width:900px; margin:0 auto}
form label{display:block; margin:6px 0}
input,select,button{background:#0f172a; color:#e2e8f0; border:1px solid var(--b); border-radius:8px; padding:8px}
input[readonly]{opacity:.85}
button{cursor:pointer}
button.secondary{background:#0b1220}
button.danger{background:#2a1010; border-color:#5a2121}
button.sm{padding:6px 8px; font-size:.9rem}
.table-wrap{overflow:auto; border:1px solid var(--b); border-radius:10px}
table{width:100%; border-collapse:collapse}
th,td{border-bottom:1px solid #1f2937; padding:8px; text-align:left}
th{background:#0f172a; position:sticky; top:0}
tr.stock-bajo{background:rgba(245,158,11,.08)}
.num{font-variant-numeric:tabular-nums}
.right{text-align:right}
.full{width:100%}
.no-print{display:block}
@media print{ .no-print{display:none !important} body{background:#fff; color:#000} header{display:none} main{max-width:100%; padding:0} }

.toolbar{display:flex; gap:10px; align-items:end; flex-wrap:wrap; margin: 0 0 10px;}
.toolbar-right{margin-left:auto; display:flex; gap:10px; align-items:center;}
.stack{display:grid; gap:6px}
.grid-5{display:grid; grid-template-columns: repeat(5,1fr); gap:10px; margin-bottom:10px;}
.grid-4{display:grid; grid-template-columns: repeat(4,1fr); gap:10px; margin-bottom:10px;}
.totales{display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end; margin-top:8px;}
.doc-totales{display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end; margin-top:8px;}
.divider{border:none; border-top:1px solid #334155; margin:20px 0}
.bordered{border:1px solid #000; padding:6px}

.overlay{position:fixed; inset:0; background: rgba(2,6,23,.92); display:flex; align-items:center; justify-content:center; z-index:1000;}
.overlay-card{width:100%; max-width:380px; background: rgba(255,255,255,.04); border:1px solid var(--b); border-radius:12px; padding:22px;}
.actions{display:flex; gap:10px; justify-content:flex-end; margin-top:14px;}
.venta-color-0 { background-color: #e1f5fe; color: #000; } /* Celeste claro */
.venta-color-1 { background-color: #ffe0b2; color: #000; } /* Naranja suave */
.venta-color-2 { background-color: #dcedc8; color: #000; } /* Verde claro */
.venta-color-3 { background-color: #f8bbd0; color: #000; } /* Rosa pastel */
.venta-color-4 { background-color: #f0f4c3; color: #000; } /* Amarillo verdoso */
.venta-color-5 { background-color: #e0f2f1; color: #000; } /* Verde-agua suave */

/* Centrar contenido de celdas */
#tablaHistorial td,
#tablaHistorial th {
  text-align: center;
  vertical-align: middle;
}
/* ============================
   INVENTARIO — LOOK & FEEL
   (solo CSS, sin tocar HTML/JS)
   ============================ */

/* Paleta base */
:root{
  --bg: #f7f8fb;
  --card: #ffffff;
  --ink: #1c1f24;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-ink: #fff;
  --border: #e5e7eb;
  --input-bg: #fff;
  --input-border: #d1d5db;
  --input-focus: #93c5fd;

  --danger: #ef4444;
  --danger-ink: #fff;

  --soft-red: #ffe8ee;   /* stock-bajo fondo */
  --soft-red-ink:#7a1b2b;
}

/* Dark mode opcional (si el SO está en oscuro) */
@media (prefers-color-scheme: dark){
  :root{
    --bg: #0f172a;
    --card: #111827;
    --ink: #e5e7eb;
    --muted: #9ca3af;
    --primary: #60a5fa;
    --primary-ink: #0b1220;
    --border: #1f2937;
    --input-bg: #0b1220;
    --input-border: #374151;
    --input-focus: #2563eb;
    --soft-red: #3b1020;
    --soft-red-ink:#ffb3c2;
  }
}

/* Lienzo general */
body{
  background: var(--bg);
  color: var(--ink);
}

/* ============================
   Tarjeta de Inventario
   ============================ */
#inventario{
  padding: 18px;
}

#inventario h2{
  margin: 0 0 14px;
}

/* Toolbar (umbral + acciones) */
#inventario .toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  margin-bottom: 14px;
}

#inventario .toolbar .stack{
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

#inventario .toolbar-right{
  display: flex;
  gap: 8px;
}

/* Botones */
button{
  background: var(--primary);
  color: var(--primary-ink);
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .05s ease, box-shadow .15s ease;
  
}
button:hover{ transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37,99,235,.18); }
button.secondary{ background: transparent; color: var(--ink); border:1px solid var(--border); }
button.danger{ background: var(--danger); color: var(--danger-ink); }
button.sm{ padding: 6px 10px; font-size: 12px; }

/* ==============================
   FORMULARIOS
============================== */
form{
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: var(--gap);
  align-items: end;
  margin-bottom: 14px;
}
form label{
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

input, select, button, textarea{ font: inherit; }

input[type="date"],
input[type="text"],
input[type="number"],
input[readonly],
select, textarea{
  width: 100%;
  background: #0b1220;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, transform .06s ease;
}
input[readonly]{
  background: #0a0f1d;
  color: #cbd5e1;
  border-style: dashed;
  opacity: .9;
}

input:hover{ border-color: rgba(148,163,184,.45); }
input:focus{
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--ring);
  transform: translateY(-1px);
}

/* Elimina flechas number */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button{ -webkit-appearance: none; margin: 0; }
input[type=number]{ appearance: textfield; -moz-appearance: textfield; }

.venta-botones{
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

#formularioInventario input[type="text"],
#formularioInventario input[type="number"],
#formularioInventario input[type="date"]{
  background: var(--input-bg);
  color: var(--ink);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
#formularioInventario input:focus{
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--input-focus) 25%, transparent);
}

#formularioInventario button[type="submit"]{
  justify-self: end;
}

/* Buscador */
#buscadorInventario{
  width: 100%;
  max-width: 520px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 8px 0 12px;
}

/* ============================
   Tabla de Inventario
   ============================ */
.table-wrap{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  overflow: hidden;            /* bordes redondeados en la tabla */
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

#tablaInventario{
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

#tablaInventario thead th {
  color: #ffffff; /* Texto blanco */
  background: linear-gradient(135deg, #2563eb, #1e40af); /* Degradado azul profesional */
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25); /* Ligero sombreado para resaltar texto */
}


#tablaInventario tbody td{
  padding: 10px 8px;
  text-align: center;          /* centrado que pedías */
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

#tablaInventario tbody tr:nth-child(odd){
  background: color-mix(in oklab, var(--card) 92%, #000 0%);
}

/* Acciones más compactas en la última columna */
#tablaInventario tbody td:last-child{
  white-space: nowrap;
}
#tablaInventario tbody td:last-child button{
  margin-right: 6px;
}

/* ============================
   Resaltado de stock bajo
   ============================ */
#tablaInventario tbody tr.stock-bajo{
  background: var(--soft-red) !important;
  color: var(--soft-red-ink);
}
#tablaInventario tbody tr.stock-bajo td{
  border-bottom-color: color-mix(in oklab, var(--soft-red-ink) 15%, var(--soft-red));
}
#tablaInventario tbody tr.stock-bajo td:nth-child(9){ /* columna 'Cantidad' suele ser la 9 */
  font-weight: 800;
}

/* Pequeños detalles de texto/num */
.num{ font-variant-numeric: tabular-nums; }

/* Quitar estilos en impresión */
@media print{
  .no-print{ display: none !important; }
}
/* 📦 Encabezados de tabla inventario */
#tablaInventario thead th {
  color: #000; /* Texto negro */
  background-color: #f0f0f0; /* Gris muy claro para contraste */
  font-weight: bold;
}

/* ⚠️ Filas con stock bajo: rosado claro */
#tablaInventario tbody tr.stock-bajo {
  background-color: #c1121f !important; /* Rojo fuerte para alerta */
}
#tablaInventario tbody tr.stock-bajo td,
#tablaInventario tbody tr.stock-bajo td * {
  color: #fff !important; /* Forzar texto blanco en toda la fila y sus hijos */
  border-bottom-color: #fff2f2;
}

/* Opcional: suavizar el hover */
#tablaInventario tbody tr:hover {
  background-color: #fceef1;
}
/* ============================
   🔧 PARCHE: BOTÓN UMBRAL + MODAL PIN
   ============================ */

/* 1) Botón "Umbral" en la tabla de inventario */
#tablaInventario tbody td:last-child button:nth-of-type(2) {
  background: var(--warn) !important; /* Amarillo */
  color: #0b1220 !important;          /* Texto oscuro */
  border: 1px solid rgba(0,0,0,0.25) !important;
  font-weight: 700 !important;
  padding: 6px 10px !important;
  border-radius: 6px !important;
}
#tablaInventario tbody td:last-child button:nth-of-type(2):hover {
  filter: brightness(1.06);
  box-shadow: 0 4px 12px rgba(245,158,11,0.25);
}

/* 2) Modal Cambiar PIN siempre por encima */
#pinOverlay {
  z-index: 99999 !important; /* Muy alto para estar sobre todo */
  background: rgba(2,6,23,0.85) !important; /* Fondo oscurecido */
  backdrop-filter: blur(2px);
}
#pinOverlay .overlay-card {
  position: relative !important;
  z-index: 100000 !important;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.06);
}
/* ✅ Modal Cambiar PIN: más grande y sin encimarse */
#pinOverlay .overlay-card{
  max-width: 560px !important;    /* antes ~380px */
  padding: 24px 28px !important;
}

/* Sobrescribe el grid global de form SOLO aquí */
#pinOverlay #formPin{
  display: grid !important;
  grid-template-columns: 1fr;     /* una columna, todo vertical */
  gap: 12px !important;
}

/* Etiquetas y campos más cómodos */
#pinOverlay #formPin label{
  font-size: 14px;
  gap: 6px;
}
#pinOverlay #formPin input{
  height: 40px;
  font-size: 16px;
  padding: 8px 10px;
}

/* Botones alineados y con espacio */
#pinOverlay #formPin .actions{
  display: flex !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  margin-top: 6px !important;
}

/* ============================
   Modulos adicionales
   ============================ */
.panel-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.panel{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.form-grid{
  --gap: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}
.form-grid input,
.form-grid select{
  padding: 6px 8px;
  font-size: 13px;
  height: 34px;
}
.form-grid button{
  padding: 8px 12px;
}
@media (max-width: 900px){
  .form-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px){
  .form-grid{ grid-template-columns: 1fr; }
}

/* ============================
   Caja: layout estable de campos
   ============================ */
#formAperturaCaja,
#formCierreCaja {
  grid-template-columns: 1fr !important;
  gap: 10px !important;
}

#formAperturaCaja .form-row-2,
#formCierreCaja .form-row-2 {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

#formAperturaCaja .form-row-2 label,
#formCierreCaja .form-row-2 label {
  margin: 0;
  display: grid;
  gap: 6px;
  min-width: 0;
}

#formAperturaCaja .form-row-2 input[type="date"],
#formAperturaCaja .form-row-2 input[type="time"],
#formCierreCaja .form-row-2 input[type="date"],
#formCierreCaja .form-row-2 input[type="time"] {
  width: 100%;
  min-width: 0;
  height: 36px;
}

@media (max-width: 700px){
  #formAperturaCaja .form-row-2,
  #formCierreCaja .form-row-2 {
    grid-template-columns: 1fr;
  }
}

.report-actions{
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
  margin: 10px 0;
}
.report-actions input{
  padding: 6px 8px;
  font-size: 13px;
  height: 34px;
}
.hist-filter{
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
  margin: 8px 0 12px;
}
.hist-filter label{
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.hist-filter input{
  padding: 6px 8px;
  font-size: 13px;
  height: 34px;
}
#tablaHistorial td,
#tablaHistorial th{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tablaHistorial th:first-child,
#tablaHistorial td:first-child{
  min-width: 120px;
}
.kpi-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 10px 0;
}
.kpi-card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.form-row-2{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.form-row-2 label{
  margin: 0;
}

@media (max-width: 600px){
  .form-row-2{
    grid-template-columns: 1fr;
    row-gap: 8px;
  }
}
.kpi-label{
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi-value{
  font-size: 22px;
  font-weight: 700;
}

/* =====================================
   Scroll interno para tablas (global)
   ===================================== */
.table-wrap{
  overflow-y: auto !important;
  overflow-x: hidden !important;
  max-height: 50vh;
}

@media (max-height: 800px){
  .table-wrap{
    max-height: 44vh;
  }
}

@media print{
  .table-wrap{
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: visible !important;
  }
}
:root{
  /* 🎨 Paleta oscura profesional */
  --bg:#0a0f1a;       /* Fondo general */
  --card:#121826;     /* Tarjetas y paneles */
  --muted:#8ea0b6;    /* Texto secundario */
  --text:#f1f5f9;     /* Texto principal */
  --b:#243145;        /* Bordes */

  --ok:#22c55e;       /* Verde éxito */
  --warn:#fbbf24;     /* Amarillo advertencia */
  --bad:#ef4444;      /* Rojo error */

  /* Colores inventario */
  --primary:#3b82f6;  /* Azul acento */
  --primary-ink:#ffffff;
  --border:#1e293b;
  --input-bg:#0f172a;
  --input-border:#334155;
  --input-focus:#60a5fa;

  --danger:#ef4444;
  --danger-ink:#ffffff;

  --soft-red:#3b1020;       /* stock-bajo fondo */
  --soft-red-ink:#ffb3c2;   /* stock-bajo texto */
}

/* Encabezados de tabla */
#tablaInventario thead th {
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #1e40af);
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

/* Hover general en tablas */
#tablaInventario tbody tr:hover,
#tablaHistorial tbody tr:hover {
  background-color: rgba(59,130,246,0.08); /* azul muy suave */
}

/* Filas de stock bajo */
#tablaInventario tbody tr.stock-bajo{
  background: var(--soft-red) !important;
  color: var(--soft-red-ink);
}
#tablaInventario tbody tr.stock-bajo:hover{
  background: rgba(255,179,194,0.15) !important;
}

/* Botón 'Umbral' más visible */
#tablaInventario tbody td:last-child button:nth-of-type(2) {
  background: var(--warn) !important;
  color: #0a0f1a !important;
  border: 1px solid rgba(0,0,0,0.25) !important;
  font-weight: 700 !important;
}
#tablaInventario tbody td:last-child button:nth-of-type(2):hover {
  background: #facc15 !important; /* amarillo un poco más vivo */
}
/* ============================
   📦 Estilo de alerta en Stock Bajo
   ============================ */

/* Fondo rojo translúcido en toda la fila */
#tablaStockBajo tbody tr {
  background-color: rgba(239, 68, 68, 0.15) !important; /* rojo cristal */
}

/* Texto negro por defecto */
#tablaStockBajo td {
  color: #000 !important;
}

/* Números en rojo fuerte para resaltar cantidad */
#tablaStockBajo td:last-child {
  color: #ef4444 !important; /* rojo fuerte */
  font-weight: 700;
}
/* 🎯 Parche: Hover suave en tablas (Inventario e Historial) */
#tablaInventario tbody tr:hover,
#tablaHistorial tbody tr:hover {
  background-color: rgba(148, 163, 184, 0.15) !important; /* gris claro translúcido */
  color: inherit !important; /* mantiene color original del texto */
}
/* =========================================================
   🔧 PARCHE DE VISIBILIDAD — Inputs en tema oscuro
   ========================================================= */

/* Texto escrito en cualquier input */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="search"],
select,
textarea {
  color: #f1f5f9 !important;   /* gris muy claro (casi blanco) */
  font-weight: 500;            /* más legible */
  background-color: #1e293b;   /* gris oscuro consistente */
  border: 1px solid #334155;   /* bordes visibles */
  border-radius: 6px;
  padding: 4px 6px;
}

/* Placeholders: visibles pero distintos al texto normal */
input::placeholder,
textarea::placeholder {
  color: #94a3b8 !important;   /* gris claro */
  opacity: 1 !important;       /* siempre sólido, no transparente */
}

/* Selects (dropdowns) */
select {
  background-color: #1e293b;
  color: #f1f5f9;
}

/* Mejor visibilidad en focus */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #22d3ee;       /* cian brillante al seleccionar */
  box-shadow: 0 0 4px #22d3ee;
}
/* =========================================================
   PARCHE VISUAL DE EMERGENCIA (tema oscuro, alta legibilidad)
   Pegar al FINAL de style.css
   ========================================================= */

/* Evitar mezclas raras que lavan el color en otras PCs */
*, *::before, *::after { mix-blend-mode: normal !important; }

/* Color base de texto en toda la app */
html, body {
  color: #eaf2ff !important;           /* texto claro */
  background: #0b1220 !important;      /* fondo oscuro estable */
}

/* ---------- Entradas (inputs, selects, textarea) ---------- */
input, select, textarea {
  background: rgba(255,255,255,.06) !important;
  color: #eaf2ff !important;
  border: 1px solid rgba(255,255,255,.18) !important;
  box-shadow: none !important;
  outline: none !important;
  opacity: 1 !important;               /* por si algún estilo los dejaba lavados */
}
input::placeholder, textarea::placeholder {
  color: rgba(234,242,255,.75) !important; /* placeholder visible */
}
input:focus, select:focus, textarea:focus {
  border-color: #22d3ee !important;
  box-shadow: 0 0 0 3px rgba(34,211,238,.35) !important;
}
input:disabled, select:disabled, textarea:disabled {
  color: #9fb3c8 !important;
  opacity: .9 !important;
}

/* Arreglo de AUTOFILL en Chrome (que blanquea/amarillea) */
input:-webkit-autofill,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: #eaf2ff !important;
  transition: background-color 9999s ease-in-out 0s;
  box-shadow: 0 0 0 1000px rgba(255,255,255,.06) inset !important;
}

/* ---------- Botones (incluye imprimir/exportar) ---------- */
button,
.btn,
[type="button"],
[type="submit"] {
  background: #38bdf8 !important;
  color: #0b1220 !important;
  border: 1px solid #0891b2 !important;
  border-radius: 10px !important;
  padding: 10px 14px !important;
  font-weight: 800 !important;
  letter-spacing: .2px !important;
  opacity: 1 !important;                /* nunca apagados visualmente */
  text-shadow: none !important;
  cursor: pointer;
}
button:hover, .btn:hover,
[type="button"]:hover, [type="submit"]:hover {
  background: #22d3ee !important;
  border-color: #06b6d4 !important;
}
button:focus-visible, .btn:focus-visible,
[type="button"]:focus-visible, [type="submit"]:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(34,211,238,.5) !important;
}

/* variantes ya usadas en tu app */
button.secondary, .btn.secondary {
  background: #334155 !important; color: #e2e8f0 !important; border-color:#475569 !important;
}
button.secondary:hover { background:#475569 !important; }
button.danger, .btn.danger {
  background:#ef4444 !important; color:#fff !important; border-color:#b91c1c !important;
}
button.danger:hover{ background:#f87171 !important; }
button.sm, .btn.sm { padding:6px 10px !important; font-weight:800 !important; }

/* ---------- Tablas ---------- */
table { border-collapse: collapse; width:100%; table-layout: fixed; }
th {
  background: rgba(255,255,255,.08) !important;
  color: #eaf2ff !important;
  border: 1px solid rgba(255,255,255,.12) !important;
}
td {
  color: #e1ecff !important;
  border: 1px solid rgba(255,255,255,.08) !important;
}

/* ---------- Tabs/Lateral ---------- */
.tab-button { color:#cbd5e1 !important; opacity:1 !important; }
.tab-button.active {
  color:#22d3ee !important;
  border-bottom: 2px solid #22d3ee !important;
}
.sidebar, .nav, .tabs { color:#eaf2ff !important; }

/* ---------- Estados de “bajo contraste” que venían del tema ---------- */
.muted, .text-muted { color:#9fb3c8 !important; opacity:1 !important; }

/* ---------- Celdas de error/stock bajo que deben resaltar ---------- */
.error-stock input { outline:2px solid #ef4444 !important; background: rgba(239,68,68,.08) !important; }

/* ---------- Imprimir (por si hereda colores del tema) ---------- */
@media print {
  body { color:#000 !important; background:#fff !important; }
  th   { background:#f2f2f2 !important; color:#000 !important; }
  td   { color:#000 !important; }
  button { display:none !important; } /* ocultar botones en papel */
}
/* =========================================================
   🔧 HOTFIX OVERRIDES (pegar al FINAL de style.css)
   Forzar contraste en tema oscuro + tablas y botones visibles
   ========================================================= */

/* ---- Base ---- */
html, body {
  background: #0f172a !important;       /* azul oscuro liso */
  color: #e5e7eb !important;             /* texto claro */
  font: 14px/1.45 system-ui, Segoe UI, Roboto, Arial, sans-serif !important;
}

h1, h2, h3, h4, h5 { color: #f1f5f9 !important; }

/* ---- Inputs ---- */
input[type="text"], input[type="number"], input[type="date"],
input[type="search"], input[type="password"], select, textarea {
  background: #111827 !important;
  color: #e5e7eb !important;
  border: 1px solid #334155 !important;
  border-radius: 10px !important;
  padding: 9px 12px !important;
  outline: none !important;
}
input::placeholder, textarea::placeholder { color: #94a3b8 !important; opacity: 1 !important; }
input:focus, select:focus, textarea:focus {
  border-color: #22d3ee !important;
  box-shadow: 0 0 0 3px rgba(34,211,238,.35) !important;
}

/* Readonly legible */
input[readonly], .readonly {
  background: #0b1320 !important;
  color: #cbd5e1 !important;
}

/* ---- Botones (genérico + .btn) ---- */
button, .btn, input[type="button"], input[type="submit"] {
  appearance: none !important;
  background: #22d3ee !important;       /* cian */
  color: #06202a !important;
  border: 1px solid #06b6d4 !important;
  border-radius: 10px !important;
  padding: 10px 14px !important;
  font-weight: 800 !important;
  cursor: pointer !important;
  box-shadow: 0 8px 24px rgba(34,211,238,.25) !important;
}
button:hover, .btn:hover, input[type="button"]:hover, input[type="submit"]:hover {
  filter: brightness(1.05) !important;
}
button:disabled, .btn:disabled { opacity:.55 !important; cursor:not-allowed !important; }

/* variantes rápidas si usas clases */
.btn--sec { background:#60a5fa !important; border-color:#3b82f6 !important; color:#081427 !important; }
.btn--danger { background:#f87171 !important; border-color:#ef4444 !important; color:#2a0707 !important; }
.btn--ghost { background:rgba(255,255,255,.06) !important; color:#e5e7eb !important; border-color:#475569 !important; }

/* ---- Tabs laterales/superiores (si son <a> o <button>) ---- */
.nav, .tabs { gap: 8px !important; }
.nav a, .nav button, .tabs a, .tabs button {
  background: #0b1320 !important;
  color: #e2e8f0 !important;
  border: 1px solid #334155 !important;
  border-radius: 10px !important;
  padding: 10px 12px !important;
  font-weight: 700 !important;
}
.nav .active, .tabs .active {
  background: #1f2937 !important;
  border-color: #22d3ee !important;
  color: #a5f3fc !important;
}

/* ---- Tablas ---- */
.table-wrap {
  background:#0b1320 !important;
  border:1px solid #334155 !important;
  border-radius:12px !important;
  max-height: 380px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}
.table-scroll { overflow-x:auto !important; }

table { width:100% !important; border-collapse:collapse !important; min-width:900px !important; table-layout:fixed !important; }
th, td { border-bottom:1px solid rgba(148,163,184,.25) !important; padding:9px 10px !important; color:#e5e7eb !important; }
th { position:sticky !important; top:0 !important; background:#0b1320 !important; color:#dbeafe !important; font-weight:800 !important; z-index:1 !important; }
tbody tr:nth-child(odd){ background:rgba(255,255,255,.04) !important; }
tbody tr:nth-child(even){ background:rgba(255,255,255,.02) !important; }
tbody tr:hover{ background:rgba(34,211,238,.14) !important; }

/* Números alineados */
td.num, th.num { text-align:right !important; font-variant-numeric: tabular-nums !important; }

/* ---- Columna ACCIONES: botones visibles y en varias filas ---- */
/* marca el <th> con class="acciones" o data-col="acciones", y los <td> con class="acciones" */
th.acciones, [data-col="acciones"] { width: 230px !important; min-width: 210px !important; }
td.acciones { min-width:210px !important; white-space:normal !important; padding:8px !important; }
td.acciones .btn, td.acciones button { display:inline-flex !important; margin:4px 6px 0 0 !important; }
td.acciones .btn-group { display:flex !important; flex-wrap:wrap !important; gap:6px !important; }

/* ---- PIN overlay (si lo tienes) ---- */
#authOverlay, #pinOverlay {
  background: rgba(2,6,23,.72) !important;
  backdrop-filter: blur(4px) !important;
}
#authOverlay .panel, #pinOverlay .panel {
  background:#0b1320 !important; border:1px solid #334155 !important; color:#e5e7eb !important;
}

/* ---- Colorear grupos de historial por saleId (si tu JS usa estas clases) ---- */
.saleC0  { background: rgba(56,189,248,.10) !important; }
.saleC1  { background: rgba(34,197,94,.10)  !important; }
.saleC2  { background: rgba(250,204,21,.12) !important; }
.saleC3  { background: rgba(244,114,182,.12)!important; }
.saleC4  { background: rgba(147,197,253,.12)!important; }
.saleC5  { background: rgba(248,113,113,.12)!important; }

/* ---- Impresión: fondo blanco, texto negro ---- */
@media print {
  body { background:#fff !important; color:#000 !important; }
  .table-wrap, .panel { background:#fff !important; border-color:#000 !important; box-shadow:none !important; }
  th, td { color:#000 !important; border-color:#000 !important; }
  button, .btn { background:#111 !important; color:#fff !important; box-shadow:none !important; }
}
/* ===========================
   FIX COLUMNA ACCIONES + SCROLL
   =========================== */

/* Si tu <th> ya se llama Acciones, lo fuerzo por selector.
   Si usas otra etiqueta, añade class="acciones" al <th> y <td>. */
#tablaInventario th:last-child,
#tablaInventario th.acciones,
#tablaInventario [data-col="acciones"] {
  width: 320px !important;       /* ancho cómodo para 3 botones */
  min-width: 280px !important;
  text-align: left !important;
}

/* Las celdas de acciones aceptan “wrap” y muestran los botones bien */
#tablaInventario td:last-child,
#tablaInventario td.acciones {
  min-width: 280px !important;
  white-space: normal !important;
  padding: 8px !important;
}

/* Botones dentro de Acciones: en varias filas si hace falta */
#tablaInventario td:last-child .btn,
#tablaInventario td.acciones .btn,
#tablaInventario td:last-child button,
#tablaInventario td.acciones button {
  display: inline-flex !important;
  margin: 4px 6px 4px 0 !important;
  padding: 8px 10px !important;
  line-height: 1.1 !important;
}

/* Si usas un contenedor para los botones */
#tablaInventario td .btn-group {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
}

/* Mantener la tabla normal dentro del contenedor con scroll vertical */
#tablaInventario {
  display: table !important;
  overflow: visible !important;
}

/* ===========================
   COLORES POR VENTA EN HISTORIAL
   (clases que añadirá el JS)
   =========================== */
.saleC0  { background: rgba(56,189,248,.12) !important; }   /* celeste   */
.saleC1  { background: rgba(34,197,94,.14)  !important; }   /* verde     */
.saleC2  { background: rgba(250,204,21,.16) !important; }   /* dorado    */
.saleC3  { background: rgba(244,114,182,.14)!important; }   /* rosa      */
.saleC4  { background: rgba(147,197,253,.14)!important; }   /* azul claro*/
.saleC5  { background: rgba(248,113,113,.14)!important; }   /* rojo      */

/* El texto siempre legible sobre esos fondos */
#tablaHistorial tbody tr[class^="saleC"] td {
  color: #e5e7eb !important;
}

/* Reportes: Columna Total más ancha para ver números completos */
#tablaTopProductos,
#tablaComprasProveedor {
  width: 100% !important;
  table-layout: fixed !important;
}

#tablaTopProductos th:first-child,
#tablaTopProductos td:first-child,
#tablaComprasProveedor th:first-child,
#tablaComprasProveedor td:first-child {
  width: 40% !important;
  text-align: left !important;
}

#tablaTopProductos th:last-child,
#tablaTopProductos td:last-child,
#tablaComprasProveedor th:last-child,
#tablaComprasProveedor td:last-child {
  width: 60% !important;
  text-align: left !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
}

/* ============================================
   OVERRIDE FINAL — Scroll VERTICAL en tablas
   ============================================ */
.table-wrap {
  max-height: 50vh !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

@media (max-height: 800px){
  .table-wrap {
    max-height: 44vh !important;
  }
}

/* Evita que la tabla se convierta en bloque con scroll propio */
.table-wrap > table,
#tablaInventario,
#tablaHistorial,
#tablaCaja,
#tablaCompras,
#tablaProveedores,
#tablaProduccion,
#tablaTopProductos,
#tablaComprasProveedor {
  display: table !important;
  overflow: visible !important;
  width: 100% !important;
}

/* ============================================
   CAJA — restaurar diseño original compacto
   (solo fix fecha/hora sin superposición)
   ============================================ */
#caja .panel-grid {
  grid-template-columns: repeat(2, minmax(300px, 1fr));
  align-items: start;
}

#caja .panel {
  padding: 12px;
}

#caja #formAperturaCaja,
#caja #formCierreCaja {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px !important;
  align-items: end;
}

#caja #formAperturaCaja .form-row-2,
#caja #formCierreCaja .form-row-2 {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#caja #formAperturaCaja label,
#caja #formCierreCaja label {
  margin: 0;
  display: grid;
  gap: 6px;
  min-width: 0;
}

#caja #formAperturaCaja .form-row-2 input[type="date"],
#caja #formAperturaCaja .form-row-2 input[type="time"],
#caja #formCierreCaja .form-row-2 input[type="date"],
#caja #formCierreCaja .form-row-2 input[type="time"] {
  width: 100%;
  min-width: 0;
  height: 36px;
}

#caja #formAperturaCaja button,
#caja #formCierreCaja button {
  grid-column: 1 / -1;
  justify-self: start;
}

#caja .table-wrap {
  max-height: 34vh !important;
  overflow: auto !important;
}

@media (max-width: 900px) {
  #caja .panel-grid {
    grid-template-columns: 1fr;
  }
}

/* Inventario: layout estable en TODAS las columnas (sin encimado) */
#inventario .table-wrap {
  overflow: auto !important;
}

#tablaInventario {
  width: 100% !important;
  min-width: 1450px !important;
  table-layout: fixed !important;
}

#tablaInventario th,
#tablaInventario td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

#tablaInventario th:nth-child(1), #tablaInventario td:nth-child(1) { width: 11ch !important; }
#tablaInventario th:nth-child(2), #tablaInventario td:nth-child(2) { width: 12ch !important; }
#tablaInventario th:nth-child(3), #tablaInventario td:nth-child(3) { width: 12ch !important; }
#tablaInventario th:nth-child(4), #tablaInventario td:nth-child(4) { width: 30ch !important; text-align: left !important; }
#tablaInventario th:nth-child(5), #tablaInventario td:nth-child(5) { width: 20ch !important; text-align: left !important; }
#tablaInventario th:nth-child(6), #tablaInventario td:nth-child(6) { width: 14ch !important; }
#tablaInventario th:nth-child(7), #tablaInventario td:nth-child(7) { width: 14ch !important; }
#tablaInventario th:nth-child(8), #tablaInventario td:nth-child(8) { width: 14ch !important; }
#tablaInventario th:nth-child(9), #tablaInventario td:nth-child(9) { width: 10ch !important; }
#tablaInventario th:nth-child(10), #tablaInventario td:nth-child(10) { width: 32ch !important; }

#tablaInventario td:nth-child(10) {
  white-space: normal !important;
  overflow: visible !important;
}

#tablaInventario td:nth-child(10) button {
  margin: 2px 4px 2px 0 !important;
}

#tablaInventario td.inv-col-producto .inv-ellipsis,
#tablaInventario td.inv-col-categoria .inv-ellipsis {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Inventario: scroll interno vertical + horizontal */
#inventario .table-wrap {
  max-height: 62vh !important;
  overflow-y: auto !important;
  overflow-x: auto !important;
}

@media (max-height: 820px) {
  #inventario .table-wrap {
    max-height: 52vh !important;
  }
}

/* ==========================================
   INVENTARIO Y POS 2026
========================================== */
#inventario,
#ventas {
  position: relative;
}

.section-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #67e8f9;
  font-weight: 800;
}

.inventory-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin: 8px 0 18px;
}

.inventory-header h2,
.pos-header h2 {
  margin: 0;
}

.inventory-copy,
.pos-copy {
  margin: 8px 0 0;
  max-width: 640px;
  color: #cbd5e1;
  line-height: 1.55;
}

.inventory-chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(34,197,94,0.18), rgba(34,211,238,0.18));
  border: 1px solid rgba(103,232,249,0.25);
  color: #dcfce7;
  font-weight: 700;
  white-space: nowrap;
}

#formularioInventario {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  padding: 20px;
  margin: 16px 0 18px;
  border-radius: 20px;
  background:
    radial-gradient(circle at top right, rgba(34,211,238,0.16), transparent 30%),
    linear-gradient(160deg, rgba(15,23,42,0.96), rgba(17,24,39,0.92));
  border: 1px solid rgba(148,163,184,0.18);
  box-shadow: 0 22px 56px rgba(2,6,23,0.34);
}

#formularioInventario label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #dbeafe;
  font-size: 0.95rem;
  font-weight: 700;
}

#formularioInventario input[type="text"],
#formularioInventario input[type="number"],
#formularioInventario input[type="date"],
#formularioInventario select {
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(96,165,250,0.18);
  background: rgba(15,23,42,0.88);
  color: #f8fafc;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#formularioInventario input[readonly] {
  background: rgba(2,6,23,0.64);
  color: #93c5fd;
  border-style: dashed;
}

#formularioInventario input:focus,
#formularioInventario select:focus {
  border-color: rgba(34,211,238,0.9);
  box-shadow: 0 0 0 4px rgba(34,211,238,0.18);
}

.inventory-toggle {
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(15,23,42,0.64);
  border: 1px solid rgba(96,165,250,0.16);
}

.inventory-toggle input {
  width: 20px;
  height: 20px;
}

.inventory-presentaciones-card {
  grid-column: 1 / -1;
  padding: 18px;
  border-radius: 18px;
  background: rgba(2,6,23,0.4);
  border: 1px solid rgba(148,163,184,0.14);
}

.inventory-presentaciones-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.inventory-presentaciones-head strong {
  display: block;
  color: #f8fafc;
  margin-bottom: 4px;
}

.inventory-presentaciones-head small {
  color: #94a3b8;
}

.inventory-presentaciones-list {
  display: grid;
  gap: 10px;
}

.inventory-presentaciones-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr 0.9fr 1fr auto;
  gap: 10px;
  align-items: center;
}

.inventory-presentaciones-grid--labels {
  color: #93c5fd;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.inventory-presentacion-row {
  padding: 10px;
  border-radius: 16px;
  background: rgba(15,23,42,0.72);
  border: 1px solid rgba(96,165,250,0.14);
}

.inv-pres-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.inv-pres-decimal-toggle {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 6px;
  color: #bfdbfe !important;
  font-size: 0.84rem !important;
  font-weight: 700 !important;
}

#formularioInventario button[type="submit"] {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #22c55e, #06b6d4);
  color: #031525;
  font-weight: 900;
  border: none;
  box-shadow: 0 18px 34px rgba(6,182,212,0.2);
}

.inventory-form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.inventory-form-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inventory-edit-state {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(34,211,238,0.12);
  border: 1px solid rgba(34,211,238,0.24);
  color: #a5f3fc;
  font-size: 0.88rem;
  font-weight: 800;
}

#btnCancelarEdicionInventario {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
}

#tablaInventario {
  width: 100%;
  table-layout: fixed;
}

#tablaInventario th:nth-child(1),
#tablaInventario td:nth-child(1) { width: 10ch !important; }
#tablaInventario th:nth-child(2),
#tablaInventario td:nth-child(2) { width: 11ch !important; }
#tablaInventario th:nth-child(3),
#tablaInventario td:nth-child(3) { width: 11ch !important; }
#tablaInventario th:nth-child(4),
#tablaInventario td:nth-child(4) { width: 24ch !important; text-align: left !important; }
#tablaInventario th:nth-child(5),
#tablaInventario td:nth-child(5) { width: 18ch !important; text-align: left !important; }
#tablaInventario th:nth-child(6),
#tablaInventario td:nth-child(6) { width: 12ch !important; }
#tablaInventario th:nth-child(7),
#tablaInventario td:nth-child(7) { width: 14ch !important; }
#tablaInventario th:nth-child(8),
#tablaInventario td:nth-child(8) { width: 14ch !important; }
#tablaInventario th:nth-child(9),
#tablaInventario td:nth-child(9) { width: 26ch !important; text-align: left !important; }
#tablaInventario th:nth-child(10),
#tablaInventario td:nth-child(10) { width: 15ch !important; }
#tablaInventario th:nth-child(11),
#tablaInventario td:nth-child(11) { width: 28ch !important; }

.inventory-unit-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(34,211,238,0.12);
  color: #67e8f9;
  border: 1px solid rgba(103,232,249,0.22);
  font-size: 0.84rem;
  font-weight: 800;
}

.inventory-base-copy,
.historial-base-cantidad {
  display: block;
  margin-top: 4px;
  color: #94a3b8;
  font-size: 0.78rem;
}

.inv-col-presentaciones .inv-ellipsis {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inventory-summary-card {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.inventory-summary-card > div {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(15,23,42,0.84);
  border: 1px solid rgba(148,163,184,0.15);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inventory-summary-card strong {
  color: #93c5fd;
}

.inventory-summary-card .num {
  font-size: 1.2rem;
  color: #f8fafc;
}

#tablaPuntoVenta input[type="text"],
#tablaPuntoVenta input[type="number"],
#tablaPuntoVenta select {
  width: 100%;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,0.16);
  background: rgba(15,23,42,0.86);
  color: #f8fafc;
  padding: 10px 12px;
}

#tablaPuntoVenta input:focus,
#tablaPuntoVenta select:focus {
  border-color: rgba(34,211,238,0.9);
  box-shadow: 0 0 0 3px rgba(34,211,238,0.16);
  outline: none;
}

#tablaPuntoVenta .pv-stock {
  font-size: 0.85rem;
  color: #bfdbfe;
  background: rgba(2,6,23,0.58);
}

#tablaPuntoVenta .pv-presentacion {
  min-width: 190px;
}

#tablaPuntoVenta .pv-sub {
  font-weight: 800;
}

#tablaPuntoVenta .pv-row-warning td {
  background: rgba(127,29,29,0.52);
}

#tablaPuntoVenta .pv-row-warning .pv-stock {
  color: #fecaca;
  border-color: rgba(248,113,113,0.5);
}

.pos-pro {
  margin-top: 12px;
  padding: 24px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(14,165,233,0.14), transparent 28%),
    linear-gradient(160deg, rgba(15,23,42,0.96), rgba(17,24,39,0.92));
  border: 1px solid rgba(148,163,184,0.18);
  box-shadow: 0 24px 56px rgba(2,6,23,0.34);
}

.pos-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.pos-datos,
.pos-totales {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.pos-datos {
  margin-bottom: 14px;
}

.pos-datos label,
.pos-totales label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #dbeafe;
  font-size: 0.95rem;
  font-weight: 700;
}

.pos-busqueda {
  position: relative;
  margin: 14px 0 18px;
}

.pos-busqueda > input {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(96,165,250,0.18);
  background: rgba(15,23,42,0.88);
  color: #f8fafc;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.pos-busqueda > input:focus {
  outline: none;
  border-color: rgba(34,211,238,0.9);
  box-shadow: 0 0 0 4px rgba(34,211,238,0.16);
}

.pos-carrito,
#inventario .table-wrap,
#historial .table-wrap {
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(148,163,184,0.12);
  background: rgba(2,6,23,0.44);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

#tablaInventario thead th,
#tablaPuntoVenta thead th,
#tablaHistorial thead th {
  background: linear-gradient(90deg, rgba(15,23,42,0.98), rgba(30,41,59,0.98));
  color: #93c5fd;
  font-size: 0.83rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(96,165,250,0.12);
}

#tablaInventario tbody td,
#tablaPuntoVenta tbody td,
#tablaHistorial tbody td {
  background: rgba(15,23,42,0.84);
  border-bottom: 1px solid rgba(51,65,85,0.4);
}

#tablaInventario tbody tr:hover td,
#tablaPuntoVenta tbody tr:hover td,
#tablaHistorial tbody tr:hover td {
  background: rgba(30,41,59,0.92);
}

#tablaPuntoVenta {
  width: 100%;
  border-collapse: collapse;
}

.pos-totales {
  margin-top: 18px;
}

.pos-acciones {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}

.pos-acciones button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid rgba(96,165,250,0.2);
  font-weight: 800;
}

.pos-acciones #btnRegistrarPuntoVenta {
  background: linear-gradient(135deg, #22c55e, #06b6d4);
  color: #031525;
  border: none;
}

.pos-acciones #btnImprimirUltima {
  background: rgba(15,23,42,0.72);
  color: #e2e8f0;
}

.pos-carrito {
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

#tablaPuntoVenta {
  width: 100% !important;
  min-width: 1180px !important;
  table-layout: fixed !important;
}

#tablaPuntoVenta th,
#tablaPuntoVenta td {
  vertical-align: middle;
}

#tablaPuntoVenta th:nth-child(1),
#tablaPuntoVenta td:nth-child(1) { width: 12ch !important; }
#tablaPuntoVenta th:nth-child(2),
#tablaPuntoVenta td:nth-child(2) { width: 24ch !important; }
#tablaPuntoVenta th:nth-child(3),
#tablaPuntoVenta td:nth-child(3) { width: 24ch !important; }
#tablaPuntoVenta th:nth-child(4),
#tablaPuntoVenta td:nth-child(4) { width: 15ch !important; }
#tablaPuntoVenta th:nth-child(5),
#tablaPuntoVenta td:nth-child(5) { width: 11ch !important; }
#tablaPuntoVenta th:nth-child(6),
#tablaPuntoVenta td:nth-child(6) { width: 20ch !important; }
#tablaPuntoVenta th:nth-child(7),
#tablaPuntoVenta td:nth-child(7) { width: 15ch !important; }
#tablaPuntoVenta th:nth-child(8),
#tablaPuntoVenta td:nth-child(8) { width: 14ch !important; }

#tablaPuntoVenta input[type="text"],
#tablaPuntoVenta input[type="number"],
#tablaPuntoVenta select {
  box-sizing: border-box;
  min-width: 0 !important;
  max-width: 100%;
}

#tablaPuntoVenta .pv-presentacion {
  min-width: 0 !important;
}

.inventory-search-shell {
  position: relative;
  margin: 14px 0 18px;
}

#inventario .pos-resultados {
  left: 0;
  right: 0;
  top: calc(100% - 1px);
  width: 100%;
  min-width: 0;
  z-index: 30;
}

#ventas {
  width: min(1500px, calc(100vw - 24px));
  max-width: none;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  margin-inline: 0;
}

#ventas .pos-pro {
  width: 100%;
}

.pos-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(360px, 420px);
  gap: 20px;
  align-items: start;
  margin-top: 18px;
}

.pos-main,
.pos-side {
  min-width: 0;
}

.pos-side {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 18px;
}

.pos-totales {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 0;
}

.pos-total-card {
  min-width: 0;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(15,23,42,0.92), rgba(2,6,23,0.86));
  border: 1px solid rgba(96,165,250,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.pos-total-card span {
  display: block;
  margin-bottom: 10px;
  color: #93c5fd;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pos-total-card input {
  width: 100%;
  min-width: 0;
  min-height: 60px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,0.16);
  background: rgba(15,23,42,0.78);
  color: #f8fafc;
  font-size: 1.16rem;
  font-weight: 800;
  text-align: right;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}

.pos-total-card select {
  width: 100%;
  min-width: 0;
  min-height: 60px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,0.16);
  background: rgba(15,23,42,0.78);
  color: #f8fafc;
  font-size: 1.02rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.02em;
  box-sizing: border-box;
}

.pos-total-card input:focus {
  outline: none;
  border-color: rgba(34,211,238,0.9);
  box-shadow: 0 0 0 4px rgba(34,211,238,0.14);
}

.pos-total-card select:focus {
  outline: none;
  border-color: rgba(34,211,238,0.9);
  box-shadow: 0 0 0 4px rgba(34,211,238,0.14);
}

.pos-total-card--primary {
  grid-column: 1 / -1;
  padding: 18px;
  background:
    radial-gradient(circle at top right, rgba(34,211,238,0.14), transparent 34%),
    linear-gradient(135deg, rgba(2,132,199,0.22), rgba(15,23,42,0.96));
  border-color: rgba(34,211,238,0.22);
}

.pos-total-card--primary input {
  min-height: 78px;
  font-size: clamp(2rem, 2.6vw, 3.1rem);
  color: #67e8f9;
  background: rgba(2,6,23,0.52);
  border-color: rgba(34,211,238,0.24);
  text-shadow: 0 2px 16px rgba(34,211,238,0.18);
}

.pos-total-card--subtotal input,
.pos-total-card--received input,
.pos-total-card--change input {
  font-size: 1.28rem;
}

.pos-total-card--change input {
  color: #86efac;
}

.pos-total-card--discount input {
  text-align: right;
}

.pos-total-card--discount {
  display: grid;
  gap: 10px;
  align-content: start;
}

.pos-discount-controls {
  display: block;
}

.pos-discount-shell {
  display: grid;
  grid-template-columns: minmax(112px, 124px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  position: relative;
  min-width: 0;
  min-height: 60px;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,0.16);
  background:
    linear-gradient(180deg, rgba(15,23,42,0.92), rgba(15,23,42,0.76));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 12px 30px rgba(2,6,23,0.22);
  padding: 6px;
}

.pos-discount-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 0;
  min-height: 48px;
}

.pos-discount-toggle {
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #94a3b8;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.pos-discount-toggle:hover {
  color: #e2e8f0;
}

.pos-discount-toggle.is-active {
  background: linear-gradient(135deg, rgba(34,211,238,0.22), rgba(14,165,233,0.16));
  color: #67e8f9;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 10px 18px rgba(8,145,178,0.16);
}

.pos-discount-input-shell {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 10px 0 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.pos-discount-input-shell input {
  width: 100%;
  min-height: 48px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.pos-discount-toggle:focus,
.pos-discount-input-shell input:focus {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}

.pos-discount-input-shell:focus-within,
.pos-discount-switch:focus-within {
  border-color: transparent;
  box-shadow: none;
}

.pos-discount-shell:focus-within {
  border-color: rgba(34,211,238,0.9);
  box-shadow:
    0 0 0 4px rgba(34,211,238,0.14),
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 12px 30px rgba(2,6,23,0.22);
}

.pos-discount-meta {
  display: block;
  margin-top: 0;
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  min-height: 1.2em;
}

.pos-discount-input {
  font-size: 1.26rem;
  font-weight: 900;
  color: #f8fafc;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 1.18rem;
}

.pos-money-field {
  overflow: hidden;
  text-overflow: clip;
  transition: font-size 120ms ease;
}

.pos-money-field--primary {
  letter-spacing: 0;
}

.pos-money-field--secondary {
  letter-spacing: 0.01em;
}

.pos-checkout-panel {
  display: grid;
  gap: 18px;
  padding: 22px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(34,211,238,0.1), transparent 24%),
    linear-gradient(180deg, rgba(15,23,42,0.96), rgba(2,6,23,0.92));
  border: 1px solid rgba(148,163,184,0.16);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 24px 50px rgba(2,6,23,0.28);
}

.pos-summary-list,
.pos-payment-list {
  display: grid;
  gap: 0;
}

.pos-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 230px);
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(148,163,184,0.12);
}

.pos-summary-list .pos-summary-row:first-child,
.pos-payment-list .pos-summary-row:first-child {
  padding-top: 0;
}

.pos-payment-list .pos-summary-row:last-child,
.pos-summary-list .pos-summary-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.pos-summary-row--discount {
  grid-template-columns: 1fr;
  align-items: start;
}

.pos-summary-copy {
  display: grid;
  gap: 4px;
}

.pos-summary-label {
  color: #e2e8f0;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.pos-summary-note {
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.pos-total-strip {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(34,211,238,0.16), transparent 28%),
    linear-gradient(135deg, rgba(3,105,161,0.24), rgba(15,23,42,0.98));
  border: 1px solid rgba(34,211,238,0.2);
}

.pos-total-strip-label {
  color: #bae6fd;
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pos-total-strip .pos-money-field {
  min-height: 74px;
  padding: 0;
  border: 0;
  background: transparent;
  text-shadow: none;
}

.pos-summary-row .pos-money-field {
  min-height: 54px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,0.14);
  background: rgba(15,23,42,0.72);
}

.pos-summary-row--change .pos-money-field {
  color: #86efac;
}

@media (max-width: 720px) {
  .pos-discount-controls {
    display: block;
  }

  .pos-discount-shell {
    grid-template-columns: 1fr;
    min-height: 56px;
  }

  .pos-discount-switch {
    width: 100%;
  }

  .pos-summary-row {
    grid-template-columns: 1fr;
  }
}

.pos-acciones {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 0;
}

.pos-acciones button {
  width: 100%;
  justify-content: center;
}

#tablaPuntoVenta th:nth-child(4),
#tablaPuntoVenta td:nth-child(4) { width: 18ch !important; }
#tablaPuntoVenta th:nth-child(7),
#tablaPuntoVenta td:nth-child(7) { width: 18ch !important; }

#tablaPuntoVenta .pv-precio,
#tablaPuntoVenta .pv-sub {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#tablaPuntoVenta .pv-sub {
  font-size: 1rem;
}

#tablaPuntoVenta tbody tr:focus-within td {
  background: rgba(8, 145, 178, 0.16);
  box-shadow: inset 0 0 0 1px rgba(34,211,238,0.16);
}

#tablaPuntoVenta tbody tr:focus-within .pv-sub {
  color: #67e8f9;
}

@media (max-width: 1180px) {
  #ventas {
    width: 100%;
    left: 0;
    transform: none;
  }

  .pos-stage {
    grid-template-columns: 1fr;
  }

  .pos-side {
    position: static;
  }

  .pos-totales {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .pos-acciones {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .inventory-header,
  .inventory-presentaciones-head,
  .pos-header {
    flex-direction: column;
    align-items: stretch;
  }

  .inventory-presentaciones-grid {
    grid-template-columns: 1fr;
  }

  .inventory-presentaciones-grid--labels {
    display: none;
  }

  .inventory-form-actions,
  .inventory-form-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .pos-totales,
  .pos-acciones {
    grid-template-columns: 1fr;
  }

  .pos-total-card--primary input {
    font-size: clamp(1.7rem, 7vw, 2.4rem);
  }
}

/* Login PIN: input + boton en la misma fila */
#authOverlay #formAuth {
  display: flex !important;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 0;
}

#authOverlay #formAuth label {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

#authOverlay #formAuth .actions {
  margin-top: 0;
  flex: 0 0 auto;
  justify-content: flex-start;
}

#authOverlay #formAuth #btnLogin {
  white-space: nowrap;
  min-width: 110px;
  height: 42px;
}

@media (max-width: 520px) {
  #authOverlay #formAuth {
    flex-direction: column;
    align-items: stretch;
  }

  #authOverlay #formAuth .actions {
    justify-content: stretch;
  }

  #authOverlay #formAuth #btnLogin {
    width: 100%;
  }
}

/* Overlay de licencia backend (trial + activacion manual) */
.license-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 15%, rgba(34, 211, 238, 0.22), transparent 35%),
    radial-gradient(circle at 82% 86%, rgba(37, 99, 235, 0.2), transparent 36%),
    rgba(2, 6, 23, 0.82);
}

.license-overlay.hidden {
  display: none !important;
}

.license-modal {
  width: min(560px, 100%);
  background: linear-gradient(180deg, #ffffff 0%, #f7f9ff 100%);
  border-radius: 20px;
  border: 1px solid #d7e2f6;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.38);
  padding: 26px;
  display: grid;
  gap: 14px;
  color: #0f172a;
}

.license-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
}

.license-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #17438d 0%, #2962ff 100%);
  box-shadow: 0 14px 26px rgba(15, 53, 122, 0.36);
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.license-icon-wrap img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.license-modal h3 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.license-note {
  color: #52627b;
  margin: 0;
  line-height: 1.45;
}

.license-form {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 12px;
  margin-bottom: 0;
}

.license-form label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #4c5d78;
  margin-bottom: 6px;
}

.license-form input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #ccd8ec;
  background: #fbfcff;
  color: #132238;
  padding: 11px 12px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.license-form input:focus {
  border-color: #3f74ff;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(63, 116, 255, 0.14);
}

.license-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.license-btn-primary,
.license-btn-secondary {
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.license-btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #2563eb 0%, #4a7bff 100%);
  box-shadow: 0 10px 22px rgba(41, 98, 255, 0.34);
}

.license-btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #3f6ff0 100%);
  transform: translateY(-1px);
}

.license-btn-secondary {
  color: #0f172a;
  background: #e8edf6;
  border: 1px solid #d4ddeb;
}

.license-btn-secondary:hover {
  background: #dbe4f2;
  transform: translateY(-1px);
}

#backendAccessStatus {
  min-height: 20px;
  font-size: 13px;
}

.access-status-info {
  color: #52627b;
}

.access-status-success {
  color: #16a34a;
}

.access-status-error {
  color: #dc2626;
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .license-head {
    grid-template-columns: 1fr;
  }

  .license-icon-wrap {
    width: 52px;
    height: 52px;
  }
}

/* Fix definitivo: campos de acceso backend siempre legibles */
#backendAccessOverlay #backendAuthEmail,
#backendAccessOverlay #backendAuthPassword {
  background: #0f172a !important;
  color: #f8fafc !important;
  -webkit-text-fill-color: #f8fafc !important;
  caret-color: #22d3ee !important;
  border: 1px solid #334155 !important;
  border-radius: 12px !important;
}

#backendAccessOverlay #backendAuthEmail::placeholder,
#backendAccessOverlay #backendAuthPassword::placeholder {
  color: #94a3b8 !important;
  -webkit-text-fill-color: #94a3b8 !important;
  opacity: 1 !important;
}

#backendAccessOverlay #backendAuthEmail:focus,
#backendAccessOverlay #backendAuthPassword:focus {
  border-color: #22d3ee !important;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.3) !important;
}

#backendAccessOverlay #backendAuthEmail:-webkit-autofill,
#backendAccessOverlay #backendAuthPassword:-webkit-autofill {
  -webkit-text-fill-color: #f8fafc !important;
  box-shadow: 0 0 0 1000px #0f172a inset !important;
}

/* Documentos (mobile): scroll lateral para columnas de items */
#documentos .table-wrap {
  overflow-x: auto !important;
  overflow-y: auto !important;
  max-height: none !important;
  -webkit-overflow-scrolling: touch;
}

#documentos #tablaNotaVenta,
#documentos #tablaPresupuesto {
  min-width: 920px;
}

#documentos #tablaNotaVenta th,
#documentos #tablaNotaVenta td,
#documentos #tablaPresupuesto th,
#documentos #tablaPresupuesto td {
  white-space: nowrap;
}

#documentos #tablaNotaVenta .doc-codigo,
#documentos #tablaNotaVenta .doc-precio,
#documentos #tablaNotaVenta .doc-cant,
#documentos #tablaNotaVenta .doc-sub,
#documentos #tablaPresupuesto .doc-codigo,
#documentos #tablaPresupuesto .doc-precio,
#documentos #tablaPresupuesto .doc-cant,
#documentos #tablaPresupuesto .doc-sub {
  min-width: 110px;
}

#documentos #tablaNotaVenta .doc-producto,
#documentos #tablaNotaVenta .doc-categoria,
#documentos #tablaPresupuesto .doc-producto,
#documentos #tablaPresupuesto .doc-categoria {
  min-width: 160px;
}
