/* ============================================================
   GLOBAL CSS — Intranet St. Andrews
   Sistema de componentes estandarizado
   Paleta: primary #21618c | secondary #154360 | accent #f4d03f
   ============================================================ */

/* ============================================================
   0. DESIGN TOKENS (CSS Custom Properties)
   ============================================================ */
:root {
  --color-primary: #21618c;
  --color-secondary: #154360;
  --color-accent: #f4d03f;
  --color-neutral: #e5e7e9;
  --color-dark: #2471a3;
  --color-site-bg: #175076;

  --radius-card: 1rem;
  --radius-lg: 0.75rem;
  --radius-md: 0.5rem;
  --radius-pill: 9999px;

  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-heavy: 0 10px 40px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.2);

  --transition: all 0.2s ease;
}

/* ============================================================
   1. ESTRUCTURA DE PÁGINA
   ============================================================ */

/* Contenedor blanco interior de cada vista (va dentro de .main-container) */
.page-container {
  background-color: white;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-heavy);
  padding: 1.5rem;
}

/* Encabezado de la vista: título izquierda + acciones derecha */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.25;
}

.page-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ============================================================
   2. BOTONES
   ============================================================ */

/* Base compartida — combinar con variante: <a class="btn btn-primary"> */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1.25;
}

/* Acción principal: crear, guardar */
.btn-primary {
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-secondary) 100%
  );
  color: white;
  box-shadow: 0 2px 8px rgba(33, 97, 140, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(33, 97, 140, 0.45);
  transform: translateY(-1px);
  color: white;
  text-decoration: none;
}

/* Acciones secundarias: volver, cancelar */
.btn-secondary {
  background-color: #6b7280;
  color: white;
}
.btn-secondary:hover {
  background-color: #4b5563;
  color: white;
  text-decoration: none;
}

/* Exportar a Excel */
.btn-excel {
  background-color: #059669;
  color: white;
}
.btn-excel:hover {
  background-color: #047857;
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.35);
  color: white;
  text-decoration: none;
}

/* Acción destructiva: eliminar */
.btn-danger {
  background-color: #ef4444;
  color: white;
}
.btn-danger:hover {
  background-color: #dc2626;
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
  color: white;
  text-decoration: none;
}

/* Cambio de estado / advertencia */
.btn-warning {
  background-color: #f59e0b;
  color: white;
}
.btn-warning:hover {
  background-color: #d97706;
  color: white;
  text-decoration: none;
}

/* Limpiar filtros / neutro */
.btn-neutral {
  background-color: white;
  color: #4b5563;
  border: 1px solid #d1d5db;
}
.btn-neutral:hover {
  background-color: #f3f4f6;
  color: #374151;
  text-decoration: none;
}

/* ---- Botones de ícono circular (acciones en filas de tabla) ---- */
/* Uso: <a class="btn-icon btn-icon-view" title="Ver"> <svg .../> </a> */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  flex-shrink: 0;
}
.btn-icon:hover {
  transform: scale(1.1);
}
.btn-icon svg,
.btn-icon i {
  pointer-events: none;
}

.btn-icon-view {
  background-color: #3b82f6;
  color: white;
}
.btn-icon-view:hover {
  background-color: #2563eb;
  color: white;
}

.btn-icon-edit {
  background-color: #f59e0b;
  color: white;
}
.btn-icon-edit:hover {
  background-color: #d97706;
  color: white;
}

.btn-icon-delete {
  background-color: #ef4444;
  color: white;
}
.btn-icon-delete:hover {
  background-color: #dc2626;
  color: white;
}

.btn-icon-pdf {
  background-color: #dc2626;
  color: white;
}
.btn-icon-pdf:hover {
  background-color: #b91c1c;
  color: white;
}

.btn-icon-deactivate {
  background-color: #f97316;
  color: white;
}
.btn-icon-deactivate:hover {
  background-color: #ea580c;
  color: white;
}

.btn-icon-activate {
  background-color: #10b981;
  color: white;
}
.btn-icon-activate:hover {
  background-color: #059669;
  color: white;
}

.btn-icon-info {
  background-color: #6366f1;
  color: white;
}
.btn-icon-info:hover {
  background-color: #4f46e5;
  color: white;
}

/* ============================================================
   3. FORMULARIOS
   ============================================================ */

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

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.375rem;
}

