/* ═══════════════════════════════════════════════
   Aulum Design System v2.0
   UX-first para instructores y alumnos
   ═══════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap');

:root {
    /* Modern Premium Palette */
    --ink: #0f172a;
    /* Slate 900 */
    --ink-light: #334155;
    /* Slate 700 */
    --ink-muted: #64748b;
    /* Slate 500 */

    --surface: #f8fafc;
    /* Slate 50 */
    --surface-raised: #ffffff;
    --surface-sunken: #f1f5f9;
    /* Slate 100 */

    --border: #e2e8f0;
    /* Slate 200 */
    --border-strong: #cbd5e1;
    /* Slate 300 */

    --accent: #6366f1;
    /* Indigo 500 */
    --accent-hover: #4f46e5;
    /* Indigo 600 */
    --accent-subtle: #eef2ff;
    /* Indigo 50 */
    --accent-text: #4338ca;
    /* Indigo 700 */

    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-text: #047857;

    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-text: #92400e;

    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-text: #b91c1c;

    --info: #0ea5e9;
    --info-bg: #f0f9ff;

    /* Typography */
    --font-body: 'Inter', 'DM Sans', system-ui, sans-serif;
    --font-display: 'Fraunces', Georgia, serif;

    /* Spacing System */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-8: 32px;
    --sp-10: 40px;
    --sp-12: 48px;
    --sp-16: 64px;

    /* Layout */
    --sidebar-w: 280px;
    --topbar-h: 64px;

    /* Effects */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-focus: 0 0 0 4px rgba(99, 102, 241, 0.2);

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 200ms;
}

/* Glassmorphism Classes */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-dark {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animation Classes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.animate-fade-in {
    animation: fadeInUp 0.4s var(--ease) forwards;
}

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

html {
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-body);
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--surface);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--duration) var(--ease);
}

a:hover {
    color: var(--accent-hover);
}

::selection {
    background: var(--accent);
    color: #fff;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    color: var(--ink);
    line-height: 1.25;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.35rem;
    font-weight: 600;
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

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

.text-sm {
    font-size: 0.85rem;
}

/* ── Layout Components ── */
.layout-app {
    display: flex;
    min-height: 100vh;
    background: var(--surface);
}

.sidebar {
    width: var(--sidebar-w);
    background: var(--ink);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s var(--ease);
    overflow: hidden;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
}

.sidebar-header {
    padding: var(--sp-6) var(--sp-5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}

.sidebar-logo {
    max-height: 40px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-4) var(--sp-3);
    scrollbar-width: none;
}

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

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all var(--duration) var(--ease);
    text-decoration: none;
    position: relative;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active .nav-link {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-icon {
    font-family: "Material Symbols Outlined", "Inter", sans-serif;
    font-size: 1.25rem;
    opacity: 0.8;
    width: 24px;
    text-align: center;
}

.nav-arrow {
    margin-left: auto;
    font-size: 0.8rem;
    opacity: 0.4;
    transition: transform 0.2s;
}

.nav-item.active .nav-arrow {
    transform: rotate(90deg);
    opacity: 0.8;
}

.nav-children {
    padding: 4px 12px 8px 46px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-child-link {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.4);
    padding: 6px 0;
    border-radius: 4px;
    transition: color 0.2s;
    text-decoration: none;
}

.nav-child-link:hover {
    color: #fff;
}

.sidebar-footer {
    padding: var(--sp-4) var(--sp-5);
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.btn-logout {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
}

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

.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    position: relative;
}

.topbar {
    height: var(--topbar-h);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-8);
    position: sticky;
    top: 0;
    z-index: 90;
}

.sidebar-toggle {
    display: none;
    background: var(--surface-sunken);
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    color: var(--ink);
    border-radius: 10px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}

.notifications-bell {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: var(--ink-muted);
    transition: all 0.2s;
}

.notifications-bell:hover {
    background: var(--surface-sunken);
    color: var(--ink);
}

.notifications-bell .icon {
    font-size: 1.4rem;
}

.badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 2px solid #fff;
}

.divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px 6px 6px;
    border-radius: 14px;
    transition: background 0.2s;
    color: var(--ink);
    text-decoration: none;
}

.topbar-user:hover {
    background: var(--surface-sunken);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent-subtle);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-meta {
    display: flex;
    flex-direction: column;
}

.user-meta .name {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
}

.user-meta .role {
    font-size: 0.75rem;
    color: var(--ink-muted);
}

.page-content {
    padding: var(--sp-8) var(--sp-10);
    max-width: 1400px;
    margin: 0 auto;
}

