/* ==========================================================
   VENDING MANAGER - ADMIN DASHBOARD STYLES
   Estilo sobrio, profesional, industrial y tecnológico
   ========================================================== */

:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --accent: #06b6d4;
  --accent-gold: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --info: #0284c7;

  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active: #2563eb;

  --app-bg: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 36px rgba(15, 23, 42, 0.14);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Outfit', sans-serif;
  background: var(--app-bg);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
}

/* ==========================================================
   PANTALLA DE LOGIN
   ========================================================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  padding: 1.5rem;
}

.login-card {
  background: white;
  width: 100%;
  max-width: 420px;
  padding: 2.2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-15px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-brand {
  text-align: center;
  margin-bottom: 1.8rem;
}

.login-logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  margin: 0 auto 0.8rem;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.login-brand h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
}

.login-brand p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fdfcff;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(122, 62, 157, 0.15);
  background: white;
}

.btn-primary {
  width: 100%;
  padding: 0.8rem 1rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(122, 62, 157, 0.3);
  transition: transform 0.15s, filter 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(1px);
}

.quick-credentials {
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px dashed var(--border);
  text-align: center;
}

.quick-credentials p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.quick-buttons {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}

.btn-quick-login {
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #faf8fd;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-quick-login:hover {
  background: var(--primary);
  color: white;
}

/* ==========================================================
   PANEL DE ADMINISTRACIÓN (LAYOUT SIDEBAR + MAIN)
   ========================================================== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 250px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  box-shadow: 4px 0 16px rgba(0,0,0,0.1);
}

.sidebar-brand {
  padding: 1.4rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 1.1rem;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.sidebar-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: white;
}

.sidebar-title span {
  color: #38bdf8;
}

.sidebar-nav {
  padding: 1.2rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item i {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: white;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: white;
  box-shadow: 0 4px 12px rgba(142, 68, 173, 0.4);
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.75rem;
  color: #7b748f;
  text-align: center;
}

/* MAIN CONTENT AREA */
.main-wrapper {
  margin-left: 250px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* TOPBAR */
.topbar {
  background: white;
  height: 64px;
  border-bottom: 1px solid var(--border);
  padding: 0 1.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 90;
  box-sizing: border-box;
  width: 100%;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.topbar-left h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.topbar-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 0.42rem 0.8rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.83rem;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.topbar-action-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.topbar-action-btn:active {
  transform: scale(0.96);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #f8f6fc;
  border: 1px solid var(--border);
  padding: 0.4rem 0.8rem;
  border-radius: 30px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.user-info span {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.1;
}

.user-info small {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

.btn-logout {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: #dc2626;
  color: white;
}

/* CONTENT VIEW AREA */
.content-body {
  padding: 1.8rem;
  flex: 1;
}

.module-view {
  display: none;
  animation: fadeIn 0.25s ease;
}

.module-view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* STATS KPI CARDS */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: white;
  padding: 1.2rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
}

.kpi-purple, .kpi-blue { background: #eff6ff; color: var(--primary); }
.kpi-teal { background: #ccfbf1; color: #0d9488; }
.kpi-gold { background: #fef3c7; color: #d97706; }
.kpi-green { background: #dcfce7; color: #16a34a; }

.kpi-data span {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.kpi-data h3 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 0.1rem;
}

/* TABLAS Y TARJETAS GENERALES */
.panel-card {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1.4rem;
  margin-bottom: 1.5rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.2rem;
}

.panel-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.table-responsive {
  overflow-x: auto;
}

.table-admin {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.table-admin th {
  background: #fbf9fd;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table-admin td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  vertical-align: middle;
}

.table-admin tbody tr:hover {
  background: #faf8fd;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-active, .badge-operativa, .badge-ok {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.badge-inactive, .badge-inactiva, .badge-danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.badge-incidencia, .badge-warn {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.action-btn {
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-main);
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #faf5ff;
}

.action-btn.delete:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: #fef2f2;
}

.action-btn.qr-btn {
  background: #eff6ff;
  color: var(--primary);
  border-color: #bfdbfe;
}

/* ==========================================================
   MÓDULO ALMACÉN: BARRA ESCÁNER Y MULTIPLICADOR
   ========================================================== */
.barcode-scanner-box {
  background: #f8fafc;
  border: 2px dashed #94a3b8;
  border-radius: var(--radius-md);
  padding: 1rem 1.4rem;
  margin-bottom: 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-sizing: border-box;
  width: 100%;
}

.barcode-icon {
  font-size: 2rem;
  color: var(--primary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.barcode-input-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
}

.barcode-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  box-sizing: border-box;
}

.barcode-actions-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.barcode-cam-btn {
  padding: 0.75rem 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
  color: #2563eb;
  border-color: #bfdbfe;
  background: #eff6ff;
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.barcode-cam-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.barcode-search-btn {
  width: auto;
  padding: 0.75rem 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  white-space: nowrap;
  box-sizing: border-box;
  border-radius: var(--radius-sm);
}

/* LISTA DE BÚSQUEDA DE PRODUCTOS EN MODAL DE RESORTE */
.slot-product-item {
  padding: 9px 12px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s ease;
}

.slot-product-item:last-child {
  border-bottom: none;
}

.slot-product-item:hover {
  background: #eff6ff;
}

.slot-product-item.selected {
  background: #eff6ff;
  border-left: 3px solid #2563eb;
}

.slot-product-item-info strong {
  color: #0f172a;
  font-size: 0.88rem;
}

.slot-product-item-info small {
  color: #64748b;
  font-size: 0.75rem;
}

.slot-product-item-meta {
  text-align: right;
}

.slot-product-item-meta .item-price {
  color: #059669;
  font-weight: 700;
  font-size: 0.85rem;
}

.slot-product-item-meta .item-stock {
  color: #64748b;
  font-size: 0.72rem;
  display: block;
}

/* ==========================================================
   SIMULADOR Y CONTROL DE MÁQUINA
   ========================================================== */

.btn-simulator-enter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #2563eb;
  color: white;
  padding: 0.45rem 0.85rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
}

.btn-simulator-enter:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  background: #1d4ed8;
}

.twin-subview-header {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.4rem;
  margin-bottom: 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.twin-header-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.twin-container-grid {
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1180px) {
  .twin-container-grid {
    grid-template-columns: 1fr;
  }
}

/* --- MÁQUINA VENDING INDUSTRIAL / VISUALIZADOR OPERATIVO --- */
.vending-canvas {
  background: #f1f5f9;
  background-image: radial-gradient(#cbd5e1 1.5px, transparent 1.5px);
  background-size: 16px 16px;
  padding: 1.5rem 1rem 2rem;
  border-radius: var(--radius-lg);
  border: 2px dashed #94a3b8;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 2px 8px rgba(15, 23, 42, 0.04);
}

.vending-machine {
  width: 430px;
  min-width: 430px;
  max-width: 430px;
  min-height: 620px; /* ALARGADA: Proporción industrial esbelta de gabinete vending */
  background: #18181b; /* Chasis grafito oscuro / antracita mate */
  border: 3.5px solid #334155; /* Marco perimetral acero titanio */
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.35), 0 4px 10px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: visible;
  user-select: none;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.vm-header {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 3.5px solid #334155;
  border-radius: 14px 14px 0 0;
  padding: 0.7rem 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 1rem;
  color: #38bdf8;
  letter-spacing: 2px;
  font-weight: 800;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.vm-speaker {
  display: flex;
  gap: 4px;
}

.vm-speaker span {
  width: 14px;
  height: 3px;
  background: #475569;
  border-radius: 2px;
}

.vm-mid-section {
  display: grid;
  grid-template-columns: 1fr 135px; /* Vitrina espaciosa y torre de control confortable */
  padding: 12px;
  gap: 12px;
  width: 100%;
  min-height: 460px;
  box-sizing: border-box;
  flex: 1;
}

/* VITRINA DE VIDRIO ILUMINADA */
.vm-showcase {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  border: 3px solid #334155;
  border-radius: 10px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  min-height: 450px;
  gap: 10px;
  position: relative;
  box-shadow: inset 0 6px 16px rgba(0, 0, 0, 0.1);
}

.glass-glare {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 45%);
  border-radius: 8px;
  z-index: 5;
}

/* BANDEJA / SHELF TIER */
.shelf-tier {
  position: relative;
  background: rgba(226, 232, 240, 0.85);
  border: 2px solid #64748b;
  border-radius: 8px;
  padding: 6px 4px 4px;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.tier-code {
  position: absolute;
  top: 3px;
  left: 4px;
  font-size: 0.65rem;
  font-weight: 800;
  color: #38bdf8;
  background: #0f172a;
  border: 1.5px solid #334155;
  border-radius: 4px;
  padding: 0 4px;
  z-index: 5;
}

.items-holder {
  display: flex;
  align-items: flex-end;
  position: relative;
  z-index: 4;
  padding-bottom: 2px;
  width: 100%;
  box-sizing: border-box;
}

/* DENSIDAD DINÁMICA DE RESORTES (HASTA 8 POR FILA SIN DESBORDARSE) */
.shelf-tier:not(.dense-tier-6):not(.dense-tier-8) .items-holder {
  padding-left: 18px;
  justify-content: space-around;
  gap: 4px;
}
.shelf-tier:not(.dense-tier-6):not(.dense-tier-8) .item-can {
  width: 26px;
  height: 44px;
}
.shelf-tier:not(.dense-tier-6):not(.dense-tier-8) .item-carton {
  width: 28px;
  height: 42px;
}
.shelf-tier:not(.dense-tier-6):not(.dense-tier-8) .item-snack {
  width: 24px;
  height: 44px;
}

/* FILA DE 6 SLOTS */
.shelf-tier.dense-tier-6 .items-holder {
  padding-left: 16px;
  justify-content: space-around;
  gap: 2px;
}
.shelf-tier.dense-tier-6 .item-can {
  width: 22px;
  height: 40px;
}
.shelf-tier.dense-tier-6 .item-carton {
  width: 23px;
  height: 38px;
}
.shelf-tier.dense-tier-6 .item-snack {
  width: 20px;
  height: 40px;
}
.shelf-tier.dense-tier-6 .item-slot-code {
  font-size: 0.54rem;
}
.shelf-tier.dense-tier-6 .stock-pill {
  font-size: 0.5rem;
  padding: 0 3px;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
}

/* FILA DE 8 SLOTS (AJUSTE PRECISO: CERO DESBORDE) */
.shelf-tier.dense-tier-8 .items-holder {
  padding-left: 20px;
  justify-content: space-around;
  gap: 2px;
}
.shelf-tier.dense-tier-8 .item-can {
  width: 19px;
  height: 38px;
  border-radius: 4px;
}
.shelf-tier.dense-tier-8 .item-carton {
  width: 20px;
  height: 36px;
  border-radius: 3px;
}
.shelf-tier.dense-tier-8 .item-snack {
  width: 18px;
  height: 38px;
  border-radius: 3px;
}
.shelf-tier.dense-tier-8 .item-slot-code {
  font-size: 0.50rem;
  margin-top: 1px;
  letter-spacing: -0.2px;
}
.shelf-tier.dense-tier-8 .stock-pill {
  font-size: 0.48rem;
  padding: 0 3px;
  top: -5px;
  left: 50%;
  transform: translateX(-50%);
}

.spiral-rail {
  height: 4px;
  background: #94a3b8;
  border-top: 1px solid #64748b;
  border-bottom: 1px solid #64748b;
  position: relative;
  margin-top: 3px;
}

/* PRODUCTOS EN LA VITRINA */
.item-wrapper {
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0px;
  min-width: 0;
}

.item-wrapper:hover {
  transform: translateY(-3px) scale(1.06);
  filter: drop-shadow(0 4px 6px rgba(15, 23, 42, 0.3));
}

.item-wrapper.empty {
  opacity: 0.25;
  filter: grayscale(1);
}

.item-can {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  border-radius: 5px;
  border: 1.5px solid #1e293b;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 800;
  color: white;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.4);
}

.item-carton {
  border: 1.5px solid #1e293b;
  border-radius: 4px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 800;
  color: white;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.4);
}

.item-snack {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-radius: 4px;
  border: 1.5px solid #1e293b;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 800;
  color: #0f172a;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.4);
}

.item-slot-code {
  font-size: 0.56rem;
  font-weight: 800;
  color: #0f172a;
  margin-top: 2px;
}

.stock-pill {
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: #0f172a;
  color: white;
  font-size: 0.52rem;
  font-weight: 800;
  border-radius: 10px;
  padding: 0 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  z-index: 6;
  border: 1px solid #334155;
}

.stock-pill.low { background: #d97706; }
.stock-pill.out { background: #dc2626; }
.stock-pill.ok { background: #059669; }

/* TORRE LATERAL DE CONTROL */
.vm-control-tower {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.vm-screen-bezel {
  background: #0f172a;
  border-radius: 8px;
  padding: 5px;
  border: 2px solid #334155;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.6);
}

.vm-screen {
  background: #052e16; /* Verde terminal fosforescente industrial */
  border: 1px solid #10b981;
  border-radius: 4px;
  padding: 6px;
  font-family: 'Share Tech Mono', monospace;
  color: #4ade80;
  font-size: 0.65rem;
  line-height: 1.25;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-shadow: 0 0 5px rgba(74, 222, 128, 0.6);
  box-shadow: inset 0 0 10px rgba(0,0,0,0.85);
}

.screen-mode {
  color: #86efac;
  font-size: 0.54rem;
  border-bottom: 1px solid #064e3b;
  padding-bottom: 2px;
  margin-bottom: 3px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.screen-marquee {
  font-weight: bold;
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.screen-sub {
  color: #a7f3d0;
  font-size: 0.54rem;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vm-keypad {
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: 8px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.keypad-label {
  font-size: 0.58rem;
  font-weight: 800;
  color: #94a3b8;
  text-align: center;
  font-family: 'Share Tech Mono', monospace;
  letter-spacing: 0.5px;
}

.keypad-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.v-btn {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 4px;
  font-size: 0.66rem;
  font-weight: 700;
  color: #0f172a;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: all 0.1s;
}

.v-btn i { font-size: 0.8rem; color: #2563eb; }
.v-btn:hover { background: #f1f5f9; border-color: #94a3b8; }
.v-btn.active { background: #2563eb; color: white; border-color: #1d4ed8; }
.v-btn.active i { color: white; }

.v-btn-full {
  grid-column: span 2;
  background: #f8fafc;
}

/* RANURA DE ARQUEO / MONEDERO */
.vm-slot-box {
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: 8px;
  padding: 6px 4px;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.vm-slot-box:hover {
  background: #334155;
}

.slot-light {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 6px #10b981;
  margin-bottom: 3px;
}

.slot-slit {
  width: 44px;
  height: 5px;
  background: #090d16;
  border-radius: 3px;
  border: 1px solid #475569;
}

.slot-tag {
  font-size: 0.55rem;
  font-weight: 800;
  color: #94a3b8;
  margin-top: 3px;
  letter-spacing: 0.5px;
}

/* BANDEJA DE DESPACHO INFERIOR (DROP ZONE) */
.vm-drop-zone {
  margin: 6px 10px 10px;
  background: #090d16;
  border: 3px solid #334155;
  border-radius: 8px;
  height: 52px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 4px 10px rgba(0,0,0,0.5);
}

.push-plate {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 3px solid #0f172a;
  cursor: pointer;
  transition: transform 0.2s ease;
  position: relative;
}

.plate-text {
  font-size: 0.65rem;
  font-weight: 800;
  color: #cbd5e1;
  letter-spacing: 1.5px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.push-plate.open {
  transform: rotateX(45deg);
  transform-origin: top;
}

.dropped-item-slot {
  position: absolute;
  bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* PATAS DE LA MÁQUINA */
.vm-feet {
  display: flex;
  justify-content: space-between;
  padding: 0 28px;
  margin-top: -3px;
}

.vm-foot {
  width: 32px;
  height: 14px;
  background: #090d16;
  border: 2px solid #334155;
  border-top: none;
  border-radius: 0 0 8px 8px;
}

/* TARJETA DE AUDITORÍA Y ESTADO DE CAMPO */
.audit-status-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  box-shadow: var(--shadow-sm);
  width: 430px;
  max-width: 100%;
  box-sizing: border-box;
}

.audit-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.audit-badge-live {
  font-size: 0.78rem;
  font-weight: 700;
  color: #2563eb;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.audit-card-header small {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.audit-details-box {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.audit-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
}

.audit-detail-row span {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.audit-detail-row strong {
  color: var(--text-main);
}

.audit-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.btn-audit-nav {
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.btn-audit-nav:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}

/* --- TABS DEL PANEL DERECHO DEL GEMELO DIGITAL --- */
.twin-panel-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.twin-tabs-nav {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  gap: 0.5rem;
  overflow-x: auto;
}

.twin-tab-btn {
  padding: 0.85rem 1.2rem;
  border: none;
  background: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  transition: all 0.2s;
}

.twin-tab-btn:hover {
  color: var(--primary);
}

.twin-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--card-bg);
}

.twin-tab-pane {
  display: none;
  padding: 1.4rem;
}

.twin-tab-pane.active {
  display: block;
}

.twin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}

.twin-kpi-item {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  display: flex;
  flex-direction: column;
}

.twin-kpi-item span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.twin-kpi-item strong {
  font-size: 1.2rem;
  color: var(--text-main);
  margin-top: 0.2rem;
}

/* ==========================================================
   MODALES
   ========================================================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  /* Sin backdrop-filter: el desenfoque a pantalla completa hace lentos los modales */
  background: rgba(18, 14, 28, 0.65);
  display: none;
  place-items: center;
  z-index: 1000;
  padding: 1rem;
  overflow-y: auto;
}

.modal-overlay.active {
  display: grid;
}

.modal-card {
  background: white;
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  animation: popModal 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-card.wide {
  max-width: 780px;
}

.modal-card form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@keyframes popModal {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1.15rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 1.4rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-shrink: 0;
  background: white;
}

.btn-secondary {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

/* SISTEMA DE PESTAÑAS DENTRO DE MODALES (Rutas, Auditorías, etc.) */
.modal-tabs-nav {
  display: flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 4px;
  gap: 6px;
  margin-bottom: 1.2rem;
  border: 1px solid #e2e8f0;
}

.modal-tab-btn {
  flex: 1;
  padding: 0.65rem 1rem;
  border: none;
  background: transparent;
  font-size: 0.88rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.modal-tab-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.7);
}

.modal-tab-btn.active {
  color: #0f172a;
  background: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.modal-tab-pane {
  display: none;
  animation: fadeInModalTab 0.2s ease;
}

.modal-tab-pane.active {
  display: block;
}

@keyframes fadeInModalTab {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .modal-tabs-nav {
    flex-direction: column;
  }
  .modal-tab-btn {
    width: 100%;
    justify-content: flex-start;
  }
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast-item {
  min-width: 280px;
  max-width: 400px;
  background: white;
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.88rem;
  border-left: 4px solid var(--primary);
  animation: slideInRight 0.25s ease;
}

@keyframes slideInRight {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-fade-out {
  opacity: 0;
  transform: translateX(40px);
  transition: all 0.3s ease;
}

.toast-success { border-left-color: var(--success); }
.toast-success i { color: var(--success); font-size: 1.2rem; }

.toast-error { border-left-color: var(--danger); }
.toast-error i { color: var(--danger); font-size: 1.2rem; }

.toast-warn { border-left-color: var(--accent-gold); }
.toast-warn i { color: var(--accent-gold); font-size: 1.2rem; }

.toast-close {
  background: none;
  border: none;
  margin-left: auto;
  font-size: 1.1rem;
  cursor: pointer;
  color: #9ca3af;
}

/* ==========================================================
   ETIQUETA QR IMPRIMIBLE
   ========================================================== */
.qr-print-sheet {
  background: white;
  border: 2px dashed #94a3b8;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
}

.qr-print-sheet h3 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
}

.qr-print-sheet p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.qr-box {
  display: inline-block;
  padding: 12px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 0.8rem;
}

@media print {
  body * {
    visibility: hidden;
  }
  .qr-print-sheet, .qr-print-sheet * {
    visibility: visible;
  }
  .qr-print-sheet {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    border: 2px solid black;
  }
}

/* ==========================================================
   PAGINACIÓN REUTILIZABLE
   ========================================================== */
.pagination-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.8rem;
}

.pagination-info {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 500;
}

.pagination-info strong {
  color: var(--text-main);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.pagination-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: white;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}

.pagination-btn:hover:not(:disabled):not(.active) {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--primary);
}

.pagination-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f8fafc;
}

.pagination-ellipsis {
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 0.85rem;
  user-select: none;
}

/* ==========================================================
   KPI CLICKABLE & MODAL DE INCIDENCIAS ACTIVAS
   ========================================================== */
.kpi-clickable {
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.kpi-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

.incident-card-item {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-left: 4px solid #d97706;
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  margin-bottom: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  transition: all 0.15s ease;
}

.incident-card-item:hover {
  background: #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
}

.btn-filter-active {
  background: #fef3c7 !important;
  border-color: #f59e0b !important;
  color: #92400e !important;
  font-weight: 700 !important;
}

/* ==========================================================
   ESCÁNER DE CÁMARA MÓVIL
   ========================================================== */
#camera-viewport-container {
  position: relative;
  background: #090d16;
  border-radius: 12px;
  overflow: hidden;
}

#camera-reader-element video {
  width: 100% !important;
  height: auto !important;
  border-radius: 12px;
  object-fit: cover;
  display: block;
}

#camera-reader-element__scan_region {
  background: transparent !important;
}

.scanner-laser-line {
  position: absolute;
  top: 20%;
  left: 6%;
  right: 6%;
  height: 2.5px;
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444, 0 0 20px #ef4444;
  border-radius: 2px;
  animation: scanLaser 2s infinite ease-in-out;
  pointer-events: none;
  z-index: 10;
}

@keyframes scanLaser {
  0% { top: 20%; opacity: 0.8; }
  50% { top: 80%; opacity: 1; }
  100% { top: 20%; opacity: 0.8; }
}

/* ==========================================================
   MÓDULO DE RUTAS, REPOSICIÓN Y LIQUIDACIÓN
   ========================================================== */
.badge-route-programada {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  font-weight: 700;
}

.badge-route-en_ruta {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-weight: 700;
  animation: pulseAmber 2s infinite ease-in-out;
}

@keyframes pulseAmber {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.badge-route-completada {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-weight: 700;
}

.badge-route-liquidada {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #ddd6fe;
  font-weight: 700;
}

.badge-route-cancelada {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  font-weight: 700;
}

.route-progress-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.route-progress-bar {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  min-width: 60px;
}

.route-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #10b981);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.picking-suggested-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  margin-top: 1rem;
}

.picking-table input[type="number"] {
  width: 80px;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  text-align: center;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
}

.picking-table input[type="number"]:focus {
  border-color: #2563eb;
  outline: none;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* ==========================================================
   WIZARD DE VISITA OPERATIVA (PASO A PASO)
   ========================================================== */
.wizard-stepper {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.6rem 1rem;
  gap: 6px;
  overflow-x: auto;
}

.wiz-step-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.4rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.wiz-step-pill:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.wiz-step-pill.active {
  background: #2563eb;
  color: white;
}

.wiz-step-pill.completed {
  background: #dcfce7;
  color: #15803d;
}

.wiz-step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.1);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
}

.wiz-step-pill.active .wiz-step-num {
  background: white;
  color: #2563eb;
}

.wiz-step-pill.completed .wiz-step-num {
  background: #15803d;
  color: white;
}

.wiz-step-arrow {
  color: #cbd5e1;
  font-size: 0.7rem;
}

.qty-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  overflow: hidden;
  background: white;
}

.qty-btn {
  background: #f8fafc;
  border: none;
  width: 28px;
  height: 32px;
  font-size: 1rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.qty-btn:hover {
  background: #e2e8f0;
}

.qty-input {
  width: 48px;
  height: 32px;
  border: none;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
}

/* ==========================================================
   DISEÑO RESPONSIVO PROFESIONAL (CELULARES Y TABLETS)
   Optimizado para uso en campo desde smartphones y tablets
   ========================================================== */

/* Toggle Sidebar y Backdrop en Desktop por defecto ocultos */
.btn-sidebar-toggle {
  display: none;
}

.sidebar-close-mobile-btn {
  display: none;
}

.sidebar-brand-content {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.sidebar-backdrop {
  display: none;
}

/* TABLETS Y MÓVILES (<= 992px) */
@media (max-width: 992px) {
  .admin-layout {
    overflow-x: hidden;
  }

  .kpi-row {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* SMARTPHONES Y PANTALLAS PEQUEÑAS (<= 768px) */
@media (max-width: 768px) {
  /* 1. SIDEBAR COMO DRAWER FLOTANTE */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 280px !important;
    max-width: 82vw !important;
    z-index: 1100 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 8px 0 28px rgba(15, 23, 42, 0.4) !important;
  }

  .sidebar.open {
    transform: translateX(0) !important;
  }

  .sidebar-brand {
    justify-content: space-between;
    padding: 1.1rem 1rem;
  }

  .sidebar-close-mobile-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #e2e8f0;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
    z-index: 1050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  /* 2. WRAPPER Y TOPBAR MÓVIL */
  html, body {
    overflow-x: hidden;
  }

  .main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden;
  }

  .topbar {
    padding: 0 0.65rem !important;
    height: 56px !important;
    gap: 6px !important;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow: hidden !important;
  }

  .topbar-left {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
  }

  .btn-sidebar-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 8px !important;
    border: 1px solid var(--border) !important;
    background: #f8fafc !important;
    color: var(--text-main) !important;
    font-size: 1.05rem !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
  }

  .btn-sidebar-toggle:hover {
    background: #f1f5f9 !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
  }

  #topbar-title {
    font-size: 0.92rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0 !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .topbar-right {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
  }

  .topbar-action-btn {
    padding: 0.38rem 0.55rem !important;
    font-size: 0.8rem !important;
    border-radius: 7px !important;
    flex-shrink: 0 !important;
  }

  .topbar-action-btn .topbar-action-text {
    display: none !important;
  }

  .user-badge {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    gap: 0 !important;
    flex-shrink: 0 !important;
  }

  .user-badge .user-avatar {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.8rem !important;
  }

  .user-badge .user-info {
    display: none !important;
  }

  .btn-logout {
    padding: 0.38rem 0.55rem !important;
    font-size: 0.78rem !important;
    border-radius: 7px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    gap: 4px !important;
  }

  /* 3. CONTENIDO PRINCIPAL Y PANELES */
  .content-body {
    padding: 0.75rem 0.65rem !important;
  }

  .panel-card {
    padding: 1rem 0.85rem !important;
    border-radius: 10px !important;
    margin-bottom: 1rem !important;
  }

  .kpi-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
    margin-bottom: 0.85rem !important;
  }

  .kpi-card {
    padding: 0.75rem 0.85rem !important;
  }

  .kpi-value {
    font-size: 1.3rem !important;
  }

  .kpi-label {
    font-size: 0.75rem !important;
  }

  /* 4. TABLAS Y CONTROLES RESPONSIVOS EN MÓVIL */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    width: 100%;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
  }

  .table-admin {
    min-width: 560px;
    font-size: 0.82rem;
  }

  .table-admin th {
    padding: 0.55rem 0.6rem;
    font-size: 0.72rem;
  }

  .table-admin td {
    padding: 0.6rem 0.6rem;
  }

  /* 5. MODALES OPTIMIZADOS PARA CELULAR */
  .modal-overlay {
    padding: 0.35rem !important;
    align-items: flex-end !important;
  }

  .modal-card, .modal-card.wide {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 94vh !important;
    border-radius: 16px 16px 6px 6px !important;
    margin: 0 !important;
  }

  .modal-header {
    padding: 0.85rem 1rem !important;
  }

  .modal-header h3 {
    font-size: 1rem !important;
  }

  .modal-body {
    padding: 0.9rem 0.8rem !important;
    -webkit-overflow-scrolling: touch;
  }

  .modal-footer {
    padding: 0.75rem 1rem !important;
    flex-direction: column-reverse !important;
    gap: 0.5rem !important;
  }

  .modal-footer button {
    width: 100% !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0.7rem 1rem !important;
  }

  /* 6. STEPPER WIZARD DE VISITAS OPERATIVAS EN CELULAR */
  .wizard-stepper {
    padding: 0.45rem 0.5rem !important;
    gap: 4px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
  }

  .wiz-step-pill {
    padding: 0.3rem 0.55rem !important;
    font-size: 0.72rem !important;
    flex-shrink: 0 !important;
  }

  .wiz-step-arrow {
    display: none !important;
  }

  /* Controles táctiles de cantidad en resortes (+ y - grandes para dedos) */
  .qty-control {
    border-radius: 8px !important;
  }

  .qty-btn {
    width: 38px !important;
    height: 40px !important;
    font-size: 1.25rem !important;
    color: #1e293b !important;
    background: #f1f5f9 !important;
  }

  .qty-input {
    width: 52px !important;
    height: 40px !important;
    font-size: 1.1rem !important;
  }

  /* Input de recaudación táctil */
  #ev-coins, #ev-bills {
    height: 44px !important;
    font-size: 1.15rem !important;
    text-align: center !important;
  }

  /* Inputs en tablas */
  .machine-carry-input {
    width: 65px !important;
    padding: 0.35rem 0.3rem !important;
    font-size: 0.9rem !important;
  }

  /* Barra escáner y búsqueda de productos responsive en celular */
  .barcode-scanner-box {
    padding: 0.85rem 0.9rem !important;
    gap: 0.75rem !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .barcode-icon {
    display: none !important;
  }

  .barcode-input-wrap {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
    width: 100% !important;
  }

  .barcode-input {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    font-size: 16px !important;
  }

  .barcode-actions-wrap {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.6rem !important;
  }

  .barcode-cam-btn,
  .barcode-search-btn {
    width: 100% !important;
    min-height: 44px !important;
    padding: 0.65rem 0.5rem !important;
    font-size: 0.9rem !important;
    justify-content: center !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  /* Evita auto-zoom molesto de Safari en iOS al enfocar inputs */
  input[type="text"], input[type="number"], input[type="password"], select, textarea {
    font-size: 16px !important;
  }
}

/* TELÉFONOS MUY COMPACTOS (<= 480px) */
@media (max-width: 480px) {
  .kpi-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.4rem !important;
  }

  .login-card {
    padding: 1.4rem 1.1rem !important;
  }

  .quick-buttons {
    flex-direction: column !important;
    gap: 0.4rem !important;
  }

  .quick-buttons button {
    width: 100% !important;
  }

  #topbar-title {
    max-width: 140px !important;
    font-size: 0.88rem !important;
  }

  .topbar-right {
    gap: 5px !important;
  }

  .btn-logout {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
  }

  .btn-logout .btn-logout-text {
    display: none !important;
  }

  .topbar-action-btn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
  }
}

/* ==========================================================
   MÓDULO MÁQUINAS: VISTA DUAL (TABLA EN PC / TARJETAS EN MÓVIL)
   ========================================================== */

/* Selector de Modo de Vista (Segmented Toggle) */
.view-mode-toggle {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border);
  gap: 2px;
}

.btn-toggle-view {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.35rem 0.65rem;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-toggle-view:hover {
  color: var(--text-main);
}

.btn-toggle-view.active {
  background: #ffffff;
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Reglas de visualización por defecto:
   - En PC (> 768px): Tabla visible, Cards ocultas.
   - En Móvil (<= 768px): Tabla oculta, Cards visibles automáticamente. */
#machines-table-wrapper {
  display: block;
}

#machines-cards-container {
  display: none;
}

@media (max-width: 768px) {
  #machines-table-wrapper {
    display: none !important;
  }
  #machines-cards-container {
    display: grid !important;
  }
}

/* Forzado de vista cuando el usuario presiona los botones del selector */
#machines-view-wrapper.view-mode-cards #machines-table-wrapper {
  display: none !important;
}
#machines-view-wrapper.view-mode-cards #machines-cards-container {
  display: grid !important;
}

#machines-view-wrapper.view-mode-table #machines-table-wrapper {
  display: block !important;
}
#machines-view-wrapper.view-mode-table #machines-cards-container {
  display: none !important;
}

/* Grid de Tarjetas */
.machines-cards-container {
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.1rem;
  margin-bottom: 1rem;
}

/* Tarjeta individual de Máquina */
.machine-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  overflow: hidden;
}

.machine-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.09);
  border-color: #cbd5e1;
}