/* Etiqueta compacta para barras de filtros */
.form-label-sm {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  color: #111827;
  background-color: white;
  transition: var(--transition);
  outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(33, 97, 140, 0.15);
}

.form-textarea {
  resize: vertical;
  min-height: 6rem;
}

.form-help {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}

.form-error {
  font-size: 0.75rem;
  color: #ef4444;
  margin-top: 0.25rem;
}

/* ============================================================
   4. BARRA DE FILTROS
   ============================================================ */

.filter-bar {
  background-color: #f9fafb;
  padding: 1rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  border: 1px solid #e5e7eb;
}

/* Grid responsivo de filtros: 1→2→3→4 columnas */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.75rem;
}
@media (min-width: 640px) {
  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 768px) {
  .filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .filter-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Grid ampliado para filtros con muchos campos: hasta 5 columnas */
.filter-grid-xl {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.75rem;
}
@media (min-width: 640px) {
  .filter-grid-xl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 768px) {
  .filter-grid-xl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .filter-grid-xl {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (min-width: 1280px) {
  .filter-grid-xl {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* ============================================================
   5. TABLAS
   ============================================================ */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid #e5e7eb;
}

.custom-table {
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.custom-table thead {
  background-color: var(--color-primary);
  color: white;
}

.custom-table thead th {
  padding: 0.75rem 1rem;
  font-weight: 600;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

.custom-table thead th:first-child {
  border-radius: var(--radius-lg) 0 0 0;
}
.custom-table thead th:last-child {
  border-radius: 0 var(--radius-lg) 0 0;
}

.custom-table tbody {
  background-color: white;
}

.custom-table tbody tr {
  transition: background-color 0.2s;
  border-bottom: 1px solid #f3f4f6;
}

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

.custom-table tbody tr:hover {
  background-color: #f0f7ff;
}

.custom-table tbody td {
  padding: 0.75rem 1rem;
  color: #4b5563;
}

.custom-table tbody td:first-child {
  font-weight: 500;
  color: #16394a;
}

/* Celda de acciones: alinea los btn-icon horizontalmente */
.custom-table .td-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Fila de estado vacío */
.table-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #9ca3af;
  background-color: white;
}

/* ============================================================
   6. BADGES / ESTADOS
   ============================================================ */

/* Base — combinar con variante: <span class="badge badge-success"> */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}

/* Variante suave (fondo claro) — recomendada */
.badge-success {
  background-color: #dcfce7;
  color: #166534;
}
.badge-warning {
  background-color: #fef9c3;
  color: #854d0e;
}
.badge-danger {
  background-color: #fee2e2;
  color: #991b1b;
}
.badge-info {
  background-color: #dbeafe;
  color: #1e40af;
}
.badge-neutral {
  background-color: #f3f4f6;
  color: #374151;
}
.badge-primary {
  background-color: #e0f0ff;
  color: var(--color-secondary);
}

/* Variante sólida — usar para mayor contraste */
.badge-success-solid {
  background-color: #10b981;
  color: white;
}
.badge-warning-solid {
  background-color: #f59e0b;
  color: white;
}
.badge-danger-solid {
  background-color: #ef4444;
  color: white;
}
.badge-info-solid {
  background-color: #3b82f6;
  color: white;
}
.badge-neutral-solid {
  background-color: #6b7280;
  color: white;
}
.badge-primary-solid {
  background-color: var(--color-primary);
  color: white;
}

/* ============================================================
   7. PAGINACIÓN
   ============================================================ */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.pagination-btn {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-lg);
  background-color: #f3f4f6;
  color: #374151;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid #e5e7eb;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.pagination-btn:hover {
  background-color: #e5e7eb;
  color: #111827;
  text-decoration: none;
}

.pagination-current {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-lg);
  background-color: var(--color-primary);
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
}

/* ============================================================
   8. CARDS
   ============================================================ */

.card {
  background-color: white;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  border: 1px solid #f3f4f6;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary);
}

/* Tarjetas de estadísticas para dashboards */
.stat-card {
  background-color: white;
  border-radius: var(--radius-card);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-card);
  border: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.stat-card-value {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--color-secondary);
  line-height: 1;
}

.stat-card-label {
  font-size: 0.875rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

/* ============================================================
   9. MODALES
   ============================================================ */

/* Uso: agregar clase .show para mostrar */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  padding: 1rem;
}
.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-container {
  background-color: white;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-heavy);
  padding: 1.5rem;
  width: 100%;
  max-width: 28rem;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-container-lg {
  max-width: 42rem;
}
.modal-container-xl {
  max-width: 56rem;
}

.modal-icon-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-pill);
  background-color: #fee2e2;
  margin: 0 auto 0.75rem;
}

