/* ============================================================
   AugasFormación — Design System v2
   ============================================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --cyan: #06b6d4;
    --success: #059669;
    --success-light: #ecfdf5;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --info-light: #eff6ff;

    --navy: #0f172a;
    --navy-mid: #1e293b;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.07), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 4px 14px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 8px 28px rgba(15, 23, 42, 0.10), 0 3px 10px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 18px 44px rgba(15, 23, 42, 0.12), 0 6px 16px rgba(15, 23, 42, 0.06);

    --r-sm: 6px;
    --r: 10px;
    --r-md: 14px;
    --r-lg: 18px;
    --r-xl: 24px;
    --r-full: 9999px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

/* ── Container ─────────────────────────────────────── */
.ac-container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Header — dark navy ─────────────────────────────── */
.ac-header {
    background: var(--navy);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.ac-header--floating {
    position: sticky;
    top: 0;
    z-index: 100;
}

.ac-header .ac-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
    gap: 1.5rem;
}

.ac-border-b {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ac-logo {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    text-decoration: none;
    background: linear-gradient(135deg, #93c5fd 0%, #ffffff 55%, #67e8f9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ac-navbar {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex-wrap: wrap;
}

.ac-navbar__link {
    position: relative;
}

.nav-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    min-width: 14px;
    height: 14px;
    background: var(--danger);
    color: #fff;
    font-size: 0.58rem;
    font-weight: 700;
    border-radius: var(--r-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    pointer-events: none;
    line-height: 1;
}

.ac-navbar__link {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    padding: 0.35rem 0.5rem;
    border-radius: var(--r-sm);
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}

.ac-navbar__link:hover {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.08);
}

/* Header — badge and buttons */
.ac-header .ac-badge--secondary {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.ac-header .ac-btn--ghost {
    color: rgba(255, 255, 255, 0.6);
    border-color: rgba(255, 255, 255, 0.15);
    background: transparent;
}

.ac-header .ac-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.95);
}

/* ── Layout ────────────────────────────────────────── */
.ac-main {
    min-height: calc(100vh - 65px);
    display: flex;
    flex-direction: column;
}

.ac-section {
    padding-top: 2rem;
    padding-bottom: 3rem;
    flex: 1;
}

.ac-footer {
    background: var(--navy);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1.5rem 0;
}

.ac-footer--center {
    text-align: center;
}

.ac-footer p {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.82rem;
}

.ac-shadow-top {
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.06);
}

/* ── Landing page (full-screen dark) ───────────────── */
.landing-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--navy);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(37, 99, 235, 0.2) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 25%, rgba(6, 182, 212, 0.12) 0%, transparent 45%),
        radial-gradient(ellipse at 55% 90%, rgba(99, 102, 241, 0.08) 0%, transparent 50%);
    position: relative;
}

.landing-brand {
    font-size: clamp(3.5rem, 10vw, 6.0rem);
    font-weight: 900;
    letter-spacing: -0.055em;
    line-height: 1.95;
    background: linear-gradient(135deg, #93c5fd 0%, #ffffff 45%, #67e8f9 80%, #a5f3fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-tagline {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
}

.landing-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.landing-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 2.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: var(--r);
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 24px rgba(37, 99, 235, 0.45);
    transition: all 0.2s ease;
}

.landing-login-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 32px rgba(37, 99, 235, 0.6);
    transform: translateY(-2px);
    color: #fff;
}

.landing-register-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--r-sm);
    transition: color 0.15s;
}

.landing-register-link:hover {
    color: rgba(255, 255, 255, 0.75);
}

.landing-flash {
    position: absolute;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: min(90%, 480px);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ── Cards ─────────────────────────────────────────── */
.ac-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ac-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.ac-card--glass {
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: rgba(255, 255, 255, 0.9);
}

.ac-card--accent {
    background: var(--primary-light);
    border-color: rgba(37, 99, 235, 0.15);
    text-decoration: none;
    display: block;
}

.ac-card--accent:hover {
    background: #dbeafe;
    transform: translateY(-2px);
}

.ac-card--form {
    max-width: 600px;
    margin: 0 auto;
}

.ac-card__title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.025em;
    margin-bottom: 0.4rem;
}

