:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
}

body.dark-mode {
  --bg: #0b1120;
  --surface: #1e293b;
  --surface-alt: #0f172a;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* Sidebar (Desktop) & Bottom Nav (Mobile/Tablet) */
.sidebar {
  width: 245px;
  background: #0f172a;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
}

.brand {
  padding: 1.25rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

.brand-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.75rem;
  color: #94a3b8;
  display: block;
}

.nav-links {
  list-style: none;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.nav-btn {
  width: 100%;
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 0.8rem 0.9rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-btn.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.nav-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.78rem;
  color: #94a3b8;
}

/* Main Content */
.main-wrapper {
  flex: 1;
  margin-left: 245px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: 2rem;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }

.content {
  padding: 1.25rem 1.5rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* POS Layout */
.pos-grid {
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 1.25rem;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
}

/* Controls & Inputs */
.search-bar {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.input, .select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.92rem;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.input:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-outline { background: #fff; border: 1px solid #cbd5e1; color: var(--text); }
.btn-outline:hover { background: var(--surface-alt); }
.rep-period-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25); }
.btn-sm { padding: 0.4rem 0.65rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* Botón WhatsApp Upgrade - Estilo atractivo */
.btn-wa-upgrade {
  background: #25D366 !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.9rem 1rem !important;
}
.btn-wa-upgrade:hover {
  background: #1ebe5b !important;
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.45);
  transform: translateY(-1px);
}
.btn-wa-upgrade:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(37, 211, 102, 0.3);
}

/* Modal de Planes - Mejoras visuales */
#saasPlansComparisonGrid .card {
  position: relative;
  overflow: hidden;
}
#saasPlansComparisonGrid .card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}
#saasPlansComparisonGrid .card:nth-child(1)::before { background: #16a34a; }
#saasPlansComparisonGrid .card:nth-child(2)::before { background: #2563eb; }
#saasPlansComparisonGrid .card:nth-child(3)::before { background: #7c3aed; }
#saasPlansComparisonGrid .card:nth-child(4)::before { background: #d97706; }

/* Plan activo - estilo destacado */
#saasPlansComparisonGrid .card[style*="border:2px solid"] .btn-outline {
  background: #f8fafc;
  border: 2px dashed var(--border);
  color: var(--text-muted);
}

/* ==================== RESPONSIVE MOBILE ==================== */
@media (max-width: 640px) {
  .topbar {
    padding: 0.65rem 0.85rem;
    gap: 0.5rem;
  }
  .topbar-meta {
    gap: 0.4rem;
    flex-wrap: wrap;
  }
  .btn {
    min-height: 48px; /* Tarea mínima para toque en móvil */
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
  }
  .btn-sm {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
  .btn-block, .btn-wa-upgrade {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .btn-wa-upgrade span:last-child {
    font-size: 0.85rem;
    text-align: center;
  }
  .modal {
    padding: 1rem;
    margin: 0.5rem;
    max-height: 95vh;
  }
  .modal-backdrop {
    padding: 0.5rem;
  }
  .card {
    padding: 1rem;
  }
  .kpi-grid, .form-grid, .split-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .pos-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.6rem;
  }
  .product-thumb {
    height: 80px;
  }
  .nav-btn {
    min-height: 52px;
    padding: 0.4rem 0.2rem;
  }
  .nav-icon {
    font-size: 1.3rem;
  }
  .nav-btn span {
    font-size: 0.68rem;
    display: block;
    margin-top: 2px;
  }
  .badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
  }
  .table-wrap {
    font-size: 0.8rem;
  }
  th, td {
    padding: 0.5rem 0.55rem;
  }
  /* Sidebar bottom nav en móvil más pulido */
  .sidebar {
    height: 70px;
    border-top: 1px solid rgba(255,255,255,0.12);
  }
  .nav-links {
    padding: 0.2rem 0;
  }
  .content {
    padding: 0.75rem;
    padding-bottom: 90px;
  }
}

/* Muy pequeños (320px - 480px) */
@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .product-card {
    padding: 0.6rem;
  }
  .product-name {
    font-size: 0.85rem;
  }
  .product-price {
    font-size: 0.95rem;
  }
  .cart-qty-input {
    width: 44px;
    height: 32px;
  }
  .qty-btn {
    width: 32px;
    height: 32px;
  }
  .modal h3, .card-title {
    font-size: 1.1rem;
  }
}