.modal-icon-warning {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-pill);
  background-color: #fef3c7;
  margin: 0 auto 0.75rem;
}

.modal-icon-info {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-pill);
  background-color: #dbeafe;
  margin: 0 auto 0.75rem;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #111827;
  text-align: center;
}

.modal-body {
  font-size: 0.875rem;
  color: #6b7280;
  text-align: center;
  margin-top: 0.5rem;
}

.modal-footer {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* ============================================================
   10. ALERTAS INLINE
   ============================================================ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert-info {
  background-color: #eff6ff;
  border-left: 4px solid #3b82f6;
  color: #1e40af;
}
.alert-success {
  background-color: #f0fdf4;
  border-left: 4px solid #10b981;
  color: #166534;
}
.alert-warning {
  background-color: #fffbeb;
  border-left: 4px solid #f59e0b;
  color: #92400e;
}
.alert-danger {
  background-color: #fef2f2;
  border-left: 4px solid #ef4444;
  color: #991b1b;
}

/* ============================================================
   11. NAVBAR / DROPDOWN DE USUARIO (base.html)
   ============================================================ */

.bg-secondary {
  background-color: var(--color-secondary) !important;
}

.user-dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 250px;
  z-index: 1000;
  overflow: hidden;
}

.dropdown-menu.show {
  display: block;
  animation: fadeIn 0.2s ease-in;
}

.dropdown-item {
  display: flex;
  align-items: center;
  padding: 0.875rem 1.25rem;
  color: var(--color-secondary);
  text-decoration: none;
  transition: var(--transition);
  border-bottom: 1px solid var(--color-neutral);
}

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

.dropdown-item:hover {
  background: var(--color-accent);
  color: var(--color-secondary);
  font-weight: 600;
  text-decoration: none;
}

.dropdown-item i {
  margin-right: 0.75rem;
  width: 20px;
  text-align: center;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-accent);
  margin-right: 0.75rem;
}

.user-info-dropdown {
  padding: 1rem 1.25rem;
  background: linear-gradient(
    135deg,
    var(--color-secondary) 0%,
    var(--color-primary) 100%
  );
  color: var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
}

.user-info-dropdown .user-name {
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.user-info-dropdown .user-rut {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* ============================================================
   12. UTILIDADES GENERALES
   ============================================================ */

/* Contador de registros (ej. "128 trabajadores") */
.counter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-accent);
  color: var(--color-secondary);
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

/* Separador horizontal */
.divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 1.5rem 0;
}

/* ============================================================
   13. ANIMACIONES
   ============================================================ */

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

/* ============================================================
   14. RESPONSIVIDAD GLOBAL
   ============================================================ */

/*
 * ─────────────────────────────────────────────────────────────
 *  ENCABEZADO DE PÁGINA (page-header)
 *
 *  Patrón HTML estándar para cabeceras de listados:
 *
 *    <div class="flex justify-between items-center mb-6">
 *      <div>
 *        <h2 class="text-3xl font-bold text-[#21618c]">Título</h2>
 *        <p class="text-gray-600 text-sm mt-1">Subtítulo</p>
 *      </div>
 *      <div class="flex items-center space-x-4 page-actions">
 *        <a class="btn btn-excel"><svg/><span class="btn-label">Exportar</span></a>
 *        <a class="btn btn-primary"><svg/><span class="btn-label">Nuevo</span></a>
 *      </div>
 *    </div>
 *
 *  En móvil el contenedor padre apila sus hijos verticalmente.
 *  Agrega la clase "page-actions" al div de botones para que en
 *  móvil los botones se ajusten correctamente.
 * ─────────────────────────────────────────────────────────────
 */

/* Título más pequeño en móvil */
@media (max-width: 639px) {
  .text-3xl {
    font-size: 1.5rem;
  } /* 24px en vez de 30px */
  .text-2xl {
    font-size: 1.25rem;
  } /* 20px en vez de 24px */
}

/*
 *  Encabezado estándar de listados: en móvil apila
 *  el título (arriba) y los botones (abajo).
 *  El patrón HTML es:
 *    <div class="flex justify-between items-center mb-6">
 *      <div>  ← título + subtítulo  </div>
 *      <div class="flex items-center ...">  ← botones  </div>
 *    </div>
 *
 *  En md+ mantiene su layout horizontal original.
 */
