:root {
  /* Colores principales - Paleta premium */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #8b5cf6;
  --accent: #ec4899;

  /* Grises */
  --bg-dark: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  /* Fondo app */
  --bg-gradient-end: #1a1f35;

  /* Estados */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);

  /* Espaciado */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;

  /* Bordes */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Transiciones */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tema claro (override de variables) */
html.theme-light {
  --bg-dark: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --bg-gradient-end: #eef2ff;
}

/* Reset y base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-gradient-end) 100%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Botón de tema (abajo-izquierda) */
.theme-toggle {
  position: fixed;
  left: var(--spacing-lg);
  bottom: var(--spacing-lg);
  z-index: 10000;
  padding: 0.65rem 0.75rem;
  border-radius: 999px;
  min-width: 44px;
  justify-content: center;
}

/* Cuando el toggle vive en el sidebar (encima de Cerrar Sesión) */
.theme-toggle.theme-toggle--sidebar {
  position: static;
  left: auto;
  bottom: auto;
  z-index: auto;
  min-width: auto;
  border-radius: var(--radius-md);
  justify-content: center;
}

/* Ajustes visuales en tema claro para reglas con rgba hardcodeado */
html.theme-light .sidebar {
  border-right: 1px solid rgba(15, 23, 42, 0.08);
}

html.theme-light .sidebar-header {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

html.theme-light .card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: var(--shadow-md);
}

html.theme-light .card-header {
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}

html.theme-light .stat-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: var(--shadow-sm);
}

html.theme-light .stat-value {
  color: var(--primary-dark);
}

html.theme-light .btn-secondary {
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(15, 23, 42, 0.15);
  color: var(--text-primary);
}

html.theme-light .btn-secondary:hover {
  background: rgba(15, 23, 42, 0.08);
}

html.theme-light .form-control,
html.theme-light .form-select {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.12);
  color: var(--text-primary);
}

html.theme-light .form-control:focus,
html.theme-light .form-select:focus {
  background: #ffffff;
}

html.theme-light .form-select option {
  background: #ffffff;
  color: var(--text-primary);
}

html.theme-light .modal-content {
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: var(--shadow-xl);
}

html.theme-light .table-container {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(15, 23, 42, 0.1);
}

html.theme-light th,
html.theme-light td {
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}

html.theme-light th {
  color: var(--text-secondary);
  background: rgba(15, 23, 42, 0.03);
}

html.theme-light .menu-link:hover {
  background: rgba(99, 102, 241, 0.1);
}

html.theme-light .menu-link.active {
  background: rgba(99, 102, 241, 0.15);
}

html.theme-light .modal-content {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: var(--shadow-xl);
}

html.theme-light .modal {
  background: rgba(15, 23, 42, 0.5);
}

/* === Overrides adicionales para tema claro === */

/* Barras de navegación móvil */
html.theme-light [style*="background: rgba(30, 41, 59"] {
  background: rgba(255, 255, 255, 0.95) !important;
  border-top-color: rgba(15, 23, 42, 0.1) !important;
}

/* Details/accordions */
html.theme-light details.card,
html.theme-light details[style*="background: rgba(30"],
html.theme-light .day-group {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
}

/* Summary headers dentro de details */
html.theme-light details summary {
  background: rgba(248, 250, 252, 0.9) !important;
}

/* Tarjetas con estilo inline */
html.theme-light [style*="background: rgba(30, 41, 59, 0.5)"],
html.theme-light [style*="background: rgba(30, 41, 59, 0.8)"],
html.theme-light [style*="background: rgba(30, 41, 59, 0.9)"] {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
}

/* Avatar containers */
html.theme-light [style*="background: rgba(30,41,59"] {
  background: rgba(241, 245, 249, 0.9) !important;
}

/* Elementos con fondo #1e293b */
html.theme-light [style*="background: #1e293b"] {
  background: #ffffff !important;
  border: 1px solid rgba(15, 23, 42, 0.1) !important;
}

/* Bordes claros en tema claro */
html.theme-light [style*="border: 1px solid rgba(255, 255, 255"],
html.theme-light [style*="border: 1px solid rgba(255,255,255"],
html.theme-light [style*="border: 2px solid rgba(255,255,255"] {
  border-color: rgba(15, 23, 42, 0.1) !important;
}

/* Sidebar logo color en tema claro */
html.theme-light .sidebar-logo {
  color: var(--primary-dark);
}

/* Request cards y elementos similares */
html.theme-light .request-card {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
}

/* Bottom navigation móvil */
html.theme-light .bottom-nav {
  background: rgba(255, 255, 255, 0.95) !important;
  border-top-color: rgba(15, 23, 42, 0.1) !important;
}

/* Header en páginas de empleado */
html.theme-light .employee-header,
html.theme-light [class*="header"][style*="background: rgba(30"] {
  background: rgba(255, 255, 255, 0.95) !important;
}

