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

:root {
  --primary:       #340033;
  --primary-hover: #4d004b;
  --primary-light: #6b1068;
  --accent:        #8b0085;
  --error:         #b5193a;
  --success:       #2e7d32;
  --gris-bg:       #f7f2f7;
  --gris-borde:    #ddd0dd;
  --texto:         #1a0019;
  --texto-suave:   #6b5a6b;
  --blanco:        #ffffff;
  --sombra:        0 2px 12px rgba(52, 0, 51, .13);
  --radio:         8px;
  --trans:         180ms ease;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--gris-bg);
  color: var(--texto);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 16px;
}

/* ── Encabezado ─────────────────────────────────────────────── */

#encabezado {
  background: var(--primary);
  color: var(--blanco);
  padding: 0 1.25rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 6px rgba(52, 0, 51, .3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.enc-marca {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.logo-siglas {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -.5px;
}

.logo-sep {
  display: block;
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, .3);
}

.logo-modulo {
  font-size: .82rem;
  color: rgba(255, 255, 255, .82);
  font-weight: 500;
}

/* ── Sesión en encabezado ───────────────────────────────────── */

#enc-sesion {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: .84rem;
}

.sesion-nombre {
  color: rgba(255, 255, 255, .9);
  font-weight: 600;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sesion-logout {
  color: rgba(255, 255, 255, .75);
  text-decoration: underline;
  cursor: pointer;
  font-size: .8rem;
  background: none;
  border: none;
  transition: color var(--trans);
}

.sesion-logout:hover { color: var(--blanco); }

/* ── Área principal ─────────────────────────────────────────── */

#area-principal {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

.contenedor {
  width: 100%;
  max-width: 540px;
}

/* ── Estado central (sin convocatorias / próximamente) ──────── */

.estado-central {
  text-align: center;
  padding: 3rem 1rem;
}

.estado-titulo {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
}

.estado-subtitulo {
  font-size: .95rem;
  color: var(--texto-suave);
  line-height: 1.6;
}

.estado-subtitulo strong { color: var(--texto); }

/* ── Caja de login ──────────────────────────────────────────── */

.login-caja {
  background: var(--blanco);
  border-radius: var(--radio);
  padding: 2rem 2rem 1.75rem;
  box-shadow: var(--sombra);
}

.login-titulo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1.5rem;
  text-align: center;
}