@media (max-width: 639px) {
  /* Convierte el encabezado en columna */
  .rounded-2xl.shadow-2xl > .flex.justify-between.items-center,
  .rounded-2xl.shadow-2xl > div > .flex.justify-between.items-center {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  /* Los botones de acción se alinean a la izquierda en móvil */
  .rounded-2xl.shadow-2xl > .flex.justify-between.items-center > div:last-child,
  .rounded-2xl.shadow-2xl
    > div
    > .flex.justify-between.items-center
    > div:last-child {
    width: 100%;
    justify-content: flex-start;
  }
}

/* Botones de acción en el encabezado: compactos en móvil */
.page-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
@media (max-width: 639px) {
  .page-actions {
    justify-content: flex-end;
  }
  .page-actions .btn {
    padding: 0.5rem 0.625rem;
  }
  .page-actions > a,
  .page-actions > button {
    padding: 0.5rem 0.75rem !important;
  }
}

/*
 *  Clase helper: texto de botón que se muestra solo en sm+
 *  Uso: <a class="..."><svg/>  <span class="btn-label">Crear</span></a>
 *  En móvil el botón queda solo con el ícono (más compacto).
 */
.btn-label {
  display: none;
}
@media (min-width: 640px) {
  .btn-label {
    display: inline;
  }
}

/*
 * ─────────────────────────────────────────────────────────────
 *  ACORDEÓN DE FILTROS  (data-filter-accordion)
 *
 *  Patrón HTML — pegar tal cual en cada plantilla de listado:
 *
 *    <div class="bg-gray-50 p-4 rounded-xl mb-6" data-filter-accordion>
 *
 *      <!-- Botón visible solo en móvil -->
 *      <button type="button" class="filter-accordion-toggle">
 *        <span class="flex items-center gap-2">
 *          <svg class="w-4 h-4 text-[#21618c]" ...><!-- ícono embudo --></svg>
 *          Filtros
 *        </span>
 *        <svg class="filter-chevron w-4 h-4" ...><!-- ícono chevron --></svg>
 *      </button>
 *
 *      <!-- Formulario: oculto en móvil, siempre visible en md+ -->
 *      <div class="filter-accordion-body">
 *        <form method="get" id="formFiltros">
 *          <div class="grid grid-cols-1 md:grid-cols-6 gap-3">
 *            ...campos de filtro...
 *          </div>
 *        </form>
 *      </div>
 *    </div>
 *
 *  El JS en base.html inicializa todos los acordeones automáticamente.
 *  Si algún campo tiene valor, el panel se abre solo al cargar.
 * ─────────────────────────────────────────────────────────────
 */

/* Botón toggle (solo móvil) */
.filter-accordion-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  padding: 0.25rem 0;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  text-align: left;
  transition: color 0.2s;
}
.filter-accordion-toggle:hover {
  color: var(--color-primary);
}
.filter-accordion-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

/* Chevron animado */
.filter-chevron {
  transition: transform 0.25s ease;
  flex-shrink: 0;
  color: #9ca3af;
}

/* Panel: colapsado en móvil por defecto */
.filter-accordion-body {
  display: none;
  margin-top: 0.75rem;
}
.filter-accordion-body.is-open {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* Escritorio (md+): toggle oculto, panel siempre visible */
@media (min-width: 768px) {
  .filter-accordion-toggle {
    display: none;
  }
  .filter-accordion-body {
    display: block !important;
    margin-top: 0;
  }
}

/*
 * ─────────────────────────────────────────────────────────────
 *  TABLAS RESPONSIVE
 * ─────────────────────────────────────────────────────────────
 */
@media (max-width: 767px) {
  .table-container,
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }
  /* Reducir padding y fuente en celdas para ganar espacio */
  table thead th,
  table tbody td {
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
  }
}

/*
 * ─────────────────────────────────────────────────────────────
 *  CONTENEDOR PRINCIPAL (page-container / tarjeta blanca)
 * ─────────────────────────────────────────────────────────────
 */
@media (max-width: 639px) {
  .page-container {
    padding: 1rem;
  }
  /* Tarjeta blanca genérica que usan todos los listados */
  .rounded-2xl.shadow-2xl.p-6 {
    padding: 1rem;
  }
}

