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

/* Restore viewport centering stripped by the reset above */
dialog:modal {
    position: fixed;
    inset: 0;
    width: fit-content;
    height: fit-content;
    max-height: calc(100vh - 2rem);
    margin: auto;
    overflow: auto;
}

:root {
    --primary: #0f6cbf;
    --primary-dark: #095ba8;
    --primary-light: #e7f0fa;
    --accent-l: #e7f0fa;
    --accent-l2: #d4e8f8;
    --success: #357a32;
    --warning: #a6670e;
    --danger: #ca3120;
    --info: #08799c;
    --bg: #f0f2f5;
    --surface: #ffffff;
    --surface-2: #f8faff;
    --text: #1d2125;
    --ink-2: #3a4f72;
    --text-muted: #6a737b;
    --border: #e2e6ea;
    --navbar-bg: #ffffff;
    --drawer-bg: #ffffff;
    --drawer-active: #eef5fc;
    --course-card-border: #e2e6ea;
    --radius: 0.625rem;
    --radius-lg: 0.875rem;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
    --navbar-height: 60px;
    --topbar-h: 60px;
    --drawer-width: 221px;
    --sidebar-w: 221px;
    --primary-color: var(--primary);
    --success-color: var(--success);
    --surface-color: var(--surface);
    --surface-muted: var(--surface-2);
    --text-color: var(--text);
    --border-color: var(--border);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    font-size: 0.9375rem;
    overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

.container { max-width: 1140px; margin: 0 auto; padding: 0 1.25rem; }

/* ===== Moodle App Shell ===== */
.moodle-body { min-height: 100vh; background: var(--bg); }
.moodle-app { min-height: 100vh; display: flex; flex-direction: column; }

.moodle-navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    height: var(--navbar-height);
    background: var(--navbar-bg);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0 1.25rem;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}
.drawer-toggle {
    background: none; border: none; font-size: 1.25rem;
    color: var(--text); cursor: pointer; padding: 0.5rem;
    border-radius: var(--radius);
}
.drawer-toggle:hover { background: var(--bg); }
.navbar-brand {
    display: flex; align-items: center; gap: 0.5rem;
    text-decoration: none !important;
}
.navbar-brand:hover { opacity: 0.9; }
.navbar-brand-name {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1;
}
.navbar-school {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    max-width: min(280px, 34vw);
    padding: 0.2rem 0.65rem 0.2rem 0.2rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--surface-2) 0%, #fff 100%);
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    text-decoration: none !important;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.navbar-school:hover {
    border-color: rgba(15, 108, 191, 0.28);
    box-shadow: var(--shadow);
    text-decoration: none !important;
}
.navbar-school--brand {
    max-width: min(340px, 52vw);
    flex-shrink: 1;
}
.navbar-school__avatar {
    width: 1.85rem !important;
    height: 1.85rem !important;
    margin-left: 0 !important;
    border-radius: 50%;
    border: 2px solid #fff !important;
    font-size: 0.6875rem !important;
    font-weight: 800 !important;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    line-height: 1;
}
.navbar-school__avatar.school-avatar--image {
    padding: 0.12rem;
    background: #fff;
}
.navbar-school__avatar .school-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.navbar-school__meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
}
.navbar-school__label {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.navbar-school__name {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--ink-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.navbar-spacer { flex: 1; }

.user-menu { position: relative; }
.user-menu-btn {
    display: flex; align-items: center; gap: 0.5rem;
    background: none; border: 1px solid var(--border);
    border-radius: 2rem; padding: 0.25rem 0.75rem 0.25rem 0.25rem;
    cursor: pointer; font-family: inherit; font-size: 0.875rem;
}
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700;
    flex-shrink: 0;
}
.user-avatar.user-avatar--image,
.table-avatar.user-avatar--image,
.user-profile-avatar.user-avatar--image,
.dashboard-welcome-avatar.user-avatar--image {
    padding: 0;
    overflow: hidden;
    background: var(--surface);
}
.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.user-name { display: none; }
@media (min-width: 576px) { .user-name { display: inline; } }
.user-dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 0.5rem);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 0.5rem 1rem rgba(0,0,0,.12);
    min-width: 200px; width: max-content; max-width: min(280px, calc(100vw - 1.5rem)); z-index: 1001; overflow: hidden;
}
.user-dropdown.open { display: block; }
.user-dropdown-header { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
.user-dropdown-header small { color: var(--text-muted); display: block; }
.user-dropdown a {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.65rem 1rem; color: var(--text); text-decoration: none;
}
.user-dropdown a:hover { background: var(--bg); text-decoration: none; }
.ai-token-meter {
    --ai-token-accent: var(--primary);
    --ai-token-soft: var(--primary-light);
    color: var(--text);
}
.ai-token-meter--dropdown {
    width: 270px;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.ai-token-meter__compact-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.75rem;
}
.ai-token-meter__compact-row span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
}
.ai-token-meter__compact-row i { color: var(--ai-token-accent); }
.ai-token-meter__compact-row strong { font-size: 0.75rem; }
.ai-token-meter--dropdown .ai-token-meter__track { margin-top: 0.4rem; }
.ai-token-meter--dropdown > small {
    display: block;
    margin-top: 0.3rem;
    color: var(--text-muted);
    font-size: 0.62rem;
    text-align: right;
}
.ai-token-meter__head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.ai-token-meter__icon {
    width: auto;
    height: auto;
    flex-shrink: 0;
    color: var(--ai-token-accent);
    font-size: 0.8rem;
}
.ai-token-meter__head > div {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
}
.ai-token-meter__head strong {
    font-size: 0.8rem;
    line-height: 1.2;
}
.ai-token-meter__head small {
    color: var(--text-muted);
    font-size: 0.68rem;
}
.ai-token-meter__percent {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 800;
}
.ai-token-meter__numbers {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.65rem;
    color: var(--text-muted);
    font-size: 0.68rem;
}
.ai-token-meter__numbers strong {
    color: var(--text);
    font-size: 0.78rem;
}
.ai-token-meter__track {
    height: 0.3rem;
    margin-top: 0.45rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--border);
}
.ai-token-meter__track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--ai-token-accent);
    transition: width 0.3s ease;
}
.ai-token-meter__note {
    margin: 0.45rem 0 0;
    color: var(--text-muted);
    font-size: 0.65rem;
}
.ai-token-meter__note i {
    margin-right: 0.2rem;
    color: var(--ai-token-accent);
}

.moodle-layout {
    display: flex; margin-top: var(--navbar-height); min-height: calc(100vh - var(--navbar-height));
}
.moodle-drawer {
    width: var(--drawer-width); background: var(--drawer-bg);
    border-right: 1px solid var(--border);
    position: fixed; top: var(--navbar-height); left: 0; bottom: 0;
    overflow-y: auto; z-index: 900;
    transform: translateX(-100%); transition: transform 0.2s ease;
    box-shadow: 2px 0 12px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
}
.drawer-brand {
    padding: 1.25rem 1.25rem 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}
.drawer-brand-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.moodle-drawer.open { transform: translateX(0); }
@media (min-width: 992px) {
    .moodle-drawer { transform: translateX(0); position: sticky; top: var(--navbar-height); height: calc(100vh - var(--navbar-height)); }
    .drawer-toggle { display: none; }
}
.drawer-overlay {
    display: none; position: fixed; inset: 0; top: var(--navbar-height);
    background: rgba(0,0,0,.4); z-index: 850;
}
.drawer-overlay.open { display: block; }
@media (min-width: 992px) { .drawer-overlay { display: none !important; } }

.drawer-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0.5rem 0.75rem 1rem;
}
.drawer-nav-bottom {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.drawer-link {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.65rem 0.85rem; color: var(--text);
    text-decoration: none; font-weight: 500; font-size: 0.9375rem;
    border-radius: var(--radius);
    margin-bottom: 0.15rem;
    border-left: none;
}
.drawer-link i { width: 1.25rem; text-align: center; color: var(--text-muted); font-size: 0.9375rem; }
.drawer-link:hover { background: var(--primary-light); text-decoration: none; color: var(--primary); }
.drawer-link:hover i { color: var(--primary); }
.drawer-link.active {
    background: var(--drawer-active); color: var(--primary);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--primary);
}
.drawer-link.active i { color: var(--primary); }
.drawer-section-label {
    display: block;
    padding: 1rem 0.85rem 0.35rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.drawer-section-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 1rem 0.85rem 0.35rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
}
.drawer-section-toggle:hover {
    color: var(--text);
}
.drawer-section-chevron {
    margin-left: auto;
    font-size: 0.6rem;
    transition: transform 0.2s ease;
}
.drawer-section-toggle[aria-expanded="false"] .drawer-section-chevron {
    transform: rotate(-90deg);
}
.drawer-section-links {
    overflow: hidden;
    max-height: 500px;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    opacity: 1;
}
.drawer-section-links.collapsed {
    max-height: 0;
    opacity: 0;
}
.drawer-link-badge {
    margin-left: auto;
    padding: 0.1rem 0.45rem;
    background: var(--warning);
    color: #fff;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.3;
}

.drawer-link-tag {
    margin-left: auto;
    padding: 0.1rem 0.45rem;
    background: var(--surface-2, #e2e8f0);
    color: var(--text-muted, #64748b);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.moodle-main {
    flex: 1; min-width: 0;
    padding: 1.5rem 1.75rem 2rem;
}
@media (min-width: 992px) {
    .moodle-main { margin-left: 0; max-width: calc(100% - var(--drawer-width)); }
}
@media (max-width: 576px) {
    .moodle-navbar {
        gap: 0.4rem;
        padding: 0 0.65rem;
    }
    .navbar-school {
        gap: 0.4rem;
        padding: 0.15rem 0.55rem 0.15rem 0.15rem;
        max-width: min(200px, 48vw);
    }
    .navbar-school--brand {
        max-width: min(200px, 48vw);
    }
    .navbar-school__avatar {
        width: 2rem !important;
        height: 2rem !important;
    }
    .navbar-school__label {
        display: none;
    }
    .navbar-school__name {
        font-size: 0.75rem;
    }
    .user-menu-btn {
        padding: 0.2rem;
        border-radius: 50%;
    }
    .user-menu-btn .fa-chevron-down {
        display: none;
    }
}
@media (max-width: 480px) {
    .moodle-main { padding: 0.75rem 0.75rem 1.5rem; }
    .page-header h1 { font-size: 1.35rem; }
    .admin-page-header { padding: 0.85rem 0.9rem; }
}

.breadcrumbs {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem;
    font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 0.75rem;
}
.breadcrumb-sep { font-size: 0.625rem; color: var(--border); }
.breadcrumb-current { color: var(--text); font-weight: 500; }

.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.625rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; line-height: 1.2; margin: 0; }
.admin-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem 2rem;
    flex-wrap: wrap;
    padding: 1.15rem 1.35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    margin-bottom: 1.5rem;
}
.admin-page-header__main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex: 1;
    min-width: min(100%, 280px);
}
.admin-page-header__icon {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, rgba(15, 108, 191, 0.12) 0%, rgba(15, 108, 191, 0.06) 100%);
    color: var(--primary);
    font-size: 1.15rem;
}
.admin-page-header__copy { min-width: 0; }
.admin-page-header__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex-shrink: 0;
}
.admin-page-header__actions .btn {
    white-space: nowrap;
}
.navbar-clock {
    position: absolute;
    left: 50%;
    top: 50%;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.7rem;
    transform: translate(-50%, -50%);
    border: 1px solid #e1e7ed;
    border-radius: 0.7rem;
    background: #f7f9fb;
    color: #536779;
    white-space: nowrap;
}
.navbar-clock > i {
    color: var(--primary);
    font-size: 0.85rem;
}
.navbar-clock__copy {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}
.navbar-clock__copy strong {
    color: #25394b;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}
.navbar-clock__copy span {
    color: var(--text-muted);
    font-size: 0.65rem;
}
@media (max-width: 900px) {
    .navbar-term-chip {
        display: none !important;
    }
    .navbar-clock {
        position: static;
        left: auto;
        top: auto;
        transform: none;
        display: inline-flex;
        flex-shrink: 0;
        align-items: center;
        gap: 0.3rem;
        padding: 0.3rem 0.65rem;
        border-radius: 999px;
        border: 1px solid rgba(15, 108, 191, 0.15);
        background: var(--primary-light);
        color: var(--primary-dark);
    }
    .navbar-clock > i {
        font-size: 0.7rem;
        color: var(--primary-dark);
        opacity: 0.85;
    }
    .navbar-clock__copy {
        gap: 0;
    }
    .navbar-clock__copy strong {
        font-size: 0.72rem;
        font-weight: 700;
        color: var(--primary-dark);
        letter-spacing: -0.01em;
    }
    .navbar-clock__copy span {
        display: none;
    }
}
.page-subtitle {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 42rem;
    line-height: 1.45;
}

.page-content { max-width: 1120px; }
.page-content--wide { max-width: none; width: 100%; min-width: 0; }

/* Toasts */
.toast-container { margin-bottom: 1rem; }
.toast {
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.75rem 1rem; border-radius: var(--radius);
    margin-bottom: 0.5rem; animation: slideIn 0.3s ease;
    border: 1px solid transparent;
}
.toast.fade-out { opacity: 0; transition: opacity 0.4s; }
.toast-success { background: #d4edda; border-color: #c3e6cb; color: #155724; }
.toast-error { background: #f8d7da; border-color: #f5c6cb; color: #721c24; }
.toast-info { background: #d1ecf1; border-color: #bee5eb; color: #0c5460; }
.toast-close { background: none; border: none; font-size: 1.25rem; cursor: pointer; margin-left: auto; opacity: 0.6; }
@keyframes slideIn { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Course cards (Moodle-style) */
.course-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.15rem;
}
.course-toolbar__search {
    position: relative;
    flex: 1 1 14rem;
    min-width: 12rem;
    max-width: 26rem;
}
.course-toolbar__search > .fa-magnifying-glass {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8125rem;
    pointer-events: none;
}
.course-toolbar__search-input {
    width: 100%;
    padding: 0.65rem 0.9rem 0.65rem 2.25rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.875rem;
    color: var(--text);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.course-toolbar__search-input:focus {
    outline: none;
    border-color: rgba(15, 108, 191, 0.4);
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.12);
}
.course-toolbar__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.course-toolbar__select {
    min-width: 9.5rem;
    max-width: 14rem;
    padding: 0.55rem 2rem 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.8125rem;
    color: var(--text);
    cursor: pointer;
}
.course-toolbar__select:focus {
    outline: none;
    border-color: rgba(15, 108, 191, 0.4);
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.12);
}
.course-toolbar__count {
    margin: 0 0 0 auto;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.course-search-empty {
    margin-top: 0.5rem;
}
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem; margin-bottom: 1.5rem;
}
.course-card {
    background: var(--surface); border: 1px solid var(--course-card-border);
    border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow); transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.course-card:hover { box-shadow: 0 0.35rem 1rem rgba(0,0,0,.12); }
.course-card-clickable {
    display: block;
    text-decoration: none !important;
    color: inherit;
    cursor: pointer;
}
.course-card-clickable:hover { text-decoration: none !important; color: inherit; }
.lms-course-card.course-card-clickable:hover {
    transform: translateY(-3px) scale(1.01);
}
.course-card-footer {
    padding: 0.75rem 1.25rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
}
.course-open-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.course-card-clickable:hover .course-open-link { color: var(--primary-dark); }

/* ===== Gradebook & grading ===== */
.grading-overview { margin-bottom: 1rem; }
.grading-overview__pending { display: flex; align-items: center; gap: 0.5rem; color: #856404; font-size: 0.9375rem; }
.grading-card-stats { display: flex; flex-wrap: wrap; gap: 0.5rem 0.85rem; margin-top: 0.65rem; font-size: 0.8125rem; font-weight: 600; color: var(--ink-2); }
.grading-card-stats i { color: var(--primary); margin-right: 0.2rem; }
.grading-card-stats__pending { color: #b45309; }
.empty-state--compact { padding: 1.25rem; text-align: center; }
.course-grade-card-link {
    align-self: center;
    margin-left: 0.5rem;
    white-space: nowrap;
}
@media (max-width: 720px) {
    .course-grade-card-link {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
    }
}

/* Category color tokens */
.gb-weight-bar__seg--quiz, .gb-chip-btn--quiz, .gb-sync-card--quiz, .grading-scheme-row--quiz { --gb-tone: #0f6cbf; --gb-tone-bg: #e8f2fb; }
.gb-weight-bar__seg--exam, .gb-chip-btn--exam, .gb-sync-card--exam, .grading-scheme-row--exam { --gb-tone: #6f42c1; --gb-tone-bg: #f3ebff; }
.gb-weight-bar__seg--assignment, .gb-chip-btn--assignment, .gb-sync-card--assignment, .grading-scheme-row--assignment { --gb-tone: #08799c; --gb-tone-bg: #e0f4fa; }
.gb-weight-bar__seg--participation, .gb-chip-btn--participation, .gb-sync-card--participation, .grading-scheme-row--participation { --gb-tone: #b45309; --gb-tone-bg: #fff8eb; }
.gb-weight-bar__seg--project, .gb-chip-btn--project, .gb-sync-card--project, .grading-scheme-row--project { --gb-tone: #198754; --gb-tone-bg: #eaf7ef; }
.gb-weight-bar__seg--other, .gb-chip-btn--other, .gb-sync-card--other, .grading-scheme-row--other { --gb-tone: #6c757d; --gb-tone-bg: #f1f3f5; }

.gb-weight-bar { margin: 0.75rem 0; }
.gb-weight-bar__track { display: flex; height: 0.55rem; border-radius: 999px; overflow: hidden; background: #e9ecef; }
.gb-weight-bar__seg { display: block; height: 100%; min-width: 2px; background: var(--gb-tone, var(--primary)); }
.gb-weight-bar__legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin: 0.5rem 0 0; padding: 0; list-style: none; font-size: 0.75rem; }
.gb-weight-bar__legend li { display: flex; align-items: center; gap: 0.35rem; }
.gb-weight-bar__legend strong { color: var(--ink); }
.gb-weight-bar__dot { width: 0.55rem; height: 0.55rem; border-radius: 999px; background: var(--gb-tone, var(--primary)); }
.gb-weight-bar--compact .gb-weight-bar__legend { display: none; }
.gb-weight-bar--hero { margin: 0; }
.gb-weight-bar--admin .gb-weight-bar__track { height: 0.75rem; }

/* Teacher class hero */
.gb-class-hero {
    display: flex; flex-wrap: wrap; gap: 1.25rem; justify-content: space-between; align-items: flex-end;
    padding: 1.25rem 1.35rem; margin-bottom: 1.25rem;
    background: linear-gradient(135deg, #f8fbff 0%, #fff 55%);
    border: 1px solid #d4e4f4; border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.gb-class-hero__badge { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--primary); }
.gb-class-hero__title { margin: 0.2rem 0 0.5rem; font-size: 1.45rem; font-weight: 800; }
.gb-class-hero__chips { display: flex; flex-wrap: wrap; gap: 0.5rem 0.85rem; font-size: 0.8125rem; color: var(--text-muted); }
.gb-class-hero__chips i { color: var(--primary); margin-right: 0.2rem; }
.gb-class-hero__pending { color: #b45309; font-weight: 700; }
.gb-class-hero__aside { flex: 1; min-width: 220px; max-width: 360px; }

/* Tabs */
.gb-workspace { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.gb-tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--border); background: var(--bg); padding: 0 0.5rem; }
.gb-tab {
    display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.85rem 1rem;
    border: none; background: transparent; font: inherit; font-size: 0.875rem; font-weight: 600;
    color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.gb-tab:hover { color: var(--primary); }
.gb-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); background: var(--surface); }
.gb-tab__badge { font-size: 0.6875rem; padding: 0.1rem 0.45rem; border-radius: 999px; background: var(--primary); color: #fff; font-weight: 700; }
.gb-tab__badge--warn { background: #f0ad4e; color: #5c3d00; }
.gb-tab-panel { display: none; padding: 1.15rem 1.25rem 1.35rem; }
.gb-tab-panel.is-active { display: block; }
.gb-tab-intro { margin: 0 0 1rem; font-size: 0.875rem; color: var(--text-muted); }

/* Setup / sync */
.gb-setup-alert {
    display: grid; grid-template-columns: auto 1fr auto; gap: 0.85rem; align-items: center;
    padding: 0.85rem 1rem; margin-bottom: 1rem; border-radius: var(--radius);
    background: #fff8eb; border: 1px solid #f0d9a8; color: #7a5200;
}
.gb-setup-alert p { margin: 0.15rem 0 0; font-size: 0.8125rem; }
.gb-setup-alert__meter { width: 4rem; height: 0.45rem; border-radius: 999px; background: #f0d9a8; overflow: hidden; }
.gb-setup-alert__meter span { display: block; height: 100%; background: #b45309; border-radius: 999px; }
.gb-setup-success {
    display: flex; align-items: center; gap: 0.55rem; padding: 0.75rem 1rem; margin-bottom: 1rem;
    border-radius: var(--radius); background: #eaf7ef; border: 1px solid #b8dfc4; color: #0f5132; font-size: 0.875rem;
}
.gb-sync-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.gb-sync-card {
    border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff;
    border-left: 4px solid var(--gb-tone, var(--primary)); overflow: hidden;
}
.gb-sync-card.is-linked { box-shadow: 0 0 0 1px rgba(25, 135, 84, 0.2); }
.gb-sync-card.is-manual { border-left-color: var(--gb-tone, #6c757d); }
.gb-sync-card__head { display: flex; gap: 0.65rem; align-items: flex-start; padding: 0.85rem 0.9rem 0.5rem; }
.gb-sync-card__icon {
    width: 2rem; height: 2rem; border-radius: 0.5rem; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--gb-tone-bg, #e8f2fb); color: var(--gb-tone, var(--primary));
}
.gb-sync-card__title { flex: 1; min-width: 0; }
.gb-sync-card__title strong { display: block; font-size: 0.9375rem; }
.gb-sync-card__title span { font-size: 0.75rem; color: var(--text-muted); }
.gb-sync-card__status { font-size: 0.6875rem; font-weight: 700; padding: 0.15rem 0.45rem; border-radius: 999px; white-space: nowrap; }
.gb-sync-card__status--linked { background: #eaf7ef; color: #0f5132; }
.gb-sync-card__status--pending { background: #fff3cd; color: #856404; }
.gb-sync-card__status--manual { background: #e9ecef; color: #495057; }
.gb-sync-card__body { padding: 0 0.9rem 0.9rem; }
.gb-sync-card__hint { margin: 0.35rem 0 0; font-size: 0.75rem; color: var(--text-muted); }
.gb-sync-form__actions { display: flex; gap: 0.5rem; }

/* Gradebook table */
.gb-table-panel { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: #fff; }
.gb-table-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
    padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--border); background: var(--bg);
}
.gb-table-search { display: flex; align-items: center; gap: 0.45rem; flex: 1; max-width: 280px; }
.gb-table-search i { color: var(--text-muted); }
.gb-table-search input { padding: 0.4rem 0.65rem; font-size: 0.875rem; }
.gb-table-toolbar__count { font-size: 0.8125rem; color: var(--text-muted); font-weight: 600; }
.gb-table-wrap { overflow-x: auto; }
.gb-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; min-width: 720px; }
.gb-table th, .gb-table td { padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.gb-table thead th { background: #f8fafc; position: sticky; top: 0; z-index: 1; }
.gb-table tbody tr:hover { background: rgba(15, 108, 191, 0.03); }
.gb-table__student-col { position: sticky; left: 0; z-index: 2; background: #fff; min-width: 200px; box-shadow: 2px 0 6px rgba(0,0,0,0.04); }
.gb-table thead .gb-table__student-col { z-index: 3; background: #f8fafc; }
.gb-table__student { display: flex; align-items: center; gap: 0.55rem; }
.gb-table__avatar { width: 2rem !important; height: 2rem !important; font-size: 0.75rem !important; }
.gb-table__student strong { display: block; font-size: 0.875rem; }
.gb-table__student span { display: block; font-size: 0.6875rem; color: var(--text-muted); }
.gb-table__comp-col { min-width: 100px; text-align: center; }
.gb-table__comp-head {
    display: inline-flex; flex-direction: column; align-items: center; gap: 0.1rem;
    padding: 0.35rem 0.45rem; border-radius: 0.45rem; font-size: 0.6875rem;
    background: var(--gb-tone-bg, #f8f9fa); color: var(--gb-tone, var(--ink));
}
.gb-table__comp-head i { font-size: 0.85rem; }
.gb-table__comp-name { font-weight: 700; font-size: 0.75rem; color: var(--ink); }
.gb-table__comp-weight { opacity: 0.85; }
.gb-table__comp-warn { color: #b45309; }
.gb-table__cell { text-align: center; }
.gb-table__cell--empty { background: #fafbfc; }
.gb-table__cell--partial { background: #fffdf5; }
.gb-table__cell--full { background: #f4fbf6; }
.gb-table__cell--zero { background: #fff5f5; }
.gb-cell-score__raw { display: block; font-size: 0.6875rem; color: var(--text-muted); }
.gb-cell-score__pct { display: block; font-weight: 800; font-size: 0.875rem; }
.gb-cell-bar { display: block; height: 3px; border-radius: 999px; background: #e9ecef; margin-top: 0.25rem; overflow: hidden; }
.gb-cell-bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.gb-cell-empty { color: var(--text-muted); }
.gb-manual-input { width: 4.25rem; margin: 0 auto; text-align: center; padding: 0.3rem; font-size: 0.875rem; }
.gb-manual-input--override { border-color: #c9a227; background: #fffdf5; box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.15); }
.gb-cell-edit { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.gb-cell-edit--override .gb-manual-input { font-weight: 700; }
.gb-cell-badge {
    display: inline-flex; align-items: center; gap: 0.2rem;
    font-size: 0.625rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
    padding: 0.1rem 0.35rem; border-radius: 999px; white-space: nowrap;
}
.gb-cell-badge--override { background: #fff3cd; color: #856404; border: 1px solid #f0d9a8; }
.gb-cell-badge--pending { background: #e8f2fb; color: #0f6cbf; border: 1px solid #b6d4f0; }
.gb-cell-sync-hint { font-size: 0.6875rem; color: var(--text-muted); line-height: 1.2; }
.gb-table__cell--override { box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.35); }
.gb-table__final-col { text-align: center; min-width: 72px; background: rgba(15, 108, 191, 0.04); }
.gb-final { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 999px; font-weight: 800; font-size: 0.875rem; }
.gb-final--excellent { background: #d4edda; color: #155724; }
.gb-final--good { background: #cce5ff; color: #084298; }
.gb-final--fair { background: #fff3cd; color: #856404; }
.gb-final--low { background: #f8d7da; color: #721c24; }
.gb-final--pending { color: var(--text-muted); font-weight: 600; }
.gb-manual-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }

/* Assignment grid (teacher tab) */
.gb-assignment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0.75rem; }
.gb-assignment-card {
    display: flex; gap: 0.75rem; align-items: center; padding: 0.9rem 1rem;
    border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff;
}
.gb-assignment-card__icon {
    width: 2.5rem; height: 2.5rem; border-radius: 0.65rem; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: #e0f4fa; color: #08799c; font-size: 1rem;
}
.gb-assignment-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.gb-assignment-card__body strong { font-size: 0.9375rem; }
.gb-assignment-card__body span { font-size: 0.75rem; color: var(--text-muted); }
.gb-assignment-card__actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; }

/* Student grades overview (all subjects) */
.student-grades {
    width: 100%;
    max-width: none;
    margin: 0;
    padding-bottom: 1.25rem;
}
.student-grades__panel {
    display: grid;
    grid-template-columns: minmax(15rem, 17.5rem) minmax(0, 1fr);
    gap: 1rem 1.15rem;
    align-items: start;
    width: 100%;
    padding: 1.1rem 1.15rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background:
        linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 8px 24px rgba(15, 23, 42, 0.04);
}
.student-grades__aside {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: sticky;
    top: 0.75rem;
}
.student-grades__hero {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem;
    border-radius: 0.9rem;
    border: 1px solid var(--border);
    background:
        linear-gradient(160deg, #f0f7ff 0%, #fff 55%),
        #fff;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}
.student-grades__hero--excellent {
    background: linear-gradient(160deg, #ecfdf3 0%, #fff 55%), #fff;
    border-color: #b8dfc4;
}
.student-grades__hero--good {
    background: linear-gradient(160deg, #eff6ff 0%, #fff 55%), #fff;
    border-color: #9ec5fe;
}
.student-grades__hero--fair {
    background: linear-gradient(160deg, #fffbeb 0%, #fff 55%), #fff;
    border-color: #f5d78e;
}
.student-grades__hero--low {
    background: linear-gradient(160deg, #fef2f2 0%, #fff 55%), #fff;
    border-color: #f1b0b7;
}
.student-grades__hero--building,
.student-grades__hero--pending {
    background: linear-gradient(160deg, #f0f7ff 0%, #fff 55%), #fff;
    border-color: var(--border);
}
.student-grades__hero-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.65rem;
}
.student-grades__ring {
    position: relative;
    width: 5.5rem;
    height: 5.5rem;
    flex-shrink: 0;
}
.student-grades__ring svg {
    width: 100%;
    height: 100%;
}
.student-grades__ring-bg,
.student-grades__ring-fg {
    fill: none;
    stroke-width: 2.8;
}
.student-grades__ring-bg {
    stroke: #e2e8f0;
}
.student-grades__ring-fg {
    stroke: var(--primary);
    stroke-linecap: round;
    transition: stroke-dasharray 0.35s ease;
}
.student-grades__hero--excellent .student-grades__ring-fg { stroke: #28a745; }
.student-grades__hero--good .student-grades__ring-fg { stroke: var(--primary); }
.student-grades__hero--fair .student-grades__ring-fg { stroke: #c9a227; }
.student-grades__hero--low .student-grades__ring-fg { stroke: #dc3545; }
.student-grades__hero--building .student-grades__ring-fg,
.student-grades__hero--pending .student-grades__ring-fg { stroke: var(--primary); }
.student-grades__ring-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1;
}
.student-grades__ring-value small {
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 0.05rem;
    color: var(--text-muted);
}
.student-grades__hero-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.student-grades__title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text);
}
.student-grades__hero-sub {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.student-grades__hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
}
.student-grades__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    min-width: 0;
    padding: 0.55rem 0.25rem;
    border-radius: 0.65rem;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(15, 23, 42, 0.06);
    text-align: center;
}
.student-grades__stat strong {
    display: block;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text);
}
.student-grades__stat > span {
    display: block;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.2;
}
.student-grades__filters {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.45rem;
    border-radius: 0.85rem;
    border: 1px solid var(--border);
    background: #fff;
}
.student-grades__filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.7rem;
    border-radius: 0.55rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none !important;
}
.student-grades__filter span {
    min-width: 1.35rem;
    height: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.7rem;
}
.student-grades__filter:hover {
    color: var(--text);
    background: #f8fafc;
}
.student-grades__filter.is-active {
    background: #eff6ff;
    border-color: rgba(15, 108, 191, 0.22);
    color: var(--primary);
}
.student-grades__filter.is-active span {
    background: #dbeafe;
    color: var(--primary);
}
.student-grades__board {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.student-grades__board-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0 0.1rem;
}
.student-grades__board-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.01em;
}
.student-grades__board-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}
.student-grades__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}
.student-grades__row {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.95rem 1rem;
    background: #fff;
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: 0.85rem;
    text-decoration: none !important;
    color: inherit;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.15s;
    min-height: 100%;
}
.student-grades__row--excellent { border-left-color: #28a745; }
.student-grades__row--good { border-left-color: var(--primary); }
.student-grades__row--fair { border-left-color: #c9a227; }
.student-grades__row--low { border-left-color: #dc3545; }
.student-grades__row--pending { border-left-color: #94a3b8; }
.student-grades__row--passed { border-left-color: #28a745; }
.student-grades__row:hover {
    border-color: rgba(15, 108, 191, 0.28);
    background: #f8fbff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    transform: translateY(-1px);
}
.student-grades__row-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.65rem;
}
.student-grades__icon {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef2f7;
    color: #64748b;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.student-grades__row--excellent .student-grades__icon,
.student-grades__row--passed .student-grades__icon {
    background: #e8f8ee;
    color: #1b7a3d;
}
.student-grades__row--good .student-grades__icon {
    background: #e7f0fa;
    color: var(--primary);
}
.student-grades__row--fair .student-grades__icon {
    background: #fff6df;
    color: #a6670e;
}
.student-grades__row--low .student-grades__icon {
    background: #fdebec;
    color: #c0392b;
}
.student-grades__main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.student-grades__title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.45rem;
    min-width: 0;
}
.student-grades__name {
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
}
.student-grades__status {
    flex-shrink: 0;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
}
.student-grades__status--passed {
    background: #d4edda;
    color: #155724;
}
.student-grades__status--complete {
    background: #cce5ff;
    color: #084298;
}
.student-grades__status--in_progress {
    background: #fff3cd;
    color: #856404;
}
.student-grades__status--pending {
    background: #f1f5f9;
    color: #64748b;
}
.student-grades__meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
}
.student-grades__bar {
    display: block;
    height: 0.3rem;
    border-radius: 999px;
    background: #e8edf3;
    overflow: hidden;
}
.student-grades__bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #5aa4e0 0%, var(--primary) 100%);
}
.student-grades__row--excellent .student-grades__bar > span,
.student-grades__row--passed .student-grades__bar > span {
    background: linear-gradient(90deg, #34c759 0%, #1b7a3d 100%);
}
.student-grades__row--fair .student-grades__bar > span {
    background: linear-gradient(90deg, #e0b93a 0%, #a6670e 100%);
}
.student-grades__row--low .student-grades__bar > span {
    background: linear-gradient(90deg, #f07178 0%, #c0392b 100%);
}
.student-grades__progress-label {
    margin-top: -0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
}
.student-grades__grade {
    min-width: 3rem;
    text-align: right;
    font-size: 1.05rem;
}
.student-grades__chips {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
}
.student-grades__chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    min-width: 0;
    padding: 0.4rem 0.5rem;
    border-radius: 0.5rem;
    background: #f8fafc;
    border: 1px solid #e8edf3;
    font-size: 0.7rem;
}
.student-grades__chip-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
    font-weight: 600;
}
.student-grades__chip strong {
    flex-shrink: 0;
    font-weight: 800;
    color: var(--text);
}
.student-grades__chip--excellent strong { color: #1b7a3d; }
.student-grades__chip--good strong { color: var(--primary); }
.student-grades__chip--fair strong { color: #a6670e; }
.student-grades__chip--low strong { color: #c0392b; }
.student-grades__chip--pending strong { color: #94a3b8; }
.student-grades__chip--more {
    justify-content: center;
    color: var(--text-muted);
    font-weight: 700;
}
.student-grades__hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.student-grades__empty { margin-top: 0; }

.student-grade-detail {
    width: 100%;
    max-width: none;
    margin: 0;
    padding-bottom: 1.25rem;
}
.student-grade-detail__panel {
    width: 100%;
    padding: 1.1rem 1.15rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background:
        linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 8px 24px rgba(15, 23, 42, 0.04);
}
.student-grade-detail__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.95rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
}
.student-grade-detail__header-main {
    min-width: 0;
    flex: 1;
}
.student-grade-detail__back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
}
.student-grade-detail__back:hover {
    color: var(--primary);
    text-decoration: none;
}
.student-grade-detail__kicker {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.student-grade-detail__title {
    margin: 0.1rem 0 0.35rem;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}
.student-grade-detail__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}
.student-grade-detail__meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.student-grade-detail__passed {
    color: #1b7a3d;
}
.student-grade-detail__course {
    flex-shrink: 0;
    white-space: nowrap;
}
.student-grade-detail__body {
    display: grid;
    grid-template-columns: minmax(14rem, 17rem) minmax(0, 1fr);
    gap: 1rem 1.15rem;
    align-items: start;
}
.student-grade-detail__aside {
    position: sticky;
    top: 0.75rem;
}
.student-grade-detail__hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.65rem;
    padding: 1rem;
    border-radius: 0.9rem;
    border: 1px solid var(--border);
    background: linear-gradient(160deg, #f0f7ff 0%, #fff 55%), #fff;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}
.student-grade-detail__hero--excellent {
    background: linear-gradient(160deg, #ecfdf3 0%, #fff 55%), #fff;
    border-color: #b8dfc4;
}
.student-grade-detail__hero--good {
    background: linear-gradient(160deg, #eff6ff 0%, #fff 55%), #fff;
    border-color: #9ec5fe;
}
.student-grade-detail__hero--fair {
    background: linear-gradient(160deg, #fffbeb 0%, #fff 55%), #fff;
    border-color: #f5d78e;
}
.student-grade-detail__hero--low {
    background: linear-gradient(160deg, #fef2f2 0%, #fff 55%), #fff;
    border-color: #f1b0b7;
}
.student-grade-detail__hero--building,
.student-grade-detail__hero--pending {
    background: linear-gradient(160deg, #f0f7ff 0%, #fff 55%), #fff;
    border-color: var(--border);
}
.student-grade-detail__ring {
    position: relative;
    width: 5.5rem;
    height: 5.5rem;
}
.student-grade-detail__ring svg {
    width: 100%;
    height: 100%;
}
.student-grade-detail__ring-bg,
.student-grade-detail__ring-fg {
    fill: none;
    stroke-width: 2.8;
}
.student-grade-detail__ring-bg { stroke: #e2e8f0; }
.student-grade-detail__ring-fg {
    stroke: var(--primary);
    stroke-linecap: round;
}
.student-grade-detail__hero--excellent .student-grade-detail__ring-fg { stroke: #28a745; }
.student-grade-detail__hero--good .student-grade-detail__ring-fg { stroke: var(--primary); }
.student-grade-detail__hero--fair .student-grade-detail__ring-fg { stroke: #c9a227; }
.student-grade-detail__hero--low .student-grade-detail__ring-fg { stroke: #dc3545; }
.student-grade-detail__hero--building .student-grade-detail__ring-fg,
.student-grade-detail__hero--pending .student-grade-detail__ring-fg { stroke: var(--primary); }
.student-grade-detail__ring-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
}
.student-grade-detail__ring-value small {
    font-size: 0.7rem;
    font-weight: 700;
    margin-left: 0.05rem;
    color: var(--text-muted);
}
.student-grade-detail__hero-label {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text);
}
.student-grade-detail__hero-sub {
    margin: 0;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.student-grade-detail__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    width: 100%;
}
.student-grade-detail__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.08rem;
    padding: 0.5rem 0.25rem;
    border-radius: 0.6rem;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(15, 23, 42, 0.06);
}
.student-grade-detail__stat strong {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text);
}
.student-grade-detail__stat span {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
}
.student-grade-detail__main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.student-grade-detail__main-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0 0.1rem;
}
.student-grade-detail__section-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text);
}
.student-grade-detail__section-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}
.student-grade-detail__empty {
    margin: 0;
}
.gb-weight-bar--detail {
    margin-bottom: 0.65rem;
}
.gb-student-breakdown--detail {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.gb-student-breakdown--detail .gb-breakdown-item {
    padding: 0.75rem 0.85rem;
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.gb-student-breakdown--detail .gb-breakdown-item__icon {
    width: 2rem;
    height: 2rem;
    font-size: 0.8rem;
}
.gb-student-breakdown--detail .gb-breakdown-item__top strong {
    font-size: 0.88rem;
}
.gb-student-breakdown--detail .gb-breakdown-item__top span {
    font-size: 0.72rem;
}
.gb-student-breakdown--detail .gb-breakdown-item__scores {
    font-size: 0.78rem;
}
.student-grade-detail .gb-student-card {
    max-width: none;
}

@media (max-width: 900px) {
    .student-grade-detail__panel {
        padding: 0.95rem;
    }
    .student-grade-detail__body {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }
    .student-grade-detail__aside {
        position: static;
    }
    .student-grade-detail__header {
        flex-wrap: wrap;
    }
    .student-grade-detail__course {
        width: 100%;
        justify-content: center;
    }
}
@media (max-width: 640px) {
    .student-grade-detail__panel {
        padding: 0.75rem;
        border-radius: 0.85rem;
    }
    .student-grade-detail__title {
        font-size: 1.08rem;
    }
    .student-grade-detail__ring {
        width: 4.75rem;
        height: 4.75rem;
    }
}

@media (max-width: 1100px) {
    .student-grades__list {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 900px) {
    .student-grades__panel {
        grid-template-columns: 1fr;
        gap: 0.85rem;
        padding: 0.95rem;
    }
    .student-grades__aside {
        position: static;
    }
    .student-grades__hero-main {
        flex-direction: row;
        text-align: left;
        align-items: center;
        gap: 0.85rem;
    }
    .student-grades__ring {
        width: 4.5rem;
        height: 4.5rem;
    }
    .student-grades__ring-value {
        font-size: 1rem;
    }
    .student-grades__filters {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.35rem;
        padding: 0.4rem;
    }
    .student-grades__filter {
        flex: 0 0 auto;
        justify-content: flex-start;
        gap: 0.35rem;
        padding: 0.4rem 0.65rem;
        border-radius: 999px;
    }
    .student-grades__list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 640px) {
    .student-grades__panel {
        padding: 0.75rem;
        border-radius: 0.85rem;
    }
    .student-grades__hero {
        padding: 0.9rem;
        gap: 0.7rem;
    }
    .student-grades__ring {
        width: 3.85rem;
        height: 3.85rem;
    }
    .student-grades__title {
        font-size: 1.1rem;
    }
    .student-grades__list {
        grid-template-columns: 1fr;
    }
    .student-grades__row {
        padding: 0.85rem 0.9rem;
    }
    .student-grades__icon {
        width: 2.1rem;
        height: 2.1rem;
        font-size: 0.8rem;
    }
    .student-grades__name {
        font-size: 0.9rem;
    }
    .student-grades__chips {
        grid-template-columns: 1fr;
    }
}

/* Student grade card */
.gb-student-card { max-width: 720px; }
.gb-student-card__hero {
    display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap;
    padding: 1.35rem 1.5rem; margin-bottom: 1.25rem;
    border-radius: var(--radius-lg); border: 1px solid var(--border);
    background: linear-gradient(135deg, #f8fbff, #fff);
}
.gb-student-card__hero--excellent { border-color: #b8dfc4; }
.gb-student-card__hero--good { border-color: #9ec5fe; }
.gb-student-card__ring {
    --gb-pct: 0;
    width: 6.5rem; height: 6.5rem; border-radius: 999px; flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: conic-gradient(var(--primary) calc(var(--gb-pct) * 1%), #e8eef4 0);
    position: relative;
}
.gb-student-card__ring::before { content: ''; position: absolute; inset: 0.5rem; border-radius: 999px; background: #fff; }
.gb-student-card__ring-value, .gb-student-card__ring-label { position: relative; z-index: 1; line-height: 1.1; }
.gb-student-card__ring-value { font-size: 1.65rem; font-weight: 800; }
.gb-student-card__ring-label { font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
.gb-student-card__subject { margin: 0; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: var(--primary); }
.gb-student-card__hero-text h2 { margin: 0.15rem 0 0.35rem; font-size: 1.35rem; font-weight: 800; }
.gb-student-card__hero-text p { margin: 0; font-size: 0.875rem; color: var(--text-muted); }
.gb-weight-bar--student { margin-bottom: 1.25rem; }
.gb-student-breakdown { display: flex; flex-direction: column; gap: 0.65rem; }
.gb-breakdown-item {
    display: flex; gap: 0.85rem; padding: 0.9rem 1rem;
    border: 1px solid var(--border); border-radius: var(--radius-lg); background: #fff;
    border-left: 4px solid var(--gb-tone, var(--primary));
}
.gb-breakdown-item.is-pending { opacity: 0.85; }
.gb-breakdown-item__icon {
    width: 2.25rem; height: 2.25rem; border-radius: 0.55rem; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--gb-tone-bg); color: var(--gb-tone);
}
.gb-breakdown-item__main { flex: 1; min-width: 0; }
.gb-breakdown-item__top strong { display: block; font-size: 0.9375rem; }
.gb-breakdown-item__top span { font-size: 0.75rem; color: var(--text-muted); }
.gb-breakdown-item__bar { height: 0.4rem; border-radius: 999px; background: #e9ecef; margin: 0.5rem 0 0.35rem; overflow: hidden; }
.gb-breakdown-item__bar span { display: block; height: 100%; background: var(--gb-tone, var(--primary)); border-radius: 999px; }
.gb-breakdown-item__scores { display: flex; flex-wrap: wrap; gap: 0.5rem 0.85rem; font-size: 0.8125rem; }
.gb-breakdown-item__pct { font-weight: 800; color: var(--ink); }
.gb-breakdown-item__contrib { color: var(--primary); font-weight: 600; }
.gb-breakdown-item__pending { margin: 0.35rem 0 0; font-size: 0.8125rem; color: var(--text-muted); font-style: italic; }

.gb-empty-scheme { text-align: center; padding: 2rem 1.5rem; }
.gb-empty-scheme__icon { font-size: 2rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.gb-empty-scheme h3 { margin: 0 0 0.35rem; font-size: 1.1rem; }
.gb-empty-scheme p { margin: 0; color: var(--text-muted); font-size: 0.875rem; max-width: 420px; margin-inline: auto; }

/* Admin grading scheme editor */
.grading-scheme-fieldset { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.15rem 1.25rem; margin: 1rem 0; background: #fafbfc; }
.grading-scheme-fieldset legend { font-weight: 800; padding: 0 0.35rem; }
.grading-scheme-help { font-size: 0.875rem; margin-bottom: 0.85rem; }
.grading-scheme-preview { margin-bottom: 1rem; }
.grading-scheme-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.85rem; }
.grading-scheme-toolbar__label { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); margin-right: 0.25rem; }
.gb-chip-btn {
    display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.65rem;
    border: 1px solid var(--border); border-radius: 999px; background: #fff;
    font-size: 0.8125rem; font-weight: 600; cursor: pointer; color: var(--gb-tone, var(--ink));
}
.gb-chip-btn:hover { background: var(--gb-tone-bg, var(--bg)); border-color: var(--gb-tone, var(--primary)); }
.grading-scheme-table-head {
    display: grid; grid-template-columns: 150px 1fr 120px 2.5rem; gap: 0.5rem;
    padding: 0 0.25rem 0.35rem; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--text-muted);
}
.grading-scheme-rows { display: flex; flex-direction: column; gap: 0.5rem; }
.grading-scheme-row {
    display: grid; grid-template-columns: 150px 1fr 120px 2.5rem; gap: 0.5rem; align-items: center;
    padding: 0.5rem 0.55rem; border-radius: var(--radius); background: #fff; border: 1px solid var(--border);
    border-left: 3px solid var(--gb-tone, var(--primary));
}
.grading-scheme-row__type { display: flex; gap: 0.35rem; align-items: center; }
.grading-scheme-row__icon {
    width: 1.75rem; height: 1.75rem; border-radius: 0.4rem; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--gb-tone-bg); color: var(--gb-tone); font-size: 0.8rem;
}
.grading-scheme-row__type select { flex: 1; min-width: 0; font-size: 0.8125rem; padding: 0.35rem 0.45rem; }
.grading-scheme-row__weight { display: flex; align-items: center; gap: 0.25rem; }
.grading-scheme-row__weight input { text-align: right; }
.grading-scheme-row__pct { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); }
.grading-scheme-row__remove { padding: 0.25rem 0.5rem; line-height: 1; }
.grading-weight-total-line { margin: 0.5rem 0 0; font-size: 0.875rem; }
.grading-weight-hint { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
#gradingWeightTotal.is-invalid { color: #b45309; }
#gradingWeightTotal.is-valid { color: #0f5132; }

@media (max-width: 720px) {
    .gb-class-hero { flex-direction: column; align-items: stretch; }
    .gb-class-hero__aside { max-width: none; }
    .grading-scheme-table-head { display: none; }
    .grading-scheme-row { grid-template-columns: 1fr; }
    .gb-setup-alert { grid-template-columns: 1fr; }
    .gb-student-card__hero { flex-direction: column; text-align: center; }
}

.page-section-title,
[id] { scroll-margin-top: calc(var(--navbar-height) + 1rem); }
.page-section-title { font-size: 1.1rem; font-weight: 700; }

.course-page-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}

/* ===== Course view (Moodle-style) ===== */
.course-view { margin-bottom: 1.5rem; }

.course-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem 2rem;
    background-color: var(--primary-dark);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: #fff;
    border-radius: 1rem;
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 8px 24px rgba(15, 108, 191, 0.2);
    position: relative;
    overflow: hidden;
}
.course-hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(15, 108, 191, 0.88) 0%, rgba(8, 90, 158, 0.82) 55%, rgba(8, 121, 156, 0.85) 100%);
}
.course-hero--custom-cover .course-hero-overlay {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.35) 0%, rgba(15, 23, 42, 0.78) 100%);
}
.course-hero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 280px;
    height: 280px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}
.course-hero-main { position: relative; z-index: 1; flex: 1; min-width: 220px; }
.course-hero-settings-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 0.625rem;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.course-hero-settings-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.5);
}
.course-hero-settings-btn i { font-size: 1rem; }
.course-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: rgba(255,255,255,0.88);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 0.85rem;
}
.course-back-link:hover { color: #fff; text-decoration: none; }
.course-hero-title-row { display: flex; align-items: center; gap: 1rem; }
.course-hero-avatar {
    width: 56px; height: 56px;
    border-radius: 0.875rem;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.35);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; font-weight: 800; flex-shrink: 0;
}
.course-hero-title {
    font-size: 1.625rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
    color: #fff;
    line-height: 1.2;
}
.course-hero-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.course-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    background: rgba(255,255,255,0.15);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.course-hero-desc {
    margin: 0.85rem 0 0;
    max-width: 560px;
    line-height: 1.55;
    opacity: 0.92;
    font-size: 0.9375rem;
}
.course-hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    position: relative;
    z-index: 1;
}
.course-stat {
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 0.75rem;
    padding: 0.65rem 1rem;
    min-width: 72px;
    text-align: center;
}
.course-stat strong { display: block; font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.course-stat span { font-size: 0.6875rem; opacity: 0.9; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }

@media (max-width: 720px) {
    .course-hero {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 1rem;
        padding: 1rem 1rem 1.1rem;
        min-height: 0;
        background-position: center top;
    }
    .course-hero--custom-cover .course-hero-overlay {
        background: linear-gradient(
            180deg,
            rgba(15, 23, 42, 0.55) 0%,
            rgba(15, 23, 42, 0.72) 42%,
            rgba(15, 23, 42, 0.9) 100%
        );
    }
    .course-hero::before {
        width: 180px;
        height: 180px;
        top: -30%;
        right: -18%;
        opacity: 0.55;
    }
    .course-hero-settings-btn {
        top: 0.75rem;
        right: 0.75rem;
        width: 2.1rem;
        height: 2.1rem;
    }
    .course-back-link {
        margin: 0 2.5rem 0.15rem 0;
        font-size: 0.78rem;
    }
    .course-hero-main {
        flex: 0 0 auto;
        min-width: 0;
        width: 100%;
        padding-right: 0.25rem;
    }
    .course-hero-title-row {
        align-items: flex-start;
        gap: 0.75rem;
    }
    .course-hero-avatar {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
        border-radius: 0.75rem;
    }
    .course-hero-title {
        font-size: 1.35rem;
        word-break: break-word;
    }
    .course-hero-tags {
        margin-top: 0.4rem;
        gap: 0.35rem;
    }
    .course-tag {
        padding: 0.2rem 0.55rem;
        font-size: 0.6875rem;
    }
    .course-hero-desc {
        margin-top: 0.65rem;
        font-size: 0.875rem;
        line-height: 1.45;
        max-width: none;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .course-hero-stats {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
        width: 100%;
        flex: none;
        padding-right: 0;
    }
    .course-stat {
        min-width: 0;
        width: 100%;
        padding: 0.55rem 0.5rem;
        background: rgba(255, 255, 255, 0.16);
        backdrop-filter: blur(4px);
    }
    .course-stat strong {
        font-size: 1.15rem;
    }
    .course-stat span {
        font-size: 0.625rem;
        letter-spacing: 0.03em;
    }
    .course-hero-stats > .course-stat:first-child:nth-last-child(2) {
        grid-column: 1 / -1;
    }
    .course-grade-card-link {
        grid-column: 1 / -1;
        width: 100%;
        margin-left: 0;
        justify-content: center;
        align-self: stretch;
    }
}

.course-layout {
    display: grid;
    grid-template-columns: 188px 1fr;
    gap: 1rem;
    align-items: start;
}
@media (max-width: 900px) {
    .course-layout { grid-template-columns: 1fr; }
}

.course-sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: calc(var(--navbar-height) + 1rem);
}
@media (max-width: 900px) {
    .course-sidebar { position: static; }
}
.course-sidebar-title { font-size: 0.8125rem; font-weight: 700; margin: 0 0 0.15rem; }
.course-sidebar-hint {
    font-size: 0.6875rem; color: var(--text-muted);
    margin: 0 0 0.65rem; line-height: 1.4;
}

.activity-picker { display: flex; flex-direction: column; gap: 0.35rem; }
.activity-picker-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.5rem;
    row-gap: 0;
    align-items: center;
    padding: 0.5rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none !important;
    color: var(--text);
    background: var(--bg);
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.activity-picker-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 1px 4px rgba(15,108,191,0.08);
}
.activity-picker-card.is-active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: inset 2px 0 0 var(--primary);
}
.activity-picker-icon {
    width: 28px; height: 28px;
    border-radius: 0.4rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8125rem;
    margin-bottom: 0;
    grid-row: 1 / 3;
}
.activity-picker-icon.material { background: #e7f0fa; color: var(--primary); }
.activity-picker-icon.assignment { background: #fff3cd; color: #856404; }
.activity-picker-icon.quiz { background: #d1ecf1; color: #0c5460; }
.activity-picker-label { font-weight: 700; font-size: 0.75rem; line-height: 1.2; }
.activity-picker-desc {
    font-size: 0.625rem; color: var(--text-muted);
    line-height: 1.25;
    grid-column: 2;
}

.course-main { min-width: 0; display: flex; flex-direction: column; gap: 1.25rem; }

.course-form-sheet {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.35rem 1.5rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.course-form-sheet--material { border-top: 4px solid var(--primary); }
.course-form-sheet--assignment { border-top: 4px solid #c9a227; }
.course-form-sheet--quiz { border-top: 4px solid #08799c; }
.course-form-sheet--section { border-top: 4px solid #4338ca; }
.course-form-sheet-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.15rem;
}
.course-form-sheet-header h2 { font-size: 1.15rem; font-weight: 700; margin: 0.35rem 0 0; }
.course-form-sheet-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.course-form-sheet-badge.material { background: #e7f0fa; color: var(--primary-dark); }
.course-form-sheet-badge.assignment { background: #fff3cd; color: #856404; }
.course-form-sheet-badge.quiz { background: #d1ecf1; color: #0c5460; }
.course-form-close {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-decoration: none;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.course-form-close:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.course-form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }

/* Teacher course builder toolbar */
.course-builder {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: end;
    gap: 0.85rem 1.15rem;
    padding: 0.9rem 1.05rem;
    margin-bottom: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.course-builder-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    min-width: 0;
}
.course-builder-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    line-height: 1;
}
.course-builder-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    width: 100%;
}
.course-builder-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.48rem 0.78rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}
.course-builder-btn i {
    color: var(--text-muted);
    font-size: 0.8125rem;
}
.course-builder-btn:hover {
    text-decoration: none !important;
    border-color: #c5d8ea;
    background: var(--surface-2);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.course-builder-btn--material.is-active,
.course-builder-btn--material:hover {
    border-color: var(--primary);
    background: #e7f0fa;
    color: var(--primary-dark);
}
.course-builder-btn--material i,
.course-builder-btn--material.is-active i,
.course-builder-btn--material:hover i { color: var(--primary); }
.course-builder-btn--assignment.is-active,
.course-builder-btn--assignment:hover {
    border-color: #c9a227;
    background: #fff8e6;
    color: #856404;
}
.course-builder-btn--assignment i,
.course-builder-btn--assignment.is-active i,
.course-builder-btn--assignment:hover i { color: #a6670e; }
.course-builder-btn--quiz.is-active,
.course-builder-btn--quiz:hover {
    border-color: #08799c;
    background: #e8f6f8;
    color: #0c5460;
}
.course-builder-btn--quiz i,
.course-builder-btn--quiz.is-active i,
.course-builder-btn--quiz:hover i { color: #08799c; }
.course-builder-lesson-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
    flex-shrink: 0;
    padding-right: 1.15rem;
    margin: 0;
    border-right: 1px solid var(--border);
}
.course-builder-lesson {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--primary-dark);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none !important;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(15, 108, 191, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.course-builder-lesson i {
    font-size: 0.9rem;
}
.course-builder-lesson:hover,
.course-builder-lesson.is-active {
    border-color: #074a8a;
    background: linear-gradient(135deg, var(--primary-dark) 0%, #074a8a 100%);
    color: #fff;
    text-decoration: none !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 108, 191, 0.3);
}
.course-builder-lesson.is-active {
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.22), 0 4px 12px rgba(15, 108, 191, 0.25);
}
.course-builder-side {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-bottom: 0.05rem;
}
.course-builder-students {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.52rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--ink-2);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.course-builder-students:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
    text-decoration: none !important;
}
.course-main--full { width: 100%; }

@media (max-width: 1100px) and (min-width: 721px) {
    .course-builder {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
    }
    .course-builder-side {
        grid-column: 1 / -1;
        justify-content: flex-start;
        padding-top: 0.15rem;
        border-top: 1px solid var(--border);
        margin: 0 -0.15rem;
        padding-left: 0.15rem;
        padding-right: 0.15rem;
        padding-top: 0.75rem;
    }
}

@media (max-width: 720px) {
    .course-builder {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 0;
        padding: 0;
        overflow: hidden;
    }
    .course-builder-lesson-group,
    .course-builder-group,
    .course-builder-side {
        width: 100%;
        margin: 0;
        padding: 0.95rem 1rem;
        border: 0;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        align-items: stretch;
    }
    .course-builder-side {
        border-bottom: 0;
        padding-top: 0.85rem;
        padding-bottom: 0.95rem;
        justify-content: stretch;
    }
    .course-builder-lesson-group {
        display: flex;
        flex-direction: column;
        gap: 0.55rem;
        flex-shrink: 1;
        background: linear-gradient(180deg, #f5f9fd 0%, #fff 100%);
    }
    .course-builder-label {
        font-size: 0.6875rem;
        margin: 0;
    }
    .course-builder-lesson {
        width: 100%;
        justify-content: center;
        padding: 0.7rem 1rem;
        box-shadow: 0 3px 10px rgba(15, 108, 191, 0.2);
    }
    .course-builder-lesson:hover,
    .course-builder-lesson.is-active {
        transform: none;
    }
    .course-builder-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }
    .course-builder-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }
    .course-builder-btn {
        width: 100%;
        justify-content: flex-start;
        gap: 0.5rem;
        padding: 0.7rem 0.75rem;
        border-radius: var(--radius);
        background: #fff;
        line-height: 1.2;
        min-height: 2.75rem;
    }
    .course-builder-btn i {
        width: 1rem;
        text-align: center;
        flex-shrink: 0;
    }
    .course-builder-btn--library i { color: #475569; }
    .course-builder-btn--ai {
        grid-column: 1 / -1;
        justify-content: center;
        background: #f0fdfa;
        border-color: #99f6e4;
        color: #0f766e;
    }
    .course-builder-btn--ai i { color: #0d9488; }
    .course-builder-students {
        width: 100%;
        justify-content: center;
        border-radius: var(--radius);
        padding: 0.7rem 1rem;
        background: var(--bg);
    }
}

/* Refined teacher course workspace */
.course-hero {
    padding: 1.15rem 1.35rem;
    margin-bottom: 0.9rem;
    min-height: 10rem;
}
.course-hero-eyebrow {
    display: block;
    margin-bottom: 0.22rem;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.course-hero-avatar {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    font-size: 1.25rem;
}
.course-hero-title {
    font-size: 1.45rem;
}
.course-back-link {
    margin-bottom: 0.6rem;
}
.course-hero-stats {
    gap: 0.45rem;
}
.course-hero:has(.course-hero-settings-btn) .course-hero-stats {
    padding-right: 2.75rem;
}
.course-stat {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
        "value"
        "label";
    justify-items: center;
    align-items: center;
    text-align: center;
    gap: 0.08rem;
    min-width: 76px;
    padding: 0.5rem 0.75rem;
    border-radius: 0.65rem;
    backdrop-filter: blur(5px);
}
.course-stat:has(> i) {
    grid-template-columns: auto auto;
    grid-template-areas:
        "icon value"
        "label label";
    gap: 0.08rem 0.35rem;
    justify-content: center;
    justify-items: start;
}
.course-stat:has(> i) span {
    justify-self: center;
}
.course-stat > i {
    grid-area: icon;
    font-size: 0.7rem;
    opacity: 0.78;
}
.course-stat strong {
    grid-area: value;
    font-size: 1.08rem;
    text-align: center;
}
.course-stat span {
    grid-area: label;
    font-size: 0.58rem;
    text-align: center;
}
.course-builder {
    padding: 0.8rem 0.95rem;
    margin-bottom: 0.9rem;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.05);
}
.course-builder-heading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--border);
}
.course-builder-heading__icon {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.6rem;
    background: var(--primary-light);
    color: var(--primary);
}
.course-builder-heading > div {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
}
.course-builder-heading strong {
    font-size: 0.85rem;
    color: var(--ink-1);
}
.course-builder-heading span:last-child {
    color: var(--text-muted);
    font-size: 0.7rem;
}
.course-content-kicker,
.course-lesson-kicker {
    display: block;
    color: var(--primary);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    line-height: 1.2;
    text-transform: uppercase;
}
.course-lesson-heading {
    gap: 0.22rem;
}
.course-lesson-heading .course-lesson-badges {
    margin-top: 0.18rem;
}
.course-lesson-body {
    background: linear-gradient(180deg, #f6f8fb 0%, #eef2f6 100%);
    border-top-color: #dbe3ec;
}
.course-lesson--general .course-lesson-body {
    background: linear-gradient(180deg, #fffdf5 0%, #f8f5e9 100%);
}

/* Focused material builder */
.course-view--material-builder {
    max-width: 1180px;
    margin: 0 auto 2rem;
}
.course-view--material-builder > .course-hero,
.course-view--material-builder > .course-builder,
.course-view--material-builder .course-content-section {
    display: none;
}
.course-view--material-builder .course-main {
    gap: 0;
}
.course-view--material-builder .course-form-sheet--material {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.course-view--material-builder .course-form-sheet-header {
    display: none;
}
.course-view--material-builder .alert {
    max-width: 880px;
    margin-right: auto;
    margin-left: auto;
}
.material-builder-intro {
    margin-bottom: 1rem;
    padding: 1.1rem 1.2rem;
    border: 1px solid #cddff1;
    border-radius: 1rem;
    background: linear-gradient(135deg, #f8fbff 0%, #eef6fd 100%);
}
.material-builder-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
    color: var(--ink-3);
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
}
.material-builder-back:hover {
    color: var(--primary);
    text-decoration: none;
}
.material-builder-intro__title {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}
.material-builder-intro__icon {
    width: 3.1rem;
    height: 3.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 0.9rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 6px 16px rgba(15, 108, 191, 0.22);
}
.material-builder-intro h1 {
    margin: 0.22rem 0 0.15rem;
    color: #102a43;
    font-size: 1.45rem;
    line-height: 1.2;
}
.material-builder-intro p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.material-builder-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16rem;
    align-items: start;
    gap: 1rem;
}
.material-builder-main {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-width: 0;
}
.material-builder-card {
    padding: 1.15rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
}
.material-builder-card[hidden],
.material-source-panel[hidden] {
    display: none !important;
}
.material-builder-card__head {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    margin-bottom: 0.9rem;
}
.material-builder-step {
    width: 1.7rem;
    height: 1.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
}
.material-builder-card__head h2 {
    margin: 0;
    color: #183b5b;
    font-size: 0.98rem;
    line-height: 1.3;
}
.material-builder-card__head p {
    margin: 0.15rem 0 0;
    color: var(--text-muted);
    font-size: 0.77rem;
}
.material-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}
.material-choice {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
    min-height: 5.2rem;
    padding: 0.8rem;
    border: 1px solid #d6e0ea;
    border-radius: 0.8rem;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.15s;
}
.material-choice:hover {
    border-color: #9fc4e5;
    background: #f8fbff;
}
.material-choice.is-selected {
    border-color: var(--primary);
    background: #f0f7fd;
    box-shadow: inset 0 0 0 1px rgba(15, 108, 191, 0.12), 0 3px 10px rgba(15, 108, 191, 0.08);
}
.material-choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.material-choice:focus-within {
    outline: 3px solid rgba(15, 108, 191, 0.2);
    outline-offset: 2px;
}
.material-choice__icon {
    width: 2.3rem;
    height: 2.3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.65rem;
    background: #edf4fa;
    color: #52708d;
}
.material-choice.is-selected .material-choice__icon {
    background: #dceefe;
    color: var(--primary);
}
.material-choice__copy {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-width: 0;
}
.material-choice__copy strong {
    color: var(--ink-1);
    font-size: 0.84rem;
}
.material-choice__copy small {
    color: var(--text-muted);
    font-size: 0.69rem;
    line-height: 1.35;
}
.material-choice__check {
    color: var(--primary);
    opacity: 0;
    transform: scale(0.75);
    transition: opacity 0.15s, transform 0.15s;
}
.material-choice.is-selected .material-choice__check {
    opacity: 1;
    transform: scale(1);
}
.material-choice--compact {
    min-height: 4.2rem;
}
.material-source-panel {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}
.material-file-drop {
    position: relative;
    display: block;
    overflow: hidden;
    border: 2px dashed #8ab7de;
    border-radius: 1rem;
    background: linear-gradient(180deg, #fafdff 0%, #f3f9ff 100%);
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s, box-shadow 0.18s, transform 0.18s;
}
.material-file-drop:hover,
.material-file-drop:focus-within,
.material-file-drop.is-dragging {
    border-color: var(--primary);
    background: #edf7ff;
    box-shadow: 0 0 0 4px rgba(15, 108, 191, 0.09);
}
.material-file-drop.is-dragging {
    transform: translateY(-2px);
}
.material-file-drop.has-file {
    border-style: solid;
    border-color: #59bba8;
    background: linear-gradient(180deg, #f3fffc 0%, #edfbf8 100%);
}
.material-file-drop.is-invalid {
    border-style: solid;
    border-color: #ef8b82;
    background: #fff7f6;
}
.material-file-drop.is-uploading {
    border-style: solid;
    border-color: var(--primary);
    background: #f5faff;
    pointer-events: none;
}
.material-upload-main {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1.25rem 1.3rem 1rem;
}
.material-file-drop__icon {
    width: 3.25rem;
    height: 3.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 0.9rem;
    background: linear-gradient(135deg, #dceefe, #c9e4fb);
    color: var(--primary);
    font-size: 1.2rem;
    box-shadow: inset 0 0 0 1px rgba(15, 108, 191, 0.1);
}
.material-file-drop.has-file .material-file-drop__icon {
    background: #d8f5ee;
    color: #0f766e;
}
.material-file-drop.is-invalid .material-file-drop__icon {
    background: #fee2e2;
    color: #b91c1c;
}
.material-file-drop.is-uploading .material-file-drop__icon i {
    animation: materialUploadPulse 1s ease-in-out infinite;
}
.material-file-drop__copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
}
.material-file-drop__copy strong {
    color: var(--ink-1);
    font-size: 0.92rem;
}
.material-file-drop__copy small,
.material-file-drop__copy em {
    color: var(--text-muted);
    font-size: 0.74rem;
    font-style: normal;
    line-height: 1.4;
}
.material-file-drop__copy em {
    color: var(--primary-dark);
    font-weight: 700;
}
.material-upload-browse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.38rem;
    flex: 0 0 auto;
    padding: 0.52rem 0.8rem;
    border: 1px solid #bdd4e8;
    border-radius: 0.6rem;
    background: #fff;
    color: var(--primary-dark);
    font-size: 0.75rem;
    font-weight: 750;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.material-file-drop:hover .material-upload-browse {
    border-color: var(--primary);
}
.material-file-drop.has-file .material-upload-browse {
    border-color: #a7ded3;
    color: #0f766e;
}
.material-upload-requirements {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.55rem 1.3rem;
    border-top: 1px solid rgba(138, 183, 222, 0.28);
    background: rgba(255, 255, 255, 0.55);
    color: #64748b;
    font-size: 0.66rem;
    font-weight: 650;
}
.material-upload-requirements span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.material-upload-requirements i {
    color: #789abd;
}
.material-upload-progress {
    display: none;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 1.3rem;
    border-top: 1px solid #d6e6f5;
    background: #fff;
}
.material-file-drop.is-uploading .material-upload-progress {
    display: flex;
}
.material-file-drop.is-uploading .material-upload-browse,
.material-file-drop.is-uploading .material-upload-requirements {
    display: none;
}
.material-upload-progress__track {
    position: relative;
    height: 0.38rem;
    flex: 1;
    overflow: hidden;
    border-radius: 999px;
    background: #dce8f3;
}
.material-upload-progress__track span {
    position: absolute;
    inset: 0 auto 0 -35%;
    width: 35%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #38bdf8);
    animation: materialUploadProgress 1.1s ease-in-out infinite;
}
.material-upload-progress__label {
    color: var(--primary-dark);
    font-size: 0.7rem;
    font-weight: 750;
}
.material-file-drop input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}
@keyframes materialUploadProgress {
    from { left: -35%; }
    to { left: 100%; }
}
@keyframes materialUploadPulse {
    0%, 100% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(-2px); opacity: 0.65; }
}
.material-access-field {
    max-width: 19rem;
    margin: 0.85rem 0 0;
}
.material-source-panel--editor {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem;
    border: 1px solid #c7ece7;
    border-radius: 0.8rem;
    background: #f0fdfa;
}
.material-editor-callout__icon {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 0.65rem;
    background: #ccfbf1;
    color: #0f766e;
}
.material-source-panel--editor strong {
    color: #115e59;
    font-size: 0.86rem;
}
.material-source-panel--editor p {
    margin: 0.2rem 0 0.65rem;
    color: #376b67;
    font-size: 0.76rem;
    line-height: 1.5;
}
.material-input-with-icon {
    position: relative;
}
.material-input-with-icon > i {
    position: absolute;
    top: 50%;
    left: 0.85rem;
    z-index: 1;
    color: #7890a7;
    transform: translateY(-50%);
}
.material-input-with-icon .form-control {
    padding-left: 2.45rem;
}
.material-details-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(12rem, 0.55fr);
    gap: 0.8rem;
}
.material-details-grid .form-group {
    margin: 0;
}
.material-details-description {
    grid-column: 1 / -1;
}
.material-builder-aside {
    position: sticky;
    top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.material-builder-guide,
.material-builder-summary {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    background: #fff;
}
.material-builder-guide__icon {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.7rem;
    border-radius: 0.65rem;
    background: #fff7d6;
    color: #a16207;
}
.material-builder-guide h2 {
    margin: 0 0 0.55rem;
    color: var(--ink-1);
    font-size: 0.88rem;
}
.material-builder-guide ul {
    display: flex;
    flex-direction: column;
    gap: 0.48rem;
    margin: 0;
    padding-left: 1rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.45;
}
.material-builder-summary {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    border-color: #cddff1;
    background: #f8fbff;
}
.material-builder-summary span {
    color: var(--text-muted);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.material-builder-summary strong {
    color: var(--primary-dark);
    font-size: 0.88rem;
}
.material-builder-summary small {
    color: var(--text-muted);
    font-size: 0.68rem;
}
.material-builder-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid #cddff1;
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(8px);
}
.material-builder-actions > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.material-builder-actions strong {
    color: var(--ink-1);
    font-size: 0.82rem;
}
.material-builder-actions span {
    color: var(--text-muted);
    font-size: 0.7rem;
}
.material-builder-actions__buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
}
.material-builder-actions__buttons .btn-primary span {
    color: inherit;
    font-size: inherit;
}

@media (max-width: 980px) {
    .course-builder-heading {
        grid-column: 1 / -1;
    }
    .material-builder-layout {
        grid-template-columns: minmax(0, 1fr);
    }
    .material-builder-aside {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) and (min-width: 721px) {
    .ai-builder-hero {
        grid-template-columns: minmax(0, 1fr) auto;
    }
}

@media (max-width: 720px) {
    .course-hero {
        min-height: 0;
        padding: 1rem;
    }
    .course-hero-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
        gap: 0.5rem;
        padding-right: 0;
    }
    .course-stat {
        min-width: 0;
        width: auto;
        box-sizing: border-box;
    }
    .course-hero-stats > .course-stat:first-child:nth-last-child(2) {
        grid-column: 1 / -1;
    }
    .course-grade-card-link {
        grid-column: 1 / -1;
        width: 100%;
        margin-left: 0;
        justify-content: center;
        align-self: stretch;
    }
    .course-builder-heading {
        padding: 0.9rem 1rem;
    }
    .course-builder {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0;
    }
    .material-builder-intro {
        padding: 0.9rem;
    }
    .material-builder-intro__title {
        align-items: flex-start;
    }
    .material-builder-intro__icon {
        width: 2.6rem;
        height: 2.6rem;
    }
    .material-builder-intro h1 {
        font-size: 1.2rem;
    }
    .material-builder-card {
        padding: 0.9rem;
    }
    .material-choice-grid,
    .material-details-grid,
    .material-builder-aside {
        grid-template-columns: minmax(0, 1fr);
    }
    .material-details-description {
        grid-column: auto;
    }
    .material-upload-main {
        align-items: flex-start;
        flex-wrap: wrap;
        padding: 1rem;
    }
    .material-file-drop__copy {
        width: calc(100% - 4.2rem);
    }
    .material-upload-browse {
        width: 100%;
        margin-left: 4.15rem;
    }
    .material-upload-requirements {
        flex-wrap: wrap;
        gap: 0.45rem 0.85rem;
        padding-right: 1rem;
        padding-left: 1rem;
    }
    .material-builder-actions {
        position: static;
        align-items: stretch;
        flex-direction: column;
    }
    .material-builder-actions__buttons {
        width: 100%;
    }
    .material-builder-actions__buttons .btn {
        flex: 1;
    }
}

/* Class roster (teacher) */
.class-roster-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.25rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #f8fbff 0%, #fff 55%);
    border: 1px solid #d4e4f4;
}
.class-roster-hero__badge {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
}
.class-roster-hero__title { margin: 0.2rem 0 0.35rem; font-size: 1.35rem; font-weight: 800; }
.class-roster-hero__meta { margin: 0; font-size: 0.875rem; }
.class-roster-hero__count {
    text-align: center;
    padding: 0.65rem 1.1rem;
    border-radius: var(--radius-lg);
    background: var(--primary-light);
    border: 1px solid rgba(15, 108, 191, 0.15);
}
.class-roster-hero__count strong { display: block; font-size: 1.75rem; font-weight: 800; color: var(--primary-dark); line-height: 1.1; }
.class-roster-hero__count span { font-size: 0.75rem; font-weight: 600; color: var(--ink-2); }
.class-roster-hero__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}
.class-roster-hero__count--active {
    background: #ecfdf3;
    border-color: rgba(34, 197, 94, 0.25);
}
.class-roster-hero__count--active strong { color: #15803d; }
.class-roster-panel { padding: 0; overflow: hidden; }
.class-roster-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.class-roster-toolbar__actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}
.class-roster-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--ink-2);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}
.class-roster-filter-chip--active,
.class-roster-filter-chip[aria-pressed="true"] {
    border-color: rgba(34, 197, 94, 0.35);
    background: #ecfdf3;
    color: #15803d;
}
.class-roster-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
}
.class-roster-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #fff;
    color: inherit;
    text-decoration: none !important;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.class-roster-card:hover {
    border-color: rgba(15, 108, 191, 0.3);
    box-shadow: var(--shadow-md);
    text-decoration: none !important;
}
.class-roster-card--active {
    border-color: rgba(34, 197, 94, 0.35);
    background: linear-gradient(90deg, #f8fff9 0%, #fff 35%);
}
.class-roster-card__chevron {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.class-roster-card__avatar { flex-shrink: 0; }
.class-roster-card__info {
    min-width: 0;
    flex: 0 1 220px;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.class-roster-card__info strong {
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.class-roster-card__info span {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.class-roster-card__meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 110px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-2);
}
.class-roster-card__last-login i { color: var(--text-muted); margin-right: 0.2rem; }
.class-roster-card__presence {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.class-roster-presence-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #cbd5e1;
    flex-shrink: 0;
}
.class-roster-presence-dot--online {
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}
.class-roster-progress {
    flex: 1 1 240px;
    min-width: 180px;
    padding: 0;
    border-top: 0;
}
.class-roster-progress__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.class-roster-progress__head strong {
    font-size: 0.8125rem;
    color: var(--primary-dark);
    text-transform: none;
    letter-spacing: 0;
}
.class-roster-progress__bar {
    height: 0.35rem;
    border-radius: 999px;
    background: #e9ecef;
    overflow: hidden;
    margin-bottom: 0.45rem;
}
.class-roster-progress__bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #3b9ae8);
    border-radius: 999px;
}
.class-roster-progress__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.75rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--ink-2);
}
.class-roster-progress__stats i { color: var(--primary); margin-right: 0.15rem; }
.class-roster-progress__grade { font-size: 0.6875rem !important; padding: 0.1rem 0.4rem !important; }

.student-progress-hero {
    padding: 1.25rem 1.35rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #f8fbff 0%, #fff 55%);
    border: 1px solid #d4e4f4;
}
.student-progress-hero__identity {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.15rem;
}
.student-progress-hero__identity h2 { margin: 0 0 0.15rem; font-size: 1.35rem; font-weight: 800; }
.student-progress-hero__avatar { flex-shrink: 0; }
.student-progress-hero__metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.student-progress-metric {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-lg);
    background: #fff;
    border: 1px solid var(--border);
}
.student-progress-metric--grade {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}
.student-progress-metric__label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.student-progress-metric__value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1.1;
}
.student-progress-metric__hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.student-progress-bar {
    height: 0.45rem;
    border-radius: 999px;
    background: #e9ecef;
    overflow: hidden;
    margin: 0.45rem 0;
}
.student-progress-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #3b9ae8);
    border-radius: 999px;
}
.student-progress-hero__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.student-progress-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-2);
}
.student-progress-chip--warn {
    background: #fff8eb;
    border-color: #f0d9a8;
    color: #856404;
}
.student-progress-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.student-progress-section { padding: 1rem 1.1rem; }
.student-progress-section__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.85rem;
    font-size: 1rem;
    font-weight: 700;
}
.student-progress-section__title i { color: var(--primary); }
.student-progress-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.student-progress-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    border-left: 3px solid #dee2e6;
}
.student-progress-item--full { border-left-color: #198754; background: #f4fbf6; }
.student-progress-item--partial { border-left-color: #f0ad4e; background: #fffdf5; }
.student-progress-item--empty { border-left-color: #dee2e6; }
.student-progress-item__main { min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.student-progress-item__main strong { font-size: 0.875rem; }
.student-progress-item__main span { font-size: 0.75rem; color: var(--text-muted); }
.student-progress-item__status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.student-progress-status {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    white-space: nowrap;
}
.student-progress-status--full { background: #d4edda; color: #155724; }
.student-progress-status--partial { background: #fff3cd; color: #856404; }
.student-progress-status--empty { background: #e9ecef; color: #6c757d; }
.student-progress-score { font-size: 0.8125rem; font-weight: 700; color: var(--ink-2); }
.mt-1 { margin-top: 1rem; }
.class-roster-note {
    margin: 0;
    padding: 0.75rem 1rem 1rem;
    font-size: 0.8125rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
}
.class-roster-note i { margin-right: 0.35rem; color: var(--primary); }
@media (max-width: 768px) {
    .class-roster-card {
        flex-wrap: wrap;
        align-items: flex-start;
    }
    .class-roster-card__info,
    .class-roster-card__meta,
    .class-roster-progress {
        flex: 1 1 100%;
    }
    .class-roster-card__chevron {
        position: absolute;
        right: 1rem;
        top: 1rem;
    }
    .class-roster-card {
        position: relative;
        padding-right: 2rem;
    }
}

.course-content-actions {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
}
.course-lessons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    padding-left: 0.15rem;
}

.course-lesson {
    border: 1px solid #dbe5f0;
    border-radius: 1.15rem;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, #f8fbff 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 10px 28px rgba(15, 48, 96, 0.06);
    transition: box-shadow 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}
.course-lesson.is-open {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.95) inset,
        0 16px 36px rgba(15, 48, 96, 0.09);
    border-color: #b8cee4;
}
.course-lesson:has(.course-lesson-add-menu:not([hidden])),
.course-lesson:has(.activity-module-info[open]) {
    overflow: visible;
    position: relative;
    z-index: 5;
}
.course-lesson--general {
    background: linear-gradient(180deg, #fffbeb 0%, #fff 100%);
    border-color: #fcd34d;
    border-style: solid;
}
.course-lesson--general .course-lesson-header {
    background: rgba(254, 243, 199, 0.35);
}
.course-lesson-header {
    display: flex;
    align-items: stretch;
    gap: 0;
    border-bottom: 1px solid transparent;
}
.course-lesson.is-open .course-lesson-header {
    border-bottom-color: var(--border);
}
.course-lesson-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 1.1rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    color: inherit;
    min-width: 0;
}
.course-lesson-toggle:hover { background: rgba(15, 108, 191, 0.04); }
.course-lesson-index {
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 0.85rem;
    background: linear-gradient(145deg, #dff0ff 0%, #cfe4fb 100%);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow:
        inset 0 0 0 1px rgba(15, 108, 191, 0.14),
        0 8px 16px rgba(15, 108, 191, 0.12);
}
.course-lesson-index--general {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #b45309;
    box-shadow: inset 0 0 0 1px rgba(180, 83, 9, 0.15);
    font-size: 0.85rem;
}
.course-lesson-heading {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
    flex: 1;
}
.course-lesson-heading strong {
    font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
    font-size: 1.08rem;
    line-height: 1.35;
    font-weight: 750;
    letter-spacing: -0.02em;
    color: #0f172a;
}
.course-lesson-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
.course-lesson-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.course-lesson-badge--material {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}
.course-lesson-badge--assignment {
    background: #fffbeb;
    border-color: #fde68a;
    color: #b45309;
}
.course-lesson-badge--quiz {
    background: #ecfeff;
    border-color: #a5f3fc;
    color: #0e7490;
}
.course-lesson-chevron {
    color: var(--text-muted);
    transition: transform 0.2s ease, color 0.15s ease;
    flex-shrink: 0;
    font-size: 0.85rem;
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--bg);
}
.course-lesson.is-open .course-lesson-chevron {
    transform: rotate(180deg);
    color: var(--primary);
    background: var(--primary-light);
}
.course-lesson-admin {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.65rem;
    border-left: 1px solid var(--border);
}
.course-lesson-admin form { display: inline; margin: 0; }
.course-lesson-admin-btn {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none !important;
}
.course-lesson-admin-btn:hover {
    background: var(--bg);
    color: var(--text);
}
.course-lesson-admin-btn--danger:hover {
    background: #fdecea;
    color: #ca3120;
}
.course-lesson-admin-btn--add {
    color: var(--primary);
}
.course-lesson-admin-btn--add:hover {
    background: var(--primary-light, #eff6ff);
    color: var(--primary);
}
.course-lesson-add {
    position: relative;
}
.course-lesson-add-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    z-index: 30;
    min-width: 11.5rem;
    padding: 0.35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    background: var(--surface, #fff);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}
.course-lesson-add-menu[hidden] {
    display: none;
}
.course-lesson-add-menu__item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: none;
    border-radius: 0.45rem;
    background: transparent;
    color: var(--text);
    font-size: 0.8125rem;
    text-align: left;
    text-decoration: none !important;
    cursor: pointer;
}
.course-lesson-add-menu__item:hover:not(:disabled) {
    background: var(--bg);
    color: var(--primary);
}
.course-lesson-add-menu__item:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.course-lesson-add-menu__item i {
    width: 1rem;
    text-align: center;
    color: var(--text-muted);
}
.course-lesson-add-menu__item:hover:not(:disabled) i {
    color: var(--primary);
}
.course-lesson-body {
    display: none;
    padding: 1rem 1.05rem 1.2rem;
    background:
        linear-gradient(180deg, rgba(236, 242, 248, 0.95) 0%, rgba(241, 245, 249, 0.75) 100%);
    border-top: 1px solid #d5e0ea;
}
.course-lesson--general .course-lesson-body {
    background: linear-gradient(180deg, #e8e0c8 0%, #f0ead8 100%);
    border-top-color: #d6c48a;
}
.course-lesson.is-open .course-lesson-body { display: block; }
.course-lesson-callout {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.75rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    font-size: 0.8125rem;
    line-height: 1.5;
}
.course-lesson-callout i {
    margin-top: 0.1rem;
    flex-shrink: 0;
}
.course-lesson-callout p { margin: 0; }
.course-lesson-desc {
    margin: 0 0 0.85rem;
    padding: 0.75rem 0.9rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.55;
}
.course-lesson-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 0.15rem 0 0;
    padding: 1rem 1.1rem;
    border: 1px dashed var(--border);
    border-radius: 0.75rem;
    background: #fff;
    color: var(--text-muted);
    font-size: 0.8125rem;
    text-align: center;
}
.course-lesson-empty i {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    flex-shrink: 0;
}
.course-lesson-empty p { margin: 0; line-height: 1.5; }
.course-lesson-empty .btn { flex-shrink: 0; }
.course-lesson-empty .btn i {
    width: auto;
    height: auto;
    border-radius: 0;
    background: transparent;
    color: inherit;
}
.course-lesson-body .activity-list { gap: 0.45rem; }
.course-lesson-body-actions {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px dashed var(--border);
}
.course-lesson-body-actions .btn {
    min-width: 9rem;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(15, 108, 191, 0.2);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.course-lesson-body-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 7px 16px rgba(15, 108, 191, 0.26);
}
.activity-list--modules {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.activity-module {
    --am-accent: var(--primary);
    --am-accent-soft: #e8f2fb;
    --am-accent-wash: rgba(15, 108, 191, 0.05);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
        "lead main"
        "media media"
        "actions actions";
    gap: 0.4rem 0.75rem;
    align-items: center;
    padding: 0.65rem 0.8rem 0.6rem;
    background:
        linear-gradient(135deg, var(--am-accent-wash) 0%, transparent 42%),
        #fff;
    border: 1px solid #e2e8f0;
    border-left: 3px solid var(--am-accent);
    border-radius: 0.7rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
    overflow: visible;
}
.activity-module--material {
    --am-accent: #0f6cbf;
    --am-accent-soft: #e7f0fa;
    --am-accent-wash: rgba(15, 108, 191, 0.06);
}
.activity-module--assignment {
    --am-accent: #d97706;
    --am-accent-soft: #fff7ed;
    --am-accent-wash: rgba(217, 119, 6, 0.07);
}
.activity-module--quiz {
    --am-accent: #0e7490;
    --am-accent-soft: #ecfeff;
    --am-accent-wash: rgba(14, 116, 144, 0.07);
}
.activity-module--quiz.activity-module--draft {
    --am-accent: #ca8a04;
    --am-accent-soft: #fef9c3;
    --am-accent-wash: rgba(202, 138, 4, 0.08);
}
.activity-module--draft {
    background:
        linear-gradient(135deg, var(--am-accent-wash) 0%, transparent 48%),
        repeating-linear-gradient(
            -12deg,
            transparent,
            transparent 10px,
            rgba(148, 163, 184, 0.035) 10px,
            rgba(148, 163, 184, 0.035) 20px
        ),
        #fff;
}
.activity-module--openable {
    position: relative;
    cursor: pointer;
}
.activity-module:hover,
.activity-module--openable:hover {
    border-color: color-mix(in srgb, var(--am-accent) 30%, #cbd5e1);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.activity-module-open-link {
    color: inherit;
    text-decoration: none;
    font-size: inherit;
}
.activity-module-open-link:hover,
.activity-module-open-link:focus-visible {
    color: var(--am-accent);
    text-decoration: none;
}
.activity-module-open-link::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}
.activity-module--openable .activity-module-actions,
.activity-module--openable .activity-module-media,
.activity-module--openable .activity-module-publish-badge {
    position: relative;
    z-index: 2;
}
.activity-module--video {
    align-items: start;
}
.activity-module--material.activity-module--video.activity-module--embed-youtube {
    --am-accent: #dc2626;
    --am-accent-soft: #fef2f2;
    --am-accent-wash: rgba(220, 38, 38, 0.06);
}
.activity-module--material.activity-module--video.activity-module--embed-gdrive {
    --am-accent: #16a34a;
    --am-accent-soft: #f0fdf4;
    --am-accent-wash: rgba(22, 163, 74, 0.07);
}
.activity-module--material.activity-module--video.activity-module--embed-canva {
    --am-accent: #0f6cbf;
    --am-accent-soft: #e7f0fa;
    --am-accent-wash: rgba(15, 108, 191, 0.07);
}
.activity-module--material.activity-module--embed-gmeet {
    --am-accent: #00897b;
    --am-accent-soft: #e0f2f1;
    --am-accent-wash: rgba(0, 137, 123, 0.12);
}
.activity-module--material.activity-module--embed-gmeet .activity-module-icon {
    background: var(--am-accent-soft);
    color: var(--am-accent);
}
.activity-module--material.activity-module--video {
    --am-accent: #dc2626;
    --am-accent-soft: #fef2f2;
    --am-accent-wash: rgba(220, 38, 38, 0.06);
}
.activity-module--material.activity-module--video .activity-module-icon {
    background: var(--am-accent-soft);
    color: var(--am-accent);
}
.activity-module-media {
    grid-area: media;
    min-width: 0;
    width: 100%;
}
.activity-module-media .material-video-embed,
.activity-card--video .material-video-embed {
    width: 80%;
    max-width: 80%;
    margin: 0.1rem auto 0;
    border-radius: 0.6rem;
    border: 1px solid #e2e8f0;
    background: #0f172a;
}
.activity-module-video-note {
    margin: 0.35rem 0 0;
    font-size: 0.75rem;
    text-align: center;
}
.activity-card--video .activity-card-icon {
    background: #fef2f2;
    color: #dc2626;
}
.activity-card--embed-youtube .activity-card-icon {
    background: #fef2f2;
    color: #dc2626;
}
.activity-card--embed-gdrive .activity-card-icon {
    background: #f0fdf4;
    color: #16a34a;
}
.activity-card--embed-canva .activity-card-icon {
    background: #e7f0fa;
    color: #0f6cbf;
}
.activity-card--embed-gmeet .activity-card-icon {
    background: #e0f2f1;
    color: #00897b;
}
.activity-card--embed-gmeet {
    border-left-color: #00897b;
    background: linear-gradient(135deg, rgba(0, 137, 123, 0.08) 0%, transparent 42%), #fff;
}
.activity-meta-chip--gmeet {
    color: #00897b;
    border-color: #99d5cf;
    background: #e0f2f1;
}
.activity-card--video .activity-module-video,
.activity-card--video .material-video-embed {
    margin-top: 0.55rem;
}
.activity-module-leading {
    grid-area: lead;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
}
.activity-module-icon {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 0.55rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
    background: var(--am-accent-soft);
    color: var(--am-accent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--am-accent) 14%, transparent);
    transition: background 0.15s ease;
}
.activity-module:hover .activity-module-icon {
    background: color-mix(in srgb, var(--am-accent-soft) 70%, #fff);
}
.activity-module-type {
    font-size: 0.58rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: color-mix(in srgb, var(--am-accent) 70%, #64748b);
    text-align: center;
    line-height: 1.15;
    max-width: 4rem;
}
.activity-module-main {
    grid-area: main;
    min-width: 0;
}
.activity-module-main h3 {
    font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: #0f172a;
    margin: 0;
    line-height: 1.3;
}
.activity-module-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.activity-module-title-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}
.activity-module-title-row h3 {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.activity-module-info {
    position: relative;
    flex: 0 0 auto;
}
.activity-module:has(.activity-module-info[open]) {
    position: relative;
    z-index: 6;
}
.activity-module-info-btn {
    list-style: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: #64748b;
    cursor: pointer;
    font-size: 0.72rem;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.activity-module-info-btn::-webkit-details-marker { display: none; }
.activity-module-info-btn::marker { content: ''; }
.activity-module-info-btn:hover,
.activity-module-info[open] .activity-module-info-btn {
    color: var(--primary);
    border-color: rgba(15, 108, 191, 0.35);
    background: #f0f7ff;
}
.activity-module-info-panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.3rem;
    min-width: 13rem;
    max-width: min(20rem, 80vw);
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    background: #fff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
}
.activity-module-info-panel .activity-meta-chip {
    justify-content: flex-start;
    width: 100%;
    margin: 0;
    white-space: normal;
}
.activity-module-info-panel .activity-meta-chip + .activity-meta-chip::before {
    content: none;
    margin: 0;
}
.activity-module-actions {
    grid-area: actions;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem 0.55rem;
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 0.45rem 0 0;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
}
.activity-module-actions--quiz {
    justify-content: flex-end;
}
.activity-module-move {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    flex: 1 1 10rem;
    min-width: 0;
    max-width: 14rem;
}
.activity-module-move-label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    font-size: 0;
    color: var(--text-muted);
}
.activity-module-move-label i {
    font-size: 0.7rem;
}
.activity-module-move-select {
    min-width: 0;
    width: 100%;
    height: 1.85rem;
    font-size: 0.72rem;
    border-radius: 0.45rem;
    background: #f8fafc;
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
}
.activity-module-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.15rem;
    border-radius: 0.55rem;
    background: #f8fafc;
    border: 1px solid #e8edf3;
}
.activity-module-buttons .btn-sm {
    padding: 0.28rem 0.55rem;
    min-height: 1.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    white-space: nowrap;
    border-radius: 0.45rem;
    font-size: 0.75rem;
    font-weight: 650;
    box-shadow: none;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.activity-module-buttons .btn-sm:hover {
    transform: none;
    box-shadow: none;
}
.activity-module-buttons .btn-primary {
    box-shadow: none;
}
.activity-module-buttons form { display: inline-flex; margin: 0; }
.activity-module-publish-badge {
    flex: 0 0 auto;
}
.activity-module .quiz-status-badge {
    box-shadow: none;
    font-size: 0.65rem;
    padding: 0.18rem 0.45rem;
}
.activity-module-publish-form .btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.activity-module--quiz {
    padding: 0.65rem 0.8rem 0.6rem;
    gap: 0.4rem 0.75rem;
}
.activity-module--quiz .activity-module-icon {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 0.55rem;
    font-size: 0.85rem;
}
.activity-module--quiz .activity-module-type {
    font-size: 0.58rem;
}
.activity-module--quiz .activity-module-publish-badge {
    gap: 0.22rem;
    padding: 0.16rem 0.45rem;
    font-size: 0.62rem;
}
.activity-module-buttons--quiz .activity-module-publish-button {
    min-width: 0;
}
.activity-module-buttons--quiz .activity-module-icon-button {
    width: 1.85rem;
    min-width: 1.85rem;
    min-height: 1.85rem;
    padding-left: 0;
    padding-right: 0;
    border: 1px solid var(--border);
    background: #fff;
}
.activity-module-buttons--quiz .activity-module-delete-button {
    color: #dc2626;
}
.activity-module-buttons--quiz .activity-module-delete-button:hover {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

@media (max-width: 680px) {
    .activity-module {
        padding: 0.6rem 0.7rem;
        gap: 0.35rem 0.55rem;
    }
    .activity-module-title-row {
        flex-wrap: wrap;
        gap: 0.3rem 0.4rem;
    }
    .activity-module-title-row h3 {
        flex: 1 1 calc(100% - 6rem);
        white-space: normal;
    }
    .activity-module-info-panel {
        right: auto;
        left: 0;
    }
    .activity-module-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .activity-module-move {
        width: 100%;
        max-width: none;
        flex: none;
    }
    .activity-module-buttons {
        width: 100%;
        justify-content: flex-start;
    }
    .activity-module-buttons--quiz .activity-module-publish-form,
    .activity-module-buttons--quiz .activity-module-publish-button {
        flex: 1;
    }
    .activity-module-btn-label {
        display: none;
    }
}

.activity-module-meta .activity-meta-chip {
    font-size: 0.6875rem;
    padding: 0.15rem 0.45rem;
}

.course-form-sheet-badge.section { background: #eef2ff; color: #4338ca; }

.course-content-section {
    background:
        linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
    border: 1px solid #dbe5f0;
    border-radius: 1.2rem;
    padding: 1.4rem 1.55rem 1.5rem;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 12px 30px rgba(15, 48, 96, 0.06);
}
.course-content-section--full { max-width: none; }
.course-content-header {
    display: block;
    margin-bottom: 1.2rem;
    padding-bottom: 1.05rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
}
.course-content-intro {
    min-width: 0;
}
.course-content-intro__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    flex-wrap: wrap;
}
.course-content-intro__titles {
    min-width: 0;
    flex: 1 1 12rem;
}
.course-content-intro h2 {
    font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
    font-size: 1.28rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0.15rem 0 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #0f172a;
}
.course-content-intro h2 i {
    display: grid;
    place-items: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 0.55rem;
    background: #e8f2fb;
    color: var(--primary);
    font-size: 0.85rem;
}
.course-content-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}
.course-content-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 600;
}
.course-content-stat i {
    color: var(--primary);
    font-size: 0.7rem;
}
.course-content-stat--muted {
    color: var(--text-muted);
}
.course-content-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    flex-shrink: 0;
    margin-left: auto;
    align-self: flex-start;
}
.course-lessons-toggle {
    white-space: nowrap;
}
.course-content-summary {
    margin: 0.45rem 0 0.65rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
    max-width: 40rem;
}
.course-content-header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.course-content-header h2 i { color: var(--primary); }
.course-content-count {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg);
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
}
.course-content-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.course-empty {
    text-align: center;
    padding: 2.5rem 1.5rem;
}
.course-empty-icon {
    width: 64px; height: 64px;
    margin: 0 auto 1rem;
    border-radius: 1rem;
    background: var(--primary-light);
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.75rem;
}
.course-empty h3 { margin-bottom: 0.35rem; font-size: 1.1rem; }
.course-empty p { color: var(--text-muted); max-width: 360px; margin: 0 auto 1.25rem; font-size: 0.9375rem; }
.course-empty-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }

.activity-list { display: flex; flex-direction: column; gap: 0.65rem; }
.activity-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "icon body";
    column-gap: 1rem;
    row-gap: 0.75rem;
    align-items: start;
    padding: 1.1rem 1.2rem 1.05rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.activity-card:has(.activity-card-actions) {
    grid-template-areas:
        "icon body"
        "icon actions";
}
.activity-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}
.activity-card--material { border-left: 4px solid var(--primary); }
.activity-card--assignment { border-left: 4px solid #c9a227; }
.activity-card--quiz { border-left: 4px solid #08799c; }
.activity-card-icon {
    grid-area: icon;
    width: 44px; height: 44px;
    border-radius: 0.625rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
    margin-top: 0.1rem;
}
.activity-card--material .activity-card-icon { background: #e7f0fa; color: var(--primary); }
.activity-card--assignment .activity-card-icon { background: #fff3cd; color: #856404; }
.activity-card--quiz .activity-card-icon { background: #d1ecf1; color: #0c5460; }
.activity-card-body { grid-area: body; min-width: 0; }
.activity-card-type {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}
.activity-card-body h3 {
    font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin: 0 0 0.35rem;
    line-height: 1.3;
}
.activity-card-body p { font-size: 0.875rem; color: var(--text-muted); margin: 0 0 0.35rem; line-height: 1.5; }
.activity-card-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.activity-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    text-decoration: none;
}
.activity-meta-chip:not(.muted):hover { border-color: var(--primary); color: var(--primary); }
.activity-card-actions {
    grid-area: actions;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    justify-self: end;
    align-self: end;
    width: 100%;
    margin-top: 0.15rem;
    padding-top: 0.7rem;
    border-top: 1px solid rgba(226, 232, 240, 0.95);
}
.activity-card-actions form { display: inline; }
.activity-card-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 2.75rem;
    padding: 0.7rem 1.35rem;
    border-radius: 0.8rem;
    font-size: 0.95rem;
    font-weight: 750;
    letter-spacing: -0.01em;
    box-shadow: 0 8px 18px rgba(15, 108, 191, 0.22);
}
.activity-card-cta.btn-secondary,
.activity-card-cta--secondary {
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    min-height: 2.55rem;
    padding: 0.55rem 1rem;
    font-size: 0.875rem;
}
.activity-card-cta:not(:disabled):hover {
    transform: translateY(-1px);
}
@media (max-width: 640px) {
    .activity-card {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas:
            "icon body"
            "actions actions";
        gap: 0.3rem 0.65rem;
        align-items: start;
        padding: 0.55rem 0.7rem;
        border-radius: 0.7rem;
    }
    .activity-card-icon {
        grid-area: icon;
        width: 1.85rem;
        height: 1.85rem;
        border-radius: 0.45rem;
        font-size: 0.8rem;
        margin-top: 0.1rem;
    }
    .activity-card-body {
        grid-area: body;
        min-width: 0;
    }
    .activity-card-type {
        display: inline;
        margin: 0 0.35rem 0 0;
        font-size: 0.625rem;
        vertical-align: middle;
    }
    .activity-card-body h3 {
        display: inline;
        margin: 0;
        font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
        font-size: 1.05rem;
        font-weight: 700;
        letter-spacing: -0.02em;
        line-height: 1.3;
        vertical-align: middle;
    }
    .activity-card-body p {
        margin: 0.15rem 0 0;
        font-size: 0.75rem;
        line-height: 1.35;
    }
    .activity-card-meta {
        margin-top: 0.2rem;
        gap: 0;
        row-gap: 0.15rem;
    }
    .activity-meta-chip {
        gap: 0.2rem;
        padding: 0;
        border: none;
        background: transparent;
        font-size: 0.6875rem;
        font-weight: 600;
        line-height: 1.3;
    }
    .activity-meta-chip i {
        font-size: 0.65rem;
        opacity: 0.85;
    }
    .activity-meta-chip + .activity-meta-chip::before,
    .activity-meta-chip + .badge::before {
        content: '·';
        margin: 0 0.35rem;
        color: var(--text-muted);
        font-weight: 700;
    }
    .activity-card-meta .badge {
        font-size: 0.625rem;
        padding: 0.12rem 0.4rem;
        vertical-align: middle;
    }
    .activity-card-actions {
        grid-area: actions;
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        justify-content: stretch;
        gap: 0.45rem;
        margin-top: 0.15rem;
        padding-top: 0.55rem;
        border-top: 1px solid rgba(226, 230, 234, 0.9);
    }
    .activity-card-actions .btn-sm,
    .activity-card-cta {
        flex: 1 1 auto;
        width: auto;
        min-height: 2.55rem;
        justify-content: center;
        padding: 0.55rem 0.85rem;
        font-size: 0.875rem;
    }
}

.course-page-header h2 { font-size: 1.5rem; font-weight: 700; margin: 0.35rem 0 0; color: #fff; }
.course-page-meta { font-size: 0.875rem; opacity: 0.9; margin: 0.15rem 0 0; }
.course-page-desc { margin-top: 0.75rem; opacity: 0.95; max-width: 640px; line-height: 1.55; }

.course-toolbar .panel-header,
.course-toolbar h2 { font-size: 1rem; margin-bottom: 0.75rem; }
.course-add-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.course-module-list { list-style: none; margin: 0; padding: 0; }
.course-module-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}
.course-module-item:last-child { border-bottom: none; }
.course-module-icon {
    width: 40px; height: 40px; border-radius: 0.5rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 1rem;
}
.course-module-icon.material { background: #e7f0fa; color: var(--primary); }
.course-module-icon.assignment { background: #fff3cd; color: #856404; }
.course-module-icon.quiz { background: #d1ecf1; color: #0c5460; }
.course-module-body { flex: 1; min-width: 0; }
.course-module-body strong { display: block; font-size: 1rem; margin-bottom: 0.2rem; }
.course-module-type {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}
.course-module-body p { font-size: 0.875rem; margin: 0.25rem 0; }
.course-module-meta {
    display: flex; flex-wrap: wrap; gap: 0.65rem 1rem;
    font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.35rem;
}
.course-module-meta a { font-weight: 600; text-decoration: none; }
.course-module-actions {
    display: flex; flex-wrap: wrap; gap: 0.35rem;
    align-items: flex-start; flex-shrink: 0;
}
@media (max-width: 768px) {
    .course-module-item { flex-direction: column; }
    .course-module-actions { width: 100%; }
}

.course-card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff; padding: 1rem 1.25rem;
}
.lms-course-card .course-card-header {
    position: relative;
    min-height: 7.5rem;
    padding: 0;
    background-color: var(--primary-dark);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}
.lms-course-card .course-card-header-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.15) 0%, rgba(0,0,0,.55) 100%);
    pointer-events: none;
}
.lms-course-card:not(.course-card-has-cover) .course-card-header-overlay {
    background: linear-gradient(135deg, rgba(13,110,253,.85) 0%, rgba(10,88,202,.92) 100%),
        linear-gradient(180deg, rgba(0,0,0,.1) 0%, rgba(0,0,0,.35) 100%);
}
.lms-course-card.course-card-has-cover .course-card-header-overlay {
    background: linear-gradient(180deg, rgba(0,0,0,.05) 0%, rgba(0,0,0,.65) 100%);
}
.lms-course-card .course-card-header-content {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 1.1rem 1.25rem 1.15rem;
}
.lms-course-card .course-card-badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(255,255,255,.2);
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    margin-bottom: 0.4rem;
    backdrop-filter: blur(4px);
}
.lms-course-card .course-card-header h3 {
    font-size: 1.0625rem;
    font-weight: 700;
    margin: 0 0 0.35rem;
    line-height: 1.25;
    text-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.lms-course-card .course-card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.lms-course-card .course-card-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255,255,255,.18);
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    backdrop-filter: blur(4px);
}
.lms-course-card .course-card-chip i { font-size: 0.65rem; opacity: 0.9; }
.lms-course-card .course-card-teacher {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.4rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted, #6c757d);
}
.lms-course-card .course-card-teacher i { font-size: 0.75rem; opacity: 0.85; }
.lms-course-card .course-card-desc { font-size: 0.875rem; margin: 0; }
.course-card-header h3 { font-size: 1rem; margin-bottom: 0.15rem; }
.course-card-header small { opacity: 0.85; font-size: 0.8125rem; }
.course-card-body { padding: 1rem 1.25rem; }
.course-card-actions {
    display: flex; flex-wrap: wrap; gap: 0.5rem;
    padding: 0 1.25rem 1rem;
}

/* Course appearance & admin cover upload */
.course-settings-modal {
    max-width: 480px;
    max-height: min(90vh, 640px);
    overflow-y: auto;
}
.course-settings-modal-intro {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}
.course-settings-section-title {
    font-size: 0.9375rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.course-settings-section-desc { margin-bottom: 1rem; font-size: 0.875rem; }
.course-metadata-section { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.course-metadata-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-bottom: 0.35rem; }
.course-metadata-status-hint { font-size: 0.8rem; margin: 0 0 0.75rem; line-height: 1.45; }
.course-metadata-status__badge {
    display: inline-flex; padding: 0.2rem 0.55rem; border-radius: 999px;
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.course-metadata-status__badge--ready { background: #dcfce7; color: #166534; }
.course-metadata-status__badge--stale { background: #fef3c7; color: #92400e; }
.course-metadata-status__badge--missing { background: #f1f5f9; color: #475569; }
.course-metadata-status__badge--pending { background: #e0f2fe; color: #075985; }
.course-metadata-status__badge--empty { background: #f1f5f9; color: #475569; }
.course-metadata-status__badge--error { background: #fee2e2; color: #991b1b; }
.course-metadata-status__time { font-size: 0.78rem; }
.course-metadata-suggested { margin-bottom: 0.85rem; }
.course-metadata-suggested__preview { margin: 0.25rem 0 0; font-size: 0.85rem; }
.course-metadata-topics { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.85rem; }
.course-metadata-topic {
    display: inline-flex; padding: 0.2rem 0.5rem; border-radius: 999px;
    background: #eff6ff; color: #1d4ed8; font-size: 0.72rem; font-weight: 600;
}
.course-metadata-form .form-group { margin-bottom: 0.85rem; }
.course-metadata-apply { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; margin-bottom: 0.75rem; }
.course-metadata-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.35rem; }
.course-metadata-hint { font-size: 0.8rem; margin: 0 0 0.5rem; }
.course-metadata-rebuild { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.75rem; }
.course-metadata-rebuild-note { font-size: 0.75rem; }
.course-appearance-preview {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1rem;
    max-width: 320px;
}
.course-appearance-preview-card {
    width: 100%;
    pointer-events: none;
    box-shadow: var(--shadow);
}
.course-appearance-preview-note { font-size: 0.8125rem; }
.course-appearance-form { max-width: 28rem; }
.course-cover-file-preview {
    margin-bottom: 0.85rem;
}
.course-cover-file-preview-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}
.course-cover-file-preview-frame {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
    aspect-ratio: 2 / 1;
    max-height: 10rem;
}
.course-cover-file-preview-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.course-cover-file-preview[hidden] { display: none !important; }
.course-appearance-remove { margin-top: 0.75rem; }

.class-cover-details { position: relative; }
.class-cover-summary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    list-style: none;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
}
.class-cover-summary::-webkit-details-marker { display: none; }
.class-cover-thumb {
    display: block;
    width: 3.5rem;
    height: 2rem;
    border-radius: 0.25rem;
    background-size: cover;
    background-position: center;
    border: 1px solid var(--border);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.class-cover-upload-panel {
    position: absolute;
    z-index: 20;
    right: 0;
    top: calc(100% + 0.35rem);
    width: min(18rem, 70vw);
    padding: 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 0.5rem 1.25rem rgba(0,0,0,.12);
}
.class-cover-upload-panel .class-cover-preview {
    margin-bottom: 0.75rem;
    pointer-events: none;
}
.class-cover-upload-panel .course-card-header { min-height: 5rem; }
.class-cover-remove { margin-top: 0.5rem; }
.activity-link {
    display: inline-flex; align-items: center; gap: 0.35rem;
    font-size: 0.8125rem; padding: 0.35rem 0.65rem;
    background: var(--bg); border-radius: var(--radius);
    color: var(--text); text-decoration: none; border: 1px solid var(--border);
}
.activity-link:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; border-color: var(--primary); }
.activity-link i { color: var(--primary); }

/* Empty state */
.admin-empty-state {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}
.admin-empty-icon {
    width: 4rem; height: 4rem; border-radius: 50%;
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; margin: 0 auto 1rem;
}
.admin-empty-state h3 { margin-bottom: 0.35rem; font-size: 1.125rem; font-weight: 700; }
.admin-empty-state p { color: var(--text-muted); margin-bottom: 1.25rem; max-width: 28rem; margin-left: auto; margin-right: auto; }

.empty-state {
    text-align: center; padding: 2.5rem 1.5rem;
    background: var(--surface); border: 1px dashed var(--border);
    border-radius: var(--radius-lg); color: var(--text-muted);
    box-shadow: var(--shadow);
}
.empty-state i { font-size: 2.5rem; color: var(--border); margin-bottom: 0.75rem; }
.empty-state h3 { color: var(--text); margin-bottom: 0.35rem; }

/* Quick action tiles */
.action-tiles {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.85rem;
}
.action-tile {
    display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
    padding: 1.35rem 0.85rem; background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    text-decoration: none !important; color: var(--text);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    font-weight: 600; font-size: 0.875rem;
}
.action-tile:hover {
    background: var(--primary-light); border-color: rgba(15, 108, 191, 0.3);
    color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px);
}
.action-tile i {
    font-size: 1.35rem; color: var(--primary);
    width: 2.5rem; height: 2.5rem; border-radius: var(--radius);
    background: var(--surface); display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow);
}

/* Public pages */
.public-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-width: 0; }
.logo {
    display: inline-flex; align-items: center; gap: 0.65rem;
    text-decoration: none;
    min-width: 0;
    flex-shrink: 1;
}
.logo:hover { text-decoration: none; opacity: 0.92; }
.logo-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    line-height: 0;
}
.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    white-space: nowrap;
}
.logo-text-edu { color: var(--primary-dark); }
.logo-text-platform { color: var(--primary); }
.site-logo {
    display: block;
    width: auto;
    object-fit: contain;
}
.site-logo--header-mark {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: contain;
    object-position: center;
}
.site-logo--header { height: 2.5rem; }
.site-logo--footer { height: 2.25rem; filter: brightness(0) invert(1); }
.site-logo--navbar { height: 1.85rem; }
.site-logo--loader { height: 2.5rem; margin: 0 auto; }
.site-logo--auth-panel { height: 3.25rem; margin-bottom: 1.25rem; }
.auth-panel-school-logo {
    width: 7.5rem;
    height: 7.5rem;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.92);
    background: #fff;
    padding: 0.7rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
}
.auth-panel-school-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}
.auth-panel-school-avatar {
    width: 7.5rem;
    height: 7.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    font-weight: 800;
    color: #fff;
    background: rgba(255, 255, 255, 0.18);
    border: 4px solid rgba(255, 255, 255, 0.92);
    margin-bottom: 1.5rem;
    flex-shrink: 0;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
}
.public-nav { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; flex-shrink: 0; }
.public-nav-register { flex-shrink: 0; }
.nav-link {
    padding: 0.45rem 0.85rem; border-radius: var(--radius);
    color: var(--text); font-weight: 500; font-size: 0.875rem;
    text-decoration: none;
}
.nav-link:hover { background: var(--bg); color: var(--primary); text-decoration: none; }

.public-footer {
    background: var(--text);
    color: rgba(255, 255, 255, 0.75);
    padding: 3rem 0 2rem;
    font-size: 0.875rem;
}
.footer-inner { display: grid; gap: 1.5rem; }
.footer-brand .logo { color: #fff; margin-bottom: 0.5rem; }
.footer-brand p { max-width: 280px; line-height: 1.6; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; }
.footer-links a { color: rgba(255, 255, 255, 0.85); text-decoration: none; font-weight: 500; }
.footer-links a:hover { color: #fff; text-decoration: underline; }
.footer-copy { color: rgba(255, 255, 255, 0.5); font-size: 0.8125rem; margin-top: 0.5rem; }
.footer-version { color: rgba(255, 255, 255, 0.4); font-size: 0.75rem; margin-top: 0.25rem; }
@media (min-width: 768px) {
    .footer-inner { grid-template-columns: 1.5fr 1fr; align-items: start; }
    .footer-copy,
    .footer-version { grid-column: 1 / -1; }
}

/* Legacy hero (auth pages) */
.hero { text-align: center; padding: 4rem 1rem 3rem; }
.hero h1 { font-size: 2.25rem; margin-bottom: 0.75rem; color: var(--text); }
.hero p { color: var(--text-muted); font-size: 1.0625rem; max-width: 560px; margin: 0 auto 2rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ===== Landing page ===== */
.landing-page { background: #f4f7fb; }
.landing-main { max-width: none; padding: 0; }

.landing-flash { padding-top: 1rem; }

.landing-hero {
    position: relative;
    overflow: hidden;
    padding: 3rem 0 2.75rem;
    background: #eef4fb url('../img/bg.jpg') center 40% / cover no-repeat;
}
.landing-hero-decor {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.landing-hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.45;
    animation: landingOrbDrift 18s ease-in-out infinite;
}
.landing-hero-orb--1 {
    width: 280px;
    height: 280px;
    top: -8%;
    right: 12%;
    background: rgba(15, 108, 191, 0.35);
}
.landing-hero-orb--2 {
    width: 220px;
    height: 220px;
    bottom: 5%;
    left: 8%;
    background: rgba(8, 121, 156, 0.28);
    animation-delay: -6s;
}
.landing-hero-orb--3 {
    width: 160px;
    height: 160px;
    top: 40%;
    right: 35%;
    background: rgba(15, 108, 191, 0.2);
    animation-delay: -12s;
}
@keyframes landingOrbDrift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(12px, -16px) scale(1.05); }
    66% { transform: translate(-8px, 10px) scale(0.95); }
}
.landing-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.35) 100%),
        linear-gradient(90deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.45) 48%, rgba(255, 255, 255, 0.12) 100%);
    z-index: 0;
}
.landing-hero-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}
.landing-hero-grid {
    display: grid;
    gap: 1.5rem;
    align-items: center;
}
@media (min-width: 992px) {
    .landing-hero {
        min-height: clamp(440px, 52vh, 580px);
        padding: 5rem 0 4.5rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .landing-hero-grid {
        grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
        gap: 2rem;
        align-items: center;
    }
    .landing-hero-shell { padding: 0 2rem; }
}

.landing-hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0;
}

.landing-badge {
    display: inline-flex; align-items: center; gap: 0.4rem;
    width: fit-content;
    padding: 0.45rem 1rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 108, 191, 0.2);
    border-radius: 999px;
    font-size: 0.6875rem; font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(15, 108, 191, 0.08);
}
.landing-badge i {
    font-size: 0.625rem;
    animation: landingSparkle 2.5s ease-in-out infinite;
}
@keyframes landingSparkle {
    0%, 100% { opacity: 1; transform: rotate(0deg); }
    50% { opacity: 0.7; transform: rotate(12deg); }
}
.landing-hero-copy h1 {
    font-size: clamp(1.85rem, 4vw, 2.75rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.04em;
    color: var(--text);
    margin-bottom: 0.75rem;
}
.text-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, #08799c 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.text-gradient--animated {
    background-size: 200% auto;
    animation: landingGradientShift 6s ease-in-out infinite;
}
@keyframes landingGradientShift {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}
.landing-lead {
    font-size: clamp(0.9375rem, 1.8vw, 1.0625rem);
    color: var(--ink-2);
    line-height: 1.55;
    margin-bottom: 1.15rem;
    max-width: 52ch;
}
.landing-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}
.landing-hero-btn-primary {
    box-shadow: 0 6px 20px rgba(15, 108, 191, 0.35);
    padding: 0.65rem 1.25rem;
    transition: box-shadow 0.25s, transform 0.25s, background 0.2s;
}
.landing-hero-btn-primary:hover {
    box-shadow: 0 10px 28px rgba(15, 108, 191, 0.45);
    text-decoration: none;
    transform: translateY(-2px);
}
.landing-hero-btn-secondary,
.landing-hero-btn-tertiary {
    background: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    border: 1px solid rgba(15, 108, 191, 0.15);
    padding: 0.65rem 1.15rem;
    transition: background 0.2s, border-color 0.2s, transform 0.25s, box-shadow 0.25s;
}
.landing-hero-btn-secondary:hover,
.landing-hero-btn-tertiary:hover {
    background: #fff;
    border-color: var(--primary);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(15, 108, 191, 0.12);
}

.landing-hero-panel {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.65rem;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 0.85rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
    transition: box-shadow 0.3s, transform 0.3s;
}
.landing-hero-panel:hover {
    box-shadow: 0 16px 40px rgba(15, 108, 191, 0.14);
}
.hero-panel-grid .hero-panel-card:hover {
    border-color: rgba(15, 108, 191, 0.25);
}
@media (min-width: 992px) {
    .landing-hero-panel {
        padding: 0.75rem;
        max-width: 280px;
        justify-self: end;
    }
}
.hero-panel-card--featured {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.65rem 0.75rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 0.65rem;
    color: #fff;
}
.hero-panel-icon {
    width: 1.75rem; height: 1.75rem; flex-shrink: 0;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.18);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
}
.hero-panel-card--featured strong {
    display: block;
    font-size: 0.8125rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
}
.hero-panel-card--featured p {
    margin: 0;
    font-size: 0.6875rem;
    line-height: 1.4;
    opacity: 0.92;
}
.hero-panel-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
}
.hero-panel-grid .hero-panel-card {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.55rem;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text);
}
.hero-panel-grid .hero-panel-card i {
    width: 1.35rem; height: 1.35rem;
    border-radius: 0.35rem;
    background: var(--primary-light);
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.625rem;
    flex-shrink: 0;
}
.btn-lg { padding: 0.75rem 1.35rem; font-size: 1rem; border-radius: 0.625rem; }
.btn-ghost {
    background: rgba(255, 255, 255, 0.85);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.btn-ghost:hover { background: #fff; border-color: var(--primary); color: var(--primary); text-decoration: none; }

/* Hero visual cards (hidden when photo background is used) */
.landing-hero-visual {
    position: relative;
    min-height: 320px;
    display: none;
}

.hero-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(15, 108, 191, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(8px);
}
.hero-card-main {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(100%, 320px);
    padding: 1.25rem 1.35rem;
    display: flex; align-items: center; gap: 1rem;
    animation: heroFloat 6s ease-in-out infinite;
}
.hero-card-icon {
    width: 48px; height: 48px; border-radius: 0.75rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; flex-shrink: 0;
}
.hero-card-main strong { display: block; font-size: 0.9375rem; margin-bottom: 0.15rem; }
.hero-card-main small { color: var(--text-muted); font-size: 0.8125rem; }

.hero-card-float {
    position: absolute;
    padding: 0.65rem 1rem;
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.8125rem; font-weight: 600; color: var(--text);
    white-space: nowrap;
}
.hero-card-float i { color: var(--primary); }
.hero-card-1 { top: 8%; right: 0; animation: heroFloat 5s ease-in-out infinite 0.5s; }
.hero-card-2 { bottom: 12%; left: 0; animation: heroFloat 5.5s ease-in-out infinite 1s; }
.hero-card-3 { top: 18%; left: 5%; animation: heroFloat 6.5s ease-in-out infinite 1.5s; }

@keyframes heroFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.hero-card-main { animation-name: heroFloatMain; }
@keyframes heroFloatMain {
    0%, 100% { transform: translate(-50%, -50%); }
    50% { transform: translate(-50%, calc(-50% - 8px)); }
}

/* Schools section */
.landing-section-head { text-align: center; max-width: 640px; margin: 0 auto 2.5rem; }
.landing-section-head h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}
.landing-section-head h2 i { color: var(--primary); margin-right: 0.35rem; }
.landing-section-head p { color: var(--text-muted); font-size: 1rem; }

.landing-page .container.landing-section-container {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}
@media (min-width: 992px) {
    .landing-page .container.landing-section-container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

.landing-page .public-header .container {
    max-width: 1280px;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}
@media (min-width: 992px) {
    .landing-page .public-header .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

.schools-section {
    position: relative;
    padding: 1.25rem 0 3.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}
.schools-section-decor {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 70% 50% at 100% 0%, rgba(15, 108, 191, 0.07) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 0% 100%, rgba(8, 121, 156, 0.05) 0%, transparent 50%);
}
.schools-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #08799c 45%, transparent);
    opacity: 0.55;
}
.schools-section-header {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem 2rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(226, 230, 234, 0.85);
}
.schools-section-head {
    display: block;
    text-align: left;
    max-width: none;
    margin: 0;
    flex: 1 1 auto;
    min-width: min(100%, 18rem);
}
.schools-section-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem;
}
.schools-section-head h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    font-weight: 700;
    margin-bottom: 0;
    color: var(--text);
}
.schools-section-head h2 i {
    color: var(--primary);
    font-size: 0.85em;
}
.schools-section-header .schools-search-wrap {
    margin-bottom: 0;
    flex: 1 1 auto;
    max-width: 24rem;
    min-width: min(100%, 16rem);
}
.schools-section-header .schools-search { max-width: none; }

.schools-search-wrap { margin-bottom: 1.5rem; }
.schools-section-header + .schools-browse,
.schools-section-header + .school-continue-hero,
.schools-section-header + .school-grid,
.schools-section-header + .school-carousel-wrap,
.schools-section-header + .landing-empty,
.schools-section-header + .empty-state { margin-top: 0; }
.schools-search {
    position: relative;
    max-width: 32rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.schools-search:focus-within {
    border-color: rgba(15, 108, 191, 0.35);
    box-shadow: 0 4px 16px rgba(15, 108, 191, 0.1);
}
.schools-search > .fa-magnifying-glass {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}
.schools-search .schools-search-input {
    width: 100%;
    padding: 0.8rem 1.25rem 0.8rem 2.75rem;
    border: none;
    background: transparent;
    border-radius: 999px;
    font-size: 0.9375rem;
    transition: none;
}
.schools-search .schools-search-input:focus {
    outline: none;
    box-shadow: none;
}
.schools-search-empty { margin-top: 0.5rem; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Last-login continue hero — top banner on desktop, compact card on mobile */
.school-continue-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 1.25rem;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    margin-bottom: 1.25rem;
}
.school-continue-hero-media {
    position: relative;
    height: 9.5rem;
    flex-shrink: 0;
    background: var(--primary);
}
.school-continue-hero-cover {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: var(--primary);
}
.school-continue-hero-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.12) 0%, rgba(15, 23, 42, 0.55) 100%);
    pointer-events: none;
}
.school-continue-hero-status {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    z-index: 2;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
}
.school-continue-hero-cover .badge-active {
    background: rgba(212, 237, 218, 0.95);
    color: #155724;
}
.school-continue-hero-cover .badge-pending {
    background: rgba(255, 243, 205, 0.95);
    color: #856404;
}
.school-continue-hero-cover .badge-suspended {
    background: rgba(226, 230, 234, 0.95);
    color: #495057;
}
.school-continue-hero-cover .badge-rejected {
    background: rgba(248, 215, 218, 0.95);
    color: #721c24;
}
.school-continue-hero-avatar {
    position: absolute;
    left: 1.75rem;
    bottom: 0;
    transform: translateY(50%);
    z-index: 3;
    width: 6.5rem;
    height: 6.5rem;
    border-radius: 50%;
    border: 4px solid var(--surface);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    font-weight: 800;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.28);
}
.school-continue-hero-avatar.school-avatar--image {
    padding: 0;
    overflow: hidden;
    background: var(--surface);
}
.school-continue-hero-avatar .school-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.school-continue-hero-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 19rem);
    grid-template-areas:
        "identity cta"
        "notes cta";
    gap: 0.75rem 1.75rem;
    align-items: start;
    padding: 1.35rem 1.5rem 1.5rem;
    padding-left: 9.5rem;
    min-width: 0;
}
.school-continue-hero-body:not(:has(.school-continue-hero-cta)) {
    grid-template-columns: 1fr;
    grid-template-areas:
        "identity"
        "notes";
}
.school-continue-hero-identity {
    grid-area: identity;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.65rem;
    min-width: 0;
    padding-top: 0.15rem;
}
.school-continue-hero-identity-main {
    min-width: 0;
}
.school-continue-hero-notes {
    grid-area: notes;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.5rem;
    min-width: 0;
}
.school-continue-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    margin: 0.4rem 0 0;
    padding: 0.22rem 0.55rem;
    width: fit-content;
    max-width: 100%;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary-dark);
    background: var(--primary-light);
    border-radius: 999px;
    line-height: 1.3;
}
.school-continue-hero-name {
    margin: 0;
    font-size: clamp(1.4rem, 2.2vw, 1.85rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text);
}
.school-continue-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.school-continue-hero-meta li {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    max-width: 100%;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.3;
}
.school-continue-hero-meta i {
    color: var(--primary);
    flex-shrink: 0;
    font-size: 0.7rem;
}
.school-continue-hero-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.school-continue-hero-blurb {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 34rem;
}
.school-continue-hero-page-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: fit-content;
    font-size: 0.875rem;
    font-weight: 650;
    color: var(--primary);
    text-decoration: none;
}
.school-continue-hero-page-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}
.school-continue-hero-cta {
    grid-area: cta;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
    align-self: stretch;
    padding: 1.15rem 1.2rem;
    border-radius: 1rem;
    background:
        linear-gradient(165deg, rgba(15, 108, 191, 0.09) 0%, rgba(15, 108, 191, 0.03) 100%);
    border: 1px solid rgba(15, 108, 191, 0.14);
}
.school-continue-hero-cta-copy h4 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
}
.school-continue-hero-cta-copy p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.45;
}
.school-continue-hero-code {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.55rem 0.75rem;
    border-radius: 0.65rem;
    background: var(--surface);
    border: 1px dashed rgba(15, 108, 191, 0.28);
}
.school-continue-hero-code-label {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.school-continue-hero-code code {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--primary-dark);
    word-break: break-all;
    line-height: 1.3;
}
.school-continue-hero-signin-btn {
    width: 100%;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(15, 108, 191, 0.22);
}
@media (max-width: 960px) {
    .school-continue-hero-body {
        grid-template-columns: 1fr;
        grid-template-areas:
            "identity"
            "cta"
            "notes";
        gap: 0.85rem;
        padding-left: 1.5rem;
        padding-top: 4rem;
    }
    .school-continue-hero-avatar {
        left: 1.5rem;
    }
}
@media (max-width: 768px) {
    .school-continue-hero-media {
        height: 9.5rem;
    }
    .school-continue-hero-status {
        top: 0.75rem;
        right: 0.75rem;
    }
    .school-continue-hero-avatar {
        left: 1.15rem;
        width: 6.25rem;
        height: 6.25rem;
        font-size: 2.1rem;
        border-width: 4px;
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.22);
    }
    .school-continue-hero-body {
        padding: 0.85rem 1.15rem 1.15rem;
        gap: 0.85rem;
    }
    .school-continue-hero-identity {
        gap: 0.65rem;
    }
    .school-continue-hero-identity-main {
        padding-left: 7rem;
        min-height: 3.35rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .school-continue-hero-eyebrow {
        margin-top: 0.3rem;
        font-size: 0.5625rem;
        padding: 0.18rem 0.5rem;
        letter-spacing: 0.06em;
    }
    .school-continue-hero-name {
        font-size: 1.2rem;
        line-height: 1.25;
    }
    .school-continue-hero-blurb {
        font-size: 0.875rem;
    }
    .school-continue-hero-cta {
        padding: 1rem;
        gap: 0.75rem;
    }
}
@media (max-width: 480px) {
    .school-continue-hero-media {
        height: 8.25rem;
    }
    .school-continue-hero-avatar {
        width: 5.5rem;
        height: 5.5rem;
        font-size: 1.85rem;
    }
    .school-continue-hero-identity-main {
        padding-left: 6.25rem;
        min-height: 2.9rem;
    }
    .school-continue-hero-name {
        font-size: 1.1rem;
    }
}

.school-grid--limited {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 1024px) {
    .school-grid--limited {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 640px) {
    .school-grid--limited {
        grid-template-columns: 1fr;
    }
}

.school-carousel-wrap {
    position: relative;
    display: block;
    margin: 0 -0.25rem;
}
.school-carousel-btn {
    position: absolute;
    top: 50%;
    z-index: 3;
    transform: translateY(-60%);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}
.school-carousel-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.school-carousel-btn:disabled,
.school-carousel-btn[hidden] {
    display: none !important;
}
.school-carousel-btn--prev {
    left: 0.15rem;
}
.school-carousel-btn--next {
    right: 0.15rem;
}
@media (min-width: 768px) {
    .school-carousel-wrap {
        margin: 0;
        padding: 0 2.25rem;
    }
    .school-carousel-btn--prev {
        left: 0;
    }
    .school-carousel-btn--next {
        right: 0;
    }
}

/* Browse-all dropdown */
.schools-browse {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: var(--surface);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}
.schools-browse-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.2s;
}
.schools-browse-summary::-webkit-details-marker { display: none; }
.schools-browse-summary::marker { content: ''; }
.schools-browse-summary:hover {
    background: rgba(15, 108, 191, 0.04);
}
.schools-browse-summary-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.975rem;
    color: var(--text);
}
.schools-browse-summary-label i {
    color: var(--primary);
}
.schools-browse-summary-hint {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}
.schools-browse-chevron {
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: transform 0.25s ease;
}
.schools-browse[open] .schools-browse-chevron {
    transform: rotate(180deg);
}
.schools-browse-panel {
    padding: 0 1.25rem 1.35rem;
    border-top: 1px solid rgba(226, 230, 234, 0.9);
}
.schools-section-header--browse {
    margin: 0;
    padding: 1.1rem 1.25rem 0.85rem;
    border-bottom: 0;
}
.schools-section-header--browse + .schools-browse-panel {
    border-top: 0;
    padding-top: 0;
}
.schools-section-header--browse .schools-section-head h2 {
    font-size: 1.125rem;
}
.schools-browse-panel .schools-search-wrap {
    margin: 1.1rem 0 1.25rem;
}
.schools-browse-panel .schools-search {
    max-width: none;
}

.school-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}
.school-grid.school-carousel {
    display: flex;
    flex-flow: row nowrap;
    align-items: stretch;
    gap: 1.15rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0.35rem 0.5rem 0.85rem;
    margin: 0;
    width: 100%;
    max-width: 100%;
    grid-template-columns: none;
    grid-auto-flow: column;
}
.school-grid.school-carousel::-webkit-scrollbar {
    display: none;
}
.school-grid.school-carousel > .school-card-wrap {
    flex: 0 0 min(300px, 78vw);
    width: min(300px, 78vw);
    min-width: min(300px, 78vw);
    max-width: 300px;
    scroll-snap-align: start;
}
@media (min-width: 768px) {
    .school-grid.school-carousel {
        padding-left: 0.15rem;
        padding-right: 0.15rem;
    }
    .school-grid.school-carousel > .school-card-wrap {
        flex: 0 0 300px;
        width: 300px;
        min-width: 300px;
    }
}
#schoolGrid [data-search][hidden],
#schoolGrid .school-card--filtered-out,
#schoolGrid .school-card-wrap[hidden],
#schoolGrid .school-card-wrap.school-card--filtered-out {
    display: none !important;
}
#schoolGrid.is-filtering [data-landing-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
}

.school-card-wrap {
    position: relative;
    min-width: 0;
}

.school-card-modern {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.125rem;
    min-height: 18rem;
    padding: 0;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
    transition: box-shadow 0.3s, transform 0.3s, border-color 0.3s;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.school-card-cover {
    height: 8rem;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    flex-shrink: 0;
}
.school-card-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0) 35%, rgba(15, 23, 42, 0.22) 100%);
    pointer-events: none;
}
.school-card-status {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    z-index: 2;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
}
.school-card-cover .badge-active {
    background: rgba(212, 237, 218, 0.95);
    color: #155724;
}
.school-card-cover .badge-pending {
    background: rgba(255, 243, 205, 0.95);
    color: #856404;
}
.school-card-cover .badge-suspended {
    background: rgba(226, 230, 234, 0.95);
    color: #495057;
}
.school-card-cover .badge-rejected {
    background: rgba(248, 215, 218, 0.95);
    color: #721c24;
}
.school-card-content {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 1.25rem 1.25rem;
    flex: 1;
}
a.school-card-modern {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
a.school-card-modern:hover,
a.school-card-modern:focus-visible {
    text-decoration: none;
    color: inherit;
}
a.school-card-modern:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}
.school-card-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #08799c);
    opacity: 0;
    transition: opacity 0.3s;
}
.school-card-modern:hover {
    box-shadow: 0 16px 40px rgba(15, 108, 191, 0.12);
    transform: translateY(-4px);
    border-color: rgba(15, 108, 191, 0.28);
}
.school-card-modern:hover::before {
    opacity: 1;
}
.school-avatar {
    width: 4.25rem;
    height: 4.25rem;
    border-radius: 50%;
    border: 4px solid var(--surface);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    flex-shrink: 0;
    margin-left: -0.25rem;
    position: relative;
    z-index: 2;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
    transition: transform 0.3s;
}
.school-card-modern:hover .school-avatar {
    transform: scale(1.04);
}
.school-avatar--image {
    padding: 0;
    overflow: hidden;
    background: var(--surface);
}
.school-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.school-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: -1.0rem;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 2;
}
.school-card-identity {
    min-width: 0;
    flex: 1;
    padding-top: 1.85rem;
}
.school-card-identity h3 {
    font-size: 1.0625rem;
    font-weight: 800;
    margin: 0 0 0.4rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.school-card-identity .school-code-tag {
    max-width: 100%;
    font-size: 0.5625rem;
    padding: 0.2rem 0.45rem;
    letter-spacing: 0.03em;
}
.school-card-identity .school-code-tag i {
    font-size: 0.5rem;
}
.school-card-meta {
    min-width: 0;
    margin-bottom: 1rem;
}
.school-card-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.school-card-footer .school-card-meta {
    margin-bottom: 0;
}
.school-card-modern.is-pending .school-avatar { background: linear-gradient(135deg, #a6670e, #856404); }
.school-card-modern.is-suspended .school-avatar { background: linear-gradient(135deg, #6c757d, #495057); }
.school-card-modern.is-rejected .school-avatar { background: linear-gradient(135deg, #ca3120, #991b1b); }
.school-card-location {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.4;
    min-width: 0;
}
.school-card-location i {
    color: var(--primary);
    flex-shrink: 0;
    font-size: 0.75rem;
}
.school-card-location span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.school-code-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.55rem;
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.school-code-tag i {
    color: var(--primary);
    flex-shrink: 0;
}
.school-card-link {
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    margin-top: auto;
    padding: 0.65rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    font-weight: 600; font-size: 0.875rem;
    color: var(--primary);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.school-card-link:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    text-decoration: none;
}

.landing-empty {
    background: var(--bg);
    border: 1px dashed rgba(15, 108, 191, 0.2);
    border-radius: 1.125rem;
    padding: 3rem 2rem;
    text-align: center;
}
.schools-section .landing-empty {
    margin-top: 0.5rem;
}
.empty-state-icon {
    width: 64px; height: 64px; margin: 0 auto 1rem;
    border-radius: 1rem;
    background: var(--primary-light);
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.75rem;
}

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; padding: 2rem 0 4rem; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.feature-card i { font-size: 1.75rem; color: var(--primary); margin-bottom: 0.75rem; }

.section-title {
    font-size: 1.25rem; font-weight: 700; margin-bottom: 1.25rem;
    display: flex; align-items: center; gap: 0.5rem; color: var(--text);
}
.school-card .course-card-header { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); }
.school-card.pending-card .course-card-header { background: linear-gradient(135deg, #a6670e, #856404); }
.school-card.suspended-card .course-card-header { background: linear-gradient(135deg, #6c757d, #495057); }
.school-card.rejected-card .course-card-header { background: linear-gradient(135deg, #ca3120, #991b1b); }

.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(160deg, #eef4fb 0%, #f0f2f5 45%, #e8f0fa 100%);
}
@media (max-width: 480px) {
    .auth-page { padding: 1.25rem 0.75rem; }
    .auth-card { padding: 1.35rem 1.15rem; }
    .auth-split-form { padding: 1.35rem 1.15rem; }
}
.auth-page .auth-card-split { max-width: 820px; }
.auth-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1.75rem 1.85rem;
    width: 100%; max-width: 400px;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
}
.auth-card.wide { max-width: 560px; }

.auth-top {
    margin-bottom: 1.25rem;
}
.auth-top .auth-footer-link {
    justify-content: flex-start;
}

.auth-brand {
    display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
    margin-bottom: 1.5rem; text-align: center;
}
.auth-brand--school {
    gap: 0.3rem;
    margin-bottom: 1.25rem;
}
.auth-brand-icon {
    width: 3rem; height: 3rem; border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 1.35rem; box-shadow: 0 4px 12px rgba(15, 108, 191, 0.25);
}
.auth-brand-kicker {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.auth-brand-name { font-size: 1.125rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.auth-brand--school .auth-brand-name {
    font-size: 1.2rem;
    line-height: 1.3;
    text-wrap: balance;
}

/* Super admin login */
.auth-page--superadmin {
    background: linear-gradient(160deg, #f4eef9 0%, #faf6f2 42%, #eef1f8 100%);
}
.auth-card-split--superadmin { max-width: 860px; }
.auth-split-panel--superadmin {
    background: linear-gradient(155deg, #4a2f6e 0%, #2f1b4d 55%, #1a1030 100%);
}
.auth-split-panel--superadmin .auth-split-panel-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 20%, rgba(214, 90, 58, 0.22) 0%, transparent 42%),
        radial-gradient(circle at 88% 75%, rgba(255, 255, 255, 0.1) 0%, transparent 45%);
}
.auth-split-panel--superadmin .auth-split-panel-orb--2 {
    background: rgba(214, 90, 58, 0.35);
}
.auth-split-panel--superadmin h2 {
    margin: 0;
    font-size: 1.75rem;
}
.auth-superadmin-logo-wrap {
    display: inline-block;
    background: #fff;
    border-radius: 1rem;
    padding: 0.85rem 1.1rem;
    margin-bottom: 1.35rem;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}
.auth-superadmin-logo {
    display: block;
    width: 100%;
    max-width: 210px;
    height: auto;
}
.auth-superadmin-logo-wrap--mobile {
    display: block;
    margin: 0 auto 1.25rem;
    text-align: center;
}
@media (min-width: 768px) {
    .auth-superadmin-logo-wrap--mobile { display: none; }
}
.auth-split-form--superadmin { padding: 2rem 1.85rem 1.75rem; }
.auth-form-heading { margin-bottom: 1.35rem; }
.auth-form-heading h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0.5rem 0 0.25rem;
}
.auth-form-subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.auth-superadmin-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: #f3eef9;
    color: #4a2f6e;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.auth-submit--superadmin {
    background: linear-gradient(135deg, #4a2f6e 0%, #2f1b4d 100%);
    border-color: #2f1b4d;
}
.auth-submit--superadmin:hover {
    background: linear-gradient(135deg, #563880 0%, #3a2258 100%);
    border-color: #3a2258;
}
.auth-superadmin-note {
    margin: 1.25rem 0 0;
    padding-top: 1.15rem;
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.auth-superadmin-note i { font-size: 0.75rem; opacity: 0.85; }

/* ===== Super Admin Dashboard & Schools ===== */
.superadmin-dashboard,
.superadmin-schools,
.superadmin-storage {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.superadmin-stats { margin-bottom: 1.25rem; }
.superadmin-stat-link {
    text-decoration: none !important;
    color: inherit;
    display: block;
}
.superadmin-stat-link .stat-card { height: 100%; }
.superadmin-stat-link:hover .stat-card {
    border-color: rgba(74, 47, 110, 0.25);
    box-shadow: var(--shadow-md);
}
.stat-card-icon-ns { background: #f3ebfa; color: #4a2f6e; }
.stat-card-icon-muted { background: #f1f3f5; color: #6c757d; }
.stat-card--highlight {
    border-color: rgba(166, 103, 14, 0.35);
    background: linear-gradient(135deg, #fffdf5 0%, var(--surface) 100%);
}
.stat-card--highlight .value { color: var(--warning); }

.superadmin-alert-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.9rem 1.15rem;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, #fff8e6 0%, #fffdf5 100%);
    border: 1px solid rgba(166, 103, 14, 0.25);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.superadmin-alert-banner-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: #fff3cd;
    color: var(--warning);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.superadmin-alert-banner-text {
    flex: 1;
    min-width: 12rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.superadmin-alert-banner-text strong {
    font-size: 0.9375rem;
    color: var(--text);
}
.superadmin-alert-banner-text span {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.superadmin-panel .panel-header h2 i { color: #4a2f6e; }
.superadmin-panel-sub {
    margin: 0.2rem 0 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.superadmin-pending-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.superadmin-pending-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.1rem 1.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--warning);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, border-color 0.2s;
}
.superadmin-pending-card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(166, 103, 14, 0.3);
}
.superadmin-pending-card-head {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}
.superadmin-pending-card-info {
    flex: 1;
    min-width: 0;
}
.superadmin-pending-card-info h3 {
    margin: 0 0 0.25rem;
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.3;
}
.superadmin-pending-card-info h3 a {
    color: var(--text);
    text-decoration: none;
}
.superadmin-pending-card-info h3 a:hover { color: var(--primary); }
.superadmin-pending-email {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    word-break: break-all;
}
.superadmin-pending-email i { font-size: 0.7rem; opacity: 0.8; flex-shrink: 0; }
.superadmin-pending-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.superadmin-pending-meta > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.superadmin-pending-actions {
    padding-top: 0.65rem;
    border-top: 1px solid var(--border);
}

.superadmin-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.superadmin-filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none !important;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
.superadmin-filter-tab i { font-size: 0.75rem; opacity: 0.85; }
.superadmin-filter-tab:hover {
    background: var(--bg);
    color: var(--text);
}
.superadmin-filter-tab.is-active {
    background: linear-gradient(135deg, #4a2f6e 0%, #2f1b4d 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(47, 27, 77, 0.25);
}
.superadmin-filter-tab.is-active i { opacity: 1; }
.superadmin-filter-tab--pending.is-active { background: linear-gradient(135deg, #a6670e, #856404); box-shadow: 0 2px 8px rgba(166, 103, 14, 0.25); }
.superadmin-filter-tab--active.is-active { background: linear-gradient(135deg, var(--success), #2d6a2a); box-shadow: 0 2px 8px rgba(53, 122, 50, 0.25); }
.superadmin-filter-tab--rejected.is-active { background: linear-gradient(135deg, var(--danger), #991b1b); box-shadow: 0 2px 8px rgba(202, 49, 32, 0.25); }
.superadmin-filter-tab--suspended.is-active { background: linear-gradient(135deg, #6c757d, #495057); box-shadow: 0 2px 8px rgba(108, 117, 125, 0.25); }
.superadmin-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
}
.superadmin-filter-tab.is-active .superadmin-filter-count {
    background: rgba(255, 255, 255, 0.22);
}

.superadmin-table-card {
    margin-bottom: 1rem;
}
.superadmin-table-wrap {
    max-height: none;
}
.superadmin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.superadmin-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f4f6f9;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.25rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    white-space: nowrap;
}
.superadmin-table tbody td {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    min-height: 4.25rem;
}
.superadmin-table tbody tr:last-child td { border-bottom: none; }
.superadmin-table-row { cursor: pointer; transition: background 0.15s, box-shadow 0.15s; }
.superadmin-table-row:hover {
    background: linear-gradient(90deg, #f8f6fc 0%, #fafbff 100%);
}
.superadmin-table-row:hover .superadmin-school-name { color: var(--primary); }
.superadmin-table:has(.superadmin-col-school) { table-layout: fixed; }
.superadmin-col-school { width: 30%; }
.superadmin-col-admin { width: 26%; }
.superadmin-col-status { width: 14%; }
.superadmin-col-date { width: 16%; }
.superadmin-col-actions { width: 14%; text-align: right; }
.superadmin-table-card .admin-empty-state {
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
}
.superadmin-table-card-header {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fafbfc 0%, var(--surface) 100%);
}
.superadmin-table-card-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.superadmin-storage-toolbar { justify-content: flex-end; }
.storage-bar-list { display: grid; gap: 0.85rem; }
.storage-bar-item { display: grid; gap: 0.35rem; }
.storage-bar-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.8125rem;
}
.storage-bar-head a {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}
.storage-bar-head a:hover { color: var(--primary); }
.storage-bar-head span { color: var(--text-muted); white-space: nowrap; }
.storage-bar-track {
    height: 0.45rem;
    border-radius: 999px;
    background: var(--surface-muted);
    overflow: hidden;
}
.storage-bar-track--inline { flex: 1; min-width: 4rem; }
.storage-bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #4a2f6e, #6b46a3);
}
.storage-share-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 8rem;
}
.storage-size-cell strong { color: #4a2f6e; }
.storage-breakdown-row td {
    background: #fafbfc;
    padding-top: 0;
}
.storage-breakdown {
    padding: 0.75rem 0 0.25rem;
}
.storage-breakdown h3 {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
}
.storage-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}
.storage-breakdown-item {
    display: grid;
    gap: 0.15rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.storage-breakdown-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}
.storage-breakdown-item strong { font-size: 0.9375rem; }
.storage-breakdown-item small { color: var(--text-muted); font-size: 0.75rem; }

/* Storage table column widths */
.superadmin-storage-table { table-layout: fixed; }
.stg-col-school  { width: 24%; }
.stg-col-status  { width: 10%; }
.stg-col-size    { width: 12%; }
.stg-col-files   { width: 8%; }
.stg-col-share   { width: 18%; }
.stg-col-cat     { width: 18%; }
.stg-col-actions { width: 10%; text-align: right; }
.storage-category-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Mobile cards - hidden on desktop */
.storage-cards-mobile { display: none; }

.storage-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.storage-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.storage-card-school {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    flex: 1;
}
.storage-card-school-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.storage-card-name {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.storage-card-name:hover { color: var(--primary); }
.storage-card-size {
    font-size: 1rem;
    color: #4a2f6e;
    white-space: nowrap;
}
.storage-card-bar { padding: 0.1rem 0; }
.storage-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.storage-card-meta i { font-size: 0.65rem; opacity: 0.7; }
.storage-card-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: background 0.15s, color 0.15s;
}
.storage-card-toggle:hover { background: var(--surface-muted); color: var(--text); }
.storage-card .storage-breakdown { padding-top: 0.25rem; }
.storage-card .storage-breakdown-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

@media (max-width: 768px) {
    .storage-table-desktop { display: none; }
    .storage-cards-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
    }
    .superadmin-storage-top .storage-bar-head { flex-direction: column; gap: 0.15rem; }
}

.superadmin-school-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.65rem;
    background: linear-gradient(135deg, #4a2f6e, #2f1b4d);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(47, 27, 77, 0.22);
}
.superadmin-school-avatar.school-avatar--image {
    padding: 0;
    overflow: hidden;
    background: var(--surface);
}
.superadmin-school-avatar .school-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.table-school-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}
.superadmin-school-cell { gap: 0.85rem; }
.superadmin-school-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.15rem;
    min-width: 0;
    overflow: hidden;
    min-height: 2.5rem;
}
.superadmin-school-name {
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
    transition: color 0.15s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.superadmin-school-code {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.superadmin-contact-cell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.15rem;
    min-width: 0;
    overflow: hidden;
    min-height: 2.5rem;
}
.superadmin-admin-name {
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.3;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.superadmin-contact-email {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}
.superadmin-email-cell {
    font-size: 0.875rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.superadmin-date-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.superadmin-date-cell i { font-size: 0.75rem; opacity: 0.75; }

.superadmin-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
}
.superadmin-status-badge i { font-size: 0.625rem; }

.superadmin-action-group {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 0.3rem;
}
.superadmin-actions {
    text-align: right;
    width: 1%;
    white-space: nowrap;
}
.superadmin-actions.actions {
    flex-wrap: nowrap;
    gap: 0;
}
.table-wrap td.superadmin-actions {
    min-width: 0;
    width: 1%;
    padding-left: 0.5rem;
    padding-right: 1rem;
}
.superadmin-action-form {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 0.3rem;
    margin: 0;
}
.superadmin-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8125rem;
    line-height: 1;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-decoration: none;
    flex-shrink: 0;
}
.superadmin-icon-btn:hover {
    background: var(--bg);
    color: var(--text);
    border-color: #cbd5e1;
}
.superadmin-icon-btn--success {
    color: #166534;
    border-color: rgba(22, 101, 52, 0.2);
    background: #f0fdf4;
}
.superadmin-icon-btn--success:hover {
    background: #dcfce7;
    border-color: #86efac;
    color: #14532d;
}
.superadmin-icon-btn--danger {
    color: #991b1b;
    border-color: rgba(153, 27, 27, 0.18);
    background: #fef2f2;
}
.superadmin-icon-btn--danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #7f1d1d;
}
.superadmin-icon-btn--view {
    color: var(--text-muted);
    background: var(--surface);
}
.superadmin-icon-btn--view:hover {
    color: var(--primary);
    border-color: rgba(15, 108, 191, 0.35);
    background: #eef5fc;
}

.superadmin-panel .admin-empty-state {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .superadmin-alert-banner { flex-direction: column; align-items: flex-start; }
    .superadmin-alert-banner .btn { width: 100%; }
    .superadmin-filter-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .superadmin-pending-grid { grid-template-columns: 1fr; }
    .superadmin-table-card-header { padding: 0.9rem 1rem; }
    .superadmin-table thead th,
    .superadmin-table tbody td { padding: 0.6rem 0.5rem; font-size: 0.8125rem; }
    .superadmin-table tbody td { height: auto; }
    .superadmin-table th:nth-child(4),
    .superadmin-table td:nth-child(4) { display: none; }

    .superadmin-col-school { width: 34%; }
    .superadmin-col-admin  { width: 28%; }
    .superadmin-col-status { width: 18%; }
    .superadmin-col-actions { width: 20%; }

    .superadmin-icon-btn { width: 1.65rem; height: 1.65rem; font-size: 0.7rem; }
    .superadmin-action-group { gap: 0.2rem; }
    .superadmin-status-badge { padding: 0.2rem 0.45rem; font-size: 0.675rem; gap: 0.2rem; }
    .superadmin-status-badge i { font-size: 0.55rem; }
    .superadmin-school-avatar { width: 2rem; height: 2rem; font-size: 0.75rem; border-radius: 0.45rem; }
}

.school-login-banner {
    display: flex; align-items: center; gap: 0.85rem;
    background: linear-gradient(135deg, #eef5fc 0%, #e7f0fa 100%);
    border: 1px solid rgba(15, 108, 191, 0.15);
    border-radius: var(--radius-lg); padding: 1rem 1.1rem;
    margin-bottom: 1.5rem;
}
.school-login-avatar {
    width: 2.75rem; height: 2.75rem; border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; font-size: 1.125rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.school-login-banner small {
    display: block; font-size: 0.6875rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
    margin-bottom: 0.1rem;
}
.school-login-banner strong {
    display: block; font-size: 1.0625rem; font-weight: 700;
    color: var(--text); line-height: 1.3; letter-spacing: -0.01em;
}

.auth-card .form-group:last-of-type { margin-bottom: 1.25rem; }
.auth-submit { padding: 0.65rem 1rem; font-size: 0.9375rem; margin-top: 0.25rem; }
.auth-alt-school {
    margin: 1rem 0 0;
    text-align: center;
    font-size: 0.875rem;
}

.auth-footer {
    margin-top: 1.5rem; padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    text-align: center; display: flex; flex-direction: column; gap: 0.65rem;
}
.auth-footer p { font-size: 0.875rem; color: var(--text-muted); margin: 0; }
.auth-footer-link {
    font-size: 0.875rem; font-weight: 500; color: var(--primary);
    text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
}
.auth-footer-link:hover { color: var(--primary-dark); text-decoration: underline; }
.auth-footer-link.muted { color: var(--text-muted); font-weight: 400; }
.auth-footer-link.muted:hover { color: var(--text); }

.auth-card .school-code-input {
    text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
    font-family: ui-monospace, monospace;
}

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.35rem; font-size: 0.875rem; }
.form-group small { color: var(--text-muted); font-size: 0.8125rem; }
.form-control {
    width: 100%; padding: 0.55rem 0.75rem;
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 0.9375rem; font-family: inherit; background: var(--surface);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,108,191,.15); }
textarea.form-control { min-height: 100px; resize: vertical; }

.password-field { position: relative; display: flex; align-items: stretch; }
.password-field .form-control { padding-right: 2.75rem; }
.password-toggle {
    position: absolute; right: 0; top: 0; bottom: 0;
    width: 2.75rem; border: none; background: transparent;
    color: var(--text-muted); cursor: pointer; border-radius: 0 var(--radius) var(--radius) 0;
    display: flex; align-items: center; justify-content: center;
}
.password-toggle:hover { color: var(--primary); }
.password-toggle:focus { outline: none; color: var(--primary); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-check { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
    padding: 0.5rem 1rem; border: none; border-radius: var(--radius);
    font-size: 0.9375rem; font-weight: 600; cursor: pointer;
    text-decoration: none; font-family: inherit; line-height: 1.4;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(15, 108, 191, 0.2); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; text-decoration: none; box-shadow: 0 2px 8px rgba(15, 108, 191, 0.25); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); text-decoration: none; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8125rem; }
.btn-block { width: 100%; }

.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9375rem; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }

.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1.25rem 1.35rem;
    display: flex; align-items: center; gap: 1rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card-icon {
    width: 2.75rem; height: 2.75rem; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem; flex-shrink: 0;
}
.stat-card-icon-blue { background: #e7f0fa; color: var(--primary); }
.stat-card-icon-green { background: #e8f5e9; color: var(--success); }
.stat-card-icon-purple { background: #f3e8ff; color: #7c3aed; }
.stat-card-icon-orange { background: #fff4e6; color: var(--warning); }
.stat-card .value { font-size: 1.625rem; font-weight: 800; color: var(--text); line-height: 1.1; letter-spacing: -0.02em; }
.stat-card .label { color: var(--text-muted); font-size: 0.8125rem; font-weight: 500; margin-top: 0.1rem; }

/* Compact 1×4 strip so Quick actions stays primary on smaller screens */
@media (max-width: 900px) {
    .stats-grid {
        gap: 0.45rem;
        margin-bottom: 1rem;
    }
    .stat-card {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        gap: 0.2rem;
        padding: 0.55rem 0.3rem;
        min-width: 0;
        border-radius: var(--radius);
        box-shadow: none;
    }
    .stat-card:hover { transform: none; box-shadow: none; }
    .stat-card-icon {
        width: 1.55rem;
        height: 1.55rem;
        font-size: 0.7rem;
        border-radius: 0.4rem;
    }
    .stat-card .value {
        font-size: 1.05rem;
        letter-spacing: -0.03em;
    }
    .stat-card .label {
        font-size: 0.625rem;
        line-height: 1.2;
        margin-top: 0;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .stat-card-term { display: none; }
}

.panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1.35rem 1.5rem;
    margin-bottom: 1.25rem; box-shadow: var(--shadow);
}
.panel h2 {
    font-size: 1.05rem; margin-bottom: 0.85rem; font-weight: 700;
    display: flex; align-items: center; gap: 0.5rem;
}
.panel h2 i { color: var(--primary); font-size: 0.95rem; }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.75rem; }
.panel-header h2 { margin-bottom: 0; }

.admin-table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.admin-table-card .table-wrap { border: none; border-radius: 0; box-shadow: none; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow-x: auto; -webkit-overflow-scrolling: touch; box-shadow: var(--shadow); max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.admin-table-card table,
.admin-table-card .table-wrap table {
    table-layout: fixed;
    font-size: 0.8125rem;
}
.admin-table-card th,
.admin-table-card td {
    padding: 0.5rem 0.75rem;
}
.admin-table-card th {
    font-size: 0.625rem;
    letter-spacing: 0.05em;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}
.admin-table-card td.col-desc { line-height: 1.4; font-size: 0.8125rem; }
.admin-table-card .table-subject-cell { gap: 0.5rem; }
.admin-table-card .table-icon-badge {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
}
.admin-table-card .table-user-name,
.admin-table-card .table-subject-cell strong { font-size: 0.8125rem; }
.admin-table-card .badge { font-size: 0.6875rem; padding: 0.12rem 0.4rem; }
.admin-table-card .btn-sm {
    padding: 0.25rem 0.55rem;
    font-size: 0.75rem;
}
.admin-table-card .table-row-actions { gap: 0.35rem; }
.admin-table-card tbody tr td.text-muted { padding: 1.25rem 0.75rem; }

/* Subjects catalog table */
.admin-table-card--subjects {
    display: flex;
    flex-direction: column;
    max-height: min(70vh, calc(100vh - 12rem));
    overflow: hidden;
}
.admin-table-card--subjects .admin-table-card-head {
    flex-shrink: 0;
}
.admin-table-card--subjects > .table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}
.admin-table-card--subjects .admin-data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f1f5f9;
    box-shadow: 0 1px 0 var(--border);
}
.admin-table-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fafbfc 0%, var(--surface) 100%);
}
.admin-table-card-head-text h2 {
    margin: 0 0 0.15rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text);
}
.admin-table-card-head-text p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.admin-table-search {
    position: relative;
    min-width: min(100%, 240px);
    max-width: 280px;
    flex: 1;
}
.admin-table-card-head-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-end;
    min-width: min(100%, 280px);
}
.admin-table-filter {
    min-width: 8.5rem;
    max-width: 11rem;
}
.admin-table-filter .form-control {
    padding: 0.4rem 0.65rem;
    font-size: 0.8125rem;
    border-radius: 999px;
    background: var(--bg);
}
.admin-table-search i {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8125rem;
    pointer-events: none;
}
.admin-table-search .form-control {
    padding: 0.4rem 0.65rem 0.4rem 2rem;
    font-size: 0.8125rem;
    border-radius: 999px;
    background: var(--bg);
}

.admin-data-table thead th {
    background: #f1f5f9;
    border-bottom: 1px solid var(--border);
    color: #64748b;
}
.admin-data-table tbody tr {
    transition: background 0.12s, box-shadow 0.12s;
}
.admin-data-table tbody tr:hover {
    background: #f8fbff;
}
.admin-data-table tbody tr:hover .subject-code-chip {
    border-color: var(--primary);
    color: var(--primary-dark);
    background: var(--primary-light);
}
.admin-data-table tbody tr[hidden] { display: none; }

.admin-table-card--subjects .col-subject { width: 6.5rem; }
.admin-table-card--subjects .col-level { width: 7.5rem; white-space: nowrap; }
.admin-table-card--subjects .col-scheme { width: 9.5rem; }
.admin-table-card--subjects .col-num { width: 4.5rem; }
.admin-table-card--subjects th.col-actions,
.admin-table-card--subjects td.actions { width: 4.5rem; }

.subject-level {
    font-size: 0.8125rem;
    color: var(--text);
}
.subject-level--empty {
    color: var(--text-muted);
}

.subject-code-link {
    text-decoration: none !important;
    display: inline-block;
}
.subject-code-chip {
    display: inline-block;
    padding: 0.2rem 0.45rem;
    border-radius: 0.35rem;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-dark);
    letter-spacing: 0.02em;
    transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.subject-title {
    color: var(--text);
    font-size: 0.8125rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.subject-title--empty { color: var(--text-muted); font-style: italic; }

.subject-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
}
.subject-status i { font-size: 0.625rem; }
.subject-status--ok {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}
.subject-status--muted {
    background: #f8fafc;
    color: #94a3b8;
    border: 1px solid #e2e8f0;
}

.subject-usage-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #64748b;
}
.subject-usage-badge.is-active {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.table-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none !important;
    transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.table-action-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-light);
}
.table-action-btn--danger:hover {
    color: #b91c1c;
    border-color: #fca5a5;
    background: #fef2f2;
}
.admin-table-card--subjects .table-row-actions {
    opacity: 0.55;
    transition: opacity 0.12s;
}
.admin-table-card--subjects tbody tr:hover .table-row-actions,
.admin-table-card--subjects tbody tr:focus-within .table-row-actions {
    opacity: 1;
}

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

th, td {
    padding: 0.85rem 1.15rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    overflow-wrap: anywhere;
}
th { background: #f8fafc; font-weight: 700; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: #f8fbff; }
tr.table-row-link { cursor: pointer; }
tr.table-row-link:hover {
    background: #e6edf6;
}
tr.table-row-link:hover .table-user-name { color: var(--primary); }
tr.table-row-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    background: #e6edf6;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr td.text-muted { padding: 2rem 1.15rem; text-align: center; }

/* Standard admin list tables */
.admin-table-card:not(.admin-table-card--subjects) .admin-data-table {
    table-layout: auto;
    width: 100%;
}
/* Shrink-to-fit columns cluster on the left; flexible column absorbs extra width */
.admin-data-table--people .col-name,
.admin-data-table--people .col-tags,
.admin-data-table--people .col-status,
.admin-data-table--people td.actions {
    width: 1%;
    white-space: nowrap;
}
.admin-data-table--people .col-email {
    width: 99%;
}
.admin-data-table--roster .col-code,
.admin-data-table--roster .col-num,
.admin-data-table--roster .col-status,
.admin-data-table--roster td.actions {
    width: 1%;
    white-space: nowrap;
}
.admin-data-table--roster .col-name {
    width: auto;
    max-width: 14rem;
}
.admin-data-table--roster .col-program {
    width: auto;
    max-width: 10rem;
}

.admin-table-card .col-program { width: auto; }
.admin-table-card .col-code { width: 1%; white-space: nowrap; }
.admin-table-card .col-status { width: 1%; white-space: nowrap; }
.admin-table-card .col-num { width: 1%; text-align: center; white-space: nowrap; }
.admin-table-card th.col-num { text-align: center; padding-left: 0.35rem; padding-right: 0.35rem; }
.admin-table-card td.col-num { padding-left: 0.35rem; padding-right: 0.35rem; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.8125rem; }
.admin-table-card th.col-actions,
.admin-table-card td.actions {
    width: 1%;
    white-space: nowrap;
    text-align: left;
    padding-right: 0.75rem;
}

.admin-table-card .col-email,
.admin-table-card td.col-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.admin-table-card .col-program,
.admin-table-card td.col-program {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8125rem;
}
.admin-table-card .cell-stack {
    min-width: 0;
}
.admin-table-card .cell-stack__title {
    display: block;
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--text);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.admin-table-card .cell-stack__title:hover {
    color: var(--primary);
    text-decoration: underline;
}
.admin-table-card .cell-stack__sub {
    display: block;
    font-size: 0.6875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 0.1rem;
}

.admin-table-card .table-user-cell,
.admin-table-card .table-group-cell {
    gap: 0.45rem;
    min-width: 0;
}
.admin-table-card .table-avatar {
    width: 1.65rem;
    height: 1.65rem;
    font-size: 0.5625rem;
}
.admin-table-card .table-icon-badge {
    width: 1.65rem;
    height: 1.65rem;
    font-size: 0.6875rem;
}
.admin-table-card .table-user-name,
.admin-table-card .table-group-cell strong {
    font-size: 0.8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.admin-table-card .table-group-cell small {
    font-size: 0.6875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}
.admin-table-card .subject-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    max-height: 2.4rem;
    overflow: hidden;
}
.admin-table-card .subject-tag {
    font-size: 0.625rem;
    padding: 0.08rem 0.35rem;
}
.admin-table-card .badge {
    font-size: 0.625rem;
    padding: 0.12rem 0.4rem;
    white-space: nowrap;
}
.admin-table-card .subject-code-chip {
    font-size: 0.6875rem;
    padding: 0.12rem 0.35rem;
}

.admin-table-card .table-row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.25rem;
    opacity: 0.65;
    transition: opacity 0.12s;
}
.admin-table-card tbody tr:hover .table-row-actions,
.admin-table-card tbody tr:focus-within .table-row-actions {
    opacity: 1;
}
.admin-table-card .table-row-actions form {
    display: inline-flex;
    margin: 0;
}
.table-action-btn--primary {
    color: var(--primary);
    border-color: #b8d4f0;
    background: var(--primary-light);
}
.table-action-btn--primary:hover {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

/* Mobile: stacked cards, no sideways scroll */
@media (max-width: 720px) {
    .admin-table-card:not(.admin-table-card--subjects) .table-wrap {
        overflow: visible;
        -webkit-overflow-scrolling: auto;
    }
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table,
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table tbody {
        display: block;
        width: 100%;
    }
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0.4rem 0.5rem;
        padding: 0.9rem 1rem;
        border-bottom: 1px solid var(--border);
        background: var(--surface);
    }
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table tbody tr:last-child {
        border-bottom: none;
    }
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table td {
        border: none;
        padding: 0;
        width: auto !important;
        max-width: none !important;
        white-space: normal !important;
        overflow: visible;
        text-overflow: unset;
        text-align: left !important;
    }
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table td.col-name {
        flex: 1 1 calc(100% - 5.75rem);
        order: 1;
        min-width: 0;
    }
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table td.actions {
        flex: 0 0 auto;
        order: 2;
        margin-left: auto;
    }
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table td.col-code,
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table td.col-num,
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table td.col-status,
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table td.col-program,
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table td.col-tags {
        order: 3;
        flex: 0 0 auto;
    }
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table td.col-email {
        order: 3;
        flex: 1 1 100%;
        font-size: 0.75rem;
        color: var(--text-muted);
    }
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table td.col-program {
        flex: 1 1 100%;
        font-size: 0.75rem;
        color: var(--text-muted);
    }
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table td.col-num {
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
        padding: 0.2rem 0.5rem;
        border-radius: 999px;
        background: var(--bg);
        border: 1px solid var(--border);
        font-size: 0.75rem;
        font-weight: 700;
    }
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table td.col-num::before {
        content: attr(data-label);
        font-size: 0.5625rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-muted);
    }
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table td.col-num:not([data-label])::before,
    .admin-table-card:not(.admin-table-card--subjects) .admin-data-table td.col-num[data-label=""]::before {
        content: none;
    }
    .admin-table-card:not(.admin-table-card--subjects) .cell-stack__title,
    .admin-table-card:not(.admin-table-card--subjects) .cell-stack__sub {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }
    .admin-table-card:not(.admin-table-card--subjects) .cell-stack__sub {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .admin-table-card:not(.admin-table-card--subjects) .table-row-actions {
        opacity: 1;
    }
    .admin-table-card:not(.admin-table-card--subjects) .table-user-name,
    .admin-table-card:not(.admin-table-card--subjects) .table-group-cell strong {
        white-space: normal;
    }

    /* Subjects catalog mobile cards */
    .admin-table-card--subjects {
        max-height: none;
    }
    .admin-table-card--subjects .admin-table-card-head {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.85rem 0.9rem;
    }
    .admin-table-card--subjects .admin-table-card-head-filters {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        min-width: 0;
        width: 100%;
        gap: 0.5rem;
    }
    .admin-table-card--subjects .admin-table-filter,
    .admin-table-card--subjects .admin-table-search {
        min-width: 0;
        max-width: none;
        width: 100%;
    }
    .admin-table-card--subjects > .table-wrap {
        overflow-x: hidden;
        overflow-y: auto;
    }
    .admin-table-card--subjects .admin-data-table,
    .admin-table-card--subjects .admin-data-table tbody {
        display: block;
        width: 100%;
    }
    .admin-table-card--subjects .admin-data-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
    .admin-table-card--subjects .admin-data-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0.4rem 0.5rem;
        padding: 0.85rem 0.9rem;
        border-bottom: 1px solid var(--border);
        background: var(--surface);
    }
    .admin-table-card--subjects .admin-data-table tbody tr[hidden] {
        display: none !important;
    }
    .admin-table-card--subjects .admin-data-table tbody tr:last-child {
        border-bottom: none;
    }
    .admin-table-card--subjects .admin-data-table td {
        border: none;
        padding: 0;
        width: auto !important;
        max-width: none !important;
        white-space: normal !important;
        overflow: visible;
        text-overflow: unset;
        text-align: left !important;
    }
    .admin-table-card--subjects .admin-data-table td.col-subject {
        flex: 1 1 calc(100% - 5.5rem);
        order: 1;
        min-width: 0;
    }
    .admin-table-card--subjects .admin-data-table td.actions {
        flex: 0 0 auto;
        order: 2;
        margin-left: auto;
    }
    .admin-table-card--subjects .admin-data-table td.col-desc {
        flex: 1 1 100%;
        order: 3;
    }
    .admin-table-card--subjects .admin-data-table td.col-level,
    .admin-table-card--subjects .admin-data-table td.col-scheme,
    .admin-table-card--subjects .admin-data-table td.col-num {
        order: 4;
        flex: 0 0 auto;
    }
    .admin-table-card--subjects .admin-data-table td.col-num {
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
        padding: 0.2rem 0.5rem;
        border-radius: 999px;
        background: var(--bg);
        border: 1px solid var(--border);
        font-size: 0.75rem;
        font-weight: 700;
    }
    .admin-table-card--subjects .admin-data-table td.col-num::before {
        content: attr(data-label);
        font-size: 0.5625rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-muted);
    }
    .admin-table-card--subjects .subject-title {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        white-space: normal;
        font-size: 0.8125rem;
        line-height: 1.35;
    }
    .admin-table-card--subjects .subject-level {
        display: inline-flex;
        padding: 0.2rem 0.5rem;
        border-radius: 999px;
        background: var(--bg);
        border: 1px solid var(--border);
        font-size: 0.6875rem;
        font-weight: 600;
    }
    .admin-table-card--subjects .subject-status {
        font-size: 0.6875rem;
    }
    .admin-table-card--subjects .table-row-actions {
        opacity: 1;
    }
}

/* Subjects catalog overrides */
.admin-table-card--subjects .col-subject { width: 6.5rem; }
.admin-table-card--subjects .col-level { width: 7.5rem; white-space: nowrap; }
.admin-table-card--subjects .col-scheme { width: 9.5rem; }
.admin-table-card--subjects .col-num { width: 4.5rem; }
.admin-table-card--subjects th.col-actions,
.admin-table-card--subjects td.actions { width: 4.5rem; }

.subject-scheme-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}

.table-user-cell, .table-subject-cell, .table-group-cell {
    display: flex; align-items: center; gap: 0.75rem;
}
.table-avatar {
    width: 2.25rem; height: 2.25rem; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; font-size: 0.75rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.table-user-name { font-weight: 600; }
.table-user-link {
    text-decoration: none;
    color: inherit;
    display: inline-block;
    border-radius: var(--radius);
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.table-user-link:hover .table-user-name {
    color: var(--primary);
    text-decoration: underline;
}
.table-user-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.table-icon-badge {
    width: 2.25rem; height: 2.25rem; border-radius: var(--radius);
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    font-size: 0.875rem;
}
.table-icon-badge-group { background: #f3e8ff; color: #7c3aed; }
.table-group-cell strong { display: block; line-height: 1.3; }
.table-group-cell small { display: block; font-size: 0.8125rem; }
.table-group-link { text-decoration: none; color: inherit; display: block; }
.table-group-link:hover .table-group-cell strong { color: var(--primary); }

.badge { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-active { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.badge-suspended { background: #e9ecef; color: #495057; }
.badge-submitted { background: #d1ecf1; color: #0c5460; }
.badge-graded { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-inactive { background: #e9ecef; color: #495057; }

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
td.actions,
th.actions,
td.col-actions,
th.col-actions {
    display: table-cell;
    vertical-align: middle;
    text-align: right;
    white-space: nowrap;
}
.table-row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: nowrap;
}
.table-row-actions form {
    display: inline-flex;
    margin: 0;
}
.inline-form { display: inline-flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.text-muted { color: var(--text-muted); }
.mb-1 { margin-bottom: 1rem; }
.mt-1 { margin-top: 1rem; }
.filter-bar { display: flex; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.filter-bar select, .filter-bar input { max-width: 220px; }

.question-block { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; background: var(--bg); }
.option-row { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }

.pagination { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.pagination-info { color: var(--text-muted); font-size: 0.875rem; }

.pending-card {
    border-left: 4px solid var(--warning);
    background: #fffdf5;
}

/* Admin setup & group management */
.setup-checklist {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.setup-checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg);
    transition: border-color 0.15s;
}
.setup-checklist-item.is-done {
    background: #f0faf2;
    border-color: #b8dfc0;
}
.setup-checklist-num {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--surface);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
    color: var(--text-muted);
}
.setup-checklist-item.is-done .setup-checklist-num {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.setup-checklist-body strong { display: block; margin-bottom: 0.15rem; }
.setup-checklist-body p { font-size: 0.875rem; margin-bottom: 0.5rem; }

.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}
.admin-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1rem;
    border-radius: var(--radius) var(--radius) 0 0;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -1px;
}
.admin-tab:hover { color: var(--primary); text-decoration: none; }
.admin-tab.active {
    color: var(--primary);
    background: var(--surface);
    border-color: var(--border);
}

.subject-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.subject-tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.subject-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}
.subject-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 0.875rem;
    cursor: pointer;
}
.subject-checkbox input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}
.subject-checkbox__label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.subject-checkbox__title {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.teacher-subject-picker { margin-top: 0.25rem; }
.teacher-subject-picker .subject-checkbox-grid {
    max-height: 280px;
    overflow-y: auto;
}
.teacher-subject-picker .subject-checkbox.is-hidden {
    display: none !important;
}
.teacher-subject-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.teacher-subject-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.teacher-subject-empty {
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.75rem;
}
.teacher-subject-empty.hidden { display: none; }

.inline-assign-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.inline-assign-form .form-control { min-width: 180px; max-width: 280px; }

.group-subjects-table .group-subject-code {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    width: 1%;
}
.group-subjects-table .group-subject-code strong {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}
.group-subjects-table .group-subject-teacher {
    min-width: 12rem;
}
.group-subjects-table .group-subject-cover {
    white-space: nowrap;
    overflow-wrap: normal;
}
.group-subjects-table .class-cover-summary-label {
    white-space: nowrap;
}
.group-subjects-table .group-subject-actions {
    width: 1%;
    white-space: nowrap;
}
.group-subjects-table .group-subject-teacher .text-muted {
    display: block;
    margin-top: 0.35rem;
    max-width: 18rem;
    line-height: 1.35;
}

.group-subject-add { margin-bottom: 1rem; }
.group-subject-add-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.group-subject-add-form .searchable-select {
    flex: 1;
    min-width: min(100%, 240px);
    max-width: 420px;
}

/* Group subjects: stacked cards on mobile */
@media (max-width: 720px) {
    .group-subjects-wrap {
        overflow: visible;
        border: none;
        background: transparent;
        box-shadow: none;
    }
    .group-subjects-table,
    .group-subjects-table tbody {
        display: block;
        width: 100%;
    }
    .group-subjects-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
    .group-subjects-table tbody tr {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 0.75rem 0.65rem;
        padding: 1rem;
        margin-bottom: 0.75rem;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow);
    }
    .group-subjects-table tbody tr:hover {
        background: var(--surface);
    }
    .group-subjects-table tbody tr:last-child {
        margin-bottom: 0;
    }
    .group-subjects-table td {
        border: none;
        padding: 0;
        width: auto !important;
        max-width: none !important;
        white-space: normal !important;
        overflow-wrap: normal;
        word-break: normal;
        vertical-align: top;
    }
    .group-subjects-table td.text-muted {
        grid-column: 1 / -1;
        text-align: center;
        padding: 1.25rem 0.5rem;
    }
    .group-subjects-table .group-subject-code {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
    }
    .group-subjects-table .group-subject-code strong {
        display: block;
        font-size: 1rem;
        line-height: 1.3;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
    }
    .group-subjects-table .group-subject-actions {
        grid-column: 2;
        grid-row: 1;
        align-self: start;
        justify-self: end;
    }
    .group-subjects-table .group-subject-teacher,
    .group-subjects-table .group-subject-cover {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        min-width: 0;
    }
    .group-subjects-table .group-subject-teacher::before,
    .group-subjects-table .group-subject-cover::before {
        content: attr(data-label);
        font-size: 0.625rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
    }
    .group-subjects-table .inline-assign-form {
        width: 100%;
    }
    .group-subjects-table .inline-assign-form .form-control {
        min-width: 0;
        max-width: none;
        width: 100%;
    }
    .group-subjects-table .group-subject-teacher .text-muted {
        max-width: none;
    }
    .group-subjects-table .class-cover-details {
        width: 100%;
    }
    .group-subjects-table .class-cover-summary {
        width: 100%;
        justify-content: flex-start;
    }
    .group-subjects-table .class-cover-summary-label {
        white-space: nowrap;
    }
    .group-subjects-table .class-cover-upload-panel {
        position: static;
        width: 100%;
        margin-top: 0.5rem;
        right: auto;
    }
    .group-subject-add-form {
        flex-direction: column;
        align-items: stretch;
    }
    .group-subject-add-form .searchable-select {
        max-width: none;
        min-width: 0;
        width: 100%;
    }
    .group-subject-add-form .btn {
        width: 100%;
    }
}

.searchable-select {
    position: relative;
}
.searchable-select__native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.searchable-select__control {
    position: relative;
}
.searchable-select__control .fa-magnifying-glass {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8125rem;
    pointer-events: none;
}
.searchable-select__input {
    width: 100%;
    padding-left: 2.15rem;
}
.searchable-select__panel {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: calc(100% + 0.25rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    max-height: 220px;
    overflow-y: auto;
}
.searchable-select__panel[hidden] {
    display: none;
}
.searchable-select__option {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--ink);
}
.searchable-select__option:hover,
.searchable-select__option.is-active {
    background: var(--surface-2);
}
.searchable-select__option.is-selected {
    font-weight: 600;
}
.searchable-select__empty {
    margin: 0;
    padding: 0.65rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.group-subject-add {
    position: relative;
    z-index: 2;
}
.group-subject-add-hint {
    margin: 0.35rem 0 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.group-subject-add-hint.hidden { display: none; }

.group-detail-header { margin-bottom: 0; }
.group-detail-header .panel-header { margin-bottom: 0; }

.user-profile-header {
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}
.user-profile-header::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #7c3aed);
}
.user-profile-header .panel-header { margin-bottom: 0; align-items: flex-start; }
.user-profile-intro {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}
.user-profile-avatar {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 1.25rem;
    box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px rgba(15, 108, 191, 0.25);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.user-profile-avatar--teacher {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
}
.user-profile-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.user-profile-title-row h2 {
    margin: 0;
    font-size: 1.35rem;
}
.user-profile-role {
    margin: 0.35rem 0 0;
    font-size: 0.875rem;
}
.user-profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: start;
}
@media (min-width: 900px) {
    .user-profile-grid {
        grid-template-columns: 1fr 1fr;
    }
    /* Panels containing tables read better at full width */
    .user-profile-grid > .user-profile-panel:has(.table-wrap) {
        grid-column: 1 / -1;
    }
}
.user-profile-panel {
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.user-profile-panel:hover {
    border-color: rgba(15, 108, 191, 0.28);
    box-shadow: var(--shadow);
}
.user-profile-panel h3 {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0 0 1rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
    font-weight: 700;
}
.user-profile-panel h3 i {
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.55rem;
    background: rgba(15, 108, 191, 0.1);
    color: var(--primary);
    font-size: 0.85rem;
}
.user-profile-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
    margin: 0;
}
@media (min-width: 640px) {
    .user-profile-details {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
}
.user-profile-details div {
    min-width: 0;
    padding: 0.55rem 0.7rem;
    border-radius: 0.6rem;
    background: var(--surface-2, var(--surface-muted));
    border: 1px solid transparent;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.user-profile-details div:hover {
    border-color: var(--border);
}
.user-profile-details dt {
    margin: 0 0 0.2rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.user-profile-details dd {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    word-break: break-word;
}
.user-profile-avatar--large {
    width: 6rem;
    height: 6rem;
    font-size: 2rem;
}
.user-profile-photo-preview {
    margin: 1rem 0 1.25rem;
}
.user-profile-photo-panel h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    font-weight: 700;
}

/* Profile page */
.profile-page { max-width: 960px; }
.ai-token-meter--profile {
    margin-bottom: 1rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.ai-token-meter--profile .ai-token-meter__icon {
    width: auto;
    height: auto;
    font-size: 0.9rem;
}
.ai-token-meter--profile .ai-token-meter__head strong { font-size: 0.9rem; }
.ai-token-meter--profile .ai-token-meter__head small { font-size: 0.75rem; }
.ai-token-meter--profile .ai-token-meter__percent { font-size: 0.8rem; }
.ai-token-meter--profile .ai-token-meter__numbers {
    margin-top: 0.65rem;
    font-size: 0.75rem;
}
.ai-token-meter--profile .ai-token-meter__numbers strong { font-size: 0.85rem; }
.ai-token-meter--profile .ai-token-meter__track {
    height: 0.35rem;
    margin-top: 0.5rem;
}
.ai-token-meter--profile .ai-token-meter__note {
    margin-top: 0.55rem;
    font-size: 0.72rem;
}
.essay-ai-review {
    margin: 0.5rem 0 0;
    padding: 0;
    border: 1px solid #dbe7f3;
    border-radius: 0.75rem;
    background: linear-gradient(180deg, #fbfdff 0%, #f6faff 100%);
    overflow: hidden;
}
.essay-ai-review--has-result {
    border-color: #c7dff3;
    box-shadow: 0 1px 3px rgba(15, 76, 129, 0.06);
}
.essay-ai-review__footer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    width: 100%;
    padding: 0.65rem 0.75rem 0.75rem;
    border-top: 1px solid #e2ebf5;
    background: rgba(255, 255, 255, 0.72);
}
.essay-ai-review--has-result .essay-ai-review__footer {
    border-top-color: #dbe7f3;
}
.essay-ai-review__footer-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    width: 100%;
}
.essay-ai-review__progress {
    width: 100%;
}
.essay-ai-review__progress-track {
    height: 4px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}
.essay-ai-review__progress-bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #38bdf8, #0ea5e9);
    transition: width 0.35s ease;
}
.essay-ai-review.is-loading .essay-ai-review__progress-bar {
    transition: width 0.4s ease;
}
.essay-ai-review__btn {
    flex-shrink: 0;
    border-color: #9ec5e8;
    color: #0f4c81;
    background: #fff;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(15, 76, 129, 0.08);
}
.essay-ai-review__btn:hover:not(:disabled) {
    background: #eef6fc;
    border-color: #7eb3de;
    color: #0a3d66;
}
.essay-ai-review__btn:disabled { opacity: 0.55; }
.essay-ai-review__status {
    margin: 0;
    flex: 1;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
}
.essay-ai-review__status:empty { display: none; }
.essay-ai-review__status.is-error { color: #b91c1c; }
.essay-ai-review__result {
    padding: 0.75rem 0.75rem 0;
}
.essay-ai-review__ratings {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem;
}
.essay-ai-review__card {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    padding: 0.55rem 0.6rem 0.5rem;
    border-radius: 0.6rem;
    border: 1px solid #e2e8f0;
    background: #fff;
}
.essay-ai-review__card-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: inherit;
    opacity: 0.85;
}
.essay-ai-review__card-score {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1;
    color: inherit;
}
.essay-ai-review__card-score small {
    margin-left: 0.1rem;
    font-size: 0.72rem;
    font-weight: 600;
    opacity: 0.7;
}
.essay-ai-review__card-meter {
    display: block;
    height: 4px;
    margin-top: 0.15rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    overflow: hidden;
}
.essay-ai-review__card-meter i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: currentColor;
    opacity: 0.55;
}
.essay-ai-review__score--low {
    border-color: #fecaca;
    background: #fff7f7;
    color: #b91c1c;
}
.essay-ai-review__score--mid {
    border-color: #fde68a;
    background: #fffbeb;
    color: #b45309;
}
.essay-ai-review__score--high {
    border-color: #a7f3d0;
    background: #f0fdf8;
    color: #047857;
}
.essay-ai-review__details-wrap {
    margin-top: 0.65rem;
    padding-bottom: 0.75rem;
}
.essay-ai-review__details-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.38rem 0.7rem;
    border: 1px solid #c7dff3;
    border-radius: 999px;
    background: #fff;
    color: #0f4c81;
    font-size: 0.78rem;
    font-weight: 650;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.essay-ai-review__details-toggle:hover {
    background: #eef6fc;
    border-color: #9ec5e8;
}
.essay-ai-review__details-toggle.is-open {
    background: #eef6fc;
    border-color: #7eb3de;
}
.essay-ai-review__details-chevron {
    font-size: 0.68rem;
    transition: transform 0.2s ease;
}
.essay-ai-review__details-toggle.is-open .essay-ai-review__details-chevron {
    transform: rotate(180deg);
}
.essay-ai-review__details {
    margin-top: 0.65rem;
    padding: 0.85rem 0.95rem;
    border: 1px solid #dbe7f3;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.88);
}
.essay-ai-review__summary {
    margin: 0 0 0.75rem;
    color: #334155;
    font-size: 0.84rem;
    line-height: 1.55;
}
.essay-ai-review__detail-group + .essay-ai-review__detail-group {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #e2ebf5;
}
.essay-ai-review__detail-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.4rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.essay-ai-review__detail-title--strengths { color: #047857; }
.essay-ai-review__detail-title--improvements { color: #b45309; }
.essay-ai-review__detail-list {
    margin: 0;
    padding-left: 1.1rem;
    color: #475569;
    font-size: 0.82rem;
    line-height: 1.45;
}
.essay-ai-review__detail-list li + li {
    margin-top: 0.35rem;
}
@media (max-width: 900px) {
    .essay-ai-review__ratings {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
.quiz-review-question__body--essay {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Compact question-type configurator */
.ai-config-body .ai-field:has(.ai-type-config-grid) {
    padding: 1rem;
    border: 1px solid #d9e1e8;
    border-radius: 1rem;
    background: #f2f4f7;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.ai-config-body .ai-field__row {
    margin-bottom: 0;
}
.ai-config-body .ai-field__row .ai-field__label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1f2937;
}
.ai-config-body #aiTypesToggleAll {
    padding: 0.3rem 0.65rem;
    border-color: #d8e2ec;
    border-radius: 999px;
    background: #fff;
    color: #52606d;
    font-size: 0.7rem;
}
.ai-config-body #aiTypesToggleAll:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.ai-config-body .ai-allocation-mode {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(190px, 1fr));
    gap: 0.25rem;
    margin: 0.75rem 0 1rem;
    padding: 0.25rem;
    border: 1px solid #d5dde5;
    border-radius: 0.8rem;
    background: #e7ebf0;
}
.ai-config-body .ai-allocation-option {
    min-height: 48px;
    padding: 0.55rem 0.7rem;
    border: 0;
    border-radius: 0.6rem;
    background: transparent;
}
.ai-config-body .ai-allocation-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.ai-config-body .ai-allocation-option::before {
    content: "";
    width: 0.85rem;
    height: 0.85rem;
    flex: 0 0 0.85rem;
    border: 2px solid #a8b5c2;
    border-radius: 50%;
    box-shadow: inset 0 0 0 2px #fff;
}
.ai-config-body .ai-allocation-option.is-selected {
    background: #fff;
    box-shadow: 0 1px 3px rgba(21, 41, 61, 0.12);
}
.ai-config-body .ai-allocation-option.is-selected::before {
    border-color: var(--primary);
    background: var(--primary);
}
.ai-config-body .ai-allocation-option strong {
    color: #243447;
    font-size: 0.76rem;
}
.ai-config-body .ai-allocation-option small {
    margin-top: 0.05rem;
    font-size: 0.64rem;
}
.ai-config-body .ai-type-config-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
}
.ai-config-body .ai-type-config-card {
    position: relative;
    overflow: hidden;
    border-color: #d4dde6;
    border-radius: 0.8rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(30, 50, 70, 0.08);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.ai-config-body .ai-type-config-card:hover {
    border-color: #a9c7df;
    transform: translateY(-1px);
}
.ai-config-body .ai-type-config-card.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(15, 108, 191, 0.12), 0 5px 14px rgba(30, 80, 120, 0.08);
}
.ai-config-body .ai-type-config-card .ai-type-chip {
    min-height: 50px;
    padding: 0.65rem 2rem 0.65rem 0.7rem;
    background: transparent;
    color: #334155;
}
.ai-config-body .ai-type-config-card .ai-type-chip::after {
    content: "";
    position: absolute;
    top: 0.85rem;
    right: 0.75rem;
    width: 0.9rem;
    height: 0.9rem;
    border: 1.5px solid #bec9d3;
    border-radius: 0.3rem;
    background: #fff;
}
.ai-config-body .ai-type-config-card .ai-type-chip.is-selected::after {
    content: "\2713";
    display: grid;
    place-items: center;
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    font-size: 0.64rem;
    font-weight: 800;
    line-height: 1;
}
.ai-config-body .ai-type-config-card .ai-type-chip i {
    display: grid;
    width: 1.75rem;
    height: 1.75rem;
    flex: 0 0 1.75rem;
    place-items: center;
    border-radius: 0.5rem;
    background: #edf3f8;
    color: #597085;
    font-size: 0.78rem;
}
.ai-config-body .ai-type-config-card.is-selected .ai-type-chip i {
    background: #e6f2fc;
    color: var(--primary);
}
.ai-config-body .ai-type-config-card .ai-type-chip span {
    font-size: 0.76rem;
    font-weight: 700;
}
.ai-config-body .ai-type-config-card__options {
    min-height: 52px;
    padding: 0.55rem 0.7rem;
    border-top-color: #e7edf3;
    background: #eef2f6;
}
.ai-config-body .ai-type-option {
    min-width: 0;
    justify-content: space-between;
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 600;
}
.ai-config-body .ai-type-option .form-control {
    width: 3.6rem;
    min-height: 1.9rem;
    padding: 0.2rem 0.35rem;
    border-color: #d5dee7;
    border-radius: 0.45rem;
    background: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
}
.ai-config-body .ai-type-option--check {
    justify-content: flex-start;
    gap: 0.45rem;
    color: #475569;
    line-height: 1.25;
}
.ai-config-body .ai-type-option--check input {
    accent-color: var(--primary);
}
.ai-config-body .ai-type-total {
    margin-top: 0.7rem;
    color: #64748b;
}
.ai-config-body .ai-type-total strong {
    color: #243447;
}
@media (max-width: 900px) {
    .ai-config-body .ai-type-config-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 620px) {
    .ai-config-body .ai-allocation-mode,
    .ai-config-body .ai-type-config-grid {
        width: 100%;
        grid-template-columns: 1fr;
    }
}
.quiz-editor-pane__head-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.quiz-ai-question-button {
    border-color: #b9d7ef;
    background: #eef7ff;
    color: #0f6099;
}
.quiz-ai-question-button:hover {
    border-color: var(--primary);
    background: #e2f1fd;
    color: var(--primary-dark);
}
.quiz-ai-question-status {
    margin: 0.75rem 1rem 0;
    padding: 0.65rem 0.8rem;
    border: 1px solid #cfe1ef;
    border-radius: 0.65rem;
    background: #f2f8fd;
    color: #36566f;
    font-size: 0.75rem;
}
.quiz-ai-question-status.is-success {
    border-color: #b9dfc9;
    background: #f0faf4;
    color: #25633e;
}
.quiz-ai-question-status.is-error {
    border-color: #efc4c4;
    background: #fff4f4;
    color: #9f2f2f;
}
.quiz-start-card,
.quiz-attempt-shell {
    max-width: 900px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.quiz-start-card__body { padding: 1.5rem; }
.quiz-start-card__body h1 { margin: 0.25rem 0 0.75rem; }
.quiz-start-instructions { margin-bottom: 1rem; color: var(--text-muted); line-height: 1.6; }
.quiz-start-facts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
    margin: 1rem 0;
}
.quiz-start-facts span {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    background: var(--surface-2);
    font-size: 0.75rem;
}
.quiz-start-facts i { color: var(--primary); }
.quiz-start-warning { align-items: flex-start; }

/* Full-viewport quiz focus mode */
.quiz-focus-active {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: #eef2f6;
}
.quiz-focus-active .moodle-app {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.quiz-focus-active .moodle-layout.quiz-focus-layout {
    margin-top: 0;
    min-height: 0;
    height: 100%;
    flex: 1 1 auto;
    overflow: hidden;
}
.quiz-focus-main {
    padding: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    width: 100% !important;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}
.quiz-focus-main .page-content,
.page-content--quiz-focus {
    padding: 0 !important;
    max-width: none !important;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.quiz-focus-main .toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 200;
    width: auto;
    max-width: 360px;
    margin: 0;
}
.quiz-attempt-shell--focus {
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #eef2f6;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}
.quiz-attempt-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: #fff;
    flex-shrink: 0;
}
.quiz-attempt-toolbar__identity {
    min-width: 0;
    flex: 1;
}
.quiz-attempt-toolbar__kicker {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.quiz-attempt-toolbar__title {
    margin: 0.1rem 0 0.15rem;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.25;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.quiz-attempt-toolbar__meta {
    margin: 0 0 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}
.quiz-attempt-toolbar__aside {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}
.quiz-attempt-progress {
    height: 0.35rem;
    overflow: hidden;
    border-radius: 999px;
    background: #dbe4ec;
    max-width: 18rem;
}
.quiz-attempt-progress span { display: block; height: 100%; background: var(--primary); }
.quiz-attempt-timer {
    padding: 0.45rem 0.7rem;
    border: 1px solid #f0d8a7;
    border-radius: 0.6rem;
    background: #fff8e8;
    color: #855d10;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.quiz-attempt-toolbar .quiz-exit-submit {
    border-color: #e3bcbc;
    color: #9b3434;
}
.quiz-attempt-toolbar .quiz-exit-submit:hover {
    border-color: #c96d6d;
    background: #fff3f3;
}
.quiz-attempt-body {
    display: grid;
    grid-template-columns: minmax(12.5rem, 15.5rem) minmax(0, 1fr);
    gap: 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
.quiz-attempt-nav {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 0.9rem;
    border-right: 1px solid var(--border);
    background: #fff;
    overflow: auto;
}
.quiz-attempt-nav__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}
.quiz-attempt-nav__head strong {
    font-size: 0.82rem;
    font-weight: 800;
}
.quiz-attempt-nav__head span {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
}
.quiz-attempt-nav__legend {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
}
.quiz-attempt-nav__legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.quiz-nav-swatch {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 0.2rem;
    display: inline-block;
    border: 1.5px solid transparent;
}
.quiz-nav-swatch--answered {
    background: #1b7a3d;
    border-color: #1b7a3d;
}
.quiz-nav-swatch--unanswered {
    background: #fff;
    border-color: #94a3b8;
}
.quiz-nav-swatch--current {
    background: #eff6ff;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(15, 108, 191, 0.18);
}
.quiz-attempt-nav__grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.4rem;
}
.quiz-nav-item {
    appearance: none;
    width: 100%;
    aspect-ratio: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.55rem;
    border: 1.5px solid #cbd5e1;
    background: #fff;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    line-height: 1;
    padding: 0;
    transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.12s;
}
button.quiz-nav-item:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}
.quiz-nav-item.is-answered {
    background: #e8f8ee;
    border-color: #1b7a3d;
    color: #1b7a3d;
}
.quiz-nav-item.is-unanswered {
    background: #fff;
    border-color: #94a3b8;
    border-style: dashed;
    color: #64748b;
}
.quiz-nav-item.is-current {
    background: #eff6ff;
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 0 2px rgba(15, 108, 191, 0.2);
    cursor: default;
}
.quiz-nav-item.is-current.is-answered {
    background: #e8f8ee;
    border-color: var(--primary);
    color: #1b7a3d;
}
.quiz-attempt-form {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #eef2f6;
}
.quiz-attempt-stage {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 1.25rem 1.5rem;
}
.quiz-attempt-shell--focus .quiz-question-block {
    margin: 0 auto;
    max-width: 48rem;
    padding: 1.35rem 1.45rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
}
.quiz-attempt-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.9rem 1.5rem;
    border-top: 1px solid var(--border);
    background: #fff;
    flex-shrink: 0;
}
@media (max-width: 900px) {
    .quiz-attempt-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
    }
    .quiz-attempt-nav {
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding: 0.75rem 0.9rem;
        max-height: none;
        overflow: visible;
    }
    .quiz-attempt-nav__legend {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.45rem 0.85rem;
    }
    .quiz-attempt-nav__grid {
        grid-template-columns: repeat(auto-fill, minmax(2.35rem, 1fr));
        max-width: 100%;
    }
    .quiz-nav-item {
        aspect-ratio: auto;
        height: 2.35rem;
    }
}
@media (max-width: 700px) {
    .quiz-start-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quiz-attempt-toolbar {
        flex-wrap: wrap;
        padding: 0.75rem 0.9rem;
    }
    .quiz-attempt-toolbar__aside {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    .quiz-attempt-stage { padding: 0.9rem; }
    .quiz-attempt-actions { padding: 0.75rem 0.9rem; }
    .quiz-attempt-shell--focus .quiz-question-block { padding: 1rem; }
}

.quiz-attempt-nav__review {
    width: 100%;
    justify-content: center;
    margin-top: 0.25rem;
}
.quiz-attempt-body--review .quiz-attempt-nav a.quiz-nav-item {
    text-decoration: none;
}
.quiz-review-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: 48rem;
    margin: 0 auto 1rem;
    padding: 0.9rem 1rem;
    border-radius: 0.85rem;
    border: 1px solid var(--border);
    background: #fff;
}
.quiz-review-banner i {
    margin-top: 0.15rem;
    font-size: 1.1rem;
}
.quiz-review-banner strong {
    display: block;
    font-size: 0.95rem;
}
.quiz-review-banner p {
    margin: 0.2rem 0 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.quiz-review-banner--warn {
    border-color: #f0d8a7;
    background: #fff8e8;
}
.quiz-review-banner--warn i { color: #a6670e; }
.quiz-review-banner--ok {
    border-color: #b8dfc4;
    background: #f0faf3;
}
.quiz-review-banner--ok i { color: #1b7a3d; }
.quiz-review-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-width: 48rem;
    margin: 0 auto;
}
.quiz-review-item {
    padding: 1rem 1.1rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
}
.quiz-review-item.is-unanswered {
    border-color: #f0d8a7;
    background: linear-gradient(180deg, #fffdf8 0%, #fff 55%);
}
.quiz-review-item__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.quiz-review-item__title {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    min-width: 0;
}
.quiz-review-item__num {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.55rem;
    background: #eef2f7;
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 800;
}
.quiz-review-item.is-unanswered .quiz-review-item__num {
    background: #fff3cd;
    color: #856404;
}
.quiz-review-item__title strong {
    display: block;
    font-size: 0.95rem;
    line-height: 1.35;
}
.quiz-review-item__meta {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
}
.quiz-review-item__badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
}
.quiz-review-item__badge--ok {
    background: #e8f8ee;
    color: #1b7a3d;
}
.quiz-review-item__badge--miss {
    background: #fff3cd;
    color: #856404;
}
.quiz-review-item__media {
    margin: 0 0 0.75rem;
}
.quiz-review-item__answer {
    padding: 0.75rem 0.85rem;
    border-radius: 0.65rem;
    background: #f8fafc;
    border: 1px solid #e8edf3;
}
.quiz-review-item__answer-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.quiz-review-item__answer-body {
    margin: 0;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
}
.quiz-review-item__answer-body--empty {
    color: var(--text-muted);
    font-style: italic;
}
.quiz-review-item__actions {
    margin-top: 0.75rem;
}
.quiz-attempt-actions--review {
    position: sticky;
    bottom: 0;
}
.profile-hero {
    --profile-accent: var(--primary);
    --profile-accent-dark: var(--primary-dark);
    --profile-accent-soft: var(--primary-light);
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    margin-bottom: 1.25rem;
    border: 1px solid #d4e4f4;
    box-shadow: var(--shadow);
    background: #fff;
}
.profile-hero--teacher,
.profile-hero--student,
.profile-hero--admin,
.profile-hero--super {
    --profile-accent: var(--primary);
    --profile-accent-dark: var(--primary-dark);
    --profile-accent-soft: var(--primary-light);
}
.profile-hero__cover {
    height: 7rem;
    background:
        linear-gradient(135deg, rgba(15, 108, 191, 0.07) 0%, rgba(15, 108, 191, 0.02) 42%, transparent 100%),
        linear-gradient(180deg, #f4f8fc 0%, #fafcfe 100%);
    border-bottom: 1px solid rgba(15, 108, 191, 0.08);
}
.profile-hero__content {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.35rem 1.35rem;
    margin-top: -2.75rem;
}
.profile-hero__main {
    display: flex;
    align-items: flex-end;
    gap: 1.15rem;
    min-width: 0;
    flex: 1;
}
.profile-hero__avatar-ring {
    flex-shrink: 0;
    padding: 0.25rem;
    border-radius: 999px;
    background: #fff;
    box-shadow: var(--shadow-md);
}
.profile-hero__avatar {
    width: 5.5rem !important;
    height: 5.5rem !important;
    font-size: 1.75rem !important;
    font-weight: 800 !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, var(--profile-accent), var(--profile-accent-dark)) !important;
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.profile-hero__avatar.user-avatar--image {
    background: var(--surface) !important;
    overflow: hidden;
}
.profile-hero__text { min-width: 0; padding-top: 3rem; }
.profile-hero__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.45rem;
}
.profile-role-badge,
.profile-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.profile-role-badge { background: var(--profile-accent-soft); color: var(--profile-accent-dark); }
.profile-status-badge--active { background: #eaf7ef; color: #0f5132; }
.profile-status-badge--inactive { background: #f8d7da; color: #721c24; }
.profile-hero__name {
    margin: 0 0 0.2rem;
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
}
.profile-hero__email {
    display: inline-block;
    font-size: 0.875rem;
    color: var(--ink-2);
    text-decoration: none !important;
    margin-bottom: 0.45rem;
}
.profile-hero__email:hover { color: var(--profile-accent); text-decoration: underline !important; }
.profile-hero__username {
    margin: 0.15rem 0 0.35rem;
    font-size: 0.875rem;
    color: var(--ink-2);
    font-weight: 500;
}
.profile-hero__username i {
    margin-right: 0.2rem;
    color: var(--profile-accent);
    font-size: 0.8em;
}
.profile-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.profile-hero__meta i { margin-right: 0.25rem; color: var(--profile-accent); }
.profile-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-self: flex-end;
    padding-bottom: 0.15rem;
}
.profile-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 900px) {
    .profile-layout { grid-template-columns: minmax(260px, 320px) 1fr; }
}
.profile-layout__aside { min-width: 0; }
.profile-layout__main { padding: 1.15rem 1.25rem 1.35rem; }
.profile-section-head { margin-bottom: 1rem; }
.profile-section-head h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.25rem;
    font-size: 1.1rem;
    font-weight: 800;
}
.profile-section-head h2 i { color: var(--primary); }
.profile-section-head p { margin: 0; font-size: 0.875rem; }
.profile-details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
}
@media (min-width: 640px) {
    .profile-details-grid { grid-template-columns: 1fr 1fr; }
}
.profile-detail-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
}
.profile-detail-card__icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.85rem;
}
.profile-detail-card__body { min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.profile-detail-card__label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.profile-detail-card__value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}
a.profile-detail-card__value:hover { color: var(--primary); }
.profile-photo-card { padding: 1.15rem 1.25rem; }
.profile-photo-drawer { margin-bottom: 1rem; }
.profile-photo-drawer[hidden] { display: none !important; }
.profile-photo-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}
.profile-photo-drawer__head h3 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}
.profile-photo-drawer__head h3 i { color: var(--primary); }
.profile-photo-drawer__close {
    border: none;
    background: var(--bg);
    color: var(--text-muted);
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.profile-photo-drawer__close:hover { background: var(--border); color: var(--text); }
.profile-photo-drawer__desc { margin: 0 0 1rem; font-size: 0.8125rem; }
.profile-photo-drawer__body { padding-top: 0; }
.profile-photo-card__head h3 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 700;
}
.profile-photo-card__head h3 i { color: var(--primary); }
.profile-photo-card__head p { margin: 0 0 1rem; font-size: 0.8125rem; }
.profile-photo-card__preview { text-align: center; margin-bottom: 1rem; }
.profile-photo-card__avatar {
    width: 5rem !important;
    height: 5rem !important;
    font-size: 1.5rem !important;
    margin: 0 auto;
}
.profile-photo-upload { display: block; cursor: pointer; }
.profile-photo-upload input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}
.profile-photo-upload__box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1.15rem 1rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg);
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
}
.profile-photo-upload:hover .profile-photo-upload__box,
.profile-photo-upload:focus-within .profile-photo-upload__box {
    border-color: var(--primary);
    background: var(--primary-light);
}
.profile-photo-upload__box i { font-size: 1.35rem; color: var(--primary); margin-bottom: 0.15rem; }
.profile-photo-upload__box strong { font-size: 0.875rem; color: var(--text); }
.profile-photo-upload__box span { font-size: 0.75rem; color: var(--text-muted); }
.profile-photo-note {
    margin: 0.65rem 0 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
}
.profile-photo-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
}
.profile-section-head--compact { margin-top: 1.35rem; padding-top: 1.25rem; border-top: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.profile-section-head--compact h3 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.25rem;
    font-size: 1rem;
    font-weight: 800;
}
.profile-section-head--compact h3 i { color: var(--primary); }
.profile-teaching-count {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary-dark);
    white-space: nowrap;
}
.profile-teaching-section { margin-top: 0.25rem; }
.profile-teaching-empty {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-lg);
    background: var(--surface-2);
    border: 1px dashed var(--border);
    color: var(--text-muted);
    font-size: 0.875rem;
}
.profile-teaching-empty i { color: var(--primary); margin-top: 0.15rem; }
.profile-teaching-empty p { margin: 0; }
.profile-subject-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
@media (min-width: 720px) {
    .profile-subject-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.profile-subject-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.profile-subject-card:hover {
    border-color: rgba(15, 108, 191, 0.22);
    box-shadow: var(--shadow);
}
.profile-subject-card__head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.profile-subject-card__icon {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.6rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.95rem;
}
.profile-subject-card__title { min-width: 0; }
.profile-subject-card__title strong { display: block; font-size: 1rem; font-weight: 800; line-height: 1.2; }
.profile-subject-card__title span {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    line-height: 1.35;
}
.profile-subject-card__classes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border);
}
.profile-subject-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-2);
    text-decoration: none !important;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.profile-subject-chip:hover {
    border-color: rgba(15, 108, 191, 0.28);
    background: var(--primary-light);
    color: var(--primary-dark);
    text-decoration: none !important;
}
.profile-subject-chip i { color: var(--primary); font-size: 0.7rem; }
.profile-subject-chip__year {
    color: var(--text-muted);
    font-weight: 500;
}
.profile-subject-chip__year::before { content: '·'; margin-right: 0.35rem; }
.profile-subject-card__pending {
    margin: 0;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-style: italic;
}
@media (max-width: 720px) {
    .profile-hero__content { flex-direction: column; align-items: stretch; }
    .profile-hero__main { flex-direction: column; align-items: center; text-align: center; }
    .profile-hero__text { padding-top: 0; }
    .profile-hero__badges,
    .profile-hero__meta { justify-content: center; }
    .profile-hero__actions { justify-content: center; }
}
.image-upload-preview-note {
    margin: 0 0 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
}
[data-preview-cover].is-previewing,
[data-preview-avatar].is-previewing {
    outline: 2px solid rgba(15, 108, 191, 0.45);
    outline-offset: 2px;
}
[data-preview-cover].is-previewing {
    box-shadow: inset 0 0 0 9999px rgba(15, 108, 191, 0.08);
}
.panel h3 { font-size: 1rem; margin-bottom: 0.75rem; font-weight: 700; }

.admin-form-card .panel { margin-bottom: 0; }

/* Compact subject add/edit form */
.admin-form-card--subject .panel {
    padding: 0.85rem 1rem;
}
.admin-form-card--subject .panel h2 {
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
}
.admin-form-card--subject .panel > .text-muted.mb-1 {
    font-size: 0.75rem;
    line-height: 1.4;
    margin-bottom: 0.65rem !important;
}
.admin-form-card--subject .subject-form__basics {
    grid-template-columns: 9rem 1fr minmax(8.5rem, 11rem);
    gap: 0.65rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px dashed var(--border);
}
.admin-form-card--subject .form-group {
    margin-bottom: 0;
}
.admin-form-card--subject .form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.admin-form-card--subject .form-control {
    font-size: 0.8125rem;
    padding: 0.35rem 0.6rem;
}
.admin-form-card--subject .subject-form .actions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.admin-form-card--subject .subject-form .actions .btn {
    font-size: 0.8125rem;
    padding: 0.4rem 0.85rem;
}

.admin-form-card--subject .grading-scheme-fieldset--featured {
    position: relative;
    padding: 0;
    margin: 0.85rem 0 0;
    border: 1px solid #b8d4f0;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #f0f7ff 0%, #fafcff 48%, #fff 100%);
    box-shadow: 0 2px 8px rgba(15, 108, 191, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    overflow: hidden;
}
.admin-form-card--subject .grading-scheme-legend {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    float: left;
    width: auto;
    margin: 0;
    padding: 0.55rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: 0.01em;
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid #d4e4f7;
    border-right: 1px solid #d4e4f7;
    border-radius: 0 0 var(--radius) 0;
}
.admin-form-card--subject .grading-scheme-legend__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 0.35rem;
    background: var(--primary);
    color: #fff;
    font-size: 0.6875rem;
}
.admin-form-card--subject .grading-scheme-fieldset__banner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    clear: both;
    padding: 0.65rem 0.85rem 0.55rem;
    border-bottom: 1px solid #d4e4f7;
    background: rgba(255, 255, 255, 0.55);
}
.admin-form-card--subject .grading-scheme-fieldset__banner-text strong {
    display: block;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.2rem;
}
.admin-form-card--subject .grading-scheme-fieldset__banner-text p {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.45;
    color: #475569;
    max-width: 52ch;
}
.admin-form-card--subject .grading-scheme-total-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 5.5rem;
    padding: 0.4rem 0.65rem;
    border-radius: var(--radius);
    border: 1px solid #cbd5e1;
    background: #fff;
    box-shadow: var(--shadow);
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
}
.admin-form-card--subject .grading-scheme-total-badge__label {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.admin-form-card--subject .grading-scheme-total-badge__value {
    font-size: 0.6875rem;
    color: var(--text-muted);
}
.admin-form-card--subject .grading-scheme-total-badge__value strong {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
}
.admin-form-card--subject .grading-scheme-total-badge.is-valid {
    border-color: #6ee7b7;
    background: #ecfdf5;
}
.admin-form-card--subject .grading-scheme-total-badge.is-valid .grading-scheme-total-badge__value strong {
    color: #047857;
}
.admin-form-card--subject .grading-scheme-total-badge.is-invalid {
    border-color: #fcd34d;
    background: #fffbeb;
}
.admin-form-card--subject .grading-scheme-total-badge.is-invalid .grading-scheme-total-badge__value strong {
    color: #b45309;
}
.admin-form-card--subject .grading-scheme-total-badge.is-empty .grading-scheme-total-badge__value strong {
    color: #94a3b8;
}

.admin-form-card--subject .grading-scheme-fieldset--featured .grading-scheme-preview--compact {
    padding: 0.55rem 0.85rem 0;
    margin-bottom: 0;
}
.admin-form-card--subject .grading-scheme-fieldset--featured .gb-weight-bar--admin .gb-weight-bar__track {
    height: 0.625rem;
    border: 1px solid #cbd5e1;
    background: #fff;
}
.admin-form-card--subject .grading-scheme-fieldset--featured .grading-scheme-toolbar {
    padding: 0.5rem 0.85rem 0;
    margin-bottom: 0;
}
.admin-form-card--subject .grading-scheme-fieldset--featured .grading-scheme-table-head {
    margin: 0.45rem 0.85rem 0.25rem;
    padding: 0.35rem 0.5rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius);
    border: 1px solid #e2e8f0;
}
.admin-form-card--subject .grading-scheme-fieldset--featured .grading-scheme-rows {
    padding: 0 0.85rem 0.65rem;
}

/* Apply grading scheme to other subjects */
.admin-form-card--subject .grading-scheme-apply {
    margin: 0 0.85rem 0.85rem;
    padding: 0.85rem 1rem;
    border: 1px solid #d4e4f7;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.75);
}
.admin-form-card--subject .grading-scheme-apply.is-active {
    border-color: var(--primary);
    background: #f8fbff;
}
.admin-form-card--subject .grading-scheme-apply__head strong {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    color: var(--text);
}
.admin-form-card--subject .grading-scheme-apply__head p {
    margin: 0.35rem 0 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.admin-form-card--subject .scheme-apply-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.admin-form-card--subject .scheme-apply-option {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
}
.admin-form-card--subject .scheme-apply-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}
.admin-form-card--subject .scheme-apply-option input {
    margin-top: 0.15rem;
    flex-shrink: 0;
}
.admin-form-card--subject .scheme-apply-option__text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}
.admin-form-card--subject .scheme-apply-option__text strong {
    font-size: 0.78rem;
    color: var(--text);
}
.admin-form-card--subject .scheme-apply-option__text small {
    font-size: 0.68rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.admin-form-card--subject .scheme-apply-panel {
    padding-top: 0.25rem;
}
.admin-form-card--subject .scheme-apply-panel.hidden {
    display: none;
}
.admin-form-card--subject .scheme-apply-panel__hint {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.admin-form-card--subject .scheme-apply-checkgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.4rem;
    max-height: 220px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.admin-form-card--subject .scheme-apply-check {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0.4rem 0.45rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.78rem;
}
.admin-form-card--subject .scheme-apply-check:hover {
    background: var(--surface-2);
}
.admin-form-card--subject .scheme-apply-check input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}
.admin-form-card--subject .scheme-apply-check__label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}
.admin-form-card--subject .scheme-apply-check__prefix {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--danger);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.admin-form-card--subject .scheme-apply-check__title {
    color: var(--text-muted);
    font-size: 0.72rem;
}
.admin-form-card--subject .subject-code-chip--sm {
    font-size: 0.68rem;
    padding: 0.1rem 0.35rem;
}

.admin-form-card--subject .grading-scheme-fieldset--featured .grading-scheme-toolbar__label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--primary-dark);
}
.admin-form-card--subject .grading-scheme-fieldset--featured .grading-scheme-toolbar__label i {
    margin-right: 0.15rem;
}

.admin-form-card--subject .grading-scheme-fieldset {
    padding: 0.6rem 0.75rem;
    margin: 0.5rem 0 0;
    border-radius: var(--radius);
}
.admin-form-card--subject .grading-scheme-fieldset legend {
    font-size: 0.8125rem;
    font-weight: 700;
    padding: 0 0.25rem;
}
.admin-form-card--subject .grading-scheme-help {
    font-size: 0.6875rem;
    margin-bottom: 0.45rem;
    line-height: 1.35;
}
.admin-form-card--subject .grading-scheme-preview--compact {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.45rem;
}
.admin-form-card--subject .grading-scheme-preview--compact .gb-weight-bar {
    flex: 1;
    min-width: 0;
    margin: 0;
}
.admin-form-card--subject .gb-weight-bar--admin .gb-weight-bar__track {
    height: 0.5rem;
}
.admin-form-card--subject .grading-weight-total-line {
    margin: 0;
    font-size: 0.6875rem;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 600;
}
.admin-form-card--subject .grading-weight-total-line strong {
    font-size: 0.8125rem;
}
.admin-form-card--subject .grading-scheme-toolbar {
    margin-bottom: 0.45rem;
    gap: 0.25rem;
}
.admin-form-card--subject .grading-scheme-toolbar__label {
    font-size: 0.6875rem;
    margin-right: 0.1rem;
}
.admin-form-card--subject .gb-chip-btn {
    padding: 0.15rem 0.4rem;
    font-size: 0.6875rem;
    gap: 0.25rem;
}
.admin-form-card--subject .gb-chip-btn i {
    font-size: 0.625rem;
}
.admin-form-card--subject .grading-scheme-table-head {
    grid-template-columns: 7.5rem 1fr 5.5rem 1.75rem;
    gap: 0.35rem;
    padding: 0 0.15rem 0.25rem;
    font-size: 0.5625rem;
}
.admin-form-card--subject .grading-scheme-rows {
    gap: 0.3rem;
}
.admin-form-card--subject .grading-scheme-row {
    grid-template-columns: 7.5rem 1fr 5.5rem 1.75rem;
    gap: 0.35rem;
    padding: 0.3rem 0.4rem;
}
.admin-form-card--subject .grading-scheme-row__icon {
    width: 1.35rem;
    height: 1.35rem;
    font-size: 0.625rem;
    border-radius: 0.3rem;
}
.admin-form-card--subject .grading-scheme-row__type select,
.admin-form-card--subject .grading-scheme-row input.form-control {
    font-size: 0.75rem;
    padding: 0.25rem 0.4rem;
    min-height: 1.75rem;
}
.admin-form-card--subject .grading-scheme-row__pct {
    font-size: 0.6875rem;
}
.admin-form-card--subject .grading-scheme-row__remove {
    padding: 0.15rem 0.35rem;
    font-size: 0.6875rem;
    min-width: 1.75rem;
    min-height: 1.75rem;
}

@media (max-width: 640px) {
    .admin-form-card--subject .subject-form__basics {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .admin-form-card--subject .panel {
        padding: 0.75rem 0.85rem;
    }
    .admin-form-card--subject .subject-form__basics {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
    }
    .admin-form-card--subject .form-control {
        font-size: 0.875rem;
        padding: 0.5rem 0.7rem;
        min-height: 2.5rem;
    }
    .admin-form-card--subject .grading-scheme-fieldset--featured {
        margin-top: 0.75rem;
    }
    .admin-form-card--subject .grading-scheme-legend {
        float: none;
        width: 100%;
        border-right: none;
        border-radius: 0;
        padding: 0.65rem 0.85rem;
    }
    .admin-form-card--subject .grading-scheme-fieldset__banner {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
        padding: 0.75rem 0.85rem;
    }
    .admin-form-card--subject .grading-scheme-fieldset__banner-text p {
        max-width: none;
    }
    .admin-form-card--subject .grading-scheme-total-badge {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        min-width: 0;
        padding: 0.55rem 0.75rem;
        gap: 0.75rem;
    }
    .admin-form-card--subject .grading-scheme-total-badge__value {
        display: inline-flex;
        align-items: baseline;
        gap: 0.15rem;
    }
    .admin-form-card--subject .grading-scheme-fieldset--featured .grading-scheme-preview--compact,
    .admin-form-card--subject .grading-scheme-fieldset--featured .grading-scheme-toolbar,
    .admin-form-card--subject .grading-scheme-fieldset--featured .grading-scheme-rows {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    .admin-form-card--subject .grading-scheme-fieldset--featured .grading-scheme-toolbar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.4rem;
        padding-top: 0.65rem;
        padding-bottom: 0.15rem;
    }
    .admin-form-card--subject .grading-scheme-fieldset--featured .grading-scheme-toolbar__label {
        grid-column: 1 / -1;
        margin: 0 0 0.1rem;
        font-size: 0.75rem;
    }
    .admin-form-card--subject .gb-chip-btn {
        justify-content: center;
        width: 100%;
        min-height: 2.35rem;
        padding: 0.4rem 0.55rem;
        font-size: 0.75rem;
    }
    .admin-form-card--subject .gb-chip-btn i {
        font-size: 0.75rem;
    }
    .admin-form-card--subject .grading-scheme-fieldset--featured .grading-scheme-table-head {
        display: none;
    }
    .admin-form-card--subject .grading-scheme-rows {
        gap: 0.55rem;
        padding-bottom: 0.85rem;
    }
    .admin-form-card--subject .grading-scheme-row {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "type remove"
            "name name"
            "weight weight";
        gap: 0.5rem;
        padding: 0.7rem 0.75rem;
        align-items: center;
    }
    .admin-form-card--subject .grading-scheme-row__type {
        grid-area: type;
        min-width: 0;
    }
    .admin-form-card--subject .grading-scheme-row__label {
        grid-area: name;
        width: 100%;
    }
    .admin-form-card--subject .grading-scheme-row__weight {
        grid-area: weight;
        width: 100%;
    }
    .admin-form-card--subject .grading-scheme-row__weight::before {
        content: "Weight";
        font-size: 0.625rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-muted);
        margin-right: 0.35rem;
        flex-shrink: 0;
    }
    .admin-form-card--subject .grading-scheme-row__weight input {
        flex: 1;
        min-width: 0;
        text-align: left;
    }
    .admin-form-card--subject .grading-scheme-row__remove {
        grid-area: remove;
        align-self: start;
        min-width: 2.25rem;
        min-height: 2.25rem;
        font-size: 1rem;
    }
    .admin-form-card--subject .grading-scheme-row__type select,
    .admin-form-card--subject .grading-scheme-row input.form-control {
        font-size: 0.875rem;
        padding: 0.45rem 0.6rem;
        min-height: 2.4rem;
    }
    .admin-form-card--subject .grading-scheme-row__icon {
        width: 2rem;
        height: 2rem;
        font-size: 0.8rem;
    }
    .admin-form-card--subject .grading-scheme-apply {
        margin: 0 0.75rem 0.75rem;
        padding: 0.75rem;
    }
    .admin-form-card--subject .scheme-apply-options {
        grid-template-columns: 1fr;
    }
    .admin-form-card--subject .scheme-apply-checkgrid {
        grid-template-columns: 1fr;
    }
    .admin-form-card--subject .subject-form .actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    .admin-form-card--subject .subject-form .actions .btn {
        width: 100%;
        justify-content: center;
        min-height: 2.6rem;
        font-size: 0.875rem;
    }
}

/* Programs curriculum builder */
.program-curriculum-app { display: flex; flex-direction: column; gap: 1rem; }

.program-curriculum-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.85rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.program-toolbar-meta {
    flex: 1;
    min-width: min(100%, 280px);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.program-toolbar-desc {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text);
    line-height: 1.45;
    max-width: 52ch;
}
.program-toolbar-desc--muted { color: var(--text-muted); }
.program-build-steps {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.program-build-step {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: var(--text);
}
.program-build-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 800;
    line-height: 1;
}
.program-build-step-sep {
    width: 1rem;
    height: 1px;
    background: var(--border);
    flex-shrink: 0;
}
.program-toolbar-stats {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.program-toolbar-stats strong {
    color: var(--text);
    font-weight: 700;
}
.program-toolbar-stats-sep { opacity: 0.5; }
.program-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.program-toolbar-edit-btn { white-space: nowrap; }

.program-mode-toggle {
    display: inline-flex;
    padding: 0.2rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    gap: 0.15rem;
}
.program-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none !important;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.program-mode-btn:hover { color: var(--primary); background: var(--surface); }
.program-mode-btn.is-active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow);
}

/* Preview vs edit visibility */
.is-preview-mode [data-curriculum-edit] { display: none !important; }
.is-edit-mode [data-curriculum-preview] { display: none !important; }

.is-preview-mode .program-term-preview-body { display: block !important; }
.is-preview-mode .program-term-actions { display: none !important; }
.is-preview-mode .program-level-panel-head form { display: none !important; }
.is-preview-mode .program-level-panel-head .program-rename-form,
.is-preview-mode .program-level-panel-head [data-rename-toggle] { display: none !important; }

/* Preview layout: horizontal level tabs + term grid */
.is-preview-mode .program-curriculum-layout {
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
.is-preview-mode .program-curriculum-sidebar {
    position: static;
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
}
.is-preview-mode .program-curriculum-sidebar-head { display: none; }
.is-preview-mode .program-level-nav-row {
    display: block;
}
.is-preview-mode .program-level-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.5rem;
    margin-bottom: 0;
    padding: 0.35rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    scrollbar-width: thin;
}
.is-preview-mode .program-level-nav-item {
    min-width: 7.5rem;
    flex: 1 1 auto;
    align-items: center;
    text-align: center;
    padding: 0.6rem 0.85rem;
    box-shadow: none;
}
.is-preview-mode .program-level-nav-item.is-active {
    box-shadow: none;
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.is-preview-mode .program-level-nav-item.is-active .program-level-nav-label,
.is-preview-mode .program-level-nav-item.is-active .program-level-nav-meta {
    color: #fff;
}
.is-preview-mode .program-level-nav-meta { font-size: 0.6875rem; opacity: 0.9; }

.is-preview-mode .program-curriculum-main { min-width: 0; }
.is-preview-mode .program-level-panel {
    border: none;
    box-shadow: none;
    background: transparent;
    overflow: visible;
}
.is-preview-mode .program-level-panel-head { display: none; }
.is-preview-mode .program-terms-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 1rem;
    padding: 0;
}
.is-preview-mode .program-term-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.is-preview-mode .program-term-card-head {
    border-bottom: 1px solid var(--border);
}
.is-preview-mode .program-term-toggle {
    cursor: default;
    padding: 0.75rem 1rem;
    background: var(--surface-2);
}
.is-preview-mode .program-term-chevron { display: none; }
.is-preview-mode .program-term-preview-body {
    padding: 0;
    border: none;
    background: var(--surface);
}

/* Edit mode layout (matches preview: horizontal levels + term grid) */
.is-edit-mode .program-curriculum-layout {
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
.is-edit-mode .program-curriculum-sidebar {
    position: static;
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.is-edit-mode .program-curriculum-sidebar-head { display: none; }
.is-edit-mode .program-level-nav-row {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.is-edit-mode .program-level-nav {
    flex: 1 1 auto;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.5rem;
    margin-bottom: 0;
    padding: 0.35rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    scrollbar-width: thin;
}
.is-edit-mode .program-level-nav-item {
    min-width: 7.5rem;
    flex: 1 1 auto;
    align-items: center;
    text-align: center;
}
.is-edit-mode .program-level-nav-item.is-active {
    box-shadow: none;
    background: var(--primary);
    border-color: var(--primary);
}
.is-edit-mode .program-level-nav-item.is-active .program-level-nav-label,
.is-edit-mode .program-level-nav-item.is-active .program-level-nav-meta { color: #fff; }
.is-edit-mode .program-level-nav-meta { font-size: 0.6875rem; opacity: 0.9; }
.is-edit-mode .program-add-level-bar {
    display: flex;
    align-items: stretch;
    flex: 0 0 auto;
    min-width: 8.5rem;
}
.is-edit-mode .program-add-level-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    min-height: 100%;
    padding: 0.55rem 0.85rem;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--primary);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.is-edit-mode .program-add-level-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.is-edit-mode .program-add-level-bar.is-open {
    flex: 1 1 16rem;
    min-width: min(100%, 16rem);
}
.is-edit-mode .program-add-level-bar.is-open .program-add-level-btn {
    display: none;
}
.is-edit-mode .program-add-level-form {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.35rem;
    border: 1px solid #dbeafe;
    border-radius: var(--radius-lg);
    background: #eff6ff;
    flex-wrap: wrap;
}
.is-edit-mode .program-add-level-form[hidden] {
    display: none !important;
}
.is-edit-mode .program-add-level-form__input {
    flex: 1 1 10rem;
    min-width: 0;
}
.is-edit-mode .program-curriculum-main { min-width: 0; }
.is-edit-mode .program-level-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.is-edit-mode .program-level-panel-head {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.is-edit-mode .program-level-edit-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.is-edit-mode .program-level-identity {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}
.is-edit-mode .program-level-kicker {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.is-edit-mode .program-level-edit-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}
.is-edit-mode .program-level-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}
.is-edit-mode .program-terms-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 1rem;
}
.is-edit-mode .program-terms-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.is-edit-mode .program-term-card.is-open {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}
.is-edit-mode .program-level-toolbar--footer {
    border-bottom: none;
    border-top: 1px solid var(--border);
}
.is-edit-mode .program-term-empty--guided {
    padding: 1.25rem;
    text-align: left;
}
.is-edit-mode .program-guided-step {
    max-width: 28rem;
    margin: 0 auto;
    padding: 1.25rem 1.35rem;
    border: 1px solid #dbeafe;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
    text-align: left;
}
.is-edit-mode .program-guided-step-badge {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0.55rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.is-edit-mode .program-guided-step-badge--sm {
    margin-bottom: 0;
}
.is-edit-mode .program-guided-step h3 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 700;
}
.is-edit-mode .program-guided-step p {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.is-edit-mode .program-guided-term-form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.is-edit-mode .program-guided-term-form .btn {
    align-self: flex-start;
}

.program-term-preview-body {
    padding: 0.85rem 1rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.program-term-preview-empty {
    margin: 0;
    padding: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

.program-subject-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.program-subject-table thead {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.program-subject-table th {
    padding: 0.5rem 1rem;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.program-subject-table td {
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.program-subject-table tbody tr:last-child td { border-bottom: none; }
.program-subject-table tbody tr:hover { background: var(--bg); }
.program-subject-table-code {
    font-weight: 800;
    color: var(--primary-dark);
    white-space: nowrap;
    width: 5.5rem;
}

.program-code-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    width: fit-content;
}

.program-curriculum-layout {
    display: grid;
    grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}
.program-curriculum-sidebar {
    position: sticky;
    top: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow);
}
.program-curriculum-sidebar-head h3 {
    margin: 0 0 0.15rem;
    font-size: 0.9375rem;
    font-weight: 700;
}
.program-curriculum-sidebar-head p {
    margin: 0 0 0.85rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.program-level-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
}
.program-level-nav-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.program-level-nav-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.program-level-nav-item.is-active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: inset 3px 0 0 var(--primary);
}
.program-level-nav-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
}
.program-level-nav-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.program-add-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    justify-content: center;
    padding: 0.55rem 0.75rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--primary);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.program-add-trigger:hover { border-color: var(--primary); background: var(--primary-light); }
.program-add-trigger--inline { width: auto; }

.program-add-form {
    margin-top: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.program-add-form .form-group { margin-bottom: 0; }
.program-add-form--inline {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0;
}
.program-add-form--inline .form-control { min-width: min(100%, 260px); }
.program-add-form--centered {
    max-width: 320px;
    margin: 0 auto;
}

.program-curriculum-main { min-width: 0; }
.program-level-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.program-level-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.program-level-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
}

.program-rename-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}
.program-rename-wrap .program-rename-form { display: none; }
.program-rename-wrap.is-editing .program-term-heading { display: none; }
.program-rename-wrap.is-editing > .program-level-title { display: none; }
.program-rename-wrap.is-editing [data-rename-toggle] { display: none; }
.program-rename-form--inline {
    display: none;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}
.program-rename-wrap.is-editing .program-rename-form--inline {
    display: flex;
}
.program-rename-wrap .program-rename-form:not(.program-rename-form--inline):not(.program-rename-form--dropdown) { display: none; }
.program-rename-wrap.is-editing .program-rename-form {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}
.program-rename-wrap.is-editing [data-rename-toggle] { display: none; }
.program-rename-form--dropdown {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    z-index: 5;
    min-width: 220px;
    padding: 0.65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
.program-rename-wrap--compact { position: relative; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-icon:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }

.program-level-toolbar {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0.75rem 1.15rem;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}
.program-level-toolbar.is-open {
    background: #eff6ff;
    border-bottom-color: #dbeafe;
}
.program-level-toolbar--footer.is-open {
    border-top-color: #dbeafe;
}
.program-add-term-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    min-height: 2.4rem;
    padding: 0.55rem 0.9rem;
    border: 1px dashed #cbd5e1;
    border-radius: 0.65rem;
    background: #fff;
    color: var(--primary);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.program-add-term-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.program-add-term-btn i {
    font-size: 0.8rem;
}
.program-level-toolbar.is-open .program-add-term-btn {
    display: none;
}
.program-add-term-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    flex-wrap: wrap;
}
.program-add-term-form[hidden] {
    display: none !important;
}
.program-add-term-form__input {
    flex: 1 1 14rem;
    min-width: 0;
}
.program-add-term-form .btn {
    flex: 0 0 auto;
}

.program-term-empty {
    padding: 2rem 1.15rem;
    text-align: center;
    color: var(--text-muted);
}
.program-term-empty i { font-size: 1.75rem; opacity: 0.45; margin-bottom: 0.65rem; display: block; }
.program-term-empty p { margin: 0; font-size: 0.875rem; }

.program-terms-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 1rem 1.15rem 1.15rem;
}

.program-term-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg);
}
.program-term-card-head {
    display: flex;
    align-items: stretch;
    gap: 0;
}
.program-term-toggle {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border: none;
    background: var(--surface);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s;
}
.program-term-toggle:hover { background: var(--surface-2); }
.program-term-order {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.8125rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.program-term-heading {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}
.program-term-heading strong { font-size: 0.9375rem; color: var(--text); }
.program-term-heading small { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.program-term-chevron {
    margin-left: auto;
    color: var(--text-muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}
.program-term-card.is-open .program-term-chevron { transform: rotate(180deg); }
.program-term-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 0.5rem;
    border-left: 1px solid var(--border);
    background: var(--surface);
}
.program-term-body {
    display: none;
    padding: 0.85rem 1rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.program-term-card.is-open .program-term-body { display: block; }

.program-subject-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-bottom: 0.65rem;
}
.program-subject-search-wrap {
    position: relative;
    flex: 1;
    min-width: min(100%, 200px);
    max-width: 360px;
}
.program-subject-search-wrap i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8125rem;
    pointer-events: none;
}
.program-subject-search-wrap .form-control {
    padding-left: 2.1rem;
    font-size: 0.875rem;
}
.program-subject-filter {
    display: inline-flex;
    padding: 0.15rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    gap: 0.1rem;
}
.program-subject-filter-btn {
    padding: 0.35rem 0.65rem;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    background: transparent;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.program-subject-filter-btn:hover { color: var(--primary); }
.program-subject-filter-btn.is-active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow);
}

.program-subject-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-bottom: 0.65rem;
    padding: 0.5rem 0.65rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.program-subject-summary-count {
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.program-subject-summary-count strong {
    color: var(--primary-dark);
    font-weight: 800;
}
.program-subject-toolbar-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.program-subject-catalog {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    max-height: 320px;
    overflow-y: auto;
    background: var(--surface);
}
.program-subject-catalog-head {
    display: grid;
    grid-template-columns: 2.25rem 5.5rem minmax(0, 1fr) minmax(6.5rem, auto);
    gap: 0.65rem;
    padding: 0.5rem 0.85rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1;
}
.program-subject-catalog-col {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.program-subject-row {
    display: grid;
    grid-template-columns: 2.25rem 5.5rem minmax(0, 1fr) minmax(6.5rem, auto);
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.12s, opacity 0.12s;
    user-select: none;
}
.program-subject-row:last-child { border-bottom: none; }
.program-subject-row:hover { background: var(--bg); }
.program-subject-row.is-selected {
    background: var(--primary-light);
}
.program-subject-row.is-selected:hover { background: #dce9fc; }
.program-subject-row.is-hidden { display: none; }
.program-subject-row.is-locked {
    opacity: 0.55;
    cursor: not-allowed;
    background: #f1f5f9;
}
.program-subject-row.is-locked:hover { background: #f1f5f9; }
.program-subject-row.is-locked .program-subject-row-code,
.program-subject-row.is-locked .program-subject-row-title {
    color: #64748b;
}
.program-subject-row-check {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}
.program-subject-row.is-locked .program-subject-row-check {
    cursor: not-allowed;
}
.program-subject-row-code {
    font-size: 0.8125rem;
    font-weight: 800;
    color: var(--primary-dark);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.program-subject-row-title {
    font-size: 0.875rem;
    color: var(--text);
    line-height: 1.35;
    min-width: 0;
}
.program-subject-row-status {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    max-width: 100%;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    font-size: 0.6875rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.program-subject-row-status i {
    font-size: 0.6rem;
    opacity: 0.85;
}
.program-subject-row-icon {
    width: 1.25rem;
    justify-self: end;
    color: var(--primary);
    opacity: 0;
    font-size: 0.8125rem;
    transition: opacity 0.12s;
}
.program-subject-row.is-selected .program-subject-row-icon { opacity: 1; }

.program-subject-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.85rem;
    margin-top: 0.85rem;
    border-top: 1px solid var(--border);
}

/* Legacy pill picker removed — catalog rows used instead */

.program-curriculum-empty .admin-empty-state { margin-bottom: 1rem; }
.program-curriculum-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.program-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.75rem 0 0;
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .program-curriculum-layout { grid-template-columns: 1fr; }
    .program-curriculum-sidebar { position: static; }
    .program-toolbar-actions {
        width: 100%;
        justify-content: space-between;
    }
    .program-mode-toggle { flex: 1; }
    .program-mode-btn { flex: 1; justify-content: center; }
    .program-toolbar-edit-btn { flex-shrink: 0; }
    .is-preview-mode .program-terms-list,
    .is-edit-mode .program-terms-list { grid-template-columns: 1fr; }
    .program-subject-catalog-head { display: none; }
    .program-subject-row {
        grid-template-columns: 2rem 4.5rem minmax(0, 1fr);
        gap: 0.5rem;
        padding: 0.55rem 0.65rem;
    }
    .program-subject-row-status {
        grid-column: 2 / -1;
        justify-self: start;
        max-width: 100%;
    }
    .program-subject-row-icon {
        display: none;
    }
    .program-subject-filter { width: 100%; justify-content: stretch; }
    .program-subject-filter-btn { flex: 1; text-align: center; }
    .program-level-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.25rem;
        scrollbar-width: thin;
    }
    .program-level-nav-item {
        min-width: 140px;
        flex-shrink: 0;
    }
}

/* Legacy aliases (class-groups) */
.program-curriculum { display: flex; flex-direction: column; gap: 1rem; }
.program-inline-form {
    display: flex;
    align-items: flex-end;
    gap: 0.65rem;
    flex-wrap: wrap;
}
.program-inline-form .form-group { margin-bottom: 0; min-width: min(100%, 220px); }

/* ===== Global UX (loader, confirm, inputs) ===== */
.page-loader {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    background: rgba(240, 242, 245, 0.85);
    backdrop-filter: blur(4px);
    opacity: 0; visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
.page-loader.is-active { opacity: 1; visibility: visible; }
.page-loader-inner {
    display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
}
.page-loader-inner .site-logo--loader {
    animation: loaderPulse 1.2s ease-in-out infinite;
}
.page-loader-text { font-size: 0.875rem; font-weight: 600; color: var(--ink-2); }
@keyframes loaderPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.85; }
}

.confirm-overlay {
    position: fixed; inset: 0; z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    padding: 1rem;
}
.confirm-overlay[hidden] { display: none; }
.confirm-dialog {
    background: var(--surface); border-radius: var(--radius-lg);
    padding: 1.5rem; width: 100%; max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.confirm-dialog-title { font-size: 1.125rem; font-weight: 700; margin-bottom: 0.5rem; }
.confirm-dialog-message { color: var(--ink-2); margin-bottom: 1.25rem; font-size: 0.9375rem; white-space: pre-line; }
body.confirm-dialog-open { overflow: hidden; }
.confirm-dialog-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

.alert-icon {
    display: flex; align-items: flex-start; gap: 0.65rem;
}
.alert-icon > i { flex-shrink: 0; margin-top: 0.1rem; }
.alert-success.alert-icon > i { color: var(--success); }
.alert-error.alert-icon > i { color: var(--danger); }
.alert-info.alert-icon > i { color: var(--info); }
.alert-warning.alert-icon > i { color: var(--warning); }

.input-wrap { position: relative; }
.input-wrap .form-control { padding-left: 2.5rem; }
.input-wrap-icon {
    position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none; font-size: 0.875rem;
}
.input-hint { display: block; margin-top: 0.35rem; font-size: 0.8125rem; color: var(--text-muted); }

.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 0.75rem; margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.card-header h2, .card-header h3 { margin: 0; font-size: 1rem; font-weight: 700; }

/* ===== Dashboard welcome ===== */
.dashboard-welcome {
    display: flex; align-items: center; gap: 1rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--surface) 100%);
    border: 1px solid rgba(15, 108, 191, 0.12);
    border-radius: var(--radius-lg); padding: 1.25rem 1.35rem;
    margin-bottom: 1.5rem;
}
.dashboard-welcome-avatar {
    width: 3rem; height: 3rem; border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; font-size: 1.125rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.dashboard-welcome-copy { min-width: 0; }
.dashboard-welcome-eyebrow {
    margin: 0 0 0.2rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
}
.dashboard-welcome-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.15rem; }
.dashboard-welcome-sub { color: var(--text-muted); font-size: 0.875rem; margin: 0; }

/* ===== Student assignment view ===== */
.assignment-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 52rem;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}
.assignment-view__nav { margin-bottom: 0.15rem; }
.assignment-view__hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.35rem;
    border: 1px solid rgba(15, 108, 191, 0.14);
    border-radius: 1rem;
    background:
        linear-gradient(135deg, rgba(239, 246, 255, 0.95) 0%, #fff 58%),
        var(--surface);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}
.assignment-view__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--primary);
}
.assignment-view__title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.25rem, 2.4vw, 1.6rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--text);
}
.assignment-view__course {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--text-muted);
}
.assignment-view__status {
    flex-shrink: 0;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.assignment-view__status--open { background: #fff4e6; color: #a6670e; }
.assignment-view__status--submitted { background: #e7f0fa; color: var(--primary); }
.assignment-view__status--graded { background: #e8f5e9; color: #1b7a3d; }
.assignment-view__status--closed { background: #f1f5f9; color: #64748b; }

.assignment-view__meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}
.assignment-view__chip {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    background: var(--surface);
}
.assignment-view__chip > i {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #eff6ff;
    color: var(--primary);
    font-size: 0.9rem;
}
.assignment-view__chip.is-overdue > i {
    background: #fde8e6;
    color: #b42318;
}
.assignment-view__chip-label {
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}
.assignment-view__chip strong {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
}

.assignment-view__card {
    padding: 1.2rem 1.3rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: var(--surface);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.03);
}
.assignment-view__card-head { margin-bottom: 0.85rem; }
.assignment-view__card-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
    font-weight: 700;
}
.assignment-view__card-title i { color: var(--primary); font-size: 0.95rem; }
.assignment-view__card-sub {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.assignment-view__instructions {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
}

.assignment-view__card--grade {
    border-color: rgba(27, 122, 61, 0.2);
    background: linear-gradient(180deg, #f3faf4 0%, #fff 55%);
}
.assignment-view__grade {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    margin: 0.35rem 0 0.75rem;
}
.assignment-view__grade-score {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #1b7a3d;
}
.assignment-view__grade-max {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
}
.assignment-view__feedback {
    padding-top: 0.85rem;
    border-top: 1px solid rgba(27, 122, 61, 0.15);
}
.assignment-view__feedback strong {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.assignment-view__feedback p {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.55;
}

.assignment-view__notice {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.75rem;
    background: #fff8e6;
    border: 1px solid #f0d78c;
    color: #856404;
    font-size: 0.875rem;
}
.assignment-view__locked {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 0.85rem;
    background: #f8fafc;
    border: 1px dashed var(--border);
    color: var(--text-muted);
}
.assignment-view__locked i {
    margin-top: 0.15rem;
    color: #94a3b8;
}
.assignment-view__locked strong {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--text);
}
.assignment-view__locked p { margin: 0; font-size: 0.875rem; }

.assignment-view__textarea {
    min-height: 10rem;
    resize: vertical;
    line-height: 1.55;
}
.assignment-view__file {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.assignment-view__file-hint {
    color: var(--text-muted);
    font-size: 0.8125rem;
}
.assignment-view__file-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: fit-content;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none !important;
}
.assignment-view__file-link:hover { text-decoration: underline !important; }
.assignment-view__actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.35rem;
}

@media (max-width: 800px) {
    .assignment-view__meta { grid-template-columns: 1fr; }
    .assignment-view__hero { flex-direction: column; }
}

/* ===== Student dashboard ===== */
.student-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.student-dashboard .dashboard-welcome {
    margin-bottom: 0;
    padding: 1.35rem 1.4rem;
    background:
        linear-gradient(135deg, rgba(239, 246, 255, 0.95) 0%, #fff 55%),
        var(--surface);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}
.student-dashboard .dashboard-welcome-avatar {
    width: 3.25rem;
    height: 3.25rem;
    font-size: 1.2rem;
}
.student-dashboard .dashboard-welcome-title {
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.sd-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
}
.sd-metric {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.7rem;
    border-radius: 0.7rem;
    border: 1px solid var(--border);
    background: #f8fafc;
    text-decoration: none !important;
    color: inherit;
    box-shadow: none;
    transition: border-color 0.15s, background 0.15s;
}
.sd-metric:hover {
    border-color: rgba(15, 108, 191, 0.28);
    background: #fff;
    transform: none;
    box-shadow: none;
}
.sd-metric__icon {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 0.45rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.7rem;
}
.sd-metric--courses .sd-metric__icon { background: #e7f0fa; color: var(--primary); }
.sd-metric--assignments .sd-metric__icon { background: #fff4e6; color: var(--warning); }
.sd-metric--quizzes .sd-metric__icon { background: #e8f5e9; color: var(--success); }
.sd-metric.is-attention {
    border-color: rgba(166, 103, 14, 0.28);
    background: #fffaf0;
}
.sd-metric__body {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.4rem;
    min-width: 0;
}
.sd-metric__value {
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text);
}
.sd-metric__label {
    margin-top: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
}
.sd-metric__label-short { display: none; }
.sd-metric__meta {
    display: none;
}

.sd-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 0.95rem;
    border: 1px solid;
}
.sd-banner__icon {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.95rem;
}
.sd-banner__body {
    flex: 1;
    min-width: 0;
}
.sd-banner__body strong {
    display: block;
    margin-bottom: 0.1rem;
    font-size: 0.9375rem;
    font-weight: 800;
    line-height: 1.25;
}
.sd-banner__body p,
.sd-banner__text {
    margin: 0;
    display: block;
    font-size: 0.8125rem;
    line-height: 1.35;
    color: var(--ink-2);
}
.sd-banner__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(15, 108, 191, 0.22);
}
.sd-banner__cta i {
    font-size: 0.7rem;
}
.sd-banner--link {
    text-decoration: none !important;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.sd-banner--link:hover {
    border-color: rgba(15, 108, 191, 0.35);
    box-shadow: 0 8px 20px rgba(15, 108, 191, 0.1);
    transform: translateY(-1px);
}
.sd-banner--link:hover .sd-banner__cta {
    background: var(--primary-dark);
}
.sd-banner--info {
    background: #eff8fb;
    border-color: #c5e4ec;
    color: #0c5460;
}
.sd-banner--info .sd-banner__icon {
    background: rgba(12, 84, 96, 0.1);
    color: #0c5460;
}
.sd-banner--action {
    background: linear-gradient(135deg, #eff6ff 0%, #f8fbff 100%);
    border-color: rgba(15, 108, 191, 0.22);
    color: #0c4a6e;
}
.sd-banner--action .sd-banner__icon {
    background: rgba(15, 108, 191, 0.12);
    color: var(--primary);
}
.sd-banner--action .sd-banner__body strong {
    color: #0c4a6e;
}

.sd-layout {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}
.sd-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.15rem 1.25rem 1.25rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}
.sd-panel__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid rgba(226, 230, 234, 0.9);
}
.sd-panel__title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.2rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}
.sd-panel__title i {
    color: var(--primary);
    font-size: 0.95rem;
}
.sd-panel__sub {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.sd-panel__link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none !important;
}
.sd-panel__link:hover { text-decoration: underline !important; }
.sd-panel__controls {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}
.sd-toolbar {
    display: flex;
    align-items: stretch;
    width: min(100%, 22rem);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.sd-search {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}
.sd-search > .fa-magnifying-glass {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.75rem;
    pointer-events: none;
}
.sd-search__input {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0.55rem 0.7rem 0.55rem 2rem;
    border: none;
    border-radius: 0;
    background: transparent;
    font-size: 0.8125rem;
    color: var(--text);
}
.sd-search__input:focus {
    outline: none;
    background: rgba(15, 108, 191, 0.03);
}
.sd-search__input::placeholder {
    color: var(--text-muted);
}
.sd-sort {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    border-left: 1px solid var(--border);
    background: #f8fafc;
}
.sd-sort > .fa-arrow-down-short-wide {
    position: absolute;
    left: 0.65rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    pointer-events: none;
}
.sd-select {
    appearance: none;
    -webkit-appearance: none;
    height: 100%;
    min-height: 2.35rem;
    padding: 0.45rem 1.75rem 0.45rem 1.85rem;
    border: none;
    border-radius: 0;
    background: transparent
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M3 4.5L6 8l3-3.5'/%3E%3C/svg%3E")
        no-repeat right 0.55rem center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
    max-width: 9.5rem;
    cursor: pointer;
}
.sd-select:focus {
    outline: none;
    background-color: rgba(15, 108, 191, 0.04);
}
.sd-toolbar:focus-within {
    border-color: rgba(15, 108, 191, 0.4);
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.1);
}

.sd-tasks {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.sd-task {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: #fff;
    text-decoration: none !important;
    color: inherit;
    transition: border-color 0.15s, background 0.15s;
}
.sd-task:hover {
    border-color: rgba(15, 108, 191, 0.28);
    background: #f8fbff;
}
.sd-task.is-overdue {
    border-color: rgba(202, 49, 32, 0.2);
}
.sd-task.is-today,
.sd-task.is-soon {
    border-color: rgba(166, 103, 14, 0.22);
}
.sd-task__icon {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.55rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
    background: #f1f5f9;
    color: #64748b;
}
.sd-task[data-type="assignment"] .sd-task__icon {
    background: #fff4e6;
    color: #a6670e;
}
.sd-task[data-type="quiz"] .sd-task__icon {
    background: #e8f4f8;
    color: #0c5460;
}
.sd-task__body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.sd-task__title {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sd-task__meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sd-task__due {
    justify-self: end;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    color: #64748b;
}
.sd-task__due--overdue { color: #b42318; }
.sd-task__due--today,
.sd-task__due--soon { color: #856404; }
.sd-task__due--later { color: var(--primary); }
.sd-task__due--none { color: #94a3b8; }
.sd-panel--tasks .sd-panel__head--simple {
    margin-bottom: 0.85rem;
    padding-bottom: 0.75rem;
}
.sd-panel--tasks .sd-panel__head--simple .sd-panel__title {
    font-size: 1rem;
}
.sd-panel--tasks .sd-panel__head--simple {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.sd-view-toggle {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
}
.sd-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 1.9rem;
    padding: 0.25rem 0.65rem;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}
.sd-view-btn i { font-size: 0.72rem; }
.sd-view-btn:hover { color: var(--text); }
.sd-view-btn.is-active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.sd-tasks-view[hidden] { display: none !important; }

.sd-cal {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.sd-cal__toolbar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.sd-cal__month {
    flex: 1 1 auto;
    margin: 0;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--ink);
}
.sd-cal__nav {
    display: inline-grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: #fff;
    color: var(--ink-2);
    cursor: pointer;
}
.sd-cal__nav:hover {
    border-color: #9fc4e5;
    color: var(--primary);
    background: #f8fbff;
}
.sd-cal__today {
    margin-left: 0.15rem;
}
.sd-cal__weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
    text-align: center;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.sd-cal__grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
}
.sd-cal__day {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    min-height: 3.4rem;
    margin: 0;
    padding: 0.3rem 0.25rem 0.35rem;
    border: 1px solid #e8eef5;
    border-radius: 0.55rem;
    background: #fff;
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.sd-cal__day:hover {
    border-color: #9fc4e5;
    background: #f8fbff;
}
.sd-cal__day.is-outside {
    visibility: hidden;
    pointer-events: none;
}
.sd-cal__day.is-today {
    border-color: var(--primary);
    background: #f0f7fd;
}
.sd-cal__day.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(15, 108, 191, 0.18);
}
.sd-cal__day.has-tasks .sd-cal__day-num {
    font-weight: 800;
    color: var(--ink);
}
.sd-cal__day-num {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ink-2);
    line-height: 1;
}
.sd-cal__marks {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
    min-height: 0.55rem;
}
.sd-cal__dot {
    display: inline-block;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
}
.sd-cal__dot--assignment { background: #d97706; }
.sd-cal__dot--quiz { background: #0e7490; }
.sd-cal__more {
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--text-muted);
    line-height: 1;
}
.sd-cal__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
}
.sd-cal__legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.sd-cal__day-detail {
    border: 1px solid #e8eef5;
    border-radius: 0.75rem;
    background: #f8fafc;
    padding: 0.75rem;
}
.sd-cal__day-detail[hidden] { display: none !important; }
.sd-cal__day-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}
.sd-cal__day-detail-head strong {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--ink);
}
.sd-cal__day-detail-close {
    display: inline-grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border: 1px solid #dbe5f0;
    border-radius: 999px;
    background: #fff;
    color: var(--ink-2);
    cursor: pointer;
}
.sd-cal__day-detail-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.sd-cal__empty {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.sd-cal__task {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.65rem;
    background: #fff;
    text-decoration: none !important;
    color: inherit;
}
.sd-cal__task:hover {
    border-color: #9fc4e5;
    background: #f8fbff;
}
.sd-cal__task-icon {
    display: inline-grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
}
.sd-cal__task--assignment .sd-cal__task-icon {
    background: #fff7ed;
    color: #d97706;
}
.sd-cal__task--quiz .sd-cal__task-icon {
    background: #ecfeff;
    color: #0e7490;
}
.sd-cal__task-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.sd-cal__task-body strong {
    font-size: 0.82rem;
    font-weight: 750;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sd-cal__task-body small {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sd-cal__task-chevron {
    color: #94a3b8;
    font-size: 0.7rem;
}
.sd-cal__undated {
    margin: 0;
    font-size: 0.75rem;
}

@media (max-width: 640px) {
    .sd-view-btn span { display: none; }
    .sd-view-btn {
        width: 2rem;
        justify-content: center;
        padding: 0;
    }
    .sd-cal__day {
        min-height: 2.85rem;
        padding: 0.25rem 0.15rem;
    }
    .sd-cal__day-num { font-size: 0.7rem; }
}

.sd-empty {
    text-align: center;
    padding: 1.75rem 1rem;
    color: var(--text-muted);
}
.sd-empty__icon {
    width: 2.75rem;
    height: 2.75rem;
    margin: 0 auto 0.75rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #64748b;
}
.sd-empty h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}
.sd-empty p {
    margin: 0;
    font-size: 0.875rem;
}
.sd-course-grid {
    margin-bottom: 0;
}
.sd-panel--tasks .sd-panel__head {
    align-items: center;
}

@media (max-width: 900px) {
    .sd-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.35rem;
    }
    .sd-metric {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.1rem;
        padding: 0.4rem 0.35rem;
        border-radius: 0.55rem;
        text-align: center;
    }
    .sd-metric__icon {
        display: none;
    }
    .sd-metric__body {
        flex-direction: column;
        align-items: center;
        gap: 0.05rem;
    }
    .sd-metric__value {
        font-size: 0.95rem;
    }
    .sd-metric__label {
        font-size: 0.625rem;
        line-height: 1.2;
        font-weight: 600;
        color: var(--text-muted);
    }
    .sd-metric__label-full { display: none; }
    .sd-metric__label-short { display: inline; }
}
@media (max-width: 720px) {
    .sd-task {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 0.55rem 0.65rem;
    }
    .sd-task__due {
        grid-column: 2;
        justify-self: start;
        font-size: 0.7rem;
    }
}
@media (max-width: 400px) {
    .sd-metrics { gap: 0.3rem; }
    .sd-metric { padding: 0.35rem 0.25rem; }
    .sd-metric__value { font-size: 0.875rem; }
    .sd-metric__label { font-size: 0.5625rem; }
}
@media (max-width: 640px) {
    .sd-banner {
        gap: 0.65rem;
        padding: 0.75rem 0.85rem;
    }
    .sd-banner__icon {
        width: 2.1rem;
        height: 2.1rem;
        border-radius: 0.6rem;
        font-size: 0.85rem;
    }
    .sd-banner__body strong {
        font-size: 0.875rem;
    }
    .sd-banner__body p,
    .sd-banner__text {
        font-size: 0.75rem;
    }
    .sd-banner__cta {
        padding: 0.4rem 0.7rem;
        font-size: 0.75rem;
    }
    .sd-banner--link:hover {
        transform: none;
    }
    .sd-panel { padding: 1rem; }
    .sd-panel__controls {
        width: 100%;
    }
    .sd-toolbar {
        width: 100%;
    }
    .sd-select {
        max-width: 8.25rem;
        font-size: 0.7rem;
        padding-right: 1.5rem;
    }
}
@media (max-width: 400px) {
    .sd-sort > .fa-arrow-down-short-wide {
        display: none;
    }
    .sd-select {
        padding-left: 0.65rem;
        max-width: 7.5rem;
    }
}
.stu-alert {
    display: flex; align-items: flex-start; gap: 0.85rem;
    padding: 1rem 1.15rem; border-radius: var(--radius-lg);
    margin-bottom: 1.25rem; border: 1px solid;
}
.stu-alert > i { flex-shrink: 0; margin-top: 0.15rem; font-size: 1.125rem; }
.stu-alert strong { display: block; margin-bottom: 0.2rem; }
.stu-alert p { margin: 0; font-size: 0.875rem; color: var(--ink-2); }
.stu-alert--warning { background: #fff8e6; border-color: #f0d78c; color: #856404; }
.stu-alert--info { background: #e8f4f8; border-color: #b8dce8; color: #0c5460; }
.stu-alert--action { background: var(--primary-light); border-color: rgba(15, 108, 191, 0.2); }
.stu-alert-actions { display: flex; gap: 0.5rem; flex-shrink: 0; align-items: center; }

.tasks-panel { margin-bottom: 1.5rem; }
.tasks-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem;
}
.tasks-panel-header h2 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.tasks-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tasks-controls .form-control { max-width: 200px; font-size: 0.875rem; padding: 0.4rem 0.65rem; }
.tasks-list { display: flex; flex-direction: column; gap: 0.5rem; }
.task-item {
    display: flex; align-items: center; gap: 0.85rem;
    padding: 0.85rem 1rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.task-item-icon {
    width: 2.25rem; height: 2.25rem; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.task-item-icon--assignment { background: #fff4e6; color: var(--warning); }
.task-item-icon--quiz { background: #e8f4f8; color: var(--info); }
.task-item-body { flex: 1; min-width: 0; }
.task-item-body strong { display: block; font-size: 0.9375rem; }
.task-item-body small { color: var(--text-muted); font-size: 0.8125rem; }
.task-item-due { font-size: 0.8125rem; color: var(--text-muted); white-space: nowrap; }
a.task-item { text-decoration: none; color: inherit; transition: border-color 0.15s, background 0.15s; }
a.task-item:hover { border-color: var(--primary); background: var(--primary-light); }

.stat-card-term { font-size: 0.6875rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ===== Landing enhancements ===== */
.landing-features-section {
    padding: 3rem 0 3.5rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    position: relative;
}
.landing-features-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(90%, 640px);
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(15, 108, 191, 0.25), transparent);
}
.landing-features-head {
    margin-bottom: 1.75rem;
    text-align: center;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}
.landing-features-sub {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin-top: 0.5rem;
    line-height: 1.55;
}
.landing-features-head h2 {
    font-size: clamp(1.125rem, 2vw, 1.375rem);
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text);
}
.landing-features-head h2 i { color: var(--primary); }
.features--landing {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
    padding: 0;
}
@media (min-width: 640px) {
    .features--landing { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
}
@media (min-width: 1100px) {
    .features--landing { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
}
.landing-features-section .feature-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.25rem;
    border-radius: 0.85rem;
    position: relative;
}
.feature-card-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.6rem;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}
.landing-features-section .feature-card h3 {
    font-size: 0.9375rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}
.landing-features-section .feature-card p {
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.5;
    margin: 0;
}
.landing-features-section .feature-card-icon i {
    font-size: 0.95rem;
    margin-bottom: 0;
    color: inherit;
}
@media (max-width: 639px) {
    .landing-features-section {
        padding: 1.35rem 0 1.5rem;
    }
    .landing-features-head {
        margin-bottom: 0.75rem;
        text-align: left;
        max-width: none;
    }
    .landing-features-head h2 {
        justify-content: flex-start;
        font-size: 1.05rem;
        gap: 0.4rem;
    }
    .landing-features-sub {
        margin-top: 0.2rem;
        font-size: 0.8125rem;
        line-height: 1.4;
    }
    .features--landing {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.55rem;
    }
    .landing-features-section .feature-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: 0.85rem 0.8rem 0.9rem;
        border-radius: 0.75rem;
        min-height: 100%;
    }
    .landing-features-section .feature-card-icon {
        width: 2rem;
        height: 2rem;
        border-radius: 0.5rem;
        font-size: 0.8rem;
        margin-bottom: 0.55rem;
    }
    .landing-features-section .feature-card-icon i {
        font-size: 0.8rem;
    }
    .landing-features-section .feature-card h3 {
        font-size: 0.8125rem;
        margin-bottom: 0.3rem;
        line-height: 1.25;
    }
    .landing-features-section .feature-card p {
        font-size: 0.6875rem;
        line-height: 1.4;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        overflow: hidden;
    }
}

.school-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.school-card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.65rem 0.5rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.01em;
    text-decoration: none !important;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.25s, box-shadow 0.25s;
    min-width: 0;
    white-space: nowrap;
}
.school-card-btn i {
    font-size: 0.7rem;
    flex-shrink: 0;
}
.school-card-btn--page {
    background: var(--primary);
    color: #fff !important;
    border: 1px solid var(--primary);
    box-shadow: 0 4px 12px rgba(15, 108, 191, 0.2);
}
.school-card-btn--page:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(15, 108, 191, 0.3);
}
.school-card-btn--login {
    background: var(--surface);
    color: var(--primary) !important;
    border: 1px solid rgba(15, 108, 191, 0.28);
}
.school-card-btn--login:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark) !important;
    transform: translateY(-1px);
}

/* Public school page */
.school-public-page { background: #eef4fb; }
.school-public-main { max-width: none; padding: 0; }
.school-public-hero {
    position: relative;
    padding: 2rem 0 4rem;
    overflow: hidden;
}
.school-public-hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 12% 20%, rgba(15, 108, 191, 0.08) 0%, transparent 42%),
        radial-gradient(circle at 88% 75%, rgba(8, 121, 156, 0.1) 0%, transparent 40%),
        linear-gradient(180deg, #eef4fb 0%, #f4f7fb 100%);
    pointer-events: none;
}
.school-public-hero .container {
    position: relative;
    z-index: 1;
}
.school-public-back {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 1.25rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(15, 108, 191, 0.1);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.school-public-back:hover {
    color: var(--primary);
    border-color: rgba(15, 108, 191, 0.22);
    background: #fff;
    text-decoration: none;
}
.school-public-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.35rem;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.1);
}
.school-public-cover {
    position: relative;
    height: 220px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: var(--primary);
}
.school-public-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.08) 0%, rgba(15, 23, 42, 0.55) 100%);
}
.school-public-status {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
}
.school-public-header {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 0 2rem;
    margin-top: -3.75rem;
    position: relative;
    z-index: 3;
}
.school-public-avatar {
    width: 7.5rem;
    height: 7.5rem;
    border-radius: 50%;
    border: 5px solid var(--surface);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.75rem;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 12px 32px rgba(15, 108, 191, 0.3);
}
.school-public-avatar.school-avatar--image {
    padding: 0;
    overflow: hidden;
    background: var(--surface);
}
.school-public-avatar .school-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.school-public-heading {
    min-width: 0;
    padding-top: 4.25rem;
    padding-bottom: 0.5rem;
}
.school-public-eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
}
.school-public-heading h1 {
    margin: 0 0 0.85rem;
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
}
.school-public-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.school-public-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    max-width: 100%;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.3;
}
.school-public-meta-chip i {
    color: var(--primary);
    flex-shrink: 0;
    font-size: 0.75rem;
}
.school-public-meta-chip span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.school-public-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    border-top: 1px solid var(--border);
}
@media (min-width: 900px) {
    .school-public-layout {
        grid-template-columns: 1fr min(340px, 38%);
    }
}
.school-public-content {
    padding: 2rem;
}
.school-public-content h2 {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.school-public-intro {
    margin: 0 0 1.75rem;
    color: var(--text-muted);
    line-height: 1.65;
    max-width: 36rem;
}
.school-public-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.school-public-features li {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}
.school-public-feature-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.95rem;
    line-height: 1;
}
.school-public-feature-icon i {
    display: block;
    line-height: 1;
}
.school-public-features li strong {
    display: block;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.15rem;
}
.school-public-features li > div > span {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.school-public-signin {
    background: linear-gradient(165deg, rgba(15, 108, 191, 0.06) 0%, rgba(8, 121, 156, 0.04) 100%);
    border-top: 1px solid var(--border);
    padding: 2rem;
}
@media (min-width: 900px) {
    .school-public-signin {
        border-top: none;
        border-left: 1px solid var(--border);
    }
}
.school-public-signin-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    max-width: 280px;
    margin: 0 auto;
}
.school-public-signin-icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 1rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 8px 20px rgba(15, 108, 191, 0.25);
}
.school-public-signin h3 {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
    font-weight: 800;
}
.school-public-signin p {
    margin: 0 0 1.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.55;
}
.school-public-code-box {
    margin-bottom: 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px dashed rgba(15, 108, 191, 0.25);
}
.school-public-code-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.school-public-code-box code {
    display: block;
    font-size: 0.9375rem;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: 0.04em;
    word-break: break-all;
}
.school-public-signin-btn {
    margin-bottom: 0.85rem;
}
.school-public-alt-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}
.school-public-alt-link:hover {
    color: var(--primary);
    text-decoration: underline;
}
@media (max-width: 640px) {
    .school-public-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0 1.25rem;
    }
    .school-public-heading {
        padding-top: 0.75rem;
    }
    .school-public-meta-row {
        justify-content: center;
    }
    .school-public-content,
    .school-public-signin {
        padding: 1.5rem 1.25rem;
    }
}

.school-settings-preview { margin: 0 0 1.25rem; max-width: 100%; }
.school-settings-preview--logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.school-settings-preview--logo .school-avatar {
    margin-left: 0;
}
.school-settings-preview-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: -1rem;
}
.school-settings-preview-header .school-avatar {
    margin-left: 0;
    flex-shrink: 0;
}
.school-settings-preview-card {
    border: 1px solid var(--border);
    border-radius: 1.125rem;
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow);
    max-width: 22rem;
}
.school-settings-preview-body {
    padding: 1rem 1.125rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.school-settings-form { max-width: none; }
.school-settings-remove { margin-top: 1rem; }

.school-settings {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.school-settings-section__head {
    margin-bottom: 1rem;
}
.school-settings-section__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}
.school-settings-section__title i {
    color: var(--primary);
    font-size: 0.95rem;
}
.school-settings-section__desc {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.school-settings-brand-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.school-settings-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.school-settings-card__head {
    margin-bottom: 1rem;
}
.school-settings-card__head h3 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.3rem;
    font-size: 1rem;
    font-weight: 700;
}
.school-settings-card__head h3 i { color: var(--primary); font-size: 0.9rem; }
.school-settings-card__head p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.school-settings-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}
.school-settings-features {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}
.school-settings-feature-link {
    margin: -0.15rem 0 0;
}
@media (max-width: 900px) {
    .school-settings-brand-grid { grid-template-columns: 1fr; }
}

/* Landing page animations */
[data-landing-delay="1"] { --landing-delay: 1; }
[data-landing-delay="2"] { --landing-delay: 2; }
[data-landing-delay="3"] { --landing-delay: 3; }
[data-landing-delay="4"] { --landing-delay: 4; }
[data-landing-delay="5"] { --landing-delay: 5; }
[data-landing-delay="6"] { --landing-delay: 6; }
@media (prefers-reduced-motion: no-preference) {
    [data-landing-hero] {
        opacity: 0;
        transform: translateY(20px);
        animation: landingHeroIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
        animation-delay: calc(0.08s * var(--landing-delay, 1));
    }
    @keyframes landingHeroIn {
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    [data-landing-reveal] {
        opacity: 0;
        transform: translateY(24px);
        transition: opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1),
                    transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
        transition-delay: calc(0.07s * var(--landing-delay, 0));
    }
    [data-landing-reveal].is-visible {
        opacity: 1;
        transform: translateY(0);
    }
}
@media (prefers-reduced-motion: reduce) {
    [data-landing-hero],
    [data-landing-reveal] {
        opacity: 1;
        transform: none;
        animation: none;
        transition: none;
    }
    .landing-hero-orb,
    .text-gradient--animated,
    .landing-badge i {
        animation: none;
    }
    .landing-page .public-header {
        transition: none;
    }
}
.landing-page .public-header {
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(16px) saturate(1.08);
    -webkit-backdrop-filter: blur(16px) saturate(1.08);
    border-bottom-color: rgba(226, 230, 234, 0.55);
    transition: box-shadow 0.3s, background 0.3s, border-color 0.3s;
}
.landing-page.is-scrolled .public-header {
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.92);
    border-bottom-color: var(--border);
}
.landing-page .public-footer {
    position: relative;
    overflow: hidden;
}
.landing-page .public-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #08799c, var(--primary));
    background-size: 200% auto;
    animation: landingGradientShift 8s ease-in-out infinite;
}
.landing-page .footer-links a {
    transition: color 0.2s, transform 0.2s;
    display: inline-block;
}
.landing-page .footer-links a:hover {
    transform: translateY(-1px);
}

/* ===== Split auth login ===== */
.auth-card-split {
    display: grid; width: 100%; max-width: 820px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: var(--shadow-lg);
}
@media (min-width: 768px) {
    .auth-card-split { grid-template-columns: 1fr 1.1fr; }
}
.auth-split-panel {
    display: none;
    position: relative;
    overflow: hidden;
    padding: 2.5rem 2rem;
    color: #fff;
    flex-direction: column;
    justify-content: center;
    min-height: 22rem;
}
.auth-split-panel--platform {
    background: linear-gradient(155deg, #0f6cbf 0%, #0a4d8c 52%, #063a6b 100%);
}
.auth-split-panel--school {
    background: linear-gradient(155deg, #0f6cbf 0%, #0a4d8c 100%);
}
.auth-split-panel-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.auth-split-panel--school .auth-split-panel-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--auth-panel-cover);
    background-size: cover;
    background-position: center;
    transform: scale(1.06);
    filter: saturate(1.08);
}
.auth-split-panel--school .auth-split-panel-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(6, 36, 72, 0.55) 0%, rgba(6, 36, 72, 0.82) 55%, rgba(4, 24, 52, 0.94) 100%),
        linear-gradient(135deg, rgba(15, 108, 191, 0.35) 0%, transparent 60%);
}
.auth-split-panel--platform .auth-split-panel-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.14) 0%, transparent 42%),
        radial-gradient(circle at 85% 80%, rgba(8, 121, 156, 0.35) 0%, transparent 45%);
}
.auth-split-panel-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.45;
}
.auth-split-panel-orb--1 {
    width: 9rem;
    height: 9rem;
    top: -2rem;
    right: -1.5rem;
    background: rgba(255, 255, 255, 0.22);
}
.auth-split-panel-orb--2 {
    width: 7rem;
    height: 7rem;
    bottom: 2rem;
    left: -2rem;
    background: rgba(8, 121, 156, 0.55);
}
.auth-split-panel-orb--3 {
    width: 5rem;
    height: 5rem;
    bottom: -1rem;
    right: 2.5rem;
    background: rgba(255, 255, 255, 0.12);
}
.auth-split-panel-content {
    position: relative;
    z-index: 1;
}
@media (min-width: 768px) {
    .auth-split-panel { display: flex; }
}
.auth-split-panel h2 {
    font-size: 1.625rem;
    font-weight: 800;
    margin: 0 0 0.65rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
    text-wrap: balance;
}
.auth-panel-eyebrow {
    display: inline-block;
    margin-bottom: 0.65rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.72);
}
.auth-panel-code {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    backdrop-filter: blur(6px);
}
.auth-panel-code i { font-size: 0.6875rem; opacity: 0.85; }
.auth-panel-tagline {
    font-size: 0.9375rem;
    line-height: 1.55;
    margin: 0 0 1.35rem;
    color: rgba(255, 255, 255, 0.88);
    max-width: 18rem;
}
.auth-panel-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.auth-panel-features li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
}
.auth-panel-features li i {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    font-size: 0.75rem;
}
.auth-split-form { padding: 1.75rem 1.85rem; }

/* ===== Multi-step registration wizard ===== */
.reg-wizard {
    width: 100%;
    max-width: 560px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.reg-wizard-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1.15rem 1.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.reg-wizard-back {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.875rem;
    transition: border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}
.reg-wizard-back:hover { border-color: var(--primary); color: var(--primary); }
.reg-wizard-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text);
}
.reg-wizard-logo {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* Stepper */
.reg-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 1.35rem 1.75rem 0.35rem;
}
.reg-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    position: relative;
    z-index: 1;
}
.reg-step-number {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    transition: all 0.3s;
}
.reg-step-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: color 0.3s;
    white-space: nowrap;
}
.reg-step.active .reg-step-number {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(15, 108, 191, 0.3);
}
.reg-step.active .reg-step-label { color: var(--primary); }
.reg-step.completed .reg-step-number {
    border-color: var(--success);
    background: var(--success);
    color: #fff;
}
.reg-step.completed .reg-step-label { color: var(--success); }
.reg-step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin: 0 0.5rem;
    margin-bottom: 1.35rem;
    transition: background 0.3s;
    min-width: 2rem;
    max-width: 5rem;
}
.reg-step-line.completed { background: var(--success); }

/* Wizard body */
.reg-wizard-body { padding: 1.5rem 1.75rem 1.25rem; }

/* Step panels */
.reg-wizard-step { display: none; }
.reg-wizard-step.active {
    display: block;
    animation: regFadeIn 0.3s ease;
}
@keyframes regFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Step header */
.reg-step-header {
    display: flex;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}
.reg-step-header-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(15, 108, 191, 0.2);
}
.reg-step-header h2 {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0 0 0.15rem;
    color: var(--text);
    letter-spacing: -0.02em;
}
.reg-step-header p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.45;
}

/* Wizard actions */
.reg-wizard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}
.reg-btn-next, .reg-btn-submit {
    padding: 0.6rem 1.5rem;
    font-size: 0.9375rem;
}

/* Field-level validation errors */
.form-control--error { border-color: var(--danger) !important; }
.form-control--error:focus { box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15) !important; }
.reg-field-error {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.8125rem;
    color: var(--danger);
    font-weight: 500;
}
.req { color: var(--danger); }

/* Review cards */
.reg-review { display: flex; flex-direction: column; gap: 1.15rem; }
.reg-review-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
}
.reg-review-card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.15rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.reg-review-card-header h4 {
    flex: 1;
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}
.reg-review-card-icon {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
    color: #fff;
}
.reg-review-card-icon--school { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.reg-review-card-icon--admin { background: linear-gradient(135deg, #5b21b6, #7c3aed); }

.reg-review-edit {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    transition: all 0.15s;
}
.reg-review-edit:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(15, 108, 191, 0.05);
}

.reg-review-rows { padding: 0; }
.reg-review-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.7rem 1.15rem;
    border-bottom: 1px solid var(--border);
}
.reg-review-row:last-child { border-bottom: none; }
.reg-review-label {
    flex-shrink: 0;
    width: 8.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.reg-review-label i { width: 0.85rem; text-align: center; font-size: 0.7rem; opacity: 0.55; }
.reg-review-value {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
    min-width: 0;
}
.reg-review-value--code {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
    letter-spacing: 0.03em;
    background: var(--bg);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 0.8125rem;
    display: inline-block;
}
.reg-review-value--masked {
    color: var(--text-muted);
    letter-spacing: 0.15em;
}

.reg-review-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    background: #eef4fb;
    border: 1px solid #c7ddf3;
    font-size: 0.8125rem;
    color: #1a5a96;
    line-height: 1.5;
    margin-bottom: 0.25rem;
}
.reg-review-notice i { margin-top: 0.15rem; flex-shrink: 0; }

/* Success state */
.reg-success {
    text-align: center;
    padding: 2rem 1rem;
}
.reg-success-icon {
    font-size: 3.5rem;
    color: var(--success);
    margin-bottom: 1rem;
    line-height: 1;
}
.reg-success h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 0.75rem;
    color: var(--text);
}
.reg-success p {
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin: 0 0 1.5rem;
    line-height: 1.55;
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
}

/* Footer */
.reg-wizard-footer {
    padding: 1rem 1.75rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--bg);
}
.reg-wizard-footer a { color: var(--primary); font-weight: 600; text-decoration: none; }
.reg-wizard-footer a:hover { text-decoration: underline; }

/* Password strength meter */
.pwd-strength {
    display: none;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.5rem;
}
.pwd-strength.visible { display: flex; }
.pwd-strength-bar {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    overflow: hidden;
}
.pwd-strength-fill {
    height: 100%;
    width: 0;
    border-radius: 3px;
    transition: width 0.35s ease, background 0.35s ease;
}
.pwd-strength-fill.very-weak { background: #dc3545; }
.pwd-strength-fill.weak { background: #e8590c; }
.pwd-strength-fill.fair { background: #f59f00; }
.pwd-strength-fill.strong { background: #51cf66; }
.pwd-strength-fill.very-strong { background: #2b8a3e; }
.pwd-strength-label {
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    min-width: 5rem;
    text-align: right;
}
.pwd-strength-label.very-weak { color: #dc3545; }
.pwd-strength-label.weak { color: #e8590c; }
.pwd-strength-label.fair { color: #f59f00; }
.pwd-strength-label.strong { color: #51cf66; }
.pwd-strength-label.very-strong { color: #2b8a3e; }

/* Password rules checklist */
.pwd-rules {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: none;
    flex-wrap: wrap;
    gap: 0.2rem 1.25rem;
}
.pwd-rules.visible { display: flex; }
.pwd-rules li {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: color 0.2s;
}
.pwd-rules li i {
    font-size: 0.45rem;
    transition: color 0.2s;
}
.pwd-rules li.pass { color: #2b8a3e; }
.pwd-rules li.pass i { font-size: 0; }
.pwd-rules li.pass::before {
    content: '\f058';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.7rem;
    color: #2b8a3e;
}
.pwd-rules li.fail { color: #dc3545; }
.pwd-rules li.fail i { font-size: 0; }
.pwd-rules li.fail::before {
    content: '\f057';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.7rem;
    color: #dc3545;
}

/* Password match message */
.pwd-match-msg {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 500;
    min-height: 1.2em;
}
.pwd-match-msg.match { color: #2b8a3e; }
.pwd-match-msg.no-match { color: #dc3545; }

/* Responsive */
@media (max-width: 480px) {
    .reg-wizard-body { padding: 1.25rem 1.15rem 1rem; }
    .reg-wizard-header { padding: 1rem 1.15rem; }
    .reg-stepper { padding: 1rem 1rem 0.25rem; }
    .reg-step-label { font-size: 0.6rem; }
    .reg-step-number { width: 2rem; height: 2rem; font-size: 0.75rem; }
    .reg-review-row { flex-direction: column; gap: 0.15rem; }
    .reg-review-label { width: auto; }
    .reg-step-header { flex-direction: column; gap: 0.5rem; }
    .pwd-rules { flex-direction: column; gap: 0.15rem; }
}

.auth-school-brand-mobile {
    display: flex;
    justify-content: center;
    margin: 0 0 1rem;
}
.auth-school-brand-mobile .auth-panel-school-logo,
.auth-school-brand-mobile .auth-panel-school-avatar {
    margin-bottom: 0;
    width: 8.5rem;
    height: 8.5rem;
    border-color: rgba(15, 108, 191, 0.18);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1);
}
.auth-school-brand-mobile .auth-panel-school-avatar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-color: rgba(15, 108, 191, 0.28);
    font-size: 2.35rem;
}
@media (min-width: 768px) {
    .auth-school-brand-mobile { display: none; }
}

/* Mobile school login: cover band behind logo */
@media (max-width: 767.98px) {
    .auth-split-form--school {
        position: relative;
        overflow: hidden;
        padding-top: 0;
        --auth-form-cover-height: 13.5rem;
    }
    .auth-split-form--school::before,
    .auth-split-form--school::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: var(--auth-form-cover-height);
        pointer-events: none;
        z-index: 0;
    }
    .auth-split-form--school::before {
        background-image: var(--auth-panel-cover);
        background-size: cover;
        background-position: center;
    }
    .auth-split-form--school::after {
        background:
            linear-gradient(180deg, rgba(6, 36, 72, 0.42) 0%, rgba(6, 36, 72, 0.7) 55%, rgba(255, 255, 255, 0.92) 100%),
            linear-gradient(135deg, rgba(15, 108, 191, 0.28) 0%, transparent 55%);
    }
    .auth-split-form--school > * {
        position: relative;
        z-index: 1;
    }
    .auth-split-form--school .auth-top {
        margin-bottom: 0.65rem;
        padding-top: 1.15rem;
    }
    .auth-split-form--school .auth-top .auth-footer-link {
        color: rgba(255, 255, 255, 0.92);
    }
    .auth-split-form--school .auth-top .auth-footer-link:hover {
        color: #fff;
    }
    .auth-split-form--school .auth-school-brand-mobile {
        margin: 0 0 1.15rem;
    }
    .auth-split-form--school .auth-school-brand-mobile .auth-panel-school-logo,
    .auth-split-form--school .auth-school-brand-mobile .auth-panel-school-avatar {
        width: 9rem;
        height: 9rem;
        border: 5px solid rgba(255, 255, 255, 0.95);
        box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28);
    }
    .auth-split-form--school .auth-school-brand-mobile .auth-panel-school-avatar {
        font-size: 2.5rem;
        border-color: rgba(255, 255, 255, 0.95);
    }
    .auth-split-form--school .auth-brand {
        margin-top: 0.15rem;
    }
}

/* ===== Topbar enhancements ===== */
.navbar-notifications { position: relative; margin-right: 0.5rem; }
.navbar-notif-btn {
    position: relative;
    width: 2.25rem; height: 2.25rem; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.navbar-notif-btn:hover { border-color: var(--primary); color: var(--primary); }
.notif-dropdown {
    position: absolute; top: calc(100% + 0.5rem); right: 0;
    width: min(280px, calc(100vw - 1.5rem)); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); display: none; z-index: 1100;
}
.notif-dropdown.open { display: block; }
.notif-dropdown-header {
    padding: 0.75rem 1rem; font-weight: 700; font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}
.notif-empty { padding: 1.5rem 1rem; text-align: center; color: var(--text-muted); font-size: 0.875rem; }
.navbar-notif-badge {
    position: absolute; top: -2px; right: -2px; min-width: 1.1rem; height: 1.1rem;
    padding: 0 0.25rem; border-radius: 999px; background: var(--danger); color: #fff;
    font-size: 0.65rem; font-weight: 700; line-height: 1.1rem; text-align: center;
}
.notif-dropdown-header {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.notif-mark-all {
    border: none; background: none; color: var(--primary); font-size: 0.75rem;
    font-weight: 600; cursor: pointer; padding: 0;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-dropdown-body { max-height: 320px; overflow-y: auto; }
.notif-item {
    display: block; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border);
    text-decoration: none !important; color: inherit;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item--unread { background: #f0f7ff; }
.notif-item strong { display: block; font-size: 0.875rem; margin-bottom: 0.2rem; }
.notif-item p { margin: 0; font-size: 0.8125rem; color: var(--text-muted); line-height: 1.4; }
.notif-item time { font-size: 0.75rem; color: var(--text-muted); }
.notif-item-priority {
    display: inline-block; margin-left: 0.35rem; font-size: 0.65rem; font-weight: 700;
    text-transform: uppercase; vertical-align: middle;
}
.notif-item-priority--important { color: #d97706; }
.notif-item-priority--urgent { color: #dc2626; }
.notif-item-platform {
    display: inline-block; margin-left: 0.35rem; font-size: 0.6rem;
    color: var(--primary); vertical-align: middle; opacity: 0.8;
}
.notif-view-all {
    display: block; padding: 0.65rem 1rem; text-align: center; font-size: 0.8125rem;
    font-weight: 600; border-top: 1px solid var(--border); text-decoration: none !important;
}

.announcements-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    margin-bottom: 1rem; flex-wrap: wrap;
}
.announcements-filters { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.announcements-list-meta { font-size: 0.8rem; margin-top: 0.15rem; }
.form-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem;
}
.form-grid .span-2 { grid-column: span 2; }
.announcement-form-grid { margin-bottom: 1.5rem; }
@media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: span 1; }
}
.announcement-audience {
    margin: 1.5rem 0; padding-top: 1.5rem; border-top: 1px solid var(--border);
}
.announcement-audience__head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
    margin-bottom: 1rem;
}
.announcement-audience__head h2 { margin: 0 0 0.25rem; font-size: 1rem; }
.audience-rule {
    display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.75rem; align-items: end;
    margin-bottom: 0.75rem; padding: 0.85rem; background: var(--surface-2); border-radius: var(--radius);
    border: 1px solid var(--border);
}
.audience-rule label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.35rem; }
.audience-user-results {
    position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 0.25rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-md); max-height: 180px; overflow-y: auto;
}
.audience-user-picker { position: relative; }
.audience-user-option {
    display: block; width: 100%; text-align: left; border: none; background: none;
    padding: 0.55rem 0.75rem; cursor: pointer; font-size: 0.8125rem;
}
.audience-user-option:hover { background: var(--surface-2); }
.announcement-recipient-estimate {
    margin-top: 0.75rem; font-size: 0.875rem; color: var(--ink-2);
}
.announcement-form-actions {
    display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap;
    padding-top: 1rem; border-top: 1px solid var(--border);
}
/* ── Notice editor layout ── */
.notice-editor__grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.25rem;
    align-items: start;
}
@media (max-width: 900px) {
    .notice-editor__grid { grid-template-columns: 1fr; }
}
.notice-editor__content,
.notice-editor__delivery,
.notice-editor__actions { padding: 1.5rem; }
.notice-editor__section-title {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.9rem; font-weight: 700; color: var(--ink-2);
    margin: 0 0 1.25rem; padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.notice-editor__section-title i { color: var(--primary); font-size: 0.85rem; }

/* Priority pills */
.notice-priority-pills {
    display: flex; gap: 0.5rem; flex-wrap: wrap;
}
.notice-priority-pill {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.45rem 0.85rem; border-radius: 999px;
    font-size: 0.8rem; font-weight: 600; cursor: pointer;
    border: 1.5px solid var(--border); background: var(--surface);
    color: var(--ink-2); transition: all 0.15s;
}
.notice-priority-pill input { display: none; }
.notice-priority-pill:hover { border-color: var(--ink-3); }
.notice-priority-pill--normal.is-active {
    border-color: #3b82f6; background: #eff6ff; color: #1d4ed8;
}
.notice-priority-pill--important.is-active {
    border-color: #f59e0b; background: #fffbeb; color: #b45309;
}
.notice-priority-pill--urgent.is-active {
    border-color: #ef4444; background: #fef2f2; color: #dc2626;
}

/* Extras accordion */
.notice-editor__extras {
    margin-top: 0.5rem; border-top: 1px solid var(--border); padding-top: 0.75rem;
}
.notice-editor__extras summary {
    font-size: 0.8rem; font-weight: 600; color: var(--ink-2); cursor: pointer;
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.35rem 0;
}
.notice-editor__extras summary:hover { color: var(--primary); }
.notice-editor__extras-body { padding-top: 0.75rem; }

/* Audience radio cards */
.notice-audience-options {
    display: flex; flex-direction: column; gap: 0.5rem;
}
.notice-audience-opt {
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.6rem 0.75rem; border-radius: var(--radius);
    border: 1.5px solid var(--border); cursor: pointer;
    transition: all 0.15s; background: var(--surface);
}
.notice-audience-opt input { display: none; }
.notice-audience-opt i {
    font-size: 1rem; width: 1.5rem; text-align: center; color: var(--ink-3);
}
.notice-audience-opt div { flex: 1; }
.notice-audience-opt strong { display: block; font-size: 0.82rem; }
.notice-audience-opt small { font-size: 0.72rem; color: var(--ink-3); font-weight: normal; }
.notice-audience-opt:hover { border-color: var(--primary-light, #93c5fd); }
.notice-audience-opt.is-active {
    border-color: var(--primary); background: var(--primary-wash, #eff6ff);
}
.notice-audience-opt.is-active i { color: var(--primary); }

/* School scope toggle */
.notice-school-scope {
    display: flex; border-radius: var(--radius); overflow: hidden;
    border: 1.5px solid var(--border);
}
.notice-scope-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.35rem;
    padding: 0.45rem 0.5rem; font-size: 0.78rem; font-weight: 600;
    border: none; background: var(--surface); color: var(--ink-2);
    cursor: pointer; transition: all 0.15s;
}
.notice-scope-btn + .notice-scope-btn { border-left: 1.5px solid var(--border); }
.notice-scope-btn:hover { background: var(--surface-2); }
.notice-scope-btn.is-active {
    background: var(--primary); color: #fff;
}

/* School picker */
.notice-school-picker {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 0.65rem;
}
.notice-school-picker__search {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2, #f9fafb);
}
.notice-school-picker__search-icon { color: var(--ink-3); font-size: 0.8rem; }
.notice-school-picker__search .form-control {
    margin: 0; border: none; background: transparent;
    padding: 0.2rem 0; font-size: 0.8rem; box-shadow: none;
}
.notice-school-picker__actions {
    display: flex; gap: 0.75rem;
    padding: 0.3rem 0.65rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2, #f9fafb);
}
.btn-link {
    background: none; border: none; padding: 0; font-size: 0.72rem;
    color: var(--primary); cursor: pointer; font-weight: 600;
}
.btn-link:hover { text-decoration: underline; }
.notice-school-picker__list {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.15rem 0;
}
.notice-school-picker__item {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.4rem 0.65rem; cursor: pointer;
    font-weight: normal; transition: background 0.1s;
}
.notice-school-picker__item:hover { background: var(--surface-2, #f3f4f6); }
.notice-school-picker__item input[type="checkbox"] { flex-shrink: 0; }
.notice-school-picker__name { font-size: 0.8rem; }
.notice-school-picker__empty { padding: 0.75rem; margin: 0; }
.notice-school-picker__footer {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.4rem 0.65rem; font-size: 0.75rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2, #f9fafb); color: var(--ink-2);
}
.notice-school-picker__footer i { font-size: 0.7rem; color: var(--ink-3); }

/* Action buttons */
.notice-editor__actions {
    display: flex; flex-direction: column; gap: 0.5rem;
}
.btn-block { width: 100%; justify-content: center; }
.announcement-priority {
    display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    padding: 0.15rem 0.45rem; border-radius: 999px;
}
.announcement-priority--important { background: #fef3c7; color: #b45309; }
.announcement-priority--urgent { background: #fee2e2; color: #b91c1c; }
.status-chip {
    display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.15rem 0.5rem;
    border-radius: 999px; background: var(--surface-2);
}
.status-chip--published { background: #dcfce7; color: #166534; }
.status-chip--draft { background: #e5e7eb; color: #374151; }
.status-chip--archived { background: #f3f4f6; color: #6b7280; }
.inline-form { display: inline; }
.table-actions { white-space: nowrap; }
.table-actions .btn { margin-left: 0.25rem; }
.notifications-list { display: flex; flex-direction: column; gap: 0.75rem; }
.notification-item { display: block; text-decoration: none !important; color: inherit; }
.notification-item--unread { border-left: 3px solid var(--primary); }
.notification-item__head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; }
.notification-item__preview { margin: 0 0 0.35rem; color: var(--text-muted); font-size: 0.9rem; }
.notification-detail__body { line-height: 1.6; margin: 1rem 0; }
.notifications-page-toolbar { margin-bottom: 1rem; text-align: right; }
@media (max-width: 768px) {
    .audience-rule { grid-template-columns: 1fr; }
}
.user-dropdown .role-badge {
    display: inline-block; margin-top: 0.35rem;
    padding: 0.15rem 0.5rem; background: var(--primary-light);
    color: var(--primary-dark); border-radius: 999px;
    font-size: 0.6875rem; font-weight: 700;
}
.navbar-term-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
    padding: 0.3rem 0.7rem;
    background: var(--primary-light);
    border: 1px solid rgba(15, 108, 191, 0.15);
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--primary-dark);
    white-space: nowrap;
}
.navbar-term-chip i { font-size: 0.625rem; opacity: 0.85; }

/* ===== Course accordions & activity modal ===== */
.course-section { margin-bottom: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.course-section-header {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 0.85rem 1rem; background: var(--surface-2);
    border: none; cursor: pointer; font-family: inherit;
    font-size: 0.9375rem; font-weight: 700; color: var(--text);
    text-align: left;
}
.course-section-header i.section-icon { margin-right: 0.5rem; color: var(--primary); }
.course-section-header .section-count {
    font-size: 0.8125rem; font-weight: 600; color: var(--text-muted);
    margin-left: auto; margin-right: 0.5rem;
}
.course-section-header .section-chevron { color: var(--text-muted); transition: transform 0.2s; }
.course-section.is-open .section-chevron { transform: rotate(180deg); }
.course-section-body { display: none; padding: 0.75rem; }
.course-section.is-open .course-section-body { display: block; }
.course-section-body .activity-list { gap: 0.65rem; }

.activity-modal-overlay {
    position: fixed; inset: 0; z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(15, 23, 42, 0.45); padding: 1rem;
}
.activity-modal-overlay[hidden] { display: none; }
.activity-modal {
    background: var(--surface); border-radius: var(--radius-lg);
    padding: 1.5rem; width: 100%; max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.activity-modal h3 { font-size: 1.125rem; font-weight: 700; margin-bottom: 0.35rem; }
.activity-modal p { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1rem; }
.activity-modal-options { display: flex; flex-direction: column; gap: 0.5rem; }
.activity-modal-option {
    display: flex; align-items: center; gap: 0.85rem;
    padding: 0.85rem 1rem; border: 1px solid var(--border);
    border-radius: var(--radius); text-decoration: none !important;
    color: var(--text); transition: border-color 0.15s, background 0.15s;
}
.activity-modal-option:hover { border-color: var(--primary); background: var(--primary-light); }
.activity-modal-close {
    position: absolute; top: 1rem; right: 1rem;
    background: none; border: none; font-size: 1.25rem;
    color: var(--text-muted); cursor: pointer;
}
.activity-modal { position: relative; }

@media (max-width: 768px) {
    .moodle-main { padding: 1rem; }
    .admin-page-header {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem 1.1rem;
    }
    .admin-page-header__main { align-items: flex-start; }
    .admin-page-header__actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .admin-page-header__actions .btn { width: 100%; justify-content: center; }
    .form-row { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.75rem; }
    .landing-hero { padding: 2.25rem 0 2.5rem; }
    .landing-hero-shell { padding: 0 1rem; }
    .landing-hero-actions { flex-direction: column; }
    .landing-hero-actions .btn { width: 100%; }
    .landing-hero-panel { display: none; }
    .landing-page .container.landing-section-container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .landing-page .public-header .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .schools-section { padding: 1rem 0 2.25rem; }
    .schools-section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        margin-bottom: 1.25rem;
        padding-bottom: 1rem;
    }
    .schools-section-head {
        flex: 0 0 auto;
        max-width: none;
        min-width: 0;
    }
    .schools-section-header .schools-search-wrap {
        flex: 0 0 auto;
        max-width: none;
        min-width: 0;
    }
    .schools-browse-summary {
        padding: 0.9rem 1rem;
        flex-wrap: wrap;
    }
    .schools-browse-summary-hint {
        margin-left: 0;
        width: 100%;
        padding-left: 1.5rem;
        order: 3;
    }
    .schools-browse-chevron {
        margin-left: auto;
    }
    .schools-browse-panel {
        padding: 0 1rem 1.15rem;
    }
    .schools-search .schools-search-input {
        padding: 0.7rem 1rem 0.7rem 2.5rem;
        font-size: 0.875rem;
    }
    .landing-features-section { padding: 1.5rem 0 1.75rem; }
    .landing-features-head { margin-bottom: 0.85rem; }
    .public-header { padding: 0.65rem 0; }
    .public-nav { gap: 0.25rem; flex-wrap: nowrap; }
    .public-nav .nav-link {
        padding: 0.4rem 0.65rem;
        font-size: 0.8125rem;
    }
    .public-nav .btn-sm {
        padding: 0.4rem 0.75rem;
        font-size: 0.8125rem;
        white-space: nowrap;
    }
    .logo-text { font-size: 1.1rem; }
    .logo-mark,
    .site-logo--header-mark {
        width: 2.15rem;
        height: 2.15rem;
    }
    .dashboard-welcome { flex-direction: column; text-align: center; }
    .stu-alert { flex-direction: column; }
    .stu-alert-actions { width: 100%; }
    .auth-card-split { max-width: 400px; }
    .container { padding-left: 1rem; padding-right: 1rem; }
}

@media (max-width: 640px) {
    .school-card-modern { min-height: 0; }
    .school-card-cover { height: 6.5rem; }
    .school-avatar {
        width: 3.5rem;
        height: 3.5rem;
        font-size: 1.2rem;
        border-width: 3px;
    }
    .school-card-content { padding: 0 1rem 1rem; }
    .school-card-identity h3 { font-size: 0.9375rem; }
    .school-card-btn {
        padding: 0.55rem 0.4rem;
        font-size: 0.6875rem;
        white-space: normal;
        text-align: center;
        line-height: 1.25;
    }
}

@media (max-width: 400px) {
    .logo-text { font-size: 0.95rem; }
    .logo-mark,
    .site-logo--header-mark {
        width: 1.85rem;
        height: 1.85rem;
    }
    .public-nav .nav-link { padding: 0.35rem 0.45rem; }
    .public-nav .btn-sm { padding: 0.35rem 0.55rem; font-size: 0.75rem; }
}

/* ===== Materials module ===== */
.material-editor-wrap { max-width: 900px; margin: 0 auto; }
.material-editor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }

.assignment-editor {
    --ae-accent: var(--primary);
    --ae-accent-soft: var(--primary-light);
    --ae-accent-border: #b7d4ef;
    max-width: 68rem;
    margin: 0 auto;
    padding: 0 0 5.5rem;
}
.assignment-editor__nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1rem;
    margin-bottom: 1.15rem;
}
.assignment-editor__back {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
}
.assignment-editor__back:hover {
    color: var(--primary);
    text-decoration: none;
}
.assignment-editor__crumb {
    font-size: 0.8125rem;
    color: var(--text-muted);
    padding-left: 0.85rem;
    border-left: 1px solid var(--border);
}
.assignment-editor__hero {
    margin-bottom: 1.35rem;
    padding: 1.35rem 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--ae-accent-border);
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(15, 108, 191, 0.12), transparent 55%),
        linear-gradient(135deg, var(--surface-2) 0%, #fff 62%);
}
.assignment-editor__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.55rem;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    background: var(--ae-accent-soft);
    color: var(--primary-dark);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.assignment-editor__title {
    margin: 0;
    font-size: clamp(1.45rem, 2.4vw, 1.85rem);
    font-weight: 750;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text);
}
.assignment-editor__lead {
    margin: 0.45rem 0 0;
    max-width: 36rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}
.assignment-editor__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 17.5rem;
    gap: 1.15rem;
    align-items: start;
}
.assignment-editor__main {
    display: grid;
    gap: 1.15rem;
    min-width: 0;
}
.assignment-editor__side {
    display: grid;
    gap: 0.85rem;
    position: sticky;
    top: 1rem;
}
.assignment-editor__panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.35rem 1.35rem;
    box-shadow: var(--shadow);
}
.assignment-editor__panel-head {
    margin-bottom: 1.1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.assignment-editor__panel-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}
.assignment-editor__panel-head p {
    margin: 0.3rem 0 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.assignment-editor__title-input {
    font-size: 1.05rem;
    font-weight: 600;
    padding: 0.75rem 0.9rem;
}
.assignment-editor__instructions {
    min-height: 11rem;
    resize: vertical;
    line-height: 1.55;
}
.assignment-editor__field-hint {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}
.assignment-editor__points {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.assignment-editor__points input {
    max-width: 7.5rem;
}
.assignment-editor__points span {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
}
.assignment-editor__toggle {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin: 0.35rem 0 0;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    cursor: pointer;
}
.assignment-editor__toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.assignment-editor__toggle-ui {
    flex: 0 0 auto;
    width: 2.4rem;
    height: 1.35rem;
    margin-top: 0.1rem;
    border-radius: 999px;
    background: #cbd5e1;
    position: relative;
    transition: background 0.15s ease;
}
.assignment-editor__toggle-ui::after {
    content: '';
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
    transition: transform 0.15s ease;
}
.assignment-editor__toggle:has(input:checked) {
    border-color: var(--ae-accent-border);
    background: var(--ae-accent-soft);
}
.assignment-editor__toggle:has(input:checked) .assignment-editor__toggle-ui {
    background: var(--ae-accent);
}
.assignment-editor__toggle:has(input:checked) .assignment-editor__toggle-ui::after {
    transform: translateX(1.05rem);
}
.assignment-editor__toggle-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.assignment-editor__toggle-copy strong {
    font-size: 0.875rem;
    color: var(--text);
}
.assignment-editor__toggle-copy span {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.assignment-editor__side-actions {
    display: none;
    gap: 0.55rem;
}
.assignment-editor__side-actions .btn-block,
.assignment-editor__side-actions .btn {
    width: 100%;
    justify-content: center;
}
.assignment-editor__footer {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-top: 1.25rem;
    padding: 0.85rem 0 0.25rem;
    background: linear-gradient(180deg, rgba(240, 242, 245, 0), var(--bg) 28%);
}
.aft-picker__intro {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 0.85rem;
}
.aft-picker__hint {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.aft-picker__limit {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.aft-picker__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9.75rem, 1fr));
    gap: 0.65rem;
}
.aft-tile {
    margin: 0;
    cursor: pointer;
}
.aft-tile input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.aft-tile__face {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    height: 100%;
    padding: 0.8rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}
.aft-tile__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--primary);
    flex: 0 0 auto;
}
.aft-tile__text {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    min-width: 0;
    padding-right: 1rem;
}
.aft-tile__label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.25;
}
.aft-tile__ext {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.3;
    word-break: break-word;
}
.aft-tile__check {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
}
.aft-tile:hover .aft-tile__face {
    border-color: #7eb3e0;
    background: var(--surface-2);
}
.aft-tile:has(input:checked) .aft-tile__face {
    border-color: var(--primary);
    background: var(--ae-accent-soft);
    box-shadow: inset 0 0 0 1px rgba(15, 108, 191, 0.2);
}
.aft-tile:has(input:checked) .aft-tile__check {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}
.aft-tile:has(input:focus-visible) .aft-tile__face {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
@media (min-width: 961px) {
    .assignment-editor__side-actions {
        display: grid;
    }
    .assignment-editor__footer {
        display: none;
    }
}
@media (max-width: 960px) {
    .assignment-editor__layout {
        grid-template-columns: 1fr;
    }
    .assignment-editor__side {
        position: static;
    }
    .assignment-editor__footer {
        position: sticky;
        bottom: 0;
        margin: 1rem -0.25rem 0;
        padding: 0.85rem 0.25rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
        background: rgba(255, 255, 255, 0.94);
        border-top: 1px solid var(--border);
        backdrop-filter: blur(8px);
        box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
    }
}
@media (max-width: 640px) {
    .assignment-editor {
        padding-bottom: 1rem;
    }
    .assignment-editor__hero {
        padding: 1.1rem 1.1rem;
    }
    .assignment-editor__panel {
        padding: 1.05rem 1.05rem 1.15rem;
    }
    .aft-picker__grid {
        grid-template-columns: 1fr 1fr;
    }
}

.material-quill-editor { min-height: 280px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.material-quill-editor .ql-editor { min-height: 240px; }

.ql-page-break::after {
    content: none;
}
.material-view-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow); }
.material-view-header { margin-bottom: 1.25rem; }
.material-view-type { display: inline-block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.35rem; }
.material-doc-body { line-height: 1.65; }
.material-doc-body h1, .material-doc-body h2, .material-doc-body h3 { margin: 1rem 0 0.5rem; }
.material-video-embed {
    position: relative;
    width: 80%;
    max-width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    margin: 0 auto 1rem;
    border-radius: var(--radius);
    overflow: hidden;
}
.material-video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.material-file-preview { margin: 1rem 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.material-file-preview img, .material-file-preview video { display: block; max-width: 100%; margin: 0 auto; }
.material-file-preview--pdf iframe { width: 100%; min-height: 480px; border: 0; }

/* ===== Quiz module ===== */
.quiz-cover-preview { display: block; max-width: 200px; margin-top: 0.5rem; border-radius: var(--radius); }
.quiz-take-cover { height: 140px; background-size: cover; background-position: center; border-radius: var(--radius-lg); margin-bottom: 1rem; }
.quiz-question-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.quiz-question-media {
    margin: 0.75rem 0 1rem; overflow: hidden; border: 1px solid var(--border);
    border-radius: 0.75rem; background: var(--surface-alt); text-align: center;
}
.quiz-question-media img {
    display: block; width: 100%; max-width: 720px; max-height: 440px;
    margin: 0 auto; object-fit: contain;
}
.quiz-question-image-editor {
    margin: 1rem 0; border: 1px solid var(--border);
    border-radius: 0.8rem; background: var(--surface-alt, #f8fafc);
}
.quiz-question-image-editor__summary {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    list-style: none; cursor: pointer; padding: 0.85rem 1rem;
}
.quiz-question-image-editor__summary::-webkit-details-marker { display: none; }
.quiz-question-image-editor__summary-main {
    display: flex; align-items: flex-start; gap: 0.65rem; min-width: 0;
}
.quiz-question-image-editor__summary-main > i {
    margin-top: 0.15rem; color: var(--primary); font-size: 1rem;
}
.quiz-question-image-editor__summary-main strong {
    display: block; color: var(--ink); font-size: 0.88rem;
}
.quiz-question-image-editor__summary-main small {
    display: block; margin-top: 0.1rem; color: var(--ink-3); font-size: 0.75rem; line-height: 1.4;
}
.quiz-question-image-editor__thumb {
    width: 2.75rem; height: 2.75rem; object-fit: cover; border-radius: 0.45rem;
    border: 1px solid var(--border); background: var(--surface); flex-shrink: 0;
}
.quiz-question-image-editor__body {
    padding: 0 1rem 1rem; border-top: 1px solid var(--border);
}
.quiz-question-image-editor__preview { max-width: 420px; margin-top: 0.85rem; }
.quiz-question-image-editor__description { margin: 0.85rem 0 0; }
.quiz-question-image-editor__description > span { display: block; margin-bottom: 0.35rem; font-size: 0.82rem; font-weight: 650; }
.quiz-question-image-editor__prompt-details {
    margin-top: 0.8rem; padding: 0.7rem 0.8rem; border: 1px solid var(--border);
    border-radius: 0.6rem; background: var(--surface);
}
.quiz-question-image-editor__prompt-details summary { cursor: pointer; color: var(--primary); font-size: 0.78rem; font-weight: 650; }
.quiz-question-image-editor__prompt-details dl { margin: 0.65rem 0 0; }
.quiz-question-image-editor__prompt-details dl > div + div { margin-top: 0.55rem; }
.quiz-question-image-editor__prompt-details dt { color: var(--ink-3); font-size: 0.72rem; font-weight: 700; }
.quiz-question-image-editor__prompt-details dd { margin: 0.15rem 0 0; color: var(--ink-2); font-size: 0.76rem; line-height: 1.45; }
.quiz-question-image-editor__actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.8rem; flex-wrap: wrap; }
.quiz-question-image-editor__status { color: var(--ink-3); font-size: 0.78rem; line-height: 1.35; }
.quiz-question-image-editor__status.is-error { color: var(--danger); }
.quiz-question-image-progress {
    margin-top: 0.85rem; padding: 0.8rem 0.85rem; border: 1px solid #d7e5f4;
    border-radius: 0.75rem; background: #fff;
}
.quiz-question-image-progress[hidden] { display: none !important; }
.quiz-question-image-progress__row {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem;
}
.quiz-question-image-progress__percent {
    flex-shrink: 0; color: var(--primary); font-size: 0.75rem; font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.quiz-question-image-progress__track {
    height: 0.45rem; margin-top: 0.65rem; overflow: hidden;
    border-radius: 999px; background: #e2edf8;
}
.quiz-question-image-progress__bar {
    display: block; width: 0; height: 100%; border-radius: inherit;
    background: linear-gradient(90deg, #38bdf8, #0f6cbf);
    transition: width 0.35s ease;
}
.quiz-question-image-progress.is-error .quiz-question-image-progress__bar {
    background: linear-gradient(90deg, #f87171, #dc2626);
}
.quiz-question-image-progress.is-error .quiz-question-image-progress__percent { color: var(--danger); }
.quiz-attempt-type-meta { margin: -0.35rem 0 0.75rem; }

/* Quiz attempt review (teacher) */
.quiz-attempt-review { max-width: 920px; }
.quiz-attempt-hero {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.25rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}
.quiz-attempt-hero__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.quiz-attempt-hero__body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    flex-wrap: wrap;
}
.quiz-attempt-hero__student { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.quiz-attempt-hero__avatar {
    width: 3.25rem; height: 3.25rem; border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), #0a4d8c);
    color: #fff; font-weight: 800; font-size: 1rem;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.quiz-attempt-hero__quiz {
    margin: 0 0 0.15rem; font-size: 0.8125rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted);
}
.quiz-attempt-hero__name { margin: 0; font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.quiz-attempt-hero__meta { margin: 0.25rem 0 0; font-size: 0.875rem; }
.quiz-attempt-hero__score { text-align: center; flex-shrink: 0; }
.quiz-attempt-hero__score-label { display: block; margin-top: 0.35rem; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.quiz-attempt-score-ring {
    --score-pct: 0;
    width: 5.5rem; height: 5.5rem; border-radius: 999px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: conic-gradient(var(--primary) calc(var(--score-pct) * 1%), #e8eef4 0);
    position: relative;
}
.quiz-attempt-score-ring::before {
    content: '';
    position: absolute; inset: 0.45rem; border-radius: 999px; background: var(--surface);
}
.quiz-attempt-score-ring__value,
.quiz-attempt-score-ring__max {
    position: relative; z-index: 1; line-height: 1.1;
}
.quiz-attempt-score-ring__value { font-size: 1.25rem; font-weight: 800; color: var(--ink); }
.quiz-attempt-score-ring__max { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }

.quiz-review-questions { display: flex; flex-direction: column; gap: 0.4rem; }
.quiz-review-questions__toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    margin-bottom: 0.35rem; flex-wrap: wrap;
}
.quiz-review-questions__count { font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); }
.quiz-review-questions__actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.quiz-review-question {
    background: var(--surface);
    border: 1px solid #c8d8ea;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 40, 80, 0.05);
}
.quiz-review-question[open] {
    box-shadow: 0 2px 8px rgba(15, 108, 191, 0.12);
    border-color: rgba(15, 108, 191, 0.45);
}
.quiz-review-question__summary {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.45rem 0.65rem;
    padding: 0.55rem 0.8rem;
    cursor: pointer;
    list-style: none;
    background: linear-gradient(180deg, #ffffff 0%, #f3f8fd 100%);
    border-left: 3px solid var(--primary);
    color: var(--ink);
    user-select: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.quiz-review-question__summary::-webkit-details-marker { display: none; }
.quiz-review-question__summary:hover {
    background: linear-gradient(180deg, #ffffff 0%, #e8f2fb 100%);
}
.quiz-review-question[open] > .quiz-review-question__summary {
    background: #e8f2fb;
    border-left-color: #0a4d8c;
    align-items: start;
}
.quiz-review-question[open] > .quiz-review-question__summary .quiz-review-question__title {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    line-height: 1.45;
}
.quiz-review-question__chevron {
    color: var(--primary); font-size: 0.72rem; width: 0.85rem;
    transition: transform 0.15s ease, color 0.15s ease;
}
.quiz-review-question[open] > .quiz-review-question__summary .quiz-review-question__chevron { transform: rotate(90deg); color: #0a4d8c; }
.quiz-review-question__num {
    flex-shrink: 0; min-width: 1.85rem; height: 1.55rem; padding: 0 0.35rem; border-radius: 0.35rem;
    background: var(--primary); color: #fff; font-size: 0.6875rem; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center;
}
.quiz-review-question__title {
    margin: 0; font-size: 0.875rem; font-weight: 700; line-height: 1.25;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
    color: #1a2b3c;
}
.quiz-review-question__type {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.15rem 0.45rem; border-radius: 999px;
    font-size: 0.6875rem; font-weight: 700; white-space: nowrap;
    background: rgba(15, 108, 191, 0.12); color: #0c5a9e;
}
.quiz-review-score {
    flex-shrink: 0; padding: 0.22rem 0.6rem; border-radius: 999px;
    font-size: 0.75rem; font-weight: 800; white-space: nowrap;
    border: 1px solid transparent;
}
.quiz-review-score--full { background: #ccebd4; color: #0f5132; border-color: #9fd4ae; }
.quiz-review-score--partial { background: #ffe8a3; color: #7a5200; border-color: #f0c84d; }
.quiz-review-score--zero { background: #f8c2c8; color: #842029; border-color: #ea868f; }
.quiz-review-score--pending { background: #dde2e8; color: #343a40; border-color: #c4cbd4; }
.quiz-review-score__sep, .quiz-review-score__unit { font-weight: 600; opacity: 0.85; }
.quiz-review-score__unit { margin-left: 0.05rem; font-size: 0.6875rem; }
.quiz-review-question__body { padding: 0.65rem 0.75rem 0.75rem; border-top: 1px solid var(--border); font-size: 0.875rem; }
.quiz-review-question__prompt {
    margin: 0 0 0.65rem;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius);
    background: #f8fafc;
    border: 1px solid var(--border);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.45;
    color: #1a2b3c;
    white-space: pre-wrap;
}

.quiz-review-answer {
    padding: 0.55rem 0.7rem; border-radius: var(--radius);
    background: var(--bg); border: 1px solid var(--border); line-height: 1.45;
}
.quiz-review-answer--essay { white-space: pre-wrap; }
.quiz-review-file-link {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.65rem 0.9rem; border-radius: var(--radius);
    background: #fff; border: 1px solid var(--border); text-decoration: none; font-weight: 600;
}
.quiz-review-file-link:hover { border-color: var(--primary); color: var(--primary); }

.quiz-review-matching { display: flex; flex-direction: column; gap: 0.35rem; }
.quiz-review-matching-pair {
    display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 0.35rem 0.55rem; align-items: center;
    padding: 0.4rem 0.55rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg);
    font-size: 0.8125rem;
}
.quiz-review-matching-pair--correct { border-color: #b8dfc4; background: #f0faf3; }
.quiz-review-matching-pair--incorrect { border-color: #f1c2c7; background: #fff8f8; }
.quiz-review-matching-status {
    width: 1.35rem; height: 1.35rem; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 0.65rem;
}
.quiz-review-matching-pair--correct .quiz-review-matching-status { background: #d4edda; color: #155724; }
.quiz-review-matching-pair--incorrect .quiz-review-matching-status { background: #f8d7da; color: #721c24; }
.quiz-review-matching-left, .quiz-review-matching-chosen { font-weight: 600; min-width: 0; word-break: break-word; }
.quiz-review-matching-arrow { color: var(--text-muted); text-align: center; }
.quiz-review-matching-expected {
    grid-column: 2 / -1; font-size: 0.8125rem; color: #721c24; font-weight: 600;
}

.quiz-review-blanks { display: flex; flex-direction: column; gap: 0.5rem; }
.quiz-review-blank {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem;
    padding: 0.65rem 0.85rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg);
}
.quiz-review-blank--correct { border-color: #b8dfc4; background: #f0faf3; }
.quiz-review-blank--incorrect { border-color: #f1c2c7; background: #fff8f8; }
.quiz-review-blank-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
.quiz-review-blank-given { font-weight: 700; }
.quiz-review-blank-expected { font-size: 0.8125rem; color: #721c24; font-weight: 600; }

.quiz-review-choice {
    display: inline-flex; align-items: center; gap: 0.65rem;
    padding: 0.75rem 1rem; border-radius: var(--radius); border: 2px solid var(--border); font-weight: 600;
}
.quiz-review-choice--correct { border-color: #28a745; background: #f0faf3; color: #155724; }
.quiz-review-choice--incorrect { border-color: #dc3545; background: #fff8f8; color: #721c24; }
.quiz-review-choice--neutral { background: var(--bg); }

.quiz-review-grade-form {
    margin-top: 0.65rem; padding-top: 0.65rem; border-top: 1px dashed var(--border);
}
.quiz-review-grade-form__fields {
    display: grid; grid-template-columns: minmax(140px, 180px) 1fr; gap: 0.65rem; margin-bottom: 0.65rem;
}
.quiz-review-grade-form__score {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.quiz-review-grade-form__score-input {
    width: 4.75rem;
    min-width: 0;
    flex-shrink: 0;
    text-align: right;
}
.quiz-review-grade-form__score-sep,
.quiz-review-grade-form__score-max {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.quiz-review-empty { margin: 0; }

/* Student quiz results */
.quiz-results-hero {
    padding: 0.85rem 1rem 1rem;
}
.quiz-results-hero__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}
.quiz-results-hero__main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.quiz-results-hero__info {
    min-width: 0;
    flex: 1;
}
.quiz-results-hero__title {
    margin: 0;
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    font-weight: 800;
    line-height: 1.25;
    color: var(--text);
}
.quiz-results-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}
.quiz-results-hero__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    background: #f3f6f9;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}
.quiz-results-hero__chip i {
    font-size: 0.7rem;
    color: var(--primary);
}
.quiz-results-hero__chip--pending {
    background: #fff8e6;
    border-color: #f0d78c;
    color: #856404;
}
.quiz-results-hero__chip--pending i {
    color: #856404;
}
.quiz-results-hero__score {
    flex-shrink: 0;
    text-align: center;
    min-width: 5.5rem;
    padding: 0.55rem 0.75rem;
    border-radius: 0.85rem;
    background: linear-gradient(180deg, #f0f6fc 0%, #fff 100%);
    border: 1px solid rgba(15, 108, 191, 0.16);
}
.quiz-results-score {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.15rem;
    line-height: 1;
}
.quiz-results-score__value {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}
.quiz-results-score__max {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-muted);
}
.quiz-results-score__label {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.quiz-results-score--pending .quiz-results-score__value,
.quiz-results-score--hidden .quiz-results-score__value {
    color: var(--text-muted);
    font-size: 1.2rem;
}
@media (max-width: 640px) {
    .quiz-results-hero {
        padding: 0.75rem 0.85rem 0.85rem;
    }
    .quiz-results-hero__bar {
        margin-bottom: 0.7rem;
    }
    .quiz-results-hero__main {
        align-items: flex-start;
        gap: 0.75rem;
    }
    .quiz-results-hero__title {
        font-size: 1.05rem;
    }
    .quiz-results-hero__meta {
        margin-top: 0.4rem;
        gap: 0.3rem;
    }
    .quiz-results-hero__chip {
        padding: 0.2rem 0.5rem;
        font-size: 0.6875rem;
    }
    .quiz-results-hero__score {
        min-width: 4.75rem;
        padding: 0.45rem 0.55rem;
        border-radius: 0.7rem;
    }
    .quiz-results-score__value {
        font-size: 1.2rem;
    }
    .quiz-results-score__max {
        font-size: 0.75rem;
    }
}

.quiz-review-question--pending > .quiz-review-question__summary {
    border-left-color: #e0a800;
}
.quiz-results-answer-label {
    margin: 0 0 0.4rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.quiz-results-verdict {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.75rem 0 0;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 700;
}
.quiz-results-verdict--correct {
    background: #d4edda;
    color: #155724;
}
.quiz-results-verdict--incorrect {
    background: #f8d7da;
    color: #721c24;
}
.quiz-results-verdict--pending {
    background: #fff3cd;
    color: #856404;
}
.quiz-results-feedback {
    margin-top: 0.85rem;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius);
    background: #f0f6fc;
    border: 1px solid rgba(15, 108, 191, 0.18);
}
.quiz-results-feedback__label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.quiz-results-feedback p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text);
    white-space: pre-wrap;
}
.quiz-results-attempts-toolbar {
    margin-bottom: 1rem;
}
.quiz-results-attempts {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.quiz-results-attempt-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.quiz-results-attempt-card__main {
    min-width: 0;
}
.quiz-results-attempt-card__num {
    display: block;
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 0.35rem;
}
.quiz-results-attempt-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    font-size: 0.8125rem;
}
.quiz-results-attempt-card__score {
    margin: 0.4rem 0 0;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
}
@media (max-width: 640px) {
    .quiz-results-attempt-card {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 720px) {
    .quiz-review-question__summary {
        grid-template-columns: auto auto minmax(0, 1fr) auto;
    }
    .quiz-review-question__type { display: none; }
    .quiz-review-matching-pair { grid-template-columns: auto 1fr; }
    .quiz-review-matching-arrow { display: none; }
    .quiz-review-matching-chosen { grid-column: 2; }
    .quiz-review-grade-form__fields { grid-template-columns: 1fr; }
    .quiz-attempt-hero__body { flex-direction: column; align-items: stretch; }
    .quiz-attempt-hero__score { align-self: center; }
}
.quiz-fill-blank { line-height: 2.2; }
.quiz-blank-input { display: inline-block; width: auto; min-width: 120px; max-width: 220px; margin: 0 0.25rem; vertical-align: baseline; }
.quiz-fill-text { white-space: pre-wrap; }
.quiz-matching-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; align-items: center; margin-bottom: 0.5rem; }
.quiz-matching-left { font-weight: 600; }
.quiz-matching-help { font-size: 0.875rem; margin: 0 0 0.75rem; }
.quiz-matching-connect { margin-top: 0.25rem; }
.quiz-matching-board {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(3rem, 5rem) minmax(0, 1fr);
    gap: 0.5rem;
    align-items: stretch;
    min-height: 6rem;
    padding: 0.35rem 0;
}
.quiz-matching-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}
.quiz-matching-line {
    fill: none;
    stroke: var(--primary);
    stroke-width: 2.5;
    stroke-linecap: round;
}
.quiz-matching-col {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    position: relative;
    z-index: 2;
}
.quiz-matching-col--left { grid-column: 1; }
.quiz-matching-col--right { grid-column: 3; }
.quiz-matching-item {
    display: block;
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    font: inherit;
    font-size: 0.9375rem;
    line-height: 1.35;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.quiz-matching-item:hover { border-color: var(--primary-light); background: rgba(15, 108, 191, 0.04); }
.quiz-matching-item.is-selected {
    border-color: var(--primary);
    background: rgba(15, 108, 191, 0.1);
    box-shadow: 0 0 0 3px var(--primary-light);
}
.quiz-matching-item.is-connected {
    border-color: #10b981;
    background: #ecfdf5;
}
.quiz-matching-item.is-connected.is-selected {
    border-color: var(--primary);
    background: rgba(15, 108, 191, 0.1);
}
/* Quiz wizard focused workspace */
.course-view--quiz-builder .course-hero,
.course-view--quiz-builder .course-builder { display: none !important; }
.course-view--quiz-builder .course-main--full { max-width: none; width: 100%; }
.course-view--quiz-builder {
    margin: -0.5rem -0.25rem 0;
    padding: 0.75rem 0.5rem 1.25rem;
    background:
        radial-gradient(1200px 420px at 8% -10%, rgba(15, 108, 191, 0.12), transparent 55%),
        radial-gradient(900px 380px at 100% 0%, rgba(14, 165, 233, 0.08), transparent 50%),
        linear-gradient(180deg, #eef4fb 0%, var(--bg) 42%, var(--bg) 100%);
    border-radius: 0;
}
.course-content-section--quiz-wizard {
    padding: 0; border: none; box-shadow: none; background: transparent; margin: 0;
}

.quiz-wizard--focused {
    --qw-accent: var(--primary);
    --qw-accent-soft: rgba(15, 108, 191, 0.1);
    --qw-panel: rgba(255, 255, 255, 0.92);
    --qw-panel-border: rgba(148, 163, 184, 0.35);
    max-width: none; margin: 0; display: flex; flex-direction: column; gap: 1rem;
    min-height: calc(100vh - 7rem);
}

.quiz-workspace-kicker {
    margin: 0 0 0.2rem;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.quiz-workspace-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.95rem 1.15rem 1rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 255, 0.96) 100%);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 1.1rem;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.8) inset,
        0 10px 28px rgba(15, 48, 96, 0.07);
    backdrop-filter: blur(12px);
}

.quiz-workspace-header__bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 1rem 1.25rem;
}

.quiz-workspace-header__identity {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.quiz-workspace-back {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.85rem;
    border: 1px solid #dbe5f0;
    color: #334155;
    text-decoration: none;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.quiz-workspace-back:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #eff6ff;
    text-decoration: none;
    transform: translateY(-1px);
}

.quiz-workspace-title-block {
    min-width: 0;
}

.quiz-workspace-title-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    min-width: 0;
}

.quiz-wizard-title {
    margin: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.03em;
    color: #0f172a;
}

.quiz-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.quiz-status-badge i {
    font-size: 0.65rem;
}

.quiz-status-badge--draft {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fdba74;
}

.quiz-status-badge--published {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #6ee7b7;
}

.quiz-workspace-tabs {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.28rem;
    background: #eef4fb;
    border-radius: 999px;
    border: 1px solid #d7e4f3;
}

.quiz-workspace-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.48rem 0.95rem;
    border-radius: 999px;
    text-decoration: none;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.quiz-workspace-tab:hover {
    color: var(--primary);
    text-decoration: none;
}

.quiz-workspace-tab__num {
    display: grid;
    place-items: center;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #c9daf0;
    font-size: 0.68rem;
    font-weight: 800;
}

.quiz-workspace-tab.is-active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(15, 108, 191, 0.14);
}

.quiz-workspace-tab.is-active .quiz-workspace-tab__num {
    background: var(--primary);
    border-color: transparent;
    color: #fff;
}

.quiz-workspace-header__actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.quiz-workspace-action {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.35rem;
    padding: 0.45rem 0.95rem;
    border-radius: 0.75rem;
    font-weight: 700;
}

.quiz-workspace-action--primary {
    box-shadow: 0 6px 16px rgba(15, 108, 191, 0.22);
}

.quiz-workspace-header__meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 0.15rem;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
}

.quiz-workspace-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 700;
}

.quiz-workspace-chip i {
    color: #64748b;
    font-size: 0.72rem;
}

.quiz-workspace-chip--hint {
    background: transparent;
    border-color: transparent;
    color: #94a3b8;
    font-weight: 600;
    padding-left: 0.15rem;
}

.quiz-workspace-chip--hint i {
    color: #94a3b8;
}

.quiz-workspace-split {
    display: grid; grid-template-columns: minmax(250px, 33%) minmax(0, 1fr);
    gap: 1rem; align-items: start; flex: 1;
}

.quiz-question-rail {
    position: sticky; top: 8.5rem;
    display: flex; flex-direction: column; max-height: calc(100vh - 9.5rem);
    background: var(--qw-panel); border: 1px solid var(--qw-panel-border);
    border-radius: 1rem; box-shadow: 0 10px 28px rgba(15, 48, 96, 0.07);
    overflow: hidden; backdrop-filter: blur(8px);
}
.quiz-question-rail__head {
    display: flex; align-items: center; justify-content: space-between; gap: 0.65rem;
    padding: 0.95rem 1rem;
    border-bottom: 1px solid #e4edf7;
    background: linear-gradient(180deg, #f8fbff, #f1f6fc);
}
.quiz-question-rail__head strong {
    display: block; font-size: 0.92rem; color: #143555; letter-spacing: -0.01em;
}
.quiz-question-rail__head span { color: #6d86a3; font-size: 0.74rem; font-weight: 650; }
.quiz-question-rail__head .btn {
    border-radius: 999px; box-shadow: 0 4px 12px rgba(15, 108, 191, 0.2);
}
.quiz-question-rail__empty {
    padding: 2.4rem 1.25rem; text-align: center; color: #6d86a3;
}
.quiz-question-rail__empty i {
    display: grid; place-items: center; width: 3rem; height: 3rem; margin: 0 auto 0.75rem;
    border-radius: 1rem; background: var(--primary-light); color: var(--primary);
    font-size: 1.15rem; opacity: 1;
}
.quiz-question-rail__empty p { margin: 0; font-size: 0.84rem; line-height: 1.5; }
.quiz-question-rail__list {
    overflow-y: auto; padding: 0.7rem; display: flex; flex-direction: column; gap: 0.5rem;
    background: linear-gradient(180deg, rgba(248, 251, 255, 0.4), transparent 80px);
}

.quiz-rail-card {
    display: grid; grid-template-columns: 1fr auto; gap: 0.15rem;
    border: 1px solid #e2ebf5; border-radius: 0.85rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 48, 96, 0.03);
    transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s, background 0.16s;
}
.quiz-rail-card:hover {
    border-color: #b9d0e8;
    box-shadow: 0 8px 18px rgba(15, 48, 96, 0.08);
    transform: translateY(-1px);
}
.quiz-rail-card.is-active {
    border-color: #7eb6e8;
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.12), 0 10px 22px rgba(15, 108, 191, 0.1);
    background: linear-gradient(180deg, #f4f9ff, #eef6ff);
}
.quiz-rail-card__main {
    display: grid; grid-template-columns: auto 1fr; gap: 0.6rem; align-items: start;
    padding: 0.75rem 0.5rem 0.75rem 0.75rem; text-decoration: none; color: inherit; min-width: 0;
}
.quiz-rail-card__main:hover { text-decoration: none; }
.quiz-rail-card__index {
    display: grid; place-items: center; width: 2rem; height: 2rem;
    border-radius: 0.65rem; background: #eef3f8; color: #3d5f82;
    font-size: 0.68rem; font-weight: 800; letter-spacing: 0.02em;
    border: 1px solid #d7e3f0;
}
.quiz-rail-card.is-active .quiz-rail-card__index {
    background: linear-gradient(180deg, #1a7fd0, #0f6cbf);
    border-color: transparent; color: #fff;
    box-shadow: 0 4px 10px rgba(15, 108, 191, 0.28);
}
.quiz-rail-card__body { min-width: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.quiz-rail-card__stem {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    line-clamp: 2; overflow: hidden; font-size: 0.84rem; font-weight: 700; line-height: 1.35;
    color: #16324f;
}
.quiz-rail-card__meta {
    display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap;
}
.quiz-rail-pill {
    display: inline-flex; align-items: center; padding: 0.12rem 0.45rem;
    border-radius: 999px; background: #eef4fb; color: #3d6288;
    border: 1px solid #d7e4f3; font-size: 0.66rem; font-weight: 750;
}
.quiz-rail-pill--muted { background: #f5f7fa; color: #6b7f96; border-color: #e4e9ef; }
.quiz-rail-card.is-active .quiz-rail-pill {
    background: #dff0ff; border-color: #b7d8f5; color: #0f6cbf;
}
.quiz-rail-card__media {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.35rem; height: 1.35rem; border-radius: 0.4rem;
    background: #e7f4ff; color: var(--primary); font-size: 0.68rem;
}
.quiz-rail-card__actions {
    display: flex; flex-direction: column; justify-content: center; gap: 0.08rem;
    padding: 0.4rem 0.35rem 0.4rem 0; opacity: 0.55; transition: opacity 0.15s;
}
.quiz-rail-card:hover .quiz-rail-card__actions,
.quiz-rail-card.is-active .quiz-rail-card__actions { opacity: 1; }
.quiz-icon-btn {
    display: grid; place-items: center; width: 1.7rem; height: 1.7rem;
    border: 0; background: transparent; color: #6d86a3; border-radius: 0.45rem; cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.quiz-icon-btn:hover:not(:disabled) { background: #eaf2fa; color: #16324f; }
.quiz-icon-btn:disabled { opacity: 0.28; cursor: not-allowed; }
.quiz-icon-btn--danger:hover:not(:disabled) { background: #fef2f2; color: var(--danger); }

.quiz-editor-pane {
    overflow: hidden;
    min-width: 0;
    padding: 0 1.35rem 1.35rem;
    border: 1px solid var(--qw-panel-border);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 10px 26px rgba(15, 48, 96, 0.07);
}
.quiz-editor-pane__head {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    margin: 0 -1.35rem 1.2rem;
    padding: 1.05rem 1.35rem;
    border-bottom: 1px solid #e4edf6;
    background: #f8fafc;
}
.quiz-editor-pane__heading {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}
.quiz-editor-pane__heading-icon {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    border: 1px solid #bfdbfe;
    border-radius: 0.75rem;
    background: #eff6ff;
    color: var(--primary);
    font-size: 0.85rem;
}
.quiz-editor-pane__head h2 {
    margin: 0 0 0.15rem; font-size: 1.15rem; font-weight: 800; color: #12314f;
    letter-spacing: -0.015em;
}
.quiz-editor-pane__head .quiz-workspace-kicker { margin-bottom: 0.1rem; }
.quiz-editor-pane__head .text-muted { margin: 0; font-size: 0.8rem; color: #6d86a3; }

.quiz-editor-toolbar {
    display: grid; grid-template-columns: 1fr 6.75rem; gap: 0.95rem; align-items: start;
    margin-bottom: 1.1rem; padding: 1rem; border-radius: 0.85rem;
    background: #f8fafc; border: 1px solid #dfe8f1;
}
.quiz-type-chip-field { margin: 0; }
.quiz-type-chip-field > label,
.quiz-points-field > label {
    display: block; margin-bottom: 0.35rem; font-size: 0.74rem; font-weight: 750;
    color: #5b7391; text-transform: uppercase; letter-spacing: 0.04em;
}
.quiz-type-chips {
    display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.15rem;
}
.quiz-type-chip {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.45rem 0.75rem; border: 1px solid #d6e0ea; border-radius: 0.65rem;
    background: #fff; color: #345978; font-size: 0.78rem; font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.quiz-type-chip i { font-size: 0.78rem; color: #7ea3c7; }
.quiz-type-chip:hover {
    border-color: #8fb8dd; background: #f5faff;
}
.quiz-type-chip.is-selected {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff; box-shadow: 0 3px 8px rgba(15, 108, 191, 0.2);
}
.quiz-type-chip.is-selected i { color: #fff; }
.quiz-points-field { margin: 0; }
.quiz-points-field input {
    min-height: 2.65rem; text-align: center; font-weight: 800; border-radius: 0.65rem;
    border-color: #cbd9e7; background: #fff;
}

.quiz-question-form .form-group > label {
    font-weight: 700; color: #234863;
}
.quiz-question-form .form-control {
    border-color: #d7e3f0; border-radius: 0.75rem;
    box-shadow: inset 0 1px 2px rgba(15, 48, 96, 0.02);
}
.quiz-question-form .form-control:focus {
    border-color: #7eb6e8;
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.14);
}
#questionText {
    min-height: 7rem;
    padding: 0.85rem 0.95rem;
    font-size: 0.95rem;
    line-height: 1.55;
    resize: vertical;
}

.quiz-wizard-form-actions {
    display: flex; gap: 0.55rem; flex-wrap: wrap;
    margin-top: 1.25rem; padding-top: 1.05rem; border-top: 1px solid #e5eef7;
}
.quiz-wizard-form-actions .btn-primary {
    box-shadow: 0 6px 16px rgba(15, 108, 191, 0.22);
}

.quiz-workspace-footer {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
    padding: 0.95rem 1.1rem;
    background: linear-gradient(180deg, #ffffff, #f7faff);
    border: 1px solid var(--qw-panel-border);
    border-radius: 1rem; box-shadow: 0 10px 28px rgba(15, 48, 96, 0.07);
}
.quiz-workspace-footer--sticky {
    position: sticky; bottom: 0.75rem; z-index: 15; margin-top: 0.75rem;
    backdrop-filter: blur(10px);
}
.quiz-settings-form {
    display: flex; flex-direction: column; gap: 1rem;
    padding-bottom: 0.25rem;
}
.quiz-wizard-footer-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.quiz-ai-review-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}
body.course-context-modal-open { overflow: hidden; }
.quiz-ai-review-modal[hidden] { display: none !important; }
.quiz-ai-review-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 35, 58, 0.28);
    backdrop-filter: blur(4px);
}
.quiz-ai-review-modal__panel {
    position: relative;
    width: min(100%, 28rem);
    padding: 1.5rem 1.5rem 1.35rem;
    border: 1px solid #f3e6c8;
    border-radius: 1.15rem;
    background: linear-gradient(180deg, #fffdf8 0%, #fff 42%, #fffaf3 100%);
    box-shadow:
        0 18px 44px rgba(146, 97, 18, 0.12),
        0 2px 8px rgba(15, 48, 96, 0.06);
    text-align: center;
}
.quiz-ai-review-modal__icon {
    display: inline-grid;
    place-items: center;
    width: 3.25rem;
    height: 3.25rem;
    margin: 0 auto 0.85rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #b45309;
    font-size: 1.25rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}
.quiz-ai-review-modal__eyebrow {
    margin: 0 0 0.35rem;
    color: #b45309;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.quiz-ai-review-modal__title {
    margin: 0 0 0.65rem;
    color: #1e3a5f;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.35;
}
.quiz-ai-review-modal__message {
    margin: 0 0 1rem;
    color: #5b6778;
    font-size: 0.92rem;
    line-height: 1.55;
}
.quiz-ai-review-modal__tips {
    list-style: none;
    margin: 0 0 1.2rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.85rem;
    background: rgba(255, 247, 230, 0.85);
    border: 1px solid #f6e7c3;
    text-align: left;
}
.quiz-ai-review-modal__tips li {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    color: #6b5a3e;
    font-size: 0.84rem;
    line-height: 1.45;
}
.quiz-ai-review-modal__tips li + li { margin-top: 0.45rem; }
.quiz-ai-review-modal__tips i {
    margin-top: 0.15rem;
    color: #d97706;
    font-size: 0.72rem;
}
.quiz-ai-review-modal__actions {
    display: flex;
    flex-direction: column-reverse;
    gap: 0.55rem;
}
.quiz-ai-review-modal__stay {
    justify-content: center;
    color: #64748b;
}
.quiz-ai-review-modal__continue {
    justify-content: center;
    box-shadow: 0 8px 18px rgba(15, 108, 191, 0.18);
}
@media (min-width: 520px) {
    .quiz-ai-review-modal__actions {
        flex-direction: row;
        align-items: center;
        justify-content: center;
    }
    .quiz-ai-review-modal__stay,
    .quiz-ai-review-modal__continue {
        flex: 1 1 0;
    }
}

.quiz-settings-workspace {
    display: flex; flex-direction: column; gap: 1rem;
    padding-bottom: 0.5rem;
}
.quiz-settings-workspace__intro {
    display: flex; align-items: center; justify-content: space-between; gap: 1.15rem;
    padding: 1.2rem 1.3rem; border-radius: 1rem;
    background: linear-gradient(135deg, #ffffff 0%, #f3f8ff 100%);
    border: 1px solid var(--qw-panel-border);
    box-shadow: 0 8px 22px rgba(15, 48, 96, 0.06);
}
.quiz-settings-workspace__intro-copy { min-width: 0; }
.quiz-settings-workspace__intro h2 {
    margin: 0 0 0.3rem; font-size: 1.25rem; font-weight: 800; color: #12314f;
    letter-spacing: -0.02em;
}
.quiz-settings-workspace__intro .text-muted { margin: 0; font-size: 0.86rem; color: #6d86a3; }
.quiz-settings-summary {
    display: grid; grid-template-columns: repeat(3, minmax(4.5rem, auto)); gap: 0.55rem;
    flex-shrink: 0;
}
.quiz-settings-summary__item {
    min-width: 5.5rem; padding: 0.65rem 0.8rem; border-radius: 0.8rem;
    background: #fff; border: 1px solid #dce8f5; text-align: center;
    box-shadow: 0 2px 8px rgba(15, 48, 96, 0.04);
}
.quiz-settings-summary__label {
    display: block; margin-bottom: 0.2rem; color: #6d86a3;
    font-size: 0.68rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.04em;
}
.quiz-settings-summary__item strong {
    display: block; font-size: 1rem; font-weight: 800; color: #143555;
}
.quiz-settings-summary__item strong.is-draft { color: #c2410c; }
.quiz-settings-summary__item strong.is-published { color: #047857; }

.quiz-settings-grid {
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 1rem;
    align-items: start; width: 100%;
}
.quiz-settings-column {
    display: flex; flex-direction: column; gap: 1rem; min-width: 0; width: 100%;
}
.quiz-settings-card {
    display: block; width: 100%; min-width: 0; box-sizing: border-box;
    margin: 0; padding: 1.25rem 1.25rem 1.3rem; border: 1px solid var(--qw-panel-border);
    border-radius: 1rem; background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 26px rgba(15, 48, 96, 0.06);
}
.quiz-settings-card__head {
    display: flex; align-items: flex-start; gap: 0.75rem;
    width: 100%; margin: 0 0 1.05rem; padding: 0 0 0.95rem;
    border-bottom: 1px solid #e8f0f8;
}
.quiz-settings-card__icon {
    display: grid; place-items: center; width: 2.35rem; height: 2.35rem; flex-shrink: 0;
    border-radius: 0.75rem; background: linear-gradient(180deg, #eaf4ff, #dceeff);
    color: var(--primary); border: 1px solid #c9dff5; font-size: 0.95rem;
}
.quiz-settings-card__icon--green {
    background: linear-gradient(180deg, #ecfdf5, #d1fae5);
    color: #059669; border-color: #a7f3d0;
}
.quiz-settings-card__head h3 {
    margin: 0; font-size: 0.98rem; font-weight: 800; color: #143555;
    letter-spacing: -0.01em;
}
.quiz-settings-card__head p {
    margin: 0.15rem 0 0; color: #6d86a3; font-size: 0.78rem; font-weight: 550; line-height: 1.4;
}
.quiz-settings-card .form-group {
    margin-bottom: 0.9rem; min-width: 0; width: 100%;
}
.quiz-settings-card .form-group:last-child { margin-bottom: 0; }
.quiz-settings-card .form-group > label {
    display: block; width: auto; max-width: 100%;
    margin-bottom: 0.35rem; font-size: 0.8rem; font-weight: 750; color: #2d4d6d;
}
.quiz-settings-card .form-control {
    display: block; width: 100%; max-width: 100%; box-sizing: border-box;
    border-color: #d5e3f2; border-radius: 0.75rem;
    background: #fff; min-height: 2.55rem;
}
.quiz-settings-card textarea.form-control { min-height: 6.5rem; resize: vertical; }
.quiz-settings-card .form-control:focus {
    border-color: #7eb6e8;
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.14);
}
.quiz-settings-card .text-muted { font-size: 0.74rem; }

.quiz-settings-timeline {
    position: relative; display: flex; flex-direction: column; gap: 0.35rem;
    padding-left: 1.35rem; width: 100%; min-width: 0;
}
.quiz-settings-timeline::before {
    content: ""; position: absolute; left: 0.45rem; top: 1.1rem; bottom: 1.35rem;
    width: 2px; background: linear-gradient(180deg, #93c5fd, #dbeafe);
    pointer-events: none;
}
.quiz-settings-timeline .form-group {
    position: relative; padding: 0.75rem 0.85rem;
    margin: 0; border-radius: 0.8rem; background: #f8fbff;
    border: 1px solid #e5eef7;
}
.quiz-settings-timeline .form-group:hover {
    background: #f3f8ff; border-color: #d5e5f5;
}
.quiz-settings-timeline .form-group::before {
    content: ""; position: absolute; left: -1.05rem; top: 1.15rem;
    width: 0.7rem; height: 0.7rem; border-radius: 50%;
    background: #fff; border: 2px solid #0f6cbf; z-index: 1;
    box-shadow: 0 0 0 3px #fff;
}
.quiz-settings-timeline .form-group > label i { display: none; }

.quiz-settings-inline {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.75rem;
    width: 100%;
}
.quiz-settings-inline .form-group { min-width: 0; }
.quiz-settings-cover__row {
    display: grid; grid-template-columns: 4.5rem 1fr; gap: 0.85rem; align-items: center;
}
.quiz-settings-cover__placeholder {
    display: grid; place-items: center; width: 4.5rem; height: 4.5rem;
    border-radius: 0.85rem; background: #eef4fb; border: 1px dashed #b9d0e8; color: #7ea3c7;
}
.quiz-settings-cover .quiz-cover-preview {
    width: 4.5rem; height: 4.5rem; object-fit: cover; border-radius: 0.85rem;
    border: 1px solid #d5e3f2; margin: 0;
}
.quiz-settings-cover__input small { display: block; margin-top: 0.35rem; }

.quiz-settings-card--publish { grid-column: 1 / -1; width: 100%; min-width: 0; }
.quiz-settings-toggles {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem;
    width: 100%;
}
.quiz-settings-toggle {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem;
    margin: 0; padding: 0.95rem 1rem; border-radius: 0.9rem;
    border: 1px solid #dce8f5; background: #f8fbff; cursor: pointer;
    min-width: 0; width: 100%; box-sizing: border-box;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.quiz-settings-toggle:hover {
    border-color: #9fc0e0; background: #fff;
    box-shadow: 0 6px 16px rgba(15, 48, 96, 0.06);
}
.quiz-settings-toggle__copy { min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; }
.quiz-settings-toggle__copy strong {
    display: block; margin-bottom: 0.2rem; font-size: 0.86rem; color: #143555;
}
.quiz-settings-toggle__copy span {
    display: block; color: #6d86a3; font-size: 0.76rem; line-height: 1.4; font-weight: 500;
}
.quiz-settings-toggle input[type="checkbox"] {
    width: 1.15rem; height: 1.15rem; margin-top: 0.15rem; flex-shrink: 0;
    accent-color: var(--primary); cursor: pointer;
}
.quiz-settings-toggle--publish {
    background: linear-gradient(180deg, #ecfdf5, #f0fdf4);
    border-color: #86efac;
}
.quiz-settings-toggle--publish:hover {
    border-color: #34d399; box-shadow: 0 6px 16px rgba(5, 150, 105, 0.12);
}
.quiz-settings-toggle--publish input[type="checkbox"] { accent-color: #059669; }
.quiz-settings-form .quiz-settings-group { border: 0; padding: 0; margin: 0 0 1.35rem; }

.quiz-question-image-editor {
    background: linear-gradient(180deg, #f8fbff, #f3f8fd);
    border-color: #d7e5f4;
}
.quiz-question-image-editor[open] {
    box-shadow: inset 0 0 0 1px rgba(15, 108, 191, 0.05);
}

@media (max-width: 1100px) {
    .quiz-workspace-header__bar {
        grid-template-columns: minmax(0, 1fr);
        justify-items: stretch;
    }
    .quiz-workspace-tabs {
        justify-self: start;
    }
    .quiz-workspace-header__actions {
        justify-content: flex-start;
    }
    .quiz-workspace-chip--hint {
        width: 100%;
    }
    .quiz-settings-toggles { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .course-view--quiz-builder { margin: 0; padding: 0.25rem 0 1rem; }
    .quiz-workspace-split { grid-template-columns: 1fr; }
    .quiz-question-rail {
        position: static; max-height: none;
    }
    .quiz-question-rail__list {
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: 18rem;
    }
    .quiz-settings-workspace__intro { flex-direction: column; align-items: stretch; }
    .quiz-settings-summary { width: 100%; grid-template-columns: repeat(3, 1fr); }
    .quiz-settings-grid { grid-template-columns: 1fr; }
    .quiz-settings-card--publish { grid-column: auto; }
}
@media (max-width: 640px) {
    .quiz-workspace-action span { display: none; }
    .quiz-workspace-chip--hint { display: none; }
    .quiz-editor-toolbar { grid-template-columns: 1fr; }
    .quiz-question-rail__list { grid-template-columns: 1fr; }
    .quiz-settings-inline { grid-template-columns: 1fr; }
    .quiz-settings-cover__row { grid-template-columns: 1fr; }
    .quiz-settings-summary { grid-template-columns: 1fr; }
    .quiz-workspace-footer,
    .quiz-workspace-footer--sticky {
        flex-direction: column; align-items: stretch;
    }
    .quiz-wizard-footer-actions { width: 100%; }
    .quiz-wizard-footer-actions .btn { flex: 1; }
}

.quiz-edit-options { margin: 0.5rem 0 0.75rem; padding-left: 1.25rem; }
.quiz-grade-form { background: var(--bg); padding: 0.85rem; border-radius: var(--radius); }
.quiz-essay-answer { background: var(--bg); padding: 0.85rem; border-radius: var(--radius); margin: 0.5rem 0; }
.quiz-payload-preview { font-size: 0.75rem; background: var(--bg); padding: 0.5rem; border-radius: var(--radius); overflow-x: auto; }
.quiz-type-fields { margin-top: 0.75rem; }
.quiz-builder-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.35rem; flex-wrap: wrap; }
.quiz-builder-head label { margin: 0; font-weight: 700; }
.quiz-builder-help { margin: 0 0 0.75rem; font-size: 0.8125rem; }
.quiz-mcq-list { display: flex; flex-direction: column; gap: 0.45rem; }
.quiz-mcq-choice { display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem; align-items: center; }
.quiz-mcq-correct { display: inline-flex; align-items: center; margin: 0; cursor: pointer; }
.quiz-mcq-correct input { width: 1rem; height: 1rem; accent-color: var(--primary); }
.quiz-remove-row { min-width: 2rem; padding-inline: 0.5rem; line-height: 1; }
.quiz-matching-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.quiz-matching-table { width: 100%; border-collapse: collapse; }
.quiz-matching-table th, .quiz-matching-table td { padding: 0.55rem 0.65rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.quiz-matching-table th { background: var(--bg); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); text-align: left; }
.quiz-matching-table tr:last-child td { border-bottom: 0; }
.quiz-matching-table td:last-child { width: 3rem; text-align: center; }
.quiz-fib-toolbar { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.quiz-fib-builder {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.85rem;
    min-height: 5rem;
    line-height: 1.5;
    font-size: 1rem;
    border: 1px solid #ccd8e3;
    border-radius: var(--radius-lg);
    background: #f4f7fa;
    cursor: text;
}
.quiz-fib-builder:focus { outline: 2px solid var(--primary-light); outline-offset: 2px; }
.quiz-fib-segment {
    display: inline-flex;
    align-items: baseline;
    vertical-align: baseline;
    max-width: 100%;
}
.quiz-fib-segment--text {
    display: block;
    width: 100%;
}
.quiz-fib-text {
    display: block;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    min-height: 2.65rem;
    padding: 0.65rem 0.75rem;
    margin: 0;
    resize: none;
    overflow: hidden;
    border: 1px solid #d8e1e9;
    border-radius: 0.55rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(28, 51, 73, 0.04);
    line-height: 1.5;
}
.quiz-fib-text:focus {
    outline: none;
    border-bottom-color: var(--primary);
    background: rgba(15, 108, 191, 0.04);
}
.quiz-fib-segment--blank {
    display: inline-flex;
    align-items: baseline;
    gap: 0.15rem;
    align-self: flex-start;
    margin: 0;
    padding: 0.25rem 0;
    border: none;
    background: transparent;
    vertical-align: baseline;
}
.quiz-fib-blank-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    vertical-align: baseline;
}
.quiz-fib-answer {
    display: inline-block;
    width: auto;
    min-width: 5ch;
    max-width: min(100%, 36rem);
    padding: 0.4rem 0.55rem;
    box-sizing: border-box;
    margin: 0;
    border: 2px solid var(--primary);
    border-radius: 0.35rem;
    background: rgba(15, 108, 191, 0.08);
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.4;
    vertical-align: baseline;
    box-shadow: 0 1px 0 rgba(15, 108, 191, 0.12);
}
.quiz-fib-answer::placeholder { color: rgba(15, 108, 191, 0.45); font-weight: 500; }
.quiz-fib-answer:focus {
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 3px var(--primary-light);
}
.quiz-fib-segment .quiz-remove-row {
    opacity: 0.35;
    min-width: 1.35rem;
    padding: 0 0.2rem;
    font-size: 0.85rem;
    line-height: 1;
    vertical-align: baseline;
}
.quiz-fib-segment--blank .quiz-remove-row { margin-left: 0.1rem; }
.quiz-fib-scoring-mode { margin-top: 0.85rem; }
.quiz-fib-scoring-mode small { display: block; margin-top: 0.35rem; }
.quiz-fib-segment:hover .quiz-remove-row,
.quiz-fib-segment:focus-within .quiz-remove-row { opacity: 1; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.quiz-settings-panel { margin-bottom: 1.25rem; }
@media (max-width: 640px) {
    .quiz-matching-row { grid-template-columns: 1fr; }
    .quiz-matching-board { grid-template-columns: 1fr; gap: 0.75rem; }
    .quiz-matching-col--left,
    .quiz-matching-col--right { grid-column: 1; }
    .quiz-matching-lines { display: none; }
}

/* Messenger */
.messenger-page { margin-top: -0.5rem; }
.page-content--messenger {
    max-width: none;
}
.messenger-layout {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    min-height: calc(100vh - 9rem);
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}
.messenger-inbox {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--surface);
    min-height: 0;
}
.messenger-inbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.95rem 1rem 0.65rem;
}
.messenger-inbox-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}
.messenger-icon-btn {
    width: 2.35rem;
    height: 2.35rem;
    border: none;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: var(--text);
    cursor: pointer;
    font-size: 0.95rem;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.messenger-icon-btn:hover {
    background: #e2e8f0;
}
.messenger-icon-btn--primary {
    background: var(--primary);
    color: #fff;
}
.messenger-icon-btn--primary:hover {
    filter: brightness(1.05);
    background: var(--primary);
    color: #fff;
}
.messenger-inbox-search {
    position: relative;
    padding: 0 1rem 0.75rem;
}
.messenger-inbox-search i {
    position: absolute;
    left: 1.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}
.messenger-inbox-search input {
    width: 100%;
    padding: 0.6rem 0.85rem 0.6rem 2.15rem;
    border: none;
    border-radius: 999px;
    background: #f1f5f9;
    font: inherit;
    font-size: 0.9rem;
}
.messenger-inbox-search input:focus {
    outline: 2px solid rgba(15, 108, 191, 0.25);
    outline-offset: 1px;
    background: #fff;
}
.messenger-inbox-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.4rem 0.85rem;
    -webkit-overflow-scrolling: touch;
}
.messenger-inbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.7rem 0.75rem;
    border: none;
    border-radius: 0.85rem;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}
.messenger-inbox-item:hover,
.messenger-inbox-item.is-active {
    background: rgba(15, 108, 191, 0.08);
}
.messenger-inbox-item.has-unread .messenger-inbox-name {
    font-weight: 800;
}
.messenger-inbox-item.has-unread .messenger-inbox-preview {
    color: var(--text);
    font-weight: 600;
}
.messenger-inbox-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.messenger-inbox-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}
.messenger-inbox-name {
    font-size: 0.95rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.messenger-inbox-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.messenger-inbox-item.has-unread .messenger-inbox-time {
    color: var(--primary);
    font-weight: 700;
}
.messenger-inbox-preview {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.messenger-inbox-badge {
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.messenger-inbox-empty,
.messenger-loading,
.messenger-error {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.messenger-error { color: var(--danger, #c0392b); }
.messenger-inbox-skeleton {
    display: flex;
    flex-direction: column;
    padding: 0.1rem 0.25rem;
}
.messenger-inbox-skel {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.78rem 0.7rem;
}
.messenger-inbox-skel__avatar,
.messenger-inbox-skel__line {
    background: linear-gradient(90deg, #e8edf3 0%, #f5f8fc 40%, #e8edf3 80%);
    background-size: 200% 100%;
    animation: messenger-skel-shimmer 1.15s ease-in-out infinite;
}
.messenger-inbox-skel__avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    flex-shrink: 0;
}
.messenger-inbox-skel__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.messenger-inbox-skel__line {
    display: block;
    height: 0.65rem;
    border-radius: 999px;
}
.messenger-inbox-skel__line--name { width: 42%; }
.messenger-inbox-skel__line--preview { width: 72%; height: 0.55rem; }
.messenger-inbox-skel:nth-child(2) .messenger-inbox-skel__line--name { width: 36%; }
.messenger-inbox-skel:nth-child(2) .messenger-inbox-skel__line--preview { width: 64%; }
.messenger-inbox-skel:nth-child(3) .messenger-inbox-skel__line--name { width: 50%; }
.messenger-inbox-skel:nth-child(3) .messenger-inbox-skel__line--preview { width: 55%; }
.messenger-inbox-skel:nth-child(4) .messenger-inbox-skel__line--name { width: 30%; }
.messenger-inbox-skel:nth-child(4) .messenger-inbox-skel__line--preview { width: 80%; }
.messenger-inbox-skel:nth-child(5) .messenger-inbox-skel__line--name { width: 46%; }
.messenger-inbox-skel:nth-child(5) .messenger-inbox-skel__line--preview { width: 60%; }
.messenger-inbox-skel:nth-child(6) .messenger-inbox-skel__line--name { width: 38%; }
.messenger-inbox-skel:nth-child(6) .messenger-inbox-skel__line--preview { width: 70%; }
@keyframes messenger-skel-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}
.messenger-thread {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    flex: 1;
    background:
        linear-gradient(180deg, #f4f7fb 0%, #eef3f8 100%);
    overflow: hidden;
}
.messenger-thread-empty,
.messenger-thread-active {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.messenger-thread-empty[hidden],
.messenger-thread-active[hidden] {
    display: none !important;
}
.messenger-thread-empty {
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    color: var(--text-muted);
    padding: 2rem 1.5rem;
    text-align: center;
}
.messenger-thread-empty-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--primary);
    font-size: 1.35rem;
    margin-bottom: 0.35rem;
}
.messenger-thread-empty h2,
.messenger-thread-empty h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
}
.messenger-thread-empty p {
    margin: 0 0 0.65rem;
    max-width: 16rem;
    line-height: 1.4;
}
.messenger-thread-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
}
.messenger-back-btn {
    display: none;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.messenger-back-btn:hover {
    background: rgba(15, 108, 191, 0.1);
}
.messenger-thread-peer {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
    flex: 1;
}
.messenger-thread-peer-meta {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
}
.messenger-thread-peer-meta strong {
    font-size: 0.98rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.messenger-thread-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.messenger-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 0.9rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    -webkit-overflow-scrolling: touch;
}
.messenger-msg {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    max-width: min(85%, 560px);
}
.messenger-msg.is-mine {
    align-self: flex-end;
    flex-direction: row;
}
.messenger-msg.is-theirs {
    align-self: flex-start;
    flex-direction: row;
}
.messenger-msg-avatar {
    width: 2rem;
    height: 2rem;
    margin-top: 0.2rem;
    border-radius: 999px;
    object-fit: cover;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 108, 191, 0.12);
    color: var(--primary);
    font-size: 0.68rem;
    font-weight: 700;
}
.messenger-bubble {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    position: relative;
}
.messenger-msg-actions {
    display: none;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 0.2rem;
}
.messenger-msg.is-mine:hover .messenger-msg-actions,
.messenger-msg.is-mine:focus-within .messenger-msg-actions,
.messenger-msg.is-theirs:hover .messenger-msg-actions,
.messenger-msg.is-theirs:focus-within .messenger-msg-actions {
    display: flex;
}
.messenger-msg-actions.is-theirs-actions {
    justify-content: flex-start;
}
.messenger-msg.is-highlighted {
    animation: messenger-msg-highlight 1.4s ease;
}
@keyframes messenger-msg-highlight {
    0%, 100% { background: transparent; }
    20%, 60% { background: rgba(15, 108, 191, 0.1); border-radius: 0.75rem; }
}
.messenger-msg-action {
    width: 1.65rem;
    height: 1.65rem;
    border: none;
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
    transition: background 0.15s ease, color 0.15s ease;
}
.messenger-msg-action:hover {
    background: rgba(15, 108, 191, 0.1);
    color: var(--primary);
}
.messenger-msg-action[data-action="unsend"]:hover {
    background: rgba(231, 76, 60, 0.12);
    color: var(--danger, #c0392b);
}
.messenger-bubble-edited {
    font-style: italic;
    border: none;
    background: none;
    padding: 0;
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    font-size: inherit;
    text-decoration: underline;
    text-underline-offset: 0.12em;
}
.messenger-bubble-edited:hover {
    color: var(--primary);
}
.messenger-history-popover {
    position: fixed;
    z-index: 1300;
    width: min(280px, calc(100vw - 24px));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}
.messenger-history-popover[hidden] {
    display: none !important;
}
.messenger-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--border);
}
.messenger-history-header h4 {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
}
.messenger-history-body {
    max-height: 240px;
    overflow-y: auto;
    padding: 0.75rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.messenger-history-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.messenger-history-item.is-current {
    padding-top: 0.55rem;
    border-top: 1px solid var(--border);
}
.messenger-history-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.messenger-history-text {
    font-size: 0.875rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
}
.messenger-history-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.messenger-history-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}
.messenger-history-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.65rem 0.85rem 0.75rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
}
.messenger-history-actions .btn {
    font-size: 0.78rem;
}
.messenger-history-delete:hover {
    color: var(--danger, #c0392b);
}
.messenger-bubble-body.is-unsent {
    background: var(--bg) !important;
    border: 1px dashed var(--border) !important;
    color: var(--text-muted) !important;
    font-style: italic;
}
.messenger-msg.is-unsent .messenger-bubble.is-mine .messenger-bubble-body {
    border-bottom-right-radius: 0.25rem;
}
.messenger-reply-quote {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    width: 100%;
    margin-bottom: 0.15rem;
    padding: 0.45rem 0.6rem;
    border: none;
    border-left: 3px solid var(--primary);
    border-radius: 0.55rem;
    background: rgba(15, 108, 191, 0.08);
    text-align: left;
    cursor: pointer;
}
.messenger-bubble.is-mine .messenger-reply-quote {
    background: rgba(255, 255, 255, 0.16);
    border-left-color: rgba(255, 255, 255, 0.85);
}
.messenger-reply-quote-name {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
}
.messenger-bubble.is-mine .messenger-reply-quote-name {
    color: rgba(255, 255, 255, 0.95);
}
.messenger-reply-quote-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.messenger-bubble.is-mine .messenger-reply-quote-text {
    color: rgba(255, 255, 255, 0.82);
}
.messenger-reply-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    background: rgba(15, 108, 191, 0.08);
    border-top: 1px solid var(--border);
}
.messenger-reply-banner[hidden] {
    display: none !important;
}
.messenger-reply-banner-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.messenger-reply-banner-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
}
.messenger-reply-banner-label i {
    margin-right: 0.3rem;
}
.messenger-reply-banner-preview {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.messenger-reply-banner-preview strong {
    color: var(--text);
    font-size: 0.78rem;
}
.messenger-reply-banner-preview span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.messenger-edit-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    background: rgba(15, 108, 191, 0.08);
    border-top: 1px solid var(--border);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
}
.messenger-edit-banner[hidden] {
    display: none !important;
}
.messenger-edit-banner i {
    margin-right: 0.35rem;
}
.messenger-bubble.is-mine {
    align-items: flex-end;
}
.messenger-bubble.is-theirs {
    align-items: flex-start;
}
.messenger-bubble-body {
    padding: 0.65rem 0.85rem;
    border-radius: 1rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.9375rem;
}
.messenger-bubble.is-mine .messenger-bubble-body {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}
.messenger-bubble.is-theirs .messenger-bubble-body {
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom-left-radius: 0.25rem;
}
.messenger-bubble-time {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.messenger-composer {
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
}
.messenger-composer textarea {
    flex: 1;
    min-height: 2.6rem;
    max-height: 7.5rem;
    resize: none;
    padding: 0.7rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    background: #f1f5f9;
    font: inherit;
    font-size: 0.9375rem;
    line-height: 1.35;
}
.messenger-composer textarea:focus {
    outline: none;
    border-color: rgba(15, 108, 191, 0.35);
    background: #fff;
}
.messenger-send-btn {
    width: 2.6rem;
    height: 2.6rem;
    min-width: 2.6rem;
    padding: 0;
    border: none;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(15, 108, 191, 0.28);
}
.messenger-send-btn:hover {
    filter: brightness(1.05);
}
.messenger-avatar,
.messenger-thread-avatar {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 999px;
    object-fit: cover;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 108, 191, 0.12);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
}
.messenger-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.messenger-modal[hidden] { display: none !important; }
.messenger-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}
.messenger-modal-panel {
    position: relative;
    width: min(100%, 420px);
    z-index: 1;
    padding: 0;
    overflow: hidden;
}
.messenger-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid var(--border);
}
.messenger-modal-header h3 { margin: 0; font-size: 1rem; }
.messenger-modal-body { padding: 1rem; }
.messenger-user-search-wrap {
    position: relative;
    margin-top: 0.35rem;
}
.messenger-user-search-wrap i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.messenger-user-search-wrap input {
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
}
.messenger-user-results {
    margin-top: 0.75rem;
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.messenger-user-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.65rem 0.5rem;
    border: none;
    border-radius: 0.65rem;
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.messenger-user-item:hover { background: rgba(15, 108, 191, 0.08); }
.messenger-user-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}
.messenger-user-meta strong {
    font-size: 0.92rem;
}
.messenger-user-meta span {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.messenger-user-empty {
    padding: 1rem 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}
.navbar-messages { position: relative; }
.navbar-msg-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 999px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s ease;
}
.navbar-msg-btn:hover {
    background: rgba(15, 108, 191, 0.08);
    color: var(--primary);
}
.navbar-msg-badge {
    position: absolute;
    top: 0.1rem;
    right: 0.05rem;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: #e74c3c;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
}
.navbar-msg-badge[hidden] { display: none !important; }
@media (max-width: 900px) {
    .moodle-main:has(.page-content--messenger) {
        padding: 0;
    }
    .page-content--messenger {
        margin: 0;
        max-width: none;
    }
    .messenger-page {
        margin: 0;
    }
    .messenger-layout {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        min-height: calc(100dvh - var(--navbar-height));
        height: calc(100dvh - var(--navbar-height));
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: var(--surface);
    }
    .messenger-inbox,
    .messenger-thread {
        grid-area: 1 / 1;
        max-height: none;
        height: 100%;
        min-height: 0;
        border: none;
    }
    .messenger-thread {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        z-index: 1;
        transform: translateX(8%);
        transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    }
    .messenger-page.is-thread-open .messenger-inbox {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
    .messenger-page.is-thread-open .messenger-thread {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        z-index: 2;
        transform: none;
    }
    .messenger-inbox-header {
        padding: 0.75rem 1rem 0.5rem;
    }
    .messenger-inbox-title {
        font-size: 1.5rem;
    }
    .messenger-inbox-search {
        padding: 0 1rem 0.65rem;
    }
    .messenger-inbox-list {
        padding: 0 0.35rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
    }
    .messenger-inbox-item {
        padding: 0.8rem 0.7rem;
        border-radius: 0;
        border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    }
    .messenger-inbox-item:hover,
    .messenger-inbox-item.is-active {
        background: transparent;
    }
    .messenger-inbox-item:active {
        background: rgba(15, 108, 191, 0.06);
    }
    .messenger-back-btn {
        display: inline-flex;
    }
    .messenger-thread-header {
        padding: 0.55rem 0.55rem 0.55rem 0.25rem;
        position: sticky;
        top: 0;
        z-index: 3;
    }
    .messenger-messages {
        padding: 0.85rem 0.75rem 0.5rem;
    }
    .messenger-msg {
        max-width: 88%;
    }
    .messenger-msg-avatar {
        display: none;
    }
    .messenger-msg-actions {
        display: flex;
        opacity: 0.7;
    }
    .messenger-composer {
        padding: 0.55rem 0.65rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
    }
    .messenger-modal {
        align-items: flex-end;
        padding: 0;
    }
    .messenger-modal-panel {
        width: 100%;
        max-width: none;
        border-radius: 1rem 1rem 0 0;
        max-height: min(88vh, 640px);
        overflow: auto;
    }
}

@media (min-width: 901px) {
    .messenger-back-btn { display: none !important; }
}

/* Virtual Library */
.library-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    margin-bottom: 1.1rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.library-tab {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 1rem;
    border-radius: 9px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
}
.library-tab:hover { color: var(--text); text-decoration: none; }
.library-tab.is-active {
    background: var(--surface);
    border-color: var(--border);
    color: var(--primary);
    box-shadow: var(--shadow);
}
.library-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 1.25rem;
}
.library-filter {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 10rem;
}
.library-filter span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}
.library-filter .fa-magnifying-glass {
    position: absolute;
    margin: 2.1rem 0 0 0.75rem;
    color: var(--text-muted);
    pointer-events: none;
}
.library-filter:first-child {
    position: relative;
    flex: 1 1 14rem;
}
.library-filter:first-child input {
    padding-left: 2rem;
}

/* Virtual Library — hero, shelves, kind pills */
.library-hero {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0 0 0.7rem;
    margin-bottom: 0.55rem;
    border: none;
    background: transparent;
    box-shadow: none;
}
.library-hero-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}
.library-hero-icon {
    width: 2.55rem;
    height: 2.55rem;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: linear-gradient(145deg, #e6f4f4 0%, #fff 70%);
    border: 1px solid rgba(13, 110, 110, 0.18);
    color: #0d6e6e;
    font-size: 1rem;
}
.library-hero-copy {
    min-width: 0;
}
.library-hero-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text);
}
.library-hero-sub {
    margin: 0.2rem 0 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.35;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.library-hero-sub strong {
    color: var(--text);
    font-weight: 700;
}
.library-hero-active {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.library-toolbar.resources-toolbar--enhanced {
    gap: 0.55rem;
    padding: 0.65rem 0.7rem;
    margin-bottom: 0.9rem;
    box-shadow: none;
    border-radius: 0.9rem;
}
.library-toolbar-form {
    margin: 0;
}
.library-toolbar-top {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.library-toolbar-top .resources-search {
    flex: 1 1 auto;
    min-width: 0;
}
.library-toolbar .resources-search-input {
    border-radius: 999px;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    background: var(--surface-2);
}
.library-filter-menu {
    position: relative;
    flex-shrink: 0;
}
.library-filter-btn {
    list-style: none;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
}
.library-filter-btn::-webkit-details-marker { display: none; }
.library-filter-btn:hover,
.library-filter-menu[open] .library-filter-btn,
.library-filter-btn.is-active {
    color: #0d6e6e;
    border-color: rgba(13, 110, 110, 0.35);
    background: rgba(13, 110, 110, 0.08);
}
.library-filter-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.4rem);
    z-index: 20;
    width: min(18rem, calc(100vw - 2.5rem));
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.library-filter-panel .resources-chip {
    width: 100%;
}
.library-filter-panel .resources-chip-select {
    width: 100%;
}
.library-filter-clear {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    flex-shrink: 0;
}
.library-filter-clear:hover {
    color: #c0392b;
    border-color: rgba(192, 57, 43, 0.3);
    background: #fef2f2;
}
.library-kind-pills {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0.05rem 0.05rem 0.15rem;
}
.library-kind-pills::-webkit-scrollbar { display: none; }
.library-kind-pill {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0.3rem 0.65rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.library-kind-pill:hover {
    color: #0d6e6e;
    text-decoration: none;
}
.library-kind-pill.is-active {
    background: #0d6e6e;
    color: #fff;
}
.library-shelf { margin-bottom: 1.75rem; }
.library-shelf-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}
.library-shelf-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}
.library-shelf-header p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.library-grid--books {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 0.85rem;
}
.library-grid--compact {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
}
.library-card-title {
    font-family: Georgia, 'Times New Roman', serif;
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.library-card {
    --lib-tone: 15, 108, 191;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.library-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(var(--lib-tone), 0.45);
}
.library-card--indigo { --lib-tone: 79, 70, 229; }
.library-card--emerald { --lib-tone: 5, 150, 105; }
.library-card--sky { --lib-tone: 2, 132, 199; }
.library-card--amber { --lib-tone: 217, 119, 6; }
.library-card--violet { --lib-tone: 124, 58, 237; }
.library-card--slate { --lib-tone: 71, 85, 105; }

.library-card-cover {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 96px;
    text-decoration: none;
    overflow: hidden;
    background:
        radial-gradient(120% 120% at 0% 0%, rgba(var(--lib-tone), 0.18), transparent 60%),
        linear-gradient(135deg, rgba(var(--lib-tone), 0.14), rgba(var(--lib-tone), 0.05));
    border-bottom: 1px solid rgba(var(--lib-tone), 0.18);
}
.library-card-cover-mount {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    pointer-events: none;
}
.library-card-cover.has-cover {
    background: #fffef9;
}
.library-card-cover.has-cover .library-card-cover-icon {
    display: none;
}
.library-book-cover-frame {
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.library-book-cover-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    height: 400px;
    padding: 1rem 1.15rem 2rem;
    background: #fffef9;
    background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.03) 0%, transparent 12%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    font-size: 0.84rem;
    line-height: 1.55;
    color: #1a1a1a;
    overflow: hidden;
    transform-origin: top left;
    pointer-events: none;
}
.library-book-cover-page h1 {
    font-size: 1.35rem;
    margin: 0 0 0.65rem;
}
.library-book-cover-page h2 {
    font-size: 1.1rem;
    margin: 0.85rem 0 0.45rem;
}
.library-book-cover-page h3 {
    font-size: 0.98rem;
    margin: 0.65rem 0 0.35rem;
}
.library-book-cover-page p,
.library-book-cover-page ul,
.library-book-cover-page ol {
    margin: 0 0 0.55rem;
}
.library-book-cover-page img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0.5rem auto;
}
.library-book-cover-canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.library-card-cover-icon {
    display: grid;
    place-items: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.9rem;
    background: var(--surface);
    color: rgb(var(--lib-tone));
    font-size: 1.4rem;
    box-shadow: 0 4px 12px rgba(var(--lib-tone), 0.22);
    transition: transform 0.18s ease;
}
.library-card:hover .library-card-cover-icon { transform: scale(1.06); }
.library-card-cover-badges {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.3rem;
}
.library-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.9rem 1rem 0.4rem;
}
.library-card-body h3 {
    margin: 0.1rem 0 0;
    font-size: 1.02rem;
    line-height: 1.3;
}
.library-card-body h3 a {
    color: inherit;
    text-decoration: none;
}
.library-card-body h3 a:hover { color: rgb(var(--lib-tone)); }
.library-card-body p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.45;
}
.library-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.library-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(var(--lib-tone), 0.1);
    color: rgb(var(--lib-tone));
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.library-tag--muted {
    background: var(--surface-muted);
    color: var(--text-muted);
}
.library-tag--audience {
    background: rgba(230, 126, 34, 0.14);
    color: #c0651a;
}
.library-tag--pending { background: rgba(241, 196, 15, 0.18); color: #9a7b0a; }
.library-tag--published { background: rgba(39, 174, 96, 0.15); color: #1e8449; }
.library-tag--rejected { background: rgba(231, 76, 60, 0.15); color: #c0392b; }
.library-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.85rem;
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}
.library-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.library-card-meta span i { color: rgba(var(--lib-tone), 0.7); }
.library-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
    padding: 0.75rem 1rem 0.9rem;
    border-top: 1px solid var(--border);
}
.library-card-actions .btn { flex: 1 1 auto; justify-content: center; gap: 0.35rem; }
.library-card-actions--admin {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.library-card-actions--admin > .btn {
    flex: 0 1 auto;
}
.library-card-manage {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
}
.library-card-manage form {
    display: inline-flex;
    margin: 0;
}
.library-card-manage .btn {
    flex: 0 0 auto;
    min-width: 2rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Admin Virtual Library workspace */
.library-admin-workspace {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.library-admin-workspace .library-tabs {
    margin-bottom: 0;
}
.library-admin-workspace .resources-toolbar {
    margin-bottom: 0;
}
.library-admin-scroll {
    max-height: min(72vh, calc(100vh - 14rem));
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 0.9rem 1rem 1rem;
}
.library-admin-catalog .library-shelf:last-child {
    margin-bottom: 0;
}
.library-admin-catalog .library-shelf-header {
    position: sticky;
    top: 0;
    z-index: 3;
    margin: -0.15rem 0 0.75rem;
    padding: 0.45rem 0 0.65rem;
    background: var(--surface);
    box-shadow: 0 1px 0 var(--border);
}
.library-card--admin.library-card--book-cover {
    grid-template-columns: 104px minmax(0, 1fr);
}
.library-card--admin.library-card--book-cover .library-card-cover {
    width: 104px;
    border-right-width: 5px;
}
.library-card--admin.library-card--book-cover .library-card-body {
    padding: 0.7rem 0.85rem 0.35rem;
}
.library-card--admin.library-card--book-cover .library-card-actions {
    padding: 0 0.85rem 0.7rem;
}
.library-card--admin.library-card--book-cover .library-card-title {
    font-size: 0.98rem;
}
.library-card--admin.library-card--book-cover .library-card-body p {
    -webkit-line-clamp: 2;
}
.library-card--admin .library-card-meta {
    gap: 0.35rem 0.65rem;
    font-size: 0.72rem;
}
.library-card--admin:hover {
    transform: translateY(-1px);
}

/* Book shelf: cover left, details right */
.library-card--book-cover {
    display: grid;
    grid-template-columns: 148px minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    align-items: center;
    min-height: 0;
}
.library-card--book-cover .library-card-cover {
    grid-column: 1;
    grid-row: 1 / -1;
    width: 148px;
    aspect-ratio: 2 / 3;
    height: auto;
    align-self: center;
    min-height: 0;
    border-bottom: none;
    background: linear-gradient(145deg, rgba(var(--lib-tone), 0.22) 0%, rgba(var(--lib-tone), 0.08) 50%, #fffef9 100%);
    border-right: 8px solid rgba(var(--lib-tone), 0.4);
    box-shadow: inset -10px 0 20px rgba(0, 0, 0, 0.07);
}
.library-card--book-cover .library-card-body {
    grid-column: 2;
    grid-row: 1;
    padding: 1rem 1.15rem 0.5rem;
}
.library-card--book-cover .library-card-actions {
    grid-column: 2;
    grid-row: 2;
    margin-top: 0;
    padding: 0 1rem 1rem;
    border-top: none;
    justify-content: flex-start;
}
.library-card--book-cover .library-card-actions .btn {
    flex: 0 1 auto;
}
.library-card--book-cover .library-card-cover-icon {
    width: 3.25rem;
    height: 3.25rem;
    font-size: 1.5rem;
}
.library-card--book-cover .library-card-title {
    font-size: 1.12rem;
}
.library-card--book-cover .library-card-body p {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 768px) {
    .library-hero-title {
        font-size: 1.15rem;
    }
    .library-hero-icon {
        width: 2.35rem;
        height: 2.35rem;
        font-size: 0.9rem;
    }
    .library-toolbar.resources-toolbar--enhanced {
        padding: 0.55rem 0.6rem;
    }
    .library-grid--books {
        grid-template-columns: 1fr;
    }
    .library-admin-scroll {
        max-height: min(68vh, calc(100vh - 11rem));
        padding: 0.75rem;
    }
    .library-card--book-cover,
    .library-card--admin.library-card--book-cover {
        grid-template-columns: 96px minmax(0, 1fr);
    }
    .library-card--book-cover .library-card-cover,
    .library-card--admin.library-card--book-cover .library-card-cover {
        width: 96px;
    }
    .library-card--book-cover .library-card-body {
        padding: 0.85rem 0.9rem 0.4rem;
    }
    .library-card--book-cover .library-card-actions {
        padding: 0 0.9rem 0.85rem;
    }
    .library-card--book-cover .library-card-body p {
        -webkit-line-clamp: 2;
    }
    .library-card-actions--admin {
        flex-wrap: wrap;
    }
}
.library-pending-list {
    display: grid;
    gap: 1rem;
}
.library-pending-card {
    display: grid;
    grid-template-columns: 1fr minmax(220px, 280px);
    gap: 1rem;
    align-items: start;
}
.library-pending-actions {
    display: grid;
    gap: 0.75rem;
}
.library-reject-form textarea {
    margin-bottom: 0.5rem;
}
.library-view-card .library-view-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.library-view-desc {
    margin-top: 0.5rem;
    color: var(--text-muted);
}
.library-chip { background: rgba(15, 108, 191, 0.08); color: var(--primary); }
.library-chip--pending { background: rgba(241, 196, 15, 0.15); color: #9a7b0a; }
.library-chip--published { background: rgba(39, 174, 96, 0.12); color: #1e8449; }
.library-chip--rejected { background: rgba(231, 76, 60, 0.12); color: #c0392b; }
.course-builder-btn--library {
    border-color: rgba(15, 108, 191, 0.25);
}
.library-attach-dialog,
.library-share-dialog {
    border: none;
    border-radius: var(--radius-lg);
    padding: 0;
    max-width: 32rem;
    width: calc(100% - 2rem);
    box-shadow: var(--shadow-lg);
}
.library-attach-dialog::backdrop,
.library-share-dialog::backdrop {
    background: rgba(15, 23, 42, 0.45);
}
.library-attach-form,
.library-share-form {
    padding: 1.25rem;
}
.library-attach-header,
.library-share-header {
    position: relative;
    margin-bottom: 1rem;
}
.library-attach-header h2,
.library-share-header h2 {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
}
.library-attach-close,
.library-share-close {
    position: absolute;
    top: 0;
    right: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
}
@media (max-width: 768px) {
    .library-pending-card {
        grid-template-columns: 1fr;
    }
}

/* Resources hub */
.resources-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 1.25rem;
}
.resources-toolbar-create {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.resources-create-form { display: inline; }
.resources-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
}

/* Full-screen resource editors — chrome stays put; only the canvas scrolls */
.editor-shell-active {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}
.editor-shell-active .moodle-app {
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
}
.editor-shell-active .moodle-navbar {
    position: relative;
    z-index: 20;
    flex-shrink: 0;
}
.editor-shell-layout {
    margin-top: 0;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow: hidden;
}
.editor-shell-main {
    padding: 0 !important;
    max-width: none !important;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}
.editor-shell-main .page-content {
    padding: 0;
    max-width: none;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.editor-shell-main .toast-container {
    position: fixed;
    top: 4.25rem;
    right: 1rem;
    z-index: 200;
    width: auto;
    max-width: 360px;
    margin: 0;
}
.editor-shell-main .toast-container:empty { display: none; }
.resource-editor-shell {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    background: #0f172a;
}
.deck-editor-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 1rem;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    color: #f8fafc;
}
.deck-editor-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}
.deck-title-input {
    flex: 1;
    min-width: 8rem;
    max-width: 28rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid #475569;
    border-radius: var(--radius);
    background: #0f172a;
    color: #f8fafc;
    font-size: 0.95rem;
    font-weight: 600;
}
.deck-save-status {
    font-size: 0.75rem;
    color: #94a3b8;
    white-space: nowrap;
}
.deck-save-status.is-dirty { color: #fbbf24; }
.deck-save-status.is-saving { color: #60a5fa; }
.deck-save-status.is-saved { color: #34d399; }
.deck-save-status.is-error { color: #f87171; }
.deck-editor-layout {
    display: grid;
    grid-template-columns: 200px 1fr 260px;
    flex: 1;
    min-height: 0;
}
.deck-slide-rail {
    background: #1e293b;
    border-right: 1px solid #334155;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.deck-slide-rail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.75rem;
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.deck-slide-thumbs {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.deck-slide-thumb {
    position: relative;
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 0;
    background: #0f172a;
    cursor: pointer;
    text-align: left;
}
.deck-slide-thumb.is-active { border-color: #3b82f6; }
.deck-slide-thumb-canvas {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}
.deck-slide-thumb-num {
    display: block;
    padding: 0.2rem 0.35rem;
    font-size: 0.7rem;
    color: #94a3b8;
}
.deck-slide-thumb-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: none;
    gap: 2px;
}
.deck-slide-thumb:hover .deck-slide-thumb-actions { display: flex; }
.deck-slide-del, .deck-slide-dup {
    border: none;
    background: rgba(15, 23, 42, 0.75);
    color: #f8fafc;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.65rem;
}
.deck-canvas-area {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #0f172a;
}
.deck-toolbar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    flex-wrap: wrap;
}
.deck-tool-btn {
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
}
.deck-tool-btn:hover, .deck-tool-btn.active {
    background: #334155;
    border-color: #475569;
    color: #fff;
}
.deck-toolbar-sep {
    width: 1px;
    height: 1.5rem;
    background: #475569;
    margin: 0 0.25rem;
}
.deck-template-select {
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    border: 1px solid #475569;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 0.8rem;
}
.deck-shapes-menu {
    position: relative;
}
.deck-shapes-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, 2.1rem);
    gap: 0.25rem;
    padding: 0.5rem;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.deck-shape-btn {
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #0f172a;
    color: #cbd5e1;
    cursor: pointer;
}
.deck-shape-btn:hover {
    background: #334155;
    border-color: #475569;
    color: #fff;
}
.deck-text-edit {
    position: fixed;
    z-index: 10000;
    padding: 0.35rem 0.5rem;
    border: 2px solid #3b82f6;
    border-radius: 4px;
    background: #fff;
    resize: none;
    outline: none;
    line-height: 1.35;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.deck-canvas-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow: auto;
    min-height: 0;
}
#deckStageContainer {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}
.deck-properties {
    background: #1e293b;
    border-left: 1px solid #334155;
    padding: 0.75rem;
    overflow-y: auto;
    color: #e2e8f0;
}
.deck-properties h3 {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
}
.deck-props-section {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #334155;
}
.deck-props-section h4 {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    color: #cbd5e1;
}
.deck-props-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: #94a3b8;
}
.deck-props-section .form-control {
    width: 100%;
    margin-top: 0.2rem;
    background: #0f172a;
    border-color: #475569;
    color: #f8fafc;
}
.deck-layer-actions {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.5rem;
}
.deck-layers-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.deck-layers-list li {
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    font-size: 0.78rem;
    cursor: pointer;
    color: #cbd5e1;
}
.deck-layers-list li:hover { background: #334155; }
.deck-layers-list li.is-active {
    background: #2563eb;
    color: #fff;
}
.doc-editor-shell {
    --book-page-width: 760px;
    --book-page-height: 1075px; /* A4 at 760px: 760 × 297/210 */
    background: #e8ecf1;
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}
.doc-editor-shell.is-previewing .doc-editor-workspace {
    visibility: hidden;
}
.doc-editor-shell.is-previewing .deck-editor-topbar {
    visibility: hidden;
}

.book-editor-preview {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    flex-direction: column;
    background: #1e293b;
}
.book-editor-preview[hidden] {
    display: none !important;
}
.book-editor-preview__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-shrink: 0;
    padding: 0.55rem 0.85rem;
    background: #0f172a;
    border-bottom: 1px solid #334155;
    color: #f8fafc;
}
.book-editor-preview__title {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 0.95rem;
    font-weight: 650;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.book-editor-preview__nav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}
.book-editor-preview__page-label {
    min-width: 6.5rem;
    text-align: center;
    font-size: 0.78rem;
    color: #cbd5e1;
    font-variant-numeric: tabular-nums;
}
.book-editor-preview__stage {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem 1.5rem;
    overflow: auto;
    background:
        radial-gradient(ellipse at top, rgba(56, 189, 248, 0.08), transparent 45%),
        #1e293b;
}
/* Exact editor paper size (760 × 1075). Do not use width/height: 100%. */
.book-editor-preview__sheet,
.book-editor-preview__sheet.book-reader-page-sheet,
.book-editor-preview__sheet.book-reader-page-sheet--html {
    position: relative;
    box-sizing: border-box;
    width: 760px !important;
    height: 1075px !important;
    min-width: 760px !important;
    min-height: 1075px !important;
    max-width: 760px !important;
    max-height: 1075px !important;
    aspect-ratio: auto !important;
    flex: 0 0 auto !important;
    align-self: center;
    display: block !important;
    margin: 0;
    border-radius: 2px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.25),
        0 18px 40px rgba(0, 0, 0, 0.35);
    overflow: hidden !important;
    background: #fffef9;
    transform-origin: center center;
}
.book-editor-preview__sheet .book-reader-page-body {
    position: absolute !important;
    inset: 0 !important;
    isolation: isolate;
    box-sizing: border-box;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: none !important;
    overflow: hidden !important;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.0625rem;
    line-height: 1.5;
    color: #1e293b;
    padding: 2.5rem 2.75rem 3rem;
    background: #fffef9;
    background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.03) 0%, transparent 14px);
}
.book-editor-preview__sheet .book-reader-page-body img {
    width: auto !important;
    height: auto !important;
    max-width: 100%;
}
.book-editor-preview__sheet .book-reader-page-body img[data-wrap="free"],
.book-editor-preview__sheet .book-reader-page-body img[data-layer="behind"],
.book-editor-preview__sheet .book-reader-page-body img[style*="position: absolute"],
.book-editor-preview__sheet .book-reader-page-body img[style*="position:absolute"] {
    position: absolute !important;
    max-width: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
}
.book-editor-preview__sheet .book-reader-page-body img[data-layer="behind"] {
    z-index: -1;
    pointer-events: none;
}
.book-editor-preview__sheet .book-reader-page-body h1 { font-size: 1.85rem; line-height: 1.25; margin: 0 0 0.75rem; }
.book-editor-preview__sheet .book-reader-page-body h2 { font-size: 1.45rem; line-height: 1.3; margin: 1.5rem 0 0.6rem; }
.book-editor-preview__sheet .book-reader-page-body h3 { font-size: 1.2rem; line-height: 1.35; margin: 1.25rem 0 0.5rem; }
.book-editor-preview__sheet .book-reader-page-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0.65rem;
    z-index: 2;
}

@media (max-width: 768px) {
    .book-editor-preview__bar {
        flex-wrap: wrap;
        gap: 0.45rem;
    }
    .book-editor-preview__title {
        order: -1;
        flex: 1 1 100%;
        text-align: left;
        font-size: 0.875rem;
    }
    .book-editor-preview__sheet .book-reader-page-body {
        padding: 1.5rem 1.15rem 2rem;
        font-size: 1rem;
    }
}

.doc-editor-shell .deck-editor-topbar {
    flex-shrink: 0;
    z-index: 5;
}
.doc-editor-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
    background: #e8ecf1;
    overflow: hidden;
}
.doc-editor-workspace {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}
.doc-editor-meta {
    flex-shrink: 0;
    background: #f8fafc;
    border-bottom: 1px solid #dbe2ea;
}
.doc-editor-meta__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
    cursor: pointer;
    list-style: none;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
    user-select: none;
}
.doc-editor-meta__summary::-webkit-details-marker { display: none; }
.doc-editor-meta__summary > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}
.doc-editor-meta__hint {
    font-weight: 500;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}
.doc-editor-meta[open] .doc-editor-meta__summary {
    border-bottom: 1px solid #e2e8f0;
}
.doc-editor-meta__body {
    padding: 0.65rem 1rem 0.85rem;
}
.doc-editor-meta__input {
    max-width: 40rem;
}
.doc-editor-toolbar.ql-toolbar.ql-snow,
.doc-editor-toolbar {
    position: relative;
    z-index: 4;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem 0.35rem;
    padding: 0.4rem 0.75rem;
    background: #fff;
    border: none;
    border-bottom: 1px solid #dbe2ea;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
    flex-shrink: 0;
}
.doc-editor-toolbar .ql-formats {
    margin-right: 0.35rem;
    padding-right: 0.45rem;
    border-right: 1px solid #e2e8f0;
}
.doc-editor-toolbar .ql-formats:last-child {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
}
.doc-editor-toolbar.ql-snow .ql-picker {
    color: #334155;
}
.doc-editor-toolbar .ql-picker.ql-lineheight {
    width: 5.5rem;
}
.doc-editor-toolbar .ql-picker.ql-spaceafter,
.doc-editor-toolbar .ql-picker.ql-spacebefore {
    width: 7.5rem;
}
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-label::before,
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-item::before {
    content: 'Line';
}
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-label[data-value="1"]::before,
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-item[data-value="1"]::before { content: 'Single'; }
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-label[data-value="1.15"]::before,
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-item[data-value="1.15"]::before { content: '1.15'; }
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-label[data-value="1.5"]::before,
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-item[data-value="1.5"]::before { content: '1.5'; }
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-label[data-value="1.75"]::before,
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-item[data-value="1.75"]::before { content: '1.75'; }
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-label[data-value="2"]::before,
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-item[data-value="2"]::before { content: 'Double'; }
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-label[data-value="2.5"]::before,
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-item[data-value="2.5"]::before { content: '2.5'; }
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-label[data-value="3"]::before,
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-item[data-value="3"]::before { content: 'Triple'; }

.doc-editor-toolbar .ql-picker.ql-spaceafter .ql-picker-label::before,
.doc-editor-toolbar .ql-picker.ql-spaceafter .ql-picker-item::before { content: 'After'; }
.doc-editor-toolbar .ql-picker.ql-spaceafter .ql-picker-label[data-value="0"]::before,
.doc-editor-toolbar .ql-picker.ql-spaceafter .ql-picker-item[data-value="0"]::before { content: 'After: none'; }
.doc-editor-toolbar .ql-picker.ql-spaceafter .ql-picker-label[data-value="0.5em"]::before,
.doc-editor-toolbar .ql-picker.ql-spaceafter .ql-picker-item[data-value="0.5em"]::before { content: 'After: small'; }
.doc-editor-toolbar .ql-picker.ql-spaceafter .ql-picker-label[data-value="1em"]::before,
.doc-editor-toolbar .ql-picker.ql-spaceafter .ql-picker-item[data-value="1em"]::before { content: 'After: medium'; }
.doc-editor-toolbar .ql-picker.ql-spaceafter .ql-picker-label[data-value="1.5em"]::before,
.doc-editor-toolbar .ql-picker.ql-spaceafter .ql-picker-item[data-value="1.5em"]::before { content: 'After: large'; }
.doc-editor-toolbar .ql-picker.ql-spaceafter .ql-picker-label[data-value="2em"]::before,
.doc-editor-toolbar .ql-picker.ql-spaceafter .ql-picker-item[data-value="2em"]::before { content: 'After: extra'; }

.doc-editor-toolbar .ql-picker.ql-spacebefore .ql-picker-label::before,
.doc-editor-toolbar .ql-picker.ql-spacebefore .ql-picker-item::before { content: 'Before'; }
.doc-editor-toolbar .ql-picker.ql-spacebefore .ql-picker-label[data-value="0"]::before,
.doc-editor-toolbar .ql-picker.ql-spacebefore .ql-picker-item[data-value="0"]::before { content: 'Before: none'; }
.doc-editor-toolbar .ql-picker.ql-spacebefore .ql-picker-label[data-value="0.5em"]::before,
.doc-editor-toolbar .ql-picker.ql-spacebefore .ql-picker-item[data-value="0.5em"]::before { content: 'Before: small'; }
.doc-editor-toolbar .ql-picker.ql-spacebefore .ql-picker-label[data-value="1em"]::before,
.doc-editor-toolbar .ql-picker.ql-spacebefore .ql-picker-item[data-value="1em"]::before { content: 'Before: medium'; }
.doc-editor-toolbar .ql-picker.ql-spacebefore .ql-picker-label[data-value="1.5em"]::before,
.doc-editor-toolbar .ql-picker.ql-spacebefore .ql-picker-item[data-value="1.5em"]::before { content: 'Before: large'; }
.doc-editor-toolbar .ql-picker.ql-spacebefore .ql-picker-label[data-value="2em"]::before,
.doc-editor-toolbar .ql-picker.ql-spacebefore .ql-picker-item[data-value="2em"]::before { content: 'Before: extra'; }

.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-label::before,
.doc-editor-toolbar .ql-picker.ql-spaceafter .ql-picker-label::before,
.doc-editor-toolbar .ql-picker.ql-spacebefore .ql-picker-label::before,
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-item::before,
.doc-editor-toolbar .ql-picker.ql-spaceafter .ql-picker-item::before,
.doc-editor-toolbar .ql-picker.ql-spacebefore .ql-picker-item::before {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 650;
    line-height: 1.2;
}
.doc-editor-toolbar .ql-picker.ql-lineheight .ql-picker-options,
.doc-editor-toolbar .ql-picker.ql-spaceafter .ql-picker-options,
.doc-editor-toolbar .ql-picker.ql-spacebefore .ql-picker-options {
    width: 9.5rem;
}
.doc-editor-toolbar .ql-page-break,
.doc-editor-toolbar .ql-undo,
.doc-editor-toolbar .ql-redo {
    width: 1.75rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.doc-editor-toolbar .ql-page-break i,
.doc-editor-toolbar .ql-undo i,
.doc-editor-toolbar .ql-redo i {
    font-size: 0.8rem;
    color: #475569;
}
.doc-editor-main {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: #c5ccd6;
}
.doc-editor-pages {
    flex: 0 0 168px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #e8ecf1;
    border-right: 1px solid #b8c0cc;
}
.doc-editor-pages__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-shrink: 0;
    padding: 0.65rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
    border-bottom: 1px solid #d0d7e0;
}
.doc-editor-pages__head span {
    font-variant-numeric: tabular-nums;
    color: #94a3b8;
}
.doc-editor-pages__list {
    flex: 1;
    overflow: auto;
    padding: 0.75rem 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    -webkit-overflow-scrolling: touch;
}
.doc-editor-page-thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    color: inherit;
}
.doc-editor-page-thumb__sheet {
    position: relative;
    width: 100%;
    aspect-ratio: 210 / 297;
    max-height: 180px;
    padding: 0;
    overflow: hidden;
    background: #fffef9;
    border: 2px solid transparent;
    border-radius: 3px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.08),
        0 4px 12px rgba(15, 23, 42, 0.08);
}
.doc-editor-page-thumb__sheet::after { display: none; }
.doc-editor-page-thumb.is-active .doc-editor-page-thumb__sheet {
    border-color: #2563eb;
    box-shadow:
        0 0 0 1px #2563eb,
        0 4px 14px rgba(37, 99, 235, 0.2);
}
.doc-editor-page-thumb__preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 760px;
    height: 1075px;
    min-height: 1075px;
    padding: 2.5rem 2.75rem 3rem;
    box-sizing: border-box;
    transform-origin: top left;
    pointer-events: none;
    overflow: hidden;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.0625rem;
    line-height: 1.5;
    color: #1e293b;
    background: #fffef9;
}
.doc-editor-page-thumb__preview img {
    max-width: 100%;
    height: auto;
}
.doc-editor-page-thumb__preview .book-page-break { display: none; }
.doc-editor-page-thumb__empty {
    margin: 1.5rem 0 0;
    color: #94a3b8;
    font-style: italic;
    font-family: system-ui, sans-serif;
    font-size: 0.95rem;
}
.doc-editor-page-thumb__num {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}
.doc-editor-page-thumb.is-active .doc-editor-page-thumb__num {
    color: #2563eb;
}
.doc-editor-pages__add {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 0.5rem 0.65rem 0.75rem;
    padding: 0.55rem 0.65rem;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 650;
    cursor: pointer;
}
.doc-editor-pages__add:hover {
    border-color: #2563eb;
    color: #1d4ed8;
    background: #eff6ff;
}
.doc-editor-canvas-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 1.25rem 1rem 1.75rem;
    -webkit-overflow-scrolling: touch;
    background: #c5ccd6;
}
.doc-editor-paper {
    max-width: var(--book-page-width, 760px);
    width: 100%;
    margin: 0 auto;
    background: transparent;
    border-radius: 2px;
    box-shadow: none;
    min-height: 0;
    overflow-x: clip;
    overflow-y: visible;
}
.doc-editor-shell .material-quill-editor,
.doc-editor-shell .doc-resource-editor {
    min-height: 0;
    height: auto !important;
    border: none;
    border-radius: 0;
    background: transparent;
    overflow: visible !important;
}
.doc-editor-shell .ql-container.ql-snow {
    border: none;
    height: auto !important;
    overflow: visible !important;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.0625rem;
}
.doc-editor-shell .ql-editor {
    position: relative;
    isolation: isolate;
    min-height: var(--book-page-height, 1075px);
    height: auto !important;
    max-height: none !important;
    /* clip overhanging free/behind images without creating an inner scrollbar */
    overflow-x: clip;
    overflow-y: visible !important;
    padding: 2.5rem 2.75rem 3rem;
    line-height: 1.5;
    color: #1e293b;
    background: #fffef9;
    background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.03) 0%, transparent 14px);
    border-radius: 2px;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.08),
        0 10px 28px rgba(15, 23, 42, 0.12);
}
.doc-editor-shell .ql-editor.ql-blank::before {
    left: 2.75rem;
    right: 2.75rem;
    font-style: normal;
    color: #94a3b8;
}
.doc-editor-shell .ql-editor h1 {
    font-size: 1.85rem;
    line-height: 1.25;
    margin: 0 0 0.75rem;
    font-family: system-ui, -apple-system, Segoe UI, sans-serif;
}
.doc-editor-shell .ql-editor h2 {
    font-size: 1.45rem;
    line-height: 1.3;
    margin: 1.5rem 0 0.6rem;
    font-family: system-ui, -apple-system, Segoe UI, sans-serif;
}
.doc-editor-shell .ql-editor h3 {
    font-size: 1.2rem;
    line-height: 1.35;
    margin: 1.25rem 0 0.5rem;
    font-family: system-ui, -apple-system, Segoe UI, sans-serif;
}
.doc-editor-shell .ql-editor p { margin: 0 0 0.85rem; }
.doc-editor-shell .ql-editor blockquote {
    border-left: 3px solid #cbd5e1;
    margin: 0.75rem 0;
    padding: 0.25rem 0 0.25rem 1rem;
    color: #475569;
}
.doc-editor-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.45rem 1rem;
    background: #f8fafc;
    border-top: 1px solid #dbe2ea;
    font-size: 0.75rem;
    color: #64748b;
}
.doc-editor-footer__stats {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-variant-numeric: tabular-nums;
}
.doc-editor-footer__hint {
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Full pages: white fill to page height, thin gutter between sheets */
.doc-editor-shell .ql-editor .book-page-break,
.book-page-break {
    --page-fill: 0px;
    --page-gutter: 2.5rem;
    position: relative;
    display: block;
    width: calc(100% + 5.5rem);
    margin: 0 -2.75rem;
    padding: 0;
    height: calc(var(--page-fill) + var(--page-gutter));
    border: none;
    outline: none;
    user-select: none;
    pointer-events: none;
    cursor: default;
    background:
        linear-gradient(#fffef9, #fffef9) top / 100% var(--page-fill) no-repeat,
        linear-gradient(90deg, rgba(0, 0, 0, 0.03) 0%, transparent 14px) top / 100% var(--page-fill) no-repeat,
        #c5ccd6;
    box-shadow: none;
}
.doc-editor-shell .ql-editor .book-page-break::before,
.book-page-break::before {
    content: none;
}
.doc-editor-shell .ql-editor .book-page-break::after,
.book-page-break::after {
    content: attr(data-page-label);
    position: absolute;
    left: 50%;
    bottom: calc(var(--page-gutter) / 2);
    transform: translate(-50%, 50%);
    font-family: system-ui, -apple-system, Segoe UI, sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #475569;
    background: #e8edf3;
    border: 1px solid #b8c0cc;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.doc-editor-shell .ql-editor .book-page-break:not([data-page-label])::after,
.book-page-break:not([data-page-label])::after {
    content: 'Page break';
}

.doc-editor-shell .ql-editor img.book-img,
.doc-editor-shell .ql-editor img {
    max-width: 100%;
    height: auto;
    cursor: pointer;
    border-radius: 4px;
}
.doc-editor-shell .ql-editor img[data-wrap="left"] {
    float: left;
    display: block;
    margin: 0.25rem 1rem 0.75rem 0;
    max-width: 48%;
}
.doc-editor-shell .ql-editor img[data-wrap="right"] {
    float: right;
    display: block;
    margin: 0.25rem 0 0.75rem 1rem;
    max-width: 48%;
}
.doc-editor-shell .ql-editor img[data-wrap="center"] {
    float: none;
    display: block;
    margin: 0.75rem auto;
    clear: both;
}
.doc-editor-shell .ql-editor img[data-wrap="inline"] {
    float: none;
    display: inline;
    margin: 0 0.35rem;
    vertical-align: middle;
    max-width: 40%;
}
.doc-editor-shell .ql-editor img[data-wrap="free"] {
    position: absolute;
    float: none;
    display: block;
    margin: 0;
    max-width: none;
    cursor: move;
    z-index: 2;
}
/* Watermark-style: sits under all page text */
.doc-editor-shell .ql-editor img[data-layer="behind"] {
    position: absolute;
    float: none;
    display: block;
    margin: 0;
    max-width: none;
    z-index: -1;
    opacity: 1;
    pointer-events: none;
    cursor: move;
}
.doc-editor-shell .ql-editor img[data-layer="behind"].is-selected {
    pointer-events: auto;
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}
.doc-editor-shell .ql-editor img[data-layer="front"] {
    position: relative;
    z-index: 4;
}
.doc-editor-shell .ql-editor img[data-wrap="free"][data-layer="front"] {
    position: absolute;
    z-index: 4;
}
.doc-editor-shell .ql-editor img[data-layer="normal"] {
    z-index: auto;
}
.doc-editor-shell .ql-editor img.is-selected {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    cursor: move;
}

.book-img-pin {
    position: fixed;
    z-index: 94;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    height: 28px;
    padding: 0 0.5rem;
    border: 1px solid #94a3b8;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.22);
    cursor: grab;
    touch-action: none;
}
.book-img-pin:hover,
.book-img-pin:focus-visible {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
    outline: none;
}
.book-img-pin i {
    font-size: 0.75rem;
}

.book-img-handle {
    position: fixed;
    width: 12px;
    height: 12px;
    margin: 0;
    padding: 0;
    background: #2563eb;
    border: 2px solid #fff;
    border-radius: 2px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.4);
    z-index: 95;
    touch-action: none;
    pointer-events: auto;
}
.book-img-handle--nw { cursor: nwse-resize; }
.book-img-handle--ne { cursor: nesw-resize; }
.book-img-handle--sw { cursor: nesw-resize; }
.book-img-handle--se { cursor: nwse-resize; }
.book-img-handle--n { cursor: ns-resize; }
.book-img-handle--s { cursor: ns-resize; }
.book-img-handle--e { cursor: ew-resize; }
.book-img-handle--w { cursor: ew-resize; }

.book-img-toolbar {
    position: fixed;
    z-index: 90;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    max-width: min(92vw, 34rem);
    padding: 0.4rem;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
}
.book-img-toolbar[hidden] { display: none !important; }
.book-img-toolbar__group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    padding-right: 0.35rem;
    border-right: 1px solid #334155;
}
.book-img-toolbar__group:last-child {
    border-right: none;
    padding-right: 0;
}
.book-img-toolbar button {
    border: none;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 0.7rem;
    font-weight: 650;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}
.book-img-toolbar button:hover,
.book-img-toolbar button.is-active {
    background: #2563eb;
    color: #fff;
}

.book-img-crop {
    border: none;
    padding: 0;
    max-width: min(92vw, 720px);
    width: 100%;
    border-radius: 14px;
    background: transparent;
}
.book-img-crop::backdrop { background: rgba(15, 23, 42, 0.55); }
.book-img-crop__panel {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
}
.book-img-crop__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}
.book-img-crop__head h3 { margin: 0; font-size: 1rem; }
.book-img-crop__stage {
    position: relative;
    max-height: 60vh;
    overflow: auto;
    background: #0f172a;
    text-align: center;
}
.book-img-crop__stage canvas {
    display: block;
    max-width: 100%;
    margin: 0 auto;
    cursor: crosshair;
}
.book-img-crop__hint {
    margin: 0;
    padding: 0.65rem 1rem 0;
    font-size: 0.8125rem;
    color: #64748b;
}
.book-img-crop__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.85rem 1rem 1rem;
}
.doc-resource-editor { min-height: 420px; }

@media (max-width: 768px) {
    .doc-editor-meta__summary { padding: 0.5rem 0.75rem; }
    .doc-editor-meta__body { padding: 0.55rem 0.75rem 0.75rem; }
    .doc-editor-toolbar.ql-toolbar.ql-snow,
    .doc-editor-toolbar {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        padding: 0.35rem 0.5rem;
    }
    .doc-editor-toolbar::-webkit-scrollbar { height: 3px; }
    .doc-editor-toolbar .ql-formats {
        flex-shrink: 0;
    }
    .doc-editor-main {
        flex-direction: column;
    }
    .doc-editor-pages {
        flex: 0 0 auto;
        border-right: none;
        border-bottom: 1px solid #b8c0cc;
        max-height: 150px;
    }
    .doc-editor-pages__list {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.55rem 0.65rem;
        gap: 0.55rem;
    }
    .doc-editor-page-thumb {
        flex: 0 0 78px;
        width: 78px;
    }
    .doc-editor-page-thumb__sheet {
        max-height: 96px;
    }
    .doc-editor-pages__add {
        margin: 0 0.65rem 0.55rem;
    }
    .doc-editor-canvas-wrap {
        padding: 0.75rem 0.5rem 1rem;
        background: #c5ccd6;
    }
    .doc-editor-shell .ql-editor {
        min-height: calc(100vw * 297 / 210);
        height: auto !important;
        max-height: none !important;
        overflow-x: clip;
        overflow-y: visible !important;
        padding: 1.5rem 1.15rem 2rem;
        font-size: 1rem;
    }
    .doc-editor-shell .ql-editor.ql-blank::before {
        left: 1.15rem;
        right: 1.15rem;
    }
    .doc-editor-shell .ql-editor .book-page-break,
    .book-page-break {
        width: calc(100% + 2.3rem);
        margin-left: -1.15rem;
        margin-right: -1.15rem;
    }
    .doc-editor-footer__hint { display: none; }
}
/* --- Feature-rich deck editor additions --- */
.deck-editor-topbar-right { display: flex; align-items: center; gap: 0.5rem; }
.deck-zoom-controls { display: flex; align-items: center; gap: 0.15rem; }
.deck-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border: 1px solid transparent; border-radius: 6px;
    background: transparent; color: #cbd5e1; cursor: pointer; font-size: 0.85rem;
}
.deck-icon-btn:hover { background: #334155; color: #fff; }
.deck-icon-btn.is-on { background: #2563eb; border-color: #3b82f6; color: #fff; }
.deck-zoom-level {
    min-width: 3.2rem; height: 2rem; padding: 0 0.4rem; border: 1px solid #475569;
    border-radius: 6px; background: #0f172a; color: #e2e8f0; font-size: 0.78rem; cursor: pointer;
}
.deck-zoom-level:hover { border-color: #64748b; }

.deck-menu { position: relative; }
.deck-menu-panel, .deck-dropdown-panel {
    position: absolute; z-index: 60; top: calc(100% + 6px);
    background: #1e293b; border: 1px solid #475569; border-radius: 8px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45); padding: 0.35rem;
}
.deck-menu-panel[hidden], .deck-dropdown-panel[hidden] { display: none; }
.deck-menu-panel { right: 0; min-width: 12rem; display: flex; flex-direction: column; gap: 2px; }
.deck-menu-panel button {
    display: flex; align-items: center; gap: 0.55rem; width: 100%;
    padding: 0.45rem 0.6rem; border: none; border-radius: 6px; background: transparent;
    color: #e2e8f0; cursor: pointer; font-size: 0.82rem; text-align: left;
}
.deck-menu-panel button:hover { background: #334155; }

.deck-dropdown { position: relative; }
.deck-dropdown-panel { left: 0; }
.deck-caret { font-size: 0.6rem; margin-left: 0.1rem; opacity: 0.7; }
.deck-image-panel { display: flex; flex-direction: column; gap: 2px; min-width: 11rem; }
.deck-image-panel button {
    display: flex; align-items: center; gap: 0.55rem; padding: 0.45rem 0.6rem;
    border: none; border-radius: 6px; background: transparent; color: #e2e8f0;
    cursor: pointer; font-size: 0.82rem; text-align: left;
}
.deck-image-panel button:hover { background: #334155; }
.deck-tool-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.15rem; width: auto; min-width: 2.1rem; padding: 0 0.45rem; }
.deck-tool-btn.is-on { background: #2563eb; border-color: #3b82f6; color: #fff; }
.deck-align-group { display: inline-flex; gap: 0.1rem; }

/* Properties tabs */
.deck-prop-tabs { display: flex; gap: 0.25rem; margin-bottom: 0.75rem; }
.deck-prop-tab {
    flex: 1; padding: 0.45rem 0.5rem; border: 1px solid #334155; border-radius: 6px;
    background: #0f172a; color: #94a3b8; font-size: 0.78rem; font-weight: 600; cursor: pointer;
}
.deck-prop-tab.is-active { background: #2563eb; border-color: #3b82f6; color: #fff; }
.deck-prop-pane { display: none; }
.deck-prop-pane.is-active { display: block; }
.deck-empty-hint { color: #64748b; font-size: 0.82rem; padding: 1rem 0.25rem; text-align: center; }
.deck-hint { font-weight: 400; color: #64748b; font-size: 0.7rem; }
.deck-mt { margin-top: 0.6rem; }

.deck-seg { display: flex; gap: 0.25rem; margin-bottom: 0.6rem; }
.deck-seg button {
    flex: 1; padding: 0.4rem 0.3rem; border: 1px solid #334155; border-radius: 6px;
    background: #0f172a; color: #94a3b8; font-size: 0.75rem; cursor: pointer;
}
.deck-seg button.is-active { background: #334155; border-color: #475569; color: #fff; }
.deck-bg-row { display: flex; flex-direction: column; gap: 0.4rem; }

.deck-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.deck-grid-2 label, .deck-bg-row label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.72rem; color: #94a3b8; }
.deck-grid-2 input[type="number"] { width: 100%; }
.deck-btn-row { display: flex; align-items: center; gap: 0.2rem; flex-wrap: wrap; }
.deck-props-section input[type="color"] {
    width: 100%; height: 2rem; padding: 0; border: 1px solid #475569; border-radius: 6px; background: #0f172a; cursor: pointer;
}
.deck-props-section input[type="range"] { width: 100%; accent-color: #3b82f6; }

.deck-swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.3rem; margin-top: 0.4rem; }
.deck-swatch { width: 100%; aspect-ratio: 1; border: 1px solid rgba(148, 163, 184, 0.35); border-radius: 5px; cursor: pointer; padding: 0; }
.deck-swatch:hover { transform: scale(1.08); }

.deck-layers-list li {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.4rem 0.5rem; border-radius: 6px; font-size: 0.78rem;
    cursor: pointer; color: #cbd5e1; border: 1px solid transparent;
}
.deck-layer-icon { width: 1rem; text-align: center; opacity: 0.8; }
.deck-layer-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-layer-lock { border: none; background: transparent; color: inherit; cursor: pointer; opacity: 0.7; }
.deck-layer-lock:hover { opacity: 1; }
.deck-layers-list li.is-dropzone { border-color: #3b82f6; background: #1e3a5f; }

.deck-slide-thumb { transition: opacity 0.15s ease; }
.deck-slide-thumb.is-dragging { opacity: 0.4; }
.deck-slide-thumb.is-dropzone { box-shadow: 0 0 0 2px #3b82f6 inset; }
.deck-slide-thumb-actions { gap: 2px; }

@media (max-width: 1100px) {
    .deck-editor-layout {
        grid-template-columns: 160px 1fr;
    }
    .deck-properties { display: none; }
}
@media (max-width: 768px) {
    /* Full-screen editor: hide LMS chrome so the canvas gets the space */
    .editor-shell-active .moodle-navbar,
    .editor-shell-active .moodle-drawer,
    .editor-shell-active .drawer-overlay {
        display: none !important;
    }
    .editor-shell-layout {
        margin-top: 0;
        min-height: 100dvh;
    }
    .resource-editor-shell {
        min-height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
    }
    .editor-shell-main .toast-container {
        top: 0.75rem;
    }

    .deck-editor-topbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "left right";
        align-items: center;
        gap: 0.4rem 0.5rem;
        padding: 0.45rem 0.55rem;
        flex-shrink: 0;
    }
    .deck-editor-topbar-left {
        grid-area: left;
        gap: 0.4rem;
        min-width: 0;
    }
    .deck-editor-topbar-right {
        grid-area: right;
        gap: 0.3rem;
        flex-shrink: 0;
    }
    .deck-btn-label { display: none; }
    .deck-back-btn {
        padding: 0.4rem 0.55rem;
        min-width: 2.35rem;
        justify-content: center;
    }
    .deck-title-input {
        min-width: 0;
        max-width: none;
        flex: 1;
        font-size: 0.8125rem;
        padding: 0.4rem 0.5rem;
    }
    .deck-save-status {
        display: none;
    }
    .deck-zoom-controls,
    .deck-topbar-sep {
        display: none;
    }
    .deck-editor-topbar-right .btn {
        min-width: 2.35rem;
        min-height: 2.35rem;
        padding: 0.4rem 0.55rem;
        justify-content: center;
    }

    .deck-toolbar {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        gap: 0.2rem;
        padding: 0.4rem 0.5rem;
        flex-shrink: 0;
        scrollbar-width: thin;
    }
    .deck-toolbar::-webkit-scrollbar { height: 4px; }
    .deck-tool-btn {
        min-width: 2.4rem;
        height: 2.4rem;
        flex-shrink: 0;
    }
    .deck-align-group {
        flex-shrink: 0;
    }
    .deck-template-select {
        flex-shrink: 0;
        max-width: 8.5rem;
        font-size: 0.75rem;
    }
    .deck-toolbar-sep {
        flex-shrink: 0;
    }

    .deck-editor-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
        min-height: 0;
        flex: 1;
    }
    .deck-slide-rail {
        max-height: none;
        border-right: none;
        border-bottom: 1px solid #334155;
        flex-direction: row;
        align-items: stretch;
    }
    .deck-slide-rail-head {
        flex-direction: column;
        justify-content: center;
        gap: 0.35rem;
        padding: 0.4rem 0.45rem;
        border-right: 1px solid #334155;
        writing-mode: horizontal-tb;
    }
    .deck-slide-rail-head span {
        display: none;
    }
    .deck-slide-rail-head .btn {
        min-width: 2.25rem;
        min-height: 2.25rem;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .deck-slide-thumbs {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 0.4rem 0.5rem;
        gap: 0.4rem;
        align-items: center;
    }
    .deck-slide-thumb {
        min-width: 96px;
        width: 96px;
        flex-shrink: 0;
    }
    .deck-slide-thumb-num {
        padding: 0.15rem 0.25rem;
        font-size: 0.65rem;
    }
    .deck-slide-thumb-actions {
        display: flex;
    }

    .deck-canvas-area {
        min-height: 0;
    }
    .deck-canvas-wrap {
        padding: 0.55rem;
        padding-bottom: 4.25rem;
    }

    /* Properties as bottom sheet */
    .deck-properties-mobile-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        margin: -0.25rem 0 0.65rem;
        padding-bottom: 0.55rem;
        border-bottom: 1px solid #334155;
        color: #e2e8f0;
        font-size: 0.875rem;
    }
    .deck-properties {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 120;
        max-height: min(72dvh, 34rem);
        padding: 0.85rem 0.85rem calc(0.85rem + env(safe-area-inset-bottom));
        border-left: none;
        border-top: 1px solid #475569;
        border-radius: 1rem 1rem 0 0;
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
        transform: translateY(110%);
        transition: transform 0.22s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .deck-properties.is-mobile-open {
        transform: translateY(0);
    }
    .deck-mobile-props-btn {
        position: fixed;
        right: 0.85rem;
        bottom: calc(0.85rem + env(safe-area-inset-bottom));
        z-index: 110;
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        padding: 0.7rem 1rem;
        border: none;
        border-radius: 999px;
        background: #2563eb;
        color: #fff;
        font-size: 0.8125rem;
        font-weight: 700;
        box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45);
        cursor: pointer;
    }
    .deck-mobile-props-btn:active {
        transform: scale(0.98);
    }
    .deck-mobile-props-backdrop {
        position: fixed;
        inset: 0;
        z-index: 115;
        background: rgba(2, 6, 23, 0.55);
    }
    .deck-mobile-props-backdrop[hidden] {
        display: none;
    }
    body.deck-props-sheet-open {
        overflow: hidden;
    }
}

@media (min-width: 769px) {
    .deck-properties-mobile-head,
    .deck-mobile-props-btn,
    .deck-mobile-props-backdrop {
        display: none !important;
    }
}

/* AI platform monitor */
.ai-monitor-stats { margin-bottom: 1rem; }
.ai-monitor-keys { overflow: hidden; }
.ai-keys-header {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border);
}
.ai-keys-heading { display: flex; align-items: center; gap: 0.85rem; min-width: 0; }
.ai-keys-heading-icon {
    display: grid; place-items: center; flex: 0 0 2.75rem; width: 2.75rem; height: 2.75rem;
    border-radius: 0.8rem; color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent);
}
.ai-keys-heading h2 { margin: 0; font-size: 1.05rem; }
.ai-keys-heading p { margin: 0.2rem 0 0; color: var(--text-muted); font-size: 0.84rem; }
.ai-key-add-form {
    padding: 1rem; margin-bottom: 1rem; border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
    border-radius: 0.85rem; background: color-mix(in srgb, var(--primary) 4%, var(--surface));
}
.ai-key-add-form__head {
    display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem;
}
.ai-key-add-form__head strong, .ai-key-add-form__head span { display: block; }
.ai-key-add-form__head span { margin-top: 0.15rem; color: var(--text-muted); font-size: 0.78rem; }
.ai-key-form-close {
    border: 0; background: transparent; color: var(--text-muted); padding: 0.25rem; cursor: pointer;
}
.ai-key-add-grid {
    display: grid; grid-template-columns: minmax(160px, 0.8fr) minmax(130px, 0.55fr) minmax(260px, 1.65fr);
    gap: 0.75rem; align-items: end;
}
.ai-key-add-grid .form-group { margin: 0; }
.ai-key-add-grid .form-group > span { display: block; margin-bottom: 0.35rem; font-size: 0.78rem; font-weight: 700; }
.ai-key-secret-input { position: relative; }
.ai-key-secret-input input { padding-right: 2.6rem; }
.ai-key-secret-input button {
    position: absolute; top: 50%; right: 0.35rem; transform: translateY(-50%);
    width: 2rem; height: 2rem; border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
}
.ai-key-form-feedback { min-height: 1.25rem; margin-top: 0.5rem; color: var(--text-muted); font-size: 0.8rem; }
.ai-key-form-feedback.is-error { color: var(--danger); }
.ai-key-add-form .form-actions { margin-top: 0.25rem; }
.ai-key-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 0.85rem; }
.ai-key-card {
    display: flex; flex-direction: column; min-height: 172px; padding: 0.95rem;
    border: 1px solid var(--border); border-radius: 0.85rem; background: var(--surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); transition: border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.ai-key-card:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); box-shadow: 0 5px 16px rgba(15, 23, 42, 0.06); }
.ai-key-card.is-inactive { opacity: 0.64; }
.ai-key-card__top, .ai-key-card__footer { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.ai-key-service-icon {
    display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 0.55rem;
    color: #2563eb; background: #dbeafe;
}
.ai-key-service-icon--image { color: #7c3aed; background: #ede9fe; }
.ai-key-status {
    padding: 0.18rem 0.5rem; border-radius: 999px; color: var(--text-muted); background: var(--surface-2);
    font-size: 0.68rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.04em;
}
.ai-key-status.is-active { color: #047857; background: #d1fae5; }
.ai-key-card__body { display: flex; flex-direction: column; gap: 0.18rem; margin: 0.75rem 0; }
.ai-key-card__body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-key-type { color: var(--text-muted); font-size: 0.75rem; }
.ai-key-card__body code {
    display: block; margin-top: 0.38rem; padding: 0.38rem 0.5rem; overflow: hidden; text-overflow: ellipsis;
    border-radius: 0.4rem; background: var(--surface-2); color: var(--ink-2); font-size: 0.72rem; white-space: nowrap;
}
.ai-key-card__footer { margin-top: auto; padding-top: 0.65rem; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.72rem; }
.ai-key-actions { display: flex; gap: 0.25rem; }
.ai-key-actions button {
    display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border: 1px solid var(--border);
    border-radius: 0.42rem; background: var(--surface); color: var(--text-muted); cursor: pointer;
}
.ai-key-actions button:hover { color: var(--primary); border-color: var(--primary); }
.ai-key-actions button.is-danger:hover { color: var(--danger); border-color: var(--danger); }
.ai-key-empty {
    grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
    padding: 2rem; border: 1px dashed var(--border); border-radius: 0.85rem; color: var(--text-muted); text-align: center;
}
.ai-key-empty > i { margin-bottom: 0.25rem; color: var(--primary); font-size: 1.4rem; }
.ai-key-empty strong { color: var(--ink); }
.ai-key-empty span { font-size: 0.8rem; }
.ai-monitor-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.ai-monitor-toolbar-right { display: flex; align-items: center; gap: 1rem; }
.ai-queue-limit-label {
    display: inline-flex; align-items: center; gap: 0.4rem;
    font-size: 0.8125rem; color: var(--text-muted); white-space: nowrap;
}
.ai-queue-limit-label select {
    width: auto; padding: 0.25rem 0.5rem; font-size: 0.8125rem;
}
.ai-monitor-live { font-size: 0.85rem; }
.ai-pulse { color: var(--success); font-size: 0.5rem; vertical-align: middle; animation: ai-pulse 1.5s infinite; }
@keyframes ai-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.ai-queue-table { table-layout: fixed; }
.aiq-col-id      { width: 6%; }
.aiq-col-type    { width: 16%; }
.aiq-col-status  { width: 11%; }
.aiq-col-prompt  { width: 25%; }
.aiq-col-key     { width: 10%; }
.aiq-col-user    { width: 12%; }
.aiq-col-date    { width: 14%; }
.aiq-col-actions { width: 6%; text-align: right; }

.ai-queue-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-queue-table td code { font-size: 0.75rem; }
.ai-prompt-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-processing { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-cancelled { background: #f3f4f6; color: #6b7280; }
.superadmin-settings-form { max-width: 520px; display: flex; flex-direction: column; gap: 1rem; }
@media (max-width: 760px) {
    .ai-keys-header { align-items: flex-start; flex-direction: column; }
    .ai-key-add-grid { grid-template-columns: 1fr; }
    .ai-key-value-field { grid-column: auto; }
}

/* AI analytics */
.ai-analytics-toolbar {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
    gap: 1rem; margin-bottom: 1rem; padding: 1rem 1.25rem;
}
.ai-analytics-filters { flex: 1; min-width: 280px; }
.ai-analytics-filter-label {
    display: block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 0.5rem;
}
.ai-granularity-pills { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ai-granularity-pill {
    border: 1px solid var(--border); background: var(--surface); color: var(--ink-2);
    border-radius: 999px; padding: 0.35rem 0.85rem; font-size: 0.8125rem; font-weight: 600;
    cursor: pointer; transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.ai-granularity-pill:hover { border-color: var(--primary); color: var(--primary); }
.ai-granularity-pill.is-active {
    background: var(--primary); border-color: var(--primary); color: #fff;
}
.ai-analytics-school-filter { min-width: 200px; }
.ai-analytics-school-filter label {
    display: block; font-size: 0.75rem; font-weight: 700; margin-bottom: 0.35rem;
}
.ai-analytics-range { width: 100%; font-size: 0.8125rem; margin: 0; }
.ai-analytics-stats { margin-bottom: 1rem; }
.ai-analytics-chart-panel { margin-bottom: 1rem; }
.ai-analytics-chart-wrap { position: relative; min-height: 280px; padding: 0.5rem 0; }
.ai-analytics-loading { text-align: center; padding: 1rem; }
.ai-job-types-cell code { font-size: 0.75rem; }

/* AI school usage table columns */
.ai-school-usage-table { table-layout: fixed; }
.aiu-col-school { width: 20%; }
.aiu-col-num    { width: 8%; text-align: right; }
.aiu-col-tokens { width: 12%; text-align: right; }
.aiu-col-split  { width: 14%; text-align: right; }
.aiu-col-types  { width: 22%; }
.ai-school-usage-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-school-usage-table td:nth-child(n+2):nth-child(-n+5) { text-align: right; }
.ai-school-usage-table td:nth-child(6),
.ai-school-usage-table td:nth-child(7) { text-align: right; font-variant-numeric: tabular-nums; }

/* Mobile cards - hidden on desktop */
.ai-school-cards-mobile { display: none; }

.aiu-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.aiu-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.aiu-card-name {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
a.aiu-card-name:hover { color: var(--primary); }
.aiu-card-tokens {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}
.aiu-card-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.35rem;
}
.aiu-card-stat {
    text-align: center;
    padding: 0.45rem 0.25rem;
    background: var(--surface-muted);
    border-radius: var(--radius);
}
.aiu-card-stat-val { display: block; font-weight: 700; font-size: 0.9375rem; line-height: 1.2; }
.aiu-card-stat-lbl { display: block; font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.03em; }
.aiu-card-stat--ok .aiu-card-stat-val { color: var(--success); }
.aiu-card-stat--fail .aiu-card-stat-val { color: var(--danger); }
.aiu-card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.aiu-card-split i { font-size: 0.625rem; opacity: 0.7; }
.aiu-card-sep { opacity: 0.4; margin: 0 0.15rem; }
.aiu-card-types { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.aiu-card-types code { font-size: 0.675rem; padding: 0.1rem 0.35rem; background: var(--surface-muted); border-radius: var(--radius); }

@media (max-width: 768px) {
    .ai-school-table-desktop { display: none; }
    .ai-school-cards-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
    }
}

/* Practice quizzes */
.practice-page .practice-intro { margin-bottom: 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.practice-section-heading { font-size: 1rem; font-weight: 700; margin: 1.5rem 0 0.75rem; color: var(--ink-2); }
.practice-course-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.25rem;
    align-items: center;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: #bae6fd;
}
.practice-course-card__badge {
    width: 3rem;
    height: 3rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}
.practice-course-card__body h3 { margin: 0 0 0.35rem; font-size: 1.1rem; }
.practice-course-card__body p { margin: 0 0 0.5rem; font-size: 0.9rem; }
.practice-status--error { color: #dc2626 !important; }
.practice-lessons { display: flex; flex-direction: column; gap: 1rem; }
.practice-lesson-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.practice-lesson-card__head { display: flex; align-items: center; gap: 1rem; }
.practice-lesson-index { width: 2rem; height: 2rem; border-radius: 50%; background: var(--primary-muted); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.85rem; }
.practice-level { font-size: 0.85rem; }
.practice-level--beginner { color: #6b7280; }
.practice-level--developing { color: #d97706; }
.practice-level--proficient { color: #2563eb; }
.practice-level--mastery { color: #059669; }
.practice-quiz-banner { margin-bottom: 1rem; }

.practice-hub {
    width: 100%;
    padding-bottom: 1.25rem;
}
.practice-hub__panel {
    padding: 1.1rem 1.15rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}
.practice-hub__header {
    margin-bottom: 1rem;
    padding-bottom: 0.95rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
}
.practice-hub__back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
}
.practice-hub__back:hover {
    color: var(--primary);
    text-decoration: none;
}
.practice-hub__kicker {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.practice-hub__title {
    margin: 0.1rem 0 0.35rem;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
}
.practice-hub__sub {
    margin: 0;
    max-width: 42rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.practice-hub__alert { margin-bottom: 1rem; }
.practice-hub__courses {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.practice-hub__subjects-head,
.practice-hub__subjects {
    margin-bottom: 0;
}
.practice-hub__subjects-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.practice-hub__subjects-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
}
.practice-hub__subjects-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}
.practice-hub__subject-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}
.practice-hub__subject-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    background: #fff;
    text-decoration: none !important;
    color: inherit;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.practice-hub__subject-card:hover {
    border-color: rgba(15, 108, 191, 0.35);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    transform: translateY(-1px);
}
.practice-hub__subject-icon {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e7f0fa;
    color: var(--primary);
    flex-shrink: 0;
}
.practice-hub__subject-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.practice-hub__subject-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text);
}
.practice-hub__subject-meta,
.practice-hub__subject-stats {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
}
.practice-hub__subject-body .practice-level {
    font-size: 0.72rem;
    margin-top: 0.1rem;
}
.practice-hub__subject-chevron {
    color: #94a3b8;
    font-size: 0.75rem;
}
.practice-hub__course-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}
.practice-hub__course-wide--detail {
    margin-bottom: 1rem;
}
.practice-hub__upload {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
    margin-bottom: 1.15rem;
    border: 1px solid #dbeafe;
    border-radius: 0.85rem;
    background: linear-gradient(135deg, #f8fbff 0%, #eef6ff 100%);
}
.practice-hub__upload--course {
    margin-bottom: 1rem;
}
.practice-hub__upload-copy {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 0;
    flex: 1 1 16rem;
}
.practice-hub__upload-icon {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #dbeafe;
    color: var(--primary);
    flex-shrink: 0;
    font-size: 1rem;
    line-height: 1;
    margin: 0;
}
.practice-hub__upload-icon i {
    display: block;
    line-height: 1;
    color: inherit;
}
.practice-hub__upload-copy strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text);
}
.practice-hub__upload-copy > div > span {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.practice-hub__upload .practice-status {
    width: 100%;
}
.practice-config-class {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0 0 0.85rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
}
.practice-config-class .form-control {
    font-weight: 500;
}
.practice-upload-zone {
    border: 2px dashed var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem 0.9rem;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.practice-upload-zone:hover,
.practice-upload-zone.is-dragover {
    border-color: rgba(15, 108, 191, 0.45);
    background: #f0f7ff;
}
.practice-upload-zone.has-file {
    padding: 0;
    border-style: solid;
    cursor: default;
}
.practice-upload-zone__inner i {
    display: block;
    font-size: 1.35rem;
    color: var(--primary);
    margin-bottom: 0.35rem;
}
.practice-upload-zone__inner p {
    margin: 0;
    font-size: 0.875rem;
}
.practice-upload-browse {
    background: none;
    border: none;
    padding: 0;
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    font: inherit;
}
.practice-upload-file {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 0.9rem;
    background: #eff6ff;
}
.practice-upload-file[hidden],
.practice-config-footer .btn[hidden],
.practice-config-page[hidden],
.practice-config-steps[hidden],
.practice-config-class[hidden] {
    display: none !important;
}
.practice-upload-file i {
    color: var(--primary);
}
.practice-upload-file span {
    flex: 1;
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: left;
    word-break: break-all;
}
.practice-upload-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 0.35rem;
}
.practice-upload-clear:hover {
    background: rgba(15, 23, 42, 0.06);
    color: var(--text);
}
.practice-hub__lessons-title {
    margin: 0 0 0.65rem;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text);
}
.practice-hub__course {
    padding: 0.95rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.practice-hub__course-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eef2f7;
}
.practice-hub__course-icon {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e7f0fa;
    color: var(--primary);
    flex-shrink: 0;
}
.practice-hub__course-copy {
    min-width: 0;
    flex: 1;
}
.practice-hub__course-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
}
.practice-hub__course-meta {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.practice-hub__course-link {
    flex-shrink: 0;
}
.practice-hub__course-wide {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.7rem 0.8rem;
    margin-bottom: 0.65rem;
    border-radius: 0.65rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e8f4fd 100%);
    border: 1px solid #bae6fd;
}
.practice-hub__course-wide .practice-hub__lesson-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    flex: 1;
}
.practice-hub__course-wide .practice-hub__lesson-copy strong {
    font-size: 0.88rem;
}
.practice-hub__course-wide .practice-hub__lesson-copy > span:not(.practice-level) {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.practice-hub__lessons {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.practice-hub__lesson {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.6rem;
    border: 1px solid #e8edf3;
    background: #f8fafc;
}
.practice-hub__lesson-main {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}
.practice-hub__lesson-index {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e7f0fa;
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}
.practice-hub__lesson-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}
.practice-hub__lesson-copy strong {
    font-size: 0.88rem;
    color: var(--text);
}
.practice-hub__lesson-copy .practice-level {
    font-size: 0.72rem;
}
.practice-hub__lesson-empty {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.practice-hub__lesson .practice-status {
    grid-column: 1 / -1;
    font-size: 0.75rem;
}
.practice-hub__course-wide .practice-status {
    width: 100%;
    flex-basis: 100%;
    font-size: 0.75rem;
}
.practice-hub__stats {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(226, 232, 240, 0.95);
}
.practice-hub__stats-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.practice-hub__stats-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
}
.practice-hub__stats-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}
@media (max-width: 640px) {
    .practice-hub__panel { padding: 0.75rem; }
    .practice-hub__subject-grid { grid-template-columns: 1fr; }
    .practice-hub__course-head { flex-wrap: wrap; }
    .practice-hub__course-link { width: 100%; justify-content: center; }
    .practice-hub__course-wide,
    .practice-hub__lesson {
        grid-template-columns: 1fr;
    }
    .practice-hub__course-wide .btn,
    .practice-hub__lesson .btn {
        width: 100%;
        justify-content: center;
    }
}

.practice-config-dialog {
    border: none;
    border-radius: 0.95rem;
    padding: 0;
    max-width: 28rem;
    width: min(28rem, calc(100vw - 1.5rem));
    overflow: hidden;
    background: #fff;
    box-shadow:
        0 18px 40px rgba(15, 48, 96, 0.16),
        0 2px 8px rgba(15, 23, 42, 0.06);
}
.practice-config-dialog::backdrop {
    background: rgba(15, 35, 58, 0.42);
    backdrop-filter: blur(4px);
}
.practice-config-form {
    display: flex;
    flex-direction: column;
    padding: 0;
}
.practice-config-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #e8eef5;
    background: linear-gradient(180deg, #f5f9fd 0%, #fff 100%);
}
.practice-config-header--compact .practice-config-header__icon {
    display: none;
}
.practice-config-header--compact .practice-config-header__lead {
    padding-right: 1.75rem;
}
.practice-config-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem 0;
}
.practice-config-steps__item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
}
.practice-config-steps__item.is-active {
    color: var(--primary);
}
.practice-config-steps__item.is-done {
    color: var(--text);
}
.practice-config-steps__num {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e8eef5;
    font-size: 0.65rem;
}
.practice-config-steps__item.is-active .practice-config-steps__num {
    background: var(--primary);
    color: #fff;
}
.practice-config-steps__item.is-done .practice-config-steps__num {
    background: #dbeafe;
    color: var(--primary);
}
.practice-config-steps__divider {
    width: 1.25rem;
    height: 2px;
    background: #e2e8f0;
    border-radius: 999px;
}
.practice-config-page[hidden] {
    display: none !important;
}
.practice-config-header__lead {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    padding-right: 1.75rem;
}
.practice-config-header__icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-size: 0.85rem;
}
.practice-config-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: var(--ink);
    line-height: 1.2;
}
.practice-config-header__sub {
    margin: 0.1rem 0 0;
    color: var(--ink-2);
    font-size: 0.75rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 18rem;
}
.practice-config-close {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    display: inline-grid;
    place-items: center;
    width: 1.7rem;
    height: 1.7rem;
    border: 1px solid #dbe5f0;
    border-radius: 999px;
    background: #fff;
    color: var(--ink-2);
    cursor: pointer;
    font-size: 0.75rem;
}
.practice-config-close:hover {
    background: #f3f7fb;
    color: var(--ink);
}
.practice-config-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
}
.practice-config-section {
    margin: 0;
}
.practice-config-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}
.practice-config-section__head h3 {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--ink);
}
.practice-config-count-value {
    font-variant-numeric: tabular-nums;
    color: var(--primary);
}
.practice-config-count-value strong {
    font-size: 0.95rem;
    font-weight: 800;
}
.practice-config-count {
    display: grid;
    grid-template-columns: 1.9rem minmax(0, 1fr) 1.9rem;
    gap: 0.45rem;
    align-items: center;
}
.practice-config-count__btn {
    display: inline-grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    border: 1px solid #d5e2ef;
    border-radius: 0.5rem;
    background: #fff;
    color: var(--ink-2);
    cursor: pointer;
    font-size: 0.7rem;
}
.practice-config-count__btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}
.practice-config-count__input[hidden] {
    display: none !important;
}
.practice-config-slider__input {
    width: 100%;
    height: 1.25rem;
    accent-color: var(--primary);
}
.practice-config-slider__labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.1rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--ink-3);
}
.practice-config-difficulty {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem;
}
.practice-config-difficulty__option {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0.45rem 0.35rem;
    border: 1px solid #d8e4f0;
    border-radius: 0.55rem;
    background: #fff;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink-2);
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.practice-config-difficulty__option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.practice-config-difficulty__option i {
    font-size: 0.75rem;
    color: var(--primary);
}
.practice-config-difficulty__option:hover {
    border-color: #9fc4e5;
    background: #f8fbff;
}
.practice-config-difficulty__option.is-selected {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}
.practice-config-difficulty__option.is-selected i {
    color: #fff;
}
.practice-config-types {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.practice-config-type {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0.4rem 0.65rem;
    border: 1px solid #d8e4f0;
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 650;
    color: var(--ink-2);
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.practice-config-type input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.practice-config-type i {
    font-size: 0.72rem;
    color: var(--ink-3);
}
.practice-config-type:hover {
    border-color: #9fc4e5;
    background: #f8fbff;
}
.practice-config-type.is-selected {
    border-color: var(--primary);
    background: #f0f7fd;
    color: var(--primary-dark);
}
.practice-config-type.is-selected i {
    color: var(--primary);
}
.practice-config-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.45rem;
    padding: 0.75rem 1rem 0.85rem;
    border-top: 1px solid #e8eef5;
    background: #fff;
}
.practice-config-footer .btn {
    min-height: 2.15rem;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}
.practice-config-footer .btn-primary {
    min-width: 0;
}
.practice-config-section__head .btn-sm {
    min-height: 1.6rem;
    padding: 0.15rem 0.55rem;
    font-size: 0.7rem;
}

@media (max-width: 560px) {
    .practice-config-dialog {
        width: calc(100vw - 1rem);
        border-radius: 0.85rem;
    }
    .practice-config-footer {
        flex-direction: column-reverse;
    }
    .practice-config-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

body.practice-loading-active {
    overflow: hidden;
}
.practice-loading {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(6px);
}
.practice-loading[hidden] { display: none !important; }
.practice-loading__panel {
    width: min(100%, 26rem);
    padding: 2rem 1.75rem 1.65rem;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
    text-align: center;
}
.practice-loading__icon {
    display: inline-grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: #e7f0fa;
    color: var(--primary);
    font-size: 1.15rem;
}
.practice-loading__title {
    display: block;
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
}
.practice-loading__detail {
    margin: 0 0 1.15rem;
    font-size: 0.85rem;
    line-height: 1.45;
}
.practice-loading__track {
    height: 0.55rem;
    overflow: hidden;
    border-radius: 999px;
    background: #dbeafe;
}
.practice-loading__bar {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #3b82f6, var(--primary));
    transition: width 0.35s ease;
}
.practice-loading__percent {
    display: block;
    margin-top: 0.55rem;
    font-size: 0.78rem;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    color: var(--primary);
}
.practice-loading__dismiss {
    margin-top: 1rem;
}
.practice-loading.is-error .practice-loading__icon {
    background: #fee2e2;
    color: #dc2626;
}
.practice-loading.is-error .practice-loading__title {
    color: #991b1b;
}
.practice-loading.is-error .practice-loading__detail {
    color: #b91c1c !important;
}
.practice-loading.is-success .practice-loading__icon {
    background: #dcfce7;
    color: #16a34a;
}
.practice-loading.is-error .practice-loading__track,
.practice-loading.is-error .practice-loading__percent {
    display: none !important;
}
.practice-loading.is-success .practice-loading__title {
    color: #166534;
}
/* School settings — learning feature cards */
.feature-setting {
    --feature-accent: var(--primary);
    --feature-accent-2: #08799c;
    --feature-accent-soft: #eff6ff;
    --feature-accent-border: rgba(15, 108, 191, 0.22);
    --feature-accent-border-soft: rgba(15, 108, 191, 0.12);
    --feature-accent-shadow: rgba(15, 108, 191, 0.22);
    --feature-accent-text: #0c4a6e;
    --feature-accent-muted: #075985;
    width: 100%;
}
.feature-setting--practice {
    --feature-accent: #0f766e;
    --feature-accent-2: #0d9488;
    --feature-accent-soft: #f0fdfa;
    --feature-accent-border: rgba(13, 148, 136, 0.28);
    --feature-accent-border-soft: rgba(13, 148, 136, 0.14);
    --feature-accent-shadow: rgba(13, 148, 136, 0.22);
    --feature-accent-text: #115e59;
    --feature-accent-muted: #0f766e;
}
.feature-setting--atools {
    --feature-accent: var(--primary);
    --feature-accent-2: #08799c;
    --feature-accent-soft: #eff6ff;
    --feature-accent-border: rgba(15, 108, 191, 0.22);
    --feature-accent-border-soft: rgba(15, 108, 191, 0.12);
    --feature-accent-shadow: rgba(15, 108, 191, 0.22);
    --feature-accent-text: #0c4a6e;
    --feature-accent-muted: #075985;
}
.feature-setting__card,
.atools-setting__card {
    border: 1px solid var(--feature-accent-border);
    border-radius: 1rem;
    background:
        linear-gradient(165deg, var(--feature-accent-soft) 0%, #fff 38%, #fff 100%);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
    overflow: hidden;
    padding: 1.25rem 1.35rem 1.15rem;
}
.feature-setting__card.is-disabled,
.atools-setting__card.is-disabled {
    border-color: var(--border);
    background: linear-gradient(180deg, #f8fafc 0%, #fff 55%);
    box-shadow: var(--shadow);
}
.feature-setting__header,
.atools-setting__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
}
.feature-setting__intro,
.atools-setting__intro {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    min-width: 0;
}
.feature-setting__icon,
.atools-setting__icon {
    width: 2.85rem;
    height: 2.85rem;
    border-radius: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.15rem;
    color: #fff;
    background: linear-gradient(135deg, var(--feature-accent), var(--feature-accent-2));
    box-shadow: 0 8px 18px var(--feature-accent-shadow);
}
.feature-setting__card.is-disabled .feature-setting__icon,
.atools-setting__card.is-disabled .atools-setting__icon {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    box-shadow: none;
}
.feature-setting__titles,
.atools-setting__titles { min-width: 0; }
.feature-setting__title-row,
.atools-setting__title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 0.3rem;
}
.feature-setting__title,
.atools-setting__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}
.feature-setting__subtitle,
.atools-setting__subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.45;
    max-width: 40rem;
}
.feature-setting__badge,
.atools-setting__badge {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
}
.feature-setting__badge[data-state="off"],
.atools-setting__badge[data-state="off"] {
    background: #f1f5f9;
    color: #64748b;
}
.feature-setting__switch,
.atools-setting__switch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    padding: 0.35rem 0.55rem;
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--feature-accent-border-soft);
}
.feature-setting__card.is-disabled .feature-setting__switch,
.atools-setting__card.is-disabled .atools-setting__switch {
    border-color: var(--border);
    background: #f8fafc;
}
.feature-setting__switch-label,
.atools-setting__switch-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.feature-setting__card.is-enabled .feature-setting__switch-label,
.atools-setting__card.is-enabled .atools-setting__switch-label {
    color: var(--feature-accent);
}
.feature-setting__chips {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.feature-setting__chips li {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--feature-accent-border-soft);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--feature-accent-text);
}
.feature-setting__chips li i {
    color: var(--feature-accent);
    font-size: 0.75rem;
}
.feature-setting__chips li.is-muted {
    color: var(--text-muted);
    border-color: var(--border);
    background: #f8fafc;
}
.feature-setting__chips li.is-muted i { color: #94a3b8; }
.feature-setting__card.is-disabled .feature-setting__chips li {
    color: var(--text-muted);
    border-color: var(--border);
    background: #f8fafc;
}
.feature-setting__card.is-disabled .feature-setting__chips li i { color: #94a3b8; }
.feature-setting__footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--feature-accent-border-soft);
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.feature-setting__card.is-disabled .feature-setting__footer {
    border-top-color: var(--border);
}
.feature-setting__footer i { color: var(--feature-accent); }
.feature-setting__card.is-disabled .feature-setting__footer i { color: #94a3b8; }
.feature-setting__notice,
.atools-setting__notice {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.9rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    background: var(--feature-accent-soft);
    border: 1px solid var(--feature-accent-border);
    color: var(--feature-accent-text);
}
.feature-setting__notice i,
.atools-setting__notice i {
    margin-top: 0.15rem;
    color: var(--feature-accent);
}
.feature-setting__notice p,
.atools-setting__notice p {
    margin: 0.2rem 0 0;
    font-size: 0.875rem;
    color: var(--feature-accent-muted);
}

.academic-tools-picker {
    margin: 0.85rem 0 0;
    padding: 0;
    border: none;
    min-width: 0;
}
.academic-tools-picker.is-muted { opacity: 0.72; }

.atools-setting { width: 100%; }
.atools-setting__header {
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--feature-accent-border-soft);
}
.atools-setting__card.is-disabled .atools-setting__header {
    border-bottom-color: var(--border);
}
.atools-setting__picker { margin: 1.1rem 0 0; }
.atools-setting__picker-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.85rem 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.atools-setting__picker-titles {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.atools-setting__picker-legend {
    padding: 0;
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text);
}
.atools-setting__picker-count {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--feature-accent);
}
.atools-setting__card.is-disabled .atools-setting__picker-count {
    color: var(--text-muted);
}
.atools-setting__search {
    position: relative;
    flex: 1 1 12rem;
    max-width: 18rem;
    min-width: 10rem;
}
.atools-setting__search > .fa-magnifying-glass {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.8125rem;
}
.atools-setting__search-input {
    width: 100%;
    padding: 0.55rem 0.85rem 0.55rem 2.15rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    font-size: 0.875rem;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.atools-setting__search-input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--feature-accent) 45%, white);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--feature-accent) 16%, transparent);
}
.atools-setting__search-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin: 0.35rem 0 0;
    padding: 1rem 0.75rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: #f8fafc;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.atools-setting__search-empty[hidden] { display: none; }
.atools-setting__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
}
.atools-setting__tool {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.atools-setting__tool:hover {
    border-color: var(--feature-accent-border);
}
.atools-setting__tool.is-selected {
    border-color: var(--feature-accent-border);
    background: linear-gradient(180deg, var(--feature-accent-soft) 0%, #fff 100%);
    box-shadow: 0 0 0 1px var(--feature-accent-border-soft);
}
.atools-setting__tool.is-tool-disabled { opacity: 0.7; }
.atools-setting__tool-main {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    min-width: 0;
}
.atools-setting__checkbox {
    margin-top: 0.4rem;
    flex-shrink: 0;
    accent-color: var(--feature-accent);
    width: 1.05rem;
    height: 1.05rem;
}
.atools-setting__tool-icon {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--feature-accent-soft);
    color: var(--feature-accent);
    font-size: 1rem;
}
.atools-setting__card.is-disabled .atools-setting__tool-icon {
    background: #e2e8f0;
    color: #94a3b8;
}
.atools-setting__tool-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.atools-setting__tool-name {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}
.atools-setting__tool-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.atools-setting__ai {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-left: 3.35rem;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    background: var(--feature-accent-soft);
    border: 1px solid var(--feature-accent-border-soft);
    cursor: pointer;
    user-select: none;
    width: fit-content;
}
.atools-setting__ai-checkbox {
    flex-shrink: 0;
    accent-color: var(--feature-accent);
}
.atools-setting__ai-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--feature-accent);
}
.atools-setting__ai-label i { font-size: 0.7rem; }
.atools-setting__tool.is-tool-disabled .atools-setting__ai {
    background: #f1f5f9;
    border-color: var(--border);
}
.atools-setting__tool.is-tool-disabled .atools-setting__ai-label {
    color: var(--text-muted);
}
.atools-setting__fallback {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.atools-setting__fallback li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.atools-setting__fallback li i { color: var(--feature-accent); }
.atools-setting__footnote {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    margin: 1rem 0 0;
    padding-top: 0.9rem;
    border-top: 1px solid var(--feature-accent-border-soft);
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.atools-setting__card.is-disabled .atools-setting__footnote {
    border-top-color: var(--border);
}
.atools-setting__footnote i {
    margin-top: 0.15rem;
    color: #94a3b8;
}
@media (max-width: 768px) {
    .feature-setting__header,
    .atools-setting__header {
        flex-direction: column;
    }
    .feature-setting__switch,
    .atools-setting__switch {
        flex-direction: row;
        align-items: center;
        width: 100%;
        justify-content: space-between;
        padding: 0.65rem 0.75rem;
    }
    .atools-setting__ai { margin-left: 0; }
}

.toggle-switch {
    position: relative; display: inline-flex; flex-shrink: 0; cursor: pointer;
}
.toggle-switch input {
    position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
.toggle-switch__track {
    display: block; width: 2.75rem; height: 1.5rem; border-radius: 999px;
    background: #cbd5e1; transition: background 0.2s ease; position: relative;
}
.toggle-switch--lg .toggle-switch__track { width: 3.25rem; height: 1.75rem; }
.toggle-switch__track::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 1.25rem; height: 1.25rem;
    border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
    transition: transform 0.2s ease;
}
.toggle-switch--lg .toggle-switch__track::after { width: 1.45rem; height: 1.45rem; top: 2px; left: 2px; }
.toggle-switch input:checked + .toggle-switch__track { background: var(--feature-accent, var(--primary)); }
.toggle-switch input:checked + .toggle-switch__track::after { transform: translateX(1.25rem); }
.toggle-switch--lg input:checked + .toggle-switch__track::after { transform: translateX(1.5rem); }
.toggle-switch input:focus-visible + .toggle-switch__track {
    outline: 2px solid var(--feature-accent, var(--primary));
    outline-offset: 2px;
}
.practice-password-dialog {
    border: none; border-radius: var(--radius-lg); padding: 0;
    max-width: 26rem; width: min(26rem, calc(100vw - 2rem)); box-shadow: var(--shadow-lg);
}
.practice-password-form { padding: 1.5rem; position: relative; }
.practice-password-icon {
    width: 2.75rem; height: 2.75rem; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: #ccfbf1; color: #0f766e; font-size: 1.15rem;
    margin-bottom: 0.75rem;
}
.practice-password-header {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem;
    margin-bottom: 0.5rem; padding-right: 1.5rem;
}
.practice-password-header h3 { margin: 0; font-size: 1.1rem; }
.practice-password-close {
    position: absolute; top: 1rem; right: 1rem;
    border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 1.1rem;
}
.practice-password-message { font-size: 0.9rem; color: var(--ink-2); margin-bottom: 1rem; line-height: 1.5; }
.practice-password-footer {
    display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.25rem;
}
@media (max-width: 768px) {
    .practice-setting-card__body { grid-template-columns: 1fr; }
    .practice-setting-card__icon { display: none; }
    .practice-setting-card__control {
        flex-direction: row; justify-content: space-between;
        width: 100%; padding-top: 0.5rem; border-top: 1px solid var(--border);
    }
    .practice-setting-card__head { flex-direction: column; gap: 0.5rem; }
}
.course-lesson-practice { margin-bottom: 0.75rem; }
.course-builder-btn--ai { border-color: #0d9488; color: #0f766e; }

/* AI quiz builder */
.ai-quiz-builder-page { max-width: 1100px; }

.ai-builder-hero {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.25rem;
    align-items: start;
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-lg, 12px);
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 45%, #faf5ff 100%);
    border: 1px solid #ddd6fe;
}
.ai-builder-hero__icon {
    width: 3rem;
    height: 3rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}
.ai-builder-hero__eyebrow {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6d28d9;
    margin: 0 0 0.35rem;
}
.ai-builder-hero__title {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: var(--ink);
}
.ai-builder-hero__desc {
    margin: 0;
    color: var(--ink-2);
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 52ch;
}
.ai-builder-hero__back { align-self: start; white-space: nowrap; }

.ai-builder-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    align-items: start;
}
.ai-builder-main { display: flex; flex-direction: column; gap: 1.25rem; }

.ai-builder-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
}
.ai-builder-card__head {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.25rem 1.5rem 0;
}
.ai-builder-card__head h3 {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
    font-weight: 700;
}
.ai-builder-card__head p { margin: 0; font-size: 0.875rem; }
.ai-builder-card__body { padding: 1.25rem 1.5rem 1.5rem; }

.ai-builder-step-num {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #ede9fe;
    color: #6d28d9;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-field { display: block; margin-bottom: 1rem; }
.ai-field:last-child { margin-bottom: 0; }
.ai-field--grow { flex: 1; }
.ai-field__label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.4rem;
    color: var(--ink);
}
.ai-field__hint { font-weight: 400; color: var(--ink-3); }
.ai-field__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.ai-field .required { color: #dc2626; }

.ai-source-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.ai-source-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    background: var(--surface);
}
.ai-source-card input { position: absolute; opacity: 0; pointer-events: none; }
.ai-source-card:hover { border-color: #c4b5fd; background: #faf5ff; }
.ai-source-card.is-selected {
    border-color: #7c3aed;
    background: #f5f3ff;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
.ai-source-card__icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
    background: #ede9fe;
    color: #6d28d9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
.ai-source-card.is-selected .ai-source-card__icon {
    background: #7c3aed;
    color: #fff;
}
.ai-source-card__title { font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.ai-source-card__desc { font-size: 0.78rem; color: var(--ink-3); line-height: 1.4; }

.ai-source-panel__note {
    display: flex;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: #0369a1;
    line-height: 1.45;
}
.ai-source-panel__note i { margin-top: 0.15rem; flex-shrink: 0; }

.ai-upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
    background: var(--surface-alt, #f9fafb);
}
.ai-upload-zone.is-dragover,
.ai-upload-zone:hover { border-color: #a78bfa; background: #faf5ff; }
.ai-upload-zone.has-file { padding: 0; border-style: solid; }
.ai-upload-zone__inner i { font-size: 2rem; color: #7c3aed; margin-bottom: 0.5rem; }
.ai-upload-zone__inner p { margin: 0 0 0.35rem; }
.ai-upload-browse {
    background: none;
    border: none;
    padding: 0;
    color: #7c3aed;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    font: inherit;
}
.ai-upload-file {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #f5f3ff;
}
.ai-upload-file i { font-size: 1.5rem; color: #6d28d9; }
.ai-upload-file span { flex: 1; font-weight: 500; text-align: left; word-break: break-all; }
.ai-upload-clear {
    background: none;
    border: none;
    color: var(--ink-3);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 4px;
}
.ai-upload-clear:hover { background: rgba(0,0,0,0.06); color: var(--ink); }

.ai-config-row { margin-bottom: 1rem; }
.ai-count-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.ai-count-btn {
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--ink);
    line-height: 1;
}
.ai-count-btn:hover { background: var(--surface-alt); border-color: #c4b5fd; }
.ai-count-input {
    width: 4rem;
    text-align: center;
    font-weight: 600;
}
.ai-count-slider {
    width: 100%;
    accent-color: #7c3aed;
}

.ai-count-picker {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}
.ai-count-picker__hint {
    margin: -0.1rem 0 0.75rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}
.ai-count-presets {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.65rem;
}
.ai-count-preset {
    display: grid;
    gap: 0.15rem;
    min-height: 68px;
    padding: 0.7rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface);
    color: var(--text);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.15s;
}
.ai-count-preset:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}
.ai-count-preset.is-selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 12%, transparent);
}
.ai-count-preset strong {
    font-size: 1.15rem;
    line-height: 1.1;
}
.ai-count-preset span {
    color: var(--text-muted);
    font-size: 0.68rem;
}
.ai-count-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.8rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--surface-2);
    font-size: 0.8rem;
    font-weight: 700;
}
.ai-count-custom .ai-count-input {
    width: 6rem;
    margin: 0;
}

.ai-difficulty-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ai-difficulty-pill {
    cursor: pointer;
}
.ai-difficulty-pill input { position: absolute; opacity: 0; pointer-events: none; }
.ai-difficulty-pill span {
    display: block;
    padding: 0.45rem 1rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
}
.ai-difficulty-pill:hover span { border-color: #c4b5fd; background: #faf5ff; }
.ai-difficulty-pill.is-selected span {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
}

.ai-type-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.ai-type-chip {
    cursor: pointer;
}
.ai-type-chip input { position: absolute; opacity: 0; pointer-events: none; }
.ai-type-chip span,
.ai-type-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s;
    background: var(--surface);
}
.ai-type-chip i { color: var(--ink-3); font-size: 0.9rem; }
.ai-type-chip:hover { border-color: #c4b5fd; }
.ai-type-chip.is-selected {
    border-color: #7c3aed;
    background: #f5f3ff;
    color: #5b21b6;
}
.ai-type-chip.is-selected i { color: #7c3aed; }
.ai-builder-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 1rem;
}
.ai-builder-preview h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--ink-2);
}
.ai-builder-preview h3 i { color: #7c3aed; }
.ai-preview-list { margin: 0; }
.ai-preview-list > div {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
.ai-preview-list > div:last-child { border-bottom: none; }
.ai-preview-list dt {
    font-weight: 600;
    color: var(--ink-3);
    margin: 0;
}
.ai-preview-list dd { margin: 0; color: var(--ink); word-break: break-word; }

.ai-builder-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.ai-generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    border: none;
}
.ai-generate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #6d28d9, #5b21b6);
}
.ai-generate-btn:disabled { opacity: 0.65; cursor: not-allowed; }
.ai-builder-footnote {
    font-size: 0.78rem;
    line-height: 1.45;
    margin: 0;
    display: flex;
    gap: 0.4rem;
    align-items: flex-start;
}
.ai-builder-footnote i { margin-top: 0.1rem; color: #7c3aed; }

.ai-builder-progress {
    display: block;
    padding: 1rem;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    border-radius: var(--radius);
}
.ai-builder-progress[hidden] { display: none !important; }
.ai-builder-progress__content {
    display: grid; grid-template-columns: 2rem 1fr auto; align-items: center; gap: 0.65rem;
}
.ai-builder-progress__icon {
    display: grid; place-items: center; width: 2rem; height: 2rem;
    border-radius: 50%; background: #ede9fe; color: #7c3aed;
}
.ai-builder-progress__percent {
    color: #6d28d9; font-size: 0.78rem; font-weight: 750; font-variant-numeric: tabular-nums;
}
.ai-builder-progress__track {
    height: 0.5rem; margin-top: 0.8rem; overflow: hidden;
    border-radius: 999px; background: #ddd6fe;
}
.ai-builder-progress__bar {
    display: block; width: 0; height: 100%; border-radius: inherit;
    background: linear-gradient(90deg, #8b5cf6, #6d28d9);
    transition: width 0.35s ease;
}
.ai-builder-progress strong { display: block; margin-bottom: 0.2rem; }
.ai-builder-progress p { margin: 0; font-size: 0.85rem; }
.ai-builder-progress.is-error {
    background: #fef2f2;
    border-color: #fca5a5;
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.1);
}
.ai-builder-progress.is-error .ai-builder-progress__icon {
    background: #fee2e2;
    color: #dc2626;
}
.ai-builder-progress.is-error strong {
    color: #991b1b;
    font-size: 0.95rem;
}
.ai-builder-progress.is-error p {
    color: #b91c1c;
    font-weight: 500;
}
.ai-builder-progress.is-success {
    background: #ecfdf5;
    border-color: #a7f3d0;
}
.ai-builder-progress.is-success .ai-builder-progress__icon {
    background: #d1fae5;
    color: #047857;
}
.ai-builder-progress.is-success strong {
    color: #065f46;
}

@media (max-width: 900px) {
    .ai-builder-layout { grid-template-columns: 1fr; }
    .ai-builder-sidebar { position: static; order: -1; }
    .ai-source-cards { grid-template-columns: 1fr; }
    .ai-builder-hero {
        grid-template-columns: 1fr;
    }
    .ai-builder-hero__icon { display: none; }
    .ai-builder-hero__back { justify-self: start; }
}

/* Unified focused AI quiz workspace */
.ai-quiz-builder-page {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto 2rem;
}
.ai-builder-hero {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.9rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1.1rem 1.2rem;
    border-color: #cddff1;
    border-radius: 1rem;
    background: linear-gradient(135deg, #f8fbff 0%, #eef6fd 100%);
}
.ai-builder-hero__icon {
    width: 3.1rem;
    height: 3.1rem;
    border-radius: 0.9rem;
    background: linear-gradient(135deg, var(--primary), #0f8fa8);
    font-size: 1.1rem;
    box-shadow: 0 6px 16px rgba(15, 108, 191, 0.22);
}
.ai-builder-hero__eyebrow {
    margin-bottom: 0.2rem;
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.07em;
}
.ai-builder-hero__title {
    margin-bottom: 0.18rem;
    color: #102a43;
    font-size: 1.45rem;
    font-weight: 800;
}
.ai-builder-hero__desc {
    max-width: 64ch;
    color: var(--text-muted);
    font-size: 0.84rem;
}
.ai-builder-hero__back {
    align-self: center;
    border-color: #c4d8e9;
    background: rgba(255, 255, 255, 0.8);
}
.ai-builder-layout {
    grid-template-columns: minmax(0, 1fr) 16rem;
    gap: 1rem;
}
.ai-builder-main {
    gap: 0.85rem;
}
.ai-builder-card {
    border-radius: 1rem;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
}
.ai-builder-card__head {
    gap: 0.7rem;
    padding: 1.15rem 1.15rem 0;
}
.ai-builder-card__head h3 {
    color: #183b5b;
    font-size: 0.98rem;
}
.ai-builder-card__head p {
    color: var(--text-muted);
    font-size: 0.77rem;
}
.ai-builder-card__body {
    padding: 0.9rem 1.15rem 1.15rem;
}
.ai-builder-step-num {
    width: 1.7rem;
    height: 1.7rem;
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
}
.ai-builder-details-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(13rem, 0.58fr);
    gap: 0.8rem;
}
.ai-builder-details-grid .ai-field {
    margin: 0;
}
.ai-field__label {
    color: var(--ink-1);
    font-size: 0.78rem;
    font-weight: 700;
}
.ai-source-cards {
    gap: 0.65rem;
}
.ai-source-card {
    min-height: 8.4rem;
    gap: 0.28rem;
    padding: 0.8rem;
    border: 1px solid #d6e0ea;
    border-radius: 0.8rem;
    background: #fff;
}
.ai-source-card:hover {
    border-color: #9fc4e5;
    background: #f8fbff;
}
.ai-source-card.is-selected {
    border-color: var(--primary);
    background: #f0f7fd;
    box-shadow: inset 0 0 0 1px rgba(15, 108, 191, 0.12), 0 3px 10px rgba(15, 108, 191, 0.08);
}
.ai-source-card::after {
    content: "\f058";
    position: absolute;
    top: 0.72rem;
    right: 0.72rem;
    color: var(--primary);
    font: var(--fa-font-solid);
    opacity: 0;
    transform: scale(0.75);
    transition: opacity 0.15s, transform 0.15s;
}
.ai-source-card.is-selected::after {
    opacity: 1;
    transform: scale(1);
}
.ai-source-card:focus-within,
.ai-difficulty-pill:focus-within,
.ai-type-chip:focus-within {
    outline: 3px solid rgba(15, 108, 191, 0.2);
    outline-offset: 2px;
}
.ai-source-card__icon {
    background: #edf4fa;
    color: #52708d;
}
.ai-source-card.is-selected .ai-source-card__icon {
    background: #dceefe;
    color: var(--primary);
}
.ai-source-card__title {
    color: var(--ink-1);
    font-size: 0.84rem;
}
.ai-source-card__desc {
    color: var(--text-muted);
    font-size: 0.7rem;
}
.ai-source-panel__note {
    border-color: #c7deef;
    background: #f4f9fd;
    color: #315c7e;
    font-size: 0.76rem;
}
.ai-upload-zone {
    overflow: hidden;
    padding: 1.4rem;
    border-color: #8ab7de;
    border-radius: 0.9rem;
    background: linear-gradient(180deg, #fafdff, #f3f9ff);
}
.ai-upload-zone.is-dragover,
.ai-upload-zone:hover {
    border-color: var(--primary);
    background: #edf7ff;
    box-shadow: 0 0 0 4px rgba(15, 108, 191, 0.08);
}
.ai-upload-zone__inner i {
    color: var(--primary);
}
.ai-upload-browse {
    color: var(--primary);
}
.ai-upload-file {
    background: #edf9f6;
}
.ai-upload-file i {
    color: #0f766e;
}
.ai-config-body {
    display: grid;
    grid-template-columns: minmax(0, 0.72fr) minmax(0, 1fr);
    gap: 1rem;
}
.ai-config-body .ai-config-row {
    margin: 0;
}
.ai-config-body > .ai-field {
    margin: 0;
}
.ai-config-body > .ai-field:last-child {
    grid-column: 1 / -1;
}
.ai-count-btn:hover {
    border-color: var(--primary);
    background: #f0f7fd;
}
.ai-count-slider {
    accent-color: var(--primary);
}
.ai-difficulty-pill:hover span {
    border-color: #9fc4e5;
    background: #f8fbff;
}
.ai-difficulty-pill.is-selected span {
    border-color: var(--primary);
    background: var(--primary);
}
.ai-type-chip:hover {
    border-color: #9fc4e5;
}
.ai-type-chip.is-selected {
    border-color: var(--primary);
    background: #f0f7fd;
    color: var(--primary-dark);
}
.ai-type-chip.is-selected i {
    color: var(--primary);
}
.ai-allocation-mode {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    margin: 0.65rem 0 0.85rem;
}
.ai-allocation-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    cursor: pointer;
}
.ai-allocation-option.is-selected { border-color: var(--primary); background: var(--primary-light); }
.ai-allocation-option span { display: flex; flex-direction: column; }
.ai-allocation-option strong { font-size: 0.82rem; }
.ai-allocation-option small { color: var(--text-muted); font-size: 0.7rem; }
.ai-type-config-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}
.ai-type-config-card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    background: var(--surface);
}
.ai-type-config-card.is-selected { border-color: #9fc4e5; }
.ai-type-config-card .ai-type-chip {
    width: 100%;
    border: 0;
    border-radius: 0;
}
.ai-type-config-card__options {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}
.ai-type-config-card__options[hidden] { display: none; }
.ai-type-option { display: flex; flex: 1; align-items: center; gap: 0.45rem; font-size: 0.72rem; color: var(--text-muted); }
.ai-type-option .form-control { width: 4.5rem; min-height: 2rem; padding: 0.3rem 0.45rem; }
.ai-type-option--check { color: var(--text); }
.is-random-allocation .ai-type-count-option { display: none; }
.ai-type-total { margin: 0.65rem 0 0; font-size: 0.75rem; text-align: right; }
@media (max-width: 700px) {
    .ai-allocation-mode,
    .ai-type-config-grid { grid-template-columns: 1fr; }
}
.ai-builder-sidebar {
    gap: 0.75rem;
}
.ai-builder-preview,
.ai-builder-actions {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    background: #fff;
    box-shadow: none;
}
.ai-builder-sidebar__eyebrow {
    display: block;
    margin-bottom: 0.18rem;
    color: var(--primary);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}
.ai-builder-preview h3 {
    margin-bottom: 0.75rem;
    color: var(--ink-1);
    font-size: 0.88rem;
}
.ai-builder-preview h3 i {
    color: var(--primary);
}
.ai-preview-list > div {
    grid-template-columns: 4.6rem 1fr;
    padding: 0.42rem 0;
    font-size: 0.74rem;
}
.ai-builder-actions__intro {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.ai-builder-actions__icon {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 0.6rem;
    background: #dceefe;
    color: var(--primary);
}
.ai-builder-actions__intro > div {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.ai-builder-actions__intro strong {
    color: var(--ink-1);
    font-size: 0.78rem;
}
.ai-builder-actions__intro small {
    color: var(--text-muted);
    font-size: 0.66rem;
    line-height: 1.35;
}
.ai-generate-btn {
    padding: 0.72rem 0.85rem;
    background: linear-gradient(135deg, var(--primary), #0f8fa8);
    font-size: 0.88rem;
    box-shadow: 0 5px 14px rgba(15, 108, 191, 0.18);
}
.ai-generate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark), #0e7490);
}
.ai-builder-footnote i {
    color: var(--primary);
}
.ai-builder-progress {
    border-color: #cddff1;
    border-radius: 0.9rem;
    background: #f5faff;
}
.ai-builder-progress__icon {
    background: #dceefe;
    color: var(--primary);
}
.ai-builder-progress__percent {
    color: var(--primary-dark);
}
.ai-builder-progress__track {
    background: #dce8f3;
}
.ai-builder-progress__bar {
    background: linear-gradient(90deg, var(--primary), #0f8fa8);
}
.ai-builder-progress.is-error {
    background: #fef2f2;
    border-color: #fca5a5;
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.1);
}
.ai-builder-progress.is-error .ai-builder-progress__icon {
    background: #fee2e2;
    color: #dc2626;
}
.ai-builder-progress.is-error strong {
    color: #991b1b;
}
.ai-builder-progress.is-error p {
    color: #b91c1c;
    font-weight: 500;
}
.ai-builder-progress.is-success {
    background: #ecfdf5;
    border-color: #a7f3d0;
}
.ai-builder-progress.is-success .ai-builder-progress__icon {
    background: #d1fae5;
    color: #047857;
}

@media (max-width: 980px) {
    .ai-builder-layout {
        grid-template-columns: minmax(0, 1fr);
    }
    .ai-builder-sidebar {
        position: static;
        order: initial;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .ai-builder-progress {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .ai-builder-hero {
        grid-template-columns: auto minmax(0, 1fr);
        padding: 0.9rem;
    }
    .ai-builder-hero__icon {
        display: flex;
        width: 2.6rem;
        height: 2.6rem;
    }
    .ai-builder-hero__title {
        font-size: 1.18rem;
    }
    .ai-builder-hero__back {
        grid-column: 1 / -1;
        justify-self: stretch;
    }
    .ai-builder-card__head {
        padding: 0.95rem 0.95rem 0;
    }
    .ai-builder-card__body {
        padding: 0.8rem 0.95rem 0.95rem;
    }
    .ai-builder-details-grid,
    .ai-config-body,
    .ai-builder-sidebar,
    .ai-source-cards {
        grid-template-columns: minmax(0, 1fr);
    }
    .ai-config-body > .ai-field:last-child,
    .ai-builder-progress {
        grid-column: auto;
    }
    .ai-source-card {
        min-height: 0;
    }
}

/* Library toolbar (shared resources-* class names) */
.resources-toolbar--enhanced {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    align-items: stretch;
    padding: 0.9rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.25rem;
}
.resources-toolbar-main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}
.resources-search { position: relative; flex: 1 1 18rem; min-width: 12rem; }
.resources-search i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.85rem;
}
.resources-search-input {
    width: 100%;
    padding: 0.6rem 0.85rem 0.6rem 2.35rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    font-size: 0.9rem;
    color: var(--text);
}
.resources-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.15);
    background: var(--surface);
}
.resources-toolbar-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.resources-toolbar-actions .resources-create-form { display: inline-flex; }

.resources-view-toggle {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.resources-view-btn {
    width: 2.1rem;
    height: 2.1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
}
.resources-view-btn:hover { color: var(--text); }
.resources-view-btn.is-active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

.resources-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
}
.resources-chip { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--text-muted); }
.resources-chip > span { font-weight: 600; }
.resources-chip-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 0.4rem 1.9rem 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background-color: var(--surface-2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236a737b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 0.7rem;
    font-size: 0.8rem;
    color: var(--text);
    cursor: pointer;
}
.resources-chip-select:hover { border-color: var(--primary); }
.resources-chip-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.15); }
.resources-filter-clear {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--danger);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 600;
}
.resources-filter-clear:hover { text-decoration: underline; color: var(--danger); }

@media (max-width: 720px) {
    .resources-toolbar-main { flex-direction: column; align-items: stretch; }
    .resources-search { flex: 1 1 auto; min-width: 0; }
    .resources-toolbar-actions { width: 100%; }
    .resources-toolbar-actions .resources-create-form { flex: 1; }
    .resources-toolbar-actions .resources-create-form .btn { width: 100%; justify-content: center; }
    .resources-filters { gap: 0.5rem; }
}
@media (max-width: 480px) {
    .resources-toolbar-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .resources-view-toggle { align-self: flex-start; }
}

/* User profile extended forms */
.admin-form-card--profile .panel h2 { margin-bottom: 1.25rem; }
.form-section {
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}
.form-section:last-of-type { border-bottom: none; padding-bottom: 0; }
.form-section-title {
    font-size: 0.9375rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: var(--ink-2);
}
.form-section--optional .form-section-title { font-weight: 600; }
.form-row--3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.form-row--4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 900px) {
    .form-row--3, .form-row--4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
    .form-row--3, .form-row--4 { grid-template-columns: 1fr; }
}
.checkbox-label, .radio-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    cursor: pointer;
}
.radio-row { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.radio-row fieldset { border: none; padding: 0; margin: 0; }
.transferee-fields { display: none; margin-top: 1rem; }
.transferee-fields.is-visible { display: block; }
.required { color: var(--danger); }

/* Student curriculum progress on profile */
.student-curriculum-panel { margin-top: 1.25rem; }
.student-curriculum-intro { margin: 0 0 1rem; max-width: 42rem; }
.student-curriculum-app { margin-top: 0.5rem; }
.student-curriculum-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin: 0.75rem 0 0;
    font-size: 0.8125rem;
}
.student-subject-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    font-size: 0.75rem;
    white-space: nowrap;
}
.student-subject-status--in_progress { color: var(--primary); }
.student-subject-status--ready_to_pass { color: var(--warning); }
.student-subject-status--completed { color: var(--success); }
.student-subject-status--not_enrolled { color: var(--text-muted); }
.student-subject-progress-count { font-weight: 500; opacity: 0.85; }
.program-subject-table--progress td { vertical-align: middle; }
.student-subject-row--completed { background: rgba(53, 122, 50, 0.04); }
.student-subject-row--ready_to_pass { background: rgba(166, 103, 14, 0.05); }

/* Gradebook passed column */
.gb-table__pass-col { width: 5.5rem; text-align: center; }
.gb-pass-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}
.gb-pass-toggle.is-disabled { opacity: 0.45; cursor: not-allowed; }
.gb-pass-toggle input { margin: 0; }

/* =========================================================================
   User Import Wizard
   ========================================================================= */

/* Wizard shell */
.import-wizard { max-width: 100%; width: 100%; min-width: 0; }
.import-wizard .panel { min-width: 0; overflow: visible; }

/* Step indicator */
.wizard-nav { margin-bottom: 1.5rem; }
.wizard-steps {
    display: flex;
    list-style: none;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    padding: 0;
}
.wizard-step {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    border-right: 1px solid var(--border);
    cursor: default;
    position: relative;
    transition: background 0.15s;
}
.wizard-step:last-child { border-right: none; }
.step-num {
    width: 1.5rem; height: 1.5rem;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.wizard-step.active { background: var(--primary-light); color: var(--primary-dark); }
.wizard-step.active .step-num { background: var(--primary); color: #fff; }
.wizard-step.done { color: var(--success); }
.wizard-step.done .step-num { background: var(--success); color: #fff; }

/* Panel */
.wizard-panel.hidden { display: none; }
.panel { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 1.75rem 2rem; box-shadow: var(--shadow); }
.panel-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 1.25rem; color: var(--text); }

/* Wizard form fields */
.wizard-field-row { margin-bottom: 1.5rem; }
.wizard-field-label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.6rem; color: var(--text); }
.wizard-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 1.5rem; flex-wrap: wrap; }

/* Radio options */
.radio-group { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.radio-group--horizontal .radio-option { flex: 1; min-width: 220px; flex-direction: column; align-items: flex-start; gap: 0.25rem; }
.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    font-weight: 500;
}
.radio-option input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.radio-option:hover { border-color: var(--primary); background: var(--primary-light); }
.radio-option.selected { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }
.radio-hint { font-size: 0.8rem; font-weight: 400; color: var(--text-muted); display: block; }

/* Template cards */
.wizard-templates { margin-top: 0.25rem; }
.wizard-template-download {
    margin-top: 0;
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.35rem;
    border: 2px solid var(--primary);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--surface) 55%);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 4px 14px rgba(15, 108, 191, 0.12);
}
.wizard-template-download.hidden { display: none; }
.wizard-template-download__icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid rgba(15, 108, 191, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: #1d6f42;
    flex-shrink: 0;
}
.wizard-template-download__icon--sm {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.25rem;
}
.wizard-template-download__content { min-width: 0; }
.wizard-template-download__header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.35rem;
}
.wizard-template-download__title {
    font-size: 1.05rem;
    color: var(--primary-dark);
}
.wizard-template-download__badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.wizard-template-download__text {
    margin: 0 0 0.65rem;
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.45;
}
.wizard-template-download__steps {
    margin: 0;
    padding-left: 1.15rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.wizard-template-download__steps li + li { margin-top: 0.15rem; }
.wizard-template-download__action {
    flex-shrink: 0;
    align-self: center;
}
.wizard-template-download--compact {
    margin-top: 0;
    padding: 0.85rem 1rem;
    grid-template-columns: auto 1fr auto;
    gap: 0.85rem 1rem;
    border-width: 1px;
    box-shadow: none;
}
.wizard-template-download--compact .wizard-template-download__text {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
}
.wizard-template-download--compact .wizard-template-download__title {
    font-size: 0.95rem;
}
@media (max-width: 768px) {
    .wizard-template-download {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .wizard-template-download__icon { margin: 0 auto; }
    .wizard-template-download__header { justify-content: center; }
    .wizard-template-download__steps { text-align: left; }
    .wizard-template-download__action { width: 100%; }
    .wizard-template-download__action .btn { width: 100%; justify-content: center; }
}
.template-cards { display: flex; flex-direction: column; gap: 0.5rem; }
.template-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    transition: border-color 0.15s;
}
.template-card:hover { border-color: var(--primary); }
.template-card.selected { border-color: var(--primary); background: var(--primary-light); }
.template-card__icon { font-size: 1.25rem; color: var(--primary); width: 2rem; text-align: center; }
.template-card__info { flex: 1; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.875rem; }
.template-card__actions { display: flex; gap: 0.4rem; }

/* Dropzone */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: var(--surface-2);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: var(--primary-light); }
.dropzone__icon { font-size: 2.5rem; color: var(--primary); margin-bottom: 0.75rem; }
.dropzone__text { font-size: 0.95rem; color: var(--text); margin-bottom: 0.25rem; }
.dropzone__browse { color: var(--primary); font-weight: 600; cursor: pointer; text-decoration: underline; }
.dropzone__hint { font-size: 0.8rem; color: var(--text-muted); }

/* Upload progress */
.upload-progress { margin-top: 1rem; }
.upload-progress__bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.upload-progress__fill { height: 100%; background: var(--primary); transition: width 0.3s; border-radius: 3px; }
.upload-progress__label { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.4rem; }

/* Mapper layout */
.mapper-layout {
    min-width: 0;
    width: 100%;
    gap: 1.25rem;
}
.mapper-layout--bulk {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.mapper-layout--bulk .mapper-panel {
    width: 100%;
    flex-shrink: 0;
}
.mapper-layout--bulk .mapper-preview-block {
    width: 100%;
    min-width: 0;
}
.mapper-layout--side {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    gap: 1.25rem;
    align-items: start;
}
.mapper-layout--side .mapper-preview-block { order: 1; }
.mapper-layout--side .mapper-panel { order: 2; }
.mapper-layout--pdf {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 1rem;
    align-items: stretch;
    min-height: 520px;
}
.mapper-layout--pdf .mapper-preview-block {
    order: 1;
    min-height: 0;
    height: min(72vh, 680px);
    display: flex;
    flex-direction: column;
}
.mapper-layout--pdf .mapper-preview-block__head {
    display: none;
}
.mapper-layout--pdf .mapper-panel {
    order: 2;
    position: sticky;
    top: 0;
    align-self: start;
    max-height: min(72vh, 680px);
    overflow-y: auto;
}
.mapper-preview.mapper-preview--pdf {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
    background: transparent;
    border: none;
}
.mapper-preview-block {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.mapper-preview-block.hidden { display: none; }
.mapper-preview-block__head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
}
.mapper-preview-block__head h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}
.mapper-preview-block__hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.mapper-preview {
    min-width: 0;
    width: 100%;
}
.mapper-panel__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.mapper-panel__toolbar.hidden { display: none; }
.mapper-loading { display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); padding: 2rem 0; font-size: 0.9rem; }

/* Excel table */
.mapper-excel-wrap {
    overflow: auto;
    max-height: 340px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    -webkit-overflow-scrolling: touch;
}
.mapper-excel-table { border-collapse: collapse; font-size: 0.8rem; width: max-content; min-width: 100%; }
.mapper-excel-table td, .mapper-excel-table th {
    border: 1px solid var(--border);
    padding: 0.35rem 0.5rem;
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mapper-row-num { background: var(--surface-2); color: var(--text-muted); font-size: 0.75rem; text-align: center; width: 2rem; }
.excel-col-header {
    background: var(--surface-2);
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.12s;
    vertical-align: bottom;
    min-width: 72px;
    max-width: 120px;
}
.excel-col-header:hover { background: var(--primary-light); color: var(--primary-dark); }
.excel-col-header.mapped { background: #e8f5e9; border-bottom: 2px solid var(--success); }
.col-letter { display: block; font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.15rem; }
.col-header-name {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--ink-2);
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
    max-height: 2.5em;
    overflow: hidden;
}
.mapped-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.2rem;
    color: var(--success);
    font-size: 0.65rem;
}
.mapped-badge--compact {
    display: block;
    margin-top: 0.2rem;
    margin-left: 0;
    font-size: 0.62rem;
    padding: 0.1rem 0.3rem;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Excel sheet selector */
.excel-sheet-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 0;
}
.excel-sheet-bar.hidden { display: none; }
.excel-sheet-bar__label { font-weight: 600; font-size: 0.875rem; white-space: nowrap; flex-shrink: 0; }
.excel-sheet-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-width: 0;
    flex: 1;
}
.excel-sheet-tab {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s, color 0.12s;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.excel-sheet-tab:hover { border-color: var(--primary); color: var(--primary-dark); }
.excel-sheet-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.excel-sheet-bar__hint { font-size: 0.8rem; color: var(--text-muted); flex-shrink: 0; margin-left: auto; }

/* Manual column mapping */
.column-mapping-section { margin-bottom: 0.75rem; }
.column-mapping-section.hidden { display: none; }
.column-mapping-hint { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.column-mapping-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.65rem;
}
.mapper-layout--side .column-mapping-list {
    grid-template-columns: 1fr;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 0.25rem;
}
.column-mapping-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color 0.12s, background 0.12s;
    min-width: 0;
}
.column-mapping-row.is-mapped { border-color: var(--primary); background: var(--primary-light); }
.column-mapping-meta { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.column-mapping-col {
    font-family: monospace;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--bg);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    flex-shrink: 0;
}
.column-mapping-header {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.column-mapping-select { font-size: 0.82rem; padding: 0.35rem 0.5rem; }
.excel-header-row td { background: var(--primary-light); font-weight: 600; color: var(--ink-2); }
.excel-cell { cursor: pointer; position: relative; transition: background 0.1s; }
.excel-cell:hover { background: var(--primary-light); }
.excel-cell.mapped { background: #e6f4ea; }

/* Text line mapper */
.text-line-list { max-height: 460px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.text-line {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
    font-size: 0.85rem;
}
.text-line:last-child { border-bottom: none; }
.text-line:hover { background: var(--primary-light); }
.text-line.mapped { background: #e6f4ea; }
.text-line__page { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; padding-top: 0.1rem; min-width: 2rem; }
.text-line__content { flex: 1; line-height: 1.4; }

#previewLoading.hidden { display: none; }

.mapper-load-template {
    margin-bottom: 0.85rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2, #f8fafc);
}
.mapper-load-template__label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.mapper-load-template__row {
    display: flex;
    gap: 0.45rem;
    align-items: center;
}
.mapper-load-template__row .form-control { flex: 1; min-width: 0; }
.mapper-load-template__status {
    margin: 0.45rem 0 0;
    font-size: 0.8rem;
    color: var(--success, #15803d);
}
.mapper-load-template__extract {
    margin: 0.35rem 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.pdf-mapper-region {
    position: absolute;
    border: 2px dashed rgba(37, 99, 235, 0.75);
    background: rgba(37, 99, 235, 0.12);
    border-radius: 3px;
    pointer-events: none;
    z-index: 2;
}
.pdf-mapper-region__label {
    position: absolute;
    top: -1.1rem;
    left: 0;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    background: rgba(37, 99, 235, 0.9);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    white-space: nowrap;
}

/* PDF visual mapper */
.pdf-mapper {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
}
.pdf-mapper-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2, #f8fafc);
    font-size: 0.8125rem;
    flex-shrink: 0;
}
.pdf-mapper-toolbar__left,
.pdf-mapper-toolbar__right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}
.pdf-mapper-page-nav,
.pdf-mapper-zoom {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.pdf-mapper-icon-btn {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.pdf-mapper-icon-btn:hover:not(:disabled) {
    background: var(--primary-light);
    border-color: rgba(15, 108, 191, 0.35);
    color: var(--primary);
}
.pdf-mapper-icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.pdf-mapper-text-btn {
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}
.pdf-mapper-text-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: rgba(15, 108, 191, 0.35);
}
.pdf-mapper-toolbar__hint {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}
.pdf-mapper-toolbar__hint i { color: var(--primary); }
.pdf-mapper-toolbar__meta,
.pdf-mapper-zoom__label {
    color: var(--text);
    font-weight: 600;
    font-size: 0.78rem;
    min-width: 5.5rem;
    text-align: center;
}
.pdf-mapper-mapped {
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: var(--surface-muted, #eef2f7);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
}
.pdf-mapper-mapped.is-active {
    background: rgba(39, 174, 96, 0.14);
    color: #1e8449;
}
.pdf-mapper-viewport {
    flex: 1;
    min-height: 0;
    overflow: auto;
    background-color: #e8edf3;
    background-image:
        linear-gradient(45deg, rgba(148, 163, 184, 0.18) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(148, 163, 184, 0.18) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.18) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.18) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    padding: 1.25rem;
}
.pdf-mapper-stage-host {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100%;
}
.pdf-mapper-stage {
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 10px 32px rgba(15, 23, 42, 0.16);
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 2px;
    overflow: hidden;
    background: #fff;
}
.pdf-mapper-canvas {
    display: block;
    vertical-align: top;
}
.pdf-mapper-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.pdf-mapper-hit {
    position: absolute;
    margin: 0;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    cursor: pointer;
    pointer-events: auto;
    transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.pdf-mapper-hit:hover {
    background: rgba(15, 108, 191, 0.16);
    border-color: rgba(15, 108, 191, 0.55);
    box-shadow: inset 0 -2px 0 rgba(15, 108, 191, 0.65);
}
.pdf-mapper-hit.is-active {
    background: rgba(15, 108, 191, 0.22);
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px rgba(15, 108, 191, 0.35);
}
.pdf-mapper-hit.is-mapped {
    background: rgba(39, 174, 96, 0.2);
    border-color: rgba(39, 174, 96, 0.65);
    box-shadow: inset 0 -2px 0 rgba(39, 174, 96, 0.75);
}
.pdf-mapper-hit__badge {
    position: absolute;
    top: -1.15rem;
    left: 0;
    max-width: 10rem;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    background: #1e8449;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    z-index: 2;
}

/* Mapped badge */
.mapped-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    margin-left: 0.35rem;
    vertical-align: middle;
    white-space: nowrap;
}

/* Mapper panel */
.mapper-panel {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.15rem;
    min-width: 0;
}
.mapper-panel__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; gap: 0.5rem; flex-wrap: wrap; }
.mapper-panel__header h3 { font-size: 0.95rem; font-weight: 700; margin: 0; }
.mapper-panel__header-actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.mapper-option { font-size: 0.85rem; margin: 0; }

/* Mapping list */
.mapping-list { display: flex; flex-direction: column; gap: 0.4rem; }
.mapping-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
}
.mapping-source { font-family: monospace; font-size: 0.78rem; background: var(--bg); padding: 0.1rem 0.3rem; border-radius: 3px; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapping-arrow { color: var(--text-muted); font-size: 0.7rem; }
.mapping-field { flex: 1; font-weight: 600; font-size: 0.8rem; }
.mapping-field--required::after { content: ' *'; color: var(--danger); }
.mapping-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0.2rem; margin-left: auto; }
.mapping-remove:hover { color: var(--danger); }

/* Assign popup */
.assign-popup {
    position: fixed;
    z-index: 1200;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 320px;
    padding: 1rem;
}
.assign-popup.hidden { display: none; }
.assign-popup__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.assign-popup__close { background: none; border: none; font-size: 1.25rem; cursor: pointer; color: var(--text-muted); line-height: 1; padding: 0; }
.assign-popup__close:hover { color: var(--text); }
.assign-popup__source { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem; background: var(--bg); padding: 0.35rem 0.5rem; border-radius: var(--radius); word-break: break-all; }
.assign-popup__actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.input-error { border-color: var(--danger) !important; }
.form-control--sm { padding: 0.3rem 0.5rem; font-size: 0.82rem; }

/* Save template dialog */
.save-template-dialog {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
}
.save-template-dialog.hidden { display: none; }
.save-template-dialog__inner {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 420px;
    max-width: calc(100vw - 2rem);
    box-shadow: var(--shadow-lg);
}

/* Preview / import summary */
.import-summary { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.summary-item { display: flex; align-items: center; gap: 0.35rem; font-size: 0.875rem; font-weight: 600; }
.summary-item--ok { color: var(--success); }
.summary-item--warn { color: var(--warning); }
.summary-item--info { color: var(--primary); }
.import-summary-banner .alert { margin: 0; }
.row-error td { background: #fff5f5 !important; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.generated-pw { font-family: monospace; font-size: 0.85rem; background: var(--bg); padding: 0.15rem 0.4rem; border-radius: 3px; }

/* Import running */
.import-running { display: flex; align-items: center; gap: 0.75rem; padding: 2rem; font-size: 0.95rem; color: var(--text-muted); }
.import-running.hidden { display: none; }

/* Badges for import results */
.badge-warning { background: #fef3c7; color: #92400e; border-radius: 999px; padding: 0.15rem 0.5rem; font-size: 0.75rem; font-weight: 700; }
.badge-danger  { background: #fee2e2; color: #991b1b; border-radius: 999px; padding: 0.15rem 0.5rem; font-size: 0.75rem; font-weight: 700; }

/* Responsive */
@media (max-width: 992px) {
    .mapper-layout--side { grid-template-columns: 1fr; }
    .mapper-layout--side .mapper-preview-block { order: 2; }
    .mapper-layout--pdf { grid-template-columns: 1fr; }
    .mapper-layout--pdf .mapper-preview-block { order: 2; }
    .column-mapping-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
@media (max-width: 860px) {
    .wizard-steps { flex-wrap: wrap; }
    .wizard-step { min-width: 50%; border-bottom: 1px solid var(--border); }
    .column-mapping-list { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .panel { padding: 1.25rem 1rem; }
    .wizard-step { min-width: 100%; }
}

/* btn-danger-ghost */
.btn-danger-ghost {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}
.btn-danger-ghost:hover { background: var(--danger); color: #fff; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }

/* Academic Tools */
.academic-tools-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.academic-tools-search {
    position: relative;
    flex: 1 1 16rem;
    max-width: 28rem;
}
.academic-tools-search > .fa-magnifying-glass {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 0.875rem;
}
.academic-tools-search__input {
    width: 100%;
    padding: 0.7rem 1rem 0.7rem 2.4rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.9375rem;
    color: var(--text);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.academic-tools-search__input:focus {
    outline: none;
    border-color: rgba(15, 108, 191, 0.4);
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.12);
}
.academic-tools-toolbar__count {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
}
.academic-tools-search-empty {
    margin-top: 0.5rem;
}
.academic-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.academic-tool-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.academic-tool-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.academic-tool-card__icon {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light, #eff6ff);
    color: var(--primary);
    border-radius: var(--radius, 8px);
    font-size: 1.25rem;
}

.academic-tool-card__body {
    flex: 1;
    min-width: 0;
}

.academic-tool-card__title {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.academic-tool-card__desc {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.academic-tool-card__arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.academic-tool-card:hover .academic-tool-card__arrow {
    color: var(--primary);
}

.web-editor-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 3.5rem);
    min-height: 480px;
    position: relative;
    overflow: hidden;
}

.web-editor-shell--assistant-open {
    overflow: hidden;
}

.web-editor-toolbar__ai.is-active {
    border-color: #c4b5fd;
    background: #f5f3ff;
    color: #6d28d9;
}

.web-editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface, #fff);
    flex-shrink: 0;
}

.web-editor-toolbar__left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.web-editor-toolbar__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.web-editor-toolbar__actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.web-editor-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.web-editor-panes {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: auto;
    border-right: 1px solid var(--border);
}

.web-editor-pane {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    border-bottom: 1px solid var(--border);
}

.web-editor-pane:last-child {
    border-bottom: none;
}

.web-editor-pane__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.web-editor-pane__label {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.web-editor-pane__clear {
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface, #fff);
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.4;
    transition: border-color 0.15s, color 0.15s;
}

.web-editor-pane__clear:hover {
    border-color: var(--danger, #dc2626);
    color: var(--danger, #dc2626);
}

.web-editor-pane__editor {
    flex: 1;
    min-height: 8rem;
    overflow: hidden;
}

.web-editor-pane__editor .CodeMirror {
    height: 100%;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.web-editor-pane__editor .CodeMirror-scroll {
    min-height: 8rem;
}

.web-editor-pane__editor .CodeMirror-gutters {
    border-right: 1px solid var(--border);
    background: var(--bg);
}

.web-editor-pane__editor .CodeMirror-linenumber {
    color: #94a3b8;
    padding: 0 0.35rem 0 0;
}

/* HTML pane */
.web-editor-pane--html .CodeMirror {
    background: #f8fbff;
    color: #1e293b;
}

.web-editor-pane--html .cm-tag { color: #2563eb; font-weight: 600; }
.web-editor-pane--html .cm-bracket { color: #64748b; }
.web-editor-pane--html .cm-attribute { color: #7c3aed; }
.web-editor-pane--html .cm-string { color: #059669; }
.web-editor-pane--html .cm-comment { color: #94a3b8; font-style: italic; }
.web-editor-pane--html .cm-meta { color: #0d9488; }

/* CSS pane */
.web-editor-pane--css .CodeMirror {
    background: #fdfaff;
    color: #1e293b;
}

.web-editor-pane--css .cm-qualifier,
.web-editor-pane--css .cm-builtin { color: #7c3aed; }
.web-editor-pane--css .cm-property { color: #2563eb; }
.web-editor-pane--css .cm-atom { color: #059669; }
.web-editor-pane--css .cm-number { color: #d97706; }
.web-editor-pane--css .cm-string { color: #059669; }
.web-editor-pane--css .cm-keyword { color: #db2777; }
.web-editor-pane--css .cm-comment { color: #94a3b8; font-style: italic; }

/* JavaScript pane */
.web-editor-pane--js .CodeMirror {
    background: #fffdf5;
    color: #1e293b;
}

.web-editor-pane--js .cm-keyword { color: #7c3aed; font-weight: 600; }
.web-editor-pane--js .cm-def { color: #2563eb; }
.web-editor-pane--js .cm-variable { color: #1e293b; }
.web-editor-pane--js .cm-variable-2 { color: #0d9488; }
.web-editor-pane--js .cm-property { color: #2563eb; }
.web-editor-pane--js .cm-string { color: #059669; }
.web-editor-pane--js .cm-number { color: #d97706; }
.web-editor-pane--js .cm-atom { color: #db2777; }
.web-editor-pane--js .cm-comment { color: #94a3b8; font-style: italic; }
.web-editor-pane--js .cm-operator { color: #64748b; }

.web-editor-pane__input {
    display: none;
}

.web-editor-preview {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--bg);
}

.web-editor-preview__header {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface, #fff);
    flex-shrink: 0;
}

.web-editor-preview__label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.web-editor-preview__frame {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: none;
    background: #fff;
}

@media (max-width: 900px) {
    .web-editor-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .web-editor-panes {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}

/* Python Compiler */
.academic-tool-card__icon--python {
    background: #ecfdf5;
    color: #047857;
}

.python-compiler-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 3.5rem);
    min-height: 520px;
    position: relative;
    overflow: hidden;
}

.python-compiler-shell--booting {
    overflow: hidden;
}

.python-compiler-boot {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 2rem 1.5rem 2.5rem;
    background:
        radial-gradient(circle at top, rgba(37, 99, 235, 0.08), transparent 42%),
        linear-gradient(180deg, #f8fafc 0%, #ffffff 55%, #eff6ff 100%);
}

.python-compiler-boot[hidden] {
    display: none !important;
}

.python-compiler-boot__back {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.9);
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.python-compiler-boot__back:hover {
    color: var(--text);
    border-color: #bfdbfe;
    background: #fff;
}

.python-compiler-boot__card {
    width: min(100%, 28rem);
    padding: 2rem 1.75rem 1.5rem;
    border-radius: 1rem;
    border: 1px solid #dbeafe;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.08);
    text-align: center;
}

.python-compiler-boot__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4.5rem;
    height: 4.5rem;
    margin: 0 auto 1rem;
    border-radius: 1.1rem;
    background: linear-gradient(135deg, #306998 0%, #ffd43b 100%);
    color: #fff;
    font-size: 2.2rem;
    box-shadow: 0 10px 24px rgba(48, 105, 152, 0.22);
}

.python-compiler-boot__title {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.python-compiler-boot__subtitle {
    margin: 0 0 1.5rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.python-compiler-boot__spinner {
    width: 2.75rem;
    height: 2.75rem;
    margin: 0 auto 1rem;
    border: 3px solid #dbeafe;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: python-compiler-spin 0.85s linear infinite;
}

.python-compiler-boot__status {
    margin: 0 0 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1d4ed8;
}

.python-compiler-boot__status.is-error {
    color: #b91c1c;
}

.python-compiler-boot__hint {
    margin: 0.85rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.python-compiler-boot__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.python-compiler-boot__actions[hidden] {
    display: none !important;
}

.python-compiler-boot__steps {
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
    display: grid;
    gap: 0.65rem;
    text-align: left;
}

.python-compiler-boot__steps li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.python-compiler-boot__step-marker {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    background: #fff;
    flex-shrink: 0;
    position: relative;
}

.python-compiler-boot__steps li.is-active {
    color: #1d4ed8;
    font-weight: 600;
}

.python-compiler-boot__steps li.is-active .python-compiler-boot__step-marker {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.python-compiler-boot__steps li.is-active .python-compiler-boot__step-marker::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: #2563eb;
    animation: python-compiler-pulse 1.2s ease-in-out infinite;
}

.python-compiler-boot__steps li.is-done {
    color: #047857;
}

.python-compiler-boot__steps li.is-done .python-compiler-boot__step-marker {
    border-color: #10b981;
    background: #10b981;
}

.python-compiler-boot__steps li.is-done .python-compiler-boot__step-marker::after {
    content: '';
    position: absolute;
    left: 0.2rem;
    top: 0.05rem;
    width: 0.28rem;
    height: 0.5rem;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg);
}

.python-compiler-boot__progress {
    height: 0.35rem;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.python-compiler-boot__progress-bar {
    width: 8%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    transition: width 0.8s ease;
}

@keyframes python-compiler-spin {
    to { transform: rotate(360deg); }
}

@keyframes python-compiler-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

@keyframes python-compiler-progress {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}

.python-compiler-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    position: relative;
    animation: python-compiler-fade-in 0.35s ease;
}

.python-compiler-main[hidden] {
    display: none !important;
}

@keyframes python-compiler-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.python-compiler-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
}

.python-compiler-status[data-state="loading"] {
    color: #1d4ed8;
    border-color: #bfdbfe;
    background: #eff6ff;
}

.python-compiler-status[data-state="ready"] {
    color: #047857;
    border-color: #a7f3d0;
    background: #ecfdf5;
}

.python-compiler-status[data-state="error"] {
    color: var(--danger, #dc2626);
    border-color: #fecaca;
    background: #fef2f2;
}

.python-compiler-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.python-compiler-workspace {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.python-compiler-pane {
    display: flex;
    flex-direction: column;
    flex: 1.2;
    min-height: 0;
    border-bottom: 1px solid var(--border);
}

.python-compiler-editor {
    flex: 1;
    min-height: 12rem;
}

.python-compiler-output-wrap {
    display: flex;
    flex-direction: column;
    flex: 0.8;
    min-height: 10rem;
    background: #0f172a;
}

.python-compiler-output-wrap .web-editor-preview__header {
    background: #1e293b;
    border-bottom-color: #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.python-compiler-output-wrap .web-editor-preview__label {
    color: #cbd5e1;
}

.python-compiler-output-wrap .web-editor-pane__clear {
    color: #94a3b8;
    background: transparent;
    border-color: #475569;
}

.python-compiler-output-wrap .web-editor-pane__clear:hover {
    color: #f8fafc;
    border-color: #94a3b8;
}

.python-compiler-output {
    flex: 1;
    margin: 0;
    padding: 0.85rem 1rem;
    overflow: auto;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
}

.python-compiler-output.is-error {
    color: #fca5a5;
}

.python-compiler-terminal-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    border-top: 1px solid #334155;
    background: #1e293b;
}

.python-compiler-terminal-input[hidden] {
    display: none;
}

.python-compiler-terminal-input__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.python-compiler-terminal-input__prompt {
    color: #38bdf8;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
    font-weight: 700;
}

.python-compiler-terminal-input__field {
    flex: 1;
    min-width: 0;
    padding: 0.45rem 0.65rem;
    border: 1px solid #475569;
    border-radius: 4px;
    background: #0f172a;
    color: #f8fafc;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
    font-size: 0.8125rem;
}

.python-compiler-terminal-input__field:focus {
    outline: none;
    border-color: #38bdf8;
}

.web-editor-pane--python .CodeMirror {
    background: #f0fdf4;
    color: #1e293b;
}

.web-editor-pane--python .cm-keyword { color: #7c3aed; font-weight: 600; }
.web-editor-pane--python .cm-def { color: #2563eb; }
.web-editor-pane--python .cm-variable { color: #1e293b; }
.web-editor-pane--python .cm-variable-2 { color: #0d9488; }
.web-editor-pane--python .cm-property { color: #2563eb; }
.web-editor-pane--python .cm-string { color: #059669; }
.web-editor-pane--python .cm-number { color: #d97706; }
.web-editor-pane--python .cm-comment { color: #94a3b8; font-style: italic; }
.web-editor-pane--python .cm-operator { color: #64748b; }
.web-editor-pane--python .cm-builtin { color: #db2777; }

.python-compiler-ai-fab {
    position: absolute;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    font-size: 1.15rem;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.python-compiler-ai-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.42);
}

.python-compiler-shell--assistant-open .python-compiler-ai-fab {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.85);
}

.python-compiler-ai-backdrop {
    position: absolute;
    inset: 0;
    z-index: 40;
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(2px);
    animation: python-compiler-fade-in 0.2s ease;
}

.python-compiler-ai-backdrop[hidden] {
    display: none !important;
}

.python-compiler-assistant {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    z-index: 50;
    display: flex;
    flex-direction: column;
    width: min(24rem, calc(100% - 2rem));
    max-height: min(32rem, calc(100% - 5.5rem));
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: var(--surface, #fff);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    animation: python-compiler-assistant-in 0.25s ease;
}

.python-compiler-assistant[hidden] {
    display: none !important;
}

@keyframes python-compiler-assistant-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.python-compiler-assistant__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.python-compiler-assistant__brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.python-compiler-assistant__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.python-compiler-assistant__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
}

.python-compiler-assistant__close:hover {
    color: var(--text);
    border-color: var(--primary);
}

.python-compiler-assistant__title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.2;
}

.python-compiler-assistant__subtitle {
    margin: 0.1rem 0 0;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.python-compiler-assistant__notice {
    display: flex;
    gap: 0.65rem;
    padding: 1rem;
    margin: 1rem;
    border-radius: var(--radius, 8px);
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.python-compiler-assistant__notice i {
    color: var(--primary);
    margin-top: 0.15rem;
}

.python-compiler-assistant__prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.55rem 0.85rem 0;
}

.python-ai-prompt-chip {
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
}

.python-ai-prompt-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light, #eff6ff);
}

.python-compiler-assistant__messages {
    flex: 1;
    min-height: 5.5rem;
    overflow: auto;
    padding: 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.python-ai-message {
    display: flex;
}

.python-ai-message--user {
    justify-content: flex-end;
}

.python-ai-message__bubble {
    max-width: 92%;
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
    font-size: 0.78rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.python-ai-message--assistant .python-ai-message__bubble {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}

.python-ai-message--applied .python-ai-message__bubble {
    border-color: #a7f3d0;
    background: #ecfdf5;
}

.python-ai-message--user .python-ai-message__bubble {
    background: var(--primary-light, #eff6ff);
    color: var(--text);
}

.python-compiler-assistant__form {
    padding: 0.65rem 0.85rem 0.85rem;
    border-top: 1px solid var(--border);
    background: #f8fafc;
}

.python-compiler-assistant__composer {
    display: flex;
    align-items: flex-end;
    gap: 0.45rem;
}

.python-compiler-assistant__input {
    flex: 1;
    min-width: 0;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    font-family: inherit;
    font-size: 0.8125rem;
    resize: none;
    min-height: 2.5rem;
    max-height: 6rem;
    background: #fff;
    line-height: 1.4;
}

.python-compiler-assistant__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.python-compiler-assistant__send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.python-compiler-assistant__send:hover:not(:disabled) {
    transform: scale(1.05);
}

.python-compiler-assistant__send:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    .python-compiler-assistant {
        right: 0.75rem;
        left: 0.75rem;
        bottom: 0.75rem;
        width: auto;
        max-height: min(70vh, calc(100% - 4.5rem));
    }

    .python-compiler-ai-fab {
        right: 1rem;
        bottom: 1rem;
    }
}

/* Academic Tools — Teams */
.academic-teams-modal {
    z-index: 1300;
}

.academic-teams-modal__backdrop {
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(3px);
}

.academic-teams-modal__panel {
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);
}

.academic-teams-modal .messenger-modal-header {
    background: var(--surface, #fff);
}

.academic-teams-modal .messenger-modal-body .form-group {
    margin-bottom: 1rem;
}

.academic-teams-modal .messenger-modal-body label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.academic-teams-modal .messenger-modal-body input[type="text"],
.academic-teams-modal .messenger-modal-body textarea,
.academic-teams-modal .messenger-modal-body select {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    font: inherit;
}

/* Create team wizard */
.academic-teams-wizard__header h3 {
    margin: 0 0 0.15rem;
    font-size: 1.1rem;
}

.academic-teams-wizard__step-label {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.academic-teams-wizard__progress {
    height: 3px;
    background: var(--border, #e2e8f0);
}

.academic-teams-wizard__progress-fill {
    height: 100%;
    width: 20%;
    background: linear-gradient(90deg, var(--primary, #4f46e5), #6366f1);
    transition: width 0.35s ease;
}

.academic-teams-wizard {
    display: flex;
    flex-direction: column;
    min-height: 320px;
}

.academic-teams-wizard__step {
    flex: 1;
    padding: 0.25rem 0 0.5rem;
    animation: academicTeamsWizardIn 0.28s ease;
}

.academic-teams-wizard__step[hidden] {
    display: none !important;
}

@keyframes academicTeamsWizardIn {
    from {
        opacity: 0;
        transform: translateX(12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.academic-teams-wizard__question {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
}

.academic-teams-wizard__hint {
    margin: 0 0 1.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.academic-teams-wizard__choices {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.academic-teams-wizard__choice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 10px);
    background: var(--surface, #fff);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.academic-teams-wizard__choice:hover {
    border-color: var(--primary, #4f46e5);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.academic-teams-wizard__choice:focus-visible {
    outline: 2px solid var(--primary, #4f46e5);
    outline-offset: 2px;
}

.academic-teams-wizard__choice i {
    font-size: 1.1rem;
    color: var(--primary, #4f46e5);
    margin-bottom: 0.15rem;
}

.academic-teams-wizard__choice strong {
    font-size: 0.95rem;
}

.academic-teams-wizard__choice span {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.academic-teams-wizard__info-panel {
    padding: 1.25rem;
    border-radius: var(--radius-lg, 10px);
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    text-align: center;
}

.academic-teams-wizard__info-panel > i {
    font-size: 1.75rem;
    color: #0284c7;
    margin-bottom: 0.5rem;
}

.academic-teams-wizard__info-panel h4 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.academic-teams-wizard__info-panel p {
    margin: 0 0 0.65rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.academic-teams-wizard__info-panel p:last-child {
    margin-bottom: 0;
}

.academic-teams-wizard__review {
    margin: 0;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 10px);
    background: #f8fafc;
}

.academic-teams-wizard__review-row {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 0.5rem 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
}

.academic-teams-wizard__review-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.academic-teams-wizard__review-row:first-child {
    padding-top: 0;
}

.academic-teams-wizard__review-row dt {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.academic-teams-wizard__review-row dd {
    margin: 0;
    font-size: 0.875rem;
    word-break: break-word;
}

.academic-teams-wizard__footer {
    margin-top: auto;
    padding-top: 1rem;
}

.academic-teams-wizard__footer [hidden] {
    display: none !important;
}

.academic-teams-hub {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.academic-teams-panel {
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow, 0 1px 3px rgba(15, 23, 42, 0.06));
    overflow: hidden;
}

.academic-teams-panel__toolbar,
.academic-teams-section__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fafbff 0%, var(--surface, #fff) 100%);
}

.academic-teams-hub.is-empty .academic-teams-panel__toolbar {
    border-bottom: none;
    background: var(--surface, #fff);
}

.academic-teams-panel__toolbar-actions {
    flex-shrink: 0;
}

.academic-teams-hub.is-empty .academic-teams-panel__toolbar-actions,
.academic-teams-hub.is-loading .academic-teams-panel__toolbar-actions {
    display: none;
}

.academic-teams-hub__title,
.academic-teams-workspace__title {
    margin: 0 0 0.25rem;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.academic-teams-hub__subtitle,
.academic-teams-workspace__meta {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.45;
}

.academic-teams-hub-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 4rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.academic-teams-hub.is-loading .academic-teams-hub-loading {
    display: flex;
}

.academic-teams-hub:not(.is-loading) .academic-teams-hub-loading {
    display: none;
}

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

.academic-teams-hub.has-teams .academic-teams-grid {
    display: grid;
}

.academic-teams-grid[hidden] {
    display: none !important;
}

.academic-teams-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.15rem;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: var(--radius, 10px);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    position: relative;
    overflow: hidden;
}

.academic-teams-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    opacity: 0;
    transition: opacity 0.2s;
}

.academic-teams-card:hover {
    border-color: #c7d2fe;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.1);
    transform: translateY(-2px);
}

.academic-teams-card:hover::before {
    opacity: 1;
}

.academic-teams-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.academic-teams-card__icon {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    color: #4f46e5;
    border-radius: 10px;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.academic-teams-card__title {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
}

.academic-teams-card__desc {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.academic-teams-card__no-desc {
    font-style: italic;
    opacity: 0.75;
}

.academic-teams-card__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1rem;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.academic-teams-card__footer span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.academic-teams-card__open {
    margin-left: auto;
    font-weight: 600;
    color: var(--primary);
    transition: gap 0.15s;
}

.academic-teams-card:hover .academic-teams-card__open {
    gap: 0.5rem;
}

.academic-teams-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2.5rem 1.5rem 3rem;
    margin: 0 1.5rem 1.5rem;
    border: 1px dashed #c7d2fe;
    border-radius: var(--radius-lg, 12px);
    background: linear-gradient(180deg, #fafbff 0%, #f8fafc 100%);
}

.academic-teams-hub.is-empty:not(.is-loading) .academic-teams-empty {
    display: flex;
}

.academic-teams-empty[hidden],
.academic-teams-hub.has-teams .academic-teams-empty {
    display: none !important;
}

.academic-teams-empty__visual {
    margin-bottom: 1.25rem;
}

.academic-teams-empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    color: #4f46e5;
    font-size: 2rem;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.12);
}

.academic-teams-empty__title {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.academic-teams-empty__desc {
    margin: 0 0 1.5rem;
    max-width: 26rem;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-muted);
}

.academic-teams-empty__features {
    list-style: none;
    margin: 0 0 1.75rem;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 0.75rem;
    max-width: 32rem;
}

.academic-teams-empty__features li {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
}

.academic-teams-empty__features li i {
    color: #6366f1;
    font-size: 0.75rem;
}

.academic-teams-empty__cta {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.academic-teams-invites {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.06);
}

.academic-teams-invites__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: #1d4ed8;
}

.academic-teams-invites__list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.academic-teams-invite-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--surface, #fff);
    border: 1px solid #dbeafe;
    border-radius: var(--radius, 8px);
}

.academic-teams-invite-card__info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.academic-teams-invite-card__info strong {
    font-size: 0.9rem;
}

.academic-teams-invite-card__info span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.academic-teams-invite-card__actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.academic-teams-modal__intro {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.academic-teams-modal__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

@media (max-width: 520px) {
    .academic-teams-modal__row {
        grid-template-columns: 1fr;
    }
}

.academic-teams-modal__footer {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.academic-teams-modal__panel {
    width: min(100%, 520px);
}

.academic-teams-project-setup__panel {
    width: min(100%, 560px);
}

.academic-teams-project-setup {
    min-height: 300px;
}

.academic-teams-project-setup__flow {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr;
    gap: 0.35rem;
    align-items: start;
    margin-bottom: 1.25rem;
    padding: 0.85rem;
    border-radius: var(--radius-lg, 10px);
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    border: 1px solid #c7d2fe;
}

.academic-teams-project-setup__flow-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.academic-teams-project-setup__flow-item strong {
    font-size: 0.78rem;
    color: var(--text, #1e293b);
}

.academic-teams-project-setup__flow-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #c7d2fe;
    color: #6366f1;
    font-size: 0.85rem;
}

.academic-teams-project-setup__flow-arrow {
    padding-top: 0.45rem;
    color: #a5b4fc;
    font-size: 0.7rem;
}

.academic-teams-project-setup__chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.academic-teams-project-setup__chips-label {
    width: 100%;
    margin-bottom: 0.15rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.academic-teams-project-setup__chip {
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface, #fff);
    font-size: 0.78rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.academic-teams-project-setup__chip:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: #eef2ff;
}

.academic-teams-project-setup__ai-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-lg, 10px);
    background: #fafaff;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.academic-teams-project-setup__ai-card:has(input:checked) {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.academic-teams-project-setup__ai-card input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.academic-teams-project-setup__ai-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.academic-teams-project-setup__ai-card-body strong {
    font-size: 0.9rem;
}

.academic-teams-project-setup__ai-card-body strong i {
    color: #6366f1;
    margin-right: 0.25rem;
}

.academic-teams-project-setup__ai-card-body span {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
}

@media (max-width: 520px) {
    .academic-teams-project-setup__flow {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .academic-teams-project-setup__flow-arrow {
        display: none;
    }

    .academic-teams-project-setup__flow-item {
        flex-direction: row;
        text-align: left;
        gap: 0.65rem;
    }

    .academic-teams-project-setup__flow-item strong,
    .academic-teams-project-setup__flow-item span {
        display: block;
    }
}

.academic-teams-workspace__progress {
    min-width: 200px;
}

.academic-teams-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    padding: 0 1.5rem;
    overflow-x: auto;
    background: var(--surface, #fff);
}

.academic-teams-tabs__btn {
    padding: 0.65rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.academic-teams-tabs__btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.academic-teams-tab-panel {
    display: none;
}

.academic-teams-tab-panel.active {
    display: block;
    padding: 1.25rem 1.5rem;
}

.academic-teams-tag {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.academic-teams-tag--leader {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.academic-teams-tag--advisor {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
}

.academic-teams-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--danger, #dc2626);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
}

.academic-teams-progress {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.25rem 0.5rem;
    align-items: center;
    margin: 0.5rem 0;
}

.academic-teams-progress__label {
    grid-column: 1 / -1;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.academic-teams-progress__track {
    height: 0.45rem;
    background: var(--bg);
    border-radius: 999px;
    overflow: hidden;
}

.academic-teams-progress__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary, #0f6cbf), var(--info, #08799c));
    border-radius: inherit;
    transition: width 0.3s ease;
}

.academic-teams-progress__pct {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.academic-teams-overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 768px) {
    .academic-teams-overview-grid {
        grid-template-columns: 1fr;
    }
}

.academic-teams-section {
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: var(--radius, 10px);
    padding: 0;
    overflow: hidden;
}

.academic-teams-section > .academic-teams-section__header,
.academic-teams-section > h3 {
    margin: 0;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.academic-teams-section > h3 {
    font-size: 0.95rem;
}

.academic-teams-section .academic-teams-members,
.academic-teams-section .academic-teams-activity,
.academic-teams-section .academic-teams-overview-projects__list {
    padding: 0.85rem 1rem 1rem;
}

.academic-teams-section .academic-teams-members {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.academic-teams-member {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.academic-teams-member > div:nth-child(2) {
    flex: 1;
}

.academic-teams-member__actions {
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
}

.academic-teams-member__avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--primary-light, #eff6ff);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.academic-teams-invite-panel {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.academic-teams-invite-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.academic-teams-activity {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.875rem;
}

.academic-teams-progress--compact {
    margin: 0;
    gap: 0.15rem 0.4rem;
}

.academic-teams-progress--compact .academic-teams-progress__track {
    height: 5px;
}

.academic-teams-progress--compact .academic-teams-progress__pct {
    font-size: 0.72rem;
}

.academic-teams-tag--status {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.68rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.academic-teams-tag--todo {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

.academic-teams-tag--in-progress {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.academic-teams-tag--done {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #047857;
}

.academic-teams-projects-list-header p {
    margin: 0.2rem 0 0;
    font-size: 0.875rem;
}

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

.academic-teams-project-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 10px);
    background: var(--surface, #fff);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.academic-teams-project-card:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

.academic-teams-project-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.academic-teams-project-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: #eef2ff;
    color: #6366f1;
    font-size: 0.9rem;
}

.academic-teams-project-card__due {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.academic-teams-project-card h4 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
}

.academic-teams-project-card p {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.academic-teams-project-card__footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
}

.academic-teams-project-card__footer .academic-teams-progress {
    flex: 1;
}

.academic-teams-project-card__chevron {
    color: #94a3b8;
    font-size: 0.8rem;
}

.academic-teams-projects-empty {
    grid-column: 1 / -1;
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg, 10px);
    background: var(--bg);
}

.academic-teams-projects-empty i {
    font-size: 1.75rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.academic-teams-project-view__back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
    padding: 0;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: pointer;
}

.academic-teams-project-view__back:hover {
    color: var(--primary);
}

.academic-teams-project-hero {
    display: grid;
    grid-template-columns: 1fr minmax(220px, 280px);
    gap: 1rem;
    padding: 1.25rem 1.35rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    background: linear-gradient(180deg, #fafbff 0%, var(--surface, #fff) 100%);
}

@media (max-width: 900px) {
    .academic-teams-project-hero {
        grid-template-columns: 1fr;
    }
}

.academic-teams-project-hero__title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.5rem;
}

.academic-teams-project-hero__title-row h3 {
    margin: 0;
    font-size: 1.25rem;
}

.academic-teams-project-hero__due {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #c2410c;
    font-size: 0.78rem;
    font-weight: 600;
}

.academic-teams-project-hero__plan {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.academic-teams-project-hero__stats {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 0.85rem;
}

.academic-teams-project-stat {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.academic-teams-project-stat__value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
    color: #4338ca;
}

.academic-teams-project-stat__label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.academic-teams-project-hero__team h4 {
    margin: 0 0 0.65rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.academic-teams-member-progress {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.academic-teams-member-progress__item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.academic-teams-member-progress__avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.68rem;
    font-weight: 700;
}

.academic-teams-member-progress__body {
    flex: 1;
    min-width: 0;
}

.academic-teams-member-progress__row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.15rem;
    font-size: 0.78rem;
}

.academic-teams-member-progress__row strong {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.academic-teams-member-progress__row span {
    color: var(--text-muted);
    flex-shrink: 0;
}

.academic-teams-project-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 10px);
    background: var(--surface, #fff);
}

.academic-teams-project-toolbar__ai,
.academic-teams-project-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.academic-teams-project-toolbar__auto {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
}

.academic-teams-form-panel {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius, 8px);
    background: var(--bg);
}

.academic-teams-kanban {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: 1fr;
    gap: 1rem;
    height: clamp(16rem, calc(100vh - 26rem), 28rem);
    overflow: hidden;
}

@media (max-width: 900px) {
    .academic-teams-kanban {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(3, clamp(14rem, 40vh, 20rem));
        height: auto;
        overflow: visible;
    }
}

.academic-teams-kanban__col {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    min-width: 0;
    border-radius: var(--radius-lg, 12px);
    border: 1px solid var(--border);
    background: #f8fafc;
    overflow: hidden;
}

.academic-teams-kanban__col--todo {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.academic-teams-kanban__col--todo .academic-teams-kanban__icon {
    background: #e2e8f0;
    color: #475569;
}

.academic-teams-kanban__col--in-progress {
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #bfdbfe;
}

.academic-teams-kanban__col--in-progress .academic-teams-kanban__icon {
    background: #dbeafe;
    color: #1d4ed8;
}

.academic-teams-kanban__col--done {
    background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #a7f3d0;
}

.academic-teams-kanban__col--done .academic-teams-kanban__icon {
    background: #d1fae5;
    color: #047857;
}

.academic-teams-kanban__head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    background: rgba(255, 255, 255, 0.55);
    flex-shrink: 0;
}

.academic-teams-kanban__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 10px;
    font-size: 0.9rem;
}

.academic-teams-kanban__head-text {
    flex: 1;
    min-width: 0;
}

.academic-teams-kanban__head-text h4 {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
}

.academic-teams-kanban__head-text span {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.academic-teams-kanban__count {
    display: none;
}

.academic-teams-kanban__cards {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.academic-teams-kanban__cards::-webkit-scrollbar {
    width: 6px;
}

.academic-teams-kanban__cards::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.academic-teams-kanban__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 2rem 0.75rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    border: 1px dashed rgba(15, 23, 42, 0.12);
    border-radius: var(--radius-lg, 10px);
    background: rgba(255, 255, 255, 0.45);
}

.academic-teams-kanban__empty i {
    font-size: 1.25rem;
    opacity: 0.55;
}

.academic-teams-task-card {
    background: var(--surface, #fff);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    padding: 0.55rem 0.6rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.academic-teams-task-card:hover {
    border-color: #c7d2fe;
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.08);
}

.academic-teams-task-card--compact .academic-teams-task-card__main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.45rem;
    margin-bottom: 0.4rem;
}

.academic-teams-task-card--compact .academic-teams-task-card__title {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.academic-teams-task-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    min-width: 0;
}

.academic-teams-task-card__meta-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.academic-teams-task-card__details-link {
    padding: 0;
    border: none;
    background: none;
    font-size: 0.68rem;
    font-weight: 600;
    color: #6366f1;
    cursor: pointer;
}

.academic-teams-task-card__details-link:hover,
.academic-teams-task-card__details-link.is-open {
    text-decoration: underline;
}

.academic-teams-task-card__desc-panel {
    margin-top: 0.4rem;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid var(--border);
    max-height: 6rem;
    overflow-y: auto;
}

.academic-teams-task-card__icon-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.academic-teams-task-card__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface, #fff);
    color: var(--text-muted);
    font-size: 0.72rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.academic-teams-task-card__icon-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: var(--text);
}

.academic-teams-task-card__icon-btn--go {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4338ca;
}

.academic-teams-task-card__icon-btn--go:hover {
    background: #e0e7ff;
    border-color: #6366f1;
}

.academic-teams-task-card__icon-btn--danger {
    flex-shrink: 0;
    color: #b91c1c;
    border-color: #fecaca;
    background: #fef2f2;
}

.academic-teams-task-card__icon-btn--danger:hover {
    color: #fff;
    background: #dc2626;
    border-color: #dc2626;
}

.academic-teams-task-card--done {
    opacity: 0.88;
}

.academic-teams-task-card--done .academic-teams-task-card__title {
    text-decoration: line-through;
    text-decoration-color: rgba(15, 23, 42, 0.25);
}

.academic-teams-task-card__assignee {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    flex: 1;
}

.academic-teams-task-card__avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.55rem;
    font-weight: 700;
}

.academic-teams-task-card__avatar--empty {
    background: #f1f5f9;
    color: #94a3b8;
}

.academic-teams-task-card__assignee-name {
    font-size: 0.72rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.academic-teams-task-card__assignee-name.is-unassigned {
    font-weight: 500;
    color: var(--text-muted);
}

.academic-teams-task-card__comment {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.45rem;
    height: 1.45rem;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.78rem;
}

.academic-teams-task-card__comment:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.academic-teams-task-card__desc {
    margin: 0;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.academic-teams-task-card__steps {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, #fff);
    border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
    border-radius: 999px;
    padding: 0.1rem 0.4rem;
    white-space: nowrap;
}

.academic-teams-task-card__due {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.academic-teams-task-card__assign-select {
    flex: 1;
    min-width: 0;
    max-width: 5.5rem;
    padding: 0;
    border: none;
    background: transparent;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    text-overflow: ellipsis;
}

.academic-teams-task-card__assign-select:focus {
    outline: none;
    color: var(--text);
}

.academic-teams-project-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
}

.academic-teams-checkbox {
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.academic-teams-resources-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.academic-teams-resource-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    background: var(--surface, #fff);
}

.academic-teams-resource-card i {
    color: var(--primary);
    margin-top: 0.15rem;
}

.academic-teams-chat {
    display: flex;
    flex-direction: column;
    height: min(60vh, 520px);
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    overflow: hidden;
    background: var(--surface, #fff);
}

.academic-teams-chat__messages {
    flex: 1;
    overflow: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.academic-teams-chat__msg--mine {
    align-self: flex-end;
    text-align: right;
}

.academic-teams-chat__msg-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.academic-teams-chat__msg-body {
    display: inline-block;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    background: var(--bg);
    font-size: 0.875rem;
    max-width: 85%;
    text-align: left;
}

.academic-teams-chat__msg--mine .academic-teams-chat__msg-body {
    background: var(--primary-light, #eff6ff);
}

.academic-teams-chat__composer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid var(--border);
}

.academic-teams-chat__composer input {
    flex: 1;
}

.academic-teams-workspace__loading {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.academic-teams-workspace__loading[hidden] {
    display: none !important;
}

/* Teams UX v2 — drawer, toast, hub hero, messenger chat, coach */
.academic-teams-toast-host {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 1400;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.academic-teams-toast {
    padding: 0.65rem 1rem;
    border-radius: var(--radius, 8px);
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
    font-size: 0.875rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
    max-width: 320px;
}

.academic-teams-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.academic-teams-toast--error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.academic-teams-toast--success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.academic-teams-modal__panel--sm {
    max-width: 420px;
}

.academic-teams-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
}

.academic-teams-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1250;
}

.academic-teams-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(420px, 100vw);
    height: 100vh;
    background: var(--surface, #fff);
    border-left: 1px solid var(--border);
    z-index: 1260;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s ease;
}

.academic-teams-drawer.is-open {
    transform: translateX(0);
}

.academic-teams-drawer__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface, #fff);
}

.academic-teams-drawer__header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    flex: 1;
    min-width: 0;
}

.academic-teams-drawer__body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 1rem;
    background: var(--surface-2, #f8fafc);
}

.academic-teams-drawer__task {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.academic-teams-drawer__status-row {
    display: flex;
    align-items: center;
}

.academic-teams-drawer__label {
    display: block;
    margin: 0 0 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.academic-teams-drawer__desc-card {
    padding: 0.85rem 0.9rem;
    border-radius: var(--radius-lg, 12px);
    background: var(--surface, #fff);
    border: 1px solid var(--border);
}

.academic-teams-drawer__desc-card .academic-teams-drawer__label {
    margin-bottom: 0.45rem;
}

.academic-teams-drawer__desc {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text);
}

.academic-teams-drawer__desc.is-empty {
    color: var(--text-muted);
    font-style: italic;
}

.academic-teams-drawer__checklist-card {
    padding: 0.85rem 0.9rem;
    border-radius: var(--radius-lg, 12px);
    background: var(--surface, #fff);
    border: 1px solid var(--border);
}

.academic-teams-drawer__checklist-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}

.academic-teams-drawer__checklist-head .academic-teams-drawer__label {
    margin-bottom: 0;
}

.academic-teams-drawer__checklist-count {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--surface-2, #f8fafc);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.15rem 0.45rem;
}

.academic-teams-drawer__checklist {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.academic-teams-drawer__checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.45rem 0.55rem;
    border-radius: var(--radius, 8px);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.academic-teams-drawer__checklist-item:hover {
    background: var(--surface-2, #f8fafc);
    border-color: var(--border);
}

.academic-teams-drawer__checklist-item.is-readonly {
    cursor: default;
}

.academic-teams-drawer__checklist-item.is-readonly:hover {
    background: transparent;
    border-color: transparent;
}

.academic-teams-drawer__checklist-item input[type="checkbox"] {
    margin: 0.15rem 0 0;
    flex-shrink: 0;
}

.academic-teams-drawer__checklist-box {
    width: 1rem;
    height: 1rem;
    margin-top: 0.12rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.62rem;
    color: var(--primary);
    background: var(--surface, #fff);
}

.academic-teams-drawer__checklist-item.is-done .academic-teams-drawer__checklist-box {
    background: color-mix(in srgb, var(--primary) 12%, #fff);
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

.academic-teams-drawer__checklist-text {
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--text);
}

.academic-teams-drawer__checklist-item.is-done .academic-teams-drawer__checklist-text {
    color: var(--text-muted);
    text-decoration: line-through;
}

.academic-teams-drawer__checklist-locked {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-lg, 12px);
    background: var(--surface-2, #f8fafc);
    border: 1px dashed var(--border);
}

.academic-teams-drawer__checklist-locked-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.academic-teams-drawer__checklist-locked-copy {
    min-width: 0;
}

.academic-teams-drawer__checklist-locked-copy strong {
    display: block;
    font-size: 0.8125rem;
    margin-bottom: 0.2rem;
    color: var(--text);
}

.academic-teams-drawer__checklist-locked-copy p {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.academic-teams-drawer__checklist-locked-copy em {
    font-style: normal;
    font-weight: 700;
    color: var(--text);
}

.academic-teams-drawer__meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
}

@media (max-width: 480px) {
    .academic-teams-drawer__meta {
        grid-template-columns: 1fr;
    }
}

.academic-teams-drawer__meta-item {
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-lg, 12px);
    background: var(--surface, #fff);
    border: 1px solid var(--border);
}

.academic-teams-drawer__assignee {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.academic-teams-drawer__assignee-avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light, #eff6ff);
    color: var(--primary, #2563eb);
    font-size: 0.62rem;
    font-weight: 700;
}

.academic-teams-drawer__assignee-avatar.is-empty {
    background: var(--bg, #f1f5f9);
    color: var(--text-muted);
}

.academic-teams-drawer__assignee-name {
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.academic-teams-drawer__assignee-name.is-unassigned {
    color: var(--text-muted);
    font-weight: 500;
}

.academic-teams-drawer__assign-select {
    width: 100%;
    font-size: 0.8125rem;
}

.academic-teams-drawer__due-value {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.academic-teams-drawer__move {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.academic-teams-drawer__move .btn {
    flex: 1 1 auto;
}

.academic-teams-drawer__ai .btn {
    width: 100%;
}

.academic-teams-drawer__danger {
    margin-top: 0.15rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.academic-teams-drawer__delete-section {
    margin-top: 0.85rem;
    padding: 0.9rem;
    border-radius: var(--radius-lg, 12px);
    background: var(--surface, #fff);
    border: 1px solid var(--border);
}

.academic-teams-drawer__delete-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}

.academic-teams-drawer__delete-head h4 {
    margin: 0;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.academic-teams-drawer__delete-count {
    font-size: 0.72rem;
    font-weight: 700;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    white-space: nowrap;
}

.academic-teams-drawer__delete-meta {
    margin: 0 0 0.45rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.academic-teams-drawer__delete-reason {
    margin: 0 0 0.55rem;
    padding: 0.65rem 0.75rem;
    border-left: 3px solid #fca5a5;
    background: #fef2f2;
    border-radius: 0 var(--radius, 8px) var(--radius, 8px) 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--text);
}

.academic-teams-drawer__delete-help {
    margin: 0 0 0.65rem;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.academic-teams-drawer__delete-votes {
    list-style: none;
    margin: 0 0 0.65rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.academic-teams-drawer__delete-vote {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.academic-teams-drawer__delete-vote.is-approve {
    color: #15803d;
}

.academic-teams-drawer__delete-vote.is-reject {
    color: #b91c1c;
}

.academic-teams-drawer__delete-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.45rem;
}

.academic-teams-drawer__delete-you-voted {
    margin: 0 0 0.45rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.academic-teams-drawer__delete-form textarea {
    margin-bottom: 0.55rem;
    font-size: 0.8125rem;
}

.academic-teams-drawer__delete-cancel {
    width: 100%;
    justify-content: center;
}

.academic-teams-drawer__comments {
    margin-top: 0.15rem;
    padding: 0.85rem 0.9rem;
    border-radius: var(--radius-lg, 12px);
    background: var(--surface, #fff);
    border: 1px solid var(--border);
}

.academic-teams-drawer__comments-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.academic-teams-drawer__comments-head h4 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
}

.academic-teams-drawer__comments-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--bg, #f1f5f9);
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
}

.academic-teams-comments {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 220px;
    overflow-y: auto;
}

.academic-teams-comments__item {
    padding: 0.6rem 0.7rem;
    border-radius: 10px;
    background: var(--bg, #f8fafc);
    border: 1px solid var(--border);
}

.academic-teams-comments__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.academic-teams-comments__head strong {
    font-size: 0.8125rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.academic-teams-comments__head time {
    flex-shrink: 0;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.academic-teams-comments__item p {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

.academic-teams-comments__empty {
    padding: 0.75rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
    list-style: none;
}

.academic-teams-comments__form {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border);
}

.academic-teams-comments__form textarea {
    resize: none;
    font-size: 0.8125rem;
}

.academic-teams-comments__form .btn {
    align-self: flex-end;
}

.academic-teams-drawer__loading {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.academic-teams-drawer-open {
    overflow: hidden;
}


.academic-teams-coach {
    position: fixed;
    top: 0;
    right: 0;
    width: min(360px, 100vw);
    height: 100vh;
    background: var(--surface, #fff);
    border-left: 1px solid var(--border);
    z-index: 1240;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 24px rgba(15, 23, 42, 0.08);
    transform: translateX(100%);
    transition: transform 0.28s ease;
}

.academic-teams-coach[hidden] {
    display: none !important;
}

.academic-teams-coach.is-open {
    transform: translateX(0);
}

.academic-teams-coach__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.academic-teams-coach__prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.65rem;
    border-bottom: 1px solid var(--border);
}

.academic-teams-coach__chip {
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg, #f8fafc);
    font-size: 0.72rem;
    cursor: pointer;
}

.academic-teams-coach__messages {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.academic-teams-coach__welcome {
    margin: auto;
    padding: 1.5rem 1rem;
    text-align: center;
    max-width: 16rem;
}

.academic-teams-coach__welcome[hidden] {
    display: none !important;
}

.academic-teams-coach__welcome-icon {
    width: 2.75rem;
    height: 2.75rem;
    margin: 0 auto 0.75rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.25);
}

.academic-teams-coach__welcome-title {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.9375rem;
    color: var(--text);
}

.academic-teams-coach__welcome-text {
    margin: 0 0 0.35rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.academic-teams-coach__welcome-hint {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.academic-teams-coach__msg {
    min-width: 0;
}

.academic-teams-coach__msg-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: 100%;
}

.academic-teams-coach__msg--user .academic-teams-coach__msg-row {
    justify-content: flex-end;
}

.academic-teams-coach__msg--assistant .academic-teams-coach__msg-row {
    justify-content: flex-start;
}

.academic-teams-coach__avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 700;
    background: var(--primary-light, #eff6ff);
    color: var(--primary, #2563eb);
}

.academic-teams-coach__avatar--coach {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    font-size: 0.72rem;
}

.academic-teams-coach__bubble-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    max-width: calc(100% - 2.5rem);
}

.academic-teams-coach__msg--user .academic-teams-coach__bubble-wrap {
    align-items: flex-end;
}

.academic-teams-coach__msg--assistant .academic-teams-coach__bubble-wrap {
    align-items: flex-start;
}

.academic-teams-coach__msg-body {
    padding: 0.65rem 0.8rem;
    border-radius: 14px;
    font-size: 0.8125rem;
    line-height: 1.55;
    word-break: break-word;
}

.academic-teams-coach__msg--user .academic-teams-coach__msg-body {
    background: var(--primary, #2563eb);
    color: #fff;
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}

.academic-teams-coach__msg--assistant .academic-teams-coach__msg-body {
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
    color: var(--text);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.academic-teams-coach__time {
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 0 0.15rem;
}

.academic-teams-coach__heading {
    margin: 0.75rem 0 0.35rem;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text);
}

.academic-teams-coach__heading:first-child {
    margin-top: 0;
}

.academic-teams-coach__paragraph {
    margin: 0 0 0.55rem;
}

.academic-teams-coach__paragraph:last-child {
    margin-bottom: 0;
}

.academic-teams-coach__list {
    margin: 0.35rem 0 0.65rem;
    padding-left: 1.15rem;
}

.academic-teams-coach__list li {
    margin-bottom: 0.3rem;
}

.academic-teams-coach__list li:last-child {
    margin-bottom: 0;
}

.academic-teams-coach__inline-code {
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.06);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78em;
}

.academic-teams-coach__code {
    margin: 0.5rem 0;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.06);
    overflow-x: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.45;
}

.academic-teams-coach__code code {
    white-space: pre-wrap;
    word-break: break-word;
}

.academic-teams-coach__typing {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0;
}

.academic-teams-coach__typing span {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.45;
    animation: academic-teams-coach-typing 1.2s ease-in-out infinite;
}

.academic-teams-coach__typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.academic-teams-coach__typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes academic-teams-coach-typing {
    0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}

.academic-teams-coach__composer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid var(--border);
    background: #f8fafc;
}

.academic-teams-coach__composer textarea {
    flex: 1;
    resize: none;
    font: inherit;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
}

.academic-teams-task-card {
    cursor: pointer;
}

.academic-teams-preview__list {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

.academic-teams-drawer__preview-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Superadmin AI test lab */
.ai-test-lab {
    max-width: 900px;
}

.ai-test-chat {
    display: flex;
    flex-direction: column;
    min-height: 28rem;
}

.ai-test-chat__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.ai-test-chat__head h2 {
    margin: 0 0 0.25rem;
}

.ai-test-chat__messages {
    flex: 1;
    min-height: 18rem;
    max-height: 55vh;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    background: #f8fafc;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ai-test-chat__empty {
    margin: auto;
    text-align: center;
    font-size: 0.9rem;
}

.ai-test-chat__msg {
    display: flex;
}

.ai-test-chat__msg--user {
    justify-content: flex-end;
}

.ai-test-chat__bubble {
    max-width: 85%;
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-test-chat__msg--assistant .ai-test-chat__bubble {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
}

.ai-test-chat__msg--user .ai-test-chat__bubble {
    background: var(--primary-light, #eff6ff);
    color: var(--text);
}

.ai-test-chat__msg--typing .ai-test-chat__bubble {
    color: var(--text-muted, #64748b);
    font-style: italic;
}

.ai-test-chat__form {
    margin-top: 0.85rem;
}

.ai-test-chat__composer {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.ai-test-chat__input {
    flex: 1;
    min-width: 0;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 2.75rem;
    max-height: 8rem;
    background: #fff;
    line-height: 1.4;
}

.ai-test-chat__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.ai-test-chat__send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
}

.ai-test-chat__send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ai-test-image__form {
    margin-top: 1rem;
}

.ai-test-image__status {
    margin-top: 1rem;
    font-size: 0.875rem;
}

.ai-test-image__result {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.ai-test-image__meta {
    font-size: 0.8125rem;
    color: var(--text-muted, #64748b);
    margin-bottom: 0.75rem;
}

.ai-test-image__frame {
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
    overflow: hidden;
    background: #f1f5f9;
    margin-bottom: 0.75rem;
}

.ai-test-image__preview {
    display: block;
    width: 100%;
    max-width: 512px;
    height: auto;
}

.ai-test-chat__reply-text {
    margin: 0 0 0.65rem;
}

.ai-test-chat__image-frame {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.ai-test-chat__image {
    display: block;
    max-width: 100%;
    width: auto;
    max-height: 320px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.ai-test-chat__image-meta {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
}

.ai-test-chat__download {
    margin-top: 0.25rem;
}

/* Teams full-screen shell */
.teams-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--navbar-height, 3.5rem));
    min-height: 480px;
    background: #f1f5f9;
    overflow: hidden;
}

.teams-shell__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
    padding: 0.75rem 1.25rem;
    background: var(--surface, #fff);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.teams-shell__toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    flex: 1;
}

.teams-shell__back {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.65rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.teams-shell__back:hover {
    background: #f1f5f9;
    color: var(--text);
}

.teams-shell__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.teams-shell__brand-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}

.teams-shell__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
}

.teams-shell__subtitle {
    margin: 0.1rem 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.teams-shell__stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.teams-shell__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 4.5rem;
    padding: 0.35rem 0.75rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.teams-shell__stat-value {
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text);
}

.teams-shell__stat-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.teams-shell__toolbar-right {
    flex-shrink: 0;
}

.teams-shell__body {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.teams-shell__sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface, #fff);
    border-right: 1px solid var(--border);
    overflow: auto;
}

.teams-shell__nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.teams-shell__nav-btn {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.teams-shell__nav-btn i {
    width: 1rem;
    text-align: center;
    opacity: 0.85;
}

.teams-shell__nav-btn:hover {
    background: #f1f5f9;
    color: var(--text);
}

.teams-shell__nav-btn.active {
    background: #eef2ff;
    color: #4f46e5;
}

.teams-shell__sidebar-section {
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.teams-shell__sidebar-title {
    margin: 0 0 0.5rem;
    padding: 0 0.15rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.teams-shell__sidebar-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px dashed #c7d2fe;
    border-radius: 8px;
    background: #fafbff;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #4f46e5;
    cursor: pointer;
}

.teams-shell__sidebar-action:hover {
    background: #eef2ff;
}

.teams-shell__invites {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.teams-shell__invites-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #1d4ed8;
}

.teams-shell__invites-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.teams-shell__invite-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.45rem;
    align-items: center;
    padding: 0.55rem;
    background: #f8fafc;
    border: 1px solid #dbeafe;
    border-radius: 8px;
}

.teams-shell__invite-avatar {
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.65rem;
    font-weight: 700;
}

.teams-shell__invite-info {
    min-width: 0;
}

.teams-shell__invite-info strong {
    display: block;
    font-size: 0.78rem;
    line-height: 1.2;
}

.teams-shell__invite-info span {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
}

.teams-shell__invite-actions {
    display: flex;
    gap: 0.2rem;
}

.teams-shell__main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 1rem 1.25rem 1.25rem;
}

.teams-shell__main-head {
    flex-shrink: 0;
    margin-bottom: 0.85rem;
}

.teams-mgmt__heading {
    margin: 0 0 0.2rem;
    font-size: 1.05rem;
    font-weight: 700;
}

.teams-mgmt__hint {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.teams-mgmt__loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    flex: 1;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.teams-shell.is-loading .teams-mgmt__loading {
    display: flex;
}

.teams-shell:not(.is-loading) .teams-mgmt__loading {
    display: none;
}

.teams-mgmt-list {
    display: none;
    flex-direction: column;
    gap: 0.65rem;
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding-right: 0.15rem;
}

.teams-shell.has-teams .teams-mgmt-list:not([hidden]) {
    display: flex;
}

.teams-mgmt-list[hidden] {
    display: none !important;
}

.teams-mgmt-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(180px, 0.9fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.1rem;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.teams-mgmt-row:hover {
    border-color: #c7d2fe;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.08);
    transform: translateY(-1px);
}

.teams-mgmt-row__identity {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 0;
}

.teams-mgmt-row__avatar {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    color: #4f46e5;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}

.teams-mgmt-row__copy {
    min-width: 0;
}

.teams-mgmt-row__title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.2rem;
}

.teams-mgmt-row__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
}

.teams-mgmt-row__role {
    display: inline-flex;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.teams-mgmt-row__role--leader {
    background: #fef3c7;
    color: #b45309;
}

.teams-mgmt-row__role--advisor {
    background: #dbeafe;
    color: #1d4ed8;
}

.teams-mgmt-row__role--member {
    background: #f1f5f9;
    color: #64748b;
}

.teams-mgmt-row__desc {
    margin: 0 0 0.25rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.teams-mgmt-row__no-desc {
    font-style: italic;
    opacity: 0.75;
}

.teams-mgmt-row__activity {
    margin: 0;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.teams-mgmt-row__metrics {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.teams-mgmt-row__metric {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.teams-mgmt-row__progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.teams-mgmt-row__progress-track {
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.teams-mgmt-row__progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    border-radius: 999px;
}

.teams-mgmt-row__action {
    flex-shrink: 0;
}

.teams-mgmt-row__open {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #4f46e5;
}

.teams-mgmt__no-results {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    background: var(--surface, #fff);
    border: 1px dashed var(--border);
    border-radius: 12px;
}

.teams-mgmt-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    padding: 2rem;
    background: var(--surface, #fff);
    border: 1px dashed #c7d2fe;
    border-radius: 12px;
}

.teams-shell.is-empty:not(.is-loading) .teams-mgmt-empty:not([hidden]) {
    display: flex;
}

.teams-mgmt-empty[hidden],
.teams-shell.has-teams .teams-mgmt-empty {
    display: none !important;
}

.teams-mgmt-empty__visual {
    margin-bottom: 1rem;
}

.teams-mgmt-empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    color: #4f46e5;
    font-size: 1.75rem;
}

.teams-mgmt-empty__title {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
}

.teams-mgmt-empty__desc {
    margin: 0 0 1.25rem;
    max-width: 24rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.teams-mgmt-empty__features {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem;
}

.teams-mgmt-empty__features li {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

@media (max-width: 960px) {
    .teams-shell__body {
        grid-template-columns: 1fr;
    }

    .teams-shell__sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0.75rem;
    }

    .teams-shell__nav {
        flex-direction: row;
        flex-wrap: wrap;
        flex: 1;
    }

    .teams-shell__sidebar-section,
    .teams-shell__invites {
        width: 100%;
        margin-top: 0;
    }

    .teams-mgmt-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .teams-shell__toolbar {
        flex-wrap: wrap;
    }

    .teams-shell__stats {
        order: 3;
        width: 100%;
        justify-content: flex-start;
    }

    .teams-shell__subtitle {
        display: none;
    }
}

/* Unified course content builder */
.content-builder {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding-bottom: 4rem;
}

.content-builder__hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem 1.2rem;
    border: 1px solid #cddff1;
    border-radius: 18px;
    background:
        radial-gradient(circle at 92% 15%, rgba(15, 108, 191, .12), transparent 30%),
        linear-gradient(135deg, #fff 0%, #f4f9fe 58%, #edf6fd 100%);
    box-shadow: 0 12px 30px rgba(15, 70, 120, .08);
}

.content-builder__hero::after {
    position: absolute;
    right: -42px;
    bottom: -72px;
    width: 180px;
    height: 180px;
    border: 22px solid rgba(15, 108, 191, .05);
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

.content-builder__hero-top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.content-builder__back {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .4rem .65rem;
    border: 1px solid #cfdeeb;
    border-radius: 9px;
    background: rgba(255, 255, 255, .75);
    color: var(--ink-2);
    font-size: .78rem;
    font-weight: 700;
}

.content-builder__back:hover {
    border-color: var(--primary);
    background: #fff;
    color: var(--primary);
    text-decoration: none;
}

.content-builder__hero-meta {
    display: flex;
    align-items: center;
    gap: .45rem;
}

.content-builder__hero-meta > span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .6rem;
    border: 1px solid #d5e3ef;
    border-radius: 999px;
    background: rgba(255, 255, 255, .72);
    color: var(--ink-2);
    font-size: .7rem;
    font-weight: 700;
}

.content-builder__hero-meta .content-builder__hero-type {
    border-color: #b9d8f0;
    background: #eaf5fd;
    color: var(--primary-dark);
}

.content-builder__hero-row,
.content-builder__panel-head,
.content-builder__step-heading {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.content-builder__hero-row {
    position: relative;
    z-index: 1;
    align-items: center;
    margin-top: .9rem;
}

.content-builder__hero-icon {
    display: grid;
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .65);
    border-radius: 17px;
    background: linear-gradient(135deg, var(--primary), #0f8fa8);
    color: #fff;
    font-size: 1.3rem;
    box-shadow: 0 8px 20px rgba(15, 108, 191, .22);
}

.content-builder__eyebrow {
    margin: 0 0 .2rem;
    color: var(--primary-color);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.content-builder__hero h1 {
    margin: 0;
    color: #163a59;
    font-size: clamp(1.45rem, 3vw, 1.9rem);
    line-height: 1.15;
}

.content-builder__hero p:last-child,
.content-builder__panel-head p,
.content-builder__step-heading p {
    margin: .35rem 0 0;
    color: var(--text-muted);
}

.content-builder__hero-row > div > p:last-child {
    max-width: 66ch;
    font-size: .82rem;
}

.content-builder--ai_quiz .content-builder__hero {
    border-color: #d8d4f4;
    background:
        radial-gradient(circle at 92% 15%, rgba(99, 102, 241, .14), transparent 30%),
        linear-gradient(135deg, #fff 0%, #f7f7ff 58%, #f0f1ff 100%);
}

.content-builder--ai_quiz .content-builder__hero::after {
    border-color: rgba(99, 102, 241, .06);
}

.content-builder--ai_quiz .content-builder__hero-icon {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 8px 20px rgba(79, 70, 229, .24);
}

.content-builder--ai_quiz .content-builder__eyebrow,
.content-builder--ai_quiz .content-builder__hero-meta .content-builder__hero-type {
    color: #5145cd;
}

.content-builder--ai_quiz .content-builder__hero-meta .content-builder__hero-type {
    border-color: #d8d4f4;
    background: #f0efff;
}

.content-builder__type-step,
.content-builder__panel {
    padding: clamp(1rem, 3vw, 1.8rem);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--surface-color);
    box-shadow: 0 14px 35px rgba(15, 23, 42, .06);
}

.content-builder__step-heading > span,
.content-builder__panel-num {
    display: grid;
    min-width: 42px;
    height: 42px;
    padding: 0 .7rem;
    place-items: center;
    border-radius: 12px;
    background: var(--primary-color);
    color: #fff;
    font-size: .8rem;
    font-weight: 800;
}

.content-builder__step-heading h2,
.content-builder__panel-head h2 {
    margin: 0;
}

.content-type-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.content-type-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    min-height: 120px;
    padding: 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 17px;
    color: var(--text-color);
    transition: border-color .18s, transform .18s, box-shadow .18s;
}

.content-type-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(15, 23, 42, .08);
}

.content-type-card__icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 14px;
    background: color-mix(in srgb, var(--primary-color) 12%, transparent);
    color: var(--primary-color);
    font-size: 1.2rem;
}

.content-type-card strong,
.content-type-card small {
    display: block;
}

.content-type-card strong {
    margin-bottom: .3rem;
    font-size: 1.05rem;
}

.content-type-card small {
    color: var(--text-muted);
    line-height: 1.45;
}

.content-type-card__arrow {
    color: var(--text-muted);
}

.content-builder__steps {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr));
    margin: 0 0 1.25rem;
    padding: .85rem .75rem;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: var(--surface-color);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}

.content-builder__steps--four {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.content-builder__steps--seven {
    grid-template-columns: repeat(7, minmax(105px, 1fr));
}

.content-builder__steps > a,
.content-builder__steps > button,
.content-builder__steps > span {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    min-width: 130px;
    padding: .55rem .35rem;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.content-builder__steps > *::before {
    position: absolute;
    z-index: 0;
    top: 25px;
    right: 50%;
    width: 100%;
    height: 2px;
    background: var(--border-color);
    content: "";
}

.content-builder__steps > *:first-child::before {
    display: none;
}

.content-builder__step-marker {
    position: relative;
    z-index: 1;
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 800;
    transition: border-color .18s, background .18s, color .18s, transform .18s;
}

.content-builder__step-copy {
    position: relative;
    z-index: 1;
    display: grid;
    padding: .1rem .3rem;
    background: var(--surface-color);
    line-height: 1.25;
}

.content-builder__step-copy strong {
    color: var(--text-color);
    font-size: .84rem;
}

.content-builder__step-copy small {
    margin-top: .15rem;
    color: var(--text-muted);
    font-size: .68rem;
    font-weight: 500;
}

.content-builder__steps .is-active {
    color: var(--primary-color);
}

.content-builder__steps .is-active .content-builder__step-marker {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--primary-color) 12%, transparent);
    transform: scale(1.05);
}

.content-builder__steps .is-active .content-builder__step-copy strong {
    color: var(--primary-color);
}

.content-builder__steps .is-done {
    color: var(--success-color);
}

.content-builder__steps .is-done::before,
.content-builder__steps .is-done + .is-active::before,
.content-builder__steps .is-done + .is-done::before {
    background: var(--success-color);
}

.content-builder__steps .is-done .content-builder__step-marker {
    border-color: var(--success-color);
    background: var(--success-color);
    color: #fff;
}

.content-builder__steps .is-done .content-builder__step-copy strong {
    color: var(--success-color);
}

.content-builder__steps button:not(.is-active):not(.is-done):hover .content-builder__step-marker {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.content-builder__panel {
    animation: content-builder-in .2s ease-out;
}

@keyframes content-builder-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-builder__panel-head {
    margin-bottom: 1.5rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--border-color);
}

.content-builder__choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .85rem;
    margin-bottom: 1.25rem;
}

.content-builder__format-intro {
    margin: -0.35rem 0 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.content-builder__format-intro p { margin: 0; }

.content-builder__format-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.content-builder-format {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 10.5rem;
    padding: 1.1rem 1rem 1rem;
    border: 2px solid var(--border-color, var(--border));
    border-radius: 1rem;
    background: var(--surface, #fff);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.content-builder-format:hover {
    border-color: color-mix(in srgb, var(--primary-color, var(--primary)) 45%, var(--border));
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    transform: translateY(-1px);
}
.content-builder-format.is-selected {
    border-color: var(--primary-color, var(--primary));
    background: color-mix(in srgb, var(--primary-color, var(--primary)) 6%, #fff);
    box-shadow: 0 10px 24px rgba(15, 108, 191, 0.1);
}
.content-builder-format input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.content-builder-format__check {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    border: 1.5px solid var(--border-color, var(--border));
    background: #fff;
    color: transparent;
    display: grid;
    place-items: center;
    font-size: 0.65rem;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.content-builder-format.is-selected .content-builder-format__check {
    background: var(--primary-color, var(--primary));
    border-color: var(--primary-color, var(--primary));
    color: #fff;
}
.content-builder-format__icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.85rem;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
}
.content-builder-format__icon--pdf {
    background: #fef2f2;
    color: #dc2626;
}
.content-builder-format__icon--editor {
    background: #eff6ff;
    color: var(--primary-color, var(--primary));
}
.content-builder-format__icon--link {
    background: #f0fdf4;
    color: #15803d;
}
.content-builder-format__copy strong,
.content-builder-format__copy small {
    display: block;
}
.content-builder-format__copy strong {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text, #0f172a);
    letter-spacing: -0.01em;
}
.content-builder-format__copy small {
    margin-top: 0.35rem;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.content-builder__format-panel {
    margin-top: 0.25rem;
    padding: 1.1rem 1.15rem 1.15rem;
    border: 1px solid var(--border-color, var(--border));
    border-radius: 1rem;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    animation: content-builder-in 0.2s ease-out;
}
.content-builder__format-panel-head {
    margin-bottom: 0.85rem;
}
.content-builder__format-panel-head h3 {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    font-weight: 800;
}
.content-builder__format-panel-head p {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.content-builder__format-panel .content-builder-dropzone {
    margin-top: 0;
}
.content-builder-video-embed {
    display: grid;
    grid-template-rows: 0fr;
    margin-top: 0;
    opacity: 0;
    transform: translateY(-0.4rem);
    pointer-events: none;
    transition:
        grid-template-rows 0.28s ease,
        opacity 0.22s ease,
        transform 0.22s ease,
        margin-top 0.22s ease;
}
.content-builder-video-embed__clip {
    min-height: 0;
    overflow: hidden;
}
.content-builder-video-embed[hidden] {
    display: none !important;
}
.content-builder-video-embed.is-open {
    grid-template-rows: 1fr;
    margin-top: 0.9rem;
    opacity: 1;
    transform: none;
    pointer-events: auto;
}
.content-builder-video-embed.is-appearing .content-builder-video-embed__detect {
    animation: content-builder-video-in 0.32s ease;
}
.content-builder-video-embed.is-leaving {
    grid-template-rows: 0fr;
    margin-top: 0;
    opacity: 0;
    transform: translateY(-0.35rem);
    pointer-events: none;
}
@keyframes content-builder-video-in {
    from {
        opacity: 0.35;
        transform: translateY(-0.35rem) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
.form-group label.content-builder-video-embed__detect,
.content-builder-video-embed__detect {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 0.75rem;
    margin: 0;
    margin-bottom: 0;
    padding: 0.85rem 0.95rem;
    border-radius: 0.85rem;
    border: 1px solid #bbf7d0;
    background: linear-gradient(135deg, #f0fdf4 0%, #fff 70%);
    cursor: default;
    font-weight: 600;
}
.content-builder-video-embed--gmeet .content-builder-video-embed__detect {
    border-color: #99d5cf;
    background: linear-gradient(135deg, #e0f2f1 0%, #fff 70%);
}
.content-builder-video-embed--gmeet .content-builder-video-embed__icon {
    color: #00897b;
}
.form-group label.content-builder-video-embed__detect:has(input:checked),
.content-builder-video-embed__detect:has(input:checked) {
    border-color: #86efac;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}
.content-builder-video-embed__embed-toggle {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    margin: 0;
    display: inline-flex;
    cursor: pointer;
}
.content-builder-video-embed__embed-toggle[hidden],
.content-builder-meet-attendance[hidden] {
    display: none !important;
}
.form-group label.content-builder-video-embed__detect > input[data-link-embed-toggle],
.content-builder-video-embed__detect > input[data-link-embed-toggle],
.content-builder-video-embed__embed-toggle > input[data-link-embed-toggle] {
    margin: 0;
    width: 1.25rem;
    height: 1.25rem;
    accent-color: #16a34a;
}
.content-builder-meet-attendance {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin: 0.65rem 0 0;
    padding: 0.75rem 0.85rem;
    border-radius: 0.75rem;
    border: 1px dashed #99d5cf;
    background: #f0fdfa;
    cursor: pointer;
    font-weight: normal;
}
.content-builder-meet-attendance input {
    margin-top: 0.2rem;
    accent-color: #00897b;
}
.content-builder-meet-attendance strong {
    display: block;
    font-size: 0.85rem;
    color: #0f766e;
}
.content-builder-meet-attendance small {
    display: block;
    font-size: 0.75rem;
    color: var(--ink-3);
    margin-top: 0.15rem;
}
.material-meet-join {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.1rem;
    margin: 0.75rem 0 1rem;
    border-radius: 0.85rem;
    border: 1px solid #99d5cf;
    background: linear-gradient(135deg, #e0f2f1 0%, #fff 65%);
}
.material-meet-join__lead {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.material-meet-join__icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #00897b;
    font-size: 1.1rem;
}
.material-meet-attendance {
    margin-top: 1.15rem;
    border: 1px solid #d1e7e4;
    border-radius: 0.95rem;
    background: #fff;
    overflow: hidden;
}
.material-meet-attendance__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.95rem 1.1rem;
    background: linear-gradient(135deg, #f0fdfa 0%, #fff 70%);
    border-bottom: 1px solid #e2eeec;
}
.material-meet-attendance__title {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}
.material-meet-attendance__title-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e0f2f1;
    color: #00897b;
    flex-shrink: 0;
}
.material-meet-attendance__title h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink);
}
.material-meet-attendance__title p {
    margin: 0.1rem 0 0;
    font-size: 0.75rem;
    color: var(--ink-3);
}
.material-meet-attendance__count {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #e0f2f1;
    color: #0f766e;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.material-meet-attendance__count strong {
    font-size: 0.95rem;
}
.material-meet-attendance__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    padding: 1.75rem 1rem;
    color: var(--ink-3);
    text-align: center;
}
.material-meet-attendance__empty i {
    font-size: 1.35rem;
    color: #99d5cf;
}
.material-meet-attendance__empty p {
    margin: 0;
    font-size: 0.85rem;
}
.material-meet-attendance__list {
    list-style: none;
    margin: 0;
    padding: 0.35rem 0;
}
.material-meet-attendee {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.1rem;
}
.material-meet-attendee + .material-meet-attendee {
    border-top: 1px solid #f1f5f4;
}
.material-meet-attendee__avatar {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ccfbf1;
    color: #0f766e;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}
.material-meet-attendee__main {
    min-width: 0;
}
.material-meet-attendee__identity {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.material-meet-attendee__identity strong {
    font-size: 0.9rem;
    color: var(--ink);
}
.material-meet-attendee__role {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    background: #f1f5f9;
    color: #475569;
    white-space: nowrap;
}
.material-meet-attendee__role--student {
    background: #eff6ff;
    color: #1d4ed8;
}
.material-meet-attendee__role--teacher {
    background: #fff7ed;
    color: #c2410c;
}
.material-meet-attendee__role--school_admin {
    background: #f5f3ff;
    color: #6d28d9;
}
.material-meet-attendee__email {
    margin-top: 0.1rem;
    font-size: 0.75rem;
    color: var(--ink-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.material-meet-attendee__times {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.85rem;
    margin-top: 0.3rem;
    font-size: 0.72rem;
    color: var(--ink-2);
}
.material-meet-attendee__times i {
    margin-right: 0.2rem;
    color: #99d5cf;
}
.material-meet-attendee__joins {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 3rem;
    padding: 0.35rem 0.5rem;
    border-radius: 0.65rem;
    background: #f0fdfa;
    border: 1px solid #d1e7e4;
    text-align: center;
}
.material-meet-attendee__joins-num {
    font-size: 1rem;
    font-weight: 800;
    color: #0f766e;
    line-height: 1.1;
}
.material-meet-attendee__joins-label {
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #5eead4;
}
@media (max-width: 560px) {
    .material-meet-attendee {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 0.55rem 0.7rem;
    }
    .material-meet-attendee__joins {
        grid-column: 2;
        flex-direction: row;
        justify-content: flex-start;
        gap: 0.35rem;
        width: fit-content;
        min-width: 0;
        padding: 0.2rem 0.55rem;
    }
    .material-meet-attendee__joins-num {
        font-size: 0.85rem;
    }
}
.content-builder-video-embed__icon {
    grid-column: 1;
    grid-row: 1;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #dc2626;
    border: 1px solid #fecaca;
    font-size: 1.1rem;
}
.content-builder-video-embed__copy {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.content-builder-video-embed__detect strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 800;
    color: #14532d;
}
.content-builder-video-embed__detect span[data-video-detect-copy] {
    font-size: 0.8rem;
    font-weight: 500;
    color: #3f6212;
    line-height: 1.4;
}
.material-video-embed-note {
    margin: 0 0 1rem;
    font-size: 0.85rem;
}

.content-builder__format-panel--editor {
    background: linear-gradient(135deg, #f0f7ff 0%, #fff 70%);
    border-color: #c7ddf5;
}
.content-builder__format-panel--editor .content-builder__callout {
    margin: 0;
    border: 0;
    background: transparent;
    padding: 0;
}

@media (max-width: 960px) {
    .content-builder__format-grid {
        grid-template-columns: 1fr;
    }
    .content-builder-format {
        min-height: 0;
        flex-direction: row;
        align-items: center;
        gap: 0.85rem;
        padding-right: 2.5rem;
    }
    .content-builder-format__icon {
        flex-shrink: 0;
    }
}

.content-builder-choice {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
}

.content-builder-choice.is-selected {
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 7%, transparent);
}

.content-builder-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.content-builder-choice > i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.content-builder-choice strong,
.content-builder-choice small {
    display: block;
}

.content-builder-choice small {
    margin-top: .2rem;
    color: var(--text-muted);
}

.content-builder__subheading,
.content-builder__field-card h3 {
    margin: 1rem 0 .75rem;
    font-size: 1rem;
}

.content-builder-dropzone {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.9rem 1rem;
    min-height: 150px;
    margin: 1rem 0;
    padding: 1.15rem 1.25rem;
    border: 2px dashed #94a3b8;
    border-radius: 15px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.content-builder-dropzone:hover,
.content-builder-dropzone.is-dragging {
    border-color: var(--primary, #0f6cbf);
    background: linear-gradient(180deg, #f0f7ff 0%, #e8f2fc 100%);
    box-shadow: 0 0 0 4px rgba(15, 108, 191, 0.08);
}

.content-builder-dropzone.is-dragging {
    transform: translateY(-1px);
}

.content-builder-dropzone.has-file {
    border-style: solid;
    border-color: #14b8a6;
    background: linear-gradient(180deg, #f0fdfa 0%, #ecfdf5 100%);
    box-shadow: 0 8px 20px rgba(13, 148, 136, 0.08);
}

.content-builder-dropzone.has-file:hover {
    border-color: #0d9488;
    background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.12);
}

.content-builder-dropzone.is-invalid {
    border-style: solid;
    border-color: #f87171;
    background: linear-gradient(180deg, #fff7f7 0%, #fef2f2 100%);
    box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.12);
}

.content-builder-dropzone.is-invalid .content-builder-dropzone__icon {
    background: #fee2e2;
    color: #b91c1c;
}

.content-builder-dropzone.is-invalid [data-file-hint] {
    color: #b91c1c;
    font-weight: 600;
}

.content-builder-dropzone__icon {
    display: grid;
    place-items: center;
    width: 3.15rem;
    height: 3.15rem;
    flex: 0 0 auto;
    border-radius: 0.9rem;
    background: #e2e8f0;
    color: #475569;
    font-size: 1.25rem;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
    transition: background 0.18s ease, color 0.18s ease;
}

.content-builder-dropzone:hover .content-builder-dropzone__icon,
.content-builder-dropzone.is-dragging .content-builder-dropzone__icon {
    background: #dbeafe;
    color: var(--primary, #0f6cbf);
}

.content-builder-dropzone.has-file .content-builder-dropzone__icon {
    background: #ccfbf1;
    color: #0f766e;
}

.content-builder-dropzone__copy {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-width: 0;
}

.content-builder-dropzone__status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: fit-content;
    margin-bottom: 0.15rem;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: #0f766e;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.content-builder-dropzone__copy strong {
    color: #0f172a;
    font-size: 0.98rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.content-builder-dropzone.has-file .content-builder-dropzone__copy strong {
    font-size: 1.02rem;
}

.content-builder-dropzone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.content-builder-dropzone small,
.content-builder-dropzone em,
.content-builder__field-card p {
    color: var(--text-muted, #64748b);
}

.content-builder-dropzone small {
    font-size: 0.82rem;
}

.content-builder-dropzone em {
    margin-top: 0.15rem;
    font-size: 0.78rem;
    font-style: normal;
    color: #0f766e;
    font-weight: 600;
}

.content-builder-dropzone em[hidden],
.content-builder-dropzone__status[hidden] {
    display: none !important;
}

.content-builder__field-card,
.content-builder__callout {
    margin-top: 1rem;
    padding: 1.1rem;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--surface-muted);
}

.content-builder__callout {
    display: flex;
    gap: .9rem;
    margin-bottom: 1.25rem;
}

.content-builder__callout > i {
    color: var(--primary-color);
    font-size: 1.25rem;
}

.content-builder__callout p {
    margin: .25rem 0 0;
    color: var(--text-muted);
}

.content-builder__details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.content-builder__access {
    display: grid;
    gap: 1rem;
}

.content-builder-access-card {
    padding: 1.15rem 1.2rem 1.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.content-builder-access-card__head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.85rem;
    align-items: start;
    margin-bottom: 1rem;
}

.content-builder-access-card__icon {
    display: grid;
    place-items: center;
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 0.85rem;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 1rem;
}

.content-builder-access-card__icon--schedule {
    background: #fef3c7;
    color: #b45309;
}

.content-builder-access-card__icon--grade {
    background: #dcfce7;
    color: #15803d;
}

.content-builder-access-card__head h3 {
    margin: 0;
    font-size: 1rem;
    color: #0f172a;
}

.content-builder-access-card__head p {
    margin: 0.2rem 0 0;
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.45;
}

.content-builder-access-schedule {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.95rem 1rem;
}

.content-builder-access-schedule--grade {
    grid-template-columns: minmax(10rem, 14rem) minmax(0, 1fr);
    align-items: stretch;
}

.content-builder-access-schedule__due {
    grid-column: 1 / -1;
}

.content-builder-access-schedule .form-group {
    margin: 0;
}

.content-builder-access-schedule label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: #334155;
}

.content-builder-access-schedule label i {
    color: #94a3b8;
    font-size: 0.85rem;
}

.content-builder-access-hint {
    display: block;
    margin-top: 0.35rem;
    color: #94a3b8;
    font-size: 0.78rem;
}

.content-builder__title-field,
.content-builder__wide,
.content-builder-publish {
    grid-column: 1 / -1;
}

.content-builder-publish {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 1.05rem;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.content-builder-publish:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.content-builder-publish:has(input:checked) {
    border-color: #86efac;
    background: linear-gradient(180deg, #f0fdf4 0%, #ecfdf5 100%);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.content-builder-publish__copy {
    min-width: 0;
}

.content-builder-publish strong,
.content-builder-publish small {
    display: block;
}

.content-builder-publish strong {
    color: #0f172a;
    font-size: 0.95rem;
}

.content-builder-publish small {
    margin-top: 0.2rem;
    color: #64748b;
    font-size: 0.82rem;
    line-height: 1.4;
}

.content-builder-publish__control {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    flex: 0 0 auto;
}

.content-builder-publish__control input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.content-builder-publish__switch {
    position: relative;
    width: 2.75rem;
    height: 1.55rem;
    border-radius: 999px;
    background: #cbd5e1;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
    transition: background 0.18s ease;
}

.content-builder-publish__switch::after {
    content: '';
    position: absolute;
    top: 0.18rem;
    left: 0.18rem;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
    transition: transform 0.18s ease;
}

.content-builder-publish:has(input:checked) .content-builder-publish__switch {
    background: #16a34a;
}

.content-builder-publish:has(input:checked) .content-builder-publish__switch::after {
    transform: translateX(1.2rem);
}

.content-builder-publish__state {
    min-width: 4.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #64748b;
    text-align: right;
}

.content-builder-publish:has(input:checked) .content-builder-publish__state {
    color: #15803d;
}

.content-builder-publish.is-disabled {
    opacity: 0.72;
    cursor: not-allowed;
}

.content-builder-publish.is-disabled:hover {
    border-color: #e2e8f0;
    background: #f8fafc;
}

.content-builder-publish--late {
    margin: 0;
    align-self: stretch;
}

.content-builder__preview {
    margin-top: 1.5rem;
    padding: 1rem 1.1rem 1.15rem;
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
    background:
        linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.content-builder__preview-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .85rem;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: #64748b;
}

.content-builder__preview-label small {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: #94a3b8;
    text-align: right;
}

.content-builder-preview-card {
    pointer-events: none;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.content-builder-preview-card .activity-module-main {
    min-width: 0;
}

.content-builder-preview-card .activity-module-media {
    pointer-events: auto;
}

.content-builder-preview-card .activity-module-media .material-video-embed {
    margin-top: 0.15rem;
}

.content-builder-preview-desc {
    margin: .35rem 0 0;
    font-size: .875rem;
    line-height: 1.45;
    color: #64748b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.content-builder-preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: .55rem;
}

.content-builder-preview-media {
    margin-top: .9rem;
}

.content-builder-preview-media__frame {
    overflow: hidden;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #0f172a;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.content-builder-preview-media__frame iframe {
    display: block;
    width: 100%;
    height: min(62vh, 560px);
    border: 0;
    background: #fff;
}

.content-builder-preview-media__empty,
.content-builder-preview-media__link,
.content-builder-preview-media__editor {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: 1rem 1.1rem;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: #fff;
    color: #475569;
}

.content-builder-preview-media__empty i,
.content-builder-preview-media__link i,
.content-builder-preview-media__editor i {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 2.25rem;
    border-radius: 10px;
    background: #eef2ff;
    color: #4338ca;
}

.content-builder-preview-media__empty p,
.content-builder-preview-media__editor p {
    margin: .2rem 0 0;
    font-size: .875rem;
    line-height: 1.45;
    color: #64748b;
}

.content-builder-preview-media__link strong,
.content-builder-preview-media__editor strong {
    display: block;
    color: #0f172a;
}

.content-builder-preview-media__link a {
    display: inline-block;
    margin-top: .2rem;
    font-size: .875rem;
    word-break: break-all;
}

.content-builder__panel-actions {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    margin-top: 1.6rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--border-color);
}

.content-builder-review {
    display: flex;
    gap: 1.1rem;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: var(--surface-muted);
}

.content-builder-review__icon {
    display: grid;
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    place-items: center;
    border-radius: 14px;
    background: var(--primary-color);
    color: #fff;
}

.content-builder-review h3 {
    margin: .15rem 0 .8rem;
}

.content-builder-review dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin: 0;
}

.content-builder-review dt {
    color: var(--text-muted);
    font-size: .75rem;
    text-transform: uppercase;
}

.content-builder-review dd {
    margin: .2rem 0 0;
    font-weight: 700;
}

.content-builder__embedded-ai .ai-builder-layout {
    margin-top: 0;
}

.content-builder__embedded-ai .ai-flow-form {
    display: block;
}

.content-builder__embedded-ai .ai-builder-main {
    width: 100%;
}

.ai-flow-panel {
    animation: content-builder-in .2s ease-out;
}

.ai-flow-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: 1rem 1.15rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

.ai-flow-review__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(250px, .65fr);
    gap: 1rem;
}

.ai-flow-review .ai-builder-preview,
.ai-flow-review .ai-builder-actions {
    margin: 0;
}

.ai-flow-review .ai-builder-actions {
    align-self: stretch;
}

.ai-flow-review .ai-builder-progress {
    margin: 0 1.15rem 1rem;
}

.ai-flow-validation {
    margin-bottom: 1rem;
}

@media (max-width: 760px) {
    .content-builder__hero-top {
        flex-wrap: wrap;
    }

    .content-builder__hero-meta {
        width: 100%;
        flex-wrap: wrap;
    }

    .content-builder__hero-row {
        align-items: flex-start;
    }

    .content-builder__hero-icon {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
        border-radius: 14px;
    }

    .content-builder__steps,
    .content-builder__steps--four,
    .content-builder__steps--seven {
        grid-template-columns: repeat(5, minmax(92px, 1fr));
        padding: .65rem .4rem;
    }

    .content-builder__steps--four {
        grid-template-columns: repeat(4, minmax(105px, 1fr));
    }

    .content-builder__steps--seven {
        grid-template-columns: repeat(7, minmax(92px, 1fr));
    }

    .content-builder__steps > a,
    .content-builder__steps > button,
    .content-builder__steps > span {
        min-width: 92px;
        flex-direction: column;
        gap: .35rem;
        text-align: center;
    }

    .content-builder__steps > *::before {
        top: 22px;
    }

    .content-builder__step-marker {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
    }

    .content-builder__step-copy {
        padding-inline: .15rem;
    }

    .content-builder__step-copy small {
        display: none;
    }

    .ai-flow-review__grid {
        grid-template-columns: 1fr;
    }

    .ai-count-presets {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ai-count-preset:last-child {
        grid-column: 1 / -1;
    }

    .ai-flow-actions {
        position: sticky;
        bottom: 0;
        z-index: 5;
        padding: .8rem .95rem;
    }

    .content-type-grid,
    .content-builder__choices,
    .content-builder__format-grid,
    .content-builder__details-grid,
    .content-builder-access-schedule,
    .content-builder-access-schedule--grade,
    .content-builder-review dl {
        grid-template-columns: 1fr;
    }

    .content-builder__title-field,
    .content-builder__wide,
    .content-builder-publish {
        grid-column: auto;
    }

    .content-builder-publish {
        align-items: flex-start;
        flex-direction: column;
    }

    .content-builder-publish__control {
        width: 100%;
        justify-content: space-between;
    }

    .content-builder__hero,
    .content-builder__type-step,
    .content-builder__panel {
        border-radius: 14px;
    }

    .content-builder__panel-actions {
        position: sticky;
        bottom: 0;
        z-index: 5;
        margin-inline: -1rem;
        margin-bottom: -1rem;
        padding: .85rem 1rem;
        background: var(--surface-color);
    }
}

