:root{
--sab-green:#0b3a35; /* verde oscuro Sabai */
--sab-green-2:#0e4a43; /* hover */
--sab-accent:#19c2a6; /* acento */
--bg:#0f0f10;
--panel:#1b1c1e;
--panel-2:#232528;
--text:#eaeaea;
--muted:#a9b3b2;
--shadow:0 12px 30px rgba(0,0,0,.35);
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,"Helvetica Neue",Arial}
a{color:inherit;text-decoration:none}


/* HEADER */
.header{position:sticky;top:0;z-index:50;background:var(--sab-green);box-shadow:0 2px 0 rgba(255,255,255,.04)}
.header .wrap{max-width:1200px;margin:auto;display:flex;align-items:center;gap:18px;padding:14px 20px}
.logo{display:flex;align-items:center;gap:10px;font-weight:800;letter-spacing:.3px}
.logo img{height:34px}
.nav{display:flex;gap:18px;margin-left:auto}
.nav a{padding:8px 10px;border-radius:10px;color:#dff6f2}
.nav a.active,.nav a:hover{background:rgba(255,255,255,.08)}
.logout{margin-left:12px;background:#c62828;color:#fff;border:0;border-radius:10px;padding:8px 12px;cursor:pointer}


/* PAGE */
.container{max-width:1200px;margin:28px auto;padding:0 20px}
.title{font-size:28px;font-weight:800;margin:10px 0 18px}
.subtitle{color:var(--muted);margin-bottom:18px}


/* CARDS */
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:22px}
.card{background:linear-gradient(180deg,var(--panel),var(--panel-2));border-radius:16px;padding:22px;box-shadow:var(--shadow);transition:.2s}
.card:hover{transform:translateY(-4px)}
.card .icon{font-size:34px;margin-bottom:10px}
.card h3{margin:0 0 6px}
.card p{margin:0;color:var(--muted)}


/* TABLE */
.table{width:100%;border-collapse:separate;border-spacing:0 10px}
.table th{color:#cfeee8;text-align:left;padding:10px}
.table td{background:var(--panel);padding:14px;border-top:1px solid rgba(255,255,255,.05);border-bottom:1px solid rgba(255,255,255,.05)}
.table tr td:first-child{border-radius:12px 0 0 12px}
.table tr td:last-child{border-radius:0 12px 12px 0}
.badge{padding:4px 8px;border-radius:999px;font-weight:700}
.badge.ok{background:#1e6b5f}
.badge.low{background:#9c6b00}
.badge.critical{background:#8b1e1e}


/* FORMS */
.input{background:#111;border:1px solid rgba(255,255,255,.1);color:#fff;border-radius:10px;padding:10px}
.btn{background:var(--sab-accent);color:#003a33;border:0;border-radius:10px;padding:10px 14px;font-weight:800;cursor:pointer}
.btn.secondary{background:#2a2f33;color:#fff}


/* FOOTER */
.footer{opacity:.6;text-align:center;margin:40px 0}

/* ================================
   FIX DEFINITIVO – MAIN MENU
================================ */

/* RESET LINKS */
a {
  text-decoration: none !important;
  color: inherit !important;
}

/* FONDO CLARO */
body {
  background: #f4f6f8 !important;
  color: #1e1e1e;
}

/* CONTENEDOR PRINCIPAL */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 20px;
  text-align: center;
}

/* HEADER */
.sab-header {
  background: #063a34;
  padding: 15px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sab-header img {
  height: 40px;
}

/* NAV */
.sab-nav a {
  color: white !important;
  margin-left: 20px;
  font-weight: 500;
}

/* GRID MENU (ESTO ES CLAVE) */
.menu {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 25px;
  margin-top: 40px;
}

/* MENU SECTION TITLES */
.menu-section-title {
  grid-column: 1 / -1;
  font-size: 14px;
  font-weight: 700;
  color: #063a34;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px 0;
  margin-top: 20px;
  border-bottom: 2px solid #063a34;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.menu-section-title:first-child {
  margin-top: 0;
}

.menu-section-title i {
  font-size: 16px;
  color: #0e4a43;
}

/* CARDS */
.card {
  background: white !important;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 10px 25px rgba(0,0,0,.08);
  transition: transform .2s ease, box-shadow .2s ease;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 15px 35px rgba(0,0,0,.15);
}

.card h3 {
  margin-top: 15px;
}

.card p {
  color: #555;
}

/* ICONOS */
.card .icon {
  font-size: 42px;
  color: #063a34;
}

/* BOTÓN LOGOUT */
.btn-logout {
  background: #c62828;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  float: right;
}

/* ================= DASHBOARD TABLA ================= */

.sab-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  background: #ffffff;
  color: #222;
  border-radius: 10px;
  overflow: hidden;
}

.sab-table thead {
  background: #0b3d2e;
  color: #ffffff;
}

.sab-table th,
.sab-table td {
  padding: 14px 16px;
  text-align: left;
}

.sab-table tbody tr {
  border-bottom: 1px solid #e6e6e6;
}

.sab-table tbody tr:nth-child(even) {
  background: #f6f8f7;
}

.sab-table tbody tr:hover {
  background: #eef5f1;
}

.sab-table td {
  color: #222;
  font-weight: 500;
}

/* =========================
   CAJA
========================= */

.input-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  align-items: center;
}

.input-row input {
  flex: 1;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fafafa;
  box-sizing: border-box;
}

.input-row input:focus {
  outline: none;
  border-color: #0e4a43;
  background: #fff;
}

/* ================================
   GLOBAL FORM GRID
================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 15px;
}

.form-grid input,
.form-grid select {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: #fafafa;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.form-grid input:focus,
.form-grid select:focus {
  outline: none;
  border-color: #0e4a43;
  background: #fff;
}

.total-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0;
  padding: 15px;
  background: #f4f6f5;
  border-radius: 8px;
  font-size: 20px;
}

.btn-danger {
  background: #c62828;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-danger:hover {
  background: #b71c1c;
}

/* =========================================
   MODO CLARO – INVENTARIO
========================================= */

.page-light .card {
  background: #ffffff;
  color: #111;
}

.page-light .table-card {
  background: #ffffff;
}

.page-light table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

.page-light thead th {
  background: #f2f4f3;
  color: #0f3d33; /* verde Sabai */
  font-weight: 600;
  padding: 14px;
  text-align: left;
}

.page-light tbody tr {
  background: #ffffff;
  border-bottom: 1px solid #e6e6e6;
}

.page-light tbody tr:nth-child(even) {
  background: #fafafa;
}

.page-light td {
  color: #222;
  padding: 14px;
  font-size: 15px;
}

/* ALERTAS */
.page-light .alert-ok {
  color: #1fa971;
  font-weight: bold;
}

.page-light .alert-low {
  color: #e6a700;
  font-weight: bold;
}

.page-light .alert-critical {
  color: #d62828;
  font-weight: bold;
}

/* =========================================
   INVENTARIO – FORZAR MODO CLARO
========================================= */

.page-light #inventory-table,
.page-light #inventory-table tbody,
.page-light #inventory-table tr {
  background: transparent !important;
}

.page-light #inventory-table tbody tr {
  background: #ffffff !important;
  color: #111 !important;
  border-radius: 8px;
}

.page-light #inventory-table tbody tr:nth-child(even) {
  background: #f8f9f8 !important;
}

.page-light #inventory-table td {
  background: transparent !important;
  color: #222 !important;
  padding: 14px;
  font-size: 15px;
}

.page-light #inventory-table thead th {
  background: #f1f4f3 !important;
  color: #0f3d33 !important;
  font-weight: 600;
  padding: 14px;
}

/* ALERTAS */
.page-light .alert-ok {
  color: #1fa971 !important;
  font-weight: bold;
}

.page-light .alert-low {
  color: #e6a700 !important;
  font-weight: bold;
}

.page-light .alert-critical {
  color: #d62828 !important;
  font-weight: bold;
}

/* ================================
   LOGIN – SABAI STYLE
================================ */

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f6f5;
}

