/* ============================================
   TEMA AZURE CORPORATIVO GLOBAL - PROFESIONAL
   Variables de color institucionales
   ============================================ */
:root{
  --bg-primary: #f5f7fa;          /* Fondo principal claro */
  --bg-secondary: #ffffff;         /* Superficie blanca */
  --bg-hover: #e8ecf2;            /* Hover sutil */
  --primary: #0078d4;              /* Azul corporativo Microsoft */
  --primary-hover: #106ebe;        /* Azul más oscuro */
  --success: #107c10;              /* Verde corporativo */
  --warning: #ffb900;              /* Amarillo corporativo */
  --danger: #d13438;               /* Rojo corporativo */
  --text-primary: #323130;         /* Texto principal oscuro */
  --text-secondary: #605e5c;       /* Texto secundario */
  --text-light: #8a8886;           /* Texto claro */
  --border-light: #edebe9;         /* Borde sutil */
  --border-medium: #d2d0ce;        /* Borde medio */
  --shadow: rgba(0, 0, 0, 0.1);    /* Sombra suave */
  
  /* Compatibilidad con código antiguo */
  --bg:#f5f7fa;
  --bg-light:#e8ecf2;
  --panel:#ffffff;
  --accent:#0078d4;
  --accent-2:#106ebe;
  --muted:#605e5c;
  --white:#323130;
  --card:#ffffff;
  --border:#edebe9;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family:'Inter', 'Segoe UI', Roboto, Arial, sans-serif;
  background:var(--bg-primary) !important;
  background-image:none !important;
  color:var(--text-primary) !important;
  -webkit-font-smoothing:antialiased;
  font-size:17px;
  line-height:1.6;
}

/* Cabecera horizontal - Azure Theme */
.cabecera{
  position:sticky;
  top:0;
  z-index:60;
  background:var(--bg-secondary);
  backdrop-filter:blur(12px);
  border-bottom:2px solid var(--border-light);
  box-shadow:0 2px 8px var(--shadow);
}

.cabecera-inner{
  max-width:1400px;
  margin:0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 32px;
}

.cabecera .logo{
  font-weight:800;
  color:var(--primary);
  font-size:1.4rem;
  letter-spacing:-0.02em;
}

.nav{
  display:flex;
  gap:8px;
  align-items:center;
}

.nav a{
  color:var(--text-secondary);
  text-decoration:none;
  padding:10px 18px;
  border-radius:6px;
  font-size:0.95rem;
  transition:all 0.2s ease;
  font-weight:600;
}

.nav a:hover{
  background:var(--bg-hover);
  color:var(--text-primary);
}

.nav a.cerrar{
  background:transparent;
  color:var(--text-secondary);
  border:1px solid var(--border-medium);
}

.nav a.cerrar:hover{
  border-color:var(--danger);
  color:var(--danger);
  background:rgba(209, 52, 56, 0.05);
}

.nav a.login{
  background:var(--primary);
  color:white;
  box-shadow:0 2px 4px var(--shadow);
}

.nav a.login:hover{
  background:var(--primary-hover);
  transform:translateY(-1px);
  box-shadow:0 4px 8px var(--shadow);
}

/* Contenido */
.contenido{
  max-width:1400px;
  margin:32px auto;
  padding:32px 40px;
}

/* Botones */
.boton{
  display:inline-block;
  background:var(--primary);
  color:white;
  padding:12px 20px;
  border-radius:6px;
  text-decoration:none;
  border:none;
  cursor:pointer;
  font-weight:600;
  font-size:0.95rem;
  transition:all 0.2s ease;
  box-shadow:0 2px 4px var(--shadow);
}

.boton:hover{
  background:var(--primary-hover);
  transform:translateY(-1px);
  box-shadow:0 4px 8px var(--shadow);
}

.boton.secondary{
  background:var(--bg-secondary);
  border:1px solid var(--border-medium);
  color:var(--text-primary);
  box-shadow:0 2px 4px var(--shadow);
}

.boton.secondary:hover{
  background:var(--bg-hover);
  border-color:var(--primary);
  color:var(--primary);
}

/* Tablas */
.tabla{
  width:100%;
  border-collapse:collapse;
  margin-top:16px;
  background:var(--bg-secondary);
  border-radius:12px;
  overflow:hidden;
  box-shadow:0 2px 8px var(--shadow);
  border:1px solid var(--border-light);
}

.tabla th, .tabla td{
  padding:16px 20px;
  border-bottom:1px solid var(--border-light);
  text-align:left;
}

.tabla thead th{
  color:white;
  font-size:0.9rem;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.05em;
  background:linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
}

.tabla tbody tr{
  transition:background 0.2s ease;
}

.tabla tbody tr:hover{
  background:var(--bg-hover);
}

/* Tarjetas */
.tarjeta{
  background:var(--bg-secondary);
  padding:24px;
  border-radius:12px;
  color:var(--text-primary);
  text-decoration:none;
  border:1px solid var(--border-light);
  transition:all 0.3s ease;
  box-shadow:0 2px 6px var(--shadow);
}

.tarjeta:hover{
  transform:translateY(-2px);
  box-shadow:0 6px 16px var(--shadow);
  border-color:var(--primary);
}

.tag{
  background:var(--bg-hover);
  padding:6px 12px;
  border-radius:6px;
  color:var(--text-secondary);
  font-size:0.85rem;
  font-weight:600;
}

footer.pie{
  padding:12px 24px;
  color:var(--text-secondary);
  text-align:center;
}

/* Formularios */
label{
  display:block;
  font-size:0.95rem;
  color:var(--text-primary);
  margin-bottom:8px;
  font-weight:600;
}

input[type=text], input[type=email], input[type=password], textarea, select{
  width:100%;
  padding:12px 16px;
  border-radius:6px;
  border:1px solid var(--border-medium);
  background:var(--bg-secondary);
  color:var(--text-primary);
  font-size:1rem;
  transition:all 0.2s ease;
}

input[type=text]:focus, input[type=email]:focus, input[type=password]:focus, textarea:focus, select:focus{
  outline:none;
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(0, 120, 212, 0.1);
}

/* Login */
.login-panel{
  max-width:520px;
  margin:48px auto;
  padding:40px;
  background:var(--bg-secondary);
  border-radius:12px;
  border:1px solid var(--border-light);
  box-shadow:0 8px 32px var(--shadow);
}

.login-panel h1{
  font-size:2rem;
  margin:0 0 16px;
  font-weight:700;
  color:var(--text-primary);
}

.mensaje.error{
  background:#fde7e9;
  color:var(--danger);
  padding:12px 16px;
  border-radius:6px;
  margin-bottom:16px;
  border-left:4px solid var(--danger);
  font-weight:500;
}

/* Header minimal */
.cabecera.cabecera--minimal .cabecera-inner{
  max-width:1400px;
  margin:0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 32px;
}

.cabecera--minimal .logo{
  font-weight:800;
  color:var(--primary);
  font-size:1.3rem;
  letter-spacing:-0.02em;
}

.cabecera--minimal .cabecera-actions .login{
  background:var(--primary);
  padding:10px 20px;
  border-radius:6px;
  color:white;
  text-decoration:none;
  font-weight:600;
  transition:all 0.2s ease;
  box-shadow:0 2px 4px var(--shadow);
}

.cabecera--minimal .cabecera-actions .login:hover{
  background:var(--primary-hover);
  transform:translateY(-1px);
  box-shadow:0 4px 8px var(--shadow);
}

/* Hero layout para login */
.hero-login{
  display:flex;
  gap:60px;
  align-items:center;
  justify-content:center;
  min-height:70vh;
  padding:60px 40px;
}