.machine-card.has-incidents {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(180deg, #fffdf8 0%, #ffffff 100%);
}

/* Header de la tarjeta */
.machine-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
  gap: 8px;
}

.machine-card-badges-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.machine-card-code {
  font-family: 'Share Tech Mono', monospace, sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  background: #ffffff;
  padding: 0.22rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.machine-card-code i {
  color: var(--primary);
  font-size: 0.8rem;
}

.machine-card-badges-right {
  display: flex;
  align-items: center;
}

/* Cuerpo de la tarjeta */
.machine-card-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.machine-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.35;
  margin: 0;
}

.machine-card-location {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.badge-district {
  align-self: flex-start;
  background: #eff6ff !important;
  color: #2563eb !important;
  border: 1px solid #bfdbfe !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  padding: 0.2rem 0.55rem !important;
}

.machine-card-address {
  font-size: 0.83rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
}

.machine-card-address i {
  color: #94a3b8;
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* Caja de Capacidad & Stock */
.machine-card-stock {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
}

.machine-card-stock-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 4px;
}

.stock-label {
  color: #475569;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.stock-label i {
  color: var(--primary);
}

.stock-values {
  color: #0f172a;
  font-size: 0.85rem;
}

.stock-badge {
  font-size: 0.7rem !important;
  padding: 0.15rem 0.45rem !important;
}

.machine-card-progress {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.machine-card-progress-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.machine-card-progress-bar.progress-high {
  background: linear-gradient(90deg, #10b981, #059669);
}

.machine-card-progress-bar.progress-mid {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.machine-card-progress-bar.progress-low {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.machine-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #64748b;
  border-top: 1px dashed #f1f5f9;
  padding-top: 0.55rem;
}

.machine-card-meta i {
  color: #94a3b8;
}

/* Footer de la tarjeta con acciones */
.machine-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.8rem 1rem 0.95rem;
  border-top: 1px solid #f1f5f9;
  background: #ffffff;
}

.machine-card-main-btn {
  flex: 1;
  padding: 0.62rem 0.9rem !important;
  font-size: 0.86rem !important;
  border-radius: 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25) !important;
  cursor: pointer;
}

.machine-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.machine-card-actions .action-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.9rem;
}

.action-btn-warn {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border-color: #fde68a !important;
}

.action-btn-warn:hover {
  background: #fde68a !important;
  color: #92400e !important;
}

.badge-clickable {
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.badge-clickable:hover {
  filter: brightness(0.95);
  transform: scale(1.03);
}

.machines-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #94a3b8;
  grid-column: 1 / -1;
  background: #f8fafc;
  border: 2px dashed #e2e8f0;
  border-radius: 14px;
}

.machines-empty-state i {
  font-size: 2.2rem;
  margin-bottom: 0.6rem;
  color: #cbd5e1;
}

.machines-empty-state p {
  font-size: 0.92rem;
  margin: 0;
}

@media (max-width: 520px) {
  .view-toggle-text {
    display: none;
  }
  .btn-toggle-view {
    padding: 0.35rem 0.5rem;
  }
}

@media (max-width: 480px) {
  .machines-cards-container {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }
  .machine-card-header {
    padding: 0.75rem 0.85rem 0.55rem;
  }
  .machine-card-body {
    padding: 0.85rem;
  }
  .machine-card-footer {
    padding: 0.7rem 0.85rem 0.85rem;
  }
}

/* ==========================================================
   MÓDULO PRODUCTOS: VISTA DUAL (TABLA EN PC / TARJETAS COMPACTAS EN MÓVIL)
   ========================================================== */

#products-table-wrapper {
  display: block;
}

