/* ==========================================================================
   SISTEMA DE DISEÑO PREMIUM - TOYOTA CHIAPAS DESARROLLO ORGANIZACIONAL
   ========================================================================== */

:root {
  /* Fuentes */
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-title: 'Outfit', system-ui, -apple-system, sans-serif;

  /* Colores Corporativos Toyota (Tema Claro por Defecto) */
  --primary-red: #eb0a1e;
  --primary-red-hover: #c30716;
  --primary-red-rgb: 235, 10, 30;
  
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-sidebar: #0f172a;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-on-dark: #f8fafc;
  
  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  --input-bg: #ffffff;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.02);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
  --shadow-red: 0 10px 15px -3px rgba(235, 10, 30, 0.15);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Estados */
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.08);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.08);
  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.08);
  --color-info: #3b82f6;
}

/* Variables para Tema Oscuro */
.dark-theme {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-sidebar: #070a12;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --border-color: #1e293b;
  --border-hover: #334155;
  --input-bg: #1e293b;
  
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -2px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -4px rgba(0,0,0,0.4);
  
  --color-success-bg: rgba(16, 185, 129, 0.15);
  --color-warning-bg: rgba(245, 158, 11, 0.15);
  --color-danger-bg: rgba(239, 68, 68, 0.15);
}

/* ==========================================================================
   ESTILOS GENERALES & ESTRUCTURA DE PANTALLA
   ========================================================================== */

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

html {
  font-size: 81.25%; /* Escala predeterminada equivalente al 80% de zoom de pantalla */
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Ocultar barra de desplazamiento predeterminada pero mantener scroll */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 72px;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  padding: 0 2rem;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.toyota-badge {
  background-color: var(--primary-red);
  color: #ffffff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  box-shadow: 0 4px 10px rgba(235, 10, 30, 0.3);
}

.brand-logos {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: #ffffff;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.brand-logo-img {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.toyota-logo-svg {
  width: 100%;
  height: 100%;
  color: #ffffff;
}

.brand-texts {
  display: flex;
  flex-direction: column;
}

.company-name {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  text-transform: uppercase;
}

.brand-texts .system-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.stats-mini {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-primary);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--transition-normal);
}

.mini-stat-label {
  color: var(--text-secondary);
}

.mini-stat-value {
  color: var(--primary-red);
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
}

.btn-theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: var(--bg-secondary);
  transition: all var(--transition-fast);
}

.btn-theme-toggle:hover {
  background-color: var(--bg-primary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.btn-theme-toggle svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-primary);
}

/* ==========================================================================
   DISEÑO DE APP SHELL (SIDEBAR + CONTENIDO)
   ========================================================================== */

.app-layout {
  display: flex;
  flex: 1;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  min-height: calc(100vh - 72px);
}

/* SIDEBAR */
.sidebar {
  width: 250px;
  background-color: var(--bg-sidebar);
  color: var(--text-on-dark);
  padding: 2rem 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--border-color);
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  z-index: 10;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  border: none;
  background: none;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition-normal);
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-on-dark);
}

.nav-item.active {
  background-color: var(--primary-red);
  color: #ffffff;
  box-shadow: var(--shadow-red);
}

.nav-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  transition: transform var(--transition-normal);
}

.nav-item:hover .nav-icon {
  transform: scale(1.05);
}

.sidebar-footer {
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.do-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.copyright {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.4);
}

/* ÁREA DE CONTENIDO */
.content-area {
  flex: 1;
  padding: 2rem 3rem;
  overflow-y: auto;
  background-color: var(--bg-primary);
  transition: background-color var(--transition-normal);
}

/* PANELES DE PESTAÑAS */
.tab-panel {
  display: none;
  animation: fadeIn var(--transition-slow) forwards;
}

.tab-panel.active {
  display: block;
}

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

.panel-header {
  margin-bottom: 2rem;
}

.panel-header h1 {
  font-family: var(--font-title);
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.panel-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ==========================================================================
   COMPONENTE: DASHBOARD
   ========================================================================== */

/* Tarjetas de Estadística */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.stat-icon-wrapper {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-wrapper svg {
  width: 26px;
  height: 26px;
}

.stat-icon-wrapper.red {
  background-color: rgba(235, 10, 30, 0.08);
  color: var(--primary-red);
}
.stat-icon-wrapper.orange {
  background-color: rgba(245, 158, 11, 0.08);
  color: var(--color-warning);
}
.stat-icon-wrapper.blue {
  background-color: rgba(59, 130, 246, 0.08);
  color: var(--color-info);
}
.stat-icon-wrapper.green {
  background-color: rgba(16, 185, 129, 0.08);
  color: var(--color-success);
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 0.2rem;
}

/* Gráficos */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.8rem;
  margin-bottom: 2rem;
}

.chart-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition-normal);
}