@media (max-width:900px){
  .hero-login{
    flex-direction:column;
    padding:32px 24px;
  }
}

.login-card{
  width:480px;
  background:var(--bg-secondary);
  padding:40px;
  border-radius:12px;
  box-shadow:0 8px 32px var(--shadow);
  border:1px solid var(--border-light);
}

.login-card h2{
  margin:0 0 8px;
  font-size:1.85rem;
  font-weight:700;
  color:var(--text-primary);
}

.login-card .subtitle{
  color:var(--text-secondary);
  margin-bottom:28px;
  font-size:1.05rem;
}

.hero-features{
  max-width:580px;
  color:var(--text-primary);
}

.hero-features h2{
  font-size:2.2rem;
  margin-bottom:24px;
  font-weight:700;
  line-height:1.2;
  color:var(--text-primary);
}

.hero-features ul{
  list-style:none;
  padding:0;
  margin:0;
}

.hero-features li{
  display:flex;
  align-items:flex-start;
  gap:16px;
  margin-bottom:20px;
  color:var(--text-primary);
}

.hero-features li .icon{
  width:48px;
  height:48px;
  border-radius:12px;
  background:linear-gradient(135deg, var(--primary), var(--primary-hover));
  display:flex;
  align-items:center;
  justify-content:center;
  color:white;
  font-size:1.3rem;
  flex-shrink:0;
  box-shadow:0 4px 12px var(--shadow);
}

/* ============================================
   RESPONSIVE - MÓVILES Y TABLETS
   ============================================ */

/* Tablets y pantallas medianas (hasta 1024px) */
@media (max-width: 1024px) {
  .contenido {
    padding: 24px 24px;
    margin: 24px auto;
  }
  
  .cabecera-inner {
    padding: 16px 24px;
  }
}

/* Tablets pequeñas (hasta 768px) */
@media (max-width: 768px) {
  body {
    font-size: 16px;
  }
  
  .cabecera {
    position: relative; /* No sticky en móvil */
  }
  
  .cabecera-inner {
    flex-direction: column;
    gap: 16px;
    padding: 16px 20px;
  }
  
  .nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    width: 100%;
  }
  
  .nav a {
    padding: 10px 14px;
    font-size: 0.9rem;
  }
  
  .contenido {
    padding: 20px 16px;
    margin: 16px auto;
  }
  
  /* Tablas responsivas */
  .tabla {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .tabla th,
  .tabla td {
    padding: 12px 14px;
    font-size: 0.9rem;
  }
  
  /* Login */
  .login-panel {
    padding: 28px 20px;
    margin: 24px 16px;
  }
  
  .login-card {
    width: 100%;
    padding: 28px 20px;
  }
  
  .hero-login {
    padding: 24px 16px;
    min-height: auto;
  }
  
  .hero-features h2 {
    font-size: 1.8rem;
  }
}

/* Móviles (hasta 480px) */
@media (max-width: 480px) {
  body {
    font-size: 15px;
  }
  
  .cabecera .logo {
    font-size: 1.2rem;
  }
  
  .cabecera-inner {
    padding: 12px 16px;
  }
  
  .nav {
    gap: 4px;
  }
  
  .nav a {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
  
  .contenido {
    padding: 16px 12px;
  }
  
  /* Botones */
  .boton {
    width: 100%;
    text-align: center;
    padding: 14px 16px;
  }
  
  /* Tablas - Vista de tarjetas en móvil */
  .tabla thead {
    display: none;
  }
  
  .tabla,
  .tabla tbody,
  .tabla tr,
  .tabla td {
    display: block;
  }
  
  .tabla tr {
    margin-bottom: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
  }
  
  .tabla td {
    border: none;
    padding: 8px 0;
    text-align: left;
    position: relative;
    padding-left: 50%;
  }
  
  .tabla td:before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    width: 45%;
    padding-right: 10px;
    font-weight: 700;
    color: var(--muted);
    font-size: 0.85rem;
  }
  
  /* Login móvil */
  .login-panel,
  .login-card {
    padding: 24px 16px;
    margin: 16px 12px;
    border-radius: 12px;
  }
  
  .login-panel h1,
  .login-card h2 {
    font-size: 1.6rem;
  }
  
  .hero-features {
    padding: 0 12px;
  }
  
  .hero-features h2 {
    font-size: 1.5rem;
  }
  
  .hero-features li {
    gap: 12px;
  }
  
  .hero-features li .icon {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }
  
  /* Formularios móvil */
  input[type=text],
  input[type=email],
  input[type=password],
  textarea,
  select {
    padding: 12px 14px;
    font-size: 16px; /* Evita zoom en iOS */
  }
}

/* Móviles muy pequeños (hasta 360px) */
@media (max-width: 360px) {
  .cabecera .logo {
    font-size: 1.1rem;
  }
  
  .nav a {
    padding: 7px 10px;
    font-size: 0.8rem;
  }
  
  .contenido {
    padding: 12px 8px;
  }
  
  .boton {
    padding: 12px 14px;
    font-size: 0.9rem;
  }
}
.hero-features li strong{
  display:block;
  margin-bottom:4px;
  font-size:1.1rem;
  color:var(--text-primary);
  font-weight:700;
}

/* Mejora inputs dentro del card */
.field-row{margin-bottom:20px}
.field-row input{padding:12px 16px;border-radius:6px;font-size:1rem}
.button-wide{display:block;width:100%;padding:16px;border-radius:8px;font-size:1.05rem;font-weight:700}

/* Ajustes del footer para login */
footer.pie{margin-top:40px}

/* =====================================================
   NAVEGADOR DE FECHAS CON FLECHAS (date-nav)
   Se aplica automáticamente a inputs con data-date-nav
   ===================================================== */
.date-navigator {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 3px;
    width: 100%;
}
.date-navigator input[type="date"],
.date-navigator input[type="month"] {
    flex: 1;
    min-width: 0;
}
.date-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}
.date-nav-btn:hover {
    background: var(--primary, #4a7c29);
    color: #fff;
    border-color: var(--primary, #4a7c29);
    transform: scale(1.08);
}
.date-nav-btn:active {
    transform: scale(0.93);
}

/* ============================================================
   MODO NOCHE (Dark Mode) - Global
   Se activa con body.dark-mode
   ============================================================ */

/* ── 1. VARIABLES OSCURAS ── */
body.dark-mode {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-hover: #334155;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-light: #64748b;
    --border-light: #334155;
    --border-medium: #475569;
    --shadow: rgba(0, 0, 0, 0.4);
    --bg: #0f172a;
    --bg-light: #334155;
    --panel: #1e293b;
    --accent: #3b82f6;
    --accent-2: #2563eb;
    --muted: #94a3b8;
    --white: #e2e8f0;
    --card: #1e293b;
    --border: #334155;
    --card-bg: #1e293b;
    --bg-main: #0f172a;
    --text: #e2e8f0;
    --surface: #1e293b;
    --surface-hover: #334155;
}

/* ── 2. CAPA BASE: colores de texto y fondo global ── */
body.dark-mode {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
}

/* ── 3. TIPOGRAFÍA: todos los textos legibles ── */
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3,
body.dark-mode h4, body.dark-mode h5, body.dark-mode h6 {
    color: #f1f5f9 !important;
}
body.dark-mode p, body.dark-mode span, body.dark-mode li,
body.dark-mode td, body.dark-mode th, body.dark-mode dt, body.dark-mode dd,
body.dark-mode div, body.dark-mode section, body.dark-mode article {
    color: #cbd5e1 !important;
}
body.dark-mode label, body.dark-mode legend, body.dark-mode small {
    color: #94a3b8 !important;
}
body.dark-mode strong, body.dark-mode b {
    color: #e2e8f0 !important;
}

/* ── 4. HEADER / NAV ── */
body.dark-mode .cabecera {
    background-color: #1e293b !important;
    border-bottom-color: #334155 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important;
}
body.dark-mode .cabecera .logo,
body.dark-mode .cabecera .logo span {
    color: #60a5fa !important;
}
body.dark-mode #headerFechaHora {
    color: #94a3b8 !important;
}
body.dark-mode .nav a {
    color: #94a3b8 !important;
}
body.dark-mode .nav a:hover {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
}
body.dark-mode .nav-user-btn {
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}
body.dark-mode .nav-user-dropdown {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5) !important;
}
body.dark-mode .nav-user-dropdown a {
    color: #e2e8f0 !important;
}
body.dark-mode .nav-user-dropdown a:hover {
    background-color: #334155 !important;
}

