/* BASIC-2B — portal familiar. Mobile-first (375 px), cómodo en 768 px y 1440 px. Sin dependencias: solo variables propias. */
:root {
    --gp-ink: #241f38;
    --gp-muted: #6b6880;
    --gp-line: #e8e4f0;
    --gp-bg: #f6f2ea;
    --gp-card: #ffffff;
    --gp-brand: #6d5ffd;
    --gp-brand-soft: #efecff;
    --gp-ok: #1e8e5a;
    --gp-ok-soft: #e3f6ec;
    --gp-warn: #b7791f;
    --gp-warn-soft: #fff4de;
    --gp-bad: #c0392b;
    --gp-bad-soft: #fde8e6;
    --gp-radius: 14px;
}

/* UI-PREMIUM lote 3 — puente al tema de la escuela: las variables propias del portal toman los tokens --gfk-* del preset
   (Greenfig Base, Alegre o Académico) y el color de marca. Sin tokens (p. ej. caché vieja) se conservan los valores de arriba. */
body.gf-guardian.gf-theme {
    --gp-ink: var(--gfk-text);
    --gp-muted: var(--gfk-text-muted);
    --gp-line: var(--gfk-border);
    --gp-bg: var(--gf-theme-content, #f6f2ea);
    --gp-card: var(--gfk-surface);
    --gp-brand: var(--gfk-accent);
    --gp-brand-soft: var(--gfk-accent-soft);
    --gp-ok: var(--gfk-success);
    --gp-ok-soft: var(--gfk-success-soft);
    --gp-warn: var(--gfk-warning);
    --gp-warn-soft: var(--gfk-warning-soft);
    --gp-bad: var(--gfk-danger);
    --gp-bad-soft: var(--gfk-danger-soft);
    --gp-radius: var(--gfk-radius-lg);
}

/* «Salir»: el gris de Bootstrap (#6c757d) no llega a AA sobre el fondo del portal. */
.gp-nav .btn-outline-secondary { color: var(--gp-ink); border-color: var(--gp-line); }
.gp-nav .btn-outline-secondary:hover { background: var(--gp-brand-soft); color: var(--gp-ink); }

body.gf-guardian { background: var(--gp-bg); color: var(--gp-ink); font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif; }
.gp-skip { position: absolute; left: -999px; }
.gp-skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px 12px; z-index: 50; border-radius: 8px; }