/* Product Grid in POS */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 0.85rem;
}

.product-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
  user-select: none;
}

.product-thumb {
  width: 100%;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  background: #e2e8f0;
  border: 1px solid var(--border);
  margin-bottom: 0.35rem;
}

.table-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  background: #e2e8f0;
  border: 1px solid var(--border);
  vertical-align: middle;
}

.img-preview-box {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  border: 1px dashed #94a3b8;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.img-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card:hover {
  border-color: var(--primary);
  background: #eff6ff;
  transform: translateY(-1px);
}

.product-card.out-of-stock {
  opacity: 0.55;
  cursor: not-allowed;
}

.product-code {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: monospace;
}

.product-name {
  font-weight: 600;
  font-size: 0.93rem;
  line-height: 1.3;
}

.product-price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
}

/* Cart */
.cart-items {
  max-height: 330px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 0.75rem 0;
  padding: 0.5rem 0;
}

.cart-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px dashed var(--border);
}

.cart-row:last-child {
  border-bottom: none;
}

.qty-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

.cart-qty-input {
  width: 48px;
  height: 28px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  text-align: center;
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--text);
  background: #ffffff;
  outline: none;
  padding: 0 2px;
}

.cart-qty-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: var(--text-muted);
}

.summary-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  margin: 0.65rem 0 1rem;
  padding-top: 0.65rem;
  border-top: 2px solid var(--border);
}

/* Stats Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
}

.kpi-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  margin-top: 0.35rem;
}

.kpi-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Forms & Grids */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 0.9rem;
  align-items: end;
}

.form-group {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
}

.form-group label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #334155;
  line-height: 1.25;
}

.input-action-row {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
}

.input-action-row .input {
  flex: 1;
  min-width: 0;
}

.input-action-row .btn {
  padding: 0 0.6rem;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* Responsive Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th, td {
  padding: 0.7rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--surface-alt);
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

tr:hover td {
  background: #f8fafc;
}

/* Modal / Receipt */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: 14px;
  max-width: 1040px;
  width: 100%;
  padding: 1.25rem 1rem;
  max-height: 92vh;
  overflow-y: auto;
  box-sizing: border-box;
}

.modal.modal-xl {
  max-width: 1040px;
  width: 96%;
  max-height: 92vh;
  padding: 1.25rem 1rem;
}

.receipt-box {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.86rem;
  background: #fffbeb;
  border: 1px dashed #94a3b8;
  padding: 1rem;
  border-radius: 8px;
  margin: 0.75rem 0;
}

