/* Estilo general tipo SENA */
:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  background: #edf9f2;
  color: #14332d;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #edf9f2 0%, #f5fcf7 100%);
}
.page-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px;
}
header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  padding: 20px 26px;
  background: linear-gradient(90deg, #006e2e 0%, #009640 100%);
  border-radius: 16px;
  color: #ffffff;
}

/* FILA 1: identidad + acciones del usuario */
.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

header .brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
header .brand-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: #ffffff;
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  background-image: url('../../img/logoSena.png');
  background-position: center;
  background-size: 70%;
  background-repeat: no-repeat;
  color: transparent;
  font-size: 0;
}

/* FILA 2 escritorio: navegación horizontal + acciones de usuario. Este bloque
   se oculta por completo en móvil (<=768px). */
.desktop-navigation {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
}

/* Botones normales del menú (hacen wrap si hay muchos) */
.desktop-menu-items {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}

/* [Salir] [Cambiar contraseña]: pegados al extremo derecho (solo escritorio) */
.header-user-actions-desktop {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

nav.desktop-navigation a {
  color: #ffffff;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 999px;
  transition: background 0.2s ease, transform 0.2s ease;
  border: 1px solid rgba(255,255,255,0.18);
  display: inline-flex;
  align-items: center;
}
nav.desktop-navigation a:hover {
  background: rgba(255,255,255,0.18);
  transform: translateY(-1px);
}

/* Botones de acción (icono cuadrado, extremo derecho de la fila del menú) */
.header-user-actions-desktop .action-link {
  gap: 8px;
  background: rgba(255,255,255,0.06);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  padding: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  text-indent: -9999px; /* ocultar texto si queda presente */
  transition: background 0.2s ease, transform 0.2s ease;
}
.header-user-actions-desktop .action-link:hover {
  background: rgba(255,255,255,0.18);
  transform: translateY(-1px);
}

/* Iconos SVG base de los botones de acción */
.header-user-actions-desktop .action-link::before {
  content: '';
  width: 20px;
  height: 20px;
  display: inline-block;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Icono cerrar sesión (original) */
.header-user-actions-desktop .action-link::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'><path d='M16 13v-2H7V8l-5 4 5 4v-3zM20 3h-8v2h8v14h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z'/></svg>");
}

/* Icono cambiar contraseña (candado) */
.header-user-actions-desktop .action-link.action-password::before {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'><path d='M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z'/></svg>");
}

/* Estilo heredado de logout-icon usado en plantillas antiguas */
header .logout-icon {
  background: rgba(255,255,255,0.06);
  color: #ffffff;
  border-radius: 10px;
  padding: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  text-decoration: none;
}
header .logout-icon svg {
  width: 20px;
  height: 20px;
  stroke: #ffffff;
  fill: none;
}

/* ============================================================
   MENÚ RESPONSIVE (móvil / tablets pequeñas)
   Escritorio (>768px): la navegación horizontal se mantiene IGUAL.
   Móvil (<=768px): se oculta la navegación horizontal y el menú se
   reemplaza por un botón hamburguesa ☰ que despliega las mismas
   opciones ($headerNav) más las acciones de usuario.
   ============================================================ */
.mobile-menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  color: #ffffff;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease, transform 0.2s ease;
}
.mobile-menu-toggle:hover {
  background: rgba(255,255,255,0.18);
}
.mobile-menu-toggle:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}
.mobile-menu-toggle svg {
  width: 22px;
  height: 22px;
  fill: #ffffff;
}
.mobile-menu-toggle .icon-close { display: none; }
.mobile-menu-toggle[aria-expanded="true"] .icon-menu { display: none; }
.mobile-menu-toggle[aria-expanded="true"] .icon-close { display: block; }

/* Menú móvil: SIEMPRE oculto en su regla base (incluso en escritorio no existe
   visualmente); solo se abre con .is-open dentro del media query movil.
   Así nunca puede aparecer una segunda lista de enlaces por defecto. */
.mobile-navigation {
  display: none;
  background: #ffffff;
  color: #14332d;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
  padding: 8px;
  margin-top: 4px;
}

/* Opciones del menú móvil: fila completa, sin subrayado, sin azul por defecto */
.mobile-nav-items { display: flex; flex-direction: column; }
.mobile-nav-items a {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 10px;
  color: #14332d;
  text-decoration: none;
  font-weight: 500;
}
.mobile-nav-items a:hover { background: #f0fdf4; }
.mobile-nav-items a.active {
  background: #d1fae5;
  color: #065f46;
  font-weight: 600;
}

.mobile-nav-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 8px 4px;
}