.gp-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; max-width: 1120px; margin: 0 auto; }
.gp-brand { font-weight: 800; color: var(--gp-ink); text-decoration: none; letter-spacing: .01em; }
.gp-user { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.gp-user a { color: var(--gp-ink); text-decoration: none; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.gp-main { padding: 0 12px 48px; }
.gf-guardian-card { max-width: 520px; margin: 1rem auto; background: var(--gp-card); border-radius: var(--gp-radius); padding: 1.5rem; box-shadow: 0 2px 12px rgba(36, 31, 56, .08); }
.gf-guardian-card.gp-wide { max-width: 1120px; background: transparent; box-shadow: none; padding: 0; }

/* Cabecera del hijo */
.gp-child-head { display: flex; align-items: center; gap: 14px; background: var(--gp-card); border-radius: var(--gp-radius); padding: 16px; box-shadow: 0 2px 12px rgba(36, 31, 56, .06); }
.gp-avatar { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 50%; background: var(--gp-brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; }
.gp-child-head h1 { font-size: 1.25rem; margin: 0; line-height: 1.2; }
.gp-meta { color: var(--gp-muted); font-size: .88rem; margin-top: 2px; }
.gp-back { font-size: .85rem; color: var(--gp-muted); text-decoration: none; display: inline-block; margin: 4px 0 10px; }

/* Navegación por secciones: deslizable en móvil */
.gp-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px; margin: 0; list-style: none; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.gp-tabs::-webkit-scrollbar { display: none; }
.gp-tabs a { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 10px 14px; border-radius: 999px; background: var(--gp-card); color: var(--gp-ink); text-decoration: none; font-weight: 700; font-size: .9rem; border: 1px solid var(--gp-line); min-height: 44px; }
.gp-tabs a.is-active { background: var(--gp-brand); color: #fff; border-color: var(--gp-brand); }
.gp-tabs a:focus-visible, .gp-btn:focus-visible { outline: 3px solid #b9b2ff; outline-offset: 2px; }

/* Tarjetas y rejillas */
.gp-card { background: var(--gp-card); border-radius: var(--gp-radius); padding: 16px; box-shadow: 0 2px 12px rgba(36, 31, 56, .06); margin-bottom: 14px; }
.gp-card h2 { font-size: 1.05rem; margin: 0 0 10px; }
.gp-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .gp-grid.cols-2, .gp-grid.cols-3, .gp-grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 992px) { .gp-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .gp-grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }
.gp-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 768px) { .gp-stats { grid-template-columns: repeat(4, 1fr); } }
.gp-stat { background: var(--gp-card); border-radius: var(--gp-radius); padding: 14px; box-shadow: 0 2px 12px rgba(36, 31, 56, .06); }
.gp-stat .n { font-size: 1.7rem; font-weight: 800; line-height: 1; }
.gp-stat .l { color: var(--gp-muted); font-size: .82rem; margin-top: 4px; }
.gp-stat.ok .n { color: var(--gp-ok); } .gp-stat.warn .n { color: var(--gp-warn); } .gp-stat.bad .n { color: var(--gp-bad); }

/* Insignias */
.gp-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--gp-brand-soft); color: var(--gp-brand); }
.gp-badge.ok { background: var(--gp-ok-soft); color: var(--gp-ok); }
.gp-badge.warn { background: var(--gp-warn-soft); color: var(--gp-warn); }
.gp-badge.bad { background: var(--gp-bad-soft); color: var(--gp-bad); }
.gp-badge.muted { background: #eeedf3; color: var(--gp-muted); }

/* Materias y calificaciones */
.gp-subject { border: 1px solid var(--gp-line); border-radius: 12px; padding: 12px; background: #fff; }
.gp-subject header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.gp-subject h3 { font-size: 1rem; margin: 0; }
.gp-final { text-align: right; }
.gp-final .v { font-size: 1.35rem; font-weight: 800; line-height: 1; }
.gp-final .t { font-size: .72rem; color: var(--gp-muted); }
.gp-periods { display: flex; flex-wrap: wrap; gap: 6px; }
.gp-period { flex: 1 1 88px; border-radius: 10px; background: #f7f6fb; padding: 6px 8px; font-size: .8rem; }
.gp-period .p { color: var(--gp-muted); display: block; }
.gp-period .g { font-weight: 800; font-size: 1.05rem; }
.gp-period.fail .g { color: var(--gp-bad); }
.gp-period.na .g { color: var(--gp-muted); font-weight: 600; font-size: .85rem; }

/* Selector de ciclo */
.gp-cycles { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.gp-cycles a { white-space: nowrap; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--gp-line); background: #fff; text-decoration: none; color: var(--gp-ink); font-size: .88rem; min-height: 40px; display: inline-flex; align-items: center; }
.gp-cycles a.is-active { border-color: var(--gp-brand); background: var(--gp-brand-soft); font-weight: 700; }

/* Asistencia */
.gp-month h3 { font-size: .95rem; margin: 14px 0 8px; text-transform: capitalize; }
.gp-days { display: flex; flex-wrap: wrap; gap: 6px; }
.gp-day { border-radius: 10px; padding: 6px 10px; font-size: .82rem; background: var(--gp-ok-soft); color: var(--gp-ok); font-weight: 700; }
.gp-day.late { background: var(--gp-warn-soft); color: var(--gp-warn); }
.gp-day.absent { background: var(--gp-bad-soft); color: var(--gp-bad); }
.gp-day.excused { background: var(--gp-brand-soft); color: var(--gp-brand); }

/* Horario */
.gp-slot { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--gp-line); }
.gp-slot:first-of-type { border-top: 0; }
.gp-slot .t { flex: 0 0 96px; font-weight: 800; font-size: .88rem; }
.gp-slot .s { font-weight: 700; }
.gp-slot .w { color: var(--gp-muted); font-size: .84rem; }
.gp-today { outline: 2px solid var(--gp-brand); }

/* Listas y botones */
.gp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--gp-line); flex-wrap: wrap; }
.gp-row:first-of-type { border-top: 0; }
.gp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: 10px; background: var(--gp-brand); color: #fff; font-weight: 700; text-decoration: none; border: 0; }
.gp-btn.ghost { background: #fff; color: var(--gp-brand); border: 1px solid var(--gp-brand); }
.gf-guardian :is(a.btn, button.btn, input.btn) { display: inline-flex; align-items: center; justify-content: center; text-align: center; vertical-align: middle; line-height: 1.2; }
.gf-guardian :is(a.btn, button.btn, input.btn) > i,
.gf-guardian :is(a.btn, button.btn, input.btn) > .ti,
.gf-guardian :is(a.btn, button.btn, input.btn) > .fa,
.gf-guardian :is(a.btn, button.btn, input.btn) > .fa-solid { display: inline-flex; align-items: center; justify-content: center; line-height: 1; flex: 0 0 auto; }
.gp-empty { text-align: center; color: var(--gp-muted); padding: 28px 12px; }
.gp-empty .ic { font-size: 2rem; display: block; margin-bottom: 6px; }
.gp-note { color: var(--gp-muted); font-size: .84rem; }
.gp-timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--gp-line); }
.gp-timeline li { position: relative; padding: 0 0 12px 12px; font-size: .9rem; }
.gp-timeline li::before { content: ''; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--gp-brand); }

