/* Bastion Academy — sistema de diseño
   Oscuro por defecto, acento teal, sin dependencias externas (CSP estricta). */

/* ---------- Tokens ---------- */
:root {
    color-scheme: dark;

    --bg: #070a0f;
    --bg-elev: #0a0f16;
    --surface: #0d141d;
    --surface-2: #121b27;
    --line: #1a2433;
    --line-strong: #26344a;

    --text: #e8eef6;
    --text-2: #b3bfd0;
    --muted: #7d8ba1;

    --accent: #35d6b9;
    --accent-hover: #6ce9d2;
    --accent-ink: #04140f;
    --accent-bg: rgba(53, 214, 185, 0.1);
    --accent-line: rgba(53, 214, 185, 0.3);

    --ok: #4ade80;
    --warn: #f2b84b;
    --danger: #ff6b72;
    --info: #6aa8ff;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;

    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;

    --container: 1180px;
    --header-h: 68px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.15; letter-spacing: -0.02em; font-weight: 650; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.5rem); font-weight: 700; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.55rem, 2.8vw, 2.1rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

::selection { background: var(--accent-line); }

.container { width: min(100% - 2rem, var(--container)); margin-inline: auto; }
.narrow { max-width: 640px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.text-accent { color: var(--accent); }

.sr-only {
    position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: 1rem; top: -4rem; z-index: 100;
    background: var(--accent); color: var(--accent-ink); padding: 0.6rem 1rem; border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { top: 1rem; color: var(--accent-ink); }

.icon { flex: none; }

.eyebrow {
    display: inline-flex; align-items: center; gap: 0.45rem;
    margin: 0 0 1rem; color: var(--accent);
    font-family: var(--mono); font-size: 0.78rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
}

.lead { color: var(--text-2); font-size: clamp(1.05rem, 1.6vw, 1.25rem); max-width: 60ch; }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.65rem 1.15rem; border-radius: 10px; border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2; cursor: pointer; white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); border-color: #33465f; color: var(--text); }
.btn-quiet { background: transparent; color: var(--text-2); }
.btn-quiet:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.btn-sm { padding: 0.45rem 0.8rem; font-size: 0.85rem; border-radius: 8px; }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 1rem; border-radius: 12px; }
.btn-block { display: flex; width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.link-arrow { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.92rem; }
.link-arrow .icon { transition: transform 0.15s; }
.link-arrow:hover .icon { transform: translateX(3px); }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.2rem 0.6rem; border-radius: 999px;
    background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line-strong);
    color: var(--text-2); font-size: 0.75rem; font-weight: 600; line-height: 1.4; letter-spacing: 0.01em;
}
.badge-level { background: rgba(7, 10, 15, 0.6); backdrop-filter: blur(6px); color: var(--text); }
.badge-soon { background: var(--accent-bg); border-color: var(--accent-line); color: var(--accent); margin-left: 0.4rem; vertical-align: middle; }
.badge-active, .badge-course-published, .badge-user-active { background: rgba(74, 222, 128, 0.1); border-color: rgba(74, 222, 128, 0.3); color: var(--ok); }
.badge-pending, .badge-course-draft { background: rgba(242, 184, 75, 0.1); border-color: rgba(242, 184, 75, 0.3); color: var(--warn); }
.badge-completed { background: rgba(106, 168, 255, 0.1); border-color: rgba(106, 168, 255, 0.3); color: var(--info); }
.badge-cancelled, .badge-user-suspended, .badge-course-archived { background: rgba(255, 107, 114, 0.1); border-color: rgba(255, 107, 114, 0.3); color: var(--danger); }
.badge-neutral { background: rgba(255, 255, 255, 0.04); border-color: var(--line-strong); color: var(--muted); }

/* ---------- Alertas ---------- */
.flash-wrap { padding-top: 1rem; }
.alert {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
    padding: 0.85rem 1rem; border-radius: var(--radius); border: 1px solid var(--line-strong);
    background: var(--surface); font-size: 0.95rem;
}
.alert-success { border-color: rgba(74, 222, 128, 0.35); background: rgba(74, 222, 128, 0.07); }
.alert-error { border-color: rgba(255, 107, 114, 0.4); background: rgba(255, 107, 114, 0.08); }
.alert-info { border-color: rgba(106, 168, 255, 0.35); background: rgba(106, 168, 255, 0.07); }
.alert-close { flex: none; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0.15rem; line-height: 0; border-radius: 4px; }
.alert-close:hover { color: var(--text); }