/*
 * ─────────────────────────────────────────────────────────────
 *  SALUDO EN EL HEADER  (.header-greeting)
 *  El apellido se oculta en pantallas muy pequeñas.
 * ─────────────────────────────────────────────────────────────
 */
.header-greeting-lastname {
  display: none;
}
@media (min-width: 480px) {
  .header-greeting-lastname {
    display: inline;
  }
}

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

.animate-fade-in {
  animation: fadeIn 0.2s ease;
}
.animate-slide-up {
  animation: slideUp 0.3s ease;
}

/* ============================================================
   14. RESPONSIVE / MOBILE-FIRST
   Breakpoints: sm=640px  md=768px  lg=1024px  xl=1280px
   ============================================================ */

/* ---- 14a. Estructura de página ---- */
@media (max-width: 639px) {
  .page-container {
    padding: 1rem;
    border-radius: var(--radius-lg);
  }

  .page-title {
    font-size: 1.375rem;
  }

  /* En móvil el header apila: título arriba, acciones abajo */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Los botones de acción ocupan todo el ancho en móvil */
  .page-actions {
    width: 100%;
  }
  .page-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
  }
}

/* ---- 14b. Botones — tamaño mínimo táctil (44px) ---- */
.btn {
  min-height: 2.75rem;
}
.btn-icon {
  min-width: 2.25rem;
  min-height: 2.25rem;
}

@media (max-width: 639px) {
  /* En listas con pocos botones de icono, hacerlos algo más grandes */
  .btn-icon {
    width: 2.25rem;
    height: 2.25rem;
  }
}

/* ---- 14c. Barra de filtros — colapsable en móvil ---- */
/*
   Para activar el comportamiento colapsable en móvil, añade al HTML:
     <div class="filter-bar">
       <button class="filter-toggle" onclick="this.parentElement.classList.toggle('filter-open')">
         <svg .../>  Filtros  <svg ... chevron />
       </button>
       <div class="filter-body">
         <form ...>...</form>
       </div>
     </div>
*/
.filter-toggle {
  display: none;
}

@media (max-width: 767px) {
  .filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-primary);
    padding: 0;
    margin-bottom: 0.75rem;
  }
  .filter-toggle svg.chevron {
    margin-left: auto;
    transition: transform 0.25s ease;
  }
  .filter-bar.filter-open .filter-toggle svg.chevron {
    transform: rotate(180deg);
  }

  .filter-body {
    display: none;
  }
  .filter-bar.filter-open .filter-body {
    display: block;
    animation: slideUp 0.2s ease;
  }

  /* Si no se usa .filter-toggle, mostrar siempre */
  .filter-bar:not(:has(.filter-toggle)) .filter-body {
    display: block;
  }
}

/* ---- 14d. Tablas — patrón "cards" en móvil ---- */
/*
   Añade la clase .table-mobile-cards a la tabla Y data-label="NombreCol"
   en cada <td> para que el label aparezca automáticamente.
   Ejemplo:
     <table class="custom-table table-mobile-cards">
       <thead>...</thead>
       <tbody>
         <tr>
           <td data-label="Nombre">Juan</td>
           <td data-label="Estado"><span class="badge badge-success">Activo</span></td>
           <td data-label="Acciones" class="td-actions">...</td>
         </tr>
       </tbody>
     </table>
*/
@media (max-width: 767px) {
  .table-mobile-cards {
    min-width: unset !important;
    border-collapse: separate;
    border-spacing: 0;
  }

  .table-mobile-cards thead {
    display: none;
  }

  .table-mobile-cards tbody tr {
    display: block;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-lg);
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background-color: white;
    box-shadow: var(--shadow-card);
  }
  .table-mobile-cards tbody tr:hover {
    background-color: #f0f7ff;
  }

  .table-mobile-cards tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.875rem;
    color: #374151;
  }
  .table-mobile-cards tbody td:first-child {
    font-weight: 600;
    color: var(--color-secondary);
    font-size: 0.9375rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
    margin-bottom: 0.125rem;
  }
  .table-mobile-cards tbody td:last-child {
    border-bottom: none;
    padding-top: 0.5rem;
  }

  /* Label automático desde data-label */
  .table-mobile-cards tbody td[data-label]::before {
    content: attr(data-label);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    flex-shrink: 0;
    margin-right: 0.5rem;
  }
  /* La primera columna no muestra label (ya es el título de la card) */
  .table-mobile-cards tbody td:first-child::before {
    display: none;
  }

  /* Celda de acciones en card mode */
  .table-mobile-cards tbody td.td-actions {
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .table-mobile-cards tbody td.td-actions::before {
    display: none;
  }
}

