* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', sans-serif;
}

body {
  color: #111;
  padding-top: 2rem;
  background: #f5f7fa; /* tu gris claro de fondo */
}

.container {
  max-width: 48rem;        /* mismo valor que uses en .header-card */
  margin: 0 auto;
  padding: 1rem;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  margin: 0;
  width: 100%;
}

#headerCard {
  display: none;
}

.header .logo,
.header .actions {
  flex: 0 0 auto;
}

.header-card {
  background: white;
  border-radius: 1rem;
  padding: 1rem 1.5rem;        /* mismo padding que tus .card */
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  max-width: 48rem;            /* igual que tus .card o el valor que uses */
  margin: auto;         /* centrado + separación vertical */
  display: block;
}

.header-card .logo-img {
  height: 60px;
  width: auto;
}

.header-card .avatar {
  width: 40px;
  height: 40px;
  object-fit: cover;   /* mantiene proporción y centra */
  border-radius: 50%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo .circle {
  width: 20px;
  height: 20px;
  background-color: #2563eb;
  border-radius: 50%;
}

.logo .text h1 {
  font-size: 1.2rem;
  font-weight: bold;
}

.logo .text p {
  font-size: 0.75rem;
  color: #666;
}

.logo-auth {
  text-align: center;
  margin-bottom: 1rem;
}
.logo-img-auth {
  height: 3rem;
}

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

.user-name {
  margin-right: 0.75rem;
  font-size: 1rem;
  font-weight: 500;
  color: #333;
}

.avatar-wrapper {
  position: relative;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
}

.oculto {
  display: none !important;
}

/* ─── DROPDOWN AVATAR UNIFICADO ─────────────────────────── */
.dropdown,
#dropdown-menu {
  position: absolute;
  top: 60px;
  right: 10px;
  width: 220px;               /* unifica la anchura */
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 0.75rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  overflow: hidden;
  z-index: 1000;
}

.dropdown button,
#dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  width: 100%;
  background: none;
  border: none;
  color: #333;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.dropdown button:hover,
#dropdown-menu button:hover {
  background-color: #f5f5f5;
}

/* Forzar tamaño fijo a todos los iconos dentro del dropdown */
.dropdown button svg,
.dropdown button img,
#dropdown-menu button svg,
#dropdown-menu button img {
  flex-shrink: 0;
  width: 20px !important;
  height: 20px !important;
  object-fit: contain;
}

.dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr; /* dos columnas iguales */
  gap: 1.5rem;
}

.card {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  width: 100%;             /* para ocupar la columna entera */
  box-sizing: border-box;
}

#informeFinal {
  max-width: 48rem; /* Igual que .panel */
  width: 100%;
  margin: 1.5rem auto;
  padding: 1rem 1.5rem;
  background: white;
  color: #000 !important;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.card h2 {
  font-size: 1.25rem;
  font-weight: bold;
  margin-bottom: 1.5rem;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Cada tarjeta: ícono arriba, texto abajo y ambos centrados */
.item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  transition: background 0.2s;
  cursor: pointer;
  text-align: center;
}

.item:hover {
  background: #f9fafb;
}

/* Iconos del menú principal */
.item img {
  width: 40px;         /* tamaño uniforme */
  height: 40px;
  object-fit: contain;
  margin-bottom: 0.5rem;
  color: #2563eb;
}

/* Texto bajo el icono */
.item p {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
}

.history ul {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  list-style: none;
}

.history li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
}

.history li img {
  width: 32px;          /* aumenta tamaño del icono */
  height: 32px;
  padding: 8px;         /* más espacio alrededor */
  background-color: #f3f4f6;
  border-radius: 6px;
  object-fit: contain;
}

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

.panel {
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
  padding: 2rem;
  max-width: 700px;
  margin: 4rem auto;
  animation: fadeIn 0.3s ease-in-out;
}

.panel h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.panel p {
  font-size: 1rem;
  color: #555;
  margin-bottom: 2rem;
}

.panel button {
  background-color: #2563eb;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.panel button:hover {
  background-color: #1d4ed8;
}

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

.panel, .card {
  max-width: 48rem;    /* coincidente con .header-card */
  margin: 1.5rem auto; /* centrado y separación */
  background: white;
  border-radius: 1rem;
  padding: 1rem 1.5rem;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.input-text {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  transition: border 0.3s ease;
}

.input-text:focus {
  outline: none;
  border-color: #2563eb;
}

button {
  background-color: #2563eb;
  color: white;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  width: 100%;
  margin-bottom: 0.75rem;
  transition: background-color 0.3s ease;
}

button:hover {
  opacity: 0.9;
  background-color: #1d4ed8;
}

.test-controls {
  display: flex;
  justify-content: space-between;
  margin-right: 0.5rem;
  margin-top: 2rem;
  gap: 1rem;
}

#select-opciones {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  margin-top: 1.5rem;
  transition: border 0.3s ease;
}