@media (min-width: 768px) {
    .gp-main { padding: 0 24px 64px; }
    .gp-child-head { padding: 20px; }
    .gp-child-head h1 { font-size: 1.5rem; }
}
@media print { .gp-topbar, .gp-tabs, .gp-btn { display: none !important; } }

/* BASIC-2C — comunicados, avisos y preferencias */
.gp-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.gp-nav a { color: var(--gp-ink); text-decoration: none; font-weight: 700; font-size: .9rem; padding: 8px 10px; border-radius: 10px; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; }
.gp-nav a.is-active { background: var(--gp-brand-soft); color: var(--gp-brand); }
.gp-count { background: var(--gp-bad); color: #fff; border-radius: 999px; font-size: .72rem; min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; font-weight: 800; }
.gp-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.gp-filters select, .gp-filters a.pill { min-height: 44px; border-radius: 10px; border: 1px solid var(--gp-line); background: #fff; padding: 8px 12px; font-size: .9rem; color: var(--gp-ink); text-decoration: none; display: inline-flex; align-items: center; }
.gp-filters a.pill.is-active { background: var(--gp-brand-soft); border-color: var(--gp-brand); font-weight: 700; }
.gp-msg { --school: var(--gp-brand); display: block; background: var(--gp-card); border-radius: var(--gp-radius); border-left: 6px solid var(--school); padding: 14px 16px; margin-bottom: 10px; box-shadow: 0 2px 12px rgba(36, 31, 56, .06); text-decoration: none; color: var(--gp-ink); }
.gp-msg.is-unread { background: #fff; box-shadow: 0 2px 14px rgba(109, 95, 253, .18); }
.gp-msg h3 { font-size: 1.02rem; margin: 4px 0; }
.gp-msg.is-unread h3 { font-weight: 800; }
.gp-msg:not(.is-unread) h3 { font-weight: 600; color: #4a4760; }
.gp-msg .sum { color: var(--gp-muted); font-size: .9rem; margin: 0; }
.gp-school-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 800; color: var(--school); }
.gp-school-chip::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--school); }
.gp-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gp-brand); display: inline-block; }
.gp-body { line-height: 1.6; overflow-wrap: anywhere; }
.gp-body img { max-width: 100%; height: auto; }
.gp-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--gp-line); min-height: 52px; }
.gp-switch:first-of-type { border-top: 0; }
.gp-switch input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--gp-brand); }
@media (max-width: 575px) {
    .gp-nav { width: 100%; justify-content: space-between; gap: 2px; }
    .gp-nav a { flex-direction: column; gap: 2px; font-size: .68rem; padding: 6px 4px; min-width: 58px; justify-content: center; position: relative; }
    .gp-nav a i { font-size: 1.25rem; }
    .gp-nav .gp-count { position: absolute; top: 0; right: 10px; }
    .gp-nav .gp-profile { display: none; } /* en móvil la cuenta se abre desde Preferencias */
    .gp-nav form .btn { min-height: 40px; }
}
.gp-topbar { flex-wrap: wrap; }

/* UIUX-B1.8 — shared authenticated Guardian wave. The class is emitted by
   the layout only for the guardian guard; invitation/auth pages stay on
   their existing composition. School accents and family permissions remain
   data-driven, while this layer improves hierarchy and responsive clarity. */