/* Sub-tabs for Reports & Sections */
.sub-tabs {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
  background: var(--surface);
  padding: 0.45rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.sub-tab {
  border: none;
  background: transparent;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sub-tab:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.sub-tab.active {
  background: var(--primary);
  color: #fff;
}

.scanner-video-wrap {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scanner-video-wrap video {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
}

.scanner-laser {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 50%;
  height: 2px;
  background: #ef4444;
  box-shadow: 0 0 8px 2px rgba(239, 68, 68, 0.8);
  pointer-events: none;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: #0f172a;
  color: #fff;
  padding: 0.8rem 1.15rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  transform: translateY(150%);
  transition: transform 0.25s ease;
  z-index: 120;
}

.toast.show {
  transform: translateY(0);
}

/* Multi-Tenant Auth Screen */
.auth-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 200;
  overflow-y: auto;
}

.auth-card {
  background: #ffffff;
  border-radius: 16px;
  max-width: 460px;
  width: 100%;
  padding: 1.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  background: #f1f5f9;
  padding: 0.35rem;
  border-radius: 10px;
  margin-bottom: 1.25rem;
}

.auth-tab {
  border: none;
  background: transparent;
  padding: 0.6rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  color: #475569;
}

.auth-tab.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Tablet & Mobile Adaptation */
@media (max-width: 1024px) {
  .pos-grid {
    grid-template-columns: 1fr;
  }
  .split-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 64px;
    flex-direction: row;
    border-top: 1px solid rgba(255,255,255,0.12);
  }
  .brand, .sidebar-footer {
    display: none;
  }
  .nav-links {
    flex-direction: row;
    padding: 0.3rem 0.5rem;
    justify-content: space-around;
    align-items: center;
    width: 100%;
  }
  .nav-btn {
    flex-direction: column;
    justify-content: center;
    padding: 0.35rem 0.25rem;
    font-size: 0.7rem;
    gap: 0.2rem;
    text-align: center;
  }
  .nav-icon {
    font-size: 1.15rem;
  }
  .main-wrapper {
    margin-left: 0;
    padding-bottom: 80px;
  }
  .content {
    padding: 0.9rem;
  }
  .topbar {
    padding: 0.75rem 1rem;
  }
  .toast {
    bottom: 76px;
    left: 1rem;
    right: 1rem;
  }
}

/* Label Print Studio & Barcode Cards */
.modal.modal-xl {
  max-width: 1080px;
  width: 96%;
  max-height: 92vh;
}

.labels-studio-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.labels-preview-wrapper {
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 1rem;
  overflow-x: auto;
}

.labels-print-sheet {
  background: #ffffff;
  margin: 0 auto;
  padding: 10mm;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
  display: grid;
  gap: 3mm;
  align-content: start;
}

.labels-print-sheet.layout-A4_3COL {
  max-width: 210mm;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.labels-print-sheet.layout-A4_4COL {
  max-width: 210mm;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2.2mm;
}

.labels-print-sheet.layout-GONDOLA_2COL {
  max-width: 210mm;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4mm;
}

.labels-print-sheet.layout-THERMAL_1COL {
  max-width: 62mm;
  padding: 3mm;
  grid-template-columns: 1fr;
  gap: 3mm;
}

.label-card {
  background: #ffffff;
  color: #000000;
  padding: 6px 8px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  page-break-inside: avoid;
  break-inside: avoid;
  overflow: hidden;
}

.label-card.with-cut-border {
  border: 1px dashed #64748b;
}

.label-card .lbl-biz {
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #334155;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.label-card .lbl-name {
  font-size: 0.78rem;
  font-weight: 800;
  color: #000000;
  line-height: 1.15;
  max-height: 2.3em;
  overflow: hidden;
  width: 100%;
  margin: 2px 0;
}

.label-card .lbl-sku {
  font-size: 0.65rem;
  font-family: monospace;
  color: #334155;
}

.label-card .lbl-price {
  font-size: 0.96rem;
  font-weight: 900;
  color: #000000;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 1px 6px;
  margin: 2px 0;
}

.labels-print-sheet.layout-GONDOLA_2COL .label-card .lbl-price {
  font-size: 1.35rem;
  padding: 3px 10px;
}

.labels-print-sheet.layout-A4_4COL .label-card .lbl-name {
  font-size: 0.7rem;
}

.labels-print-sheet.layout-A4_4COL .label-card .lbl-price {
  font-size: 0.82rem;
}

.lbl-codes-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 2px;
}

/* Format Selector Buttons & Printable Arqueo / Receipt Paper Sizes (58mm, 80mm, A4) */
.print-fmt-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.arqueo-paper {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  border-radius: 6px;
  margin: 0 auto;
}

.print-paper-58MM {
  width: 58mm;
  max-width: 100%;
  padding: 3.5mm 3mm;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  line-height: 1.28;
}

.print-paper-80MM {
  width: 80mm;
  max-width: 100%;
  padding: 4.5mm 4mm;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.83rem;
  line-height: 1.35;
}

.print-paper-A4 {
  width: 100%;
  max-width: 195mm;
  padding: 8mm 10mm;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.86rem;
  line-height: 1.45;
  background: #ffffff;
  border: 1px solid #cbd5e1;
}

#dedicatedPrintRoot {
  display: none;
}

