/* ============================================================
   CSS VARIABLES — PALETA CORPORATIVA ERP
   ============================================================ */
:root {
  --primary:        #1e3a5f;
  --primary-light:  #2563eb;
  --primary-hover:  #1d4ed8;
  --sidebar-bg:     #0f172a;
  --sidebar-border: #1e293b;
  --sidebar-text:   #94a3b8;
  --sidebar-active: #2563eb;
  --sidebar-hover:  rgba(255,255,255,0.06);
  --bg-base:        #f1f5f9;
  --bg-surface:     #ffffff;
  --bg-elevated:    #f8fafc;
  --border:         #e2e8f0;
  --border-strong:  #cbd5e1;
  --text-primary:   #0f172a;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;
  --success:        #16a34a;
  --success-bg:     #dcfce7;
  --danger:         #dc2626;
  --danger-bg:      #fee2e2;
  --warning:        #d97706;
  --warning-bg:     #fef3c7;
  --info:           #0284c7;
  --info-bg:        #e0f2fe;
  --shadow-sm:      0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md:      0 4px 12px rgba(15,23,42,0.08), 0 2px 4px rgba(15,23,42,0.04);
  --shadow-lg:      0 12px 32px rgba(15,23,42,0.12), 0 4px 8px rgba(15,23,42,0.06);
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-primary);
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

h1, h2, h3 {
  color: var(--primary);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ============================================================
   LOGIN
   ============================================================ */
.login-container {
  background: var(--bg-surface);
  padding: 44px 36px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  margin: 80px auto;
  border: 1px solid var(--border);
}

.container {
  background: var(--bg-surface);
  padding: 40px 30px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 800px;
  margin-top: 40px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 13px;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-surface);
}