.gf-guardian-wave-page {
    position: relative;
}
.gf-guardian-wave-page .gp-child-head,
.gf-guardian-wave-page .gp-card,
.gf-guardian-wave-page .gp-stat,
.gf-guardian-wave-page .gp-msg {
    border: 1px solid color-mix(in srgb, var(--gp-brand) 12%, var(--gp-line));
    box-shadow: 0 8px 22px rgba(36, 31, 56, .07);
}
.gf-guardian-wave-page .gp-child-head {
    background: linear-gradient(135deg, #fff, color-mix(in srgb, var(--gp-brand-soft) 45%, #fff));
}
.gf-guardian-wave-page .gp-child-head h1,
.gf-guardian-wave-page .gp-card h2,
.gf-guardian-wave-page .gp-msg h3 {
    color: var(--gp-ink);
}
.gf-guardian-wave-page .gp-tabs {
    padding-block: 14px;
    scroll-snap-type: inline proximity;
}
.gf-guardian-wave-page .gp-tabs li { scroll-snap-align: start; }
.gf-guardian-wave-page .gp-tabs a:hover,
.gf-guardian-wave-page .gp-cycles a:hover,
.gf-guardian-wave-page .gp-btn.ghost:hover {
    border-color: var(--gp-brand);
    color: var(--gp-brand);
}
.gf-guardian-wave-page .gp-msg {
    transition: box-shadow .18s ease, transform .18s ease;
}
.gf-guardian-wave-page .gp-msg:hover {
    box-shadow: 0 12px 28px rgba(109, 95, 253, .14);
    transform: translateY(-1px);
}
.gf-guardian-wave-page :is(a, button, input, select, textarea):focus-visible {
    outline: 3px solid #b9b2ff;
    outline-offset: 2px;
}
.gf-guardian-wave-page .table-responsive {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
}
.gf-guardian-wave-page .table-responsive > .table { min-width: 620px; }
.gf-guardian-wave-page .alert {
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(36, 31, 56, .06);
}
@media (max-width: 575px) {
    .gf-guardian-wave-page .gp-child-head { align-items: flex-start; }
    .gf-guardian-wave-page .gp-card { padding: 14px; }
    .gf-guardian-wave-page .gp-row { align-items: flex-start; }
    .gf-guardian-wave-page .gp-row .gp-btn,
    .gf-guardian-wave-page > form > .gp-btn { width: 100%; }
    .gf-guardian-wave-page .gp-msg:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .gf-guardian-wave-page *,
    .gf-guardian-wave-page *::before,
    .gf-guardian-wave-page *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* UIUX-B1.3 — dashboard Guardian. Encapsulado para conservar las variantes
   institucionales y el resto de pantallas del portal sin efectos colaterales. */
.gp-dashboard .alert {
    border: 0;
    border-left: 4px solid currentColor;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(36, 31, 56, .08);
    font-size: .92rem;
    margin-bottom: 1rem;
}
.gp-dashboard-hero {
    align-items: center;
    background: linear-gradient(135deg, #f0edff 0%, #fff 72%);
    border: 1px solid #e5e0ff;
    border-radius: 18px;
    display: flex;
    gap: 14px;
    margin-bottom: 1.25rem;
    padding: 18px 20px;
}
.gp-dashboard-hero-icon {
    align-items: center;
    background: var(--gp-brand);
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(109, 95, 253, .22);
    color: #fff;
    display: inline-flex;
    flex: 0 0 48px;
    font-size: 1.5rem;
    height: 48px;
    justify-content: center;
    width: 48px;
}
.gp-eyebrow {
    color: var(--gp-brand);
    display: block;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .1em;
    margin-bottom: 3px;
    text-transform: uppercase;
}
.gp-dashboard-school { margin-top: 1.25rem; }
.gp-dashboard-section-heading {
    align-items: end;
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}
.gp-section-count {
    background: var(--gp-brand-soft);
    border-radius: 999px;
    color: var(--gp-brand);
    font-size: .75rem;
    font-weight: 800;
    padding: 5px 10px;
    white-space: nowrap;
}
.gp-child-card {
    border: 1px solid #eeeaf7;
    position: relative;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.gp-child-card:hover {
    border-color: #d8d1ff;
    box-shadow: 0 10px 24px rgba(109, 95, 253, .12);
    transform: translateY(-2px);
}
.gp-action-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.gp-action-grid .gp-btn { flex: 1 1 auto; }
.gp-action-grid .gp-btn i { font-size: 1rem; }
.gp-empty--dashboard {
    align-items: center;
    background: linear-gradient(135deg, #fff 0%, #f8f6ff 100%);
    border: 1px dashed #cfc8f5;
    display: flex;
    gap: 14px;
    margin-top: 1.25rem;
    text-align: left;
}
.gp-empty-icon {
    align-items: center;
    background: var(--gp-brand-soft);
    border-radius: 14px;
    color: var(--gp-brand);
    display: inline-flex;
    flex: 0 0 48px;
    font-size: 1.5rem;
    height: 48px;
    justify-content: center;
    width: 48px;
}
.gp-empty-copy { min-width: 0; }
.gp-empty-copy strong { color: var(--gp-ink); display: block; margin-bottom: 4px; }
.gp-empty-copy p:first-of-type { color: var(--gp-ink); line-height: 1.5; }
@media (max-width: 575px) {
    .gp-dashboard-hero { align-items: flex-start; padding: 16px; }
    .gp-dashboard-hero-icon { flex-basis: 42px; height: 42px; width: 42px; }
    .gp-dashboard-section-heading { align-items: flex-start; gap: 8px; }
    .gp-action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gp-action-grid .gp-btn { min-width: 0; padding-inline: 9px; }
    .gp-action-grid .gp-btn:first-child { grid-column: 1 / -1; }
    .gp-empty--dashboard { align-items: flex-start; padding: 20px 14px; }
}