.login-card {
  background: #ffffff;
  padding: 40px 45px;
  border-radius: 14px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 15px 40px rgba(0,0,0,.08);
  text-align: center;
}

.login-logo {
  width: 120px;
  margin-bottom: 20px;
}

.login-card h1 {
  margin: 0;
  font-size: 1.6rem;
  color: #0b3b32;
}

.login-subtitle {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 25px;
}

.login-field {
  text-align: left;
  margin-bottom: 18px;
}

.login-field label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: #333;
}

.login-field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 1rem;
}

.login-field input:focus {
  outline: none;
  border-color: #0b3b32;
}

.login-btn {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  font-size: 1rem;
}



.login-error {
  margin-top: 15px;
  color: #d62828;
  font-size: 0.9rem;
}

/* ================================
   ADMIN – TABLA SESIONES
================================ */

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table thead th {
  background: #f0f3f2;
  color: #0b3b32;
  font-weight: 600;
  padding: 12px;
  text-align: center;
}

.admin-table tbody tr {
  background: #ffffff;
  transition: background 0.2s ease;
}

.admin-table tbody tr:hover {
  background: #f6f8f7;
}

.admin-table td {
  padding: 12px;
  text-align: center;
  color: #222;
  font-size: 0.95rem;
  border-bottom: 1px solid #e0e0e0;
}

/* Botón forzar cierre */
.btn-danger {
  background: #d62828;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-danger:hover {
  background: #b81f1f;
}

/* Botón eliminar usuario */
.btn-delete {
  background: #5c1a1a;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  margin-top: 5px;
}

.btn-delete:hover {
  background: #3d1111;
}

/* ================================
   ADMIN – TABLA CLARA
================================ */

.page-light .admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.page-light .admin-table thead th {
  background: #f1f3f2;
  color: #0f3d2e;
  font-weight: 600;
  padding: 12px;
  text-align: center;
  border-radius: 6px;
}

.page-light .admin-table tbody tr {
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(0,0,0,.06);
}

.page-light .admin-table td {
  padding: 14px;
  color: #222;
  text-align: center;
}

.page-light .admin-table tbody tr:hover {
  background: #f8f9f8;
}

/* Botón cerrar sesión individual */
.btn-close-session {
  background: #d32f2f;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-close-session:hover {
  background: #b71c1c;
}

/* ================================
   Z REPORT
================================ */

.z-action-card {
  text-align: center;
}

/* Selector de rango de fechas */
.date-range-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.date-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-input-group label {
  font-weight: 600;
  color: #0f3d2e;
}

.date-input-group input[type="date"] {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}

.date-input-group input[type="date"]:focus {
  outline: none;
  border-color: #2ecc71;
  box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.2);
}

.date-buttons {
  display: flex;
  gap: 8px;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #0f3d2e;
  background: transparent;
  color: #0f3d2e;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-small:hover {
  background: #0f3d2e;
  color: white;
}

/* Botones de cantidad +/- */
.quantity-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-qty {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #0f3d2e;
  background: white;
  color: #0f3d2e;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
  line-height: 1;
}

.btn-qty:hover {
  background: #0f3d2e;
  color: white;
}

.btn-qty:active {
  transform: scale(0.95);
}

.qty-value {
  min-width: 24px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
}

/* Fila de totales en tabla */
.total-row {
  background: #0f3d2e !important;
  color: white;
}

.total-row td,
.total-row td strong {
  color: white !important;
  font-weight: 600;
}

.z-message {
  margin-top: 15px;
  font-weight: 600;
  color: #0f3d2e;
}

.z-message.error {
  color: #d32f2f;
}

.z-result-card h2 {
  margin-bottom: 20px;
}

/* ================================
   EXCEL EXPORT/IMPORT BUTTONS
================================ */