@media (max-width: 900px) {
  .labels-studio-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ================= MODO OSCURO (DARK MODE) ================= */
body.dark-mode .sidebar {
  background: #060a13;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
}

body.dark-mode .input,
body.dark-mode .select,
body.dark-mode .qty-btn,
body.dark-mode .cart-qty-input,
body.dark-mode .denom-qty-input {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

body.dark-mode .input::placeholder {
  color: #64748b;
}

body.dark-mode .btn-outline {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-mode .btn-outline:hover {
  background: #334155;
  color: #ffffff;
}

body.dark-mode .btn-danger {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

body.dark-mode .btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
}

body.dark-mode .badge-blue {
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
}

body.dark-mode .badge-green {
  background: rgba(34, 197, 94, 0.22);
  color: #86efac;
}

body.dark-mode .badge-amber {
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
}

body.dark-mode .badge-red {
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
}

body.dark-mode .form-group label {
  color: #cbd5e1;
}

body.dark-mode th {
  background: #0f172a !important;
  color: #cbd5e1 !important;
}

body.dark-mode tr:hover td {
  background: rgba(59, 130, 246, 0.08);
}

body.dark-mode tfoot tr {
  background: #0f172a !important;
  color: #f8fafc !important;
}

body.dark-mode tfoot td {
  border-top-color: #475569 !important;
  color: #f8fafc !important;
}

body.dark-mode .product-card {
  background: #0f172a;
  border-color: #334155;
}

body.dark-mode .product-card:hover {
  background: #172554;
  border-color: var(--primary);
}

body.dark-mode .product-thumb,
body.dark-mode .table-thumb,
body.dark-mode .img-preview-box {
  background: #0f172a;
  border-color: #334155;
}

body.dark-mode .modal {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid #334155;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

body.dark-mode .auth-card {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid #334155;
}

body.dark-mode .auth-tabs {
  background: #0f172a;
}

body.dark-mode .auth-tab {
  color: #94a3b8;
}

body.dark-mode .auth-tab.active {
  background: #1e293b;
  color: #60a5fa;
}

body.dark-mode .labels-preview-wrapper {
  background: #0f172a;
  border-color: #334155;
}

body.dark-mode #posRegLiveNumbers,
body.dark-mode #lblQueueList {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

body.dark-mode #posRegExpectedCash {
  color: #f8fafc !important;
}

body.dark-mode #arqueoCloseFormCard > div,
body.dark-mode #arqueoCloseFormCard details,
body.dark-mode #denominationCalcGrid > div {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

body.dark-mode #arqueoCloseFormCard h4,
body.dark-mode #arqueoCloseFormCard span,
body.dark-mode #denominationCalcGrid span {
  color: #f1f5f9;
}

body.dark-mode #arqueoOpenFormCard {
  background: rgba(234, 179, 8, 0.12) !important;
  border-color: rgba(234, 179, 8, 0.35) !important;
}

body.dark-mode #arqueoOpenFormCard h4 {
  color: #fde047 !important;
}

/* Mantener hojas de papel (Arqueo, Ticket y Etiquetas) en blanco real incluso en Modo Oscuro */
body.dark-mode .arqueo-paper,
body.dark-mode .print-paper-A4,
body.dark-mode .print-paper-80MM,
body.dark-mode .print-paper-58MM,
body.dark-mode .labels-print-sheet,
body.dark-mode .label-card {
  background: #ffffff !important;
  color: #0f172a !important;
}

body.dark-mode .receipt-box:not(.print-paper-A4) {
  background: #fffbeb !important;
  color: #0f172a !important;
}

body.dark-mode .arqueo-paper th,
body.dark-mode .receipt-box th {
  background: #f1f5f9 !important;
  color: #334155 !important;
}

body.dark-mode .arqueo-paper tr:hover td,
body.dark-mode .receipt-box tr:hover td {
  background: transparent !important;
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body {
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: auto !important;
    display: block !important;
  }

  body > *:not(#dedicatedPrintRoot) {
    display: none !important;
  }

  #dedicatedPrintRoot {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }

  #dedicatedPrintRoot .arqueo-paper,
  #dedicatedPrintRoot .receipt-box {
    box-shadow: none !important;
    border: none !important;
    margin: 0 auto !important;
    background: #ffffff !important;
  }

  #dedicatedPrintRoot .labels-print-sheet {
    box-shadow: none !important;
    margin: 0 auto !important;
    padding: 2mm !important;
    width: 100% !important;
  }

  .no-print {
    display: none !important;
  }
}


/* ===================================================================
   Ajustes para celular: barra inferior, aviso emergente y encabezado.
   Va al final para tener prioridad sobre las reglas anteriores.
   =================================================================== */