/* ── UI Components ── */
.flash-container {
    padding: 16px 40px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.alert {
    padding: 14px 20px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    font-weight: 500;
}

.alert-icon {
    font-size: 1.2rem;
}

.alert-content {
    flex: 1;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: rgba(16, 185, 129, 0.2);
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: rgba(239, 68, 68, 0.2);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info);
    border-color: rgba(14, 165, 233, 0.2);
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    color: currentColor;
}

.alert-close:hover {
    opacity: 1;
}

.card {
    background: var(--surface-raised);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: all 0.3s var(--ease);
    overflow: hidden;
}

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

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink);
}

.card-body {
    padding: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    border: 1px solid transparent;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: #fff;
    border-color: var(--border-strong);
    color: var(--ink-light);
}

.btn-secondary:hover {
    background: var(--surface-sunken);
}

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

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

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: 10px;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-light);
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--ink);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--shadow-focus);
    background: #fff;
}

.form-input::placeholder {
    color: var(--ink-muted);
    opacity: 0.5;
}

/* ── Tables ── */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    background: var(--surface-sunken);
    padding: 14px 20px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-muted);
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
    vertical-align: middle;
}

.table tr:hover td {
    background: var(--accent-subtle);
}

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

/* ── Stats ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-muted);
    margin-top: 4px;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
    opacity: 0.3;
}

.stat-card:nth-child(2)::before {
    background: var(--success);
}

.stat-card:nth-child(3)::before {
    background: var(--warning);
}

.stat-card:nth-child(4)::before {
    background: var(--info);
}

/* ── Progress ── */
.progress {
    background: var(--surface-sunken);
    border-radius: 99px;
    height: 8px;
    overflow: hidden;
}

.progress-sm {
    height: 5px;
}

.progress-bar {
    height: 100%;
    border-radius: 99px;
    background: var(--accent);
    transition: width 600ms var(--ease);
}

.progress-bar.success {
    background: var(--success);
}

/* ── Badges ── */
.badge-pill {
    display: inline-flex;
    padding: 2px 10px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-active,
.badge-published {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-draft,
.badge-pending {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.badge-inactive,
.badge-archived {
    background: var(--surface-sunken);
    color: var(--ink-muted);
}

.badge-suspended {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.badge-admin {
    background: var(--accent-subtle);
    color: var(--accent-text);
}

.badge-instructor {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-student {
    background: var(--surface-sunken);
    color: var(--ink-muted);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.active {
    background: var(--success);
    box-shadow: 0 0 0 3px var(--success-bg);
}

.status-dot.inactive {
    background: var(--border-strong);
}

/* ── Pagination ── */
.pagination {
    display: flex;
    gap: var(--sp-1);
    justify-content: center;
    margin-top: var(--sp-5);
}

.pagination a,
.pagination span {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border);
    color: var(--ink-light);
    transition: all var(--duration);
}

.pagination a:hover {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

.pagination .active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: var(--sp-16) var(--sp-8);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--sp-4);
    opacity: 0.3;
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink-light);
    margin-bottom: var(--sp-2);
}

.empty-state-text {
    color: var(--ink-muted);
    font-size: 0.9rem;
    margin-bottom: var(--sp-5);
    max-width: 360px;
    margin-inline: auto;
}

/* ── Course Cards ── */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--sp-5);
}

.course-card {
    transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}

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

.course-thumb {
    height: 140px;
    background: linear-gradient(135deg, var(--accent) 0%, #7209b7 100%);
    position: relative;
    overflow: hidden;
}

.course-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.course-badge {
    position: absolute;
    top: var(--sp-3);
    right: var(--sp-3);
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
}

.course-badge.published {
    background: rgba(6, 214, 160, 0.9);
    color: #fff;
}

.course-badge.draft {
    background: rgba(252, 163, 17, 0.9);
    color: #fff;
}

/* ── Wizard Steps ── */
.wizard-steps {
    display: flex;
    gap: var(--sp-2);
    margin-bottom: var(--sp-8);
    counter-reset: step;
}

.wizard-step {
    flex: 1;
    text-align: center;
    position: relative;
    padding: var(--sp-3) var(--sp-2);
}

.wizard-step::before {
    counter-increment: step;
    content: counter(step);
    display: flex;
    width: 32px;
    height: 32px;
    margin: 0 auto var(--sp-2);
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--surface-sunken);
    color: var(--ink-muted);
    border: 2px solid var(--border);
}

.wizard-step.active::before {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.wizard-step.done::before {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
    content: '✓';
}

.wizard-step-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-muted);
}

.wizard-step.active .wizard-step-label {
    color: var(--accent);
}

/* ── Content Builder ── */
.content-module {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--sp-4);
    background: var(--surface-raised);
    overflow: hidden;
}

