:root {
    --gde-primario: #4F46E5;
    --gde-fondo: #F5F6FA;
    --gde-texto: #1F2430;
    --gde-borde: #E1E4EB;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--gde-fondo);
    color: var(--gde-texto);
}

.gde-shell { display: flex; flex-direction: column; min-height: 100vh; }

.gde-topbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: white;
    border-bottom: 1px solid var(--gde-borde);
}

.gde-topbar-brand { display: flex; align-items: baseline; gap: 0.5rem; }
.gde-logo { font-weight: 700; font-size: 1.25rem; color: var(--gde-primario); }
.gde-subtitulo { color: #6B7280; font-size: 0.9rem; }

.gde-nav { display: flex; gap: 1rem; flex: 1; }
.gde-nav a { color: var(--gde-texto); text-decoration: none; }
.gde-nav a.active { color: var(--gde-primario); font-weight: 600; }

.gde-logout-form { margin: 0; }
.gde-logout-btn {
    background: none;
    border: 1px solid var(--gde-borde);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
}

.gde-content { padding: 1.5rem; max-width: 960px; margin: 0 auto; width: 100%; }

.gde-hero h1 { margin-bottom: 0.25rem; }
.gde-ciclo { color: #6B7280; margin-top: 0; }

.gde-hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.gde-card { background: white; border: 1px solid var(--gde-borde); border-radius: 10px; padding: 1rem 1.25rem; }

.gde-badge { font-size: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 999px; margin-left: 0.5rem; }
.gde-badge-logrado { background: #DCFCE7; color: #166534; }
.gde-badge-enproceso { background: #FEF9C3; color: #854D0E; }
.gde-badge-nologrado { background: #FEE2E2; color: #991B1B; }

.gde-boton-principal {
    display: inline-block;
    margin-top: 1.5rem;
    background: var(--gde-primario);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
}

.gde-login-wrapper { display: flex; flex-wrap: wrap; min-height: 100vh; }

.gde-login-panel { flex: 1 1 420px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; }

.gde-login-panel-marca {
  background: linear-gradient(160deg, #111C4E 0%, #1E3A8A 55%, #2563EB 100%);
  color: white;
  text-align: center;
}
.gde-login-hero { max-width: min(320px, 80%); width: 100%; height: auto; border-radius: 16px; box-shadow: 0 20px 45px rgba(0,0,0,0.35); margin-bottom: 1.5rem; }
.gde-login-panel-marca h1 { font-size: 2.5rem; margin: 0; letter-spacing: 0.05em; }
.gde-login-lema { margin-top: 0.35rem; font-size: 1rem; color: #BFDBFE; }

.gde-login-panel-form { background: #F3F4F6; }
.gde-login-card { background: white; padding: 2rem; border-radius: 12px; width: 320px; max-width: 100%; box-shadow: 0 10px 30px rgba(0,0,0,0.08); }
.gde-login-card h2 { margin-top: 0; }
.gde-login-card label { display: block; margin-top: 0.75rem; font-size: 0.9rem; }
.gde-login-card input { width: 100%; padding: 0.5rem; margin-top: 0.25rem; border: 1px solid var(--gde-borde); border-radius: 6px; }
.gde-login-card button { margin-top: 1.25rem; width: 100%; padding: 0.6rem; background: var(--gde-primario); color: white; border: none; border-radius: 6px; cursor: pointer; }

@media (max-width: 700px) {
  .gde-login-panel-marca { padding: 2rem 1.5rem 1rem; }
  .gde-login-hero { max-width: 220px; margin-bottom: 1rem; }
  .gde-login-panel-marca h1 { font-size: 2rem; }
}
.gde-error { color: #991B1B; font-size: 0.9rem; }

.gde-chat { display: flex; flex-direction: column; height: calc(100vh - 8rem); }
.gde-chat-historial { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.75rem; padding: 1rem 0; }
.gde-mensaje { max-width: 70%; padding: 0.6rem 0.9rem; border-radius: 10px; }
.gde-mensaje-Estudiante { align-self: flex-end; background: var(--gde-primario); color: white; }
.gde-mensaje-Agente { align-self: flex-start; background: white; border: 1px solid var(--gde-borde); }
.gde-mensaje-rol { font-size: 0.7rem; opacity: 0.7; }
.gde-mensaje p { margin: 0.15rem 0 0; white-space: pre-wrap; }

/* Indicador de "escribiendo..." del asistente (chat) -- tres puntos que
   rebotan en secuencia, para que el alumno note que el agente sigue
   trabajando y no piense que la pagina se colgo mientras espera la
   respuesta (no hay streaming token a token todavia). */
.gde-mensaje-cargando { display: flex; align-items: center; gap: 0.5rem; }
.gde-typing { display: flex; align-items: center; gap: 0.25rem; padding: 0.3rem 0; }
.gde-typing span {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--gde-primario);
    opacity: 0.4;
    animation: gde-typing-rebote 1.1s ease-in-out infinite;
}
.gde-typing span:nth-child(2) { animation-delay: 0.15s; }
.gde-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes gde-typing-rebote {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-0.3rem); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .gde-typing span { animation: none; opacity: 0.7; }
}

.gde-chat-input { display: flex; gap: 0.5rem; align-items: center; background: white; border: 1px solid var(--gde-borde); border-radius: 10px; padding: 0.5rem; }
.gde-chat-input textarea { flex: 1; border: none; resize: none; font-family: inherit; }
.gde-chat-input button { background: var(--gde-primario); color: white; border: none; border-radius: 6px; padding: 0.5rem 1rem; cursor: pointer; }
.gde-archivos-adjuntos { font-size: 0.8rem; color: #6B7280; }

.gde-avatar-editor { max-width: 480px; }
.gde-avatar-preview { width: 160px; height: 160px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 1rem auto; }
.gde-avatar-cara { width: 100px; height: 100px; border-radius: 50%; position: relative; }
.gde-avatar-cabello { width: 100px; height: 40px; border-radius: 50px 50px 0 0; position: absolute; top: -10px; left: 0; }
.gde-avatar-controles label { display: block; margin-top: 0.75rem; }
.gde-avatar-controles button { margin-top: 1.25rem; background: var(--gde-primario); color: white; border: none; border-radius: 6px; padding: 0.6rem 1.2rem; cursor: pointer; }
.gde-exito { color: #166534; }

.gde-alerta { background: #FEF9C3; border: 1px solid #FDE68A; padding: 1rem; border-radius: 8px; }

/* --- Administración: Plan de estudios --- */
.gde-admin-card { background: white; border: 1px solid var(--gde-borde); border-radius: 10px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.gde-admin-card-modulo { background: #FAFAFC; }
.gde-admin-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.gde-admin-meta { font-size: 0.8rem; color: #6B7280; margin-top: 0.25rem; }
.gde-admin-acciones { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.gde-admin-acciones button { background: white; border: 1px solid var(--gde-borde); border-radius: 6px; padding: 0.35rem 0.7rem; cursor: pointer; font-size: 0.85rem; }
.gde-admin-boton-peligro { color: #991B1B; border-color: #FCA5A5 !important; }
.gde-admin-anidado { margin-top: 1rem; padding-left: 1rem; border-left: 2px solid var(--gde-borde); }
.gde-admin-form label { display: block; margin-top: 0.5rem; font-size: 0.85rem; }
.gde-admin-form input[type="text"], .gde-admin-form input, .gde-admin-form textarea {
    width: 100%; padding: 0.4rem; margin-top: 0.15rem; border: 1px solid var(--gde-borde); border-radius: 6px; font-family: inherit;
}
.gde-admin-fila { display: flex; gap: 1rem; }
.gde-admin-fila label { flex: 1; }
.gde-admin-checkbox { display: flex !important; align-items: center; gap: 0.4rem; }
.gde-admin-checkbox input { width: auto !important; }
.gde-admin-form button[type="submit"] {
    margin-top: 0.75rem; background: var(--gde-primario); color: white; border: none; border-radius: 6px; padding: 0.5rem 1rem; cursor: pointer;
}
.gde-admin-nuevo { border-style: dashed; }
.gde-admin-nuevo h3, .gde-admin-nuevo h4 { margin-top: 0; }

.gde-admin-importacion { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px dashed var(--gde-borde); }
.gde-admin-importacion > textarea { width: 100%; padding: 0.4rem; border: 1px solid var(--gde-borde); border-radius: 6px; font-family: inherit; }
.gde-admin-importacion table input { width: 100%; padding: 0.25rem; border: 1px solid var(--gde-borde); border-radius: 4px; font-family: inherit; font-size: 0.85rem; }
.gde-admin-tabla { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.gde-admin-tabla th, .gde-admin-tabla td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--gde-borde); }

/* Envuelve tablas anchas (ej. el dashboard de avance, con una columna por
   indicador) para que se desplacen horizontalmente en vez de romper el layout
   en pantallas angostas. */
.gde-tabla-scroll { overflow-x: auto; margin-top: 1rem; }
.gde-avance-tabla { min-width: 600px; }
.gde-avance-tabla th { white-space: nowrap; }
.gde-avance-tabla select { font-size: 0.85rem; }

.gde-reporte-lista-unidades { margin: 0; padding-left: 1.1rem; }
.gde-reporte-lista-unidades li { font-size: 0.85rem; margin-bottom: 0.2rem; }

/* Dashboard del alumno (docente): grid de 4 tarjetas de resumen en vez
   de las 2 de .gde-hero-grid, y una cifra grande para el % de avance. */
.gde-dashboard-alumno-resumen { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.gde-dashboard-alumno-cifra { font-size: 2rem; font-weight: 700; margin: 0.25rem 0; color: var(--gde-primario); }

.gde-ils-preguntas { display: flex; flex-direction: column; gap: 0.75rem; margin: 1.25rem 0; }
.gde-ils-pregunta { background: white; border: 1px solid var(--gde-borde); border-radius: 10px; padding: 0.85rem 1rem; }
.gde-ils-enunciado { font-weight: 600; margin: 0 0 0.6rem 0; }
.gde-ils-opciones { display: flex; flex-direction: column; gap: 0.4rem; }
.gde-ils-opcion { text-align: left; background: var(--gde-fondo); border: 1px solid var(--gde-borde); border-radius: 8px; padding: 0.5rem 0.75rem; cursor: pointer; font-family: inherit; font-size: 0.95rem; }
.gde-ils-opcion:hover { border-color: var(--gde-primario); }
.gde-ils-opcion-activa { background: var(--gde-primario); color: white; border-color: var(--gde-primario); }

/* Cuestionarios (EAPESA/CAPA reducido/CSAT): igual que .gde-ils-opciones
   pero en fila, para escalas numericas cortas (1-4, 1-5, 1-7) en vez de la
   lista vertical de dos opciones (a/b) del test ILS. */
.gde-ils-opciones-fila { display: flex; flex-direction: row; flex-wrap: wrap; gap: 0.4rem; }
.gde-ils-opciones-fila .gde-ils-opcion { flex: 0 0 auto; min-width: 2.5rem; text-align: center; }
.gde-ils-escala-extremos { font-size: 0.8rem; color: var(--gde-texto-secundario, #666); margin: 0 0 0.5rem 0; }

.gde-boton-secundario {
    display: inline-block;
    margin-top: 1.5rem;
    margin-right: 0.5rem;
    background: white;
    color: var(--gde-primario);
    border: 1px solid var(--gde-primario);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}

.gde-ils-perfil { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 0.5rem; }
.gde-ils-dim-polos { display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; }
.gde-ils-barra { position: relative; height: 10px; background: var(--gde-fondo); border: 1px solid var(--gde-borde); border-radius: 999px; overflow: hidden; }
.gde-ils-barra-relleno { position: absolute; top: 0; bottom: 0; background: var(--gde-primario); border-radius: 999px; }
.gde-ils-barra-centro { position: absolute; top: -2px; bottom: -2px; left: 50%; width: 2px; background: var(--gde-texto); opacity: 0.35; transform: translateX(-50%); }