#select-opciones:focus {
  outline: none;
  border-color: #2563eb;
}

.lista-informes {
  margin-top: 2rem;
}

.item-informe {
  padding: 1rem 0;
  border-bottom: 1px solid #ddd;
}

.informe-card {
  border: 1px solid #e0e0e0;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border-radius: 12px;
  background: #f9fafb;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.informe-card .fecha {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.nota-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.nota-card p {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.nota-card .nota-nombre {
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.nota-card .nota-fecha {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.75rem;
}

.nota-card .test-controls {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

#contenedor-notas {
  margin-top: 2rem;
}

.progreso-preguntas {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 1rem;
  justify-content: center;
}

.progreso-preguntas .paso {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: #e5e7eb;
  color: #111827;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: all 0.3s ease;
}

.paso.activa {
  background-color: #3b82f6; /* azul */
  color: white;
}

.paso.respondida {
  background-color: #10b981; /* verde */
  color: white;
}

.submenu {
  margin-top: 0.5rem;
  padding-left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.submenu button {
  display: flex;
  align-items: center;
  padding: 0.3rem 0.8rem;
  background: transparent;
  border: none;
  color: #111;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.submenu button:hover {
  background-color: #f0f0f0;
  border-radius: 0.5rem;
}

/* ---- Informe final ---- */
.informe-final {
  max-width: 48rem;
  margin: auto;
  padding: 1rem 1.5rem;
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  font-family: Georgia, 'Times New Roman', serif; /* serif para cuerpo de informe */
  color: #222;
  line-height: 1.7;
}

/* Títulos dentro del informe */
.informe-final h3 {
  font-family: 'Segoe UI', sans-serif;
  font-size: 2rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 0.5rem;
  color: #111;
}

.informe-final .bloque {
  margin-bottom: 2rem;
}

/* Subtítulos de cada bloque */
.informe-final .bloque h4 {
  font-family: 'Segoe UI', sans-serif;
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
  color: #333;
  position: relative;
  padding-bottom: 0.25rem;
}
.informe-final .bloque h4::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 3px;
  background: #2563eb;
  border-radius: 2px;
}

/* Párrafos del contenido */
.informe-final .bloque p {
  margin: 0.6rem 0;
  text-align: justify;
}

/* Listas ordenadas y no ordenadas */
.informe-final .bloque ul,
.informe-final .bloque ol {
  margin: 0.8rem 0 0.8rem 1.5rem;
  line-height: 1.6;
}

/* Negritas en ítems */
.informe-final .bloque ul li strong {
  color: #111;
}

/* Ajuste de tablas KN-NOW MAP (si las usas) */
.informe-final table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}
.informe-final th,
.informe-final td {
  border: 1px solid #ddd;
  padding: 0.6rem 0.8rem;
  text-align: left;
}
.informe-final th {
  background: #f3f4f6;
}

/* Botones Finalizar y Descargar con margen extra */
.informe-final .test-controls {
  margin-top: 3rem;
  justify-content: flex-end;
}

/* === DAFO Minimalista Profesional === */
.informe-final .tabla-dafo {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  table-layout: fixed;            /* Columnas iguales */
  font-size: 0.95rem;
  color: #333;
}

.informe-final .tabla-dafo th,
.informe-final .tabla-dafo td {
  border: 1px solid #ddd;
  padding: 1rem;
  vertical-align: top;
}

.informe-final .tabla-dafo th {
  background: #f9f9f9;
  font-weight: 600;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;            /* No partir encabezados */
}

.informe-final .tabla-dafo td p {
  margin: 0 0 0.75rem;
  line-height: 1.5;
}

/* Diseño “hover” muy sutil */
.informe-final .tabla-dafo tbody tr:hover td {
  background: #fcfcfc;
}