.form-group input:focus {
  border-color: var(--primary-light);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* ============================================================
   LAYOUT GENERAL
   ============================================================ */
.layout {
  display: flex;
  height: 100dvh;
  min-height: 100dvh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 231px;
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.3s cubic-bezier(.4,0,.2,1);
  border-right: 1px solid var(--sidebar-border);
}

.sidebar-logo {
  padding: 16px 12px 14px;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 8px;
}

.sidebar-logo img {
  width: 136px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 6px;
  background: #fff;
  padding: 6px 10px;
}

.sidebar-menu {
  list-style: none;
  padding: 8px 10px;
  margin: 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-menu::-webkit-scrollbar { width: 3px; }
.sidebar-menu::-webkit-scrollbar-track { background: transparent; }
.sidebar-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.sidebar-menu::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

.sidebar-menu li {
  margin-bottom: 2px;
}

.sidebar-menu a {
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 400;
  font-size: 13px;
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
  gap: 10px;
}

.sidebar-menu a:hover {
  background: var(--sidebar-hover);
  color: #f8fafc;
}

.sidebar-menu > li > a:hover {
  color: #f8fafc;
}

/* ============================================================
   SIDEBAR — ESTADOS (COLAPSADO / EXPANDIDO)
   ============================================================ */
.sidebar-expanded { width: 231px !important; }

.sidebar-collapsed {
  width: 63px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar-collapsed .sidebar-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 6px;
}

.sidebar-collapsed .sidebar-menu li {
  margin-bottom: 4px;
  width: 100%;
  text-align: center;
}

.sidebar-collapsed .sidebar-icon {
  display: block;
  text-align: center;
  width: 100%;
  margin: 0 auto;
  font-size: 20px;
}

.sidebar-collapsed .sidebar-toggle {
  margin: 12px auto 16px auto;
  display: flex;
}

.sidebar-collapsed .sidebar-logo { display: none !important; }
.sidebar-collapsed .sidebar-text,
.sidebar-collapsed .submenu .sidebar-text { display: none !important; }

.sidebar-expanded ~ .main-content {
  margin-left: 231px !important;
  width: calc(100vw - 231px);
  max-width: calc(100vw - 231px);
}

.sidebar-collapsed ~ .main-content {
  margin-left: 63px !important;
  width: calc(100vw - 63px);
  max-width: calc(100vw - 63px);
}

/* ============================================================
   SIDEBAR — ICONOS Y BOTON TOGGLE
   ============================================================ */
.sidebar-icon {
  display: inline-flex;
  width: 20px;
  flex-shrink: 0;
  text-align: center;
  justify-content: center;
  align-items: center;
}

.sidebar-icon i {
  font-size: 16px;
  color: var(--sidebar-text);
}

.sidebar-icon i.bi {
  font-size: 16px !important;
  color: var(--sidebar-text) !important;
  font-weight: 400 !important;
}

.sidebar-menu a:hover .sidebar-icon i,
.sidebar-menu a:hover .sidebar-icon i.bi {
  color: var(--sidebar-active) !important;
}

.sidebar-toggle {
  background: transparent !important;
  border: none;
  box-shadow: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 12px 0 8px 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.sidebar-toggle:hover {
  background: var(--sidebar-hover) !important;
}

.sidebar-toggle i.toggle-animated,
.sidebar-toggle i.bi-list {
  font-size: 20px !important;
  color: var(--sidebar-text) !important;
  font-weight: 400 !important;
  transition: color 0.2s, transform 0.3s;
}

.sidebar-toggle:hover i.toggle-animated,
.sidebar-toggle:hover i.bi-list {
  color: #f8fafc !important;
}

.toggle-animated {
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
}

.sidebar-expanded .toggle-animated { transform: rotate(90deg); }
.sidebar-collapsed .toggle-animated { transform: rotate(0deg); }

/* Submenú */
.submenu {
  padding-left: 30px;
  list-style: none;
}

.submenu li { margin-bottom: 1px; }

.submenu a {
  font-size: 12px !important;
  padding: 7px 12px !important;
  color: #64748b !important;
}

.submenu a:hover {
  color: #f8fafc !important;
  background: var(--sidebar-hover) !important;
}

/* ============================================================
   CONTENIDO PRINCIPAL
   ============================================================ */
.main-content {
  margin-left: 0;
  margin-top: 16px;
  margin-bottom: 16px;
  margin-right: 16px;
  padding: 24px 28px 32px 28px;
  height: calc(100dvh - 32px);
  background: var(--bg-base);
  color: var(--text-primary);
  border-radius: var(--radius-lg);
  width: 90vw;
  max-width: 90vw;
  overflow-y: auto;
  transition: margin-left 0.3s, width 0.3s, max-width 0.3s;
}

/* ============================================================
   CABECERA DE PÁGINA
   ============================================================ */
.header-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.header-main h1 {
  color: var(--primary);
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ============================================================
   BOTONES
   ============================================================ */
.login-btn,
.btn {
  padding: 9px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.login-btn { width: 100%; justify-content: center; }

.login-btn:hover,
.btn:hover {
  background: var(--primary-light);
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}

.login-btn:active,
.btn:active { transform: scale(0.98); }

.btn.btn-primary {
  background: var(--primary-light);
}

.btn.btn-primary:hover {
  background: var(--primary-hover);
}

.btn.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn.btn-secondary:hover {
  background: var(--border);
}

.btn.btn-success {
  background: var(--success);
}

.btn.btn-success:hover {
  background: #15803d;
}

.btn.btn-danger {
  background: var(--danger);
}

.btn.btn-danger:hover {
  background: #b91c1c;
}

.btn.btn-primary.btn-sm,
.btn.btn-sm {
  padding: 5px 14px;
  font-size: 12px;
  width: auto;
  min-width: 0;
  border-radius: var(--radius-sm);
  margin-top: 0;
}

/* ============================================================
   ALERTAS
   ============================================================ */
.alert,
.alert-success,
.alert-danger,
.alert-info {
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-success {
  background: var(--success-bg);
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert-danger {
  background: var(--danger-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-info {
  background: var(--info-bg);
  color: #075985;
  border: 1px solid #bae6fd;
}

/* ============================================================
   SECCIÓN DE FILTROS
   ============================================================ */
.filter-section {
  background: var(--bg-surface);
  padding: 20px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.filter-section h3 {
  margin-top: 0;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.filter-form {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-form > div {
  display: flex;
  flex-direction: column;
}

.filter-form label {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.filter-form input[type="date"],
.filter-section .form-control {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  min-width: 180px;
  color: var(--text-primary);
  background: var(--bg-surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-form input[type="date"]:focus,
.filter-section .form-control:focus {
  border-color: var(--primary-light);
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.btn-filtrar {
  background: var(--primary);
  color: #fff;
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  transition: background 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn-filtrar:hover {
  background: var(--primary-light);
  box-shadow: 0 2px 8px rgba(37,99,235,0.25);
}

.btn-filtrar:active { transform: scale(0.98); }

/* ============================================================
   TABLAS — ESTILOS GENÉRICOS
   ============================================================ */
.table-responsive {
  overflow-x: auto;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: var(--text-primary);
}

.table th, .table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.table thead th {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: none;
  padding: 12px 14px;
}

.table tbody tr:hover { background: #f8faff; }
.table tbody tr:nth-child(even) { background: var(--bg-elevated); }

.table-striped tbody tr:nth-child(odd) { background: var(--bg-surface); }
.table-striped tbody tr:nth-child(even) { background: var(--bg-elevated); }

/* Tabla de datos genérica */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  background: var(--primary);
  color: #fff;
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: none;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.data-table tbody tr:hover { background: #f8faff; }
.data-table tbody tr:nth-child(even) { background: var(--bg-elevated); }

.text-right { text-align: right; }

.no-datos {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ============================================================
   DATATABLES — OVERRIDE PROFESIONAL
   ============================================================ */
.dataTables_wrapper {
  padding: 0 !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 13px !important;
}

.dataTables_wrapper .dataTables_filter {
  margin-bottom: 14px !important;
  text-align: right;
}

.dataTables_wrapper .dataTables_filter label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.dataTables_wrapper .dataTables_filter input {
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 6px 10px !important;
  margin-left: 8px !important;
  font-size: 12px !important;
  font-family: inherit !important;
  outline: none;
  transition: border-color 0.2s;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--primary-light) !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1) !important;
}

.dataTables_wrapper .dataTables_length {
  margin-bottom: 14px !important;
}

.dataTables_wrapper .dataTables_length label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.dataTables_wrapper .dataTables_length select {
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  padding: 4px 8px !important;
  font-size: 12px !important;
  font-family: inherit !important;
  margin: 0 4px !important;
}

.dataTables_wrapper .dataTables_info {
  color: var(--text-muted) !important;
  font-size: 12px !important;
  padding-top: 10px !important;
}

.dataTables_wrapper .dataTables_paginate {
  padding-top: 10px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 4px 10px !important;
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border) !important;
  margin: 0 2px !important;
  font-size: 12px !important;
  color: var(--text-primary) !important;
  background: var(--bg-surface) !important;
  transition: all 0.15s !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
  font-weight: 600 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  color: var(--text-muted) !important;
  background: var(--bg-elevated) !important;
  border-color: var(--border) !important;
}

table.dataTable thead th {
  background: var(--primary) !important;
  color: #fff !important;
  font-weight: 600 !important;
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  padding: 12px 14px !important;
  border-bottom: none !important;
}

table.dataTable tbody td {
  padding: 10px 14px !important;
  border-bottom: 1px solid var(--border) !important;
  font-size: 13px !important;
  color: var(--text-primary) !important;
}

table.dataTable tbody tr:hover { background: #f8faff !important; }
table.dataTable tbody tr:nth-child(even) { background: var(--bg-elevated) !important; }
table.dataTable { border-collapse: collapse !important; }
table.dataTable.no-footer { border-bottom: 1px solid var(--border) !important; }

/* Botones DT */
.dt-buttons {
  margin-bottom: 14px !important;
}

.dt-buttons button,
.dt-button {
  background: var(--primary) !important;
  color: #fff !important;
  border: none !important;
  padding: 7px 16px !important;
  border-radius: var(--radius-sm) !important;
  cursor: pointer !important;
  font-size: 12px !important;
  font-family: inherit !important;
  font-weight: 500 !important;
  margin-right: 6px !important;
  transition: background 0.15s !important;
}

.dt-buttons button:hover,
.dt-button:hover {
  background: var(--primary-light) !important;
  box-shadow: 0 2px 8px rgba(37,99,235,0.25) !important;
}

.dt-buttons .btn-aprobar { background: var(--success) !important; }
.dt-buttons .btn-aprobar:hover { background: #15803d !important; }

/* ============================================================
   TOOLBAR
   ============================================================ */
.toolbar .btn {
  background: var(--primary);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.toolbar .btn:hover { background: var(--primary-light); }

/* ============================================================
   MODALES
   ============================================================ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal[aria-hidden="true"] { display: none; }

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-surface);
  color: var(--text-primary);
  width: 90%;
  max-width: 720px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 10001;
  overflow: hidden;
  max-height: 90vh;
  border: 1px solid var(--border);
}

@keyframes fadeInModal {
  from { opacity: 0; transform: translate(-50%, calc(-50% - 12px)); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

.modal-content { animation: fadeInModal 0.2s ease; }

.modal-header {
  position: relative;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-elevated);
}

.modal-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  text-align: right;
  background: var(--bg-elevated);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-body table th {
  width: 40%;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
}

.modal-body table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 2px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--border);
}

/* ============================================================
   SELECT2 PERSONALIZADO
   ============================================================ */
.select2-container--default .select2-selection--single {
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  height: auto !important;
  padding: 2px !important;
  background: var(--bg-surface) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding: 7px 10px !important;
  color: var(--text-primary) !important;
  font-size: 13px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow { top: 7px !important; }
.select2-dropdown { border: 1.5px solid var(--border) !important; border-radius: var(--radius-sm) !important; box-shadow: var(--shadow-md) !important; }
.select2-search__field { padding: 8px 10px !important; border: none !important; font-size: 13px !important; font-family: inherit !important; }
.select2-results__option { padding: 9px 12px !important; font-size: 13px !important; }
.select2-results__option--highlighted { background: var(--primary) !important; }

/* ============================================================
   TARJETA DE PRODUCTO
   ============================================================ */
.producto-card {
  display: flex;
  gap: 24px;
  background: var(--bg-surface);
  padding: 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  max-width: 600px;
  margin: 0 auto 24px auto;
  align-items: center;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  text-align: center;
  padding: 12px 0;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

.navbar { display: none !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .sidebar { width: 189px; padding: 0; }
  .sidebar-collapsed { width: 52px !important; }
  .sidebar-expanded { width: 189px !important; }
  .main-content { padding: 20px 14px; }
}

@media (max-width: 800px) {
  .table th, .table td { padding: 8px 10px; font-size: 12px; }
  .toolbar { flex-direction: column; align-items: stretch; }
}

@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .main-content { border-radius: 0; }
}

@media (max-width: 600px) {
  .layout { flex-direction: row !important; align-items: stretch; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: 63px;
    min-width: 63px;
    height: 100dvh;
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 200;
    transition: width 0.25s cubic-bezier(.4,0,.2,1);
  }
  .sidebar-collapsed { width: 63px !important; }
  .sidebar-expanded  { width: 231px !important; z-index: 999 !important; }
  /* el contenido nunca se desplaza en móvil; el sidebar lo cubre como drawer */
  .sidebar-expanded ~ .main-content,
  .sidebar-collapsed ~ .main-content,
  .main-content {
    margin-left: 63px !important;
    margin: 0 0 0 63px;
    height: 100dvh;
    width: calc(100vw - 63px);
    max-width: calc(100vw - 63px);
    border-radius: 0;
    padding: 12px 8px;
  }
}

/* Backdrop del drawer en móvil */
#sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 998;
}
#sidebar-backdrop.visible { display: block; }

@media (max-width: 480px) {
  .container { padding: 24px 16px; }
}

/* ============================================================
   PERMISOS
   ============================================================ */
.permissions-wrapper { margin-top: 20px; }

.user-selector-section {
  background: var(--bg-surface);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  width: fit-content;
  box-shadow: var(--shadow-sm);
}

.user-selector-section label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.user-selector-section select {
  width: auto;
  min-width: 250px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-primary);
}

.permissions-container { margin-top: 4px; }

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.permission-group {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.permission-group-title {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.permission-item {
  display: flex;
  align-items: center;
  padding: 6px 4px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.permission-item:hover { background: var(--bg-elevated); }
.permission-item:last-child { margin-bottom: 0; }

.permission-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  margin-right: 8px;
  accent-color: var(--primary-light);
  flex-shrink: 0;
}

.permission-item label {
  flex: 1;
  margin: 0;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-primary);
}

.btn-save {
  background: var(--primary);
  color: #fff;
  padding: 8px 24px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  font-family: inherit;
  transition: background 0.15s, box-shadow 0.15s;
  margin-top: 16px;
  display: inline-block;
}

.btn-save:hover { background: var(--primary-light); }

.btn-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.btn-select-all,
.btn-deselect-all {
  background: var(--bg-surface);
  color: var(--primary);
  border: 1.5px solid var(--primary);
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  font-family: inherit;
  transition: all 0.15s;
}

.btn-select-all:hover { background: var(--primary); color: #fff; }
.btn-deselect-all:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

@media (max-width: 768px) { .permissions-grid { grid-template-columns: 1fr; } }

.force-change-section {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--warning-bg);
  border: 1.5px solid var(--warning);
  border-radius: var(--radius-sm);
}

.force-change-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--warning);
}

.force-change-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--warning);
}

/* ============================================================
   USUARIOS
   ============================================================ */
.usuarios-container { margin-top: 20px; }

.transfer-section {
  background: var(--bg-surface);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.transfer-section h3 {
  margin-top: 0;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-bottom: 20px;
}

.transfer-wrapper {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: start;
}

.listbox-container { display: flex; flex-direction: column; gap: 8px; }
.listbox-container label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.listbox {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  min-height: 300px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-surface);
  list-style: none;
}

.listbox li {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  font-size: 12px;
}

.listbox li:hover { background: var(--bg-elevated); }
.listbox li.selected { background: var(--primary); color: #fff; }

.button-group { display: flex; flex-direction: column; gap: 8px; justify-content: center; }

.btn-transfer {
  background: var(--primary);
  color: #fff;
  padding: 9px 14px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  transition: background 0.15s;
  text-align: center;
  min-width: 72px;
}

.btn-transfer:hover { background: var(--primary-light); }
.btn-transfer:disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; }

.info-text { color: var(--text-muted); font-size: 11px; margin-top: 6px; font-style: italic; }

@media (max-width: 1024px) {
  .transfer-wrapper { grid-template-columns: 1fr; }
  .button-group { flex-direction: row; }
  .listbox { min-height: 200px; }
}

/* ============================================================
   KARDEX
   ============================================================ */
.kardex-container { margin-top: 20px; }

.btn-excel {
  background: var(--success);
  color: #fff;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.btn-excel:hover { background: #15803d; }

.loading-spinner { display: none; text-align: center; padding: 40px; margin: 20px 0; }
.loading-spinner.active { display: block; }
.spinner {
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary-light);
  border-radius: 50%;
  width: 36px; height: 36px;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loading-text { color: var(--primary); font-weight: 600; font-size: 13px; }

.kardex-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.kardex-table thead {
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1;
}

.kardex-table th {
  padding: 11px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-bottom: none;
}

.kardex-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
.kardex-table tbody tr:hover { background: #f8faff; }
.kardex-table tbody tr:nth-child(even) { background: var(--bg-elevated); }

.numero-col { font-weight: 600; color: var(--primary); }
.tipo-col { font-weight: 600; padding: 3px 8px; border-radius: 4px; text-align: center; font-size: 11px; display: inline-block; }
.tipo-ingreso { background: #dcfce7; color: #166534; }
.tipo-egreso { background: #fee2e2; color: #991b1b; }
.numero-formato { text-align: right; font-family: 'Courier New', monospace; }
.fecha-col { white-space: nowrap; }
.results-info { color: var(--text-muted); font-size: 12px; margin-bottom: 10px; }

.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  text-decoration: none;
  color: var(--primary);
  background: var(--bg-surface);
  transition: all 0.15s;
}

.pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.pagination .disabled { color: var(--text-muted); cursor: not-allowed; }

.buttons-section { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }

@media (max-width: 768px) {
  .filter-form { flex-direction: column; }
  .filter-form > div, .filter-form input[type="date"] { width: 100%; }
  .kardex-table { font-size: 11px; }
  .kardex-table th, .kardex-table td { padding: 7px 8px; }
  .buttons-section { flex-direction: column; }
}

/* ============================================================
   APROBACIÓN Y HORAS EXTRA
   ============================================================ */
.aprobacion-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}

.aprobacion-container h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 12px;
}

.filtros-section {
  background: var(--bg-surface);
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filtro-grupo { flex: 1; min-width: 180px; }

.filtro-grupo label {
  display: block;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filtro-grupo select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.filtro-grupo select:hover { border-color: var(--border-strong); }
.filtro-grupo select:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

#tablaDatos { font-size: 13px !important; }

#tablaDatos thead th {
  background: var(--primary) !important;
  color: #fff !important;
  font-weight: 600 !important;
  padding: 12px 14px !important;
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  border: none !important;
}

#tablaDatos tbody td {
  padding: 10px 14px !important;
  border-bottom: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
}

#tablaDatos tbody tr:hover { background: #f8faff !important; }
#tablaDatos tbody tr:last-child td { border-bottom: none !important; }

.summary-box {
  background: var(--bg-elevated);
  padding: 18px 20px;
  border-radius: var(--radius-md);
  margin-top: 20px;
  border-left: 4px solid var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.summary-box strong { color: var(--primary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 10px; font-weight: 700; }
.summary-box div { color: var(--text-primary); font-size: 13px; line-height: 1.7; }
.summary-box div strong { color: var(--primary); font-weight: 700; }

@media (max-width: 768px) {
  .filtros-section { flex-direction: column; gap: 12px; }
  .filtro-grupo { width: 100%; }
  .aprobacion-container h1 { font-size: 18px; }
}

/* ============================================================
   HORAS EXTRA
   ============================================================ */
.horas-container { margin-top: 20px; }

.table-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-section h3 {
  background: var(--bg-elevated);
  padding: 14px 18px;
  margin: 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.horas-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.horas-table thead { background: var(--primary); color: #fff; }
.horas-table th { padding: 11px 12px; text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: none; }
.horas-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
.horas-table tbody tr:hover { background: #f8faff; }
.horas-table tbody tr:nth-child(even) { background: var(--bg-elevated); }

.btn-editar {
  background: var(--primary);
  color: #fff;
  padding: 4px 12px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 11px;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-editar:hover { background: var(--primary-light); }

.btn-eliminar {
  background: var(--danger);
  color: #fff;
  padding: 4px 12px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 11px;
  font-family: inherit;
  margin-left: 4px;
  transition: background 0.15s;
}

.btn-eliminar:hover { background: #b91c1c; }

.hora-input {
  width: 70px;
  padding: 4px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
}

.hora-input:focus { outline: none; border-color: var(--primary-light); }

/* ============================================================
   CARGA DE HORAS EXTRA
   ============================================================ */
.upload-section {
  background: var(--bg-surface);
  padding: 28px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  max-width: 600px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.upload-section h2 { color: var(--primary); margin-top: 0; margin-bottom: 20px; font-size: 18px; }
.file-input-wrapper { position: relative; display: inline-block; cursor: pointer; margin-bottom: 20px; }
#fileInput { display: none; }

.btn-examinar {
  background: var(--primary);
  color: #fff;
  padding: 11px 28px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  transition: background 0.15s;
  display: inline-block;
}

.btn-examinar:hover { background: var(--primary-light); }
.file-info { margin-top: 14px; color: var(--text-muted); font-size: 12px; }
.file-content-section { margin-top: 24px; display: none; flex: 1; overflow: hidden; flex-direction: column; }
.file-content-section.active { display: flex; }
.file-details { background: var(--bg-elevated); padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; text-align: left; border: 1px solid var(--border); }
.file-details h3 { margin: 0 0 8px 0; color: var(--primary); font-size: 14px; }
.file-details p { margin: 4px 0; font-size: 12px; color: var(--text-secondary); }
.file-content { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; height: 100%; overflow-y: auto; text-align: left; flex: 1; }
.file-content-title { font-weight: 600; color: var(--primary); margin-bottom: 10px; font-size: 13px; }
.content-text { font-size: 12px; color: var(--text-primary); white-space: pre-wrap; word-break: break-word; font-family: 'Courier New', monospace; line-height: 1.5; }
.table-container { overflow-x: visible; width: 100%; }
.file-table { width: 100%; border-collapse: collapse; font-size: 12px; background: var(--bg-surface); }
.file-table th { background: var(--primary); color: #fff; padding: 9px 10px; text-align: left; font-weight: 600; font-size: 11px; white-space: nowrap; }
.file-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); color: var(--text-primary); }
.file-table tbody tr:nth-child(even) { background: var(--bg-elevated); }
.file-table tbody tr:hover { background: #f8faff; }
.btn-guardar { background: var(--success); color: #fff; padding: 8px 20px; border: none; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; font-size: 13px; font-family: inherit; margin-top: 10px; }
.btn-guardar:hover { background: #15803d; }

/* ============================================================
   CAMBIAR CONTRASEÑA
   ============================================================ */
.cambiar-contrasena-wrapper { max-width: 480px; }
.form-group-custom { margin-bottom: 18px; }
.form-group-custom label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--text-secondary); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.form-group-custom input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; transition: border-color 0.2s, box-shadow 0.2s; color: var(--text-primary); }
.form-group-custom input:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-helper-text { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.btn-group-custom { display: flex; gap: 10px; margin-top: 24px; }
.btn-custom { padding: 10px 22px; border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; transition: background 0.15s; display: inline-flex; align-items: center; gap: 6px; }
.btn-custom.primary { background: var(--primary); color: #fff; }
.btn-custom.primary:hover { background: var(--primary-light); }
.btn-custom.secondary { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); }
.btn-custom.secondary:hover { background: var(--border); }
.alert-custom { padding: 11px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 13px; font-weight: 500; }
.alert-custom.success { background: var(--success-bg); color: #166534; border: 1px solid #bbf7d0; }
.alert-custom.danger { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }
.usuario-info { background: var(--info-bg); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 13px; border-left: 3px solid var(--info); }
.security-tips { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; margin-top: 20px; }
.security-tips h5 { font-size: 12px; color: var(--primary); margin-bottom: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.security-tips ul { list-style: none; padding: 0; margin: 0; }
.security-tips li { font-size: 12px; color: var(--text-secondary); padding: 6px 0; border-bottom: 1px solid var(--border); }
.security-tips li:last-child { border-bottom: none; }
.security-tips li:before { content: "✓ "; color: var(--success); font-weight: bold; margin-right: 6px; }

/* ============================================================
   PROVEEDORES
   ============================================================ */
#tablaProveedores { border-collapse: collapse; width: 100%; }
#tablaProveedores th, #tablaProveedores td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
#tablaProveedores th { background: var(--primary); color: #fff; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
#tablaProveedores tr:hover { background: #f8faff; }
#supplierModal .modal-content { max-width: 600px; }

/* ============================================================
   ORDEN DE COMPRA
   ============================================================ */
.form-container { background: var(--bg-surface); padding: 24px; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.toolbar-container { background: var(--bg-elevated); padding: 14px 16px; border-radius: var(--radius-md); border: 1px solid var(--border); margin-bottom: 20px; display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.btn-lookup { width: calc(1.5em + 0.5rem + 2px); display: inline-flex; align-items: center; justify-content: center; }
.text-numeric { text-align: right; }
.col-codigo { width: 25%; }
.form-container .form-group { margin-bottom: 12px; }
.form-container .form-group label { margin-bottom: 4px; }
#tablaItems th, #tablaItems td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); }
#tablaItems th { background: var(--bg-elevated); color: var(--text-secondary); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
#tablaItems .form-control { font-size: 12px; }

/* ============================================================
   PLANILLAS
   ============================================================ */
.table-filter-input { max-width: 120px; font-size: 13px; padding: 4px 8px; margin-right: 4px; margin-bottom: 4px; display: inline-block; border: 1.5px solid var(--border); border-radius: var(--radius-sm); }

/* ============================================================
   BADGES / PILLS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-success  { background: var(--success-bg);  color: #166534; }
.badge-danger   { background: var(--danger-bg);   color: #991b1b; }
.badge-warning  { background: var(--warning-bg);  color: #92400e; }
.badge-info     { background: var(--info-bg);     color: #075985; }
.badge-neutral  { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-primary  { background: #dbeafe;            color: #1e40af; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2,
.card-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.01em;
}
.card-body  { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--primary-light);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 8px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--primary); line-height: 1; }
.kpi-sub   { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ============================================================
   TOPBAR DENTRO DE MAIN-CONTENT
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 20px 0;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 9;
  background: var(--bg-base);
}
.topbar-left    { display: flex; flex-direction: column; gap: 3px; }
.topbar-title   { font-size: 20px; font-weight: 700; color: var(--primary); letter-spacing: -0.02em; margin: 0; }
.topbar-breadcrumb {
  font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center; gap: 5px;
}
.topbar-breadcrumb span { color: var(--text-secondary); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ============================================================
   SIDEBAR — ACTIVO Y USUARIO
   ============================================================ */
.sidebar-menu a.active {
  background: rgba(37,99,235,0.12);
  color: #f8fafc;
}
.sidebar-menu a.active .sidebar-icon i,
.sidebar-menu a.active .sidebar-icon i.bi { color: var(--sidebar-active) !important; }
.sidebar-menu .submenu a.active {
  color: #f8fafc !important;
  background: rgba(37,99,235,0.12) !important;
  font-weight: 600;
}
.sidebar-user {
  padding: 12px 14px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  flex-shrink: 0;
}
.sidebar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-user-name { font-size: 12px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 10px; color: var(--sidebar-text); }
.sidebar-collapsed .sidebar-user-name,
.sidebar-collapsed .sidebar-user-role { display: none; }
.sidebar-collapsed .sidebar-user { justify-content: center; padding: 12px 6px; }

/* Scrollbar main-content */
.main-content::-webkit-scrollbar { width: 5px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.main-content::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   GENERAR EMBARQUES
   ============================================================ */
.embarques-form { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 16px; }
.embarque-field { display: flex; flex-direction: column; gap: 5px; flex: 0 0 auto; }
.embarque-field label { font-weight: 600; font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.embarque-field .form-select { padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; background: var(--bg-surface); color: var(--text-primary); width: auto; min-width: 160px; transition: border-color 0.2s, box-shadow 0.2s; }
.embarque-field .form-select:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.embarque-field .form-select:disabled { background: var(--bg-elevated); color: var(--text-muted); cursor: not-allowed; border-color: var(--border); }
.vendedor-hint { font-size: 11px; color: var(--text-muted); }
.embarque-actions { padding-top: 0; }

/* ============================================================
   ESTATUS DE PEDIDOS
   ============================================================ */

/* ── Selector de período ──────────────────────────────────── */
.period-selector { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.period-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.period-selector select {
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-surface);
  cursor: pointer;
  transition: border-color .2s;
}
.period-selector select:focus { outline: none; border-color: var(--primary-light); }

/* ── KPI cards con icono ──────────────────────────────────── */
.kpi-card-icon { display: flex; align-items: center; gap: 14px; }
.kpi-icon-circle {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.kpi-card-icon .kpi-value { font-size: 24px; }

/* ── Cards clickeables ────────────────────────────────────── */
.kpi-card.clickable { cursor: pointer; transition: box-shadow .18s, transform .15s; }
.kpi-card.clickable:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-card.clickable .kpi-sub { font-size: 10px; color: var(--text-muted); }
.kpi-hint { font-size: 10px; color: var(--text-muted); margin-top: 6px; display: flex; align-items: center; gap: 3px; }

/* ── Barra de progreso ────────────────────────────────────── */
.progress-bar-wrap { background: var(--border); border-radius: 4px; height: 8px; min-width: 80px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }

/* ── Grid de gráficas ─────────────────────────────────────── */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 800px) { .charts-grid { grid-template-columns: 1fr; } }

/* ── Panel de contenido genérico ─────────────────────────── */
.stat-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
}
.stat-panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.stat-panel-header h3 {
  margin: 0;
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .05em;
}
.stat-panel-header i { color: var(--primary-light); font-size: 15px; }
.stat-panel-body { padding: 16px 20px; }

/* ── Badge de estatus ─────────────────────────────────────── */
.estatus-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .03em;
}

/* ── Estado vacío ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state i { font-size: 48px; display: block; margin-bottom: 12px; opacity: .4; }

/* ── Modal overlay ────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  z-index: 1000;
  align-items: flex-start; justify-content: center;
  padding: 32px 16px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }

/* ── Modal box ────────────────────────────────────────────── */
.modal-box {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 900px;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 64px);
  overflow: hidden;
}

/* ── Modal header ─────────────────────────────────────────── */
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-header-left { display: flex; align-items: center; gap: 10px; }
.modal-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px; font-weight: 700;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--primary); margin: 0; }
.modal-close {
  background: none; border: none;
  font-size: 20px; color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
  line-height: 1;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }

/* ── Modal filtros ────────────────────────────────────────── */
.modal-filters {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  flex-shrink: 0;
  background: var(--bg-elevated);
}
.modal-filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.modal-filter-group label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted);
}
.modal-filter-group select,
.modal-filter-group input {
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px; font-family: inherit;
  color: var(--text-primary); background: var(--bg-surface);
  transition: border-color .2s;
}
.modal-filter-group select:focus,
.modal-filter-group input:focus { outline: none; border-color: var(--primary-light); }
.modal-filter-group input { min-width: 200px; }

/* ── Modal body / footer ──────────────────────────────────── */
.modal-body { overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 10px 24px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
  background: var(--bg-elevated);
}

/* ── Spinner ──────────────────────────────────────────────── */
.modal-spinner {
  display: flex; align-items: center; justify-content: center;
  padding: 48px; gap: 10px;
  color: var(--text-muted); font-size: 13px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-icon { animation: spin .7s linear infinite; font-size: 20px; }

/* ── Sección colapsable de gráficas ──────────────────────── */
.charts-section { margin-bottom: 20px; }

.charts-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 10px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer; font-family: inherit;
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .05em;
  transition: background .15s, border-color .15s;
  margin-bottom: 10px;
}
.charts-toggle:hover { background: var(--bg-elevated); border-color: var(--primary-light); }

.charts-toggle-left { display: flex; align-items: center; gap: 7px; }
.charts-toggle-left i { color: var(--primary-light); font-size: 14px; }

.charts-chevron {
  font-size: 13px; color: var(--text-muted);
  transition: transform .25s ease;
}

/* Contenido colapsable */
.charts-collapsible {
  display: grid;
  grid-template-rows: 1fr;
  overflow: hidden;
  transition: grid-template-rows .3s ease, opacity .3s ease;
  opacity: 1;
}
.charts-collapsible.collapsed {
  grid-template-rows: 0fr;
  opacity: 0;
}
.charts-collapsible > * { min-height: 0; }

/* ── Pedidos Masivos — selector de cliente ───────────────── */
.client-selector-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.client-selector-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.client-selector-select {
  flex: 1;
  min-width: 220px;
  max-width: 380px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  background: var(--bg-elevated);
  color: var(--text-main);
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s;
}
.client-selector-select:focus {
  outline: none;
  border-color: var(--primary);
}
.client-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-hover);
  border-radius: 20px;
  padding: 4px 12px;
}
.client-badge i { color: var(--primary-light); }

/* ── Pedidos Masivos — upload zone ──────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--bg-surface);
  position: relative;
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, var(--bg-surface));
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.upload-icon  { font-size: 32px; color: var(--primary); margin-bottom: 8px; }
.upload-title { font-size: 16px; font-weight: 600; color: var(--text-main); margin-bottom: 4px; }
.upload-sub   { font-size: 13px; color: var(--text-muted); }

/* ── Pedidos Masivos — file chip ─────────────────────────── */
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 12px;
}
.file-chip .remove-file {
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  opacity: .7;
}
.file-chip .remove-file:hover { opacity: 1; }

#fileChipWrapper { text-align: center; }

/* ── Pedidos Masivos — sheet tabs ────────────────────────── */
.sheet-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 0;
}
.sheet-tab {
  padding: 6px 16px;
  border-radius: 6px 6px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sheet-tab:hover  { background: var(--bg-hover); color: var(--text-main); }
.sheet-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

/* ── Pedidos Masivos — preview panel ─────────────────────── */
.preview-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 0 8px 8px 8px;
  overflow: auto;
  max-height: 60vh;
}
.preview-panel table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.preview-panel thead th {
  position: sticky;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: 8px 12px;
  white-space: nowrap;
  font-weight: 600;
  border-right: 1px solid rgba(255,255,255,.15);
  z-index: 2;
}
.preview-panel tbody tr:nth-child(even) { background: var(--bg-hover); }
.preview-panel tbody tr:hover           { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.preview-panel tbody td {
  padding: 6px 12px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-panel tbody td:first-child { color: var(--text-muted); font-size: 11px; text-align: center; }

/* ── Pedidos Masivos — stats bar ─────────────────────────── */
.stats-bar {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
}
.stats-bar .stat        { display: flex; align-items: center; gap: 6px; color: var(--text-muted); }
.stats-bar .stat strong { color: var(--text-main); }

/* ── Pedidos Masivos — search bar ────────────────────────── */
.preview-search {
  width: 280px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--bg-surface);
  color: var(--text-main);
}
.preview-search:focus { outline: none; border-color: var(--primary); }

/* ── Pedidos Masivos — empty / loading states ────────────── */
.state-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 64px 24px;
  color: var(--text-muted);
}
.state-empty i { font-size: 40px; opacity: .35; }
.state-empty p { font-size: 14px; margin: 0; }

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Pedidos Masivos — misc ──────────────────────────────── */
.col-rownum        { width: 40px; min-width: 40px; }
#previewSection    { margin-top: 16px; }
#btnClear          { gap: 6px; }

/* ── Modal Crear Pedido (pedidos_masivos.php) ────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    backdrop-filter: blur(2px);
}
.modal-box {
    background: var(--bg-surface, #fff);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalIn .18s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(-16px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    gap: 12px;
}
.modal-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.modal-header-left > i {
    font-size: 1.6rem;
    color: var(--primary, #3b82f6);
}
.modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
}
.modal-subtitle {
    margin: 2px 0 0;
    font-size: .82rem;
    color: var(--text-muted, #6b7280);
}
.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-muted, #6b7280);
    padding: 6px;
    border-radius: 6px;
    line-height: 1;
    transition: background .15s, color .15s;
}
.modal-close:hover {
    background: var(--bg-elevated, #f3f4f6);
    color: var(--text-primary, #111827);
}
.modal-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    padding: 10px 24px;
    background: var(--bg-elevated, #f9fafb);
    border-bottom: 1px solid var(--border, #e5e7eb);
    font-size: .8rem;
    color: var(--text-muted, #6b7280);
}
.modal-stats .stat {
    display: flex;
    align-items: center;
    gap: 5px;
}
.modal-stats .stat strong {
    color: var(--text-primary, #111827);
}
.modal-body {
    flex: 1;
    overflow: auto;
    padding: 0;
}
.modal-table-wrapper {
    min-width: 100%;
}
.modal-table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    font-size: .84rem;
}
.modal-table-wrapper thead th {
    position: sticky;
    top: 0;
    background: var(--bg-elevated, #f9fafb);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary, #374151);
    border-bottom: 2px solid var(--border, #e5e7eb);
    white-space: nowrap;
}
.modal-table-wrapper tbody tr:hover {
    background: var(--bg-elevated, #f3f4f6);
}
.modal-table-wrapper tbody td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    color: var(--text-primary, #111827);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* ── Col picker ──────────────────────────────────────────── */
.modal-col-picker {
    padding: 12px 24px;
    background: var(--bg-elevated, #f9fafb);
    border-bottom: 1px solid var(--border, #e5e7eb);
}
.col-picker-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    align-items: flex-end;
}
.col-picker-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
}
.col-picker-field label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-secondary, #374151);
    display: flex;
    align-items: center;
    gap: 5px;
}
.col-picker-field select {
    padding: 6px 10px;
    border: 1.5px solid var(--border, #e5e7eb);
    border-radius: 6px;
    font-size: .83rem;
    font-family: inherit;
    color: var(--text-primary, #111827);
    background: var(--bg-surface, #fff);
    height: 34px;
}
.col-picker-field select:focus {
    outline: none;
    border-color: var(--primary, #3b82f6);
}
/* ── Row states ──────────────────────────────────────────── */
.row-found   { background: #f0fdf4; }
.row-missing { background: #fff7ed; }
.badge-found   { background: #dcfce7; color: #15803d; border-radius: 4px; padding: 1px 7px; font-size: .75rem; font-weight: 600; }
.badge-missing { background: #ffedd5; color: #c2410c; border-radius: 4px; padding: 1px 7px; font-size: .75rem; font-weight: 600; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border, #e5e7eb);
    background: var(--bg-surface, #fff);
}

/* ── Página Productos (productos.php) ────────────────────── */
.badge-activo   { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; background: color-mix(in srgb,#22c55e 15%,transparent); color: #16a34a; }
.badge-inactivo { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; background: color-mix(in srgb,#ef4444 15%,transparent); color: #dc2626; }
.text-right  { text-align: right  !important; }
.text-center { text-align: center !important; }
.btn-ficha {
    padding: 3px 10px; font-size: 11px; font-weight: 600; border: none; border-radius: 5px;
    cursor: pointer; background: var(--primary, #2563eb); color: #fff;
    display: inline-flex; align-items: center; gap: 4px; transition: background .15s;
}
.btn-ficha:hover { background: var(--primary-hover, #1d4ed8); }

/* Modal ficha producto */
.ficha-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; padding: 16px; backdrop-filter: blur(2px);
}
.ficha-box {
    background: var(--bg-surface, #fff); border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    width: 100%; max-width: 860px; max-height: 92vh;
    display: flex; flex-direction: column; overflow: hidden;
    animation: fichaIn .18s ease;
}
@keyframes fichaIn {
    from { opacity: 0; transform: translateY(-14px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ficha-header {
    background: var(--primary, #2563eb); color: #fff;
    padding: 14px 20px; display: flex; align-items: center;
    justify-content: space-between; gap: 10px; flex-shrink: 0;
}
.ficha-header-left { display: flex; align-items: center; gap: 12px; }
.ficha-header-left i { font-size: 1.5rem; }
.ficha-codigo { font-size: 1.1rem; font-weight: 700; letter-spacing: .04em; }
.ficha-desc   { font-size: .82rem; opacity: .85; margin-top: 1px; }
.ficha-close  {
    background: rgba(255,255,255,.15); border: none; color: #fff;
    width: 30px; height: 30px; border-radius: 6px; cursor: pointer;
    font-size: 1rem; display: flex; align-items: center; justify-content: center;
    transition: background .15s; flex-shrink: 0;
}
.ficha-close:hover { background: rgba(255,255,255,.3); }
.ficha-body { flex: 1; overflow-y: auto; padding: 20px; }
.ficha-section { margin-bottom: 20px; }
.ficha-section-title {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    color: var(--primary, #2563eb); border-bottom: 1.5px solid var(--border, #e5e7eb);
    padding-bottom: 5px; margin-bottom: 10px;
}
.ficha-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 16px;
}
.ficha-field { display: flex; flex-direction: column; gap: 2px; }
.ficha-label { font-size: 10px; font-weight: 600; color: var(--text-muted, #6b7280); text-transform: uppercase; letter-spacing: .04em; }
.ficha-val   { font-size: 13px; color: var(--text-primary, #111827); word-break: break-word; }
.ficha-val.mono { font-family: monospace; font-size: 12px; }

/* Sección equivalencias */
.equiv-section {
    background: var(--bg-elevated, #f9fafb); border: 1.5px solid var(--border, #e5e7eb);
    border-radius: 8px; padding: 16px; margin-top: 4px;
}
.equiv-title {
    font-size: 12px; font-weight: 700; color: var(--text-primary, #111827);
    margin: 0 0 12px; display: flex; align-items: center; gap: 7px;
}
.equiv-form-grid {
    display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px;
}
@media (max-width: 640px) { .equiv-form-grid { grid-template-columns: 1fr 1fr; } }
.equiv-field { display: flex; flex-direction: column; gap: 4px; }
.equiv-label { font-size: 11px; font-weight: 600; color: var(--text-secondary, #374151); }
.equiv-input {
    padding: 6px 10px; border: 1.5px solid var(--border, #e5e7eb);
    border-radius: 6px; font-size: 13px; font-family: inherit;
    color: var(--text-primary, #111827); background: #fff; height: 34px;
    transition: border-color .15s;
}
.equiv-input:focus { outline: none; border-color: var(--primary, #2563eb); }
.equiv-actions { display: flex; justify-content: flex-end; margin-top: 12px; gap: 8px; }
.btn-equiv-add {
    padding: 7px 18px; background: var(--success, #16a34a); color: #fff;
    border: none; border-radius: 6px; font-size: 13px; font-weight: 600;
    font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    transition: background .15s;
}
.btn-equiv-add:hover    { background: #15803d; }
.btn-equiv-add:disabled { opacity: .6; cursor: not-allowed; }
.equiv-msg { font-size: 12px; padding: 6px 10px; border-radius: 5px; margin-top: 8px; }
.equiv-msg.ok  { background: #dcfce7; color: #15803d; }
.equiv-msg.err { background: #fee2e2; color: #dc2626; }

/* ── Contraseñas de Pago (contrasena_pago.php) ───────────────────────────── */
.cp-wrapper { display: flex; gap: 24px; align-items: flex-start; }
.cp-form-card {
    flex: 1;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    padding: 28px 32px;
}
.cp-form-card h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main, #1e293b);
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cp-numero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-light, #eff6ff);
    color: var(--primary, #2563eb);
    border: 1px solid var(--primary-border, #bfdbfe);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 20px;
}
.cp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cp-field { display: flex; flex-direction: column; gap: 5px; }
.cp-field.full { grid-column: span 2; }
.cp-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    text-transform: uppercase;
    letter-spacing: .4px;
}
.cp-label .req { color: #ef4444; margin-left: 2px; }
.cp-input, .cp-select, .cp-textarea {
    border: 1px solid var(--border-color, #cbd5e1);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-main, #1e293b);
    background: #fff;
    transition: border-color .15s;
    width: 100%;
    box-sizing: border-box;
}
.cp-input:focus, .cp-select:focus, .cp-textarea:focus {
    outline: none;
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.cp-textarea { resize: vertical; min-height: 72px; }
.cp-actions { margin-top: 24px; display: flex; gap: 10px; }
.btn-emitir {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--primary, #2563eb);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 9px 22px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.btn-emitir:hover { background: #1d4ed8; }
.btn-limpiar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: var(--text-muted, #64748b);
    border: 1px solid var(--border-color, #cbd5e1);
    border-radius: 7px;
    padding: 9px 18px;
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.btn-limpiar:hover { border-color: #94a3b8; color: #475569; }
.cp-alert {
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.cp-alert.ok  { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.cp-alert.err { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }
.cp-ticket {
    width: 320px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.cp-ticket-header { background: var(--primary, #2563eb); color: #fff; padding: 16px 20px; text-align: center; }
.cp-ticket-header h3 { margin: 0 0 4px 0; font-size: 14px; }
.cp-ticket-header .cp-ticket-num { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.cp-ticket-body { padding: 18px 20px; }
.cp-ticket-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 6px 0;
    border-bottom: 1px dashed #e2e8f0;
    font-size: 12px;
    gap: 8px;
}
.cp-ticket-row:last-child { border-bottom: none; }
.cp-ticket-key { color: #64748b; font-weight: 500; flex-shrink: 0; }
.cp-ticket-val { color: #1e293b; font-weight: 600; text-align: right; }
.cp-ticket-monto {
    text-align: center;
    margin: 12px 0;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.cp-ticket-monto-label { font-size: 11px; color: #64748b; }
.cp-ticket-monto-val   { font-size: 22px; font-weight: 700; color: #1e293b; }
.cp-ticket-footer { background: #f8fafc; border-top: 1px solid #e2e8f0; padding: 12px 20px; text-align: center; }
.btn-imprimir {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #0f172a;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.btn-imprimir:hover { background: #1e293b; }
#printArea { display: none; }
@media print {
    body > * { display: none; }
    #printArea { display: block !important; margin: 0; padding: 20px; font-family: monospace; }
}
@media (max-width: 900px) {
    .cp-wrapper { flex-direction: column; }
    .cp-ticket  { width: 100%; }
    .cp-grid    { grid-template-columns: 1fr; }
    .cp-field.full { grid-column: span 1; }
}

/* ── Grid de Facturas (contrasena_pago.php) ──────────────────────────────── */
.cp-facturas-section {
    margin-top: 24px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    padding: 24px 28px;
}
.cp-facturas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.cp-facturas-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main, #1e293b);
    margin: 0 0 2px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cp-facturas-sub {
    font-size: 12px;
    color: var(--text-muted, #64748b);
}
.btn-add-factura {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #16a34a;
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.btn-add-factura:hover { background: #15803d; }
.cp-factura-form {
    background: var(--bg-elevated, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    padding: 18px 20px;
    margin-bottom: 16px;
}
.cp-factura-form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
.cp-factura-form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}
.cp-ff-msg {
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 5px;
}
.cp-ff-msg.ok  { background: #dcfce7; color: #15803d; }
.cp-ff-msg.err { background: #fee2e2; color: #dc2626; }
@media (max-width: 900px) {
    .cp-factura-form-grid { grid-template-columns: 1fr 1fr; }
}
.btn-icon-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 7px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    transition: background .15s;
}
.btn-danger-sm { background: #fee2e2; color: #dc2626; }
.btn-danger-sm:hover { background: #fca5a5; }

/* ── APISAT ─────────────────────────────────────────────────────────────── */
.sat-stat-card {
    padding: 16px 24px;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sat-stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.sat-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

/* ── Consulta / Reimpresión ─────────────────────────────────────────────── */
.cp-consulta-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.cp-consulta-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    user-select: none;
    transition: background .15s;
}
.cp-consulta-toggle:hover { background: var(--hover-bg); }
.cp-consulta-toggle i { color: var(--primary); }

.cp-consulta-filtros {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
    padding: 16px 20px 4px;
    border-top: 1px solid var(--border);
}
.cp-consulta-filtros .cp-field { flex: 1; min-width: 160px; }

.cp-bs-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--hover-bg);
    border-top: 1px solid var(--border);
    margin-top: 8px;
}
.cp-bs-nav-info {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}
.btn-nav {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: background .15s;
}
.btn-nav:hover:not(:disabled) { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-nav:disabled { opacity: .4; cursor: default; }

.bs-row-active { background: #eff6ff !important; }
.bs-row-active td { color: var(--primary); }

#wrapBsTable { padding: 0 20px 16px; }
#wrapBsNav   { border-radius: 0; margin: 0; }

/* ── Print: Contraseña de Pago ──────────────────────────────────────────── */
#printArea { display: none; }

.cp-print-receipt {
    font-family: Arial, sans-serif;
    font-size: 11px;
    color: #000;
    padding: 16px 20px;
    box-sizing: border-box;
}

.cp-print-receipt table td,
.cp-print-receipt table th {
    vertical-align: top;
}

.cp-print-cut {
    display: none;
    justify-content: space-between;
    font-size: 10px;
    color: #888;
    border-top: 1px dashed #aaa;
    border-bottom: 1px dashed #aaa;
    padding: 4px 8px;
    margin: 4px 0;
    letter-spacing: 1px;
    white-space: nowrap;
}

@media print {
    body > * { display: none !important; }
    #printArea { display: block !important; }

    .cp-print-receipt {
        width: 100%;
        page-break-inside: avoid;
    }

    .cp-print-cut {
        display: flex;
        justify-content: space-between;
        border-top: 1px dashed #aaa;
        border-bottom: 1px dashed #aaa;
        padding: 4px 8px;
        margin: 6px 0;
        font-size: 10px;
        color: #555;
        letter-spacing: 1px;
        white-space: nowrap;
    }
}