.ac-card__text {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.7;
}

/* ── Stat cards (teacher dashboard) ────────────────── */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: var(--r-lg);
    padding: 1.75rem 1.5rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card__number {
    font-size: 3.25rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.35rem;
}

.stat-card__label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* ── Action cards (teacher dashboard) ──────────────── */
.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem 1.5rem;
    background: var(--surface);
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--r-lg);
    text-decoration: none;
    transition: all 0.2s;
    text-align: center;
}

.action-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
}

.action-card__icon {
    font-size: 1.75rem;
    line-height: 1;
    color: var(--primary);
}

.action-card__icon i,
.action-card__icon svg {
    width: 28px;
    height: 28px;
    stroke-width: 1.5;
}

.action-card__title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

.action-card__desc {
    font-size: 0.825rem;
    color: var(--text-muted);
}

/* ── Typography ─────────────────────────────────────── */
.ac-heading {
    font-size: clamp(1.4rem, 2.5vw, 1.9rem);
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.035em;
    line-height: 1.2;
    margin-bottom: 0.35rem;
}

.ac-text-muted {
    color: var(--text-muted);
}

.ac-text-center {
    text-align: center;
}

.ac-text-right {
    text-align: right;
}

.ac-text-xl {
    font-size: 1.1rem;
    font-weight: 700;
}

.ac-text-sm {
    font-size: 0.82rem;
}

.ac-text-primary {
    color: var(--primary);
}

.ac-font-semibold {
    font-weight: 600;
}

/* ── Buttons ────────────────────────────────────────── */
.ac-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--r);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1;
    letter-spacing: 0.01em;
}

.ac-btn:hover {
    transform: translateY(-1px);
}

.ac-btn:active {
    transform: translateY(0);
}

.ac-btn--primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

.ac-btn--primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    color: #fff;
}

.ac-btn--secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.ac-btn--secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.ac-btn--ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.ac-btn--ghost:hover {
    background: var(--bg);
    color: var(--text);
}

.ac-btn--danger {
    background: var(--danger);
    color: #fff;
}

.ac-btn--danger:hover {
    background: #b91c1c;
    color: #fff;
}

.ac-btn--small {
    padding: 0.38rem 0.8rem;
    font-size: 0.8rem;
}

.ac-btn--lg {
    padding: 0.75rem 1.4rem;
    font-size: 0.925rem;
}

.ac-btn--xl {
    padding: 0.9rem 1.65rem;
    font-size: 0.975rem;
}

.ac-btn--block {
    width: 100%;
}

/* ── Badges ─────────────────────────────────────────── */
.ac-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.72rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: var(--r-full);
    letter-spacing: 0.01em;
}

.ac-badge--info {
    background: var(--info-light);
    color: #1d4ed8;
}

.ac-badge--success {
    background: var(--success-light);
    color: var(--success);
}

.ac-badge--danger {
    background: var(--danger-light);
    color: var(--danger);
}

.ac-badge--secondary {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* In light context, override badge secondary */
.ac-section .ac-badge--secondary,
main .ac-badge--secondary {
    background: #f1f5f9;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ── Alerts ─────────────────────────────────────────── */
.ac-alert {
    padding: 0.85rem 1rem 0.85rem 1.1rem;
    border-radius: var(--r);
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 3px solid;
}

.ac-alert--info {
    background: var(--info-light);
    color: #1e40af;
    border-color: var(--primary);
}

.ac-alert--success {
    background: var(--success-light);
    color: #065f46;
    border-color: var(--success);
}

.ac-alert--danger {
    background: var(--danger-light);
    color: #991b1b;
    border-color: var(--danger);
}

/* ── Forms ──────────────────────────────────────────── */
.ac-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.ac-form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ac-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.ac-input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    font-size: 0.95rem;
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
}

.ac-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.ac-input--lg {
    padding: 0.85rem 1rem;
    font-size: 0.975rem;
}

.ac-input::placeholder {
    color: var(--border-strong);
}

.markdown-textarea {
    min-height: 400px;
    max-height: 800px;
    resize: vertical;
}

.ac-checkbox {
    accent-color: var(--primary);
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

.ac-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--text-muted);
}