.chart-card h3 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}

/* Listas rápidas del Dashboard */
.quick-summaries-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr;
  gap: 1.8rem;
}

.summary-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: var(--shadow-md);
}

.summary-card h3 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.8rem;
  color: var(--text-primary);
}

.recent-list-wrapper {
  max-height: 240px;
  overflow-y: auto;
}

.recent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.recent-table th {
  text-align: left;
  padding: 0.6rem 0.8rem;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
}

.recent-table td {
  padding: 0.75rem 0.8rem;
  border-bottom: 1px solid var(--border-color);
}

.recent-table tr:last-child td {
  border-bottom: none;
}

.recent-emp-name {
  font-weight: 700;
  color: var(--text-primary);
}

.recent-emp-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Alertas de vacaciones */
.alert-vacation-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.alert-vacation-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--color-warning);
}

.alert-vacation-item.critical {
  border-left-color: var(--primary-red);
}

.alert-v-info {
  display: flex;
  flex-direction: column;
}

.alert-v-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.alert-v-dept {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.alert-v-badge {
  font-family: var(--font-title);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--color-warning);
  background-color: var(--color-warning-bg);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.critical .alert-v-badge {
  color: var(--primary-red);
  background-color: rgba(235, 10, 30, 0.08);
  border-color: rgba(235, 10, 30, 0.15);
}

/* ==========================================================================
   FORMULARIOS (REGISTRO Y EDICIÓN)
   ========================================================================== */

.toyota-form {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 2.2rem;
  transition: background-color var(--transition-normal);
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.form-section-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-icon {
  width: 20px;
  height: 20px;
  color: var(--primary-red);
}

.text-red {
  color: var(--primary-red);
}

.form-row {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  position: relative;
}

/* Grid del Formulario */
.col-12 { flex: 0 0 100%; width: 100%; }
.col-8  { flex: 0 0 calc(66.666% - 0.6rem); }
.col-6  { flex: 0 0 calc(50% - 0.6rem); }
.col-4  { flex: 0 0 calc(33.333% - 0.8rem); }
.col-3  { flex: 0 0 calc(25% - 0.9rem); }

.form-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.form-group label .required {
  color: var(--primary-red);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--input-bg);
  outline: none;
  font-size: 0.88rem;
  transition: all var(--transition-fast);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: var(--border-hover);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px rgba(235, 10, 30, 0.1);
  background-color: var(--bg-secondary);
}

/* Validaciones Visuales */
.form-group.success input,
.form-group.success select,
.form-group.success textarea {
  border-color: var(--color-success);
}
.form-group.success input:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-group.invalid input,
.form-group.invalid select,
.form-group.invalid textarea {
  border-color: var(--color-danger);
  background-color: rgba(239, 68, 68, 0.01);
}
.form-group.invalid input:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.error-msg {
  display: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-danger);
  margin-top: 0.2rem;
  animation: slideDown 0.15s ease forwards;
}

.form-group.invalid .error-msg {
  display: block;
}

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

.helper-text {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.flex-align-center {
  display: flex;
  align-items: center;
}

/* Custom Checkbox */
.checkbox-container {
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 2rem;
  cursor: pointer;
  font-size: 0.88rem;
  user-select: none;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  height: 22px;
  width: 22px;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.checkbox-container:hover input ~ .checkmark {
  border-color: var(--border-hover);
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--primary-red);
  border-color: var(--primary-red);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

.checkbox-container .checkmark:after {
  left: 7.5px;
  top: 3.5px;
  width: 5px;
  height: 10px;
  border: solid #ffffff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

/* Sub-paneles dinámicos animados */
.sub-panel-animated {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  margin-top: 0.6rem;
  border-left: 4px solid var(--primary-red);
  animation: slideDown var(--transition-normal) forwards;
}

.sub-panel-title {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  color: var(--text-primary);
}

.sub-panel-desc {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  margin-top: 1rem;
}

.form-divider {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 0.4rem;
  margin: 1rem 0;
}

/* ==========================================================================
   BOTONES
   ========================================================================== */

.btn-primary,
.btn-secondary,
.btn-accent,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.btn-primary {
  background-color: var(--primary-red);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(235, 10, 30, 0.15);
}

.btn-primary:hover {
  background-color: var(--primary-red-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(235, 10, 30, 0.22);
}

.btn-secondary {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--border-color);
  border-color: var(--border-hover);
}

.btn-accent {
  background-color: var(--color-success);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.15);
}

.btn-accent:hover {
  background-color: #0d9488;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(16, 185, 129, 0.22);
}

.btn-danger {
  background-color: var(--color-danger);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.15);
}

.btn-danger:hover {
  background-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(239, 68, 68, 0.22);
}

.btn-icon {
  background: none;
  border: 1px solid var(--border-color);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: var(--bg-secondary);
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-primary);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-secondary);
}