@media (max-width: 768px) {
  .sidebar {
    height: auto;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .sidebar .nav-links {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 0;
    padding: 0.25rem;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .sidebar .nav-links::-webkit-scrollbar { display: none; }
  .sidebar .nav-links li { flex: 1 1 0; min-width: 0; }
  .sidebar .nav-btn {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 54px;
    padding: 0.3rem 0.1rem;
    gap: 0.15rem;
    border-radius: 10px;
    box-shadow: none;
  }
  .sidebar .nav-btn span:not(.nav-icon):not(.badge) {
    display: block;
    max-width: 100%;
    font-size: 0.6rem;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sidebar .nav-btn .badge {
    position: absolute;
    margin: 0 !important;
    transform: translate(14px, -16px);
  }
  .main-wrapper { padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
  .content { padding-bottom: 1rem; }
  .toast {
    bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    left: 0.75rem;
    right: 0.75rem;
  }
  /* Encabezado: título en su línea y los indicadores debajo */
  .topbar { flex-wrap: wrap; align-items: flex-start; gap: 0.45rem; }
  .topbar > div:first-child { flex: 1 1 100%; }
  .topbar-title { font-size: 1.05rem; line-height: 1.2; }
  .topbar-meta { width: 100%; gap: 0.35rem; }
  .topbar-meta .btn-sm { min-height: 34px; padding: 0.3rem 0.6rem; font-size: 0.78rem; }
}

/* Celular: los avisos emergentes salen ARRIBA, para no tapar nunca la barra de botones
   (en el navegador del iPhone la zona inferior cambia según la barra de herramientas) */
@media (max-width: 768px) {
  .toast {
    top: calc(0.75rem + env(safe-area-inset-top, 0px));
    bottom: auto;
    left: 0.75rem;
    right: 0.75rem;
    transform: translateY(-160%);
    z-index: 260;
  }
  .toast.show {
    transform: translateY(0);
  }
}


/* ===================================================================
   REDISEÑO 2026: interfaz más limpia y ordenada.
   Va al final para tener prioridad sobre las reglas anteriores.
   =================================================================== */
:root {
  --bg: #f4f6fa;
  --border: #e6e9ef;
  --border-strong: #d5dbe4;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.04);
}
body.dark-mode { --border-strong: #3b4a60; }
body { -webkit-font-smoothing: antialiased; }

/* Menú lateral */
.nav-links { gap: 0.2rem; }
.nav-btn { padding: 0.65rem 0.85rem; font-size: 0.92rem; }
.nav-btn.active { background: rgba(59, 130, 246, 0.18); color: #fff; box-shadow: inset 3px 0 0 #3b82f6; }
.sidebar-footer { font-size: 0.75rem; }

/* Encabezado */
.topbar { padding: 0.8rem 1.5rem; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); }
.topbar-title { font-size: 1.2rem; font-weight: 750; letter-spacing: -0.01em; }
.topbar-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 1px; }
.topbar-sub:empty { display: none; }
.topbar-meta { gap: 0.5rem; }
.icon-btn { padding: 0.4rem 0.55rem !important; min-width: 36px; font-size: 1rem; line-height: 1; }

/* Tarjetas */
.content { padding: 1.25rem 1.5rem; }
.card { padding: 1.2rem 1.25rem; }
.card-header { margin-bottom: 0.9rem; }
.card-title { font-size: 1rem; font-weight: 700; letter-spacing: -0.005em; }
.card-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; font-weight: 400; }
.muted-sm { font-size: 0.8rem; color: var(--text-muted); }

/* Campos y botones */
.input, .select { border-color: var(--border-strong); border-radius: 10px; padding: 0.6rem 0.8rem; }
.btn { border-radius: 10px; }
.btn-outline { border-color: var(--border-strong); }
.form-group label { color: #475569; font-weight: 600; font-size: 0.8rem; }
.link-btn {
  background: none; border: none; padding: 0.25rem 0.1rem; cursor: pointer;
  color: var(--primary); font-weight: 600; font-size: 0.82rem;
}
.link-btn:hover { text-decoration: underline; }

/* Tablas */
table { font-size: 0.875rem; }
th {
  background: transparent; color: var(--text-muted); font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700;
  padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border);
}
td { padding: 0.7rem 0.75rem; vertical-align: middle; }
tr:hover td { background: color-mix(in srgb, var(--primary) 4%, transparent); }
body.dark-mode th { background: transparent !important; color: #94a3b8 !important; }

/* Barra de herramientas (buscador + acciones) */
.toolbar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.toolbar-search { display: flex; gap: 0.4rem; flex: 1; min-width: 220px; max-width: 380px; }
.card-header .toolbar { flex: 1; justify-content: flex-end; }

/* Menú desplegable "Más ▾" */
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 250px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14); padding: 0.35rem;
  display: flex; flex-direction: column;
}
.menu-list button {
  background: none; border: none; text-align: left; padding: 0.6rem 0.75rem; border-radius: 8px;
  font-size: 0.86rem; color: var(--text); cursor: pointer;
}
.menu-list button:hover { background: var(--surface-alt); }

/* Paneles plegables: se abren tocando el encabezado */
.collapsible > .card-header { cursor: pointer; user-select: none; margin-bottom: 0; }
.collapsible.open > .card-header { margin-bottom: 0.9rem; }
.collapsible > .card-header::after {
  content: ''; width: 8px; height: 8px; flex-shrink: 0; margin-left: 0.25rem;
  border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg); transition: transform 0.15s ease; margin-top: -4px;
}
.collapsible.open > .card-header::after { transform: rotate(-135deg); margin-top: 4px; }
.collapsible:not(.open) > :not(.card-header) { display: none !important; }
.collapsible-actions { margin-left: auto; display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.collapsible:not(.open) .collapsible-actions .btn { display: none; }
.sub-block {
  border: 1px solid var(--border); border-radius: 12px; padding: 0.8rem 0.95rem;
  background: var(--surface-alt); margin-top: 0.35rem;
}
.sub-block-title { font-weight: 700; font-size: 0.9rem; color: var(--text); }

/* Opciones avanzadas dentro de formularios */
details.form-more, details.pos-more { margin-top: 0.85rem; }
details.pos-more { margin-top: 0; margin-bottom: 0.25rem; }
details.form-more > summary, details.pos-more > summary {
  cursor: pointer; color: var(--primary); font-weight: 600; font-size: 0.82rem; padding: 0.3rem 0;
}
.pos-doc-box {
  margin-top: 0.5rem; padding: 0.45rem 0.65rem; background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: 10px; font-size: 0.78rem;
}
.pos-scan-hint { margin-bottom: 0.6rem; }
.pos-scan-hint:not(:has(.badge:not([style*="none"]))) { display: none; }

/* Barra de caja del POS */
.cash-bar { padding: 0.65rem 1rem; margin-bottom: 1rem; }
.cash-bar-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.cash-bar-info { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; font-size: 0.86rem; }
.cash-bar-expected { font-size: 0.86rem; color: var(--text-muted); }
.cash-bar-expected strong { color: var(--text); font-size: 0.95rem; }
.cash-bar-actions { display: flex; align-items: center; gap: 0.45rem; }
.cash-bar-detail { display: none !important; gap: 0.5rem 1.25rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--text-muted);
  margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px dashed var(--border); }
.cash-bar.show-detail:not(.is-closed) .cash-bar-detail { display: flex !important; }
.cash-bar-detail strong { color: var(--text); margin-left: 0.25rem; }
.cash-bar.is-closed { background: color-mix(in srgb, var(--warning) 8%, var(--surface)); border-color: color-mix(in srgb, var(--warning) 30%, var(--border)); }

/* Selector de período (Informes) */
.segmented { display: inline-flex; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; padding: 3px; flex-wrap: wrap; }
.segmented button {
  background: none; border: none; padding: 0.4rem 0.8rem; border-radius: 8px; cursor: pointer;
  font-size: 0.84rem; font-weight: 600; color: var(--text-muted);
}
.segmented button.active, .segmented .rep-period-btn.active {
  background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}
.sub-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 0.25rem; padding: 0.3rem; }
.sub-tabs::-webkit-scrollbar { display: none; }
.sub-tab { white-space: nowrap; padding: 0.5rem 0.85rem; }
.sub-tab.active { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.rep-panel .card-header p { display: none; }

/* Indicadores (KPI) */
.kpi-grid { gap: 0.85rem; margin-bottom: 1rem; }
.kpi-card { padding: 1rem 1.1rem; }
.kpi-label { text-transform: none; letter-spacing: 0; font-size: 0.8rem; font-weight: 600; }
.kpi-value { font-size: 1.45rem; font-weight: 750; letter-spacing: -0.02em; color: var(--text); }
.kpi-sub { font-size: 0.76rem; }
.trend { font-weight: 700; }
.trend.up { color: var(--success); }
.trend.down { color: var(--danger); }

/* ============ Panel de Inicio ============ */
.dash-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.dash-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: stretch; }
.dash-side { display: flex; flex-direction: column; gap: 1rem; }
.dash-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.dash-status { padding: 1rem 1.1rem; }
.dash-status-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.dash-status-value { font-size: 1.3rem; font-weight: 750; margin-top: 0.15rem; display: flex; align-items: center; gap: 0.45rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 20%, transparent); }
.dot-amber { background: var(--warning); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 20%, transparent); }
.dash-bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.6rem; height: 230px; align-items: stretch; }
.dash-bar { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; min-width: 0; }
.dash-bar-value { font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; min-height: 1em; }
.dash-bar-track { flex: 1; width: 100%; max-width: 54px; display: flex; align-items: flex-end; background: var(--surface-alt); border-radius: 8px; overflow: hidden; }
.dash-bar-fill { width: 100%; background: color-mix(in srgb, var(--primary) 40%, transparent); border-radius: 8px 8px 0 0; transition: height 0.4s ease; }
.dash-bar-fill.today { background: var(--primary); }
.dash-bar-label { font-size: 0.74rem; color: var(--text-muted); font-weight: 600; text-transform: capitalize; }
.dash-list { display: flex; flex-direction: column; }
.dash-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--border); font-size: 0.86rem; }
.dash-row:last-child { border-bottom: none; }
.dash-row > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-row.clickable { cursor: pointer; }
.dash-row.clickable:hover { color: var(--primary); }
.rank { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 6px;
  background: var(--surface-alt); border: 1px solid var(--border); font-size: 0.7rem; font-weight: 700; margin-right: 0.5rem; }