#products-cards-container {
  display: none;
}

/* En móvil (<= 768px): Ocultar tabla y mostrar tarjetas automáticamente */
@media (max-width: 768px) {
  #products-table-wrapper {
    display: none !important;
  }
  #products-cards-container {
    display: flex !important;
  }
}

/* Forzado de vista cuando el usuario presiona los botones del selector */
#products-view-wrapper.view-mode-cards #products-table-wrapper {
  display: none !important;
}
#products-view-wrapper.view-mode-cards #products-cards-container {
  display: flex !important;
}

#products-view-wrapper.view-mode-table #products-table-wrapper {
  display: block !important;
}
#products-view-wrapper.view-mode-table #products-cards-container {
  display: none !important;
}

/* Contenedor de Tarjetas Compactas */
.products-cards-container {
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

/* Tarjeta Compacta Desplegable (Accordion) */
.product-compact-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

.product-compact-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
  transform: translateY(-1px);
}

.product-compact-card.expanded {
  border-color: #93c5fd;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.1);
  background: #ffffff;
}

/* Fila Principal / Visible */
.product-card-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.95rem;
  gap: 12px;
}

.product-card-info {
  flex: 1;
  min-width: 0;
}

.product-card-meta-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  flex-wrap: wrap;
}

.product-barcode-chip {
  font-family: 'Share Tech Mono', monospace, sans-serif;
  font-size: 0.76rem;
  background: #f8fafc;
  color: #475569;
  padding: 0.12rem 0.45rem;
  border-radius: 5px;
  border: 1px solid #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.product-barcode-chip i {
  color: #64748b;
  font-size: 0.75rem;
}

.badge-category {
  font-size: 0.72rem !important;
  padding: 0.12rem 0.5rem !important;
  background: #fdf4ff !important;
  color: #9333ea !important;
  border: 1px solid #f0abfc !important;
  font-weight: 700 !important;
}