/* ---- 14e. Formularios en móvil ---- */
@media (max-width: 639px) {
  /* Forzar columna única en grids de formulario estándar */
  .form-grid-2,
  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: 1fr !important;
  }

  /* Inputs táctiles — altura mínima */
  .form-input,
  .form-select,
  .form-textarea {
    min-height: 2.75rem;
    font-size: 1rem; /* evita zoom automático en iOS */
  }
}

/* Grids de formulario responsivos (se usan directamente en templates) */
.form-grid-2 {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
.form-grid-3 {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
.form-grid-4 {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  .form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .form-grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ---- 14f. Modales — pantalla completa en móvil ---- */
@media (max-width: 639px) {
  .modal-overlay {
    padding: 0;
    align-items: flex-end; /* desliza desde abajo (sheet pattern) */
  }
  .modal-container,
  .modal-container-lg,
  .modal-container-xl {
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    max-height: 92vh;
  }
}

/* ---- 14g. Cards / Stat cards en móvil ---- */
@media (max-width: 639px) {
  .stat-card-value {
    font-size: 1.5rem;
  }
  .card {
    padding: 1rem;
  }
}

/* ---- 14h. Dropdown de usuario — full width en móvil ---- */
@media (max-width: 479px) {
  .dropdown-menu {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-width: unset;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    margin-top: 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  }
}

/* ---- 14i. Paginación compacta en móvil ---- */
@media (max-width: 479px) {
  .pagination-btn {
    padding: 0.5rem 0.5rem;
    font-size: 0.8125rem;
  }
  /* Ocultar texto "Primera"/"Última" en pantallas muy pequeñas */
  .pagination-btn .pagination-text {
    display: none;
  }
}

/* ---- 14j. Navbar — nombre truncado en móvil ---- */
@media (max-width: 479px) {
  .header .user {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9375rem;
  }
}

/* ============================================================
   15. PÁGINAS DE FORMULARIO
   ============================================================ */

/* Wrapper centrado para formularios de creación/edición */
.form-page {
  max-width: 44rem;
  margin: 0 auto;
}

/* Tarjeta contenedora */
.form-card {
  background-color: white;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-heavy);
  padding: 2rem;
}
@media (max-width: 639px) {
  .form-card {
    padding: 1.25rem;
  }
}

/* Botón / enlace de navegación hacia atrás */
.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--color-primary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 1.5rem;
  transition: var(--transition);
  opacity: 0.8;
}
.nav-back:hover {
  color: var(--color-secondary);
  text-decoration: none;
  opacity: 1;
  transform: translateX(-2px);
}

/* Sección con fondo gris claro dentro del form */
.form-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem 1.5rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 639px) {
  .form-section {
    padding: 1rem 1rem 1.25rem;
  }
}

/* Título de sección */
.form-section-title {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.625rem;
  border-bottom: 2px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.form-section-title svg {
  width: 0.9rem;
  height: 0.9rem;
  flex-shrink: 0;
}

/* Fila de acciones (botones al final del form) */
.form-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 1.5rem;
  margin-top: 0.25rem;
  border-top: 1px solid #f1f5f9;
  flex-wrap: wrap;
  align-items: center;
}
@media (max-width: 639px) {
  .form-actions {
    flex-direction: column;
  }
  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Aviso informativo al inicio de un formulario */
.info-box {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: #eff6ff;
  border-left: 4px solid var(--color-primary);
  padding: 0.875rem 1rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: #1e40af;
  line-height: 1.55;
}
.info-box svg {
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.1rem;
}
.info-box-warning {
  background: #fffbeb;
  border-left-color: #f59e0b;
  color: #92400e;
}
.info-box-success {
  background: #f0fdf4;
  border-left-color: #10b981;
  color: #166534;
}

/* Barra informativa (planilla asociada al registro) */
.planilla-bar {
  background: linear-gradient(135deg, #f0f7ff 0%, #e8f4ff 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: var(--color-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  align-items: center;
}
.planilla-bar strong {
  font-weight: 700;
}

/* ============================================================
   16. TARJETAS DE DETALLE (vista de trabajo)
   ============================================================ */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem 1.5rem;
  margin-top: 1rem;
}
@media (min-width: 640px) {
  .detail-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 1024px) {
  .detail-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.detail-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
  margin-bottom: 0.2rem;
}
.detail-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1f2937;
}
.detail-value-mono {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1f2937;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Cabecera hero de la vista de trabajo */
.work-view-header {
  background: white;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.work-view-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.25;
}
@media (min-width: 640px) {
  .work-view-title {
    font-size: 1.625rem;
  }
}

/* Tarjeta de firma digital */
.firma-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-lg);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  flex: 1 1 0;
  min-width: 0;
}
.firma-card-avatar {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--radius-pill);
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.firma-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.firma-card-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #9ca3af;
  margin-bottom: 0.1rem;
}
.firma-card-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
}
.firma-card-date {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.1rem;
}
.firma-card-pending {
  font-size: 0.875rem;
  color: #9ca3af;
  font-style: italic;
}