.btn-svg-icon {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   TABLA DE ASOCIADOS Y BÚSQUEDA
   ========================================================================== */

.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 300px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.8rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  font-size: 0.88rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px rgba(235, 10, 30, 0.08);
}

.filters-dropdowns {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}

.select-wrapper {
  position: relative;
}

.filters-dropdowns select {
  padding: 0.75rem 2.2rem 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
  transition: all var(--transition-fast);
}

.select-wrapper::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  font-size: 0.8rem;
}

.filters-dropdowns select:focus {
  border-color: var(--primary-red);
}

/* Tabla Principal */
.table-wrapper {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow-x: auto;
  position: relative;
}

.main-table-wrapper {
  min-height: 400px;
}

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

.toyota-table th {
  background-color: var(--bg-secondary);
  padding: 0.65rem 0.75rem;
  font-family: var(--font-title);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
  user-select: none;
  white-space: nowrap;
}

.toyota-table th.sortable {
  cursor: pointer;
}

.toyota-table th.sortable:hover {
  color: var(--primary-red);
}

.toyota-table th span {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.toyota-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
  white-space: nowrap;
  font-size: 0.84rem;
}

.toyota-table tbody tr {
  transition: background-color var(--transition-fast);
}

.toyota-table tbody tr:hover {
  background-color: var(--bg-primary);
}

.toyota-table tbody tr:last-child td {
  border-bottom: none;
}

/* Celda Número Empleado */
.emp-num-badge {
  background-color: var(--border-color);
  color: var(--text-primary);
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.8rem;
}

/* Celda Nombre */
.emp-name-cell {
  display: flex;
  flex-direction: column;
}

.emp-name-main {
  font-weight: 700;
  color: var(--text-primary);
}

.emp-name-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Celda Vacaciones */
.vac-bar-container {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.vac-badge {
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  min-width: 28px;
  text-align: center;
}

.vac-badge.success {
  background-color: var(--color-success-bg);
  color: var(--color-success);
}
.vac-badge.warning {
  background-color: var(--color-warning-bg);
  color: var(--color-warning);
}
.vac-badge.danger {
  background-color: var(--color-danger-bg);
  color: var(--color-danger);
}

/* Acciones en Tabla */
.center-col {
  text-align: center;
}

.table-actions {
  display: inline-flex;
  gap: 0.5rem;
}

.btn-table-action {
  background: none;
  border: 1px solid var(--border-color);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background-color: var(--bg-secondary);
}

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

.btn-table-action svg {
  width: 14px;
  height: 14px;
  stroke: var(--text-secondary);
}

.btn-table-action.view:hover {
  background-color: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
}
.btn-table-action.view:hover svg {
  stroke: var(--color-info);
}

.btn-table-action.edit:hover {
  background-color: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
}
.btn-table-action.edit:hover svg {
  stroke: var(--color-warning);
}

.btn-table-action.delete:hover {
  background-color: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
}
.btn-table-action.delete:hover svg {
  stroke: var(--color-danger);
}

.btn-table-action.whatsapp:hover {
  background-color: rgba(37, 211, 102, 0.08);
  border-color: rgba(37, 211, 102, 0.2);
}
.btn-table-action.whatsapp svg {
  fill: var(--text-secondary);
  stroke: none;
  width: 14px;
  height: 14px;
}
.btn-table-action.whatsapp:hover svg {
  fill: #25d366;
}


.no-results {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}

.no-results-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.no-results h3 {
  font-family: var(--font-title);
  margin-bottom: 0.4rem;
}

/* ==========================================================================
   TARJETAS DE BASE DE DATOS
   ========================================================================== */

.database-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.8rem;
}

.db-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  align-items: flex-start;
  transition: border-color var(--transition-normal);
}

.db-card.warning {
  border-left: 5px solid var(--color-warning);
}

.db-card-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.db-card h2 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
}

.db-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  flex-grow: 1;
}

.btn-group-row {
  display: flex;
  gap: 0.8rem;
  width: 100%;
  flex-wrap: wrap;
}

.btn-group-row button {
  flex: 1;
  min-width: 100px;
}

/* ==========================================================================
   MODALES
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.modal-overlay.active .modal-box {
  transform: translateY(0);
}

.card-modal {
  max-width: 750px;
}

.edit-modal-box {
  max-width: 950px;
}

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

.modal-header h2 {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  transition: color var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--primary-red);
}

.modal-body {
  padding: 1.8rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1.2rem 1.8rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* Ficha del Asociado (Estilo Credencial PDF) */
.ficha-container {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  padding: 0.5rem;
}

/* Encabezado Ficha */
.ficha-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--primary-red);
  padding-bottom: 1.2rem;
}