.badge-packaging-chip {
  font-size: 0.72rem !important;
  padding: 0.12rem 0.5rem !important;
  background: #f0fdf4 !important;
  color: #15803d !important;
  border: 1px solid #bbf7d0 !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}

.badge-packaging-chip i {
  color: #16a34a;
}

.product-card-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.3;
}

/* Columna de acciones rápidas (A la vista) */
.product-card-quick-col {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.product-stock-pill {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.product-stock-pill i {
  color: #10b981;
}

.btn-quick-stock {
  padding: 0.42rem 0.75rem !important;
  font-size: 0.8rem !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.22) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  cursor: pointer;
}

.product-chevron-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.85rem;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s ease;
}

.product-chevron-btn i {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-compact-card.expanded .product-chevron-btn i {
  transform: rotate(180deg);
  color: var(--primary);
}

/* Panel Desplegable (Detalles al hacer tap) */
.product-card-dropdown {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  background: #f8fafc;
  border-top: 1px dashed #e2e8f0;
}

.product-compact-card.expanded .product-card-dropdown {
  max-height: 350px;
  opacity: 1;
}

.product-dropdown-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  padding: 0.85rem 1rem;
}

.product-detail-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.product-detail-item .detail-label {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.product-detail-item .detail-label i {
  color: var(--primary);
  font-size: 0.75rem;
}

.product-detail-item .detail-value {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
}

.product-detail-item .highlight-price {
  color: #2563eb;
}

.product-detail-item .highlight-margin {
  color: #059669;
}

.product-detail-item .highlight-margin small {
  font-size: 0.72rem;
  color: #059669;
  font-weight: 600;
}

.product-dropdown-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem 0.75rem;
  border-top: 1px solid #f1f5f9;
  gap: 8px;
  flex-wrap: wrap;
}

.dropdown-hint {
  font-size: 0.72rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-stock-detail-action {
  padding: 0.38rem 0.8rem;
  font-size: 0.78rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

@media (max-width: 480px) {
  .product-card-main {
    padding: 0.65rem 0.75rem;
    gap: 8px;
  }
  .product-card-quick-col {
    gap: 6px;
  }
  .product-stock-pill {
    padding: 0.28rem 0.5rem;
    font-size: 0.75rem;
  }
  .btn-quick-stock {
    padding: 0.35rem 0.55rem !important;
    font-size: 0.74rem !important;
  }
  .product-dropdown-grid {
    padding: 0.7rem 0.75rem;
    gap: 0.5rem;
  }
}

/* ==========================================================
   MÓDULO CATEGORÍAS Y EMPAQUES: VISTA DUAL (TABLA / TARJETAS)
   ========================================================== */

#categories-table-wrapper, #packaging-table-wrapper {
  display: block;
}

#categories-cards-container, #packaging-cards-container {
  display: none;
}

@media (max-width: 768px) {
  #categories-table-wrapper, #packaging-table-wrapper {
    display: none !important;
  }
  #categories-cards-container, #packaging-cards-container {
    display: grid !important;
  }
}

/* Modos forzados de visualización para Categorías */
#categories-view-wrapper.view-mode-cards #categories-table-wrapper {
  display: none !important;
}
#categories-view-wrapper.view-mode-cards #categories-cards-container {
  display: grid !important;
}
#categories-view-wrapper.view-mode-table #categories-table-wrapper {
  display: block !important;
}
#categories-view-wrapper.view-mode-table #categories-cards-container {
  display: none !important;
}

/* Modos forzados de visualización para Empaques */
#packaging-view-wrapper.view-mode-cards #packaging-table-wrapper {
  display: none !important;
}
#packaging-view-wrapper.view-mode-cards #packaging-cards-container {
  display: grid !important;
}
#packaging-view-wrapper.view-mode-table #packaging-table-wrapper {
  display: block !important;
}
#packaging-view-wrapper.view-mode-table #packaging-cards-container {
  display: none !important;
}

/* Grid de tarjetas de categorías y empaques */
.category-cards-container {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.95rem;
  margin-bottom: 1rem;
}

.category-item-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.category-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
}

.category-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid #f1f5f9;
  gap: 8px;
}

.category-card-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.category-color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.category-card-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-product-count {
  background: #eff6ff !important;
  color: #2563eb !important;
  border: 1px solid #bfdbfe !important;
  font-size: 0.74rem !important;
  font-weight: 700 !important;
  padding: 0.15rem 0.5rem !important;
  white-space: nowrap;
}

.category-card-body {
  padding: 0.85rem 1rem;
  flex: 1;
}

.category-card-desc {
  font-size: 0.83rem;
  color: #64748b;
  line-height: 1.4;
  margin: 0;
}

.category-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem 0.85rem;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
  gap: 8px;
}

.category-card-edit-btn {
  flex: 1;
  padding: 0.42rem 0.8rem !important;
  font-size: 0.82rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  border-radius: 8px !important;
}

@media (max-width: 480px) {
  .category-cards-container {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }
}

/* ==========================================================
   MÓDULO USUARIOS: VISTA DUAL (TABLA / TARJETAS RESPONSIVAS)
   ========================================================== */

#users-table-wrapper {
  display: block;
}

#users-cards-container {
  display: none;
}

@media (max-width: 768px) {
  #users-table-wrapper {
    display: none !important;
  }
  #users-cards-container {
    display: grid !important;
  }
}

/* Modos forzados de visualización para Usuarios */
#users-view-wrapper.view-mode-cards #users-table-wrapper {
  display: none !important;
}
#users-view-wrapper.view-mode-cards #users-cards-container {
  display: grid !important;
}
#users-view-wrapper.view-mode-table #users-table-wrapper {
  display: block !important;
}
#users-view-wrapper.view-mode-table #users-cards-container {
  display: none !important;
}

/* Grid de tarjetas de usuarios */
.user-cards-container {
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.user-item-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.user-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
}

.user-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 1rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  gap: 10px;
}

.user-card-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.user-card-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid #dbeafe;
}

.user-card-avatar.avatar-admin {
  background: #fdf2f8;
  color: #db2777;
  border-color: #fbcfe8;
}

.user-card-avatar.avatar-operario {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}

.user-card-titles {
  min-width: 0;
  flex: 1;
}

.user-card-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-username {
  font-size: 0.76rem;
  font-family: 'Share Tech Mono', monospace, sans-serif;
  color: #64748b;
  display: block;
  margin-top: 1px;
}

.user-card-body {
  padding: 0.85rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-role-admin {
  background: #fdf2f8 !important;
  color: #be185d !important;
  border: 1px solid #fbcfe8 !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  padding: 0.18rem 0.55rem !important;
  border-radius: 6px !important;
}

.badge-role-operario {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border: 1px solid #bfdbfe !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  padding: 0.18rem 0.55rem !important;
  border-radius: 6px !important;
}

.badge-role-default {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  padding: 0.18rem 0.55rem !important;
  border-radius: 6px !important;
}

.user-contact-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.user-contact-item {
  font-size: 0.82rem;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: break-all;
}

.user-contact-item i {
  color: #94a3b8;
  font-size: 0.8rem;
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}

.user-contact-item a {
  color: #2563eb;
  text-decoration: none;
}

.user-contact-item a:hover {
  text-decoration: underline;
}

.user-last-access {
  font-size: 0.75rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  padding-top: 6px;
  border-top: 1px dashed #f1f5f9;
}

.user-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem 0.85rem;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
  gap: 8px;
}

.user-card-edit-btn {
  flex: 1;
  padding: 0.42rem 0.8rem !important;
  font-size: 0.82rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  border-radius: 8px !important;
}

.btn-status-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
}

@media (max-width: 480px) {
  .user-cards-container {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }
}

/* ==========================================================
   MÓDULO RUTAS DE REPOSICIÓN: VISTA DUAL (TABLA / TARJETAS RESPONSIVAS)
   ========================================================== */

#routes-table-wrapper {
  display: block;
}

#routes-cards-container {
  display: none;
}

@media (max-width: 768px) {
  #routes-table-wrapper {
    display: none !important;
  }
  #routes-cards-container {
    display: grid !important;
  }
}

/* Modos forzados de visualización para Rutas */
#routes-view-wrapper.view-mode-cards #routes-table-wrapper {
  display: none !important;
}
#routes-view-wrapper.view-mode-cards #routes-cards-container {
  display: grid !important;
}
#routes-view-wrapper.view-mode-table #routes-table-wrapper {
  display: block !important;
}
#routes-view-wrapper.view-mode-table #routes-cards-container {
  display: none !important;
}

/* Grid de tarjetas de rutas */
.routes-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Tarjeta individual de Ruta */
.route-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.route-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
}

.route-card.is-en-ruta {
  border-left: 4px solid #10b981;
}

.route-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem 0.65rem;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  gap: 8px;
  flex-wrap: wrap;
}

.route-card-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.route-code-badge {
  font-family: 'Share Tech Mono', monospace, sans-serif;
  font-weight: 800;
  font-size: 0.88rem;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
}

.route-date-chip {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.route-card-body {
  padding: 0.95rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.route-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.3;
}

.route-card-desc {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.route-card-operator-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

.route-operator-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 800;
  flex-shrink: 0;
}

.route-operator-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.route-operator-info .op-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.route-operator-info .op-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-operator-info .op-user {
  font-size: 0.72rem;
  color: #64748b;
}

.route-card-progress-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.route-card-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
}

.route-card-progress-bar {
  width: 100%;
  height: 7px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.route-card-progress-fill {
  height: 100%;
  background: #2563eb;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.route-card-progress-sub {
  display: flex;
  gap: 8px;
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
  flex-wrap: wrap;
  justify-content: space-between;
}

.route-units-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.route-unit-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.4rem 0.45rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.route-unit-box .lbl {
  font-size: 0.66rem;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
}

.route-unit-box .val {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
}

.route-unit-box.highlight-green {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.route-unit-box.highlight-green .lbl {
  color: #15803d;
}
.route-unit-box.highlight-green .val {
  color: #059669;
}

.route-unit-box.highlight-amber {
  background: #fffbeb;
  border-color: #fde68a;
}
.route-unit-box.highlight-amber .lbl {
  color: #b45309;
}
.route-unit-box.highlight-amber .val {
  color: #d97706;
}

.route-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem 0.85rem;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
  gap: 8px;
  flex-wrap: wrap;
}

.route-btn-audit {
  padding: 0.42rem 0.85rem !important;
  font-size: 0.82rem !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  border-radius: 8px !important;
}

@media (max-width: 480px) {
  .routes-cards-container {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }
}

/* Tarjetas para paradas de operario en ruta activa (móvil) */
.operario-stops-cards-container {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
}

@media (max-width: 768px) {
  .operario-stops-table-wrapper {
    display: none !important;
  }
  .operario-stops-cards-container {
    display: flex !important;
  }
}

.operario-stop-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.operario-stop-card.is-visited {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.operario-stop-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.operario-stop-num {
  font-weight: 800;
  color: #2563eb;
  font-size: 0.82rem;
  background: #eff6ff;
  border-radius: 4px;
  padding: 2px 6px;
}

.operario-stop-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.operario-stop-location {
  font-size: 0.78rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 4px;
}

.operario-stop-stock {
  font-size: 0.8rem;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.operario-stop-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px dashed #e2e8f0;
}

/* ==========================================================
   MÓDULO TELEMETRÍA Y VISITAS: VISTA DUAL (TABLA / TARJETAS RESPONSIVAS)
   ========================================================== */

#visits-table-wrapper {
  display: block;
}

#visits-cards-container {
  display: none;
}

@media (max-width: 768px) {
  #visits-table-wrapper {
    display: none !important;
  }
  #visits-cards-container {
    display: grid !important;
  }
}

/* Modos forzados de visualización para Visitas */
#visits-view-wrapper.view-mode-cards #visits-table-wrapper {
  display: none !important;
}
#visits-view-wrapper.view-mode-cards #visits-cards-container {
  display: grid !important;
}
#visits-view-wrapper.view-mode-table #visits-table-wrapper {
  display: block !important;
}
#visits-view-wrapper.view-mode-table #visits-cards-container {
  display: none !important;
}

/* Grid de tarjetas de visitas */
.visits-cards-container {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

/* 1. Tarjeta de Visita Realizada */
.visit-item-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.visit-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
}

.visit-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid #f1f5f9;
  gap: 8px;
}

.visit-card-id-badge {
  font-size: 0.95rem;
  font-weight: 800;
  color: #2563eb;
  letter-spacing: -0.01em;
}

.visit-card-body {
  padding: 0.85rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.visit-card-machine-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.visit-card-machine-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.3;
}

.visit-card-machine-loc {
  font-size: 0.78rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 4px;
}

.visit-card-operator-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #f1f5f9;
}

.visit-operator-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #059669;
  color: white;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}

.visit-operator-info {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  line-height: 1.25;
}

.visit-operator-info strong {
  color: #0f172a;
}

.visit-operator-info small {
  color: #94a3b8;
  display: block;
}