/* ---------- Cabecera ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(7, 10, 15, 0.82); backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 2rem; min-height: var(--header-h); }

.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text); font-weight: 700; font-size: 1.12rem; letter-spacing: -0.01em; }
.brand:hover { color: var(--text); }
.brand-mark { flex: none; height: auto; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.5)); }
.brand-thin { font-weight: 400; color: var(--text-2); margin-left: 0.15em; }
.brand-center { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; margin-bottom: 1.75rem; font-size: 1.3rem; }

.header-panel { display: flex; align-items: center; flex: 1; gap: 1.5rem; }
.site-nav { display: flex; gap: 0.25rem; }
.site-nav a { padding: 0.5rem 0.8rem; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 0.95rem; }
.site-nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.site-nav a[aria-current="page"] { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.header-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.header-actions form { margin: 0; }

.nav-toggle {
    display: none; margin-left: auto; padding: 0.5rem; background: none; border: 1px solid var(--line-strong);
    color: var(--text); border-radius: 10px; cursor: pointer; line-height: 0;
}
.nav-toggle .i-close { display: none; }
.site-header.is-open .nav-toggle .i-open { display: none; }
.site-header.is-open .nav-toggle .i-close { display: block; }

@media (max-width: 860px) {
    .nav-toggle { display: inline-flex; }
    .header-panel {
        display: none; position: absolute; left: 0; right: 0; top: 100%;
        flex-direction: column; align-items: stretch; gap: 1rem;
        padding: 1rem; background: var(--bg-elev); border-bottom: 1px solid var(--line);
    }
    .site-header.is-open .header-panel { display: flex; }
    .site-nav { flex-direction: column; }
    .site-nav a { padding: 0.75rem 0.8rem; }
    .header-actions { margin-left: 0; flex-wrap: wrap; }
    .header-actions .btn { flex: 1; }
    .header-actions form { flex: 1; display: flex; }
}

/* ---------- Secciones ---------- */
.section { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.section-tight { padding: clamp(2rem, 4vw, 3rem) 0 clamp(3.5rem, 7vw, 5rem); }
.section-alt { background: linear-gradient(180deg, var(--bg-elev), var(--bg)); border-block: 1px solid var(--line); }

.section-head { max-width: 720px; margin-bottom: 2.5rem; }
.section-head h2 { margin-bottom: 0.4em; }
.section-lead { color: var(--text-2); font-size: 1.08rem; margin: 0; }
.section-head-row { max-width: none; display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-head-row h2 { margin: 0; }

.page-head { padding: clamp(1rem, 2vw, 1.5rem) 0 1rem; border-bottom: 1px solid var(--line);
    background: radial-gradient(60% 120% at 85% -20%, rgba(53, 214, 185, 0.08), transparent 70%); }
.page-head .eyebrow { margin-bottom: 0.4rem; }
.page-head h1 { font-size: clamp(1.7rem, 2.8vw, 2.25rem); margin-bottom: 0.2em; }
.page-head .lead { margin: 0; max-width: 80ch; font-size: 1.05rem; }
/* El contenido arranca justo debajo de la línea del encabezado de página. */
.page-head + .section-tight { padding-top: 1rem; }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.align-start { align-items: start; }
@media (max-width: 980px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

.empty {
    display: flex; flex-direction: column; align-items: center; gap: 0.5rem; text-align: center;
    padding: 3.5rem 1.5rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); color: var(--text-2);
}
.empty .icon { color: var(--muted); margin-bottom: 0.5rem; }
.empty h2 { font-size: 1.35rem; margin: 0; color: var(--text); }
.empty p { margin: 0 0 0.75rem; }

/* ---------- Hero ---------- */
.hero {
    position: relative; overflow: hidden; padding: clamp(3.5rem, 8vw, 6.5rem) 0 clamp(3.5rem, 7vw, 5.5rem);
    background: radial-gradient(55% 60% at 80% 0%, rgba(53, 214, 185, 0.13), transparent 70%);
}
.hero::before {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.55;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(70% 80% at 60% 20%, #000, transparent 75%);
    -webkit-mask-image: radial-gradient(70% 80% at 60% 20%, #000, transparent 75%);
}
.hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.hero-copy h1 { margin-bottom: 0.45em; }
.hero-copy .lead { margin-bottom: 2rem; }

.hero-stats { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 0.5rem 2.5rem; margin: 3rem 0 0; padding-top: 1.75rem; border-top: 1px solid var(--line); }
.hero-stats div { display: flex; flex-direction: column-reverse; }
.hero-stats dt { color: var(--muted); font-size: 0.82rem; }
.hero-stats dd { margin: 0; font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

@media (max-width: 940px) {
    .hero-grid { grid-template-columns: minmax(0, 1fr); }
    .hero-visual { max-width: 560px; }
}
@media (max-width: 560px) { .hero-stats { grid-template-columns: repeat(2, auto); } }

.terminal {
    background: rgba(9, 14, 21, 0.88); border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(53, 214, 185, 0.05), 0 0 60px -10px rgba(53, 214, 185, 0.12);
    overflow: hidden;
}
.terminal-bar { display: flex; align-items: center; gap: 0.4rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); }
.terminal-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.terminal-bar em { margin-left: 0.6rem; color: var(--muted); font-family: var(--mono); font-size: 0.75rem; font-style: normal; }
.terminal-body { margin: 0; padding: 1.25rem 1.25rem 1.5rem; font-family: var(--mono); font-size: 0.85rem; line-height: 1.75; color: var(--text-2); overflow-x: auto; }
.t-prompt { color: var(--accent); }
.t-dim { color: var(--muted); }
.t-ok { color: var(--ok); }
.t-warn { color: var(--warn); }
.t-cursor { display: inline-block; width: 8px; height: 1.05em; margin-left: 4px; vertical-align: text-bottom; background: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Tarjetas de categoría ---------- */
.category-card {
    display: flex; flex-direction: column; gap: 0.35rem; padding: 1.5rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--text);
    transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.category-card:hover { border-color: var(--accent-line); background: var(--surface-2); transform: translateY(-2px); color: var(--text); }
.category-card h3 { margin: 0.75rem 0 0; }
.category-card p { margin: 0; color: var(--text-2); font-size: 0.93rem; flex: 1; }
.category-count { margin-top: 0.75rem; color: var(--muted); font-family: var(--mono); font-size: 0.78rem; }

.category-icon {
    display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
    background: hsl(var(--cv) / 0.13); border: 1px solid hsl(var(--cv) / 0.3); color: hsl(var(--cv));
}

/* Paleta por categoría (hsl sin alfa, se compone con var(--cv)) */
.cover-1 { --cv: 170 65% 52%; }
.cover-2 { --cv: 215 90% 66%; }
.cover-3 { --cv: 350 85% 68%; }
.cover-4 { --cv: 38 92% 60%; }
.cover-5 { --cv: 265 80% 72%; }
.cover-6 { --cv: 140 65% 55%; }

/* ---------- Tarjetas de curso ---------- */
.course-card {
    display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-lg); overflow: hidden; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.course-card:hover { border-color: var(--accent-line); transform: translateY(-3px); box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.7); }

.course-cover, .cover-strip {
    position: relative; display: grid; place-items: center; min-height: 128px; color: hsl(var(--cv));
    background:
        linear-gradient(hsl(var(--cv) / 0.08) 1px, transparent 1px) 0 0 / 22px 22px,
        linear-gradient(90deg, hsl(var(--cv) / 0.08) 1px, transparent 1px) 0 0 / 22px 22px,
        linear-gradient(135deg, hsl(var(--cv) / 0.26), hsl(var(--cv) / 0.03) 70%),
        var(--surface-2);
    border-bottom: 1px solid var(--line);
}
.course-cover .badge { position: absolute; top: 0.75rem; left: 0.75rem; }
.course-cover .badge-start { left: auto; right: 0.75rem; background: rgba(7, 10, 15, 0.6); backdrop-filter: blur(6px); border-color: var(--accent-line); color: var(--accent); }
.cover-icon { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 18px; background: hsl(var(--cv) / 0.12); border: 1px solid hsl(var(--cv) / 0.35); }

.course-body { display: flex; flex-direction: column; flex: 1; padding: 1.25rem 1.25rem 1rem; }
.course-cat { margin: 0 0 0.4rem; color: var(--muted); font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
.course-title { font-size: 1.12rem; margin-bottom: 0.4rem; }
.course-title a { color: var(--text); }
.course-title a:hover { color: var(--accent); }
.course-sub { color: var(--text-2); font-size: 0.92rem; margin-bottom: 1rem; flex: 1; }
.course-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; color: var(--muted); font-size: 0.82rem; }
.course-meta li { display: inline-flex; align-items: center; gap: 0.35rem; }
.course-foot { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1.25rem; border-top: 1px solid var(--line); }

.price { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.price-free { color: var(--accent); }

/* ---------- Metodología ---------- */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; counter-reset: step; }
.steps li { position: relative; padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.steps h3 { margin: 0.75rem 0 0.4rem; }
.steps p { margin: 0; color: var(--text-2); font-size: 0.93rem; }
.step-num { font-family: var(--mono); font-size: 0.85rem; color: var(--accent); }
@media (max-width: 980px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .steps { grid-template-columns: minmax(0, 1fr); } }

.cta-band {
    display: flex; align-items: center; justify-content: space-between; gap: 2rem; flex-wrap: wrap;
    padding: clamp(1.75rem, 4vw, 3rem); border-radius: 24px; border: 1px solid var(--accent-line);
    background: radial-gradient(80% 140% at 100% 0%, rgba(53, 214, 185, 0.16), transparent 60%), var(--surface);
}
.cta-band h2 { margin-bottom: 0.3em; }
.cta-band p { margin: 0; color: var(--text-2); max-width: 46ch; }

/* ---------- Catálogo ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem 1rem; padding: 0.85rem 1rem; margin-bottom: 0.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.filters .field { min-width: 170px; }
.field-grow { flex: 1 1 240px; }
.filters-actions { display: flex; gap: 0.5rem; }
.result-count { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.6rem; }

/* ---------- Detalle de curso ---------- */
.course-hero { padding: 2rem 0 clamp(2.5rem, 5vw, 3.5rem); border-bottom: 1px solid var(--line);
    background: radial-gradient(60% 100% at 90% -20%, rgba(53, 214, 185, 0.1), transparent 70%); }
.breadcrumb { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 1.75rem; color: var(--muted); font-size: 0.88rem; }
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--accent); }
.course-hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.course-hero h1 { font-size: clamp(1.9rem, 3.8vw, 2.9rem); margin-top: 0.9rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.course-facts { display: grid; gap: 0.7rem; margin-top: 1.75rem; color: var(--text-2); }
.course-facts li { display: flex; align-items: center; gap: 0.7rem; }
.course-facts .icon { color: var(--accent); }
.course-facts strong { color: var(--text); font-weight: 600; }

.enroll-card { position: sticky; top: calc(var(--header-h) + 1rem); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); overflow: hidden; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8); }
.enroll-card > :not(.cover-strip) { margin-inline: 1.25rem; }
.enroll-card .btn-block { width: auto; }
.cover-strip { min-height: 96px; }
.enroll-price { margin: 1.25rem 1.25rem 1rem; font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; }
.price-note { margin: -0.5rem 1.25rem 1rem; color: var(--muted); font-size: 0.8rem; line-height: 1.45; }
.enroll-state { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; color: var(--text-2); font-size: 0.92rem; }
.enroll-note { margin-top: 0.85rem; margin-bottom: 0; color: var(--muted); font-size: 0.85rem; }
.enroll-list { display: grid; gap: 0.5rem; margin: 1.25rem 1.25rem 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--line); color: var(--text-2); font-size: 0.9rem; }
.enroll-list li { display: flex; align-items: center; gap: 0.55rem; }
.enroll-list .icon { color: var(--accent); }

.course-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.course-main > * + * { margin-top: 3rem; }
.course-main h2 { font-size: 1.5rem; }

@media (max-width: 940px) {
    .course-hero-grid, .course-layout { grid-template-columns: minmax(0, 1fr); }
    .enroll-card { position: static; }
}

.prose p { color: var(--text-2); max-width: 68ch; }

.outcomes ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem 1.5rem; }
.outcomes li { display: flex; gap: 0.7rem; color: var(--text-2); }
.outcomes .icon { color: var(--accent); margin-top: 0.2rem; }
@media (max-width: 680px) { .outcomes ul { grid-template-columns: minmax(0, 1fr); } }