/* ============================================================
   17. ESTADOS VACÍOS
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: #9ca3af;
}
.empty-state-icon {
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto 0.875rem;
  opacity: 0.35;
}
.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 0.375rem;
}
.empty-state-text {
  font-size: 0.875rem;
}
.empty-state-link {
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: none;
}
.empty-state-link:hover {
  text-decoration: underline;
}

/* ============================================================
   18. CANVAS DE FIRMA DIGITAL
   ============================================================ */

.firma-canvas {
  width: 100%;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  cursor: crosshair;
  touch-action: none;
  background: #f8fafc;
  transition:
    border-color 0.2s,
    background 0.2s;
  display: block;
}
.firma-canvas:hover {
  border-color: var(--color-primary);
  background: white;
}

/* ============================================================
   19. BADGES NUMÉRICOS (valores en celdas de tabla)
   ============================================================ */

.num-badge {
  display: inline-block;
  min-width: 2rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
}
.num-badge-blue {
  background: #dbeafe;
  color: #1e40af;
}
.num-badge-green {
  background: #dcfce7;
  color: #166534;
}
.num-badge-amber {
  background: #fef3c7;
  color: #92400e;
}
.num-badge-red {
  background: #fee2e2;
  color: #991b1b;
}
.num-badge-gray {
  background: #f3f4f6;
  color: #6b7280;
}

/* ============================================================
   19b. BARRA DE PROGRESO (modales de éxito con auto-cierre)
   ============================================================ */

.progress-bar {
  height: 3px;
  background: #e5e7eb;
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 1rem;
}
.progress-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-dark));
  border-radius: var(--radius-pill);
  transform-origin: left;
  transition: width 2.5s linear;
}
/* Variante verde para éxito */
.progress-bar-fill-success {
  background: linear-gradient(90deg, #10b981, #059669);
}

/* ============================================================
   20. TABLA DE TRABAJO (work-table)
   ============================================================ */

.work-table-wrapper {
  background: white;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.work-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.work-table-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #1f2937;
}
.work-table {
  min-width: 100%;
  font-size: 0.875rem;
  border-collapse: collapse;
}
.work-table thead {
  background: var(--color-primary);
  color: white;
}
.work-table thead th {
  padding: 0.75rem 1rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  text-align: left;
  border: none;
}
.work-table thead th.th-center {
  text-align: center;
}
.work-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.15s;
}
.work-table tbody tr:last-child {
  border-bottom: none;
}
.work-table tbody tr:hover {
  background-color: #f0f7ff;
}
.work-table tbody td {
  padding: 0.75rem 1rem;
  color: #374151;
  vertical-align: middle;
  border: none;
}
.work-table tbody td.td-center {
  text-align: center;
}
.work-table tbody td.td-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8125rem;
}
.work-table tbody td.td-primary {
  font-weight: 600;
  color: var(--color-primary);
}
.work-table tbody td.td-muted {
  color: #9ca3af;
  font-size: 0.8125rem;
}
.work-table tbody td.td-actions {
  white-space: nowrap;
}

/* Thead pegajoso (agregar .work-table-sticky al <table>) */
.work-table-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 10;
}

/* ============================================================
   21. AUTOCOMPLETE (buscador de texto con sugerencias)
   ============================================================

   HTML mínimo:
     <div class="ac-wrapper">
       <div class="ac-input-wrap">
         <input type="text" class="form-input" placeholder="Buscar...">
         <div class="ac-spinner hidden"></div>
       </div>
       <div class="ac-dropdown hidden"></div>
       <div class="ac-badge-wrap"></div>
     </div>
   ============================================================ */