.excel-actions {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

.excel-actions h3 {
  margin-bottom: 15px;
  color: #0f3d2e;
  font-size: 1rem;
}

.excel-buttons {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.btn-excel-export,
.btn-excel-import {
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-excel-export {
  background: #217346;
  color: white;
  border: none;
}

.btn-excel-export:hover {
  background: #1a5c38;
}

.btn-excel-import {
  background: #2b579a;
  color: white;
  border: none;
}

.btn-excel-import:hover {
  background: #1e3f6f;
}

.import-message {
  margin-top: 15px;
  padding: 10px 15px;
  border-radius: 6px;
  font-weight: 500;
}

.import-message.success {
  background: #d4edda;
  color: #155724;
}

.import-message.error {
  background: #f8d7da;
  color: #721c24;
}

/* ================================
   CAJA - MENÚ SECTION
================================ */

.menu-add-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.menu-add-row select {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  min-width: 180px;
}

.menu-add-row input[type="number"] {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
}

.subtotal-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: #f5f5f5;
  border-radius: 8px;
  margin-top: 15px;
  font-size: 1rem;
}

.subtotal-box strong {
  color: #0f3d2e;
  font-size: 1.1rem;
}

.total-final {
  background: #0f3d2e !important;
  color: white !important;
  padding: 20px;
  font-size: 1.3rem;
}

.total-final span,
.total-final strong {
  color: white !important;
}

.total-final strong {
  font-size: 1.8rem;
}

.btn-large {
  width: 100%;
  padding: 15px;
  font-size: 1.1rem;
  margin-top: 15px;
}

.btn-small {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.hidden {
  display: none;
}

.z-result {
  margin-top: 20px;
  padding: 20px;
  background: #f9fafb;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.z-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 15px 0;
}

.hidden {
  display: none;
}

/* ===================== */
/* CORTE Z – TABLA CLARA */
/* ===================== */

.z-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

.z-table thead th {
  background: #f1f3f2;
  color: #0b3d2e;
  font-weight: 600;
  padding: 12px;
  text-align: left;
  border-bottom: 2px solid #e0e0e0;
}

.z-table tbody tr {
  background: #ffffff;
  transition: background 0.2s ease;
}

.z-table tbody tr:nth-child(even) {
  background: #f9f9f9;
}

.z-table tbody tr:hover {
  background: #eef6f2;
}

.z-table td {
  padding: 12px;
  color: #222;
  border-bottom: 1px solid #eaeaea;
}

/* ===== RESET FONDO OSCURO ===== */
html, body {
  background-color: #f4f6f8 !important;
  min-height: 100%;
}
.page-light {
  background: #f4f6f8;
  min-height: 100vh;
}

.table {
  width: 100%;
  background: #fff;
}

.table td, .table th {
  color: #111;
  padding: 10px;
}

.page-light {
  background: #f7f7f7;
  color: #222;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.table th {
  background: #f0f0f0;
  color: #222;
}

.table td {
  background: #fff;
  color: #222;
  border-bottom: 1px solid #ddd;
}

.form-card {
  max-width: 480px;
  margin: 0 auto;
}

.form-card label {
  margin-top: 12px;
  display: block;
  font-weight: 600;
}

.form-card select,
.form-card input {
  width: 100%;
  padding: 10px;
  margin-top: 6px;
}

.message {
  margin-top: 16px;
  font-weight: bold;
  text-align: center;
}

.btn-primary {
  background: #0e4a43;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary:hover {
  background: #063a34;
}
/* Mantener compatibilidad con páginas que usan btn-large para ancho completo */
.btn-primary.btn-large {
  width: 100%;
  padding: 14px 20px;
  font-size: 15px;
  margin-top: 10px;
  justify-content: center;
}

/* ================================
   QR SCANNER & TABS
================================ */

.search-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 20px;
  border: 2px solid #0f3d2e;
  background: transparent;
  color: #0f3d2e;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  background: rgba(15, 61, 46, 0.1);
}

.tab-btn.active {
  background: #0f3d2e;
  color: white;
}

.scanner-controls {
  text-align: center;
  margin-bottom: 15px;
}

.scan-message {
  text-align: center;
  padding: 10px;
  border-radius: 6px;
  font-weight: 600;
  margin-top: 10px;
}

.scan-message.success {
  background: #d4edda;
  color: #155724;
}

.scan-message.error {
  background: #f8d7da;
  color: #721c24;
}

/* QR Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 400px;
  width: 90%;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  cursor: pointer;
  color: #666;
}

.modal-close:hover {
  color: #333;
}

/* QR Button */
.btn-qr {
  padding: 8px 15px;
  background: #6c5ce7;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-qr:hover {
  background: #5b4cdb;
}

/* Status Badges */
.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-badge.active {
  background: #d4edda;
  color: #155724;
}

.status-badge.inactive {
  background: #f8d7da;
  color: #721c24;
}

.inactive-row {
  opacity: 0.6;
}

/* NFC Manager styles */
.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.filter-row input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  min-width: 200px;
}

/* Waiter page styles */
.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.consumption-summary {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.consumption-summary h3,
.menu-section h3 {
  margin-bottom: 15px;
  color: #0f3d2e;
  display: flex;
  align-items: center;
  gap: 8px;
}

.total-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: #f0f0f0;
  border-radius: 8px;
  margin-top: 20px;
}

.btn-secondary {
  padding: 10px 20px;
  background: #607d8b;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary:hover {
  background: #455a64;
}

/* No session box */
.no-session-box {
  text-align: center;
  padding: 15px;
}

.no-session-box p {
  margin-bottom: 15px;
  font-size: 1rem;
}

.no-session-box button {
  padding: 12px 25px;
  font-size: 1rem;
}

.scan-message.warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
}

/* ================================
   DASHBOARD VISUAL - NUEVO DISEÑO
================================ */

.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px 25px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 30px;
}

.dashboard-title {
  font-size: 2rem;
  font-weight: 700;
  color: #0f3d2e;
  margin: 0;
}

.dashboard-subtitle {
  color: #666;
  font-size: 1rem;
  margin: 5px 0 0 0;
}

