/* Aula Connect · estilos base (paleta institucional) */
:root {
    --navy: #182538;
    --teal: #136979;
    --teal-oscuro: #0d4c58;
    --dorado: #c08d3d;
    --dorado-texto: #6b4a14;
    --fondo: #f4f6f7;
    --borde: #dfe5ea;
    --texto-suave: #4a5866;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html, body { overflow-x: hidden; }
body {
    font-family: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--navy);
    background: var(--fondo);
    -webkit-text-size-adjust: 100%;
}
a { color: var(--teal); }
a:hover { color: var(--teal-oscuro); }

/* Pantalla de bienvenida */
.bienvenida {
    min-height: 100vh;
    min-height: 100dvh;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 36px;
    padding: 32px 16px;
    text-align: center;
}
.bienvenida img { width: min(320px, 78vw); height: auto; animation: aparece .8s ease-out both; }
.bienvenida .lema { display: flex; flex-direction: column; align-items: center; gap: 10px; animation: aparece .8s ease-out .4s both; }
.bienvenida .lema::before { content: ''; width: 48px; height: 2px; background: var(--dorado); }
.bienvenida .lema span { font-size: 22px; font-weight: 600; letter-spacing: 3px; }
.bienvenida .carga { width: 160px; height: 4px; background: #e8edf1; border-radius: 999px; overflow: hidden; }
.bienvenida .carga div { height: 4px; background: var(--teal); animation: carga 3s linear both; }
.bienvenida .pie { font-size: 14px; color: var(--texto-suave); }
@keyframes aparece { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes carga { from { width: 0; } to { width: 100%; } }
@media (prefers-reduced-motion: reduce) {
    .bienvenida img, .bienvenida .lema, .bienvenida .carga div { animation: none; }
}

/* ---------- Estructura ---------- */
.barra { background: var(--navy); color: #fff; }
.barra-in { max-width: 1240px; margin: 0 auto; padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.marca { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.marca-icono { width: 40px; height: 40px; border-radius: 8px; background: var(--dorado); color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.marca b { display: block; font-size: 18px; }
.marca small { display: block; font-size: 13px; color: #c9d3dc; }
.barra nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.barra nav a, .barra nav button { color: #fff; text-decoration: none; padding: 10px 14px; border-radius: 8px; font-size: 15px; font-weight: 600; background: rgba(255,255,255,.12); border: 0; font-family: inherit; cursor: pointer; }
.barra .quien { font-size: 15px; color: #e3e9ee; }
.contenido { max-width: 1240px; margin: 0 auto; padding: 24px 16px 56px; display: flex; flex-direction: column; gap: 20px; }
.encabezado { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
h1 { margin: 0; font-size: 30px; font-weight: 700; line-height: 1.2; }
h2 { margin: 0; font-size: 19px; font-weight: 700; }
h3 { margin: 0; font-size: 17px; font-weight: 700; }
.sub { margin: 4px 0 0; color: var(--texto-suave); font-size: 16px; }
.miga { color: var(--texto-suave); font-size: 14px; text-decoration: none; font-weight: 600; }
.fila { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.fila > .ancho { flex: 999 1 560px; min-width: 0; }
.fila > .lateral { flex: 1 1 300px; min-width: 0; }
.panel { background: #fff; border: 1px solid var(--borde); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.vacio { color: var(--texto-suave); font-size: 15px; margin: 0; }
.nota { font-size: 13px; color: var(--texto-suave); margin: 0; }

/* Banda de materia */
.banda { background: var(--teal); color: #fff; }
.banda .barra-in { flex-direction: column; align-items: stretch; padding-bottom: 0; }
.banda h1 { color: #fff; }
.banda .sub { color: #e3f1f3; }
.banda .miga { color: #d4ecef; }
.banda .barra-in > * { min-width: 0; max-width: 100%; }
.pestanas { display: flex; gap: 4px; overflow-x: auto; margin-top: 14px; max-width: 100%; }
.pestanas button { flex-shrink: 0; min-height: 46px; padding: 0 18px; border: 0; border-radius: 10px 10px 0 0; font-family: inherit; font-size: 16px; font-weight: 700; cursor: pointer; background: transparent; color: #fff; }
.pestanas button[aria-selected="true"] { background: var(--fondo); color: var(--navy); }

/* Tarjetas de materia */
.tarjeta { background: #fff; border: 1px solid var(--borde); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.tarjeta .franja { height: 8px; background: var(--teal); }
.tarjeta .cuerpo { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex-grow: 1; }
.avance { height: 8px; background: #e8edf1; border-radius: 999px; overflow: hidden; }
.avance div { height: 8px; background: var(--teal); }

/* Elementos de lista */
.item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: #fff; border: 1px solid var(--borde); border-radius: 12px; }
.item .info { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item .meta { font-size: 13px; color: var(--texto-suave); font-weight: 600; }
.item .acciones { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.archivo { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 12px; border-radius: 10px; background: #f7f9fa; color: var(--navy); text-decoration: none; border: 0; font-family: inherit; font-size: 15px; text-align: left; cursor: pointer; width: 100%; }
.archivo:hover { background: #eef3f5; }
.tipo { width: 46px; flex-shrink: 0; text-align: center; font-size: 12px; font-weight: 700; padding: 4px 0; border-radius: 6px; background: #e3f1f3; color: var(--teal-oscuro); }
.sesion-titulo { font-size: 14px; font-weight: 700; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .5px; margin: 6px 0 0; }

/* Estados */
.chip { display: inline-block; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.chip.pendiente, .chip.sin_entregar { background: #fbf3e6; color: var(--dorado-texto); }
.chip.entregada, .chip.por_revisar, .chip.borrador { background: #e8edf1; color: #26384a; }
.chip.revisada, .chip.publicada { background: #e3f1f3; color: var(--teal-oscuro); }
.chip.tarde, .chip.vencida { background: #fde8e4; color: #8f2a17; }

/* Botones y formularios */
.boton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--teal); background: #fff; color: var(--teal); font-family: inherit; font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; }
.boton.primario { background: var(--teal); color: #fff; }
.boton.primario:hover { background: var(--teal-oscuro); color: #fff; }
.boton.peligro { border-color: #b4412b; color: #8f2a17; }
.boton:disabled { opacity: .55; cursor: wait; }
.boton.chico { min-height: 36px; padding: 0 12px; font-size: 14px; }
label.campo { display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 600; }
input[type=text], input[type=url], input[type=tel], input[type=number], input[type=email], input[type=password], input[type=datetime-local], select, textarea {
    min-height: 44px; padding: 8px 12px; border: 1px solid #b9c6cf; border-radius: 10px; font-family: inherit; font-size: 16px; color: var(--navy); background: #fff; width: 100%; }
textarea { resize: vertical; line-height: 1.5; }
.casilla { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; font-weight: 600; cursor: pointer; }
.casilla input { width: 20px; height: 20px; margin: 1px 0 0; flex-shrink: 0; }
.dos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.zona-archivo { border: 2px dashed #9fb8c0; border-radius: 12px; padding: 18px 14px; text-align: center; background: #f7fafb; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.mensaje { padding: 12px 14px; border-radius: 10px; font-size: 15px; font-weight: 600; }
.mensaje.error { background: #fde8e4; color: #8f2a17; }
.mensaje.ok { background: #e3f1f3; color: var(--teal-oscuro); }
.aviso-dorado { background: #fbf7ef; border: 1px solid #e6cfa6; border-radius: 12px; padding: 14px 16px; }
.aviso-dorado h3 { color: var(--dorado-texto); margin-bottom: 6px; }
.aviso-dorado p { margin: 0; font-size: 15px; line-height: 1.55; }
.texto-largo { white-space: pre-wrap; font-size: 16px; line-height: 1.6; margin: 0; }

/* Mensajes privados */
.hilo { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; padding: 4px; }
.burbuja { max-width: 82%; padding: 10px 14px; border-radius: 14px; display: flex; flex-direction: column; gap: 4px; }
.burbuja p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.5; }
.burbuja.propia { align-self: flex-end; background: #e3f1f3; border-bottom-right-radius: 4px; }
.burbuja.otra { align-self: flex-start; background: #f0f2f4; border-bottom-left-radius: 4px; }
.burbuja.propia .nota { text-align: right; }
.redactar { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--borde); padding-top: 12px; }
.redactar .boton { align-self: flex-end; }
.globo { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--dorado); color: var(--navy); font-size: 12px; font-weight: 700; text-align: center; }

/* Tablas */
.tabla-caja { overflow-x: auto; background: #fff; border: 1px solid var(--borde); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; background: #f0f4f6; padding: 10px 12px; font-weight: 700; white-space: nowrap; }
td { padding: 10px 12px; border-top: 1px solid #edf1f3; vertical-align: top; }
tr.activa td { background: #eef7f8; }

/* Paneles con menú lateral (docente / administración) */
.app-lateral { display: flex; flex-wrap: wrap; min-height: 100vh; }
.menu { flex: 1 1 240px; background: var(--navy); color: #fff; padding: 16px 12px; display: flex; flex-direction: column; gap: 14px; }
.menu nav { display: flex; flex-direction: column; gap: 2px; }
.menu nav button { display: flex; justify-content: space-between; align-items: center; min-height: 42px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: #fff; font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer; text-align: left; }
.menu nav button[aria-current="true"] { background: var(--teal); }
.menu .contador { min-width: 22px; padding: 2px 6px; border-radius: 999px; background: var(--dorado); color: var(--navy); font-size: 12px; font-weight: 700; text-align: center; }
.menu select { min-height: 40px; font-size: 14px; }
.menu .rotulo { font-size: 12px; color: #c9d3dc; display: flex; flex-direction: column; gap: 4px; }
.principal { flex: 999 1 640px; min-width: 0; padding: 20px; display: flex; flex-direction: column; gap: 14px; background: #eef2f4; }
.kpis { display: flex; flex-wrap: wrap; gap: 8px; }
.kpis span { padding: 6px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--borde); font-size: 14px; }
.oculto { display: none !important; }
.cargando { color: var(--texto-suave); padding: 24px 0; }
@media (max-width: 640px) {
    h1 { font-size: 25px; }
    .menu { flex-basis: 100%; }
    .pestanas button { padding: 0 11px; font-size: 15px; }
}