.login-intro {
  font-size: .88rem;
  color: var(--texto);
  line-height: 1.6;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.login-intro a {
  color: var(--accent);
  text-decoration: underline;
  word-break: break-all;
}

.login-intro a:hover { color: var(--primary); }

.login-campo { margin-bottom: 1rem; }

.login-label {
  display: block;
  font-size: .84rem;
  font-weight: 600;
  color: var(--texto);
  margin-bottom: .4rem;
  line-height: 1.4;
}

.login-input {
  width: 100%;
  padding: .65rem .85rem;
  border: 1.5px solid var(--gris-borde);
  border-radius: var(--radio);
  font-size: .95rem;
  color: var(--texto);
  background: var(--blanco);
  outline: none;
  transition: border-color var(--trans);
}

.login-input:focus { border-color: var(--accent); }

.login-error {
  font-size: .83rem;
  color: var(--error);
  margin-bottom: .75rem;
  padding: .5rem .75rem;
  background: #fdf0f3;
  border-radius: var(--radio);
  border: 1px solid #f0b8c4;
}

.login-btn {
  width: 100%;
  margin-top: .5rem;
  padding: .75rem;
  background: var(--primary);
  color: var(--blanco);
  border: none;
  border-radius: var(--radio);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  transition: background var(--trans);
}

.login-btn:hover:not(:disabled) { background: var(--primary-hover); }
.login-btn:disabled { background: #c0b0bf; cursor: not-allowed; }

/* ── Secciones ──────────────────────────────────────────────── */

.seccion-bloque {
  background: var(--blanco);
  border-radius: var(--radio);
  padding: 1.5rem;
  box-shadow: var(--sombra);
  margin-bottom: 1.25rem;
}

.seccion-titulo {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--gris-borde);
  margin-bottom: 1rem;
}

.seccion-cuerpo { min-height: 2rem; }

.seccion-desc {
  font-size: .88rem;
  color: var(--texto);
  line-height: 1.6;
  text-align: justify;
  margin-bottom: 1rem;
}

.seccion-btn-continuar {
  display: block;
  width: 100%;
  margin-top: 1.25rem;
  padding: .65rem;
  background: var(--primary);
  color: var(--blanco);
  border: none;
  border-radius: var(--radio);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: background var(--trans);
}

.seccion-btn-continuar:hover { background: var(--primary-hover); }

/* ── Spinner ────────────────────────────────────────────────── */

.spinner {
  display: flex;
  justify-content: center;
  padding: 2rem;
}

.spinner::after {
  content: '';
  width: 28px;
  height: 28px;
  border: 3px solid var(--gris-borde);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Avisos ─────────────────────────────────────────────────── */

.aviso {
  padding: .75rem 1rem;
  border-radius: var(--radio);
  font-size: .86rem;
  line-height: 1.5;
}

.aviso.error {
  background: #fdf0f3;
  color: var(--error);
  border: 1px solid #f0b8c4;
}

.aviso.info {
  background: #f5eef5;
  color: var(--primary);
  border: 1px solid #d9b8d8;
}

/* ── Lista de identificación ────────────────────────────────── */

.id-lista { font-size: .92rem; }

.id-clave {
  font-weight: 600;
  color: var(--primary);
  margin-top: .9rem;
}

.id-lista dt:first-child { margin-top: 0; }

.id-valor {
  margin-left: 3em;
  color: var(--texto);
  margin-top: .1rem;
}

/* ── Documentos ─────────────────────────────────────────────── */

.doc-instrucciones {
  font-size: .86rem;
  color: var(--texto);
  line-height: 1.6;
  margin-bottom: 1.25rem;
  text-align: justify;
}

.doc-instrucciones ol {
  padding-left: 1.25rem;
  margin: .5rem 0;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.doc-instrucciones-importante {
  margin-top: .75rem;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radio);
  padding: .5rem .75rem;
  color: #5a3e00;
}

.docs-lista {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.doc-tarjeta {
  border-radius: var(--radio);
  padding: .75rem 1rem;
  border: 1px solid var(--gris-borde);
  transition: box-shadow var(--trans);
}

.doc-tarjeta:hover { box-shadow: var(--sombra); }

.doc-nombre {
  font-weight: 600;
  font-size: .9rem;
  color: var(--texto);
  margin-bottom: .45rem;
}

.doc-sin-archivo {
  text-align: center;
  padding: .25rem 0;
}

.doc-btn-cargar {
  background: #c0392b;
  color: var(--blanco);
  border: none;
  border-radius: var(--radio);
  padding: .35rem 1rem;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--trans);
}

.doc-btn-cargar:hover { background: #a93226; }

.doc-ayuda-error {
  font-size: .78rem;
  color: #5a3e00;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radio);
  padding: .5rem .75rem;
  margin-top: 1em;
  margin-bottom: .5rem;
  line-height: 1.5;
}

.doc-ayuda-error a {
  color: #5a3e00;
  font-weight: 600;
  text-decoration: underline;
}

.doc-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .4rem;
}

.doc-links-izq {
  display: flex;
  gap: .75rem;
}

.doc-ver,
.doc-datos,
.doc-cambiar {
  font-size: .82rem;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.doc-ver:hover,
.doc-datos:hover,
.doc-cambiar:hover { color: var(--primary); }

.doc-estado-texto {
  font-size: .8rem;
  color: var(--texto-suave);
  font-style: italic;
}

.doc-estado-info {
  font-size: .8rem;
  color: var(--texto);
  line-height: 1.7;
}

.doc-obs {
  color: var(--texto-suave);
  margin-top: .15rem;
}

.doc-btn-guardar {
  background: #2e7d32;
  color: var(--blanco);
  border: none;
  border-radius: var(--radio);
  padding: .3rem .85rem;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--trans);
}

.doc-btn-guardar:hover    { background: #1b5e20; }
.doc-btn-guardar:disabled { background: #9e9e9e; cursor: not-allowed; }

.docs-error {
  padding: 1.5rem;
  text-align: center;
  color: var(--error);
  font-size: .86rem;
}

/* ── Modal ───────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1rem;
}

.modal-caja {
  background: var(--blanco);
  border-radius: var(--radio);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
  width: clamp(300px, 92vw, 520px);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-caja--grande {
  width: 95vw;
  height: 90vh;
  max-height: 90vh;
}

.modal-cabeza {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 1rem;
  background: var(--primary);
  color: var(--blanco);
  font-size: .86rem;
  font-weight: 600;
  flex-shrink: 0;
  gap: .75rem;
}

.modal-cerrar {
  background: none;
  border: none;
  color: var(--blanco);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 .2rem;
  opacity: .8;
  transition: opacity var(--trans);
  flex-shrink: 0;
}

.modal-cerrar:hover { opacity: 1; }

.modal-cuerpo {
  overflow-y: auto;
  padding: 1rem;
  flex: 1;
  min-height: 0;
}

.modal-caja--grande .modal-cuerpo {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.docs-iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  min-height: 0;
}

/* ── Tabla de datos ──────────────────────────────────────────── */

.datos-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}

.datos-tabla tr:nth-child(even) { background: var(--gris-bg); }
.datos-tabla tr:hover { background: #ede5ed; }

.datos-clave,
.datos-valor {
  padding: .45rem .75rem;
  border: 1px solid var(--gris-borde);
  vertical-align: top;
}

.datos-clave {
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  width: 35%;
}

.datos-valor {
  color: var(--texto);
  word-break: break-word;
}

.datos-lista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.datos-item a {
  color: var(--accent);
  text-decoration: underline;
  word-break: break-all;
}

.datos-item a:hover { color: var(--primary); }

/* ── Opciones ────────────────────────────────────────────────── */

.opc-lista {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.opc-tarjeta {
  border-radius: var(--radio);
  padding: .85rem 1rem;
  border: 1px solid var(--gris-borde);
}

.opc-tarjeta--disponible {
  background: #e8f5e9;
  cursor: pointer;
  transition: background var(--trans);
}

.opc-tarjeta--disponible:hover { background: #e0d0e8; }

.opc-tarjeta--sin-cupo { background: #fde8e8; }

.opc-estudios {
  font-weight: 700;
  font-size: .95rem;
  color: var(--texto);
  margin-bottom: .3rem;
}

.opc-plantel,
.opc-turno {
  font-size: .85rem;
  color: var(--texto-suave);
  margin-top: .15rem;
}

.opc-sin-cupo {
  text-align: center;
  color: var(--error);
  font-size: .83rem;
  font-weight: 600;
  margin-top: .5rem;
}

.opc-confirm-texto {
  font-size: .92rem;
  line-height: 1.6;
  color: var(--texto);
  margin-bottom: 1.25rem;
}

.opc-confirm-btns {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
}

.opc-btn-cancelar {
  padding: .6rem 1.25rem;
  background: none;
  border: 1.5px solid var(--gris-borde);
  border-radius: var(--radio);
  color: var(--texto);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--trans);
}

.opc-btn-cancelar:hover    { background: var(--gris-bg); }
.opc-btn-cancelar:disabled { opacity: .5; cursor: not-allowed; }

.opc-btn-confirmar {
  padding: .6rem 1.25rem;
  background: var(--primary);
  color: var(--blanco);
  border: none;
  border-radius: var(--radio);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--trans);
}

.opc-btn-confirmar:hover:not(:disabled) { background: var(--primary-hover); }
.opc-btn-confirmar:disabled { background: #c0b0bf; cursor: not-allowed; }

/* ── Folio en documentos ─────────────────────────────────────── */

.doc-folio-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  background: #f0e8f0;
  border: 1px solid var(--gris-borde);
  border-radius: var(--radio);
  padding: .75rem 1rem;
  margin-bottom: 1em;
}

.doc-folio-numero {
  font-weight: 700;
  font-size: .95rem;
  color: var(--primary);
}

.doc-folio-comprobante {
  font-size: .85rem;
  color: var(--accent);
  text-decoration: underline;
}

.doc-folio-comprobante:hover { color: var(--primary); }

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 480px) {
  #area-principal { padding: 1rem .75rem; }
  .login-caja { padding: 1.25rem 1rem 1rem; }
  .login-titulo { font-size: 1rem; }
  .estado-titulo { font-size: 1.15rem; }
  .sesion-nombre { max-width: 130px; }
}