/* Filtro de fechas */
.date-filter-card {
  background: white;
  border-radius: 12px;
  padding: 20px 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.date-filter-row {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.date-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f7f6;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.date-input-wrapper i {
  color: #0f3d2e;
  font-size: 14px;
}

.date-input-wrapper input[type="date"] {
  border: none;
  background: transparent;
  font-size: 14px;
  color: #333;
  outline: none;
}

.date-separator {
  color: #999;
  font-size: 18px;
}

.btn-filter {
  background: #0f3d2e;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-filter:hover {
  background: #0a2d22;
}

.quick-filters {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.quick-btn {
  padding: 8px 16px;
  border: 1px solid #0f3d2e;
  background: transparent;
  color: #0f3d2e;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-btn:hover {
  background: rgba(15, 61, 46, 0.1);
}

.quick-btn.active {
  background: #0f3d2e;
  color: white;
}

/* Métricas Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.metric-card {
  background: white;
  border-radius: 16px;
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.metric-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.metric-content {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 13px;
  color: #777;
  margin-bottom: 4px;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
}

/* Colores por tipo de métrica */
.metric-primary .metric-icon {
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: white;
}

.metric-beer .metric-icon {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: white;
}

.metric-menu .metric-icon {
  background: linear-gradient(135deg, #10b981, #34d399);
  color: white;
}

.metric-ml .metric-icon {
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  color: white;
}

.metric-users .metric-icon {
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  color: white;
}

.metric-ticket .metric-icon {
  background: linear-gradient(135deg, #ec4899, #f472b6);
  color: white;
}

/* Grid de Gráficos */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.chart-card {
  background: white;
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  grid-column: span 4;
}

.chart-card.chart-wide {
  grid-column: span 12;
}

.chart-title {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  margin: 0 0 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-title i {
  color: #0f766e;
}

.chart-container {
  position: relative;
  height: 280px;
}

.chart-donut {
  height: 240px;
}

/* Grid de Tablas */
.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.table-card-new {
  background: white;
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.table-title {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  margin: 0 0 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-title i {
  color: #0f766e;
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  background: #f8faf9;
  color: #0f3d2e;
  font-weight: 600;
  padding: 14px 16px;
  text-align: left;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e0e0e0;
}

.data-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
  font-size: 14px;
}

.data-table tbody tr:hover {
  background: #f9fafb;
}

.data-table .empty-cell {
  text-align: center;
  color: #999;
  font-style: italic;
  padding: 30px;
}

/* Responsive para Dashboard */
@media (max-width: 1200px) {
  .chart-card {
    grid-column: span 6;
  }
  .chart-card.chart-wide {
    grid-column: span 12;
  }
}

@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
  }

  .date-filter-card {
    width: 100%;
  }

  .date-filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .date-separator {
    display: none;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .chart-card,
  .chart-card.chart-wide {
    grid-column: span 12;
  }

  .tables-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    padding: 18px;
  }

  .metric-value {
    font-size: 1.3rem;
  }
}

/* ================================
   MOBILE NAV – HAMBURGER
================================ */

.sab-header {
  position: relative;
}

.sab-nav {
  display: flex;
  align-items: center;
}

/* Hamburger: oculto en desktop */
.hamburger {
  display: none;
}

/* Logout nav: solo aparece dentro del menú móvil */
.nav-logout {
  display: none;
}

@media (max-width: 900px) {

  /* Header más compacto */
  .sab-header {
    padding: 12px 16px;
  }

  /* Nav se convierte en dropdown vertical */
  .sab-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #063a34;
    flex-direction: column;
    align-items: stretch;
    z-index: 100;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  }

  .sab-nav.open {
    display: flex;
  }

  .sab-nav a {
    margin-left: 0 !important;
    padding: 13px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    font-size: 15px;
  }

  /* Logout dentro del nav móvil */
  .nav-logout {
    display: block;
    padding: 14px 20px;
    color: #ff7070 !important;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    border-top: 1px solid rgba(255,255,255,0.2);
  }

  /* Botón logout flotante se esconde */
  .btn-logout {
    display: none !important;
  }

  /* Hamburger: visible en móvil y tablet/landscape */
  .hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    margin-left: auto;
    padding: 6px;
  }

  .hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
  }

  /* Contenedores menos padding */
  .container {
    padding: 20px 14px !important;
  }

  .dashboard-container {
    padding: 18px 14px !important;
  }

  /* Cards menos padding */
  .card {
    padding: 18px !important;
  }

  /* Títulos de página más pequeños */
  .page-title {
    font-size: 1.4rem !important;
  }

  .dashboard-title {
    font-size: 1.4rem !important;
  }

  /* Menú principal: 2 columnas compactas en móvil */
  .menu {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    margin-top: 20px !important;
  }
  /* Cards compactas dentro del menú móvil */
  .menu .card {
    padding: 18px 12px !important;
  }
  .menu .card .icon {
    font-size: 28px !important;
  }
  .menu .card h3 {
    font-size: 13px !important;
    margin-top: 8px !important;
    line-height: 1.3 !important;
  }
  .menu .card p {
    font-size: 11px !important;
    margin-top: 4px !important;
  }

  /* Tablas: scroll horizontal */
  .table-card,
  .table-card-new {
    overflow-x: auto;
  }

  /* Z-report: fecha inputs apilados */
  .date-range-container {
    flex-direction: column;
    align-items: stretch;
  }

  .date-input-group {
    justify-content: space-between;
  }

  /* Dashboard date filter: apilado */
  .date-filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .date-separator {
    display: none;
  }

  /* Quick buttons más compactos */
  .quick-filters {
    flex-wrap: wrap;
  }

  /* Login card menos padding lateral */
  .login-card {
    padding: 30px 22px;
    margin: 0 12px;
  }

  /* Cards-grid (z-report métricas): 2 columnas */
  .cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .cards-grid .card.metric {
    padding: 14px !important;
  }

  .cards-grid .card.metric h3 {
    font-size: 0.8rem;
    margin-bottom: 4px;
  }

  .cards-grid .card.metric p {
    font-size: 1rem;
    font-weight: 700;
  }
}

/* ================================
   MOBILE TABLE & HEADER POLISH
================================ */

/* btn-success: no estaba definido */
.btn-success {
  background: #217346;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}
.btn-success:hover {
  background: #1a5c38;
}

@media (max-width: 640px) {

  /* === Títulos de página === */
  .page-title {
    color: #063a34 !important;
    border-left: 4px solid #19c2a6;
    padding-left: 12px !important;
    margin-bottom: 4px !important;
  }

  .page-subtitle {
    color: #666 !important;
    font-size: 0.88rem !important;
    margin-top: 0 !important;
    padding-left: 16px;
  }

  /* === Headers dentro de cards === */
  .card h2 {
    color: #063a34;
    font-size: 1.05rem;
    margin-top: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e8eeec;
    margin-bottom: 12px;
  }

  /* === Tablas: celdas más compactas === */
  .z-table th,
  .z-table td,
  .admin-table th,
  .admin-table td {
    padding: 8px 5px !important;
    font-size: 13px !important;
  }

  .z-table th,
  .admin-table th {
    font-size: 11px !important;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  /* === Inputs dentro de tablas === */
  .z-table td input[type="text"] {
    width: 72px;
    padding: 4px 5px;
    font-size: 13px;
    border-radius: 4px;
  }

  /* === Botón "Ver QR": solo icono === */
  .btn-qr {
    font-size: 0 !important;
    padding: 6px 9px !important;
  }
  .btn-qr i {
    font-size: 15px;
  }

  /* === Botones btn-small: solo icono === */
  .btn-small {
    font-size: 0 !important;
    padding: 5px 7px !important;
    width: auto !important;
  }
  .btn-small i {
    font-size: 13px;
  }

  /* === Badge estado más compacto === */
  .status-badge {
    font-size: 11px !important;
    padding: 2px 7px !important;
  }

  /* === Admin tabla sesiones: esconder columna ID === */
  .admin-table th:nth-child(1),
  .admin-table td:nth-child(1) {
    display: none;
  }

  /* === Columna "Manilla NFC" negrita (primera visible) === */
  .admin-table td:nth-child(2) {
    font-weight: 600;
  }

  /* === Botón "Cerrar" en admin más compacto === */
  .admin-table .btn-danger {
    font-size: 12px !important;
    padding: 5px 10px !important;
  }

  /* === Form rows: apilar === */
  .form-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }
  .form-row input,
  .form-row button {
    width: 100%;
  }

  /* === Filter row: apilar === */
  .filter-row {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .filter-row input {
    width: 100% !important;
    min-width: unset !important;
  }
  .filter-row label {
    margin-left: 0 !important;
  }

  /* === Caja: menu-add-row apilar === */
  .menu-add-row {
    flex-direction: column !important;
  }
  .menu-add-row select,
  .menu-add-row input[type="number"],
  .menu-add-row button {
    width: 100%;
    min-width: unset;
  }

  /* === Search tabs (Manual / Escanear QR): ancho completo === */
  .search-tabs {
    width: 100%;
  }
  .tab-btn {
    flex: 1;
    justify-content: center;
  }

  /* === Excel export/import: apilar === */
  .excel-buttons {
    flex-direction: column;
  }
  .btn-excel-export,
  .btn-excel-import {
    width: 100%;
    justify-content: center;
  }
}

/* ============================================================
   SISTEMA DE TEMAS – SABAI
   data-theme: "verde" (default) | "oceano" | "vino"
   Aplicado en <html> por auth.js desde localStorage('sabai-theme')
============================================================ */

/* Transición suave al cambiar de tema */
.sab-header,
.btn-primary,
.tab-btn,
.btn-filter,
.quick-btn,
.btn-small,
.btn-qty {
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease !important;
}

/* ================================================================
   TEMA OCÉANO  —  Azul Marino Corporativo
================================================================ */

/* Header */
[data-theme="oceano"] .sab-header                      { background: #0d2853 !important; }
@media (max-width: 900px) {
  [data-theme="oceano"] .sab-nav                       { background: #0d2853 !important; }
}

/* Botones primarios */
[data-theme="oceano"] .btn-primary                     { background: #1a56db !important; color: white !important; }
[data-theme="oceano"] .btn-primary:hover               { background: #1e429f !important; color: white !important; }
[data-theme="oceano"] .btn-filter                      { background: #1a56db !important; color: white !important; }
[data-theme="oceano"] .btn-filter:hover                { background: #1e429f !important; color: white !important; }

/* Tab buttons / btn-small / btn-qty */
[data-theme="oceano"] .tab-btn                         { border-color: #1a56db !important; color: #1a56db !important; }
[data-theme="oceano"] .tab-btn:hover                   { background: rgba(26,86,219,0.08) !important; }
[data-theme="oceano"] .tab-btn.active                  { background: #0d2853 !important; color: white !important; }
[data-theme="oceano"] .btn-small                       { border-color: #1a56db !important; color: #1a56db !important; }
[data-theme="oceano"] .btn-small:hover                 { background: #1a56db !important; color: white !important; }
/* btn-success siempre texto blanco, incluso con btn-small en cualquier tema */
[data-theme="oceano"] .btn-success                     { color: white !important; border-color: transparent !important; }
[data-theme="oceano"] .btn-success:hover               { color: white !important; }
[data-theme="vino"]   .btn-success                     { color: white !important; border-color: transparent !important; }
[data-theme="terracota"] .btn-success                  { color: white !important; border-color: transparent !important; }
[data-theme="oceano"] .btn-primary.btn-small           { background: #1a56db !important; color: white !important; }
[data-theme="oceano"] .btn-primary.btn-small:hover     { background: #1e429f !important; color: white !important; }
[data-theme="oceano"] .btn-qty                         { border-color: #1a56db !important; color: #1a56db !important; }
[data-theme="oceano"] .btn-qty:hover                   { background: #1a56db !important; color: white !important; }
[data-theme="oceano"] .btn-primary.btn-qty             { background: #1a56db !important; color: white !important; }
[data-theme="oceano"] .btn-primary.btn-qty:hover       { background: #1e429f !important; color: white !important; }
[data-theme="oceano"] .quick-btn                       { border-color: #1a56db !important; color: #1a56db !important; }
[data-theme="oceano"] .quick-btn:hover                 { background: rgba(26,86,219,0.09) !important; }
[data-theme="oceano"] .quick-btn.active                { background: #1a56db !important; color: white !important; }

/* Cabeceras de tabla */
[data-theme="oceano"] .sab-table thead                 { background: #0d2853 !important; }
[data-theme="oceano"] .page-light thead th             { color: #0d2853 !important; background: #e8f0fe !important; }
[data-theme="oceano"] .page-light .admin-table thead th{ color: #0d2853 !important; background: #e8f0fe !important; }
[data-theme="oceano"] .z-table thead th                { color: #0d2853 !important; background: #e8f0fe !important; }
[data-theme="oceano"] .admin-table thead th            { background: #e8f0fe !important; color: #0d2853 !important; }
[data-theme="oceano"] .data-table thead th             { color: #0d2853 !important; }
[data-theme="oceano"] .sab-table tbody tr:hover        { background: #e8f4ff !important; }
[data-theme="oceano"] .z-table tbody tr:hover          { background: #e8f4ff !important; }
[data-theme="oceano"] .page-light .admin-table tbody tr:hover { background: #e8f4ff !important; }

/* Filas de total */
[data-theme="oceano"] .total-row                       { background: #0d2853 !important; }
[data-theme="oceano"] .total-final                     { background: #0d2853 !important; }

/* Textos de acento */
[data-theme="oceano"] .dashboard-title                 { color: #0d2853 !important; }
[data-theme="oceano"] .menu-section-title              { color: #0d2853 !important; border-bottom-color: #0d2853 !important; }
[data-theme="oceano"] .menu-section-title i            { color: #1a56db !important; }
[data-theme="oceano"] .card .icon                      { color: #0d2853 !important; }
[data-theme="oceano"] .consumption-summary h3,
[data-theme="oceano"] .menu-section h3                 { color: #0d2853 !important; }
[data-theme="oceano"] .subtotal-box strong             { color: #0d2853 !important; }
[data-theme="oceano"] .z-message                       { color: #0d2853 !important; }
[data-theme="oceano"] .login-card h1                   { color: #0d2853 !important; }
[data-theme="oceano"] .excel-actions h3                { color: #0d2853 !important; }
[data-theme="oceano"] .date-input-group label          { color: #0d2853 !important; }
[data-theme="oceano"] .date-input-wrapper i            { color: #0d2853 !important; }

/* Focus states */
[data-theme="oceano"] .input-row input:focus           { border-color: #1a56db !important; box-shadow: 0 0 0 3px rgba(26,86,219,0.1) !important; }
[data-theme="oceano"] .form-grid input:focus,
[data-theme="oceano"] .form-grid select:focus          { border-color: #1a56db !important; box-shadow: 0 0 0 3px rgba(26,86,219,0.1) !important; }
[data-theme="oceano"] .login-field input:focus         { border-color: #1a56db !important; }

/* Mobile page titles */
@media (max-width: 640px) {
  [data-theme="oceano"] .page-title                    { color: #0d2853 !important; border-left-color: #5b8dee !important; }
  [data-theme="oceano"] .card h2                       { color: #0d2853 !important; }
}

/* ================================================================
   TEMA VINO  —  Borgoña Elegante
================================================================ */

/* Header */
[data-theme="vino"] .sab-header                        { background: #6b3a1f !important; }
@media (max-width: 900px) {
  [data-theme="vino"] .sab-nav                         { background: #6b3a1f !important; }
}

/* Botones primarios */
[data-theme="vino"] .btn-primary                       { background: #9a4e28 !important; color: white !important; }
[data-theme="vino"] .btn-primary:hover                 { background: #7e3e1e !important; color: white !important; }
[data-theme="vino"] .btn-filter                        { background: #9a4e28 !important; color: white !important; }
[data-theme="vino"] .btn-filter:hover                  { background: #7e3e1e !important; color: white !important; }

/* Tab buttons / btn-small / btn-qty */
[data-theme="vino"] .tab-btn                           { border-color: #9a4e28 !important; color: #9a4e28 !important; }
[data-theme="vino"] .tab-btn:hover                     { background: rgba(154,78,40,0.08) !important; }
[data-theme="vino"] .tab-btn.active                    { background: #6b3a1f !important; color: white !important; }
[data-theme="vino"] .btn-small                         { border-color: #9a4e28 !important; color: #9a4e28 !important; }
[data-theme="vino"] .btn-small:hover                   { background: #9a4e28 !important; color: white !important; }
[data-theme="vino"] .btn-primary.btn-small             { background: #9a4e28 !important; color: white !important; }
[data-theme="vino"] .btn-primary.btn-small:hover       { background: #7e3e1e !important; color: white !important; }
[data-theme="vino"] .btn-qty                           { border-color: #9a4e28 !important; color: #9a4e28 !important; }
[data-theme="vino"] .btn-qty:hover                     { background: #9a4e28 !important; color: white !important; }
[data-theme="vino"] .btn-primary.btn-qty               { background: #9a4e28 !important; color: white !important; }
[data-theme="vino"] .btn-primary.btn-qty:hover         { background: #7e3e1e !important; color: white !important; }
[data-theme="vino"] .quick-btn                         { border-color: #9a4e28 !important; color: #9a4e28 !important; }
[data-theme="vino"] .quick-btn:hover                   { background: rgba(154,78,40,0.08) !important; }
[data-theme="vino"] .quick-btn.active                  { background: #9a4e28 !important; color: white !important; }

/* Cabeceras de tabla */
[data-theme="vino"] .sab-table thead                   { background: #6b3a1f !important; }
[data-theme="vino"] .page-light thead th               { color: #6b3a1f !important; background: #fdeee3 !important; }
[data-theme="vino"] .page-light .admin-table thead th  { color: #6b3a1f !important; background: #fdeee3 !important; }
[data-theme="vino"] .z-table thead th                  { color: #6b3a1f !important; background: #fdeee3 !important; }
[data-theme="vino"] .admin-table thead th              { background: #fdeee3 !important; color: #6b3a1f !important; }
[data-theme="vino"] .data-table thead th               { color: #6b3a1f !important; }
[data-theme="vino"] .sab-table tbody tr:hover          { background: #fef6ef !important; }
[data-theme="vino"] .z-table tbody tr:hover            { background: #fef6ef !important; }
[data-theme="vino"] .page-light .admin-table tbody tr:hover { background: #fef6ef !important; }

/* Filas de total */
[data-theme="vino"] .total-row                         { background: #6b3a1f !important; }
[data-theme="vino"] .total-final                       { background: #6b3a1f !important; }

/* Textos de acento */
[data-theme="vino"] .dashboard-title                   { color: #6b3a1f !important; }
[data-theme="vino"] .menu-section-title                { color: #6b3a1f !important; border-bottom-color: #6b3a1f !important; }
[data-theme="vino"] .menu-section-title i              { color: #9a4e28 !important; }
[data-theme="vino"] .card .icon                        { color: #6b3a1f !important; }
[data-theme="vino"] .consumption-summary h3,
[data-theme="vino"] .menu-section h3                   { color: #6b3a1f !important; }
[data-theme="vino"] .subtotal-box strong               { color: #6b3a1f !important; }
[data-theme="vino"] .z-message                         { color: #6b3a1f !important; }
[data-theme="vino"] .login-card h1                     { color: #6b3a1f !important; }
[data-theme="vino"] .excel-actions h3                  { color: #6b3a1f !important; }
[data-theme="vino"] .date-input-group label            { color: #6b3a1f !important; }
[data-theme="vino"] .date-input-wrapper i              { color: #6b3a1f !important; }

/* Focus states */
[data-theme="vino"] .input-row input:focus             { border-color: #9a4e28 !important; box-shadow: 0 0 0 3px rgba(154,78,40,0.1) !important; }
[data-theme="vino"] .form-grid input:focus,
[data-theme="vino"] .form-grid select:focus            { border-color: #9a4e28 !important; box-shadow: 0 0 0 3px rgba(154,78,40,0.1) !important; }
[data-theme="vino"] .login-field input:focus           { border-color: #9a4e28 !important; }

/* Mobile page titles */
@media (max-width: 640px) {
  [data-theme="vino"] .page-title                      { color: #6b3a1f !important; border-left-color: #d4845a !important; }
  [data-theme="vino"] .card h2                         { color: #6b3a1f !important; }
}

/* ================================================================
   LOGIN — FONDO CON COLOR DEL TEMA ACTIVO
   El fondo del login refleja el color primario de cada tema.
   El card permanece blanco para legibilidad.
================================================================ */

/* Verde (default — sin data-theme) */
.login-wrapper {
  background: linear-gradient(145deg, #0b3a35 0%, #145f51 60%, #1a7a6a 100%);
}
.login-card {
  border-top: 4px solid #0b3a35;
}

/* Océano */
[data-theme="oceano"] .login-wrapper {
  background: linear-gradient(145deg, #0d2853 0%, #1a407a 60%, #1e56a0 100%) !important;
}
[data-theme="oceano"] .login-card {
  border-top: 4px solid #1a56db !important;
}

/* Vino */
[data-theme="vino"] .login-wrapper {
  background: linear-gradient(145deg, #6b3a1f 0%, #7e3e1e 60%, #9a4e28 100%) !important;
}
[data-theme="vino"] .login-card {
  border-top: 4px solid #9a4e28 !important;
}

/* ================================================================
   MOBILE RESPONSIVENESS — COMPREHENSIVE FIXES
   Correcciones globales para todos los tamaños de pantalla
================================================================ */

/* ── 1. Header compacto en móvil/landscape con branch switcher ── */
@media (max-width: 900px) {
  .sab-header {
    flex-wrap: nowrap;
    padding: 10px 14px !important;
    gap: 6px;
    align-items: center;
  }
  .sab-header img {
    height: 30px;
    flex-shrink: 0;
  }
  /* Branch switcher más compacto en móvil */
  .branch-switcher {
    max-width: 100px !important;
    font-size: 11px !important;
    padding: 2px 4px !important;
    flex-shrink: 1 !important;
  }
  /* Hamburger siempre visible al final del header */
  .hamburger {
    flex-shrink: 0 !important;
    margin-left: 4px !important;
  }
}

/* ── 2. Menú principal: 1 columna en pantallas muy pequeñas ── */
@media (max-width: 340px) {
  .menu {
    grid-template-columns: 1fr !important;
  }
}

/* ── 3. Modales: tamaño adaptable en móvil ── */
@media (max-width: 640px) {
  /* Overlay */
  [style*="position:fixed"][style*="inset:0"],
  [style*="position: fixed"][style*="inset: 0"] {
    align-items: flex-end !important;
  }

  /* Contenedor del modal */
  [style*="max-width:820px"],
  [style*="max-width: 820px"],
  [style*="max-width:520px"],
  [style*="max-width: 520px"],
  [style*="max-width:480px"],
  [style*="max-width: 480px"],
  [style*="max-width:440px"],
  [style*="max-width: 440px"],
  [style*="max-width:420px"],
  [style*="max-width: 420px"],
  [style*="max-width:400px"],
  [style*="max-width: 400px"],
  [style*="max-width:380px"],
  [style*="max-width: 380px"] {
    max-width: 100vw !important;
    width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    margin: 0 !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
  }

  /* Modal contenido interno */
  .modal-content {
    max-width: 100vw !important;
    width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    margin: 0 !important;
  }
}

/* ── 4. Inputs con ancho fijo: resetear en móvil ── */
@media (max-width: 640px) {
  input[style*="width:300px"],
  input[style*="width: 300px"],
  input[style*="width:350px"],
  input[style*="width: 350px"],
  input[style*="width:400px"],
  input[style*="width: 400px"],
  input[style*="width:500px"],
  input[style*="width: 500px"],
  input[style*="width:180px"],
  input[style*="width: 180px"] {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Inputs de ancho fijo más pequeños: también adaptar */
  input[style*="width:130px"],
  input[style*="width: 130px"],
  input[style*="width:140px"],
  input[style*="width: 140px"],
  input[style*="width:150px"],
  input[style*="width: 150px"],
  input[style*="width:160px"],
  input[style*="width: 160px"],
  input[style*="width:120px"],
  input[style*="width: 120px"] {
    width: 100% !important;
    min-width: unset !important;
  }

  /* Selects con ancho fijo */
  select[style*="width:140px"],
  select[style*="width: 140px"],
  select[style*="width:160px"],
  select[style*="width: 160px"] {
    width: 100% !important;
  }
}

/* ── 5. Texto largo: evitar overflow ── */
h1, h2, h3, h4 {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ── TABLAS: scroll interno, la página NO se desplaza horizontalmente ── */
body {
  overflow-x: hidden;
}

/* Todas las tablas se desplazan internamente en móvil */
@media (max-width: 900px) {
  .z-table,
  .admin-table,
  .sab-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
  }

  /* Asegurar que el contenedor padre no expanda el ancho de la página */
  .card,
  .table-card,
  .table-card-new {
    overflow-x: clip;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Wrapper para tablas scrolleables dentro de cards */
  .table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  /* Inputs dentro de tablas más compactos */
  .z-table input[type="text"],
  .z-table input[type="number"],
  .admin-table input[type="text"],
  .admin-table input[type="number"] {
    width: 80px !important;
    min-width: unset !important;
    font-size: 12px !important;
    padding: 4px 6px !important;
  }

  /* Selects dentro de tablas más compactos */
  .z-table select,
  .admin-table select {
    width: 100px !important;
    min-width: unset !important;
    font-size: 12px !important;
    padding: 4px 4px !important;
  }

  /* Celdas con menos padding */
  .z-table th,
  .z-table td,
  .admin-table th,
  .admin-table td {
    padding: 8px 8px !important;
    white-space: nowrap;
  }

  /* Botones dentro de tablas: solo icono */
  .z-table .btn-primary,
  .z-table .btn-danger,
  .z-table .btn-small,
  .admin-table .btn-primary,
  .admin-table .btn-danger,
  .admin-table .btn-small {
    padding: 5px 8px !important;
    font-size: 0 !important;
  }
  .z-table .btn-primary i,
  .z-table .btn-danger i,
  .z-table .btn-small i,
  .admin-table .btn-primary i,
  .admin-table .btn-danger i,
  .admin-table .btn-small i {
    font-size: 13px !important;
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: clamp(1.2rem, 5vw, 2rem) !important;
  }
  .subtitle {
    font-size: 0.9rem !important;
  }
}

/* ── 6. Empresa nombre en main.html ── */
#empresa-nombre {
  word-break: break-word;
  overflow-wrap: break-word;
  padding: 0 8px;
}

/* ── 7. Tablas: scroll horizontal con hint visual ── */
@media (max-width: 640px) {
  .table-card,
  .table-card-new,
  .table-wrapper {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  .table-card::after,
  .table-card-new::after {
    content: "← desliza →";
    display: block;
    text-align: center;
    font-size: 11px;
    color: #aaa;
    padding: 4px 0;
  }
}

/* ── 8. Cards grid métricas: 2 columnas en móvil ── */
@media (max-width: 640px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .metric-card {
    padding: 14px !important;
  }
}

/* ── 9. Formularios en columna en móvil ── */
@media (max-width: 640px) {
  .form-group,
  [style*="display:flex"][style*="gap"] {
    flex-wrap: wrap;
  }

  /* Inputs dentro de form-group al 100% */
  .form-group input,
  .form-group select,
  .form-group textarea {
    width: 100%;
    box-sizing: border-box;
    min-width: unset !important;
    max-width: 100% !important;
  }
}

/* ── 10. Badge de alertas de stock: reposicionar en móvil ── */
@media (max-width: 640px) {
  #stock-alert-badge,
  [id*="alert"][style*="position:fixed"],
  [id*="alert"][style*="position: fixed"] {
    top: auto !important;
    bottom: 16px !important;
    right: 16px !important;
    left: auto !important;
  }
}

/* ── 11. Contenedor principal más angosto en móvil muy pequeño ── */
@media (max-width: 380px) {
  .container {
    padding: 14px 10px !important;
  }
  .card {
    padding: 14px !important;
  }
  .sab-header {
    padding: 8px 10px !important;
  }
  .branch-switcher {
    max-width: 90px !important;
    font-size: 10px !important;
  }
}

/* ── 12. Gráficas: altura adaptable en móvil ── */
@media (max-width: 640px) {
  .chart-container,
  canvas {
    max-height: 220px !important;
  }
}

/* ================================================================
   BOTONES DE ACCIÓN EN TABLAS — compactos en todas las pantallas
================================================================ */

/* Celda de acciones: nunca partir en dos líneas */
table td:last-child,
table th:last-child {
  white-space: nowrap;
}

/* Botones dentro de celdas: padding reducido */
td .btn-primary,
td .btn-danger,
td .btn-delete,
td .btn-secondary {
  padding: 5px 9px !important;
  font-size: 12px !important;
  border-radius: 6px !important;
  gap: 4px !important;
  line-height: 1.2;
}

/* En pantallas pequeñas/landscape: scroll horizontal en todas las tablas */
@media (max-width: 900px) {
  .table-card,
  .table-card-new,
  .card table,
  .table-responsive {
    overflow-x: auto !important;
    display: block;
    width: 100%;
  }
}

/* ================================================================
   RESPONSIVE GLOBAL — MOBILE FIXES (max-width: 600px)
================================================================ */
@media (max-width: 600px) {

  /* --- Modales: nunca exceder el ancho del viewport --- */
  [style*="max-width:520px"],
  [style*="max-width: 520px"],
  [style*="max-width:480px"],
  [style*="max-width: 480px"],
  [style*="max-width:800px"],
  [style*="max-width: 800px"],
  [style*="max-width:820px"],
  [style*="max-width: 820px"],
  [style*="max-width:600px"],
  [style*="max-width: 600px"] {
    max-width: 96vw !important;
    width: 96vw !important;
    box-sizing: border-box !important;
  }

  /* --- Todas las tablas con scroll horizontal --- */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  /* --- Grids de 2/3 columnas → 1 columna --- */
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Inputs y selects: ancho completo --- */
  input[style*="width:140px"],
  input[style*="width: 140px"],
  input[style*="width:160px"],
  input[style*="width: 160px"],
  input[style*="width:180px"],
  input[style*="width: 180px"],
  input[style*="width:200px"],
  input[style*="width: 200px"],
  select[style*="width:140px"],
  select[style*="width: 140px"],
  select[style*="width:160px"],
  select[style*="width: 160px"],
  select[style*="min-width:160px"],
  select[style*="min-width: 160px"],
  select[style*="min-width:180px"],
  select[style*="min-width: 180px"] {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* --- Filas de acciones de caja: apiladas verticalmente --- */
  .acciones-caja-row,
  [style*="display:flex"][style*="gap"] > a.card,
  [style*="display: flex"][style*="gap"] > a.card {
    flex-direction: column !important;
  }

  /* --- Grupos de fecha/filtro en flex: wrap --- */
  [style*="display:flex"][style*="flex-wrap"] {
    flex-wrap: wrap !important;
  }

  /* --- Stat/metric grids → columna única --- */
  .stats-grid,
  .z-summary,
  .metrics-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ================================================================
   RESPONSIVE GLOBAL — SMALL MOBILE (max-width: 420px)
================================================================ */
@media (max-width: 420px) {

  /* Botones de acción en filas: reducir padding */
  .btn-primary,
  .btn-secondary,
  .btn-danger {
    padding: 8px 12px !important;
    font-size: 13px !important;
  }

  /* Formularios: todos los inputs ocupan el ancho completo */
  input, select, textarea {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* Evitar overflow horizontal global */
  body {
    overflow-x: hidden;
  }
  main, .container, section {
    max-width: 100vw;
    overflow-x: hidden;
  }
}