.syllabus-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem 1rem; margin-bottom: 1rem; }
.syllabus-head h2 { margin: 0; }
.syllabus-head p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.module { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.module + .module { margin-top: 0.6rem; }
.module summary { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.15rem; cursor: pointer; list-style: none; }
.module summary::-webkit-details-marker { display: none; }
.module summary:hover { background: rgba(255, 255, 255, 0.025); }
.module-title { flex: 1; font-weight: 600; display: flex; align-items: center; gap: 0.75rem; }
.module-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent-bg); color: var(--accent); font-family: var(--mono); font-size: 0.78rem; }
.module-meta { color: var(--muted); font-size: 0.83rem; white-space: nowrap; }
.module-chevron { color: var(--muted); transition: transform 0.2s; }
.module[open] .module-chevron { transform: rotate(180deg); }
@media (max-width: 560px) { .module-meta { display: none; } }

.lesson-list { border-top: 1px solid var(--line); }
.lesson-list li { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 1.15rem; color: var(--text-2); font-size: 0.93rem; }
.lesson-list li + li { border-top: 1px solid var(--line); }
.lesson-list .icon { color: var(--muted); }
.lesson-title { flex: 1; }
.lesson-type { color: var(--muted); font-size: 0.78rem; font-family: var(--mono); }
.lesson-time { color: var(--muted); font-size: 0.83rem; min-width: 4.5rem; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .lesson-type { display: none; } }