/* Responsive: cada celda en bloque con etiqueta */
@media (max-width: 600px) {
  .informe-final .tabla-dafo,
  .informe-final .tabla-dafo thead,
  .informe-final .tabla-dafo tbody,
  .informe-final .tabla-dafo th,
  .informe-final .tabla-dafo td,
  .informe-final .tabla-dafo tr {
    display: block;
    width: auto;
  }
  .informe-final .tabla-dafo thead { display: none; }
  .informe-final .tabla-dafo tr { margin-bottom: 1rem; }
  .informe-final .tabla-dafo td {
    border: none;
    padding-left: 1.5rem;
    position: relative;
  }
  .informe-final .tabla-dafo td::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    position: absolute;
    left: 0;
  }
}

.informe-final .dafo-container {
  display: flex;
  flex-direction: column; /* apilar tablas */
  gap: 1.5rem;            /* espacio entre tablas */
  margin: 1.5rem 0;
}
 
.informe-final .dafo-container .tabla-dafo {
  width: 100%;            /* cada tabla ocupa todo el ancho */
  border-collapse: collapse;
  margin: 0;              
  border: 1px solid #ccc; /* borde suave */
}

.informe-final .dafo-container th,
.informe-final .dafo-container td {
  border: 1px solid #ddd;
  padding: 0.75rem 1rem;
  vertical-align: top;
}
  
.informe-final .dafo-container th {
  background: #f3f4f6;
  color: #333;
  font-weight: 600;
  text-transform: uppercase;
  text-align: left;
}
  
/* Párrafos continuos dentro de cada celda (sin viñetas) */
.informe-final .dafo-container td p {
  margin: 0.5rem 0;
  line-height: 1.5;
}
  
/* Responsive: en móvil, todo sigue full-width */
@media (max-width: 600px) {
  .informe-final .dafo-container .tabla-dafo { font-size: 0.9rem; }
}
 
.informe-final .dafo-container td p {
  margin: 0.5rem 0;               /* algo de espacio arriba y abajo */
  padding-bottom: 0.5rem;        /* para que la línea no quede pegada al texto */
  border-bottom: 1px solid #eee; /* separador muy sutil */
}

.informe-final .dafo-container td p:last-child {
  border-bottom: none;           /* elimina línea tras el último párrafo */
}

/* Encaje laboral recomendado */
.lista-encaje-laboral {
  list-style: disc inside;
  margin-top: 0.5rem 0 0 0;
}

@media print {
  /* Oculta todo lo que esté en .test-controls */
  .test-controls { display: none !important; }
}

/* Evita que un bloque se corte a la mitad */
.bloque, .tabla-dafo, .tabla-dafo tbody tr {
  page-break-inside: avoid;
}

/* Repite siempre el <thead> en cada página */
.tabla-dafo thead { display: table-header-group; }

@media print {
  /* Que cada bloque no se parta a la mitad */
  .bloque {
    page-break-inside: avoid;
  }
  /* Que las filas de tabla no se corten */
  .tabla-dafo,
  .tabla-dafo tr,
  .tabla-dafo td {
    page-break-inside: avoid;
  }
}

.auth-panel {
  background: white;
  border-radius: 1rem;
  padding: 2rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  max-width: 24rem;
  margin: 2rem auto;
}

.auth-panel h2 {
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-panel form {
  display: flex;
  flex-direction: column;
}

.auth-panel label {
  margin: 0.5rem 0 0.25rem;
}

.auth-panel input {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.auth-panel button {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #3366ff;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.auth-panel button:hover {
  background: #274edb;
}

.auth-panel p {
  margin-top: 1rem;
  text-align: center;
}

.auth-panel a {
  color: #3366ff;
  text-decoration: none;
}

.auth-panel a:hover {
  text-decoration: underline;
}

/* oculto por defecto */
.oculto { display: none !important; }

/* GRID DE IMÁGENES */
#image-options {
  display: grid;
  /* grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); */
  gap: 1rem;
  margin: 1rem 0;
  justify-items: center;
}

#image-options img {
  width: 200px;
  height: 200px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 8px;
  transition: border-color 0.2s, transform 0.2s;
}

#image-options img.selected {
  border-color: #2563eb;
  transform: scale(1.03);
}

#image-options .image-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

#image-options .image-option p {
  font-size: 0.9rem;
  margin: 0;
  color: #333;
}

#image-options .image-option img.selected {
  border-color: #3b82f6; /* tu color de selección */
}

.informe-footer {
  text-align: center;
  margin-top: 2rem;
}

.informe-footer img {
  height: 60px;
  margin-bottom: 1rem;
}

.informe-footer p {
  max-width: 600px;
  margin: 0 auto 1rem;
  line-height: 1.4;
}

.informe-footer p:last-child {
  margin-bottom: 0;
  font-weight: 600;
}