.visit-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.visit-metric-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.visit-metric-box .metric-lbl {
  font-size: 0.7rem;
  color: #64748b;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.visit-metric-box .metric-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.visit-metric-box .metric-sub {
  font-size: 0.72rem;
  color: #64748b;
}

.visit-card-footer {
  padding: 0.65rem 1rem 0.85rem;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
}

.visit-card-audit-btn {
  width: 100%;
  padding: 0.48rem 1rem !important;
  font-size: 0.85rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  border-radius: 8px !important;
}

/* 2. Tarjeta de Parada Pendiente */
.pending-stop-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.pending-stop-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.pending-stop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid #f1f5f9;
  gap: 8px;
}

.pending-stop-order {
  font-size: 0.85rem;
  font-weight: 800;
  color: #475569;
  background: #f1f5f9;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
}

.pending-stop-body {
  padding: 0.85rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pending-stop-route-info {
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: #1e40af;
}

.pending-stop-stock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.pending-stop-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem 0.85rem;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
  gap: 6px;
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .visits-cards-container {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }
}

/* ==========================================================
   MODAL AUDITORÍA: CONCILIACIÓN DE RESORTES (TABLA / CARDS)
   ========================================================== */
#audit-slots-table-wrapper {
  display: block;
}

#audit-slots-cards-container {
  display: none;
}

@media (max-width: 768px) {
  #audit-slots-table-wrapper {
    display: none !important;
  }
  #audit-slots-cards-container {
    display: flex !important;
  }
}

/* Modos forzados de visualización para slots auditados */
#audit-slots-view-wrapper.view-mode-cards #audit-slots-table-wrapper {
  display: none !important;
}
#audit-slots-view-wrapper.view-mode-cards #audit-slots-cards-container {
  display: flex !important;
}
#audit-slots-view-wrapper.view-mode-table #audit-slots-table-wrapper {
  display: block !important;
}
#audit-slots-view-wrapper.view-mode-table #audit-slots-cards-container {
  display: none !important;
}

.audit-slots-cards-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: none;
  overflow-y: visible;
  padding-right: 2px;
}

.audit-slot-item-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.audit-slot-item-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.07);
}

.audit-slot-item-card.expanded {
  border-color: #93c5fd;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.1);
}

/* Header de la tarjeta */
.audit-slot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.9rem;
  background: #f8fafc;
  border-bottom: 1px solid #f1f5f9;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.audit-slot-badge {
  background: #2563eb;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  letter-spacing: 0.03em;
  display: inline-block;
  flex-shrink: 0;
}

.audit-slot-prod-name {
  font-size: 0.9rem;
  color: #0f172a;
  display: block;
  line-height: 1.25;
}

.btn-audit-slot-toggle {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #2563eb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-audit-slot-toggle:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.audit-slot-item-card.expanded .btn-audit-slot-toggle {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

/* Control dinámico de texto según estado abierto/cerrado */
.audit-slot-item-card .btn-text-opened,
.audit-slot-item-card .toggle-text-opened {
  display: none !important;
}
.audit-slot-item-card .btn-text-closed,
.audit-slot-item-card .toggle-text-closed {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
}

.audit-slot-item-card.expanded .btn-text-closed,
.audit-slot-item-card.expanded .toggle-text-closed {
  display: none !important;
}
.audit-slot-item-card.expanded .btn-text-opened,
.audit-slot-item-card.expanded .toggle-text-opened {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
}

/* Vista resumen compacta (como estaba antes) */
.audit-slot-card-body {
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audit-slot-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.audit-slot-metric-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.4rem 0.45rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.audit-slot-metric-item .lbl {
  font-size: 0.67rem;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
}

.audit-slot-metric-item .val {
  font-size: 0.86rem;
  font-weight: 700;
  color: #0f172a;
}

.audit-slot-metric-item.highlight-amber {
  background: #fffbeb;
  border-color: #fde68a;
}
.audit-slot-metric-item.highlight-amber .lbl {
  color: #b45309;
}
.audit-slot-metric-item.highlight-amber .val {
  color: #d97706;
}

.audit-slot-metric-item.highlight-blue {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.audit-slot-metric-item.highlight-blue .lbl {
  color: #1d4ed8;
}
.audit-slot-metric-item.highlight-blue .val {
  color: #2563eb;
}

.audit-slot-metric-item.highlight-green {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.audit-slot-metric-item.highlight-green .lbl {
  color: #15803d;
}
.audit-slot-metric-item.highlight-green .val {
  color: #059669;
}

/* Botón interactivo claro para desplegar/contraer */
.audit-slot-action-btn {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: #1d4ed8;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.audit-slot-action-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.audit-slot-item-card.expanded .audit-slot-action-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

/* Panel Desplegable (Detalle completo al hacer click/tap) */
.audit-slot-card-dropdown {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease;
  background: #f8fafc;
  border-top: 1px dashed #cbd5e1;
}

.audit-slot-item-card.expanded .audit-slot-card-dropdown {
  max-height: 2500px;
  opacity: 1;
}

.audit-dropdown-content {
  padding: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.audit-dropdown-header {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}

.audit-dropdown-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.audit-detail-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  word-break: break-word;
}

.audit-detail-item .detail-label {
  font-size: 0.68rem;
  color: #64748b;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.audit-detail-item .detail-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
}

.audit-dropdown-financial-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  margin-top: 2px;
  gap: 8px;
  flex-wrap: wrap;
}

.audit-dropdown-fin-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.audit-dropdown-fin-col .fin-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 4px;
}

.audit-dropdown-fin-col .fin-val {
  font-size: 0.98rem;
  font-weight: 800;
  color: #0f172a;
}

.audit-dropdown-fin-col .fin-hint {
  font-size: 0.74rem;
  color: #64748b;
  font-weight: 500;
}

.audit-dropdown-fin-divider {
  width: 1px;
  height: 32px;
  background: #e2e8f0;
}

.audit-dropdown-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 4px;
}

.btn-audit-dropdown-close {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.45rem 1.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-audit-dropdown-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

@media (max-width: 480px) {
  .audit-slot-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .audit-dropdown-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* ==========================================================
   MODAL AUDITORÍA DE RUTA: VISTA DUAL (TABLA / TARJETAS RESPONSIVAS)
   ========================================================== */
#route-audit-paradas-table-wrapper,
#route-audit-picking-table-wrapper {
  display: block;
}

#route-audit-paradas-cards-container,
#route-audit-picking-cards-container {
  display: none;
}

@media (max-width: 768px) {
  #route-audit-paradas-table-wrapper,
  #route-audit-picking-table-wrapper {
    display: none !important;
  }
  #route-audit-paradas-cards-container,
  #route-audit-picking-cards-container {
    display: flex !important;
  }
}

/* Modos forzados de visualización para Auditoría de Ruta */
#route-audit-paradas-view-wrapper.view-mode-cards #route-audit-paradas-table-wrapper,
#route-audit-picking-view-wrapper.view-mode-cards #route-audit-picking-table-wrapper {
  display: none !important;
}
#route-audit-paradas-view-wrapper.view-mode-cards #route-audit-paradas-cards-container,
#route-audit-picking-view-wrapper.view-mode-cards #route-audit-picking-cards-container {
  display: flex !important;
}

#route-audit-paradas-view-wrapper.view-mode-table #route-audit-paradas-table-wrapper,
#route-audit-picking-view-wrapper.view-mode-table #route-audit-picking-table-wrapper {
  display: block !important;
}
#route-audit-paradas-view-wrapper.view-mode-table #route-audit-paradas-cards-container,
#route-audit-picking-view-wrapper.view-mode-table #route-audit-picking-cards-container {
  display: none !important;
}

.route-audit-cards-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Tarjeta de Parada en Auditoría de Ruta */
.route-audit-stop-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #94a3b8;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.route-audit-stop-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

.route-audit-stop-card.status-visited {
  border-left-color: #10b981;
}
.route-audit-stop-card.status-omitted {
  border-left-color: #ef4444;
}
.route-audit-stop-card.status-process {
  border-left-color: #3b82f6;
}
.route-audit-stop-card.status-pending {
  border-left-color: #f59e0b;
}

.route-audit-stop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.route-audit-stop-order {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.route-audit-stop-loc {
  font-size: 0.8rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.35;
}

.route-audit-stop-body {
  margin-top: 2px;
}

/* Tarjeta de Producto en Auditoría de Ruta (Picking) */
.route-audit-product-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.route-audit-product-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

.route-audit-product-card.has-merma {
  border-left: 4px solid #ef4444;
}

.route-audit-prod-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.route-audit-prod-name {
  font-size: 0.95rem;
  color: #0f172a;
  font-weight: 700;
  display: block;
}

.route-audit-prod-metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

@media (max-width: 540px) {
  .route-audit-prod-metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.route-audit-metric-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.4rem 0.45rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.route-audit-metric-box .lbl {
  font-size: 0.66rem;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
}

.route-audit-metric-box .val {
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
}

.route-audit-metric-box.highlight-blue {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.route-audit-metric-box.highlight-blue .lbl {
  color: #1d4ed8;
}
.route-audit-metric-box.highlight-blue .val {
  color: #2563eb;
}

.route-audit-metric-box.highlight-green {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.route-audit-metric-box.highlight-green .lbl {
  color: #15803d;
}
.route-audit-metric-box.highlight-green .val {
  color: #059669;
}

.route-audit-metric-box.highlight-red {
  background: #fef2f2;
  border-color: #fecaca;
}
.route-audit-metric-box.highlight-red .lbl {
  color: #b91c1c;
}
.route-audit-metric-box.highlight-red .val {
  color: #dc2626;
}

.route-audit-prod-obs {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  font-size: 0.78rem;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================
   SUBVISTA DE MÁQUINA (GEMELO DIGITAL) - RESPONSIVE & TARJETAS
   ========================================================== */
.twin-mobile-view-tabs {
  display: none;
}

@media (max-width: 768px) {
  .twin-mobile-view-tabs {
    display: flex !important;
    gap: 8px;
    margin-bottom: 1rem;
    background: #e2e8f0;
    padding: 4px;
    border-radius: 10px;
  }
  .btn-twin-mobile-tab {
    flex: 1;
    padding: 0.65rem 0.85rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
  }
  .btn-twin-mobile-tab.active {
    background: #ffffff;
    color: #2563eb;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  }

  /* Alternar visibilidad de Gabinete Físico vs Datos en Pantallas Móviles */
  .twin-container-grid.mobile-show-info .vending-canvas {
    display: none !important;
  }
  .twin-container-grid.mobile-show-info .twin-panel-card {
    display: block !important;
  }
  .twin-container-grid.mobile-show-canvas .vending-canvas {
    display: flex !important;
  }
  .twin-container-grid.mobile-show-canvas .twin-panel-card {
    display: none !important;
  }

  .twin-subview-header {
    padding: 0.85rem 1rem !important;
    gap: 0.75rem !important;
  }
  .twin-header-info {
    gap: 0.6rem !important;
    width: 100% !important;
  }
  .twin-header-info h3 {
    font-size: 1.05rem !important;
  }
  .twin-tabs-nav {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    padding-bottom: 4px !important;
  }
  .twin-tab-btn {
    white-space: nowrap !important;
    font-size: 0.82rem !important;
    padding: 0.5rem 0.85rem !important;
  }
}

/* Gabinete físico adaptable a cualquier tamaño de pantalla móvil */
@media (max-width: 500px) {
  .vending-canvas {
    padding: 0.75rem 0.4rem !important;
    border-radius: 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .vending-machine {
    width: 100% !important;
    min-width: unset !important;
    max-width: 100% !important;
    min-height: 520px !important;
    border-width: 2.5px !important;
  }
  .vm-mid-section {
    grid-template-columns: 1fr 100px !important;
    padding: 6px !important;
    gap: 6px !important;
  }
  .brand-label {
    font-size: 0.82rem !important;
    letter-spacing: 1px !important;
  }
  .shelf-tier {
    min-height: 60px !important;
    padding: 4px 2px 2px !important;
  }
  .tier-code {
    font-size: 0.6rem !important;
  }
  .item-wrapper {
    margin: 0 1px !important;
  }
  .vm-keypad .v-btn span {
    font-size: 0.65rem !important;
  }
  .vm-screen-bezel {
    padding: 4px !important;
  }
}

/* Dual View para Resortes / Slots en la Máquina */
#twin-slots-table-wrapper {
  display: block;
}
#twin-slots-cards-container {
  display: none;
}

@media (max-width: 768px) {
  #twin-slots-table-wrapper {
    display: none !important;
  }
  #twin-slots-cards-container {
    display: grid !important;
  }
}

#twin-slots-view-wrapper.view-mode-cards #twin-slots-table-wrapper {
  display: none !important;
}
#twin-slots-view-wrapper.view-mode-cards #twin-slots-cards-container {
  display: grid !important;
}
#twin-slots-view-wrapper.view-mode-table #twin-slots-table-wrapper {
  display: block !important;
}
#twin-slots-view-wrapper.view-mode-table #twin-slots-cards-container {
  display: none !important;
}