/* Info cards en perfil */
html.theme-light .info-section,
html.theme-light .profile-section {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
}

/* Quick actions */
html.theme-light .quick-action {
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
}

/* Attendance entries */
html.theme-light .attendance-entry,
html.theme-light .history-item {
  background: rgba(248, 250, 252, 0.9) !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
}

/* === Action Cards (Solicitudes Rápidas en dashboard empleado) === */
html.theme-light .action-card {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(15, 23, 42, 0.12) !important;
  color: var(--text-primary) !important;
}

html.theme-light .action-card:hover,
html.theme-light .action-card:active {
  background: rgba(241, 245, 249, 1) !important;
}

html.theme-light .action-card span {
  color: var(--text-primary) !important;
}

/* Quick actions grid */
html.theme-light .quick-actions .action-card {
  box-shadow: var(--shadow-sm);
}

/* Textos con color: white hardcodeado */
html.theme-light [style*="color: white"],
html.theme-light [style*="color:white"] {
  color: var(--text-primary) !important;
}

/* Elementos con rgba(255,255,255, 0.0x) que son casi invisibles en claro */
html.theme-light [style*="background: rgba(255, 255, 255, 0.03)"],
html.theme-light [style*="background: rgba(255, 255, 255, 0.05)"] {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
}

/* Nav items en bottom nav */
html.theme-light .nav-item {
  color: var(--text-secondary);
}

html.theme-light .nav-item.active {
  color: var(--primary-dark);
}

/* Geo modal */
html.theme-light #geo-notice-modal .modal-content {
  background: #ffffff !important;
  border-color: rgba(99, 102, 241, 0.2) !important;
}

/* === Employee Requests Page === */
html.theme-light .form-card {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
}

html.theme-light .type-btn {
  background: rgba(241, 245, 249, 0.9) !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
  color: var(--text-secondary) !important;
}

html.theme-light .type-btn.active {
  background: var(--primary) !important;
  color: white !important;
  border-color: var(--primary) !important;
}

/* === Employee Profile Page === */
html.theme-light .info-group {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
}

html.theme-light .info-row {
  border-bottom-color: rgba(15, 23, 42, 0.08) !important;
}

/* === General overrides para cualquier elemento con fondo semi-transparente oscuro === */
html.theme-light [style*="rgba(255, 255, 255, 0.03)"],
html.theme-light [style*="rgba(255, 255, 255, 0.05)"],
html.theme-light [style*="rgba(255, 255, 255, 0.08)"],
html.theme-light [style*="rgba(255, 255, 255, 0.1)"] {
  background: rgba(255, 255, 255, 0.95) !important;
}

/* Marca de agua global (esquina inferior derecha) */
.app-watermark {
  position: fixed;
  right: var(--spacing-lg);
  bottom: var(--spacing-lg);
  z-index: 9999;
  pointer-events: none;
  user-select: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  opacity: 0.6;
}

/* Layout Principal */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  padding: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.main-content {
  margin-left: 260px;
  padding: var(--spacing-xl);
  min-height: 100vh;
  position: relative;
}

/* Sidebar Styles */
.sidebar-header {
  padding-bottom: var(--spacing-lg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: var(--spacing-lg);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-light);
}

.sidebar-menu {
  list-style: none;
}

.menu-item {
  margin-bottom: var(--spacing-xs);
}

.menu-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: 0.875rem var(--spacing-md);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  font-weight: 500;
}

.menu-link:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--primary-light);
}

.menu-link.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
  font-weight: 600;
}

/* Cards */
.card {
  background: rgba(30, 41, 59, 0.7);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: var(--spacing-lg);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: var(--spacing-sm);
}

/* Grillas */
.grid {
  display: grid;
  gap: var(--spacing-lg);
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Stats Cards */
.stat-card {
  background: rgba(30, 41, 59, 0.5);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-light);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  font-size: 0.9rem;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.actions-grid {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

/* Formularios */
.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-control,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: white;
  font-size: 0.9375rem;
  transition: all var(--transition-base);
  outline: none;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  background: rgba(15, 23, 42, 0.8);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.form-select option {
  background: var(--bg-sidebar);
  color: white;
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

/* Modales */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  padding: var(--spacing-md);
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-xl), var(--shadow-glow);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: modalIn var(--transition-slow) ease-out;
}

.btn-close {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition-base);
  line-height: 1;
  padding: 0.5rem;
  z-index: 10;
}

.btn-close:hover {
  color: var(--error);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Tablas */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.2);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

th,
td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    width: 80px;
  }

  .sidebar span:last-child {
    display: none;
  }

  .main-content {
    margin-left: 80px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: var(--spacing-md);
  }

  .main-content {
    margin-left: 0;
    padding: var(--spacing-md);
  }

  .sidebar span:last-child {
    display: inline-block;
  }

  .grid-cols-2,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

/* Animaciones */
.fade-in {
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}