.form-card {
    max-width: 780px;
    margin: 0 auto;
}

.form-field-note {
    margin-top: 0.35rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ── Grids ──────────────────────────────────────────── */
.ac-grid {
    display: grid;
    gap: 1.5rem;
}

.ac-grid--2 {
    grid-template-columns: repeat(2, 1fr);
}

.ac-grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.ac-grid--4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ── Flex ───────────────────────────────────────────── */
.ac-flex {
    display: flex;
}

.ac-flex--center {
    align-items: center;
}

.ac-flex--space-between {
    justify-content: space-between;
}

.ac-flex--wrap {
    flex-wrap: wrap;
}

.ac-items-center {
    align-items: center;
}

/* ── Stack ──────────────────────────────────────────── */
.ac-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.ac-stack--small {
    gap: 0.5rem;
}

/* ── Spacing ─────────────────────────────────────────── */
.ac-gap-2 {
    gap: 0.5rem;
}

.ac-gap-3 {
    gap: 0.75rem;
}

.ac-gap-4 {
    gap: 1rem;
}

.ac-gap-5 {
    gap: 1.25rem;
}

.ac-gap-6 {
    gap: 1.5rem;
}

.ac-gap-10 {
    gap: 2.5rem;
}

.ac-mt-4 {
    margin-top: 1rem;
}

.ac-mt-6 {
    margin-top: 1.5rem;
}

.ac-mt-8 {
    margin-top: 2rem;
}

.ac-mb-4 {
    margin-bottom: 1rem;
}

.ac-mb-6 {
    margin-bottom: 1.5rem;
}

.ac-mb-8 {
    margin-bottom: 2rem;
}

.ac-mb-10 {
    margin-bottom: 2.5rem;
}

.ac-p-6 {
    padding: 1.5rem;
}

.ac-p-8 {
    padding: 2rem;
}

.ac-pt-8 {
    padding-top: 2rem;
}

.ac-pb-8 {
    padding-bottom: 2rem;
}

.ac-py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.ac-py-10 {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
}

.ac-py-16 {
    padding-top: 4rem;
    padding-bottom: 4rem;
}

.ac-px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.ac-space-y-3>*+* {
    margin-top: 0.75rem;
}

.ac-space-y-5>*+* {
    margin-top: 1.25rem;
}

.ac-space-y-6>*+* {
    margin-top: 1.5rem;
}

/* ── Shadows ─────────────────────────────────────────── */
.ac-shadow-xl {
    box-shadow: var(--shadow-lg);
}

.ac-shadow-2xl {
    box-shadow: var(--shadow-lg);
}

/* ── Background helpers ──────────────────────────────── */
.ac-surface,
.ac-bg-white {
    background: var(--surface);
}

.ac-bg-slate-50,
.ac-bg-slate-100 {
    background: #f8fafc;
}

.ac-scroll-smooth {
    scroll-behavior: smooth;
}

/* ── Max widths ──────────────────────────────────────── */
.ac-max-w-md {
    max-width: 480px;
}

.ac-max-w-lg {
    max-width: 600px;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.ac-rounded-3xl {
    border-radius: var(--r-xl);
}

/* ── Hero (logged-in dashboard hero) ─────────────────── */
.ac-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(140deg, #eff6ff 0%, #e0f2fe 45%, #f0fdf4 100%);
    border: 1px solid rgba(37, 99, 235, 0.1);
    border-radius: var(--r-xl);
    padding: 3rem 2.5rem;
}

.ac-hero::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.ac-hero__title {
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 900;
    letter-spacing: -0.045em;
    line-height: 1.06;
    color: var(--navy);
    margin-bottom: 1rem;
}

.ac-hero__subtitle {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 520px;
    line-height: 1.75;
    margin-bottom: 2rem;
}

/* ── Icon Buttons ────────────────────────────────────── */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: var(--r-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
}

.icon-btn svg {
    width: 15px;
    height: 15px;
    stroke-width: 2;
}

.icon-btn:hover {
    background: var(--bg);
    color: var(--text);
    transform: translateY(-1px);
}

.icon-btn-danger {
    color: var(--danger);
}

.icon-btn-danger:hover {
    background: var(--danger-light);
    color: var(--danger);
}

/* ── Tabs ────────────────────────────────────────────── */
.tabs-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs-nav::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 0.55rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-count {
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--border);
    color: var(--text-muted);
    border-radius: var(--r-full);
    padding: 0.1rem 0.45rem;
    line-height: 1.4;
}

.tab-btn.active .tab-count {
    background: var(--primary-light);
    color: var(--primary);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ── Answer card correct ─────────────────────────────── */
.answer-correct {
    border-left: 4px solid var(--success) !important;
    background: var(--success-light) !important;
}

/* ── Notification badge ──────────────────────────────── */
.btn-with-badge {
    position: relative;
    display: inline-flex;
}

.notification-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: var(--r-full);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid var(--surface);
    pointer-events: none;
}

/* ── Topic Grid / Cards ──────────────────────────────── */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1.25rem;
}

