:root {
  --bg-primary: #0d1117;
  --bg-card: #151c28;
  --bg-card-hover: #1a2333;
  --bg-modal: #131924;
  --border-color: #243044;
  --border-subtle: #1c2637;
  --text-main: #f1f5f9;
  --text-muted: #8da0b8;
  --text-faint: #52637a;

  /* Acentos ejecutivos sobrios */
  --accent: #2563eb;          /* Azul corporativo royal */
  --accent-hover: #1d4ed8;
  --accent-light: rgba(37, 99, 235, 0.12);
  --accent-subtle: rgba(37, 99, 235, 0.08);

  --warning: #d97706;         /* Ámbar reorden sobrio */
  --warning-light: rgba(217, 119, 6, 0.12);
  --warning-text: #fbbf24;

  --danger: #dc2626;
  --danger-light: rgba(220, 38, 38, 0.12);

  --success: #059669;         /* Verde enebro sobrio */
  --success-light: rgba(5, 150, 105, 0.12);
  --success-text: #34d399;

  --info: #0284c7;
  --info-light: rgba(2, 132, 199, 0.12);

  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 5px;
  --radius-full: 9999px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Utilidad de Íconos SVG */
.wz-icon {
  display: inline-block;
  vertical-align: -0.15em;
  stroke-width: 1.8;
  stroke: currentColor;
  flex-shrink: 0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: calc(75px + var(--safe-bottom));
  overflow-x: hidden;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(13, 17, 23, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  background: #1e293b;
  color: #f1f5f9;
  font-weight: 800;
  font-size: 13px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
  border: 1px solid #334155;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: #384a68;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

.btn-logout {
  color: #f87171 !important;
  border-color: rgba(220, 38, 38, 0.35) !important;
  background: rgba(220, 38, 38, 0.08) !important;
  flex-shrink: 0;
}

.btn-logout:hover {
  background: rgba(220, 38, 38, 0.2) !important;
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
}

.user-pill-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: #fff;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.user-pill-btn:hover {
  background: var(--bg-card-hover);
  border-color: #384a68;
}

/* Main Layout */
.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

/* Views */
.view {
  display: none;
  animation: fadeIn 0.2s ease-out forwards;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.stat-card:hover {
  border-color: #384a68;
}

.stat-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.stat-icon.emerald { background: var(--accent-light); color: #60a5fa; }
.stat-icon.amber { background: var(--warning-light); color: var(--warning-text); }
.stat-icon.cyan { background: var(--success-light); color: var(--success-text); }
.stat-icon.rose { background: var(--danger-light); color: #f87171; }

.stat-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 500;
}

/* Quick Action Banner */
.hero-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.hero-text h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 3px;
  color: var(--text-main);
}

.hero-text p {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid #1d4ed8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: #1e40af;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: #384a68;
  color: #ffffff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: 1px solid #b91c1c;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-danger:hover {
  background: #b91c1c;
}

/* Search and Filters Bar */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 14px;
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13px;
  padding: 10px 14px 10px 40px;
  outline: none;
  transition: border-color 0.15s ease;
}

.search-input:focus {
  border-color: var(--accent);
}

.filter-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip:hover {
  border-color: #384a68;
  color: var(--text-main);
}

.chip.active {
  background: #1e293b;
  color: #ffffff;
  font-weight: 600;
  border-color: #475569;
}

.chip.danger.active {
  background: rgba(217, 119, 6, 0.15);
  color: #fbbf24;
  border-color: rgba(217, 119, 6, 0.4);
}

.chip.healthy.active {
  background: rgba(5, 150, 105, 0.15);
  color: #34d399;
  border-color: rgba(5, 150, 105, 0.4);
}

/* Product Cards */
.products-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}

.product-card:hover {
  background: var(--bg-card-hover);
  border-color: #384a68;
}

.product-card.low-stock {
  border-left: 3px solid var(--warning);
}

.product-card.critical-stock {
  border-left: 3px solid var(--danger);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-sku {
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  font-family: monospace;
  font-size: 11px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.badge-cat {
  background: rgba(2, 132, 199, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(2, 132, 199, 0.25);
}

.badge-supplier {
  background: rgba(71, 85, 105, 0.18);
  color: #cbd5e1;
  border: 1px solid rgba(71, 85, 105, 0.35);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-stock {
  font-weight: 600;
  font-size: 11px;
}

.badge-stock.ok {
  background: var(--success-light);
  color: var(--success-text);
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.badge-stock.low {
  background: var(--warning-light);
  color: var(--warning-text);
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.badge-stock.critical {
  background: var(--danger-light);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
  margin-top: 2px;
}

.price-tag {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.cost-tag {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 6px;
}

.quick-stock-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-qty {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-qty:hover {
  background: var(--accent);
  color: #0b0f19;
  border-color: var(--accent);
}

.btn-qty.minus:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* Scanner View */
.scanner-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.camera-wrapper {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  aspect-ratio: 4/3;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 2px solid var(--border-color);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

#reader {
  width: 100% !important;
  height: 100% !important;
}

#reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* Overlay Laser Scan Beam */
.scanner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.scanner-frame {
  width: 75%;
  height: 60%;
  border: 2px dashed rgba(16, 185, 129, 0.7);
  border-radius: 12px;
  position: relative;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
}

.scanner-laser {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #10b981, #34d399, #10b981, transparent);
  box-shadow: 0 0 8px #10b981;
  animation: scanLaser 2s infinite ease-in-out alternate;
}

@keyframes scanLaser {
  0% { top: 5%; }
  100% { top: 92%; }
}

.scanner-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.scanner-manual-input {
  display: flex;
  gap: 8px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(13, 17, 23, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 6px 12px calc(6px + var(--safe-bottom));
  z-index: 40;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease;
  flex: 1;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  transition: transform 0.15s ease;
}

.nav-item.active {
  color: #60a5fa;
  font-weight: 600;
}

.nav-item.active svg {
  transform: translateY(-1px);
}

.nav-item.nav-scan {
  position: relative;
  top: -10px;
}

.nav-item.nav-scan .scan-fab {
  background: var(--accent);
  color: #fff;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  margin-bottom: 2px;
  border: 3px solid var(--bg-primary);
  transition: transform 0.15s ease, background 0.15s ease;
}

.nav-item.nav-scan .scan-fab:hover {
  background: var(--accent-hover);
}

.nav-item.nav-scan:active .scan-fab {
  transform: scale(0.92);
}

/* Modal Bottom Sheet */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
  }
}

.modal-sheet {
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 640px) {
  .modal-sheet {
    border-radius: var(--radius-lg);
  }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
}

/* Form inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input, .form-select, .form-textarea {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Barcode Display Card */
.barcode-box {
  background: #ffffff;
  padding: 14px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 12px 0;
}

.barcode-box svg {
  max-width: 100%;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 70px;
  right: 16px;
  left: 16px;
  max-width: 400px;
  margin: 0 auto;
  z-index: 200;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.25s ease-out;
}

.toast.success { border-color: var(--accent); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }

@keyframes slideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Movements list */
.movement-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.movement-type {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.movement-type.ENTRADA { background: var(--accent-light); color: var(--accent); }
.movement-type.SALIDA { background: var(--danger-light); color: var(--danger); }
.movement-type.AJUSTE { background: var(--warning-light); color: var(--warning); }

/* QR WiFi pairing */
.qr-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.qr-box {
  background: white;
  padding: 12px;
  border-radius: var(--radius-md);
  display: inline-block;
}

/* --- Modo Auditoría & Conteo Continuo --- */
.scan-mode-tabs {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 6px;
  margin-bottom: 14px;
}

.mode-tab {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.mode-tab.active {
  background: var(--accent);
  color: #0b0f19;
  font-weight: 700;
}

.audit-metrics-bar {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  justify-content: space-around;
  margin-top: 10px;
}

.audit-metric-item {
  text-align: center;
}

.audit-metric-val {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}

.audit-metric-lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.audit-tray {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audit-item-row {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  animation: fadeIn 0.2s ease-out;
}

.audit-item-info {
  flex: 1;
  min-width: 0;
}

.audit-item-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audit-item-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.audit-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.diff-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  min-width: 44px;
  text-align: center;
}

.diff-badge.equal {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
}

.diff-badge.positive {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.diff-badge.negative {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.audit-actions-bar {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* --- Estilos del Consejero de Compras Inteligente WZ --- */
.consejero-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin: 6px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.consejero-stat {
  display: flex;
  flex-direction: column;
}

.consejero-stat-lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.consejero-stat-val {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}

.consejero-decision {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 6px;
}

.order-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.order-badge.buy {
  background: rgba(217, 119, 6, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(217, 119, 6, 0.3);
}

.order-badge.urgent {
  background: rgba(220, 38, 38, 0.14);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.35);
}

.order-badge.healthy {
  background: rgba(5, 150, 105, 0.12);
  color: #34d399;
  border: 1px solid rgba(5, 150, 105, 0.3);
}

.supplier-filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  max-width: 220px;
}

.supplier-filter-select:focus {
  border-color: var(--accent);
}

/* --- ESTILOS PARA FILTROS MÚLTIPLES (SUCURSALES Y PROVEEDORES) --- */
.branch-pills-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.branch-pills-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.branch-pills-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.branch-pill {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.branch-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: #384a68;
}

.branch-pill.active {
  background: rgba(37, 99, 235, 0.15);
  color: #93c5fd;
  border-color: #3b82f6;
  font-weight: 600;
}

.branch-pill.all-pill.active {
  background: rgba(37, 99, 235, 0.2);
  color: #bfdbfe;
  border-color: #3b82f6;
}

.btn-supplier-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-supplier-filter:hover {
  border-color: #384a68;
  background: var(--bg-card-hover);
}

.btn-supplier-filter.has-selection {
  background: rgba(37, 99, 235, 0.12);
  border-color: #3b82f6;
  color: #93c5fd;
}

.active-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  width: 100%;
}

.active-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(37, 99, 235, 0.3);
  color: #bfdbfe;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.active-tag .remove-tag {
  cursor: pointer;
  opacity: 0.7;
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.active-tag .remove-tag:hover {
  opacity: 1;
  color: #f87171;
}

.clear-all-tags-btn {
  font-size: 11px;
  color: var(--text-muted);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
  padding: 2px 6px;
}

.clear-all-tags-btn:hover {
  color: var(--danger);
}

.supplier-modal-content {
  max-width: 600px;
  width: 92%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.supplier-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  flex: 1;
}

.supplier-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.supplier-checkbox-list {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(0, 0, 0, 0.2);
}

.supplier-checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-main);
  transition: background 0.12s;
}

.supplier-checkbox-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.supplier-checkbox-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #2563eb;
}

.supplier-item-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 3px;
}

.supplier-item-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.2);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.supplier-item-badge.single {
  background: rgba(217, 119, 6, 0.1);
  color: #fbbf24;
  border-color: rgba(217, 119, 6, 0.25);
}

.supplier-item-badge.all {
  background: rgba(5, 150, 105, 0.1);
  color: #34d399;
  border-color: rgba(5, 150, 105, 0.25);
}

/* --- ESTILOS LOGIN Y GESTIÓN DE USUARIOS --- */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 17, 23, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.login-overlay.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 400px;
  padding: 28px 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.3s ease-out;
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.user-mgmt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  gap: 10px;
}

.user-mgmt-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* --- RESPONSIVE & MOBILE-FIRST OPTIMIZATIONS (< 640px) --- */
.desktop-only {
  display: inline-flex;
}

.desktop-only-inline {
  display: inline;
}

.mobile-only {
  display: none !important;
}

@media (max-width: 640px) {
  .desktop-only {
    display: none !important;
  }

  .desktop-only-inline {
    display: none !important;
  }

  .mobile-only {
    display: flex !important;
  }

  /* Header Móvil Compacto y Libre de Roturas */
  .app-header {
    padding: 8px 12px;
    gap: 8px;
  }

  .brand {
    gap: 6px;
    min-width: 0;
    flex-shrink: 1;
  }

  .brand-badge {
    font-size: 11px;
    padding: 3px 6px;
    flex-shrink: 0;
  }

  .brand-title {
    font-size: 14px;
    letter-spacing: -0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand-sub {
    display: none !important;
  }

  .header-actions {
    gap: 5px;
    flex-shrink: 0;
  }

  #user-header-controls {
    gap: 5px;
  }

  .user-pill-btn {
    padding: 4px 7px;
    font-size: 11px;
    max-width: 115px;
  }

  .user-pill-btn span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .btn-icon {
    width: 34px;
    height: 34px;
  }

  /* Carrusel Táctil de Sucursales */
  .branch-pills-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
  }

  .branch-pills-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    width: 100%;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .branch-pills-row::-webkit-scrollbar {
    display: none;
  }

  .branch-pill {
    flex-shrink: 0;
    font-size: 12px;
    padding: 5px 11px;
    white-space: nowrap;
  }

  /* Banner Principal en Móvil */
  .hero-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    padding: 12px 14px;
    gap: 10px;
  }

  .hero-banner .btn-primary {
    width: 100%;
    justify-content: center;
  }

  /* Tarjetas de Métricas en Móvil */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
  }

  .stat-card {
    padding: 10px 12px;
  }

  .stat-val {
    font-size: 18px;
  }

  .stat-lbl {
    font-size: 10px;
  }

  .stat-icon {
    width: 26px;
    height: 26px;
    margin-bottom: 6px;
  }

  /* Ajustes de productos en móvil */
  .product-card {
    padding: 12px 14px;
  }
}

@media (max-width: 380px) {
  .brand-title {
    font-size: 13px;
  }

  .user-pill-btn {
    max-width: 80px;
  }
}