.mobile-nav-actions { display: flex; flex-direction: column; }
.mobile-nav-action {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 500;
}
.mobile-nav-action:hover { background: #f0fdf4; }
.mobile-nav-password { color: #1d4ed8; }
.mobile-nav-logout { color: #b91c1c; }

@media (max-width: 768px) {
  /* Escritorio desaparece por completo en móvil: navegación y acciones */
  .desktop-navigation {
    display: none;
  }
  header .header-user-actions-desktop {
    display: none;
  }

  /* ☰ sustituye visualmente a todo el menú desktop */
  .mobile-menu-toggle {
    display: inline-flex;
  }

  /* Menú móvil: cerrado por defecto, se abre solo con .is-open */
  .mobile-navigation.is-open {
    display: block;
  }

  .header-top {
    align-items: center;
  }
  .header-brand {
    gap: 10px;
  }
  .header-brand .brand-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }
  .header-brand > div:last-child {
    min-width: 0;
    flex: 1;
  }
}
main {
  margin-top: 24px;
}
.page-title {
  margin: 0 0 16px;
  font-size: clamp(1.8rem, 2.5vw, 2.5rem);
  line-height: 1.05;
}
.subtitle {
  margin: 0 0 24px;
  color: #475569;
}
.dashboard-grid,
.form-grid {
  display: grid;
  gap: 16px;
}
.dashboard-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}
.card h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}
.card p {
  margin: 0;
  color: #475569;
}
.card a {
  display: inline-flex;
  margin-top: 16px;
  color: #0c3a70;
  text-decoration: none;
  font-weight: 600;
}
.card a:hover {
  text-decoration: underline;
}
.auth-panel,
.content-panel {
  background: #ffffff;
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
}
.auth-panel form,
.content-panel form {
  display: grid;
  gap: 18px;
}
input[type="text"],
input[type="password"],
button,
select,
textarea {
  font: inherit;
}
input,
textarea,
select {
  width: 100%;
  display: block;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  padding: 14px 16px;
  background: #f9fbff;
  color: #0f172a;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus,
textarea:focus,
select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
  outline: none;
}
button {
  width: fit-content;
  border: none;
  border-radius: 12px;
  padding: 14px 22px;
  background: #009640;
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.2s ease, background 0.2s ease;
}
button:hover {
  transform: translateY(-1px);
  background: #007b35;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.editor-toolbar button {
  background: #f3f4f6;
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.9rem;
}

.editor-toolbar button:hover,
.editor-toolbar button:focus {
  background: #e2e8f0;
}

.rich-editor {
  min-height: 170px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  padding: 14px;
  background: #ffffff;
  color: #0f172a;
  overflow-y: auto;
}

.rich-editor:focus {
  outline: 2px solid rgba(37, 99, 235, 0.2);
}

.detalle-texto {
  margin-top: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.alert {
  padding: 14px 18px;
  border-radius: 14px;
  background: #ffe4e6;
  color: #9f1239;
  border: 1px solid #fecdd3;
}
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 18px;
  min-width: 700px;
}
table th,
table td {
  padding: 14px 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  text-align: left;
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
table thead {
  background: #f8fafc;
}
table tbody tr:hover {
  background: #f8fafc;
}
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.table-responsive table {
  min-width: 100%;
}
table td a {
  display: inline-block;
  white-space: normal;
}
/* Estilos para formularios con fieldsets */
fieldset {
  border: 1px solid rgba(0, 86, 37, 0.18);
  border-radius: 12px;
  padding: 18px 20px;
  margin: 0 0 18px;
  background: #f4fcf6;
}
fieldset legend {
  padding: 0 8px;
  font-weight: 700;
  color: #00552b;
  font-size: 0.95rem;
}
/* Estilos para secciones de información */
.info-grid {
  display: grid;
  gap: 20px;
  margin-bottom: 24px;
}
.info-section {
  background: #f9fbff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  padding: 18px 20px;
}
.info-section h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
  color: #00552b;
}
.info-section p {
  margin: 8px 0;
  color: #14332d;
  font-size: 0.95rem;
}
.info-section p strong {
  color: #0a2a1f;
  font-weight: 700;
}
/* Estilos para botones secundarios y grupo de botones */
.btn,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: 12px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  border: none;
}
.btn {
  background: #0c3a70;
  color: #ffffff;
}
.btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}
.btn-secondary {
  background: #e2e8f0;
  color: #1e293b;
  margin-left: 12px;
}
.btn-secondary:hover {
  background: #cbd5e1;
  transform: translateY(-1px);
}
.button-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}
/* Estilos para checkbox dentro de labels */
label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
}
label input[type="checkbox"] {
  width: auto;
  margin: 0;
}
/* Tabla mejorada */
table a {
  color: #0c3a70;
  text-decoration: none;
  font-weight: 500;
  margin-right: 8px;
}
table a:hover {
  text-decoration: underline;
}