.topic-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 210px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.topic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.topic-card-student::before {
    background: linear-gradient(90deg, var(--primary), var(--cyan));
}

.topic-card-teacher::before {
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
}

.topic-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.topic-card-header {
    margin-bottom: 0.75rem;
}

.topic-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.topic-card-subtitle {
    margin-top: 0.4rem;
    font-size: 0.845rem;
    color: var(--text-muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}

.topic-card-body {
    flex: 1;
}

.topic-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Status chips */
.ac-text-muted-activo {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    color: #065f46;
    background: #d1fae5;
    border-radius: var(--r-full);
    padding: 0.2rem 0.65rem;
    letter-spacing: 0.02em;
}

.ac-text-muted-programado {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    color: #6b7280;
    background: #f3f4f6;
    /* border: 1px solid var(--border); border-radius: var(--r-full);*/
    padding: 0.2rem 0.65rem;
    letter-spacing: 0.02em;
}

/* ── Subject view ────────────────────────────────────── */
.subject-header {
    padding-bottom: 1.0rem;
    margin-bottom: 1.0rem;
    /*border-bottom: 2px solid var(--border);*/
}

.subject-title {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 900;
    letter-spacing: -0.045em;
    color: var(--text);
    line-height: 1.1;
}

.subject-subtitle {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 1rem;
}

/* ── Markdown ────────────────────────────────────────── */
.markdown-content {
    font-size: 0.975rem;
    line-height: 1.85;
    color: var(--text);
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-top: 1.5rem;
    margin-bottom: 0.65rem;
}

.markdown-content h2 {
    font-size: 1.35rem;
}

.markdown-content h3 {
    font-size: 1.1rem;
}

.markdown-content p {
    margin-bottom: 0.85rem;
}

.markdown-content ul,
.markdown-content ol {
    margin: 0.75rem 0 0.75rem 1.25rem;
    padding-left: 1rem;
}

.markdown-content ul {
    list-style-type: disc;
}

.markdown-content ol {
    list-style-type: decimal;
}

.markdown-content ul ul {
    list-style-type: circle;
    margin: 0.3rem 0 0.3rem 1rem;
}

.markdown-content ol ol {
    list-style-type: lower-alpha;
    margin: 0.3rem 0 0.3rem 1rem;
}

.markdown-content li {
    margin-bottom: 0.3rem;
}

.markdown-content code {
    background: #f1f5f9;
    border-radius: 4px;
    padding: 0.15em 0.4em;
    font-size: 0.875em;
    color: #be185d;
}

.markdown-content pre {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: var(--r);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.markdown-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.markdown-slider {
    position: relative;
}

.slide-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.slide-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    transition: all 0.15s;
}

.slide-button:hover:not(:disabled) {
    background: var(--primary-light);
    border-color: rgba(37, 99, 235, 0.3);
    color: var(--primary);
}

.slide-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.slide-counter {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    min-width: 4rem;
    text-align: center;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.markdown-slide {
    animation: fade-in 0.2s ease;
}

/* ── Progress bar ────────────────────────────────────── */
.progress-bar-wrapper {
    height: 6px;
    background: var(--border);
    border-radius: var(--r-full);
    overflow: hidden;
}

.progress-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--cyan));
    border-radius: var(--r-full);
    transition: width 0.5s ease;
}