.instructor-card { padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.instructor-card .eyebrow { margin-bottom: 1rem; }
.instructor-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.instructor-head h3 { margin: 0; }
.instructor-head p { margin: 0; font-size: 0.9rem; }
.instructor-card > p:last-child { margin: 0; color: var(--text-2); font-size: 0.93rem; }

.avatar { display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--accent-bg); border: 1px solid var(--accent-line); color: var(--accent); font-weight: 700; font-size: 0.9rem; letter-spacing: 0.02em; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.05rem; }

/* ---------- Docentes ---------- */
.person-card { padding: 1.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.person-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.person-head h2 { font-size: 1.25rem; margin: 0; }
.person-head p { margin: 0; font-size: 0.92rem; }
.person-card > p { color: var(--text-2); }
.person-courses { margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.person-courses .eyebrow { margin-bottom: 0.6rem; }
.person-courses li { padding: 0.15rem 0; font-size: 0.93rem; }

/* ---------- Formularios ---------- */
.card { padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card h2 { font-size: 1.2rem; margin-bottom: 1.1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.card-head h2 { margin: 0; }

.form { display: grid; gap: 1.1rem; }
.form-wide { max-width: 860px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.form-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-row .field-grow { flex: initial; }
.form-row:has(.field-grow) { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.5rem; }
@media (max-width: 680px) { .form-row, .form-row-3, .form-row:has(.field-grow) { grid-template-columns: minmax(0, 1fr); } }

.field { display: grid; gap: 0.4rem; align-content: start; }
.field label { font-size: 0.88rem; font-weight: 600; color: var(--text-2); }
.optional { color: var(--muted); font-weight: 400; }
.hint { margin: 0; color: var(--muted); font-size: 0.83rem; }
.error { margin: 0; color: var(--danger); font-size: 0.85rem; }

.input, .select, .textarea {
    width: 100%; padding: 0.7rem 0.85rem; background: var(--bg-elev); color: var(--text);
    border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; font-size: 0.97rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { resize: vertical; min-height: 7rem; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: #55637a; }
.input:hover, .select:hover, .textarea:hover { border-color: #33465f; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.input:disabled { opacity: 0.6; cursor: not-allowed; }
.is-invalid { border-color: var(--danger) !important; }
.is-invalid:focus { box-shadow: 0 0 0 3px rgba(255, 107, 114, 0.15); }
.select { appearance: none; padding-right: 2.2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237d8ba1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.75rem center; }
.select option { background: var(--surface); }

.input-group { position: relative; }
.input-group .input { padding-right: 3rem; }
.input-addon { position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%); padding: 0.45rem; background: none; border: 0; color: var(--muted); cursor: pointer; line-height: 0; border-radius: 8px; }
.input-addon:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

.check { display: flex; align-items: center; gap: 0.6rem; color: var(--text-2); cursor: pointer; }
.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.contact-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: minmax(0, 1fr); } }
.check-list { display: grid; gap: 0.75rem; margin-bottom: 1.25rem; color: var(--text-2); }
.check-list li { display: flex; gap: 0.65rem; }
.check-list .icon { color: var(--accent); margin-top: 0.2rem; }

/* ---------- Autenticación ---------- */
.auth-body { background: radial-gradient(60% 50% at 50% -10%, rgba(53, 214, 185, 0.12), transparent 70%), var(--bg); min-height: 100vh; }
.auth-wrap { width: min(100% - 2rem, 440px); margin: 0 auto; padding: clamp(2rem, 8vh, 5rem) 0 3rem; }
.auth-card { padding: clamp(1.5rem, 4vw, 2.25rem); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8); }
.auth-card h1 { font-size: 1.7rem; margin-bottom: 0.3rem; }
.auth-sub { margin-bottom: 1.5rem; }
.auth-card .flash-wrap { width: auto; padding: 0 0 1.25rem; }
.forgot-link { margin: -0.4rem 0 0; text-align: right; font-size: 0.88rem; }
.auth-alt { margin: 1.5rem 0 0; text-align: center; color: var(--text-2); font-size: 0.93rem; }
.auth-back { display: block; margin-top: 1.5rem; text-align: center; color: var(--muted); font-size: 0.9rem; }
.auth-back:hover { color: var(--text); }

/* ---------- Portal del alumno ---------- */
.portal { padding: 2.5rem 0 4.5rem; min-height: 60vh; }
.portal-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.75rem; }
.portal-head .avatar { width: 56px; height: 56px; font-size: 1.1rem; }
.portal-head .eyebrow { margin: 0 0 0.2rem; }
.portal-title { font-size: clamp(1.4rem, 2.4vw, 1.9rem); margin: 0; }
.portal .flash-wrap { width: auto; padding: 0 0 1.25rem; }

.tabs { display: flex; gap: 0.25rem; margin-bottom: 1.75rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 0.7rem 1rem; color: var(--text-2); font-weight: 500; font-size: 0.93rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

.enrollment-card { display: flex; flex-direction: column; gap: 0.5rem; padding: 1.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.enrollment-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.enrollment-card h2 { font-size: 1.15rem; margin: 0; }
.enrollment-card h2 a { color: var(--text); }
.enrollment-card h2 a:hover { color: var(--accent); }
.enrollment-card p { margin: 0; }
.enrollment-note { color: var(--text-2); font-size: 0.92rem; padding: 0.75rem 0.9rem; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 10px; }
.enrollment-card .link-arrow { margin-top: 0.5rem; }

/* ---------- Pago ---------- */
.checkout { max-width: 560px; margin-inline: auto; }
.checkout-card { display: grid; gap: 1.1rem; }
.checkout-card h2 { margin: 0; font-size: 1.35rem; }
.checkout-card p { margin: 0; }
.checkout-lines { display: grid; gap: 0.7rem; margin: 0.25rem 0 0; }
.checkout-lines > div { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--line); }
.checkout-lines dt { color: var(--muted); }
.checkout-lines dd { margin: 0; font-weight: 600; text-align: right; }
.checkout-lines .checkout-total { align-items: baseline; padding-bottom: 0; border-bottom: 0; }
.checkout-lines .checkout-total dd { color: var(--accent); font-size: 1.6rem; }
.checkout .price-note { margin: 0; }
.checkout .auth-alt { margin-top: 0; }

.progress-row { display: flex; align-items: center; gap: 0.8rem; margin-top: 0.5rem; }
.progress-row span { font-family: var(--mono); font-size: 0.85rem; color: var(--text-2); min-width: 3ch; text-align: right; }
progress { appearance: none; -webkit-appearance: none; flex: 1; height: 8px; border: 0; border-radius: 999px; background: var(--line); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--accent), var(--accent-hover)); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

/* ---------- Errores ---------- */
.error-page { padding: clamp(4rem, 12vw, 8rem) 0; }
.error-code { margin: 0 0 0.5rem; font-family: var(--mono); font-size: clamp(3.5rem, 12vw, 7rem); font-weight: 700; line-height: 1; letter-spacing: -0.04em;
    background: linear-gradient(180deg, var(--accent), rgba(53, 214, 185, 0.15)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page .lead { margin-inline: auto; }
.error-page .btn-row { justify-content: center; margin-top: 1.75rem; }

/* ---------- Pie ---------- */
.site-footer { margin-top: 2rem; border-top: 1px solid var(--line); background: var(--bg-elev); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 2rem; padding: 3rem 0 2rem; }
.footer-brand p { margin: 1rem 0 0; max-width: 38ch; color: var(--muted); font-size: 0.93rem; }
.footer-col { display: flex; flex-direction: column; gap: 0.55rem; }
.footer-col h2 { margin: 0 0 0.4rem; font-family: var(--mono); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.footer-col a { color: var(--text-2); font-size: 0.93rem; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; padding: 1.25rem 0 2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.84rem; }
.footer-bottom p { margin: 0; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .footer-brand { grid-column: 1 / -1; } }

/* ---------- Administración ---------- */
.admin-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.admin-side { position: sticky; top: 0; align-self: start; height: 100vh; display: flex; flex-direction: column; gap: 1.5rem; padding: 1.25rem 1rem; background: var(--bg-elev); border-right: 1px solid var(--line); }
.admin-side .brand { padding: 0.25rem 0.5rem; }
.admin-nav { display: grid; gap: 0.15rem; }
.admin-nav a, .admin-nav-link { display: flex; align-items: center; gap: 0.7rem; width: 100%; padding: 0.6rem 0.75rem; border: 0; border-radius: 9px; background: none; color: var(--text-2); font: inherit; font-size: 0.93rem; font-weight: 500; text-align: left; cursor: pointer; }
.admin-nav a:hover, .admin-nav-link:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.admin-nav a[aria-current="page"] { background: var(--accent-bg); color: var(--accent); }
.admin-side-foot { margin-top: auto; display: grid; gap: 0.15rem; }
.admin-side-foot form { margin: 0; }
.admin-user { margin: 0.75rem 0 0; padding: 0.75rem 0.75rem 0; border-top: 1px solid var(--line); font-size: 0.85rem; font-weight: 600; word-break: break-word; }
.admin-user span { color: var(--muted); font-weight: 400; }

.admin-main { padding: 2rem clamp(1rem, 3vw, 2.5rem) 4rem; min-width: 0; }
.admin-main .flash-wrap { width: auto; padding: 0 0 1.25rem; }
.admin-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.admin-head h1 { font-size: 1.7rem; margin: 0 0 0.2rem; }
.admin-head p { margin: 0; }

@media (max-width: 860px) {
    .admin-shell { grid-template-columns: minmax(0, 1fr); }
    .admin-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-right: 0; border-bottom: 1px solid var(--line); }
    .admin-nav { display: flex; overflow-x: auto; order: 3; width: 100%; }
    .admin-nav a { width: auto; white-space: nowrap; }
    .admin-side-foot { margin: 0 0 0 auto; display: flex; }
    .admin-side-foot .admin-nav-link span, .admin-user { display: none; }
    .admin-side-foot .admin-nav-link { width: auto; }
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { display: flex; flex-direction: column; gap: 0.2rem; padding: 1.15rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); transition: border-color 0.15s; }
.stat:hover { border-color: var(--accent-line); color: var(--text); }
.stat-value { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 0.85rem; }
.stat-attn { border-color: rgba(242, 184, 75, 0.4); }
.stat-attn .stat-value { color: var(--warn); }

.feed li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 0; }
.feed li + li { border-top: 1px solid var(--line); }
.feed li > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.feed .muted { font-size: 0.87rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; flex: none; }

.table-wrap { position: relative; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th { padding: 0.8rem 1rem; text-align: left; color: var(--muted); font-family: var(--mono); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--line-strong); background: var(--bg-elev); }
.table td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * { display: inline-flex; }
.inline-form { display: inline-flex; gap: 0.35rem; margin: 0; }
.search-inline { display: flex; gap: 0.5rem; }
.search-inline .input { width: 240px; }

.message-list { display: grid; gap: 1rem; max-width: 820px; }
.message header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.message header div { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: baseline; }
.message h2 { font-size: 1.05rem; margin-bottom: 0.4rem; }
.message > p { color: var(--text-2); }
.message form { margin: 0; }
.message-unread { border-color: rgba(242, 184, 75, 0.4); }

/* ---------- Selector de idioma ---------- */
.lang-switch { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; color: var(--muted); }
.lang-select {
    appearance: none; padding: 0.4rem 1.7rem 0.4rem 0.65rem; border: 1px solid var(--line-strong); border-radius: 8px;
    background: var(--bg-elev) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237d8ba1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.5rem center;
    color: var(--text); font: inherit; font-size: 0.85rem; font-weight: 500; cursor: pointer;
}
.lang-select:hover { border-color: #33465f; }
.lang-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-select option { background: var(--surface); color: var(--text); }
.auth-lang { position: absolute; top: 1rem; right: 1rem; }
@media (max-width: 860px) { .header-actions .lang-switch { flex: 0 0 auto; } }

/* ---------- Aula del alumno ---------- */
.classroom-title { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 1rem; margin-bottom: 0.3rem; }
.classroom-title h1 { margin: 0; }
.progress-wide { max-width: 520px; margin-top: 0.9rem; }
.progress-note { margin: 0.35rem 0 0; }
.preview-note { display: inline-flex; margin: 0.9rem 0 0; }

.classroom-layout, .lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: clamp(1.25rem, 3vw, 2.5rem); align-items: start; }
.classroom-main > * + * { margin-top: 0.6rem; }
@media (max-width: 940px) {
    .classroom-layout, .lesson-layout { grid-template-columns: minmax(0, 1fr); }
    .next-class, .lesson-side { order: -1; }
}

.class-list { border-top: 1px solid var(--line); }
.class-list li + li { border-top: 1px solid var(--line); }
.class-row { display: flex; align-items: center; gap: 0.85rem; padding: 0.8rem 1.15rem; color: var(--text-2); font-size: 0.93rem; }
.class-row:hover { background: rgba(255, 255, 255, 0.03); color: var(--text); }
.class-name { flex: 1; min-width: 0; }
.class-when { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.class-check { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); color: var(--accent-ink); }
.class-row.is-done .class-check { background: var(--accent); border-color: var(--accent); }
.class-row.is-done .class-name { color: var(--muted); }
@media (max-width: 640px) { .class-when { display: none; } }

.next-class, .lesson-side .card { padding: 1.4rem; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); }
.next-class { position: sticky; top: calc(var(--header-h) + 1rem); }
.next-class h2 { font-size: 1.2rem; margin-bottom: 0.3rem; }
.next-class .eyebrow { margin-bottom: 0.7rem; }
.next-facts { display: grid; gap: 0.5rem; margin: 1rem 0 1.25rem; color: var(--text-2); font-size: 0.92rem; }
.next-facts li { display: flex; align-items: center; gap: 0.55rem; }
.next-facts .icon { color: var(--accent); }

.lesson-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-top: 0.9rem; color: var(--text-2); font-size: 0.92rem; }
.lesson-meta li { display: inline-flex; align-items: center; gap: 0.45rem; }
.lesson-meta .icon { color: var(--accent); }
.lesson-main > * + * { margin-top: 1.5rem; }
.class-access h2 { font-size: 1.15rem; }
.class-access > p { max-width: 60ch; }
.class-recording { margin: 1rem 0 0; }
.lesson-main .prose h2 { font-size: 1.25rem; }
.lesson-notes h2 { display: flex; align-items: center; gap: 0.5rem; font-size: 1.15rem; }
.lesson-notes .textarea { margin-top: 0.9rem; resize: vertical; }
.lesson-notes-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 0.85rem; }
.lesson-side { display: grid; gap: 1rem; }
.lesson-side .card h2 { font-size: 1.05rem; }
.done-note { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.9rem; color: var(--ok); font-weight: 600; }
.lesson-nav { display: grid; gap: 0.5rem; }
.lesson-nav .btn { white-space: normal; text-align: center; }

/* ---------- Administración: clases del curso ---------- */
.head-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.module-card { padding: 0; margin-bottom: 1.25rem; overflow: hidden; }
.module-card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem 1rem; padding: 0.9rem 1.15rem; border-bottom: 1px solid var(--line); background: var(--bg-elev); }
.module-rename { flex: 1 1 320px; align-items: center; gap: 0.6rem; }
.module-rename .input { flex: 1; min-width: 0; font-weight: 600; }
.row-actions { display: flex; align-items: center; gap: 0.5rem; }
.row-actions form { margin: 0; }
.table-flat { border: 0; border-radius: 0; background: none; }
.module-empty { margin: 0; padding: 1rem 1.15rem; }
.add-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.85rem 1.15rem; border-top: 1px solid var(--line); }
.add-row .input { flex: 1; min-width: 0; }
.add-module label { display: block; margin-bottom: 0.5rem; font-weight: 600; color: var(--text-2); font-size: 0.9rem; }
.add-module .inline-form { display: flex; gap: 0.5rem; }
.add-module .input { flex: 1; min-width: 0; }
.inline-form .input { width: auto; }
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { color: var(--danger); background: rgba(255, 107, 114, 0.1); }
.btn[disabled] { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.input-narrow { max-width: 280px; }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Administración: traducciones ---------- */
.i18n { min-width: 0; margin: 0; padding: 0.9rem 1.15rem 0.4rem; border: 1px solid var(--line); border-radius: var(--radius); }
.i18n legend { padding: 0 0.4rem; color: var(--text-2); font-size: 0.9rem; font-weight: 600; }
.i18n > .hint { margin-bottom: 0.5rem; }
.i18n-lang { border-top: 1px solid var(--line); }
.i18n-lang summary { display: flex; align-items: center; gap: 0.6rem; padding: 0.75rem 0; font-weight: 600; cursor: pointer; }
.i18n-body { display: grid; gap: 1rem; padding-bottom: 1rem; }
.module-rename { flex-wrap: wrap; }
.module-i18n { flex: 1 0 100%; }
.module-i18n summary { color: var(--muted); font-size: 0.82rem; cursor: pointer; }
.module-i18n-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; margin-top: 0.5rem; }
@media (max-width: 680px) { .module-i18n-body { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Intro de arranque ---------- */
/* El escudo crece desde el centro; BASTION entra desde arriba a la izquierda y ACADEMY desde abajo a la derecha. */
.splash { display: none; }

.splash-on .splash {
    position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; cursor: pointer;
    background: radial-gradient(60% 50% at 50% 48%, rgba(53, 214, 185, 0.1), transparent 70%), var(--bg);
    animation: splash-out 0.8s ease 3.5s forwards;
}
.splash-stage { display: flex; flex-direction: column; align-items: center; gap: clamp(0.9rem, 3vmin, 1.75rem); }

.splash-shield {
    width: clamp(130px, 27vmin, 270px); aspect-ratio: 243 / 256;
    background: url("../img/escudo-512.png") center / contain no-repeat;
    filter: drop-shadow(0 12px 40px rgba(212, 169, 75, 0.25));
    animation: splash-grow 1.6s cubic-bezier(0.16, 0.84, 0.28, 1) both;
}

.splash-word { display: block; text-transform: uppercase; white-space: nowrap; will-change: transform, opacity; }
.splash-bastion {
    color: var(--text); font-size: clamp(2.1rem, 8.5vmin, 4.75rem); font-weight: 800; letter-spacing: 0.3em; margin-right: -0.3em;
    animation: splash-from-top-left 1.4s cubic-bezier(0.2, 0.8, 0.25, 1) 0.6s both;
}
.splash-academy {
    display: flex; align-items: center; gap: 0.9em;
    color: var(--text-2); font-size: clamp(1.05rem, 4vmin, 2.1rem); font-weight: 300; letter-spacing: 0.55em; margin-right: -0.55em;
    animation: splash-from-bottom-right 1.4s cubic-bezier(0.2, 0.8, 0.25, 1) 1s both;
}
.splash-academy::before, .splash-academy::after { content: ""; width: clamp(1.5rem, 7vmin, 3.5rem); height: 1px; background: #d4a94b; opacity: 0.85; }

@keyframes splash-grow {
    from { transform: scale(0.04); opacity: 0; }
    60% { opacity: 1; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes splash-from-top-left {
    from { transform: translate3d(-65vw, -60vh, 0); opacity: 0; }
    25% { opacity: 1; }
    to { transform: translate3d(0, 0, 0); opacity: 1; }
}
@keyframes splash-from-bottom-right {
    from { transform: translate3d(65vw, 60vh, 0); opacity: 0; }
    25% { opacity: 1; }
    to { transform: translate3d(0, 0, 0); opacity: 1; }
}
@keyframes splash-out {
    to { opacity: 0; visibility: hidden; }
}

/* ---------- Ficha del docente (ventana modal) ---------- */
.stretched-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.teacher-link { color: inherit; text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 0.2em; cursor: pointer; }
.teacher-link:hover { color: var(--accent); text-decoration-color: var(--accent); }

.instructor-card { position: relative; transition: border-color 0.2s, background 0.2s; }
.instructor-card:hover { border-color: var(--accent-line); background: var(--surface-2); }
.instructor-card h3 a { color: var(--text); }
.instructor-more { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 1rem; color: var(--accent); font-weight: 600; font-size: 0.9rem; }

.person-card { position: relative; transition: border-color 0.2s, background 0.2s; }
.person-card:hover { border-color: var(--accent-line); }
.person-card h2 a { color: var(--text); }
.person-courses a { position: relative; z-index: 1; }
.person-card .instructor-more { margin-top: 1.25rem; }

.avatar-xl { width: 72px; height: 72px; font-size: 1.4rem; }

.instructor-dialog {
    width: min(760px, calc(100vw - 1.5rem)); max-height: min(90vh, 880px); padding: 0; overflow: hidden;
    border: 1px solid var(--line-strong); border-radius: 22px; background: var(--surface); color: var(--text);
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(53, 214, 185, 0.06);
}
.instructor-dialog[open] { display: flex; flex-direction: column; animation: dialog-in 0.28s cubic-bezier(0.2, 0.8, 0.25, 1); }
.instructor-dialog::backdrop { background: rgba(3, 6, 10, 0.74); backdrop-filter: blur(5px); animation: dialog-fade 0.25s ease; }
html:has(dialog[open]) { overflow: hidden; }

.dialog-head {
    display: flex; align-items: center; gap: 1.1rem; padding: 1.6rem 1.75rem 1.3rem;
    border-bottom: 1px solid var(--line);
    background: radial-gradient(90% 160% at 0% 0%, rgba(53, 214, 185, 0.1), transparent 70%), var(--bg-elev);
}
.dialog-title { flex: 1; min-width: 0; }
.dialog-title .eyebrow { margin-bottom: 0.35rem; }
.dialog-title h2 { margin: 0; font-size: clamp(1.35rem, 3vw, 1.75rem); }
.dialog-headline { margin: 0.2rem 0 0; color: var(--text-2); }
.dialog-close { align-self: flex-start; flex: none; padding: 0.5rem; border: 1px solid var(--line-strong); border-radius: 10px; background: none; color: var(--text-2); line-height: 0; cursor: pointer; }
.dialog-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

.dialog-body { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; padding: 1.5rem 1.75rem 1.75rem; display: grid; gap: 1.6rem; align-content: start; }
.dialog-bio p { margin: 0 0 0.8em; color: var(--text-2); }
.dialog-bio p:last-child { margin: 0; }
.dialog-section h3 { display: flex; align-items: center; gap: 0.55rem; margin: 0 0 0.8rem; font-size: 0.78rem; font-family: var(--mono); font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.background-list { display: grid; gap: 0.55rem; padding-left: 0.3rem; border-left: 1px solid var(--line-strong); }
.background-list li { position: relative; padding-left: 1.1rem; color: var(--text-2); font-size: 0.95rem; line-height: 1.5; }
.background-list li::before { content: ""; position: absolute; left: -0.25rem; top: 0.6em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--surface); }
.dialog-courses { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.dialog-courses a { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.85rem; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--text); font-size: 0.88rem; font-weight: 500; }
.dialog-courses a:hover { border-color: var(--accent-line); color: var(--accent); }
.dialog-foot { padding: 1rem 1.75rem 1.4rem; border-top: 1px solid var(--line); background: var(--bg-elev); }

@keyframes dialog-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes dialog-fade { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 560px) {
    .instructor-dialog { width: 100vw; max-width: 100vw; max-height: 92vh; margin-bottom: 0; border-radius: 22px 22px 0 0; }
    .dialog-head { padding: 1.2rem 1.1rem 1rem; gap: 0.8rem; }
    .dialog-body { padding: 1.2rem 1.1rem 1.4rem; }
    .dialog-foot { padding: 0.9rem 1.1rem 1.2rem; }
    .avatar-xl { width: 56px; height: 56px; font-size: 1.15rem; }
}

/* ---------- Adaptable (móvil y tablet) ---------- */
/* Botones y enlaces de navegación con área táctil cómoda (mínimo ~40 px de alto). */
@media (max-width: 860px) {
    .footer-col a, .breadcrumb a { display: inline-block; padding-block: 0.5rem; }
    .footer-col { gap: 0; }
    .breadcrumb { flex-wrap: wrap; gap: 0 0.5rem; }
    .site-nav a, .admin-nav a { min-height: 44px; }
    .tabs a { padding-block: 0.85rem; }
    .btn-sm { min-height: 40px; }
    .lang-switch .select, .lang-switch select { min-height: 40px; }
}

/* En pantallas chicas el pseudo-terminal de la portada ajusta el texto en vez de recortarlo. */
@media (max-width: 560px) {
    .terminal-body { padding: 1rem; font-size: 0.78rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: visible; }
}

/* Búsquedas y filtros en línea ocupan todo el ancho disponible. */
@media (max-width: 680px) {
    .search-inline { width: 100%; }
    .search-inline .input { flex: 1; min-width: 0; width: auto; }
    .admin-head > * { min-width: 0; }
    .admin-head .btn, .admin-head .search-inline { max-width: 100%; }
}

/* Tablas del panel: con JavaScript (clase .js), cada fila pasa a ser una tarjeta «columna: valor» en pantallas chicas; sin él, la tabla se desliza de costado. */
@media (max-width: 720px) {
    .js .table-wrap { overflow: visible; background: none; border: 0; }
    .js .table, .js .table tbody, .js .table tr, .js .table td { display: block; width: 100%; }
    .js .table thead { position: absolute; top: 0; left: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .js .table tbody tr { margin-bottom: 0.9rem; padding: 0.4rem 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
    .js .table-flat .table tbody tr { background: var(--bg-elev); }
    .js .table tbody tr:hover { background: var(--surface); }
    .js .table td { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.5rem 1rem; border-bottom: 0; text-align: right; overflow-wrap: anywhere; }
    .js .table td[data-label]::before { content: attr(data-label); flex: none; max-width: 45%; color: var(--muted); font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.06em; text-align: left; text-transform: uppercase; }
    .js .table td:first-child { display: block; padding-top: 0.75rem; text-align: left; }
    .js .table td:first-child::before { display: none; }
    .js .table td.actions { justify-content: flex-end; flex-wrap: wrap; padding-bottom: 0.75rem; }
    .js .table td.actions::before { display: none; }
    .js .table td[colspan] { justify-content: center; text-align: center; }
}
@media (max-width: 860px) {
    .module-i18n summary { padding-block: 0.6rem; }
}
@media (max-width: 860px) {
    /* Con la barra superior arriba, el contenido sobrante va al contenido y no a estirar la barra. */
    .admin-shell { grid-template-rows: auto minmax(0, 1fr); }
}
.table-wrap + p { margin-top: 1rem; }