.twin-slots-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.85rem;
  padding: 2px;
}

@media (max-width: 480px) {
  .twin-slots-cards-container {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.6rem !important;
  }
}

/* Tarjeta individual de Resorte / Slot */
.twin-slot-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.twin-slot-card:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

.twin-slot-card.status-ok {
  border-top: 3.5px solid #10b981;
}
.twin-slot-card.status-low {
  border-top: 3.5px solid #f59e0b;
}
.twin-slot-card.status-out {
  border-top: 3.5px solid #ef4444;
  background: #fef2f2;
}
.twin-slot-card.status-empty {
  border-top: 3.5px dashed #94a3b8;
  background: #f8fafc;
}

.twin-slot-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.twin-slot-badge {
  font-family: 'Share Tech Mono', monospace, sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
}

.twin-slot-card-prod {
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.2em;
}

.twin-slot-card-price {
  font-size: 0.85rem;
  font-weight: 800;
  color: #059669;
}

.twin-slot-card-progress {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 2px;
}

.twin-slot-card-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.twin-slot-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: #64748b;
  font-weight: 600;
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid #f1f5f9;
}

.btn-twin-slot-assign {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-twin-slot-assign:hover {
  background: #2563eb;
  color: #ffffff;
}

/* Tarjetas responsivas para visitas de la máquina */
.twin-visit-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.twin-incident-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #f59e0b;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

#twin-visits-table-wrapper,
#twin-incidents-table-wrapper {
  display: block;
}
#twin-visits-cards-wrapper,
#twin-incidents-cards-wrapper {
  display: none;
}

@media (max-width: 768px) {
  #twin-visits-table-wrapper,
  #twin-incidents-table-wrapper {
    display: none !important;
  }
  #twin-visits-cards-wrapper,
  #twin-incidents-cards-wrapper {
    display: block !important;
  }
}

/* ==========================================================
   MODAL VISITA OPERATIVA: VISTA DUAL (TABLA EN PC / CARDS EN MÓVIL)
   ========================================================== */
.wiz-step-cards-container {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-top: 4px;
}

@media (max-width: 480px) {
  .wiz-step-cards-container {
    grid-template-columns: 1fr !important;
    gap: 0.65rem !important;
  }
}

/* En pantallas móviles (<= 768px), por defecto mostrar tarjetas y ocultar tabla horizontal */
@media (max-width: 768px) {
  .wiz-step-view-wrapper:not(.view-mode-table) .table-responsive {
    display: none !important;
  }
  .wiz-step-view-wrapper:not(.view-mode-table) .wiz-step-cards-container {
    display: grid !important;
  }
}

/* Clases explícitas según toggle de usuario */
.wiz-step-view-wrapper.view-mode-cards .table-responsive {
  display: none !important;
}
.wiz-step-view-wrapper.view-mode-cards .wiz-step-cards-container {
  display: grid !important;
}

.wiz-step-view-wrapper.view-mode-table .table-responsive {
  display: block !important;
}
.wiz-step-view-wrapper.view-mode-table .wiz-step-cards-container {
  display: none !important;
}

/* Tarjeta individual de resorte en el wizard */
.wiz-slot-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.wiz-slot-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.wiz-slot-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.wiz-slot-card-pill {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 38px;
  padding: 0 8px;
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: 8px;
  color: #1d4ed8;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.wiz-slot-card-prod-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
}

.wiz-slot-card-prod-meta {
  font-size: 0.76rem;
  color: #64748b;
  margin-top: 2px;
}

.wiz-slot-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  text-align: center;
  align-items: center;
}

.wiz-slot-stat-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wiz-slot-stat-lbl {
  font-size: 0.68rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
}

.wiz-slot-stat-val {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
  margin-top: 1px;
}

.wiz-slot-card-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  gap: 8px;
}