.content-module-header {
    padding: var(--sp-3) var(--sp-5);
    background: var(--surface-sunken);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.content-module-title {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.drag-handle {
    color: var(--ink-muted);
    cursor: grab;
    opacity: 0.4;
}

.lesson-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-5);
    border-bottom: 1px solid var(--border);
    transition: background var(--duration);
}

.lesson-item:last-child {
    border-bottom: none;
}

.lesson-item:hover {
    background: rgba(67, 97, 238, 0.02);
}

.lesson-icon {
    font-size: 1.2rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.lesson-info {
    flex: 1;
}

.lesson-title {
    font-weight: 500;
    font-size: 0.9rem;
}

.lesson-meta {
    font-size: 0.78rem;
    color: var(--ink-muted);
    display: flex;
    gap: var(--sp-3);
    margin-top: 1px;
}

.lesson-actions {
    display: flex;
    gap: var(--sp-1);
    opacity: 0;
    transition: opacity var(--duration);
}

.lesson-item:hover .lesson-actions {
    opacity: 1;
}

/* ── Type Picker ── */
.type-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: var(--sp-3);
}

.type-option {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: var(--sp-4) var(--sp-3);
    text-align: center;
    cursor: pointer;
    transition: all var(--duration);
}

.type-option:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.type-option.selected {
    border-color: var(--accent);
    background: var(--accent-subtle);
    box-shadow: var(--shadow-focus);
}

.type-option-icon {
    font-size: 1.8rem;
    margin-bottom: var(--sp-2);
}

.type-option-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-light);
}

/* ── Question Builder ── */
.option-row {
    display: flex;
    gap: var(--sp-2);
    align-items: center;
    margin-bottom: var(--sp-2);
}

.option-row input[type="text"] {
    flex: 1;
}

.correct-toggle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all var(--duration);
}

.correct-toggle.active {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

/* ── Classroom ── */
.classroom-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--sp-5);
}

.classroom-sidebar {
    position: sticky;
    top: calc(var(--topbar-h) + var(--sp-4));
    align-self: start;
    max-height: calc(100vh - var(--topbar-h) - 40px);
    overflow-y: auto;
}

.classroom-lesson-link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    transition: all var(--duration);
    text-decoration: none;
    color: var(--ink-light);
}

.classroom-lesson-link:hover {
    background: var(--accent-subtle);
    text-decoration: none;
}

.classroom-lesson-link.completed {
    color: var(--success-text);
}

.classroom-lesson-link.current {
    background: var(--accent-subtle);
    color: var(--accent);
    font-weight: 600;
}

.classroom-lesson-link.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.lesson-status-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.lesson-status-icon.completed {
    background: var(--success-bg);
    color: var(--success-text);
}

.lesson-status-icon.in-progress {
    background: var(--accent-subtle);
    color: var(--accent);
}

.lesson-status-icon.not-started {
    background: var(--surface-sunken);
    color: var(--ink-muted);
    border: 1.5px solid var(--border);
}

/* ── Exam ── */
.exam-question-card {
    background: var(--surface-raised);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: var(--sp-6);
    margin-bottom: var(--sp-5);
    border: 1px solid var(--border);
}

.exam-option {
    padding: var(--sp-3) var(--sp-4);
    margin: var(--sp-2) 0;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--duration);
    font-size: 0.95rem;
}

.exam-option:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.exam-option.selected {
    border-color: var(--accent);
    background: var(--accent-subtle);
    box-shadow: var(--shadow-focus);
}

/* ── Backoffice badge ── */
.backoffice-badge {
    background: var(--warning);
    color: #000;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: var(--sp-2);
    font-family: var(--font-body);
}

/* ── Auth pages ── */
.layout-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--ink) 0%, #2a2a4a 100%);
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: var(--sp-5);
}

.auth-card {
    background: var(--surface-raised);
    border-radius: var(--radius-lg);
    padding: var(--sp-10) var(--sp-8);
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: var(--sp-8);
}

.auth-logo {
    max-height: 60px;
    margin-bottom: var(--sp-3);
}

.auth-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--ink);
}

.auth-subtitle {
    font-size: 1rem;
    color: var(--ink-muted);
    margin-bottom: var(--sp-6);
    text-align: center;
}

.auth-links {
    text-align: center;
    margin-top: var(--sp-4);
}

.auth-links a {
    font-size: 0.85rem;
    color: var(--ink-muted);
}

.auth-footer {
    text-align: center;
    margin-top: var(--sp-6);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .form-grid-3 {
        grid-template-columns: 1fr 1fr;
    }

    .classroom-layout {
        grid-template-columns: 240px 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .page-content {
        padding: var(--sp-5);
    }

    .page-header {
        flex-direction: column;
    }

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

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

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

    .classroom-layout {
        grid-template-columns: 1fr;
    }

    .classroom-sidebar {
        position: static;
        max-height: none;
    }
}