/* ── 5. CONTENIDO PRINCIPAL / SECCIONES ── */
body.dark-mode .contenido,
body.dark-mode section,
body.dark-mode .contenido > div {
    background-color: #0f172a !important;
}

/* ── 6. CARDS / PANELES / CONTENEDORES — todos los módulos ── */
body.dark-mode .card,
body.dark-mode .panel,
body.dark-mode .stat-card,
body.dark-mode .info-card,
body.dark-mode .detail-section,
body.dark-mode .resumen-banner,
body.dark-mode .resumen-section,
body.dark-mode .resumen-card,
body.dark-mode .filters-section,
body.dark-mode .filter-card,
body.dark-mode .table-container,
body.dark-mode .tabla-container,
body.dark-mode .table-responsive,
body.dark-mode .data-table-wrapper,
body.dark-mode .page-content,
/* Módulos específicos */
body.dark-mode .kpi-card,
body.dark-mode .chart-card,
body.dark-mode .sc-card,
body.dark-mode .rent-kpi-card,
body.dark-mode .rent-chart-card,
body.dark-mode .rent-tabla-container,
body.dark-mode .alerta-card,
body.dark-mode .log-item,
body.dark-mode .otc-card,
body.dark-mode .prox-card,
body.dark-mode .event-item,
body.dark-mode .rep-card,
body.dark-mode .seg-panel,
body.dark-mode .seg-filter-card,
body.dark-mode .seg-timeline-panel,
body.dark-mode .dt-panel,
body.dark-mode .dt-ot-card,
body.dark-mode .dt-detail-panel,
body.dark-mode .hist-event,
body.dark-mode .hist-pill,
body.dark-mode .hist-patron-card,
body.dark-mode .hist-keywords,
body.dark-mode .hist-chart-card,
body.dark-mode .cal-month-card,
body.dark-mode .cal-grid,
body.dark-mode .cal-day,
body.dark-mode .sidebar-section,
body.dark-mode .mapa-container,
body.dark-mode .pe-var-item,
body.dark-mode .pe-var-input,
body.dark-mode .profile-card,
body.dark-mode .upload-area,
body.dark-mode .presup-header-label,
body.dark-mode .presup-header-value,
body.dark-mode .detalle-gasto,
body.dark-mode .campo-input,
body.dark-mode .ot-detail-field,
body.dark-mode .resumen-card-body .field,
body.dark-mode .resumen-card-body .field-value,
body.dark-mode .totales-section,
body.dark-mode .detalles-table,
body.dark-mode .ordenes-trabajo-list,
body.dark-mode .cotizacion-number-section,
body.dark-mode .pag-btn {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* ── 7. FONDOS SECUNDARIOS (paneles internos, subgrupos) ── */
body.dark-mode .da-panel-header,
body.dark-mode .filtros-bar,
body.dark-mode .filter-group,
body.dark-mode .filter-compact,
body.dark-mode .filters-row,
body.dark-mode .action-bar,
body.dark-mode .bit-tabla-container,
body.dark-mode .cal-header-bar,
body.dark-mode .cal-day-header,
body.dark-mode .ot-section-header,
body.dark-mode .ot-campo,
body.dark-mode .ot-campo-input,
body.dark-mode .ot-detail-value,
body.dark-mode .campo-readonly,
body.dark-mode .hist-date-label,
body.dark-mode .hist-tab,
body.dark-mode .hist-bar-track,
body.dark-mode .profile-field,
body.dark-mode .pres-cat-header,
body.dark-mode .presup-header-row,
body.dark-mode .historial-trigger,
body.dark-mode .pe-toolbar,
body.dark-mode .pe-preview-section,
body.dark-mode .pe-vars-section,
body.dark-mode .pe-textarea,
body.dark-mode .modal-body-cal,
body.dark-mode .calc-tab,
body.dark-mode .calc-summary-row,
body.dark-mode .mat-cantidad-input,
body.dark-mode .mat-search-input,
body.dark-mode .modal-calc-body,
body.dark-mode .fc-empty,
body.dark-mode .region-item,
body.dark-mode .comuna-item,
body.dark-mode .item-field,
body.dark-mode .input-inline-cantidad,
body.dark-mode .input-inline-precio,
body.dark-mode .input-inline-descuento,
body.dark-mode .info-upload-area,
body.dark-mode .badge-container,
body.dark-mode .tab-content,
body.dark-mode .tabs {
    background-color: #162032 !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

/* ── 8. TABLAS ── */
body.dark-mode table {
    border-color: #334155 !important;
}
body.dark-mode thead,
body.dark-mode thead tr,
body.dark-mode thead th,
body.dark-mode .detalles-table thead th,
body.dark-mode .rent-tabla thead,
body.dark-mode .tabla-gastos thead,
body.dark-mode .tabla-sla thead,
body.dark-mode .tabla-mapa thead {
    background-color: #162032 !important;
    color: #94a3b8 !important;
    border-color: #334155 !important;
}
body.dark-mode tbody tr {
    background-color: transparent !important;
    border-color: #1e293b !important;
}
body.dark-mode tbody tr:nth-child(even) {
    background-color: rgba(30,41,59,0.5) !important;
}
body.dark-mode tbody tr:hover {
    background-color: rgba(59,130,246,0.08) !important;
}
body.dark-mode td {
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

/* DataTables */
body.dark-mode .dataTables_wrapper,
body.dark-mode .dataTables_length,
body.dark-mode .dataTables_filter,
body.dark-mode .dataTables_info,
body.dark-mode .dataTables_paginate {
    color: #94a3b8 !important;
}
body.dark-mode .dataTables_wrapper .dataTables_length select,
body.dark-mode .dataTables_wrapper .dataTables_filter input {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
body.dark-mode .dataTables_paginate .paginate_button {
    background-color: #1e293b !important;
    color: #94a3b8 !important;
    border-color: #475569 !important;
}
body.dark-mode .dataTables_paginate .paginate_button.current {
    background: #3b82f6 !important;
    color: #fff !important;
    border-color: #3b82f6 !important;
}
body.dark-mode .dataTables_paginate .paginate_button:hover {
    background-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* ── 9. FORMULARIOS ── */
body.dark-mode input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
body.dark-mode select,
body.dark-mode textarea {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
body.dark-mode input[type="checkbox"],
body.dark-mode input[type="radio"] {
    accent-color: #3b82f6;
}
body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
    color: #64748b !important;
}
body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15) !important;
}
body.dark-mode option {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

/* ── 10. BOTONES ── */
body.dark-mode .btn-success,
body.dark-mode .btn-primary,
body.dark-mode .btn-danger,
body.dark-mode .btn-warning,
body.dark-mode .btn-info {
    color: #fff !important;
}
body.dark-mode .btn-secondary,
body.dark-mode .btn.btn-secondary,
body.dark-mode .btn-volver,
body.dark-mode .bit-btn-volver,
body.dark-mode .rent-btn-volver,
body.dark-mode .btn-limpiar,
body.dark-mode .bit-btn-limpiar,
body.dark-mode .btn-cancelar,
body.dark-mode .btn-cancelar-cal,
body.dark-mode .btn-vista,
body.dark-mode .btn-nav,
body.dark-mode .hist-header-btn,
body.dark-mode .fc-btn.secondary,
body.dark-mode .fc-btn.icon,
body.dark-mode .pe-btn.secondary,
body.dark-mode .pe-card-actions button,
body.dark-mode .gonzurq-confirm__btn--cancel {
    background-color: #334155 !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
body.dark-mode .btn-secondary:hover,
body.dark-mode .btn-volver:hover,
body.dark-mode .btn-limpiar:hover,
body.dark-mode .btn-cancelar:hover {
    background-color: #475569 !important;
}

/* Tabs */
body.dark-mode .tab-btn,
body.dark-mode .view-tab,
body.dark-mode .seg-tab {
    background-color: #1e293b !important;
    color: #94a3b8 !important;
    border-color: #334155 !important;
}
body.dark-mode .tab-btn.active,
body.dark-mode .view-tab.active,
body.dark-mode .seg-tab.active {
    background-color: #3b82f6 !important;
    color: #fff !important;
    border-color: #3b82f6 !important;
}

/* ── 11. BADGES — mantener colores de fondo suaves en dark ── */
body.dark-mode [class*="badge"] {
    color: inherit !important;
}
body.dark-mode .badge-borrador,
body.dark-mode .badge-prioridad-baja,
body.dark-mode .badge-tipo,
body.dark-mode .badge-ver,
body.dark-mode .badge-listar,
body.dark-mode .cat-otro,
body.dark-mode .pe-badge.general,
body.dark-mode .pe-badge.inactiva,
body.dark-mode .seg-estado-badge.est-borrador,
body.dark-mode .seg-estado-badge.est-anulada,
body.dark-mode .session-status.cerrada,
body.dark-mode .badge-anulada {
    background-color: #334155 !important;
    color: #94a3b8 !important;
}
body.dark-mode .badge-pendiente,
body.dark-mode .badge-facturacion.pendiente {
    background-color: #78350f !important;
    color: #fcd34d !important;
}
body.dark-mode .badge-en-proceso,
body.dark-mode .badge-enviada,
body.dark-mode .badge-facturacion.oc_recibida {
    background-color: #1e3a5f !important;
    color: #60a5fa !important;
}
body.dark-mode .badge-completado,
body.dark-mode .badge-aprobada,
body.dark-mode .badge-facturacion.facturada,
body.dark-mode .badge-facturacion.pagada {
    background-color: #14532d !important;
    color: #4ade80 !important;
}
body.dark-mode .badge-cancelado,
body.dark-mode .badge-rechazada,
body.dark-mode .badge-vencida {
    background-color: #7f1d1d !important;
    color: #fca5a5 !important;
}
body.dark-mode .badge-facturacion.hes_recibida {
    background-color: #3b1f6e !important;
    color: #c4b5fd !important;
}

/* ── 12. STAT CARDS (cuadros de estadísticas con iconos) ── */
body.dark-mode .stat-card .stat-icon,
body.dark-mode .stats-grid .stat-card .stat-icon,
body.dark-mode [class*="stat-icon"] {
    opacity: 0.9;
}
body.dark-mode .stat-info h3,
body.dark-mode .stat-info p,
body.dark-mode .kpi-valor,
body.dark-mode .kpi-card h3,
body.dark-mode .rent-kpi-card h3,
body.dark-mode .sc-stat strong {
    color: #e2e8f0 !important;
}
body.dark-mode .kpi-label,
body.dark-mode .stat-info span,
body.dark-mode .kpi-card p,
body.dark-mode .rent-kpi-card p,
body.dark-mode .sc-stat span {
    color: #94a3b8 !important;
}

/* ── 13. MODALES ── */
body.dark-mode .modal,
body.dark-mode .modal-overlay {
    background-color: rgba(0,0,0,0.75) !important;
}
body.dark-mode .modal-content,
body.dark-mode .modal-dialog,
body.dark-mode .modal-gastos,
body.dark-mode .modal-body,
body.dark-mode .modal-header,
body.dark-mode .modal-footer,
body.dark-mode .modal-detalle,
body.dark-mode .modal-sla,
body.dark-mode .modal-pdf-preview-content,
body.dark-mode .cal-evento-modal,
body.dark-mode .cal-form-modal,
body.dark-mode .bit-modal,
body.dark-mode .prox-modal,
body.dark-mode .dt-form-modal,
body.dark-mode .presup-modal,
body.dark-mode .gonzurq-confirm-modal {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}
body.dark-mode .gonzurq-confirm__title {
    color: #f1f5f9 !important;
}
body.dark-mode .gonzurq-confirm__message {
    color: #94a3b8 !important;
}
body.dark-mode .gonzurq-confirm__icon--primary {
    background-color: #1e3a5f !important;
}
body.dark-mode .gonzurq-confirm__icon--danger {
    background-color: #7f1d1d !important;
}

/* ── 14. PAGINATION ── */
body.dark-mode .pagination a,
body.dark-mode .pagination span,
body.dark-mode .page-link {
    background-color: #1e293b !important;
    color: #94a3b8 !important;
    border-color: #475569 !important;
}
body.dark-mode .pagination .active,
body.dark-mode .pagination .active a,
body.dark-mode .page-link.active {
    background-color: #3b82f6 !important;
    color: #fff !important;
    border-color: #3b82f6 !important;
}
/* Cotizaciones pagination */
body.dark-mode .paginacion-container,
body.dark-mode .paginacion-top,
body.dark-mode .paginacion-bottom {
    background: #1e293b !important;
    border-color: #334155 !important;
}
body.dark-mode .paginacion-info,
body.dark-mode .paginacion-texto {
    color: #94a3b8 !important;
}
body.dark-mode .paginacion-info select {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
body.dark-mode .btn-pag {
    background: #0f172a !important;
    color: #94a3b8 !important;
    border-color: #475569 !important;
}
body.dark-mode .btn-pag:hover:not(.disabled):not(.active) {
    background: #334155 !important;
    color: #e2e8f0 !important;
    border-color: #3b82f6 !important;
}
body.dark-mode .btn-pag.active {
    background: #3b82f6 !important;
    color: #fff !important;
    border-color: #3b82f6 !important;
}
body.dark-mode .btn-pag.disabled {
    background: #1e293b !important;
    opacity: 0.4;
}
body.dark-mode .pag-ellipsis {
    color: #64748b !important;
}
body.dark-mode .filters-section-compact {
    background: transparent !important;
}
body.dark-mode .btn-compact {
    border-color: #475569 !important;
}
body.dark-mode .filtro-ot-textarea:focus {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 2px 8px rgba(59,130,246,0.2) !important;
}
body.dark-mode .data-table tbody tr:hover {
    background: rgba(59,130,246,0.08) !important;
    box-shadow: none !important;
}

/* ── 15. LINKS ── */
body.dark-mode a:not(.btn):not(.nav a):not(.btn-dark-toggle) {
    color: #60a5fa !important;
}
body.dark-mode .nav a {
    color: #94a3b8 !important;
}

/* ── 16. TOAST / NOTIFICACIONES ── */
body.dark-mode .gonzurq-toast {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4) !important;
}
body.dark-mode .gonzurq-toast__title {
    color: #f1f5f9 !important;
}
body.dark-mode .gonzurq-toast__message {
    color: #94a3b8 !important;
}
body.dark-mode .gonzurq-toast__close:hover {
    background-color: #334155 !important;
}
body.dark-mode .notif-dropdown {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}
body.dark-mode .notif-dropdown::before {
    background-color: #1e293b !important;
}
body.dark-mode .notif-dropdown-header {
    background: #162032 !important;
    border-color: #334155 !important;
}
body.dark-mode .notif-dropdown-header h4 {
    color: #f1f5f9 !important;
}
body.dark-mode .notif-item {
    border-color: #334155 !important;
}
body.dark-mode .notif-item:hover {
    background-color: #162032 !important;
}
body.dark-mode .notif-item.notif-no-leida {
    background: rgba(59,130,246,0.08) !important;
}
body.dark-mode .notif-titulo {
    color: #e2e8f0 !important;
}
body.dark-mode .notif-ref {
    background-color: #334155 !important;
    color: #94a3b8 !important;
}
body.dark-mode .notif-dropdown-footer {
    background-color: #162032 !important;
    border-color: #334155 !important;
}
body.dark-mode .notif-toast {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}
body.dark-mode .notif-toast-title {
    color: #f1f5f9 !important;
}

/* ── 17. CHAT WIDGET ── */
body.dark-mode .cw-panel {
    background-color: #1e293b !important;
}
body.dark-mode .cw-conv-list {
    background-color: #162032 !important;
}
body.dark-mode .cw-conv-item:hover,
body.dark-mode .cw-user-item:hover,
body.dark-mode .cw-chat-back:hover,
body.dark-mode .cw-chat-expand:hover {
    background-color: #334155 !important;
}
body.dark-mode .cw-chat-area {
    background-color: #0f172a !important;
}
body.dark-mode .cw-msg-bubble {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}
body.dark-mode .cw-input-area {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}
body.dark-mode .cw-input-field {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
}
body.dark-mode .cw-user-modal {
    background-color: #1e293b !important;
}

/* ── 18. DATE NAVIGATOR ── */
body.dark-mode .date-nav-btn {
    background-color: #1e293b !important;
    border-color: #475569 !important;
    color: #94a3b8 !important;
}
body.dark-mode .date-nav-btn:hover {
    background-color: #3b82f6 !important;
    color: #fff !important;
    border-color: #3b82f6 !important;
}

/* ── 19. GRÁFICOS (barras de progreso, etc.) ── */
body.dark-mode .tecnico-barra-container,
body.dark-mode .mini-rank-bar-wrap,
body.dark-mode .suc-rank-barra-container {
    background-color: #334155 !important;
}
body.dark-mode .suc-rank-num {
    background-color: #334155 !important;
    color: #94a3b8 !important;
}

/* ── 20. HISTORIAL SUCURSAL pills activos ── */
body.dark-mode .hist-pill.active {
    background-color: #1e3a5f !important;
    color: #60a5fa !important;
}
body.dark-mode .pill-ot.active {
    background-color: #78350f !important;
    color: #fbbf24 !important;
}
body.dark-mode .pill-cot.active {
    background-color: #14532d !important;
    color: #4ade80 !important;
}
body.dark-mode .pill-fact.active {
    background-color: #3b1f6e !important;
    color: #c4b5fd !important;
}

/* ── 21. FOOTER ── */
body.dark-mode .pie {
    background-color: #0f172a !important;
    color: #64748b !important;
    border-top-color: #334155 !important;
}

/* ── 22. MEGA-CATCH: todo lo que se nos escape ── */
/* Atrapar fondos blancos/claros que no tienen clase específica */
body.dark-mode [style*="background: white"],
body.dark-mode [style*="background-color: white"],
body.dark-mode [style*="background: #fff"],
body.dark-mode [style*="background-color: #fff"],
body.dark-mode [style*="background: rgb(255"],
body.dark-mode [style*="background-color: rgb(255"],
body.dark-mode [style*="background:#fff"],
body.dark-mode [style*="background-color:#fff"],
body.dark-mode [style*="background: #f5f7fa"],
body.dark-mode [style*="background:#f5f7fa"],
body.dark-mode [style*="background: #f8f9fa"],
body.dark-mode [style*="background:#f8f9fa"] {
    background-color: #1e293b !important;
}
/* Atrapar textos oscuros inline */
body.dark-mode [style*="color: #333"],
body.dark-mode [style*="color:#333"],
body.dark-mode [style*="color: #1e293b"],
body.dark-mode [style*="color:#1e293b"],
body.dark-mode [style*="color: #323130"],
body.dark-mode [style*="color:#323130"],
body.dark-mode [style*="color: black"],
body.dark-mode [style*="color:black"] {
    color: #e2e8f0 !important;
}

/* ── 23. BORDERS GLOBALES ── */
body.dark-mode hr {
    border-color: #334155 !important;
}
body.dark-mode [style*="border"] {
    border-color: #334155 !important;
}

/* ── 24. SCROLLBAR ── */
body.dark-mode ::-webkit-scrollbar { width: 8px; height: 8px; }
body.dark-mode ::-webkit-scrollbar-track { background: #0f172a; }
body.dark-mode ::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }
body.dark-mode ::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* ── 25. CATCH-ALL: <style> embebidos en PHP con fondos claros ── */
/* Estos selectores cubren estilos definidos en <style> tags dentro de archivos PHP */
/* que usan background:white, #fff, #f8f9fa, etc. sin clases específicas */
body.dark-mode div,
body.dark-mode article,
body.dark-mode aside,
body.dark-mode main,
body.dark-mode header:not(.cabecera),
body.dark-mode footer:not(.pie),
body.dark-mode fieldset,
body.dark-mode details,
body.dark-mode summary,
body.dark-mode figure {
    border-color: #334155 !important;
}

/* Portal, correo, contratos, QR, análisis — módulos con <style> embebido */
body.dark-mode .portal-card,
body.dark-mode .portal-nav,
body.dark-mode .portal-sidebar,
body.dark-mode .mail-panel,
body.dark-mode .mail-list,
body.dark-mode .mail-item,
body.dark-mode .mail-content,
body.dark-mode .mail-compose,
body.dark-mode .contrato-card,
body.dark-mode .contrato-header,
body.dark-mode .contrato-body,
body.dark-mode .contrato-section,
body.dark-mode .qr-card,
body.dark-mode .deuda-card,
body.dark-mode .deuda-panel,
body.dark-mode .deuda-resumen,
body.dark-mode .form-card,
body.dark-mode .form-section,
body.dark-mode .form-group,
body.dark-mode .search-box,
body.dark-mode .autocomplete-dropdown,
body.dark-mode .dropdown-menu,
body.dark-mode .popup,
body.dark-mode .tooltip-content,
body.dark-mode .popover {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* Iconos de Font Awesome — mantener su color heredado */
body.dark-mode i.fa,
body.dark-mode i.fas,
body.dark-mode i.far,
body.dark-mode i.fab,
body.dark-mode i[class*="fa-"] {
    color: inherit !important;
}

/* Emision SII y módulos con muchos inline styles */
body.dark-mode .sii-panel,
body.dark-mode .sii-folio-card,
body.dark-mode .sii-resultado,
body.dark-mode .emisor-card,
body.dark-mode .receptor-card,
body.dark-mode .detalle-card,
body.dark-mode .preview-card,
body.dark-mode .acciones-card {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

/* Box-shadows en dark */
body.dark-mode [class*="card"],
body.dark-mode [class*="panel"],
body.dark-mode [class*="modal"] {
    box-shadow: 0 4px 16px rgba(0,0,0,0.3) !important;
}

/* ── 26. IMÁGENES Y ELEMENTOS MULTIMEDIA — no tocar ── */
body.dark-mode img,
body.dark-mode video,
body.dark-mode canvas,
body.dark-mode svg,
body.dark-mode iframe {
    color: inherit !important;
}

/* ── 27. TRANSICIONES SUAVES ── */
body,
body .cabecera,
body .contenido,
body .card,
body .stat-card,
body .kpi-card,
body input,
body select,
body textarea,
body table,
body .modal-content,
body .nav a {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ── 28. BOTÓN TOGGLE TEMA EN HEADER ── */
.btn-dark-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border-medium, #d2d0ce);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary, #605e5c);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.btn-dark-toggle:hover {
    background: var(--bg-hover, #e8ecf2);
    color: var(--text-primary, #323130);
    border-color: var(--primary, #0078d4);
}
.btn-dark-toggle .toggle-icon {
    font-size: 1rem;
    line-height: 1;
}
body.dark-mode .btn-dark-toggle {
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}
body.dark-mode .btn-dark-toggle:hover {
    background-color: #334155 !important;
    border-color: #60a5fa !important;
}

/* ══════════════════════════════════════════════════════════
   29. ORDENES DE TRABAJO – DARK MODE COMPLETO
   Cubre: Edit OT, PDF Firmado, Email, Costeo modals
   ══════════════════════════════════════════════════════════ */

/* --- Tipo de Documento selector cards --- */
body.dark-mode .tipo-doc-card {
    background: #1e293b !important;
    border-color: #475569 !important;
}
body.dark-mode .tipo-doc-card:hover {
    background: #334155 !important;
    border-color: #64748b !important;
}
body.dark-mode .tipo-doc-card.selected-ot {
    background: #064e3b !important;
    border-color: #10b981 !important;
    box-shadow: 0 0 0 1px #10b981 !important;
}
body.dark-mode .tipo-doc-card.selected-ot .tipo-doc-icon-ot {
    background: #10b981 !important;
    color: white !important;
}
body.dark-mode .tipo-doc-card.selected-ot .tipo-doc-check {
    color: #10b981 !important;
}
body.dark-mode .tipo-doc-card.selected-iv {
    background: #1e3a5f !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 1px #3b82f6 !important;
}
body.dark-mode .tipo-doc-card.selected-iv .tipo-doc-icon-iv {
    background: #3b82f6 !important;
    color: white !important;
}
body.dark-mode .tipo-doc-card.selected-iv .tipo-doc-check {
    color: #3b82f6 !important;
}
body.dark-mode .tipo-doc-icon-ot {
    background: #064e3b !important;
    color: #34d399 !important;
}
body.dark-mode .tipo-doc-icon-iv {
    background: #1e3a5f !important;
    color: #60a5fa !important;
}
body.dark-mode .tipo-doc-label {
    color: #e2e8f0 !important;
}
body.dark-mode .tipo-doc-desc {
    color: #64748b !important;
}
body.dark-mode .tipo-doc-check {
    color: #475569 !important;
}

/* --- Form sections y controles dentro de modales OT --- */
body.dark-mode .form-section {
    background: #0f172a !important;
    border-color: #334155 !important;
}
body.dark-mode .form-section h3 {
    color: #e2e8f0 !important;
    border-bottom-color: #3b82f6 !important;
}
body.dark-mode .form-control {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
body.dark-mode .form-control:focus {
    background: #1e293b !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2) !important;
}

/* --- Botones motivo preset --- */
body.dark-mode .btn-motivo-preset {
    background: #1e293b !important;
    border-color: #475569 !important;
    color: #94a3b8 !important;
}
body.dark-mode .btn-motivo-preset:hover {
    background: #334155 !important;
    color: #e2e8f0 !important;
    border-color: #64748b !important;
}

/* --- Filtros compactos en OT --- */
body.dark-mode .filter-compact input:focus,
body.dark-mode .filter-compact select:focus,
body.dark-mode .filter-compact input:hover,
body.dark-mode .filter-compact select:hover {
    background: #1e293b !important;
}

/* --- Materiales e historial --- */
body.dark-mode .material-item {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
body.dark-mode .material-item:hover {
    border-color: #3b82f6 !important;
    box-shadow: 0 2px 8px rgba(59,130,246,0.15) !important;
}
body.dark-mode .material-item input[type="number"] {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
body.dark-mode .historial-item {
    background: #0f172a !important;
    border-left-color: #3b82f6 !important;
    color: #e2e8f0 !important;
}
body.dark-mode .historial-item:hover {
    background: #1e293b !important;
}
body.dark-mode .historial-usuario {
    color: #e2e8f0 !important;
}

/* --- Badges estados --- */
body.dark-mode .badge-pendiente {
    background: #422006 !important;
    color: #fbbf24 !important;
    border-color: #92400e !important;
}
body.dark-mode .badge-en-proceso {
    background: #1e3a5f !important;
    color: #60a5fa !important;
    border-color: #2563eb !important;
}
body.dark-mode .badge-completado {
    background: #064e3b !important;
    color: #34d399 !important;
    border-color: #059669 !important;
}
body.dark-mode .badge-cancelado {
    background: #7f1d1d !important;
    color: #fca5a5 !important;
    border-color: #dc2626 !important;
}
body.dark-mode .badge-prioridad-baja {
    background: #334155 !important;
    color: #94a3b8 !important;
    border-color: #475569 !important;
}
body.dark-mode .badge-prioridad-media {
    background: #422006 !important;
    color: #fbbf24 !important;
    border-color: #92400e !important;
}
body.dark-mode .badge-prioridad-alta {
    background: #7f1d1d !important;
    color: #fca5a5 !important;
    border-color: #dc2626 !important;
}
body.dark-mode .badge-prioridad-urgente {
    background: #7f1d1d !important;
    color: #fca5a5 !important;
    border-color: #ef4444 !important;
}

/* --- Productos disponibles en modal materiales --- */
body.dark-mode #modalMaterial #productos_disponibles {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
body.dark-mode #modalMaterial #productos_disponibles .producto-item {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-bottom-color: #334155 !important;
}
body.dark-mode #modalMaterial #productos_disponibles .producto-item:hover {
    background: #1e3a5f !important;
    color: #93c5fd !important;
}

/* --- Selector de productos — labels dentro de modal --- */
body.dark-mode .modal label {
    color: #94a3b8 !important;
}

/* ── 30. MODAL PDF FIRMADO – DARK MODE ── */
body.dark-mode .modal-pdf-upload .upload-zone {
    background: #0f172a !important;
    border-color: #475569 !important;
}
body.dark-mode .modal-pdf-upload .upload-zone:hover,
body.dark-mode .modal-pdf-upload .upload-zone.dragover {
    background: #1e3a5f !important;
    border-color: #3b82f6 !important;
}
body.dark-mode .modal-pdf-upload .upload-zone .upload-icon {
    color: #64748b !important;
}
body.dark-mode .modal-pdf-upload .upload-zone:hover .upload-icon {
    color: #60a5fa !important;
}
body.dark-mode .modal-pdf-upload .upload-zone p {
    color: #94a3b8 !important;
}
body.dark-mode .modal-pdf-upload .pdf-preview {
    background: #064e3b !important;
    border-color: #065f46 !important;
}
body.dark-mode .modal-pdf-upload .pdf-preview .pdf-name {
    color: #e2e8f0 !important;
}
body.dark-mode .modal-pdf-upload .pdf-preview .pdf-size {
    color: #94a3b8 !important;
}
body.dark-mode .modal-pdf-upload .current-pdf {
    background: #1e3a5f !important;
    border-color: #2563eb !important;
}
/* Info bar dentro de PDF modal (inline style bg:#f1f5f9) */
body.dark-mode #modalPdfFirmado [style*="background: #f1f5f9"],
body.dark-mode #modalPdfFirmado [style*="background:#f1f5f9"] {
    background: #0f172a !important;
    border-color: #334155 !important;
}

/* ── 31. MODAL EMAIL OT + REPORTE – DARK MODE ── */
body.dark-mode #modalEmailOT .modal-body,
body.dark-mode #modalEmailReporte .modal-body {
    background: #1e293b !important;
}
/* Listas de contactos / usuarios */
body.dark-mode #emailOT_contactos,
body.dark-mode #emailOT_internos,
body.dark-mode #rptEmailContactos,
body.dark-mode #rptEmailUsuarios {
    border-color: #475569 !important;
    background: #0f172a !important;
}
/* Inputs y textareas dentro de modales email */
body.dark-mode #modalEmailOT input[type="text"],
body.dark-mode #modalEmailOT input[type="email"],
body.dark-mode #modalEmailOT textarea,
body.dark-mode #modalEmailReporte input[type="text"],
body.dark-mode #modalEmailReporte textarea {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
/* Chips de email */
body.dark-mode #emailOT_chips_para .email-chip,
body.dark-mode #emailOT_chips_cc .email-chip,
body.dark-mode .email-chip {
    background: #334155 !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
/* Area adjuntar PDF (inline bg:#f0f9ff) */
body.dark-mode #modalEmailOT [style*="background: #f0f9ff"],
body.dark-mode #modalEmailOT [style*="background:#f0f9ff"] {
    background: #1e3a5f !important;
    border-color: #2563eb !important;
}
/* Footer de modales con inline background #f8fafc */
body.dark-mode .modal-footer[style*="background"],
body.dark-mode .modal .modal-footer {
    background: #0f172a !important;
    border-top-color: #334155 !important;
}
/* Labels y radios en Email Reporte */
body.dark-mode #modalEmailReporte label {
    color: #94a3b8 !important;
}
/* Status text */
body.dark-mode #emailOT_status,
body.dark-mode #rptEmailStatus {
    color: #64748b !important;
}

/* ── 32. MODAL COSTEO (inyectado por js/costeo_ot.js) ── */
body.dark-mode .modal-costeo-content {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}
body.dark-mode .modal-costeo-body {
    background: #1e293b !important;
}
body.dark-mode .costeo-tab {
    background: #0f172a !important;
    color: #94a3b8 !important;
    border-color: #475569 !important;
}
body.dark-mode .costeo-tab:hover {
    background: #334155 !important;
    color: #e2e8f0 !important;
}
body.dark-mode .costeo-tab.active {
    background: #2563eb !important;
    color: white !important;
    border-color: #2563eb !important;
}
body.dark-mode .costeo-form {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
}
body.dark-mode .costeo-form h4 {
    color: #e2e8f0 !important;
}
body.dark-mode .costeo-form .form-group label {
    color: #94a3b8 !important;
}
body.dark-mode .costeo-form .form-group input,
body.dark-mode .costeo-form .form-group select {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
body.dark-mode .costeo-list {
    border-color: #475569 !important;
    background: #0f172a !important;
}
body.dark-mode .costeo-list-item {
    border-bottom-color: #334155 !important;
    color: #e2e8f0 !important;
}
body.dark-mode .costeo-list-item .info small {
    color: #64748b !important;
}
body.dark-mode .costeo-list-item .delete-btn {
    background: #7f1d1d !important;
    color: #fca5a5 !important;
}
body.dark-mode .costeo-total {
    background: #1e3a5f !important;
    color: #93c5fd !important;
}
body.dark-mode .costeo-card {
    background: #0f172a !important;
    color: #e2e8f0 !important;
}
body.dark-mode .costeo-card h5 {
    color: #94a3b8 !important;
}
body.dark-mode .costeo-card .amount {
    color: #e2e8f0 !important;
}
body.dark-mode .costeo-card .detail {
    color: #64748b !important;
}
body.dark-mode .costeo-card.total {
    background: #2563eb !important;
    color: white !important;
}
body.dark-mode .costeo-card.total h5,
body.dark-mode .costeo-card.total .amount,
body.dark-mode .costeo-card.total .detail {
    color: white !important;
}
body.dark-mode .loading {
    color: #64748b !important;
}

/* ── 33. CATCH-ALL INLINE STYLES en modales OT ── */
/* Divs con border inline #e2e8f0 dentro de modales */
body.dark-mode .modal [style*="border: 1px solid #e2e8f0"],
body.dark-mode .modal [style*="border:1px solid #e2e8f0"] {
    border-color: #475569 !important;
}
body.dark-mode .modal [style*="border: 2px solid"],
body.dark-mode .modal [style*="border:2px solid"] {
    border-color: #475569 !important;
}
body.dark-mode .modal [style*="border: 1px solid #cbd5e1"],
body.dark-mode .modal [style*="border:1px solid #cbd5e1"] {
    border-color: #475569 !important;
}
/* Inputs con border inline */
body.dark-mode .modal input[style*="border"],
body.dark-mode .modal textarea[style*="border"],
body.dark-mode .modal select[style*="border"] {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
/* Footers con background inline */
body.dark-mode .modal [style*="background: #f8fafc"],
body.dark-mode .modal [style*="background:#f8fafc"],
body.dark-mode .modal [style*="background: #f8f9fa"],
body.dark-mode .modal [style*="background:#f8f9fa"],
body.dark-mode .modal [style*="background: #f1f5f9"],
body.dark-mode .modal [style*="background:#f1f5f9"] {
    background-color: #0f172a !important;
}

/* ── 34. OT APP BACKGROUND & PAGE-LEVEL ── */
body.dark-mode .page-header {
    background: #1e293b !important;
    border-color: #334155 !important;
}
body.dark-mode .container,
body.dark-mode .container-fluid,
body.dark-mode main,
body.dark-mode .main-content,
body.dark-mode #wrapper {
    background: #0f172a !important;
}
/* Stats grid y dashboard analytics */
body.dark-mode .da-panel {
    background: #1e293b !important;
    border-color: #334155 !important;
}
body.dark-mode .da-panel-header {
    background: #0f172a !important;
    border-bottom-color: #334155 !important;
}
body.dark-mode .da-panel-header h4 {
    color: #e2e8f0 !important;
}
body.dark-mode .da-panel-body {
    background: #1e293b !important;
}
body.dark-mode .tecnico-card {
    background: #0f172a !important;
    border-color: #334155 !important;
}
body.dark-mode .tecnico-card:hover {
    border-color: #3b82f6 !important;
}
body.dark-mode .btn-toggle-tecnicos {
    border-color: #475569 !important;
    color: #94a3b8 !important;
}
body.dark-mode .btn-toggle-tecnicos:hover {
    background: #334155 !important;
    color: #60a5fa !important;
}
body.dark-mode .stat-card {
    background: #1e293b !important;
    border-color: #334155 !important;
}
body.dark-mode .stat-card:hover {
    border-color: #3b82f6 !important;
}
body.dark-mode .stat-info h3 {
    color: #e2e8f0 !important;
}
body.dark-mode .stat-info p {
    color: #94a3b8 !important;
}
/* Table OT header y body */
body.dark-mode .table-responsive {
    background: #1e293b !important;
    border-color: #334155 !important;
}
body.dark-mode .table-responsive table thead th {
    background: #0f172a !important;
    color: #94a3b8 !important;
    border-color: #334155 !important;
}
body.dark-mode .table-responsive table tbody td {
    border-color: #334155 !important;
}
body.dark-mode .table-responsive table tbody tr:hover td {
    background: #334155 !important;
}

/* ── 35. GENÉRICO: select, input, textarea dentro de .modal --- */
body.dark-mode .modal select,
body.dark-mode .modal input:not([type="radio"]):not([type="checkbox"]):not([type="file"]):not([type="hidden"]),
body.dark-mode .modal textarea {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
body.dark-mode .modal select option {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

/* ── 36. PAGINACIÓN OT (inline styles) ── */
body.dark-mode #paginacionSuperior,
body.dark-mode #paginacionInferior,
body.dark-mode .paginacion-desktop {
    background: #1e293b !important;
    border-color: #334155 !important;
}
body.dark-mode #paginacionSuperior select,
body.dark-mode #paginacionInferior select,
body.dark-mode #registrosPorPaginaOT,
body.dark-mode #registrosPorPaginaOT_bottom {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
/* Paginacion buttons generados por JS */
body.dark-mode .paginacion-desktop button,
body.dark-mode .paginacion-mobile button {
    background: #1e293b !important;
    color: #94a3b8 !important;
    border-color: #475569 !important;
}
body.dark-mode .paginacion-desktop button:hover,
body.dark-mode .paginacion-mobile button:hover {
    background: #334155 !important;
    color: #e2e8f0 !important;
}
body.dark-mode .paginacion-desktop button.active,
body.dark-mode .paginacion-mobile button.active,
body.dark-mode .paginacion-desktop button[style*="background: #0078d4"],
body.dark-mode .paginacion-desktop button[style*="background:#0078d4"] {
    background: #2563eb !important;
    color: white !important;
    border-color: #2563eb !important;
}

/* ── 37. MODAL DETALLE OT + CATCH-ALL INLINE OVERRIDES ── */
body.dark-mode .modal [style*="background: #f8fafc"],
body.dark-mode .modal [style*="background:#f8fafc"],
body.dark-mode .modal [style*="background: white"],
body.dark-mode .modal [style*="background:white"] {
    background: #0f172a !important;
}
body.dark-mode .modal [style*="background: #f0f9ff"],
body.dark-mode .modal [style*="background:#f0f9ff"] {
    background: #1e3a5f !important;
}
body.dark-mode .modal [style*="color: #1e293b"],
body.dark-mode .modal [style*="color:#1e293b"] {
    color: #e2e8f0 !important;
}
body.dark-mode .modal [style*="color: #334155"],
body.dark-mode .modal [style*="color:#334155"] {
    color: #94a3b8 !important;
}
body.dark-mode .modal [style*="color: #64748b"],
body.dark-mode .modal [style*="color:#64748b"] {
    color: #64748b !important;
}
body.dark-mode .modal [style*="color: #0369a1"],
body.dark-mode .modal [style*="color:#0369a1"] {
    color: #60a5fa !important;
}
body.dark-mode .modal [style*="border-bottom: 1px solid #e2e8f0"],
body.dark-mode .modal [style*="border-bottom:1px solid #e2e8f0"],
body.dark-mode .modal [style*="border-top: 1px solid #e2e8f0"],
body.dark-mode .modal [style*="border-top:1px solid #e2e8f0"] {
    border-color: #334155 !important;
}
/* Info sections in modals with light blue bg */
body.dark-mode .modal [style*="border: 1px solid #bae6fd"],
body.dark-mode .modal [style*="border:1px solid #bae6fd"] {
    border-color: #2563eb !important;
    background: #1e3a5f !important;
}
/* Detalle row styling */
body.dark-mode .detalle-row {
    border-color: #334155 !important;
}
body.dark-mode .detalle-label {
    color: #94a3b8 !important;
}
body.dark-mode .detalle-value {
    color: #e2e8f0 !important;
}
body.dark-mode .detalle-descripcion {
    color: #cbd5e1 !important;
    background: #0f172a !important;
}

/* ── 38. MODAL ENTREGA OTs (todo inline, sin clase .modal) ── */
body.dark-mode #modalEntregaOTs > div {
    background: #1e293b !important;
}
body.dark-mode #modalEntregaOTs [style*="background:#fffbeb"],
body.dark-mode #modalEntregaOTs [style*="background: #fffbeb"] {
    background: #1c1917 !important;
    border-color: #78350f !important;
}
body.dark-mode #modalEntregaOTs [style*="color:#92400e"],
body.dark-mode #modalEntregaOTs [style*="color: #92400e"] {
    color: #fbbf24 !important;
}
body.dark-mode #modalEntregaOTs select,
body.dark-mode #modalEntregaOTs input,
body.dark-mode #modalEntregaOTs textarea {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}
body.dark-mode #modalEntregaOTs [style*="background:#fff"],
body.dark-mode #modalEntregaOTs [style*="background: #fff"],
body.dark-mode #modalEntregaOTs [style*="background:white"],
body.dark-mode #modalEntregaOTs [style*="background: white"] {
    background: #0f172a !important;
    color: #e2e8f0 !important;
}
body.dark-mode #modalEntregaOTs [style*="background:#f8fafc"],
body.dark-mode #modalEntregaOTs [style*="background: #f8fafc"],
body.dark-mode #modalEntregaOTs [style*="background:#f1f5f9"],
body.dark-mode #modalEntregaOTs [style*="background: #f1f5f9"] {
    background: #0f172a !important;
    border-color: #334155 !important;
}
body.dark-mode #modalEntregaOTs table thead tr,
body.dark-mode #modalEntregaOTs [style*="background:#f1f5f9"] {
    background: #0f172a !important;
}
body.dark-mode #modalEntregaOTs table thead th {
    color: #94a3b8 !important;
    border-bottom-color: #475569 !important;
}
body.dark-mode #modalEntregaOTs table tbody td {
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}
body.dark-mode #modalEntregaOTs .btn-filtro-rapido,
body.dark-mode #modalEntregaOTs button[style*="background:#f8fafc"],
body.dark-mode #modalEntregaOTs button[style*="background: #f8fafc"] {
    background: #1e293b !important;
    color: #94a3b8 !important;
    border-color: #475569 !important;
}
body.dark-mode #modalEntregaOTs button[style*="background:#f0fdf4"],
body.dark-mode #modalEntregaOTs button[style*="background: #f0fdf4"] {
    background: #064e3b !important;
    color: #34d399 !important;
    border-color: #065f46 !important;
}
body.dark-mode #modalEntregaOTs button[style*="background:#fef2f2"],
body.dark-mode #modalEntregaOTs button[style*="background: #fef2f2"] {
    background: #7f1d1d !important;
    color: #fca5a5 !important;
    border-color: #991b1b !important;
}
body.dark-mode #modalEntregaOTs [style*="border-bottom:1px solid #f1f5f9"],
body.dark-mode #modalEntregaOTs [style*="border-bottom: 1px solid #f1f5f9"] {
    border-color: #334155 !important;
}
/* Dropdown multiselect */
body.dark-mode #ccLocalDropdown,
body.dark-mode #ccClientesDropdown {
    background: #1e293b !important;
    border-color: #475569 !important;
}
body.dark-mode #ccLocalDropdown input,
body.dark-mode #ccClientesDropdown input {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #475569 !important;
}