.wiz-slot-card-action.action-blue {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.wiz-slot-action-label {
  display: flex;
  flex-direction: column;
}

.wiz-slot-action-label strong {
  font-size: 0.82rem;
  color: #166534;
}

.wiz-slot-card-action.action-blue .wiz-slot-action-label strong {
  color: #1e40af;
}

.wiz-slot-action-label small {
  font-size: 0.72rem;
  color: #64748b;
}

.btn-quick-fill-slot {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0.28rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.btn-quick-fill-slot:hover {
  background: #1d4ed8;
}





/* ==========================================================
   DIÁLOGO GRANDE DE MÁQUINA (Ver Máquina)
   Se abre sobre la lista de máquinas; al cerrarlo la lista sigue intacta.
   z-index por debajo de .modal-overlay (1000) para que los modales
   de edición, QR, resortes, etc. se abran encima del diálogo.
   ========================================================== */
body.twin-dialog-open {
  overflow: hidden;
}

.twin-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 950;
  /* Sin backdrop-filter: el blur a pantalla completa vuelve pesado el scroll */
  background: rgba(15, 23, 42, 0.72);
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.twin-dialog {
  position: relative;
  width: min(1600px, 100%);
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  /* Capa propia de composición: el scroll se desplaza en GPU sin repintar todo */
  transform: translateZ(0);
  contain: layout paint;
  background: var(--app-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0 1.4rem 1.4rem;
  animation: twinDialogIn 0.18s ease-out;
}

@keyframes twinDialogIn {
  from { opacity: 0; transform: translate3d(0, 12px, 0); }
  to   { opacity: 1; transform: translateZ(0); }
}

/* Mientras se hace scroll, desactivar hovers (drop-shadow/escala) que fuerzan repintados */
.twin-dialog.is-scrolling * {
  pointer-events: none !important;
}

/* Cabecera fija dentro del diálogo para tener siempre a mano cerrar/acciones */
.twin-dialog .twin-subview-header {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 -1.4rem 1.2rem;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.twin-dialog-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 1.15rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.twin-dialog-close:hover {
  background: #fee2e2;
  color: var(--danger);
  border-color: #fecaca;
}

@media (max-width: 768px) {
  .twin-dialog-overlay {
    padding: 0;
  }

  .twin-dialog {
    border-radius: 0;
    padding: 0 0.75rem 1rem;
  }

  .twin-dialog .twin-subview-header {
    margin: 0 -0.75rem 0.9rem;
    border-radius: 0;
  }

  /* El botón cerrar queda arriba a la derecha aunque las acciones se envuelvan */
  .twin-dialog-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
  }

  .twin-dialog .twin-header-info {
    padding-right: 44px;
  }
}

/* Al imprimir la ficha QR desde el diálogo, quitar el posicionamiento/recorte del diálogo */
@media print {
  body.twin-dialog-open {
    overflow: visible;
  }
  .twin-dialog-overlay,
  .twin-dialog {
    position: static !important;
    overflow: visible !important;
    height: auto !important;
    background: none !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    animation: none !important;
  }
}

/* ==========================================================
   TELEMETRÍA ESTIMADA (SIN DEX) — PESTAÑAS ESTILO CUSTOS
   ========================================================== */
.kpi-red { background: #fee2e2; color: #dc2626; }
.neg { color: #dc2626 !important; }
.pos { color: #d97706 !important; }
.warn { color: #d97706; }
.muted { color: #94a3b8; }

.est-tag {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 4px;
  background: #ede9fe;
  color: #6d28d9;
  vertical-align: middle;
}

.twin-tab-count {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}
.twin-tab-count.is-danger { background: #dc2626; color: #fff; }
.twin-tab-count.is-warn { background: #f59e0b; color: #fff; }

/* Tarjetas resumen del planograma */
.twin-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.sum-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.sum-card small { color: #64748b; font-size: 0.74rem; line-height: 1.35; }
.sum-card > strong { font-size: 0.92rem; color: #0f172a; overflow-wrap: anywhere; }
.sum-card-accent { border-color: #c7d2fe; background: linear-gradient(180deg, #eef2ff, #fff); }
.sum-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
}
.sum-label i { color: var(--primary); margin-right: 3px; }
.sum-card .sum-big { font-size: 1.45rem; font-weight: 800; color: #0f172a; line-height: 1.15; }
.sum-big em { font-style: normal; font-size: 0.95rem; color: #94a3b8; font-weight: 600; }
.sum-bar { height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.sum-bar > div { height: 100%; border-radius: 3px; }
.lvl-critica { color: #dc2626 !important; }
.lvl-alta { color: #ea580c !important; }
.lvl-media { color: #d97706 !important; }
.lvl-info { color: #2563eb !important; }
.lvl-ok { color: #059669 !important; }

/* Resumen económico */
.twin-economy-bar {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  padding: 0.7rem 0.9rem;
  margin-bottom: 1rem;
}
.eco-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.55rem;
}
.eco-title i { color: var(--primary); }
.eco-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem 1rem;
}
.eco-items > div { display: flex; flex-direction: column; gap: 2px; }
.eco-items span { font-size: 0.72rem; color: #64748b; }
.eco-items strong { font-size: 0.98rem; color: #0f172a; }
.eco-items .eco-total strong { color: var(--primary); font-size: 1.08rem; }

.conf-chip {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  cursor: help;
}
.conf-none { background: #f1f5f9; color: #64748b; }
.conf-low { background: #fef3c7; color: #b45309; }
.conf-mid { background: #dbeafe; color: #1d4ed8; }
.conf-high { background: #dcfce7; color: #15803d; }

/* Tabla de resortes con barra de stock y marcador de mínimo */
.stock-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.stock-track { position: relative; width: 70px; height: 7px; background: #e5e7eb; border-radius: 4px; }
.stock-fill { height: 100%; border-radius: 4px; }
.stock-min { position: absolute; top: -3px; width: 2px; height: 13px; background: #475569; border-radius: 1px; }
#twin-slots-tbody tr.slot-row-out td { background: #fef2f2; }
#twin-slots-tbody tr.slot-row-empty td { background: #f8fafc; color: #94a3b8; }

/* Pestaña Ventas */
.twin-sales-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.7rem 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.twin-sales-range, .twin-sales-presets { display: flex; align-items: flex-end; gap: 0.5rem; flex-wrap: wrap; }
.twin-sales-range label { display: flex; flex-direction: column; gap: 3px; font-size: 0.72rem; font-weight: 700; color: #64748b; }
.twin-sales-range .form-input { width: auto; padding: 0.4rem 0.6rem; font-size: 0.85rem; }
.twin-sales-range .btn-primary, .twin-sales-presets .btn-secondary { width: auto; padding: 0.45rem 0.85rem; font-size: 0.82rem; }

.sales-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem;
  margin-bottom: 1rem;
}
.sales-kpi {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sales-kpi span { font-size: 0.72rem; color: #64748b; font-weight: 600; }
.sales-kpi strong { font-size: 1.25rem; color: #0f172a; font-weight: 800; }
.sales-kpi small { font-size: 0.72rem; color: #94a3b8; }

.sales-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  min-width: 0;
}
.sales-card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 0.6rem; }
.sales-card-head h5 { margin: 0; font-size: 0.9rem; color: #0f172a; }
.sales-card-head h5 i { color: var(--primary); margin-right: 4px; }
.sales-card-head small { color: #64748b; font-size: 0.72rem; }
.sales-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 1rem; }
.sales-note { margin: 0.5rem 0 0; font-size: 0.74rem; color: #64748b; }

.sales-chart { width: 100%; height: 220px; display: block; }
.sales-chart .bar { fill: #93c5fd; }
.sales-chart .bar-visit { fill: #2563eb; }
.sales-chart rect:hover { fill: #1e40af; }
.sales-chart .grid { stroke: #e2e8f0; stroke-width: 1; }
.sales-chart .axis-x { font-size: 11px; fill: #64748b; text-anchor: middle; }
.sales-chart .axis-y { font-size: 11px; fill: #94a3b8; text-anchor: end; }
.legend-sq { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; }
.legend-sq.bar { background: #93c5fd; }
.legend-sq.bar-visit { background: #2563eb; }

.mini-bar { height: 8px; background: #eff6ff; border-radius: 4px; overflow: hidden; }
.mini-bar > div { height: 100%; background: var(--primary); border-radius: 4px; }
.sales-sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.7rem; }
.sales-source { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 0.8rem 0.9rem 0.8rem 2.6rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; }
.sales-source .src-num { position: absolute; left: 0.75rem; top: 0.8rem; width: 1.35rem; height: 1.35rem; border-radius: 50%; background: var(--primary); color: #fff; font-size: 0.74rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.sales-source .src-label { font-size: 0.76rem; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: 0.02em; }
.sales-source > strong { font-size: 1.55rem; font-weight: 800; color: #0f172a; line-height: 1.15; }
.sales-source > small { font-size: 0.75rem; color: #64748b; }
.src-breakdown { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 0.8rem; color: #334155; }
.src-breakdown li { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed #e2e8f0; padding-bottom: 2px; }
.src-breakdown li i { width: 1rem; }
.src-flag { align-self: flex-start; margin-top: 4px; font-size: 0.74rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.src-flag:empty { display: none; }
.src-flag.ok { background: #ecfdf5; color: #047857; }
.src-flag.warn { background: #fffbeb; color: #b45309; }
.src-flag.bad { background: #fef2f2; color: #b91c1c; }
.sales-verdict { margin-top: 0.8rem; padding: 0.6rem 0.8rem; border-radius: 8px; font-size: 0.84rem; border: 1px solid; }
.sales-verdict p { margin: 0; }
.sales-verdict p + p { margin-top: 4px; }
.sales-verdict.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.sales-verdict.warn { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.table-admin tr.row-diff td { background: #fef2f2; }
.twin-counters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.45rem; }
.twin-counters-grid > div { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 0.4rem 0.55rem; display: flex; flex-direction: column; }
.twin-counters-grid span { font-size: 0.7rem; color: #64748b; font-weight: 600; }
.twin-counters-grid strong { font-size: 0.92rem; color: #0f172a; }
.twin-counters-grid strong.muted { color: #94a3b8; }
.twin-counters-grid small { font-size: 0.66rem; color: #94a3b8; }
#wiz-tubes-summary .neg { color: #dc2626; font-weight: 600; }
#twin-visits-table .pagination-footer { padding-top: 0.7rem; margin-top: 0.6rem; }
.twin-visits-per-page { width: auto; display: inline-block; margin-left: 0.5rem; padding: 0.2rem 0.4rem; font-size: 0.8rem; }
.twin-sales-tubes { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.8rem; padding: 0.55rem 0.7rem; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; }
.twin-sales-tubes > i { color: #d97706; font-size: 1.1rem; }
.twin-sales-tubes strong { display: block; font-size: 0.84rem; color: #0f172a; }
.twin-sales-tubes small { color: #64748b; font-size: 0.74rem; }
.table-compact td, .table-compact th { padding: 0.45rem 0.6rem !important; font-size: 0.82rem; }

.pay-split-bar { height: 14px; background: #10b981; border-radius: 7px; overflow: hidden; }
.pay-split-bar > div { height: 100%; background: #f59e0b; }
.pay-split-legend { display: flex; flex-direction: column; gap: 4px; margin-top: 0.6rem; font-size: 0.84rem; color: #334155; }

.twin-loading { padding: 2rem; text-align: center; color: #64748b; }
.twin-empty-box {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 2rem 1.5rem;
  text-align: center;
  color: #64748b;
  font-size: 0.85rem;
}
.twin-empty-box i { font-size: 2rem; color: var(--primary); margin-bottom: 0.5rem; }
.twin-empty-box h4 { margin: 0 0 0.3rem; color: #0f172a; font-size: 1rem; }
.twin-empty-box p { margin: 0; }
.twin-empty-box.ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.twin-empty-box.ok i { color: #16a34a; }

/* Pestaña Alertas */
.twin-pane-intro { margin-bottom: 0.8rem; }
.twin-pane-intro h4 { margin: 0 0 0.3rem; font-size: 1rem; color: #0f172a; }
.twin-pane-intro p { margin: 0; font-size: 0.82rem; color: #64748b; }
.twin-alert-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 0.8rem; }
.alert-chip {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}
.alert-chip b { margin-left: 3px; }
.alert-chip.active { background: #0f172a; color: #fff; border-color: #0f172a; }
.alert-chip.chip-critica b { color: #dc2626; }
.alert-chip.chip-alta b { color: #ea580c; }
.alert-chip.chip-media b { color: #d97706; }
.alert-chip.chip-info b { color: #2563eb; }
.alert-chip.active b { color: #fff; }

.alert-list { display: flex; flex-direction: column; gap: 0.5rem; }
.alert-row {
  display: grid;
  grid-template-columns: 78px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid #94a3b8;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
}
.alert-row.lvl-critica { border-left-color: #dc2626; color: inherit !important; }
.alert-row.lvl-alta { border-left-color: #ea580c; color: inherit !important; }
.alert-row.lvl-media { border-left-color: #f59e0b; color: inherit !important; }
.alert-row.lvl-info { border-left-color: #3b82f6; color: inherit !important; }
.alert-level {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  text-align: center;
  padding: 3px 6px;
  border-radius: 6px;
  background: #f1f5f9;
}
.lvl-critica .alert-level { background: #fee2e2; color: #b91c1c; }
.lvl-alta .alert-level { background: #ffedd5; color: #c2410c; }
.lvl-media .alert-level { background: #fef3c7; color: #b45309; }
.lvl-info .alert-level { background: #dbeafe; color: #1d4ed8; }
.alert-title { font-weight: 700; font-size: 0.88rem; color: #0f172a; }
.alert-title code { font-size: 0.68rem; color: #64748b; background: #f1f5f9; padding: 1px 5px; border-radius: 4px; margin-left: 4px; }
.alert-detail { font-size: 0.8rem; color: #475569; margin-top: 2px; }
.alert-meta { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.alert-meta small { color: #94a3b8; }

/* Visitas y caja */
.twin-cash-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.twin-cash-summary:empty { display: none; }
.twin-cash-summary > div {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
}
.twin-cash-summary span { font-size: 0.72rem; color: #64748b; }
.twin-cash-summary strong { font-size: 1.05rem; color: #0f172a; }

/* Ficha y QR */
.twin-info-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 1rem; align-items: start; }
.twin-info-sheet { display: flex; flex-direction: column; gap: 0.8rem; min-width: 0; }
.info-block { border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem 0.9rem; background: #fff; }
.info-block h5 { margin: 0 0 0.5rem; font-size: 0.88rem; color: #0f172a; }
.info-block h5 i { color: var(--primary); margin-right: 4px; }
.info-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; border-bottom: 1px solid #f1f5f9; font-size: 0.84rem; }
.info-row:last-child { border-bottom: none; }
.info-row span { color: #64748b; }
.info-row strong { color: #0f172a; text-align: right; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .twin-info-layout { grid-template-columns: 1fr; }
}

/* Lista de máquinas: semáforo y leyenda */
.health-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #cbd5e1; flex-shrink: 0; vertical-align: middle; }
.health-dot.health-ok { background: #10b981; box-shadow: 0 0 0 3px #d1fae5; }
.health-dot.health-warn { background: #f59e0b; box-shadow: 0 0 0 3px #fef3c7; }
.health-dot.health-bad { background: #ef4444; box-shadow: 0 0 0 3px #fee2e2; }
.health-dot.health-off { background: #94a3b8; box-shadow: 0 0 0 3px #f1f5f9; }
.machines-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}
.legend-item.active { border-color: var(--primary); background: #eff6ff; color: var(--primary); }
.legend-note { margin-left: auto; color: #64748b; font-size: 0.74rem; }

@media (max-width: 768px) {
  .alert-row { grid-template-columns: 1fr; gap: 0.4rem; }
  .alert-level { justify-self: start; }
  .alert-meta { justify-content: space-between; }
  .legend-note { margin-left: 0; width: 100%; }
  .twin-sales-toolbar { align-items: stretch; }
  .sum-card .sum-big { font-size: 1.2rem; }
}

@media print {
  .twin-info-sheet { display: none !important; }
  .twin-info-layout { display: block !important; }
}

/* ---------- Ficha de máquina (modal de edición) ---------- */
.em-profile { border: 1px solid var(--border); border-radius: 10px; margin-top: 1rem; background: #f8fafc; }
.em-profile > summary { cursor: pointer; padding: 0.7rem 0.9rem; font-weight: 700; font-size: 0.9rem; color: #0f172a; list-style: none; }
.em-profile > summary::-webkit-details-marker { display: none; }
.em-profile > summary::before { content: '\25B8'; display: inline-block; margin-right: 6px; transition: transform 0.15s; color: #64748b; }
.em-profile[open] > summary::before { transform: rotate(90deg); }
.em-profile > summary small { font-weight: 500; color: #64748b; margin-left: 4px; }
.em-profile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 0.8rem; padding: 0 0.9rem; }
.em-profile-grid .form-group label { font-size: 0.8rem; }
.em-span-2 { grid-column: span 2; }
.em-span-3 { grid-column: 1 / -1; }
.em-profile-note { display: block; padding: 0 0.9rem 0.8rem; color: #64748b; font-size: 0.76rem; line-height: 1.4; }

/* ---------- Gemelo: piezas nuevas ---------- */
.btn-sm-inline { width: auto !important; padding: 0.4rem 0.75rem !important; font-size: 0.8rem !important; display: inline-flex; align-items: center; gap: 5px; }
.stock-minmax small { color: #94a3b8; font-size: 0.74rem; }

.twin-report-toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.twin-subtabs { display: inline-flex; background: #f1f5f9; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.twin-subtab { border: none; background: transparent; padding: 0.45rem 0.8rem; border-radius: 8px; font-size: 0.82rem; font-weight: 700; color: #64748b; cursor: pointer; }
.twin-subtab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }
.twin-report-pane { display: none; }
.twin-report-pane.active { display: block; }
.twin-cash-summary small { font-size: 0.7rem; color: #64748b; }

.twin-alerts-table td { vertical-align: top; }
.twin-alerts-table .alert-level { display: inline-block; }

.pay-split-3 { display: flex; background: #e2e8f0; }
.pay-split-3 > div { height: 100%; }
.pay-split-3 .seg-mon { background: #f59e0b; }
.pay-split-3 .seg-bil { background: #10b981; }
.pay-split-3 .seg-card { background: #2563eb; }

.cash-formula { display: flex; align-items: stretch; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.cf-item { flex: 1 1 120px; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.8rem; display: flex; flex-direction: column; }
.cf-item span { font-size: 0.72rem; color: #64748b; }
.cf-item strong { font-size: 1.05rem; color: #0f172a; }
.cf-item.cf-total { background: #eff6ff; border-color: #bfdbfe; }
.cf-item.cf-diff { background: #ecfdf5; border-color: #a7f3d0; }
.cf-item.cf-diff.neg { background: #fef2f2; border-color: #fecaca; }
.cf-item.cf-diff.neg strong { color: #dc2626; }
.cf-op { align-self: center; font-size: 1.2rem; font-weight: 800; color: #94a3b8; }

.info-sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.8rem; }
.info-map-link { font-size: 0.78rem; font-weight: 600; margin-left: 6px; white-space: nowrap; }

@media (max-width: 768px) {
  .em-profile-grid { grid-template-columns: 1fr; }
  .em-span-2 { grid-column: auto; }
  .cf-op { display: none; }
  .twin-report-toolbar { align-items: stretch; }
}

/* ==========================================================
   DASHBOARDS (general y por máquina)
   ========================================================== */
.dash-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.8rem; padding: 1rem 1.2rem; margin-bottom: 1.2rem; }
.dash-toolbar h3 i { color: var(--primary); }
.dash-range { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dash-range .form-input { width: auto; padding: 0.4rem 0.6rem; font-size: 0.85rem; }
.dash-preset { border: 1px solid var(--border); background: #fff; color: #334155; border-radius: 8px; padding: 0.42rem 0.75rem; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.dash-preset:hover { background: #f1f5f9; }
.dash-preset.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.dash-delta { display: block; font-size: 0.74rem; color: #64748b; margin-top: 2px; }
.dash-delta.up { color: #16a34a; }
.dash-delta.down { color: #dc2626; }
.dash-click { cursor: pointer; }
.dash-click:hover { border-color: var(--primary); }
.dash-row-click { cursor: pointer; }
.dash-row-click:hover td { background: #f8fafc; }
.dash-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.dash-chip { font-size: 0.7rem; background: #fef3c7; color: #92400e; border-radius: 999px; padding: 1px 8px; }
.dash-kpis-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.dash-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.dash-list li { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.85rem; }
.dash-lvl { flex: none; font-size: 0.68rem; font-weight: 700; border-radius: 6px; padding: 2px 7px; margin-top: 2px; background: #e2e8f0; color: #334155; }
.dash-lvl.lvl-critica { background: #fee2e2; color: #b91c1c; }
.dash-lvl.lvl-alta { background: #ffedd5; color: #c2410c; }
.dash-lvl.lvl-media { background: #fef3c7; color: #92400e; }
.v-btn-wide { grid-column: span 2; }

.month-bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; height: 190px; }
.month-bar { display: flex; flex-direction: column; align-items: center; height: 100%; gap: 4px; }
.mb-col { flex: 1; width: 100%; max-width: 46px; background: #eff6ff; border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.mb-col > div { width: 100%; background: var(--primary); border-radius: 6px; min-height: 2px; }
.mb-val { font-size: 0.72rem; color: #334155; font-weight: 700; min-height: 1em; }
.mb-lbl { font-size: 0.72rem; color: #64748b; text-transform: capitalize; }

@media (max-width: 640px) {
  .dash-toolbar { padding: 0.8rem; }
  .dash-range .form-input { flex: 1 1 120px; }
  .month-bars { height: 150px; gap: 4px; }
}

/* Dashboard de máquina: selector de mes */
.dash-section-title { font-size: 0.78rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 0.45rem; }
.dash-section-title i { color: var(--primary); margin-right: 4px; }
.dash-monthbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 0.55rem 0.7rem; margin: 0.4rem 0 0.8rem; }
.dash-month-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dash-month-nav .form-input { width: auto; min-width: 190px; padding: 0.4rem 0.6rem; font-size: 0.88rem; font-weight: 700; }
.dash-month-nav .action-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.month-bar.is-clickable { cursor: pointer; border-radius: 8px; padding: 2px 0; }
.month-bar.is-clickable:hover { background: #f1f5f9; }
.month-bar.is-clickable:hover .mb-col > div { background: #1e40af; }
.month-bar.is-selected { background: #eff6ff; outline: 2px solid var(--primary); }
.month-bar.is-selected .mb-lbl { color: var(--primary); font-weight: 800; }
.month-bar:not(.is-selected).is-clickable .mb-col > div { background: #93c5fd; }
#twin-dashboard-container { transition: opacity 0.15s; }
#twin-dashboard-container.is-loading { opacity: 0.45; pointer-events: none; }
@media (max-width: 640px) {
  .dash-month-nav .form-input { min-width: 0; flex: 1; }
  .month-bars .mb-val { font-size: 0.6rem; }
  .month-bars .mb-lbl { font-size: 0.62rem; }
}

/* Diálogo de máquina: aviso mientras carga (oculta el contenido de la máquina anterior) */
.twin-dialog-loading { display: none; }
.twin-dialog.is-loading .twin-dialog-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 4rem 1rem; color: #64748b; font-weight: 600; font-size: 1rem; }
.twin-dialog.is-loading > .twin-mobile-view-tabs,
.twin-dialog.is-loading > .twin-container-grid { display: none !important; }
.twin-dialog.is-loading .twin-subview-header button { pointer-events: none; opacity: 0.5; }
.twin-dialog.is-loading .twin-subview-header .twin-dialog-close { pointer-events: auto; opacity: 1; }

/* Operario: datos de la ficha en ruta y en la visita */
.stop-extra { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 0.76rem; color: #475569; }
.stop-extra i { color: #64748b; margin-right: 2px; }
.stop-extra a { color: #2563eb; text-decoration: none; }
.stop-inc-badge { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; border-radius: 999px; padding: 0 8px; font-weight: 700; }
.stop-inc-badge i { color: #b45309; }
.wiz-brief { border: 1px solid var(--border); background: #f8fafc; border-radius: 8px; padding: 0.65rem 0.9rem; margin-bottom: 1rem; font-size: 0.84rem; }
.wiz-brief-info { display: flex; flex-wrap: wrap; gap: 4px 16px; color: #334155; }
.wiz-brief-info i { color: #2563eb; margin-right: 3px; }
.wiz-brief-info a { color: #2563eb; }
.wiz-brief-inc { margin-top: 0.6rem; background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px; padding: 0.55rem 0.7rem; }
.wiz-brief-info + .wiz-brief-inc { margin-top: 0.6rem; }
.wiz-brief-info:empty + .wiz-brief-inc, .wiz-brief > .wiz-brief-inc:first-child { margin-top: 0; }
.wiz-brief-inc > strong { color: #92400e; display: block; margin-bottom: 4px; }
.wiz-brief-inc-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px dashed #fde68a; }
.wiz-brief-inc-row small { display: block; color: #64748b; }
@media (max-width: 640px) { .wiz-brief-inc-row { flex-direction: column; align-items: stretch; } }

/* ==========================================================
   PRODUCTOS: ALERTA DE STOCK MÍNIMO Y FICHA DEL PRODUCTO
   ========================================================== */
.kpi-card.kpi-active {
  border-color: #fca5a5;
  box-shadow: 0 0 0 2px #fee2e2;
}

.low-stock-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  margin-bottom: 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.product-stock-pill.is-low {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.product-name-link {
  color: inherit;
  text-decoration: none;
}

.product-name-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.product-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.1rem;
}

.pd-stat {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pd-stat span {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.pd-stat strong {
  font-size: 1.1rem;
  color: var(--text-main);
}

.pd-stat small {
  font-size: 0.72rem;
  color: #64748b;
}

.pd-stat.is-low {
  background: #fef2f2;
  border-color: #fecaca;
}

.pd-stat.is-low strong,
.pd-stat.is-low small {
  color: #dc2626;
}

.pd-section-title {
  font-size: 0.88rem;
  margin: 0.4rem 0 0.5rem;
  color: var(--text-main);
}

.pd-section-title i {
  color: var(--primary);
  margin-right: 4px;
}

@media (max-width: 640px) {
  .product-detail-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- Ventas ---------- */
.sales-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sales-filters .form-input { width: auto; padding: 0.42rem 0.7rem; font-size: 0.85rem; }
.sales-filters .btn-primary { width: auto; padding: 0.5rem 0.9rem; display: inline-flex; align-items: center; gap: 6px; background: #059669; border-color: #059669; }
#sales-kpi-diff { font-size: 0.75rem; font-weight: 600; }
@media (max-width: 600px) {
  .sales-filters, .sales-filters .form-input { width: 100%; }
}
.wiz-counters { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 0.6rem 1rem; margin-bottom: 1rem; }
.wiz-counters summary { cursor: pointer; font-weight: 700; font-size: 0.88rem; color: #1e293b; }
.wiz-counters summary i { color: #2563eb; }
.wiz-counters summary small { font-weight: 400; color: #64748b; }
.wiz-counters p { font-size: 0.78rem; color: #64748b; margin: 0.4rem 0 0.6rem; }
.wiz-counters-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.wiz-counters-grid label { font-size: 0.78rem; font-weight: 600; color: #475569; display: flex; flex-direction: column; gap: 3px; }
.wiz-counters-group { margin: 0.7rem 0 0.35rem; font-size: 0.76rem; font-weight: 700; color: #334155; text-transform: uppercase; letter-spacing: 0.03em; }
.wiz-counters-wide { font-size: 0.78rem; font-weight: 600; color: #475569; display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.wiz-tubes-table { width: 100%; max-width: 420px; border-collapse: collapse; font-size: 0.85rem; }
.wiz-tubes-table th { text-align: left; font-size: 0.74rem; color: #64748b; font-weight: 600; padding: 4px 6px; }
.wiz-tubes-table td { padding: 3px 6px; }
.wiz-tubes-table td:first-child { font-weight: 700; color: #0f172a; white-space: nowrap; }
.wiz-tubes-table td small { display: block; font-weight: 400; color: #94a3b8; font-size: 0.7rem; }
.wiz-tubes-table .form-input { padding: 0.35rem 0.5rem; text-align: center; }
.wiz-tubes-prev { font-size: 0.78rem; color: #475569; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px; padding: 0.4rem 0.6rem; margin-bottom: 0.5rem; }
.wiz-tubes-summary { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.8rem; color: #475569; margin-top: 0.5rem; }
.wiz-tubes-summary strong { color: #0f172a; }
.wiz-machine-sales-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 12px; }
.wiz-machine-sales-list label { display: grid; grid-template-columns: 1fr 80px; align-items: center; gap: 6px; font-size: 0.8rem; color: #334155; }
.wiz-machine-sales-list label span small { display: block; color: #94a3b8; font-size: 0.7rem; }
.wiz-machine-sales-list .form-input { padding: 0.3rem 0.4rem; text-align: center; }
.vd-tubes { width: 100%; border-collapse: collapse; font-size: 0.8rem; margin-top: 6px; }
.vd-tubes th, .vd-tubes td { padding: 3px 4px; text-align: right; }
.vd-tubes th:first-child, .vd-tubes td:first-child { text-align: left; }
.vd-tubes th { color: #64748b; font-weight: 600; font-size: 0.74rem; }
.vd-counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px 12px; font-size: 0.82rem; }
.vd-counters span { color: #64748b; display: block; font-size: 0.74rem; }
.vd-counters small { color: #94a3b8; display: block; font-size: 0.68rem; }

/* ---------- Compras y proveedores ---------- */
#modal-supplier-form { z-index: 1010; } /* se abre también encima de "Nueva compra" */
.pur-new-btn { width: auto; padding: 0.5rem 0.9rem; display: inline-flex; align-items: center; gap: 6px; }
.pur-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; }
.pur-lines-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 0.4rem 0 0.5rem; flex-wrap: wrap; }
.pur-lines-head .form-input { max-width: 280px; padding: 0.4rem 0.7rem; font-size: 0.85rem; }
.pur-lines td { vertical-align: middle; }
.pur-lines .form-input { padding: 0.35rem 0.5rem; font-size: 0.85rem; }
.pur-form-footer { display: flex; gap: 16px; align-items: flex-end; margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid #e2e8f0; flex-wrap: wrap; }
.pur-total { text-align: right; color: #64748b; font-size: 0.8rem; min-width: 140px; margin-bottom: 1rem; }
.pur-total strong { display: block; font-size: 1.5rem; color: #0f172a; }
.pay-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.pay-pendiente { background: #fee2e2; color: #b91c1c; }
.pay-parcial { background: #fef3c7; color: #b45309; }
.pay-pagado { background: #dcfce7; color: #15803d; }
.pay-anulada { background: #e2e8f0; color: #475569; }
tr.pur-row-anulada td { color: #94a3b8; text-decoration: line-through; }
tr.pur-row-anulada td:last-child, tr.pur-row-anulada td .pay-badge { text-decoration: none; }
.pur-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 1rem; }
.pur-summary div { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 0.6rem 0.8rem; font-size: 0.78rem; color: #64748b; }
.pur-summary strong { display: block; font-size: 1.05rem; color: #0f172a; }
.pur-pay-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; align-items: end; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px; padding: 0.7rem; margin-top: 0.6rem; }
.pur-pay-form label { font-size: 0.76rem; font-weight: 600; color: #475569; display: flex; flex-direction: column; gap: 3px; }

/* Mermas: fila de responsable clicable */
.shr-row-click { cursor: pointer; }
.shr-row-click:hover td { background: #f8fafc; }

/* Retiros de producto en la visita */
.wiz-returns-ul { list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.wiz-returns-ul li { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.8rem; color: #334155; background: white; border: 1px solid #e2e8f0; border-radius: 6px; padding: 0.35rem 0.6rem; }

/* ==========================================================
   CONFIGURACIÓN DEL SISTEMA
   ========================================================== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: start;
}
.settings-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem 0.2rem;
  margin: 0 0 1.25rem;
  min-width: 0;
}
.settings-grid > .settings-section { margin-bottom: 0; }
.settings-section legend {
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0 0.4rem;
  color: var(--text-main);
}
.settings-section legend i { color: var(--primary); margin-right: 4px; }
.settings-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 0.9rem;
}
.settings-hint { display: block; margin-top: 4px; color: #64748b; font-size: 0.75rem; }
.settings-logo-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.2rem; }
.settings-logo-preview {
  width: 84px; height: 84px; flex-shrink: 0;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #94a3b8; font-size: 1.6rem; background: #f8fafc; overflow: hidden;
}
.settings-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.settings-logo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.settings-logo-actions small { flex-basis: 100%; color: #64748b; font-size: 0.75rem; }
@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .settings-two { grid-template-columns: 1fr; }
}

/* ---------- Conteo de caja (el encargado cuenta la bolsa de cada máquina) ---------- */
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #f59e0b; color: #fff; font-size: 0.72rem; font-weight: 700; align-items: center; justify-content: center; }
.cash-help { font-size: 0.8rem; color: #64748b; margin: 0 0 0.75rem; }
.cash-help i { color: #2563eb; }
.cash-table td { vertical-align: top; }
.cash-table .cash-input { width: 110px; text-align: right; font-weight: 700; }
.cash-table .cash-save { width: auto; padding: 0.45rem 0.9rem; font-size: 0.8rem; white-space: nowrap; }
.cash-warn { color: #b45309; }
.badge-pending-cash { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.wiz-tubes-required { border-color: #fcd34d; background: #fffbeb; padding: 0.75rem 1rem; }
.wiz-tubes-title { margin: 0; font-size: 0.9rem; color: #1e293b; display: flex; align-items: center; gap: 6px; }
.wiz-tubes-title i { color: #d97706; }
.wiz-tubes-title small { font-weight: 600; color: #b45309; }