/* Ajustes específicos para la tabla de aprendices: reducir tamaño de letra y padding para mejor visualización */
.table-aprendices th,
.table-aprendices td {
  font-size: 0.82rem;
  padding: 7px 8px;
}

.table-aprendices {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Ajustes por columna para mejorar distribución y legibilidad */
.table-aprendices th:nth-child(1),
.table-aprendices td:nth-child(1) {
  width: 10%; /* Documento */
  font-size: 0.82rem;
  padding: 6px 6px;
}
.table-aprendices th:nth-child(2),
.table-aprendices td:nth-child(2) {
  width: 17%; /* Nombre Completo */
  font-size: 0.84rem;
  padding: 6px 8px;
}
.table-aprendices th:nth-child(3),
.table-aprendices td:nth-child(3) {
  width: 8%; /* Ficha */
  font-size: 0.82rem;
  padding: 6px 6px;
}
.table-aprendices th:nth-child(4),
.table-aprendices td:nth-child(4) {
  width: 16%; /* Programa */
  font-size: 0.82rem;
  padding: 6px 6px;
}
.table-aprendices th:nth-child(5),
.table-aprendices td:nth-child(5) {
  width: 14%; /* Correo */
  font-size: 0.82rem;
  padding: 6px 6px;
  white-space: normal;
}
.table-aprendices th:nth-child(6),
.table-aprendices td:nth-child(6) {
  width: 12%; /* Correo Alternativo */
  font-size: 0.82rem;
  padding: 6px 6px;
  white-space: normal;
}
.table-aprendices th:nth-child(7),
.table-aprendices td:nth-child(7) {
  width: 8%; /* Estado */
  font-size: 0.82rem;
  padding: 6px 6px;
}
.table-aprendices th:nth-child(8),
.table-aprendices td:nth-child(8) {
  width: 10%; /* Acciones */
  font-size: 0.82rem;
  padding: 6px 6px;
  white-space: nowrap;
}

.table-aprendices.aprobacion th:nth-child(1),
.table-aprendices.aprobacion td:nth-child(1) {
  width: 10%; /* Acción */
  font-size: 0.84rem;
  padding: 6px 8px;
}
.table-aprendices.aprobacion th:nth-child(2),
.table-aprendices.aprobacion td:nth-child(2) {
  width: 16%; /* Documento */
  font-size: 0.9rem;
  padding: 6px 8px;
}
.table-aprendices.aprobacion th:nth-child(3),
.table-aprendices.aprobacion td:nth-child(3) {
  width: 30%; /* Nombre Completo */
  font-size: 0.92rem;
  padding: 6px 10px;
}
.table-aprendices.aprobacion th:nth-child(4),
.table-aprendices.aprobacion td:nth-child(4) {
  width: 10%; /* Ficha */
  font-size: 0.88rem;
  padding: 6px 8px;
}
.table-aprendices.aprobacion th:nth-child(5),
.table-aprendices.aprobacion td:nth-child(5) {
  width: 23%; /* Resultado de la valoración / Estado */
  font-size: 0.88rem;
  padding: 6px 8px;
  white-space: normal;
}

.toggle-revision {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #0c3a70;
  color: #ffffff;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
}

.toggle-revision:hover {
  background: #174a82;
}

.detalle-texto {
  margin-top: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.revision-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 18px;
}

.revision-card h4 {
  margin: 0 0 10px;
}

.revision-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.print-action {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.print-action button {
  background: #009640;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 12px;
}

.table-aprendices.aprobacion th:nth-child(6),
.table-aprendices.aprobacion td:nth-child(6) {
  width: 18%; /* Confirmar envío de correo */
  font-size: 0.88rem;
  padding: 6px 8px;
  white-space: normal;
  word-break: keep-all;
  min-width: 140px;
}
.table-aprendices.aprobacion .btn {
  padding: 8px 14px;
  min-width: 90px;
  white-space: nowrap;
}
/* Tabla mejorada */
table a {
  color: #0c3a70;
  text-decoration: none;
  font-weight: 500;
  margin-right: 8px;
}
table a:hover {
  text-decoration: underline;
}

/* Estilos para badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}
.badge-activa {
  background: #d1fae5;
  color: #065f46;
}
.badge-finalizada {
  background: #e5e7eb;
  color: #374151;
}
.badge-suspendida {
  background: #fee2e2;
  color: #7f1d1d;
}

/* Estilos para detalle de alertas: semáforos y layout */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 18px;
  align-items: start;
}
.detail-grid span {
  display: block;
  color: #2f3b52;
  font-size: 0.95rem;
}
.detail-grid span.detail-risk,
.detail-grid span.detail-ficha {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.detail-grid span strong { color: #262626; }

.risk-circle,
.ficha-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  min-width: 14px;
  min-height: 14px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  line-height: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
  background-color: #cfd8dc;
  border: 1px solid rgba(0,0,0,0.12);
}

/* Colores para riesgo */
.risk-critico { background: #e93f3f; }
.risk-atencion { background: #e8a71c; }
.risk-normal { background: #35b77a; }

/* Colores para alerta ficha */
.ficha-practica { background-color: #35b77a !important; }
.ficha-d18     { background-color: #e8a71c !important; }
.ficha-q12     { background-color: #ff66a3 !important; }
.ficha-q6      { background-color: #ff8a8a !important; }
.ficha-cancel  { background-color: #7a0b0b !important; }
.ficha-sin-alerta { background-color: #cfd8dc !important; }


/* Estilos para estado automático de fichas */
.estado-info {
  margin: 16px 0;
  padding: 16px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
}
.estado-info label {
  display: block;
  font-weight: 600;
  color: #0c4a6e;
  margin-bottom: 8px;
}
.estado-explicacion {
  color: #374151;
}
.estado-explicacion ul {
  margin: 8px 0 0 0;
  padding-left: 20px;
}
.estado-explicacion li {
  margin: 4px 0;
}
.estado-display {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.estado-display small {
  color: #6b7280;
  font-style: italic;
}
.estado-manual {
  margin: 16px 0;
  padding: 12px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
}
.estado-manual label {
  display: block;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 8px;
}
.estado-manual select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d97706;
  border-radius: 6px;
  background: #ffffff;
}
.estado-manual small {
  display: block;
  color: #a16207;
  font-size: 0.85rem;
  margin-top: 4px;
}

/* Estilos para búsqueda de fichas con autocomplete */
.ficha-search {
  position: relative;
  margin-bottom: 16px;
}
.ficha-search input {
  width: 100%;
}
.suggestions-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-top: none;
  border-radius: 0 0 12px 12px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.1);
}
.suggestion-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  transition: background 0.2s ease;
  font-size: 0.95rem;
}
.suggestion-item:hover {
  background: #f0f4f8;
}
.suggestion-item:last-child {
  border-bottom: none;
}
.suggestion-item.no-results,
.suggestion-item.error {
  cursor: default;
  color: #64748b;
  text-align: center;
}
.suggestion-item.no-results:hover,
.suggestion-item.error:hover {
  background: transparent;
}
.suggestion-item.error {
  color: #dc2626;
}

/* Alertas mejoradas */
.alert {
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid;
  margin-bottom: 16px;
}
.alert-success {
  background: #d1fae5;
  color: #065f46;
  border-color: #a7f3d0;
}
.alert-error {
  background: #fee2e2;
  color: #7f1d1d;
  border-color: #fecaca;
}
/* Estilos para sección de importación */
.import-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(15, 23, 42, 0.12);
}
.import-section h2 {
  margin: 0 0 16px;
  font-size: 1.4rem;
  color: #0c3a70;
}
.import-description {
  margin: 0 0 20px;
  color: #475569;
  line-height: 1.5;
}
.download-template {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  text-align: center;
}
.btn-template {
  display: inline-block;
  background: #059669;
  color: #ffffff;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  margin-bottom: 8px;
  transition: background 0.2s ease;
}
.btn-template:hover {
  background: #047857;
  color: #ffffff;
}
.download-template small {
  color: #065f46;
  display: block;
}
.csv-format {
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}
.csv-format h3 {
  margin: 0 0 16px;
  color: #0c3a70;
  font-size: 1.1rem;
}
.format-example {
  margin-bottom: 16px;
  line-height: 1.6;
}
.format-example code {
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
}
.csv-example {
  margin-bottom: 16px;
}
.csv-example pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.4;
}
.csv-notes {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 16px;
}
.csv-notes strong {
  color: #92400e;
}
.csv-notes ul {
  margin: 8px 0 0;
  padding-left: 20px;
}
.csv-notes li {
  margin-bottom: 4px;
  color: #78350f;
  line-height: 1.4;
}
.file-upload {
  margin-bottom: 16px;
}
.file-upload input[type="file"] {
  display: block;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  background: #f9fbff;
  width: 100%;
  max-width: 400px;
}
.btn-import {
  background: #059669;
  color: #ffffff;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease;
}
.btn-import:hover {
  background: #047857;
}
footer {
  margin-top: 40px;
  text-align: center;
  color: #64748b;
  font-size: 0.95rem;
}

/* Ajustes para tabla de seguimiento: compacta y bien distribuida */
.table-seguimiento {
  margin-left: -16px;
  margin-right: -16px;
  width: calc(100% + 32px);
}
.table-seguimiento th,
.table-seguimiento td {
  font-size: 0.85rem;
  padding: 6px 8px;
}

.table-seguimiento th:nth-child(1),
.table-seguimiento td:nth-child(1) {
  width: 11%; /* Documento */
  font-size: 0.78rem;
  padding: 6px 8px;
}
.table-seguimiento th:nth-child(2),
.table-seguimiento td:nth-child(2) {
  width: 14%; /* Nombre Completo */
  font-size: 0.85rem;
}
.table-seguimiento th:nth-child(3),
.table-seguimiento td:nth-child(3) {
  width: 7%; /* Ficha */
  font-size: 0.78rem;
  padding: 6px 8px;
}
.table-seguimiento th:nth-child(4),
.table-seguimiento td:nth-child(4) {
  width: 12%; /* Programa */
  font-size: 0.76rem;
  padding: 6px 8px;
  line-height: 1.02;
  white-space: normal;
  overflow-wrap: break-word;
}
.table-seguimiento th:nth-child(5),
.table-seguimiento td:nth-child(5) {
  width: 13%; /* Estado General */
  font-size: 0.74rem;
  padding: 6px 8px;
}
.table-seguimiento th:nth-child(6),
.table-seguimiento td:nth-child(6) {
  width: 10%; /* Instructor */
}

/* Ajustes específicos para la tabla de fichas */
.table-fichas th,
.table-fichas td {
  font-size: 0.82rem;
}
.table-fichas th:nth-child(1),
.table-fichas td:nth-child(1) {
  width: 12%; /* Número de ficha completo */
}
.table-fichas th:nth-child(3),
.table-fichas td:nth-child(3) {
  width: 12%; /* Nivel */
}
.table-fichas th:nth-child(7),
.table-fichas td:nth-child(7) {
  width: 10%; /* Estado */
}
.table-fichas th:nth-child(8),
.table-fichas td:nth-child(8) {
  width: 11%; /* Acciones */
  font-size: 0.82rem;
}
.table-fichas td .btn-action,
.table-fichas td a {
  font-size: 0.8rem;
}
.table-seguimiento th:nth-child(7),
.table-seguimiento td:nth-child(7) {
  width: 9%; /* Fecha Objetivo */
  font-size: 0.76rem;
  padding: 6px 8px;
}
.table-seguimiento th:nth-child(8),
.table-seguimiento td:nth-child(8) {
  width: 10%; /* Próxima Acción */
  font-size: 0.76rem;
  padding: 6px 8px;
  line-height: 1.02;
  white-space: normal;
  overflow-wrap: break-word;
}
.table-seguimiento th:nth-child(9),
.table-seguimiento td:nth-child(9) {
  width: 9%; /* Acciones */
  font-size: 0.76rem;
  padding: 6px 8px;
}

@media (max-width: 640px) {
  header {
    padding: 18px;
  }
  .page-shell {
    padding: 18px;
  }
  .info-grid {
    grid-template-columns: 1fr;
  }
  .button-group {
    flex-direction: column;
    align-items: stretch;
  }
  .btn,
  .btn-secondary {
    width: 100%;
  }
  .btn-secondary {
    margin-left: 0;
  }
  .suggestions-list {
    max-height: 200px;
  }
  .csv-example pre {
    font-size: 0.75rem;
  }
}
/* Estilos para el módulo de seguimiento */
.estado-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.estado-en-formación { background: #dbeafe; color: #1e40af; }
.estado-completado { background: #dcfce7; color: #166534; }
.estado-aprobado { background: #dcfce7; color: #166534; }
.estado-en-revisión { background: #fef3c7; color: #92400e; }
.estado-suspendido { background: #fee2e2; color: #dc2626; }
.estado-retirado { background: #f3f4f6; color: #374151; }

/* ✨ Estilo para filtros 50/50: uso de flexbox y ajuste de mínimo ancho */
.filters {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  align-items: center;
}
.filters > * {
  flex: 1 1 0%;
  min-width: 0; /* permite que inputs reduzcan su ancho dentro de contenedores flex */
}
.filters input,
.filters select {
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 640px) {
  .filters {
    flex-direction: column;
  }
}

.filters input,
.filters select {
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
  width: 100%;
}

.filters input::placeholder {
  color: #9ca3af;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.detail-section {
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  padding: 20px;
}

.detail-section h3 {
  margin: 0 0 16px 0;
  color: #0c3a70;
  font-size: 1.1rem;
}

.detail-section p {
  margin: 8px 0;
  line-height: 1.5;
}

.bitacoras-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.bitacoras-meses-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.bitacora-section {
  margin-bottom: 20px;
}

.bitacoras-layout {
  grid-template-columns: minmax(280px, 1fr) minmax(380px, 1.5fr);
}

@media (max-width: 1024px) {
  .bitacoras-layout {
    grid-template-columns: 1fr;
  }
}

.readonly-info {
  background: #f1f5f9;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.readonly-info p {
  margin: 4px 0;
  color: #475569;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

@media (max-width: 768px) {
  .filters {
    grid-template-columns: 1fr;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .form-actions {
    flex-direction: column;
  }
  .files-list {
    margin-bottom: 20px;
  }
  .file-item {
    margin-bottom: 12px;
  }
  .file-info {
    font-size: 0.9rem;
  }
  .file-actions {
    margin-top: 8px;
  }
}

/* Estilos para archivos y documentos */
.files-list {
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.files-list h4 {
  margin: 0 0 12px 0;
  color: #0c3a70;
  font-size: 0.95rem;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 6px;
  margin-bottom: 8px;
}

.file-info {
  flex: 1;
}

.file-info strong {
  color: #0c3a70;
  display: block;
  margin-bottom: 4px;
}

.file-info small {
  color: #64748b;
  display: block;
  line-height: 1.4;
}

.file-actions {
  display: flex;
  gap: 8px;
  margin-left: 12px;
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-primary {
  background: #059669;
}

.btn-primary:hover {
  background: #047857;
}

.btn-danger {
  background: #ef4444;
  color: #ffffff;
}

.btn-danger:hover {
  background: #dc2626;
}

.archivo-info {
  background: #f8fafc;
  border-left: 4px solid #3b82f6;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 4px;
}

.archivo-info p {
  margin: 4px 0;
}

.archivo-info strong {
  color: #0c3a70;
}

.fieldset-description {
  font-size: 0.9rem;
  color: #64748b;
  margin: -8px 0 16px 0;
}

.info-text {
  display: block;
  margin-top: 8px;
  padding: 8px;
  background: #ecfdf5;
  border-left: 3px solid #10b981;
  color: #065f46;
  border-radius: 4px;
}

/* Estilos para el dashboard */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
  margin: 0 0 12px 0;
  font-size: 0.9rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card p {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: #0c3a70;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 28px;
}

.chart-container {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
}

.chart-container.span-2 {
  grid-column: span 2;
}

.chart-container h3 {
  margin: 0 0 16px;
  font-size: 1.05rem;
  color: #0c3a70;
}

.chart-container canvas {
  width: 100% !important;
  max-height: 320px;
}

.stat-card-accent {
  color: #059669;
}

.stat-card-warning {
  color: #f59e0b;
}

.stat-card-danger {
  color: #ef4444;
}