@media (max-width: 600px) {
  /* Agrupa todo en columna */
  .header-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
  }
  /* Logo, texto y avatar uno debajo de otro */
  #logoHeader, #userName, #avatar {
    width: 100%;
    text-align: center;
    margin-bottom: .5rem;
  }
  #avatar {
    max-width: 50px; /* ajusta al tamaño deseado */
    border-radius: 50%;
  }
}

@media (max-width: 600px) {
  .dashboard {
    display: flex;
    flex-direction: column;
    gap: 0rem !important;
  }

  /* Ya no hace falta margin-bottom en cada .card porque gap lo controla */
  .dashboard .card {
    margin: 0 !important;
    width: 100%;
  }
}

@media (max-width: 600px) {
  #image-options {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-gap: .5rem !important;
  }
  #image-options img {
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
  }
}

@media (max-width: 600px) {
  .tabla-dafo {
    width: 100%;
    border: none;
  }
  .tabla-dafo thead {
    display: none;
  }
  .tabla-dafo tbody tr {
    display: block;
    margin-bottom: 1rem;
  }
  .tabla-dafo tbody td {
    display: block;
    position: relative;
    padding-left: 50%;
    border: 1px solid #ddd;
    margin-bottom: .5rem;
  }
  .tabla-dafo tbody td::before {
    content: attr(data-label);
    position: absolute;
    left: .5rem;
    top: .5rem;
    font-weight: bold;
  }
}

@media (max-width: 600px) {
  /* Reduce un poco el gap y elimina padding extra */
  #informeFinal .test-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1rem;    /* deja 1rem de margen lateral dentro de la tarjeta */
    justify-content: center;
    margin-top: 1rem;
  }

  /* Cada botón ocupará 1/3 menos el gap, sin desbordar */
  #informeFinal .test-controls button {
    flex: 1 1 calc(33.333% - 0.5rem);
    min-width: 0;       /* permite que realmente se reduzca por debajo del contenido */
    box-sizing: border-box;
    margin: 0;          /* ya controlamos el espacio con gap */
    text-align: center;
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 600px) {
  /* Asegura que el dropdown sea lo suficientemente ancho */
  #dropdown-menu {
    min-width: 150px;
  }
  /* Da un poco de separación al username dentro del menú */
  #dropdown-menu .mobile-username {
    border-bottom: 1px solid #ddd;
    margin-bottom: .5rem;
  }
}

@media (max-width: 600px) {
  /* Contenedor de botones en cada nota: centrado y responsivo */
  .nota-card .test-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
  }

  /* Cada botón: ocupa hasta un tercio con un mínimo razonable */
  .nota-card .test-controls button {
    flex: 1 1 calc(33% - 0.5rem);
    min-width: 90px;
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
  }
}

/* ========= Ajustes botones Informe en móvil ========= */
@media (max-width: 600px) {
  /* Contenedor de botones */
  #informeFinal .test-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.5rem;
  }

  /* Cada botón ocupa un tercio del ancho, con un mínimo razonable */
  #informeFinal .test-controls button {
    flex: 1 1 calc(33.333% - 0.5rem);
    min-width: 100px;
    text-align: center;
    padding: 1rem 0.5rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 600px) {
  .header-card {
    position: relative;
    padding: 1rem 1.5rem;
    flex-direction: column;
    align-items: center;
  }
  .header-card .avatar-wrapper {
    position: absolute;
    top: 1rem;
    right: 1rem;
  }
  .header-card .avatar {
    width: 40px !important;
    height: 40px !important;
    object-fit: cover;
    border-radius: 50%;
    margin-top: 0.5rem;
  }
}

#avatarPreview {
  display: block;
  width: 80px;           /* tamaño uniforme */
  height: 80px;
  object-fit: cover;     /* recorta centrado dentro del círculo */
  border-radius: 50%;
  margin: 0 auto 1rem;   /* centrado + espacio inferior */
}

/* Si tu input-file ocupa todo el ancho, reagrúpalo: */
#avatarPreview + #setAvatar {
  display: block;
  width: 100%;
  margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
  /* 1) Header siempre con 1.5rem debajo */
  .header-card {
    margin-bottom: 1.5rem !important;
  }

  /* 2) Reset de márgenes de cada card y aplicar sólo margin-bottom */
  .dashboard .card {
    margin-top: 0 !important;
    margin-bottom: 1.5rem !important;
  }

  /* 3) Opcional: quitar margin-bottom en el último card */
  .dashboard .card:last-child {
    margin-bottom: 0 !important;
  }
}