.ac-wrapper {
  position: relative;
}

.ac-input-wrap {
  position: relative;
}
.ac-input-wrap input {
  padding-right: 2.5rem;
}

.ac-spinner {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  border: 2px solid #d1d5db;
  border-top-color: var(--color-primary);
  border-radius: var(--radius-pill);
  animation: acSpin 0.65s linear infinite;
  pointer-events: none;
}
@keyframes acSpin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

.ac-dropdown {
  position: absolute;
  z-index: 200;
  width: 100%;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-lg);
  box-shadow:
    0 8px 24px -4px rgba(0, 0, 0, 0.12),
    0 2px 6px -1px rgba(0, 0, 0, 0.06);
  max-height: 280px;
  overflow-y: auto;
  margin-top: 3px;
}

.ac-item {
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: #1f2937;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.1s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ac-item:last-child {
  border-bottom: none;
}
.ac-item:hover,
.ac-item.ac-active {
  background: #eff6ff;
  color: var(--color-primary);
}

.ac-empty {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: #9ca3af;
  text-align: center;
}

.ac-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: #dbeafe;
  color: var(--color-primary);
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.625rem 0.25rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-top: 0.375rem;
}
.ac-badge-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-primary);
  padding: 0;
  line-height: 1;
  opacity: 0.7;
  display: flex;
  align-items: center;
  transition: opacity 0.15s;
}
.ac-badge-btn:hover {
  opacity: 1;
}

/* ============================================================
   22. HEADER PRINCIPAL (mejoras adicionales)
   ============================================================ */

/* Asegura que el header no se "rompa" en pantallas muy pequeñas */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Mejora el main-container para que en móvil ocupe bien el espacio */
.main-container {
  min-height: calc(100vh - 4rem);
}

/* ============================================================
   23. MEJORAS iOS / TÁCTIL
   ============================================================ */

/* Evita el zoom automático en inputs en iOS (requiere font-size ≥ 16px) */
@media (max-width: 767px) {
  .form-input,
  .form-select,
  .form-textarea,
  input[type="text"],
  input[type="date"],
  input[type="time"],
  input[type="number"],
  input[type="email"],
  select,
  textarea {
    font-size: 1rem !important;
  }
}

/* Área de toque mínima para todos los botones */
button,
a,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

/* Scroll suave global */
html {
  scroll-behavior: smooth;
}

/* Mejora del focus para accesibilidad */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

/* Scrollbar personalizada (navegadores Chromium) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ============================================================
   24. UTILIDADES DE TABLA MEJORADAS
   ============================================================ */

/* Filas alternadas (zebra) — usar .work-table.table-zebra */
.table-zebra tbody tr:nth-child(even) {
  background-color: #fafafa;
}
.table-zebra tbody tr:nth-child(even):hover {
  background-color: #f0f7ff;
}

/* Indicador de columna ordenable */
.th-sortable {
  cursor: pointer;
  user-select: none;
}
.th-sortable:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* ============================================================
   25. FORMULARIO — INDICADOR DE CAMPO REQUERIDO
   ============================================================ */

.form-required {
  color: #ef4444;
  margin-left: 0.125rem;
  font-size: 0.875em;
}

/* Helper text mejorado */
.form-help {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  line-height: 1.4;
}

/* Error mejorado con ícono */
.form-error {
  font-size: 0.75rem;
  color: #ef4444;
  margin-top: 0.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  line-height: 1.4;
}

/* ============================================================
   26. CABECERA DE SECCIÓN (resumen de datos) 
   ============================================================ */

/* Bloque hero compacto con fondo degradado */
.hero-info {
  background: linear-gradient(
    135deg,
    var(--color-secondary) 0%,
    var(--color-primary) 100%
  );
  border-radius: var(--radius-card);
  padding: 1.5rem;
  color: white;
  margin-bottom: 1.25rem;
}
.hero-info-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
@media (min-width: 640px) {
  .hero-info-title {
    font-size: 1.5rem;
  }
}
.hero-info-subtitle {
  font-size: 0.8125rem;
  opacity: 0.8;
  margin-bottom: 1rem;
}
.hero-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem 1.5rem;
}
@media (min-width: 640px) {
  .hero-info-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.hero-info-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  opacity: 0.65;
  margin-bottom: 0.15rem;
}
.hero-info-value {
  font-size: 0.9375rem;
  font-weight: 600;
}
.hero-info-value-mono {
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