.ficha-header-logo {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.ficha-logo-svg {
  width: 32px;
  height: 32px;
  color: var(--primary-red);
}

.ficha-header-title {
  text-align: right;
}

.ficha-header-title h3 {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary-red);
}

.ficha-header-title p {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* Credencial de Perfil */
.ficha-profile-block {
  display: flex;
  gap: 1.8rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.4rem;
}

.ficha-avatar {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-md);
  background-color: var(--primary-red);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.ficha-emp-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ficha-emp-name {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.ficha-emp-puesto {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-red);
  margin-bottom: 0.4rem;
}

.ficha-emp-pills {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.ficha-pill {
  font-size: 0.75rem;
  font-weight: 700;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
}

/* Bloques de Datos */
.ficha-data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.8rem;
}

.ficha-data-section {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.ficha-section-name {
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.3rem;
}

.ficha-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.84rem;
}

.ficha-label {
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.ficha-val {
  color: var(--text-primary);
  font-weight: 500;
}

.ficha-val.antiguedad-destacada {
  color: var(--primary-red);
  font-weight: 700;
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: var(--bg-sidebar);
  color: var(--text-on-dark);
  padding: 0.9rem 1.6rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.88rem;
  font-weight: 700;
  transform: translateY(100px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  border-left: 4px solid var(--color-success);
}

.toast.error {
  border-left: 4px solid var(--color-danger);
}

.toast.info {
  border-left: 4px solid var(--color-info);
}

/* ==========================================================================
   MEDIA QUERIES (DISEÑO RESPONSIVO)
   ========================================================================== */

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .quick-summaries-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    bottom: 0;
    top: auto;
    flex-direction: row;
    padding: 0.6rem 1rem;
    border-right: none;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-sidebar);
    box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
  }
  
  .sidebar-nav {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
    gap: 0.2rem;
  }
  
  .nav-item {
    padding: 0.6rem;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    flex: 1;
    text-align: center;
    border-radius: var(--radius-sm);
  }
  
  .nav-icon {
    width: 18px;
    height: 18px;
  }
  
  .sidebar-footer {
    display: none;
  }
  
  .content-area {
    padding: 1.5rem 1.2rem;
    padding-bottom: 5rem; /* Evitar que sidebar tape el contenido */
  }
  
  .header-inner {
    padding: 0 1rem;
  }
  
  .stats-mini {
    display: none;
  }
  
  .form-group {
    flex: 0 0 100% !important;
    width: 100% !important;
  }
  
  .ficha-data-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
  
  .ficha-profile-block {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .database-cards {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   ESTILOS DE IMPRESIÓN (PDF DE LA FICHA)
   ========================================================================== */

@media print {
  body * {
    visibility: hidden;
  }
  
  #detailModal,
  #detailModal *,
  #detailModalBody,
  #detailModalBody * {
    visibility: visible;
  }
  
  #detailModal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    background: none !important;
    backdrop-filter: none !important;
    pointer-events: none;
    display: block !important;
    opacity: 1 !important;
  }
  
  .modal-box {
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  
  .modal-header,
  .modal-footer {
    display: none !important;
  }
  
  .modal-body {
    padding: 0 !important;
    overflow: visible !important;
  }
  
  .ficha-container {
    width: 100%;
    padding: 0;
  }
  
  .ficha-profile-block {
    background-color: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  .ficha-avatar {
    background-color: #eb0a1e !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  .ficha-pill {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ==========================================================================
   AUTHENTICATION (LOGIN)
   ========================================================================== */
.login-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
}

.login-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 2.5rem 2rem;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: loginSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-card h2 {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-top: 0.5rem;
  margin-bottom: 0.2rem;
}

.login-card p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

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

.btn-table-action.contact:hover {
  background-color: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.2);
}
.btn-table-action.contact:hover svg {
  stroke: #6366f1;
}

/* ==========================================================================
   ESTILOS ADICIONALES: CONTROLES DO
   ========================================================================== */
.subtab-button:hover {
  color: var(--text-primary) !important;
  background-color: rgba(255, 255, 255, 0.02) !important;
}

.brigadas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.brigadista-item-wrapper:hover, .inscrito-item-wrapper:hover {
  background-color: var(--bg-primary);
  border-radius: var(--radius-xs);
}

.emp-num-badge {
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
}

.subtab-panel {
  animation: fadeIn 0.25s ease-out;
}

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



/* ==========================================================================
   RESTRICCIÓN INFALIBLE DE MENÚ DE USUARIOS (VERO & DENNISSE)
   ========================================================================== */
body[data-user-role="limited"] .nav-item[data-tab="controls"],
body[data-user-role="limited"] .nav-item[data-tab="database"],
body[data-user-role="limited"] #tab-controls,
body[data-user-role="limited"] #tab-database {
  display: none !important;
}