.dash-empty { color: var(--text-muted); font-size: 0.84rem; text-align: center; padding: 1.25rem 0.5rem; }

@media (max-width: 1100px) {
  .dash-grid, .dash-grid-3 { grid-template-columns: 1fr; }
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .content { padding: 0.85rem; }
  .topbar { padding: 0.65rem 0.85rem; flex-wrap: nowrap; align-items: center; }
  .topbar > div:first-child { flex: 1 1 auto; min-width: 0; }
  .topbar-title { font-size: 1.05rem; }
  .topbar-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-meta { width: auto; flex-wrap: nowrap; }
  #planTopbarBadge { display: none; }
  .nav-btn.active { box-shadow: none; }
  .kpi-grid, .kpi-grid.dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .kpi-card { padding: 0.8rem 0.85rem; }
  .kpi-value { font-size: 1.12rem; }
  .dash-bars { height: 180px; gap: 0.35rem; }
  .dash-bar-value { display: none; }
  .dash-actions .btn { flex: 1 1 calc(50% - 0.5rem); }
  .toolbar-search { max-width: none; min-width: 100%; }
  .card-header .toolbar { justify-content: flex-start; }
  .cash-bar-info { gap: 0.5rem; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; padding: 0.45rem 0.4rem; }
  .menu-list { right: auto; left: 0; }
}