/* ── Test form ───────────────────────────────────────── */
.test-header-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.test-header-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.test-header-info strong {
    color: var(--text);
}

.test-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.75rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.test-question-number {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 0.65rem;
}

.test-question-text {
    font-size: 1.025rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.55;
    margin-bottom: 1.25rem;
}

.test-answers {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.test-answer-label {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.925rem;
    line-height: 1.5;
    color: var(--text);
}

.test-answer-label:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.test-answer-label:has(input[type="radio"]:checked) {
    border-color: var(--primary);
    background: #dbeafe;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    font-weight: 600;
}

.test-answer-label input[type="radio"] {
    accent-color: var(--primary);
    flex-shrink: 0;
    margin-top: 0.2rem;
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

/* ── Result page ─────────────────────────────────────── */
.result-score-card {
    text-align: center;
    padding: 2.5rem 2rem;
    border-radius: var(--r-xl);
    margin-bottom: 1.75rem;
}

.result-score-card--pass {
    background: linear-gradient(140deg, #d1fae5, #ecfdf5);
    border: 1px solid #6ee7b7;
}

.result-score-card--fail {
    background: linear-gradient(140deg, #fee2e2, #fff1f2);
    border: 1px solid #fca5a5;
}

.result-score-number {
    font-size: 5rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.result-score-card--pass .result-score-number {
    color: #059669;
}

.result-score-card--fail .result-score-number {
    color: #dc2626;
}

.result-status {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.result-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.result-meta span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.result-answer-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: var(--r-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 0.75rem;
}

.result-answer-card--correct {
    border-left-color: var(--success);
}

.result-answer-card--wrong {
    border-left-color: var(--danger);
}

.result-answer-text {
    padding: 0.65rem 0.9rem;
    border-radius: var(--r-sm);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

.result-answer-text--correct {
    background: #d1fae5;
    color: #065f46;
}

.result-answer-text--wrong {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Tables ──────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: #f8fafc;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 900px) {

    .ac-grid--3,
    .ac-grid--4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {

    .ac-grid--2,
    .ac-grid--3,
    .ac-grid--4 {
        grid-template-columns: 1fr;
    }

    .ac-hero {
        padding: 2rem 1.25rem;
    }

    .ac-hero .ac-grid--2 {
        grid-template-columns: 1fr;
    }

    .ac-hero__title {
        font-size: 1.85rem;
    }

    .topic-grid {
        grid-template-columns: 1fr;
    }

    .ac-flex--space-between {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .landing-brand {
        font-size: 3rem;
    }
}

/* ── Legacy compatibility ────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--r);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    color: #fff;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: #f8fafc;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: var(--r-full);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-info {
    background: var(--info-light);
    color: var(--primary);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.card-text {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.875rem;
}