/* Celdas de tablas */
.badge { white-space: nowrap; }
td.nowrap { white-space: nowrap; }
td .muted, td.muted { color: var(--text-muted); }
.cell-title { font-weight: 600; line-height: 1.3; }
.cell-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; font-family: ui-monospace, Consolas, monospace; }
.cell-product { min-width: 180px; }
.row-actions { display: flex; gap: 0.3rem; flex-wrap: nowrap; }
.row-actions .btn-sm { padding: 0.35rem 0.5rem; }

/* Tablas: los montos y fechas no se parten en dos líneas */
.table-wrap td { white-space: nowrap; }
.table-wrap td.cell-product, #catalogOrdersTableBody td, .table-wrap td.wrap { white-space: normal; }
.stack-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
#tab-reports .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
@media (max-width: 768px) { #tab-reports .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#tab-reports .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 768px) { #tab-reports .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* POS en celular: dos productos por fila y tarjetas compactas */
@media (max-width: 640px) {
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.55rem; }
  .product-thumb { height: 84px; }
}
@media (max-width: 480px) {
  .products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-card { padding: 0.55rem; gap: 0.3rem; }
  .product-name { font-size: 0.85rem; }
  .product-price { font-size: 0.98rem; }
  .cash-bar-actions { width: 100%; }
  .cash-bar-actions #openCashArqueoModalBtn { flex: 1; }
}

.segmented button { white-space: nowrap; }
