*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Baseline focus ring. Dozens of components set their own `outline: none` with a local
   replacement (often just a faint background tint) or none at all — this only needs to win
   where no local rule already handles focus, so it's deliberately not !important and the
   existing per-component rules are left alone. */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* 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);
    max-width: min(96vw, calc(100% - 2rem));
    margin: auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
}
dialog:modal > * {
    min-width: 0;
}
dialog:modal > form[method="dialog"],
dialog:modal > .dialog-body,
dialog:modal > .modal-body {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
dialog:modal > form[method="dialog"]::-webkit-scrollbar,
dialog:modal > .dialog-body::-webkit-scrollbar,
dialog:modal > .modal-body::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
dialog:modal > form[method="dialog"]::-webkit-scrollbar-track,
dialog:modal > .dialog-body::-webkit-scrollbar-track,
dialog:modal > .modal-body::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}
dialog:modal > form[method="dialog"]::-webkit-scrollbar-thumb,
dialog:modal > .dialog-body::-webkit-scrollbar-thumb,
dialog:modal > .modal-body::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--scroll-radius);
    border: 2px solid var(--scrollbar-track);
    background-clip: padding-box;
}
dialog:modal > form[method="dialog"]::-webkit-scrollbar-thumb:hover,
dialog:modal > .dialog-body::-webkit-scrollbar-thumb:hover,
dialog:modal > .modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    background-clip: padding-box;
    border: 2px solid var(--scrollbar-track);
}

: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;
    --drawer-width-collapsed: 4.5rem;
    --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);
    --scrollbar-w: 10px;
    --scrollbar-h: 10px;
    --scrollbar-track: transparent;
    --scrollbar-thumb: #cbd5e1;
    --scrollbar-thumb-hover: #94a3b8;
    --scrollbar-thumb-active: var(--primary);
    --scroll-radius: 999px;
    --scroll-smooth-offset: 80px;
}

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;
    max-height: min(72vh, 520px);
    display: none;
    flex-direction: column;
}
.user-dropdown.open { display: flex; }
.user-dropdown > *:not(.user-dropdown__scroll) { flex-shrink: 0; }
.user-dropdown__scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
.user-dropdown__scroll::-webkit-scrollbar {
    width: 8px;
}
.user-dropdown__scroll::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}
.user-dropdown__scroll::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--scroll-radius);
}
.user-dropdown__scroll::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}
.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.78rem;
}
.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: visible;
    z-index: 900;
    transform: translateX(-100%); transition: transform 0.2s ease, width 0.2s ease;
    box-shadow: 2px 0 12px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
}
.drawer-nav {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
.drawer-nav::-webkit-scrollbar {
    width: 8px;
}
.drawer-nav::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}
.drawer-nav::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--scroll-radius);
    border: 2px solid var(--scrollbar-track);
    background-clip: padding-box;
}
.drawer-nav::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    background-clip: padding-box;
    border: 2px solid var(--scrollbar-track);
}
.drawer-brand {
    padding: 1.25rem 1.25rem 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}
.drawer-brand-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.drawer-collapse-toggle {
    display: none;
    position: absolute;
    top: 50%;
    right: -0.95rem;
    transform: translateY(-50%);
    z-index: 10;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 3.5rem;
    border: 2px solid var(--surface);
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-size: 0.75rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
    transition: background 0.12s, transform 0.12s;
}
.drawer-collapse-toggle:hover {
    background: var(--primary-dark);
    transform: translateY(-50%) scale(1.08);
}
@media (min-width: 992px) {
    .drawer-collapse-toggle { display: inline-flex; }
}

/* -- Collapsed (icon-rail) sidebar --
   Desktop-only: the collapse preference is saved in localStorage and would otherwise
   carry over to the mobile off-canvas drawer, shrinking it to icons there too. The
   collapse toggle button itself is already desktop-only (see above), so this just makes
   the CSS side agree with that. */
@media (min-width: 992px) {
    .moodle-drawer.collapsed {
        width: var(--drawer-width-collapsed);
    }
    .moodle-drawer.collapsed .drawer-brand-label {
        display: none;
    }
    .moodle-drawer.collapsed .drawer-collapse-toggle i {
        transform: rotate(180deg);
    }
    .moodle-drawer.collapsed .drawer-link {
        justify-content: center;
        gap: 0;
        padding: 0.8rem 0.65rem;
    }
    .moodle-drawer.collapsed .drawer-link i {
        width: auto;
        font-size: 1rem;
    }
    /* The full-width left-edge bar (.drawer-link.active's box-shadow) reads as a thin crescent
       against the small, centered icon-only button collapsed mode uses — swap it for a round
       badge behind the icon instead, so the active state stays a circle, not a sliver. */
    .moodle-drawer.collapsed .drawer-link.active {
        background: none;
        box-shadow: none;
    }
    .moodle-drawer.collapsed .drawer-link.active i {
        box-sizing: border-box !important;
        display: flex !important;
        flex: none !important;
        align-items: center !important;
        justify-content: center !important;
        width: 2.25rem !important;
        height: 2.25rem !important;
        min-width: 2.25rem !important;
        min-height: 2.25rem !important;
        max-width: 2.25rem !important;
        max-height: 2.25rem !important;
        line-height: 1 !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 50% !important;
        /* --drawer-active (#eef5fc) is nearly invisible against the drawer's own white
           background at this small size — solid fill + white glyph instead, matching the
           icon-badge treatment already used elsewhere (institute icons, feature-setting icons). */
        background: var(--primary);
        color: #fff;
    }
    .moodle-drawer.collapsed .drawer-link span,
    .moodle-drawer.collapsed .drawer-link-badge,
    .moodle-drawer.collapsed .drawer-link-tag {
        display: none;
    }
    .moodle-drawer.collapsed .drawer-section-toggle {
        display: none;
    }
    /* Icon-rail mode ignores each section's own expand/collapse state — every icon stays visible */
    .moodle-drawer.collapsed .drawer-section-links,
    .moodle-drawer.collapsed .drawer-section-links.collapsed {
        max-height: none;
        opacity: 1;
    }
    .moodle-drawer.collapsed ~ .moodle-main,
    .moodle-layout:has(.moodle-drawer.collapsed) .moodle-main {
        max-width: calc(100% - var(--drawer-width-collapsed));
    }
}
.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: clamp(0.75rem, 2.5vw, 1.5rem) clamp(0.75rem, 3vw, 1.75rem) clamp(1.25rem, 4vw, 2.75rem);
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
    scroll-behavior: smooth;
    transition: max-width 0.2s ease;
}
@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; }
.page-header-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    vertical-align: middle;
    margin-left: 0.6rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}
.page-header-badge--success { background: #d4edda; color: #155724; }
.page-header-badge--neutral { background: #e9ecef; color: #495057; }
.page-header-badge--warning { background: #fff3cd; color: #856404; }
.admin-page-header--compact {
    padding: 0.65rem 1rem;
    box-shadow: none;
    background: transparent;
    border: none;
    margin-bottom: 1rem;
}
.admin-page-header--compact .admin-page-header__icon {
    width: 2.1rem;
    height: 2.1rem;
    font-size: 0.85rem;
    border-radius: 0.6rem;
}
.admin-page-header--compact .admin-page-header__copy h1 { font-size: 1.15rem; }
.admin-page-header--compact .page-subtitle { font-size: 0.8125rem; margin-top: 0.15rem; }
.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; padding-bottom: 0.5rem; }
.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-workspace .section-tab-panel.is-active { padding: 1.15rem 1.25rem 1.35rem; }
.section-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: clip; 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;
    overflow-y: hidden;
    max-width: 100%;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
.gb-table-wrap::-webkit-scrollbar {
    height: 8px;
}
.gb-table-wrap::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}
.gb-table-wrap::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--scroll-radius);
}
.gb-table-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}
.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; white-space: nowrap; }
.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-manual-input--locked[readonly] { background: #f1f5f9; color: #475569; cursor: default; caret-color: transparent; }
.gb-manual-input--rating {
    width: 5.5rem;
    min-width: 4.5rem;
    max-width: 100%;
    text-align: center;
    font-weight: 700;
    font-size: 0.9375rem;
    letter-spacing: 0.02em;
    border-radius: 0.45rem;
    padding: 0.4rem 0.5rem;
}
.gb-cell-rating {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    padding: 0.25rem 0.55rem;
    border-radius: 0.4rem;
    font-weight: 800;
    font-size: 0.9375rem;
    background: #eef6fc;
    color: var(--primary-dark, #0b4f8a);
}
.gb-table-toolbar__lead {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    margin-right: auto;
}
.gb-table-toolbar__mode {
    font-size: 0.8125rem;
    font-weight: 800;
    color: var(--text);
}
.gb-table-panel--rating .gb-table-toolbar__mode {
    color: var(--primary-dark, #0b4f8a);
}
.gb-table__passed-col {
    text-align: center;
    width: 6.5rem;
    min-width: 5.5rem;
    background: rgba(25, 135, 84, 0.04);
}
.gb-table thead th.gb-table__passed-col {
    background: #f3faf6;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.gb-pass-toggle--inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0.3rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}
.gb-pass-toggle--inline input { margin: 0; }
.gb-pass-toggle--inline.is-on {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}
.gb-locked-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 0.85rem;
    border: 1px solid #f0d8a7;
    background: #fff8e8;
    color: #855d10;
}
.gb-locked-banner i {
    margin-top: 0.2rem;
    font-size: 1.1rem;
}
.gb-locked-banner strong {
    display: block;
    margin-bottom: 0.2rem;
}
.gb-locked-banner p {
    margin: 0;
    font-size: 0.85rem;
    color: #8a6a2e;
}
.gb-pass-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}
.gb-pass-badge--passed {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}
.gb-pass-badge--failed {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #991b1b;
}
.gb-pass-badge--pending {
    opacity: 0.6;
}
.gb-pass-toggle--inline.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.gb-table__row.is-passed .gb-table__student-col {
    box-shadow: inset 3px 0 0 #22c55e;
}
.gb-table-panel--rating .gb-table-wrap {
    overflow-x: visible;
    scrollbar-gutter: auto;
}
.gb-table--rating {
    min-width: 0 !important;
    table-layout: auto;
    width: 100%;
}
.gb-table--rating .gb-table__student-col {
    min-width: 12rem;
    width: 40%;
}
.gb-table--rating .gb-table__comp-col {
    min-width: 6.5rem;
    width: auto;
}
.gb-table--rating .gb-table__comp-head {
    flex-direction: row;
    gap: 0.35rem;
    padding: 0.25rem 0.5rem;
}
.gb-table-panel--rating .gb-table__comp-weight,
.gb-table-panel--rating .gb-table__period-weight,
.gb-table-panel--rating .gb-table-toolbar__period em {
    display: none;
}
.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; position: relative; z-index: 1; }

.gb-passed-panel {
    border-top: 1px solid var(--border);
    background: #f8fafc;
    padding: 0.85rem 1rem 1rem;
}
.gb-passed-panel__head {
    margin-bottom: 0.65rem;
}
.gb-passed-panel__head strong {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    color: var(--text);
}
.gb-passed-panel__head strong i { color: var(--success, #198754); }
.gb-passed-panel__head p {
    margin: 0.2rem 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.gb-passed-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.gb-passed-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}
.gb-passed-list__item.is-passed {
    border-color: #86efac;
    background: #f0fdf4;
}
.gb-passed-list__item.is-incomplete {
    opacity: 0.85;
}
.gb-passed-list__student {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}
.gb-passed-list__student strong {
    display: block;
    font-size: 0.875rem;
}
.gb-passed-list__student span {
    display: block;
    font-size: 0.6875rem;
    color: var(--text-muted);
}

/* 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;
}
/* One collapsible per academic year + semester — the current term opens expanded (the [open]
   attribute is set server-side), every past term starts collapsed, matching the same
   chevron-rotate mechanic .fin-row-group already uses for billing history. */
.student-grades__term-group {
    margin-bottom: 1.1rem;
}
.student-grades__term-group:last-child {
    margin-bottom: 0;
}
.student-grades__term-group > .student-grades__list {
    margin-top: 0.75rem;
}
.student-grades__term-summary {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.15rem;
    cursor: pointer;
    list-style: none;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    color: var(--text);
}
.student-grades__term-summary::-webkit-details-marker {
    display: none;
}
.student-grades__term-chevron {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.15s;
    flex-shrink: 0;
}
.student-grades__term-group[open] .student-grades__term-chevron {
    transform: rotate(90deg);
}
.student-grades__term-label {
    flex: 1 1 auto;
    font-size: 0.9rem;
}
.student-grades__term-summary .badge {
    flex-shrink: 0;
}
.student-grades__term-summary .student-grades__board-count {
    flex-shrink: 0;
}
.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--failed { border-left-color: #c0392b; }
.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,
.student-grades__row--failed .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--failed {
    background: #fdebec;
    color: #8b1e1e;
}
.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;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    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__failed {
    color: #b91c1c;
}
.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; }

/* Multi-period gradebook */
.gb-table-panel--periods .gb-table-toolbar {
    gap: 0.65rem 1rem;
}
.gb-table-toolbar__periods {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-right: auto;
}
.gb-table-toolbar__period {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 800;
    border: 1px solid transparent;
}
.gb-table-toolbar__period em {
    font-style: normal;
    font-weight: 600;
    opacity: 0.75;
}
.gb-table-toolbar__period--0 { background: #e8f2fb; color: #0f6cbf; border-color: #b6d4f0; }
.gb-table-toolbar__period--1 { background: #f3ebff; color: #6f42c1; border-color: #d9c7f5; }
.gb-table-toolbar__period--2 { background: #eaf7ef; color: #198754; border-color: #b7e0c7; }

.gb-table--periods { min-width: 980px; border-collapse: collapse; }
.gb-table--periods thead th {
    z-index: 1;
}
.gb-table--periods .gb-table__period-row th {
    border-bottom: none;
}
.gb-table--periods .gb-table__component-row th {
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.04);
}

.gb-table__period-group {
    text-align: center;
    padding: 0.45rem 0.5rem !important;
    border-bottom: none !important;
}
.gb-table__period-group-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(15, 23, 42, 0.08);
}
.gb-table__period-group-label {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
}
.gb-table__period-group-name {
    font-size: 0.8125rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: none;
}
.gb-table__period-weight {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    background: rgba(15, 23, 42, 0.06);
    color: inherit;
    text-transform: none;
    letter-spacing: 0;
    margin-left: 0;
}

.gb-table__period-group--0 { background: linear-gradient(180deg, #e8f2fb 0%, #f4f9fd 100%); color: #0f6cbf; }
.gb-table__period-group--1 { background: linear-gradient(180deg, #f3ebff 0%, #faf6ff 100%); color: #6f42c1; }
.gb-table__period-group--2 { background: linear-gradient(180deg, #eaf7ef 0%, #f5fbf7 100%); color: #198754; }

.gb-table__band--0 { background: rgba(15, 108, 191, 0.035); }
.gb-table__band--1 { background: rgba(111, 66, 193, 0.035); }
.gb-table__band--2 { background: rgba(25, 135, 84, 0.035); }
.gb-table thead th.gb-table__band--0 { background: #f4f9fd; }
.gb-table thead th.gb-table__band--1 { background: #faf6ff; }
.gb-table thead th.gb-table__band--2 { background: #f5fbf7; }

.gb-table__period-avg-col {
    min-width: 5.75rem;
    text-align: center;
    border-left: 1px dashed rgba(15, 23, 42, 0.1);
    border-right: 2px solid rgba(15, 23, 42, 0.08);
}
.gb-table__period-avg-label {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.gb-final--period {
    font-size: 0.8125rem;
    min-width: 3.5rem;
}

.gb-table__summary-head {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.gb-table__final-col {
    text-align: center;
    min-width: 5.5rem;
    background: rgba(15, 108, 191, 0.06);
    border-left: 2px solid rgba(15, 108, 191, 0.18);
}
.gb-table thead th.gb-table__final-col {
    background: #eef6fc;
}

.gb-sync-period-title {
    margin: 1rem 0 0.5rem;
    font-size: 0.9375rem;
    font-weight: 800;
}
.gb-period-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.gb-period-summary__item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}
.gb-period-summary__item strong { font-size: 0.8125rem; }
.gb-period-summary__item span { font-size: 1.25rem; font-weight: 800; }
.gb-period-summary__item small { color: var(--text-muted); font-size: 0.75rem; }
.gb-period-block { margin-bottom: 1.25rem; }
.gb-period-block__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}
.gb-period-block__head strong { font-size: 0.9375rem; }
.gb-period-block__head span { font-size: 0.8125rem; color: var(--text-muted); }
.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-mode {
    display: inline-flex;
    align-items: stretch;
    padding: 0.15rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    gap: 0.1rem;
}
.grading-scheme-mode__option {
    display: block;
    cursor: pointer;
    margin: 0;
}
.grading-scheme-mode__option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.grading-scheme-mode__option span {
    display: block;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1.2;
    transition: background 0.15s ease, color 0.15s ease;
}
.grading-scheme-mode__option input:checked + span {
    background: var(--primary);
    color: #fff;
}
.grading-scheme-mode__option input:focus-visible + span {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.grading-scheme-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 1rem;
    margin: 0.55rem 0.85rem 0.35rem;
    clear: both;
}
.grading-scheme-top__hint {
    flex: 1 1 12rem;
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text-muted);
}
.grading-scheme-top .grading-scheme-total-badge {
    margin-left: auto;
}
.grading-scheme-passing {
    flex: 0 0 auto;
    margin: 0;
    min-width: 12rem;
}
.grading-scheme-passing label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}
.grading-scheme-passing__input {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.grading-scheme-passing__input input {
    max-width: 6rem;
}
.grading-scheme-passing small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.7rem;
    line-height: 1.35;
}
.grading-scheme-fieldset--rating .grading-scheme-period__weight-label,
.grading-scheme-fieldset--rating .grading-scheme-row__weight,
.grading-scheme-fieldset--rating .grading-scheme-preview--compact,
.grading-scheme-fieldset--rating [data-period-component-badge],
.grading-scheme-fieldset--rating #gradingPeriodWeightBadge,
.grading-scheme-fieldset--rating .grading-scheme-table-head span:nth-child(3) {
    display: none !important;
}
.grading-scheme-fieldset--rating .grading-scheme-table-head {
    grid-template-columns: minmax(7rem, 0.9fr) minmax(0, 1.6fr) 2.25rem;
}
.grading-scheme-fieldset--rating .grading-scheme-row {
    grid-template-columns: minmax(7rem, 0.9fr) minmax(0, 1.6fr) 2.25rem;
}
.gb-manual-input--rating {
    width: 5.5rem;
}
.gb-table-panel--rating .gb-table__period-avg-col,
.gb-table-panel--rating .gb-final--period {
    display: none;
}
.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; }
.grading-scheme-period-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid #d4e4f7;
    background: rgba(255, 255, 255, 0.4);
}
.grading-scheme-period-toolbar__text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}
.grading-scheme-period-toolbar__title {
    font-size: 0.8125rem;
    font-weight: 800;
    color: var(--text);
}
.grading-scheme-period-toolbar__hint {
    font-size: 0.71875rem;
    color: var(--text-muted);
}
.grading-scheme-period-toolbar__btn {
    flex-shrink: 0;
}
.grading-scheme-periods {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.85rem;
}
.grading-scheme-period {
    border: 1px solid #d4e4f7;
    border-radius: var(--radius-lg);
    background: #fff;
    padding: 0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}
.grading-scheme-period.is-empty {
    border-style: dashed;
    background: #fcfdff;
}
.grading-scheme-period__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    margin: 0;
    padding: 0.7rem 0.85rem;
    background: linear-gradient(180deg, #f8fbff 0%, #fff 100%);
    border-bottom: 1px solid #e8eef6;
}
.grading-scheme-period__identity {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}
.grading-scheme-period__index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 0.45rem;
    background: var(--primary);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 800;
    flex-shrink: 0;
}
.grading-scheme-period__title {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.85rem;
    align-items: flex-end;
}
.grading-scheme-period__name-label,
.grading-scheme-period__weight-label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.grading-scheme-period__name-label .form-control {
    min-width: 4.5rem;
    max-width: 7rem;
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0.35rem 0.5rem;
}
.grading-scheme-period__weight-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 7.5rem;
    padding: 0.2rem 0.55rem 0.2rem 0.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    box-sizing: border-box;
}
.grading-scheme-period__weight-wrap .form-control {
    width: 5.75rem;
    min-width: 5.75rem;
    text-align: right;
    border: none;
    box-shadow: none;
    padding: 0.3rem 0.15rem 0.3rem 0.35rem;
    font-size: 0.875rem;
    font-weight: 700;
    /* Leave room for native number spinners so digits are not clipped */
    padding-right: 0.15rem;
}
.grading-scheme-period__weight-wrap .form-control:focus {
    outline: none;
    box-shadow: none;
}
.grading-scheme-period__pct {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
    line-height: 1;
}
.grading-scheme-period__head-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.grading-scheme-period__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.grading-scheme-period__remove:hover {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fef2f2;
}
.grading-scheme-period__body {
    padding: 0.75rem 0.85rem 0.85rem;
}
.grading-scheme-period .grading-scheme-preview--compact {
    margin: 0;
    padding: 0 0.85rem;
}
.grading-scheme-period .gb-weight-bar--admin {
    margin: 0.15rem 0 0.15rem;
}
.grading-scheme-period .gb-weight-bar__track {
    height: 0.4rem;
    background: #eef2f7;
}
.grading-scheme-period__empty {
    margin: 0.35rem 0 0;
    padding: 0.75rem 0.85rem;
    border: 1px dashed #d4e4f7;
    border-radius: var(--radius);
    background: #f8fbff;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.4;
    text-align: center;
}
.grading-scheme-total-badge--sm {
    min-width: 4.5rem;
    padding: 0.3rem 0.5rem;
}
.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,
#gradingPeriodWeightTotal.is-invalid,
[data-period-component-total].is-invalid { color: #b45309; }
#gradingWeightTotal.is-valid,
#gradingPeriodWeightTotal.is-valid,
[data-period-component-total].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; }
    .grading-scheme-period__head { flex-direction: column; align-items: stretch; }
    .grading-scheme-period-toolbar { align-items: stretch; }
    .grading-scheme-period-toolbar__btn { width: 100%; }
    .grading-scheme-period__identity { width: 100%; }
    .grading-scheme-period__head-actions { width: 100%; justify-content: space-between; }
}

/* ===== Subject Prerequisites ===== */
.prerequisites-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.25rem;
    margin: 1rem 0;
    background: #fafbfc;
}

.prerequisites-legend {
    font-weight: 800;
    padding: 0 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.prerequisites-legend__icon {
    color: var(--text-muted);
    font-size: 1.15rem;
}

.prerequisites-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0.5rem 0 1rem;
}

.prerequisites-list {
    margin-bottom: 1.5rem;
}

.prerequisites-list__title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.prerequisites-list__items {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.prerequisite-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.prerequisite-item:hover {
    border-color: var(--accent-l2, #bfdbfe);
    box-shadow: var(--shadow);
}

.prerequisite-item__info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

/* A small colored badge, same visual language as the section's own legend icon, so the row
   reads as "this subject links to another" at a glance instead of starting cold with plain text. */
.prerequisite-item__icon {
    flex: none;
    width: 2.15rem;
    height: 2.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.65rem;
    background: var(--accent-l3, #eef2ff);
    color: var(--primary);
    font-size: 0.9rem;
}

.prerequisite-item__text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.prerequisite-item__title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
}

/* This is the whole point of the row — the subject being required — so it gets the same weight
   as a heading, not a small muted code chip that used to make the row look nearly empty. */
.prerequisite-item__name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.prerequisite-item__level {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: #f3f4f6;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.prerequisite-item__desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prerequisite-item__grade {
    flex: none;
    font-size: 0.75rem;
    font-weight: 700;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
}

.prerequisite-item__form {
    margin: 0;
}

.prerequisite-item__remove {
    background: none;
    border: none;
    color: #d1d5db;
    cursor: pointer;
    padding: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: all 0.15s ease;
}

.prerequisite-item__remove:hover {
    color: #ef4444;
    background: #fee2e2;
}

.prerequisite-item__remove:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.prerequisite-add {
    margin-top: 0.25rem;
    padding: 1rem 1.1rem 1.1rem;
    background: var(--surface-alt, #f8fafc);
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-lg);
}

.prerequisite-add__title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.85rem;
}

.prerequisite-add__title i {
    color: var(--primary);
}

.prerequisite-add__form {
    margin: 0;
}

.prerequisite-add .form-row {
    display: grid;
    grid-template-columns: 1fr 12.5rem auto;
    gap: 0.75rem;
    align-items: flex-end;
}

.prerequisite-add .form-group label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.prerequisite-add .form-control {
    background: #fff;
}

.prerequisite-add .form-control-addon {
    position: relative;
    display: flex;
}

.prerequisite-add .form-control-addon .form-control {
    width: 100%;
    padding-right: 1.85rem;
}

.prerequisite-add .form-control-addon__suffix {
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    pointer-events: none;
}

.prerequisite-add .form-group--action {
    display: flex;
    align-items: center;
    height: 100%;
}

.prerequisite-add .form-group--action button {
    height: 2.5rem;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

@media (max-width: 720px) {
    .prerequisite-add .form-row {
        grid-template-columns: 1fr;
    }

    .prerequisite-add .form-group--action {
        width: 100%;
    }

    .prerequisite-add .form-group--action button {
        width: 100%;
        justify-content: 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-drag,
.activity-module-drag {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transition: color 0.15s ease, background 0.15s ease;
}
.course-lesson-drag:hover,
.activity-module-drag:hover {
    color: #475569;
}
.course-lesson-drag:active,
.activity-module-drag:active {
    cursor: grabbing;
}
.course-lesson-drag {
    width: 1.85rem;
    flex-shrink: 0;
    font-size: 0.85rem;
    border-right: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.7);
}
.activity-module-drag {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1.65rem;
    font-size: 0.75rem;
    border-right: 1px solid rgba(226, 232, 240, 0.6);
    background: rgba(248, 250, 252, 0.92);
    border-radius: 0.75rem 0 0 0.75rem;
    z-index: 6;
    pointer-events: auto;
}
.activity-module-drag i {
    pointer-events: none;
}
.activity-module {
    position: relative;
}
.activity-list--modules .activity-module {
    padding-left: 2.1rem;
}
.course-lesson.is-dragging,
.activity-module.is-dragging {
    opacity: 0.5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 100;
}
.course-lesson.is-sortable-source,
.activity-module.is-sortable-source {
    display: none !important;
}
.sortable-ghost {
    pointer-events: none !important;
    cursor: grabbing;
}
.sortable-ghost .activity-module-drag,
.sortable-ghost [data-section-drag],
.sortable-ghost .activity-module-actions,
.sortable-ghost .activity-module-media,
.sortable-ghost iframe,
.sortable-ghost video {
    display: none !important;
}
.sortable-placeholder {
    flex-shrink: 0;
}
.course-lesson.drag-over-top {
    border-top: 2px solid var(--primary);
}
.course-lesson.drag-over-bottom {
    border-bottom: 2px solid var(--primary);
}
.activity-module.drag-over-top {
    box-shadow: inset 0 2px 0 var(--primary);
}
.activity-module.drag-over-bottom {
    box-shadow: inset 0 -2px 0 var(--primary);
}
.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);
    position: relative;
    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;
}
/* Video embeds must receive taps (stretched title link must not sit above the iframe). */
.activity-module--video .activity-module-open-link::after {
    display: none;
}
.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 .activity-module-media {
    position: relative;
    z-index: 3;
    pointer-events: auto;
}
.activity-module--video .activity-module-media iframe {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: auto;
}
.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--image {
    margin-top: 0.15rem;
    border-radius: 0.65rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background:
        linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
        linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
        linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
    background-size: 14px 14px;
    background-position: 0 0, 0 7px, 7px -7px, -7px 0;
    background-color: #fff;
    pointer-events: none;
}
.activity-module-media--image img {
    display: block;
    width: 100%;
    max-height: 14rem;
    object-fit: contain;
    background: transparent;
}
.activity-module--image {
    --am-accent: #7c3aed;
    --am-accent-soft: #f5f3ff;
    --am-accent-wash: rgba(124, 58, 237, 0.07);
}
.activity-module--image .activity-module-icon {
    background: var(--am-accent-soft);
    color: var(--am-accent);
}
.activity-card-image-preview {
    display: block;
    margin-top: 0.65rem;
    border-radius: 0.65rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}
.activity-card-image-preview img {
    display: block;
    width: 100%;
    max-height: 14rem;
    object-fit: contain;
}
.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;
}
.material-video-expand {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    z-index: 4;
    width: 2.35rem;
    height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.82);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.material-video-expand:hover,
.material-video-expand:focus-visible {
    background: rgba(15, 23, 42, 0.96);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    outline: none;
}
.material-video-expand:active {
    transform: scale(0.94);
}
.material-video-expand i {
    font-size: 0.8rem;
}
body.video-embed-lightbox-open {
    overflow: hidden;
}
.video-embed-lightbox {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding:
        max(0.75rem, env(safe-area-inset-top, 0))
        max(0.75rem, env(safe-area-inset-right, 0))
        max(0.75rem, env(safe-area-inset-bottom, 0))
        max(0.75rem, env(safe-area-inset-left, 0));
}
.video-embed-lightbox[hidden] {
    display: none !important;
}
.video-embed-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.video-embed-lightbox__panel {
    position: relative;
    z-index: 1;
    width: min(100%, 920px);
    max-height: calc(100vh - 1.5rem);
    max-height: calc(100dvh - 1.5rem);
    display: flex;
    flex-direction: column;
    border-radius: 1rem;
    overflow: hidden;
    background: #0b1220;
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}
.video-embed-lightbox__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.85rem 1rem;
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}
.video-embed-lightbox__head-text {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.video-embed-lightbox__eyebrow {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
}
.video-embed-lightbox__title {
    color: #f8fafc;
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.35;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.video-embed-lightbox__close {
    width: 2.75rem;
    height: 2.75rem;
    flex-shrink: 0;
    border: 0;
    border-radius: 999px;
    background: #f8fafc;
    color: #0f172a;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    line-height: 1;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    touch-action: manipulation;
}
.video-embed-lightbox__close:hover,
.video-embed-lightbox__close:focus-visible {
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.32);
    outline: 2px solid rgba(248, 250, 252, 0.45);
    outline-offset: 2px;
}
.video-embed-lightbox__close:active {
    transform: scale(0.94);
}
.video-embed-lightbox__stage {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #020617;
}
.video-embed-lightbox__stage .material-video-embed {
    width: 100%;
    max-width: 100%;
    margin: 0;
    height: auto;
    padding-bottom: 0;
    aspect-ratio: 16 / 9;
    border-radius: 0;
    border: 0;
    background: #000;
}
.video-embed-lightbox__stage .material-video-expand {
    display: none;
}
body.proof-lightbox-open {
    overflow: hidden;
}
.proof-lightbox {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}
.proof-lightbox[hidden] {
    display: none !important;
}
.proof-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.proof-lightbox__panel {
    position: relative;
    z-index: 1;
    width: min(100%, 640px);
    max-height: calc(100vh - 2.5rem);
    max-height: calc(100dvh - 2.5rem);
    display: flex;
    align-items: center;
    justify-content: center;
}
.proof-lightbox__image {
    max-width: 100%;
    max-height: calc(100vh - 2.5rem);
    max-height: calc(100dvh - 2.5rem);
    border-radius: 0.75rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    background: #0b1220;
    display: block;
}
.proof-lightbox__close {
    position: absolute;
    top: -0.75rem;
    right: -0.75rem;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 999px;
    background: #f8fafc;
    color: #0f172a;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
    z-index: 2;
}
.proof-lightbox__close:hover,
.proof-lightbox__close:focus-visible {
    background: #fff;
    outline: 2px solid rgba(248, 250, 252, 0.45);
    outline-offset: 2px;
}
.proof-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.75rem;
    height: 2.75rem;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.65);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    z-index: 2;
    transition: background-color 0.15s ease;
}
.proof-lightbox__nav:hover {
    background: rgba(15, 23, 42, 0.85);
}
.proof-lightbox__nav--prev { left: 0.75rem; }
.proof-lightbox__nav--next { right: 0.75rem; }
.proof-lightbox__nav[hidden] { display: none !important; }
.proof-lightbox__counter {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.65);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
}
@media (max-width: 640px) {
    .proof-lightbox__close {
        top: 0.5rem;
        right: 0.5rem;
    }
}
.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.28rem;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.2rem;
    border-radius: 0.55rem;
    background: #f8fafc;
    border: 1px solid #e8edf3;
}
.activity-module-buttons .btn-sm {
    padding: 0.22rem 0.48rem;
    min-height: 1.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    white-space: nowrap;
    border-radius: 0.4rem;
    font-size: 0.7rem;
    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-buttons .activity-module-icon-button {
    width: 1.7rem;
    min-width: 1.7rem;
    min-height: 1.7rem;
    padding-left: 0;
    padding-right: 0;
}
.activity-module-buttons .activity-module-icon-button .activity-module-btn-label {
    display: none;
}
.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.7rem;
    min-width: 1.7rem;
    min-height: 1.7rem;
    padding-left: 0;
    padding-right: 0;
    border: 1px solid var(--border);
    background: #fff;
}
.activity-module-buttons .activity-module-icon-button.btn-danger,
.activity-module-buttons--quiz .activity-module-delete-button {
    color: #dc2626;
    background: #fff;
    border: 1px solid var(--border);
}
.activity-module-buttons .activity-module-icon-button.btn-danger:hover,
.activity-module-buttons--quiz .activity-module-delete-button:hover {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

@media (max-width: 680px) {
    .course-lesson-header {
        flex-direction: column;
        align-items: stretch;
    }
    .course-lesson-toggle {
        padding: 0.85rem 0.85rem 0.7rem;
        gap: 0.7rem;
        align-items: flex-start;
    }
    .course-lesson-index {
        width: 2.35rem;
        height: 2.35rem;
        border-radius: 0.75rem;
        font-size: 0.9rem;
    }
    .course-lesson-heading strong {
        font-size: 1rem;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .course-lesson-chevron {
        margin-left: auto;
        align-self: center;
    }
    .course-lesson-admin {
        border-left: none;
        border-top: 1px solid var(--border);
        padding: 0.45rem 0.75rem;
        justify-content: flex-end;
        gap: 0.35rem;
        background: rgba(248, 250, 252, 0.9);
    }
    .course-lesson-body {
        padding: 0.75rem;
    }
    .course-lesson-body-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .course-lesson-body-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .activity-module {
        padding: 0.65rem 0.7rem 0.7rem;
        gap: 0.4rem 0.5rem;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
    }
    .activity-list--modules .activity-module {
        padding-left: 1.95rem;
    }
    .activity-module-drag {
        width: 1.45rem;
        font-size: 0.7rem;
    }
    .activity-module-leading {
        gap: 0.12rem;
    }
    .activity-module-icon {
        width: 1.95rem;
        height: 1.95rem;
        border-radius: 0.5rem;
        font-size: 0.78rem;
    }
    .activity-module-type {
        font-size: 0.52rem;
        max-width: 3.4rem;
    }
    .activity-module-main h3 {
        font-size: 0.9rem;
        line-height: 1.25;
    }
    .activity-module-title-row {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.3rem 0.4rem;
    }
    .activity-module-title-row h3 {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .activity-module .quiz-status-badge,
    .activity-module-publish-badge {
        flex: 0 0 auto;
        font-size: 0.58rem;
        padding: 0.14rem 0.4rem;
    }
    .activity-module-info-panel {
        right: auto;
        left: 0;
        max-width: min(18rem, calc(100vw - 2.5rem));
    }
    .activity-module-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.3rem;
        padding-top: 0.3rem;
    }
    .activity-module-move {
        width: 100%;
        max-width: none;
        flex: none;
        justify-content: center;
    }
    .activity-module-buttons,
    .activity-module-buttons--quiz {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        gap: 0.28rem;
        padding: 0.22rem;
        grid-template-columns: none;
    }
    .activity-module-buttons .activity-module-publish-form,
    .activity-module-buttons--quiz .activity-module-publish-form {
        grid-column: auto;
        display: inline-flex;
        width: auto;
        flex: 1 1 auto;
        min-width: 0;
        max-width: 100%;
    }
    .activity-module-buttons .activity-module-publish-form .btn,
    .activity-module-buttons--quiz .activity-module-publish-button {
        width: 100%;
        min-height: 1.9rem;
        height: 1.9rem;
        padding: 0 0.55rem;
        font-size: 0.68rem;
        font-weight: 700;
        justify-content: center;
        touch-action: manipulation;
    }
    .activity-module-buttons > .btn,
    .activity-module-buttons > a.btn,
    .activity-module-buttons > form:not(.activity-module-publish-form) .btn {
        width: 1.9rem;
        min-width: 1.9rem;
        min-height: 1.9rem;
        height: 1.9rem;
        padding: 0;
        font-size: 0.72rem;
        justify-content: center;
        touch-action: manipulation;
    }
    .activity-module-buttons .btn-sm,
    .activity-module-buttons .activity-module-publish-form,
    .activity-module-buttons .activity-module-publish-button {
        flex: none;
        min-width: 0;
        justify-content: center;
    }
    .activity-module-buttons .activity-module-publish-form {
        flex: 1 1 auto;
    }
    .activity-module-buttons form:not(.activity-module-publish-form) {
        display: inline-flex;
        width: auto;
        margin: 0;
    }
    .activity-module-buttons .activity-module-icon-button,
    .activity-module-buttons--quiz .activity-module-icon-button {
        width: 1.9rem;
        min-width: 1.9rem;
        min-height: 1.9rem;
        height: 1.9rem;
        padding: 0;
    }
    .activity-module-btn-label {
        display: none;
    }
    .activity-module-publish-form .activity-module-btn-label,
    .activity-module-publish-button .activity-module-btn-label {
        display: inline;
    }

    .activity-module-media .material-video-embed,
    .activity-card--video .material-video-embed,
    .material-video-embed {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    .material-video-expand {
        width: 2.85rem;
        height: 2.85rem;
        top: 0.55rem;
        right: 0.55rem;
    }
    .video-embed-lightbox {
        padding:
            max(0.35rem, env(safe-area-inset-top, 0))
            max(0.35rem, env(safe-area-inset-right, 0))
            max(0.35rem, env(safe-area-inset-bottom, 0))
            max(0.35rem, env(safe-area-inset-left, 0));
    }
    .video-embed-lightbox__panel {
        width: 100%;
        max-height: calc(100dvh - 0.7rem);
        border-radius: 0.85rem;
    }
    .video-embed-lightbox__head {
        padding: 0.75rem 0.85rem;
        gap: 0.65rem;
    }
    .video-embed-lightbox__title {
        font-size: 0.9375rem;
    }
    .video-embed-lightbox__close {
        width: 3rem;
        height: 3rem;
        font-size: 1.2rem;
    }
    .video-embed-lightbox__stage .material-video-embed {
        width: 100%;
        max-width: 100%;
    }
    .activity-module-video-note {
        text-align: left;
        padding: 0 0.1rem;
    }
}

.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;
}

@media (max-width: 680px) {
    .course-content-section {
        padding: 1rem 0.85rem 1.15rem;
        border-radius: 1rem;
    }
    .course-content-intro__top {
        gap: 0.55rem;
    }
    .course-content-intro h2 {
        font-size: 1.1rem;
    }
    .course-content-toolbar {
        width: 100%;
        margin-left: 0;
    }
    .course-content-stats {
        width: 100%;
    }
}

.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.35rem;
    padding: 0.28rem 0.5rem;
    border: 1px solid #e5eaf0;
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.92);
    font-size: 0.7rem;
    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;
}
.course-card-prereq-warn {
    position: absolute;
    z-index: 2;
    top: 0.7rem;
    right: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}
.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: 1.5rem 0 1.15rem;
    font-size: 0.875rem;
}
.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.footer-top {
    display: grid;
    grid-template-columns: minmax(200px, 1.3fr) repeat(2, minmax(160px, 1fr));
    gap: 2rem 2.5rem;
    align-items: start;
}
@media (max-width: 700px) {
    .footer-top { grid-template-columns: 1fr; gap: 1.75rem; }
}
.footer-col-title {
    margin: 0 0 0.85rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #fff;
}
.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}
.footer-brand .logo { color: #fff; margin: 0; }
.footer-brand p {
    max-width: 22rem;
    margin: 0;
    line-height: 1.45;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.65);
}
.footer-school { min-width: 0; }
.footer-meta-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.footer-meta-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.65);
}
.footer-meta-list i { flex: 0 0 auto; width: 1rem; text-align: center; color: rgba(255, 255, 255, 0.45); }

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.footer-links a { color: rgba(255, 255, 255, 0.65); text-decoration: none; font-weight: 500; font-size: 0.8125rem; width: fit-content; }
.footer-links a:hover { color: #fff; text-decoration: underline; }
.footer-powered {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.55rem;
}
.footer-powered-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    white-space: nowrap;
}
.footer-ns-logo {
    display: block;
    width: auto;
    max-width: 118px;
    height: auto;
    background: #fff;
    border-radius: 0.5rem;
    padding: 0.3rem 0.45rem;
}
.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-top: 1.75rem;
    padding-top: 1.15rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-bottom-text {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 1rem;
}
.footer-copy {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8125rem;
    margin: 0;
}
.footer-version {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    margin: 0;
}

/* 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;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}
.landing-main {
    max-width: none;
    padding: 0;
    flex: 1 0 auto;
}

.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; }

/* A <fieldset> around a radio/checkbox group gives it an accessible group name via <legend>
   without changing how it looks — reset the browser's default border/padding/margin box. */
.quiz-question-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

.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); }
[data-mark-paid-trigger].btn-primary { background: var(--primary-dark) !important; }
[data-mark-paid-trigger].btn-primary:hover { background: var(--primary) !important; }
.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;
    display: flex;
    flex-direction: column;
}
.admin-table-card .table-wrap { border: none; border-radius: 0; box-shadow: none; overflow-x: auto; overflow-y: auto; -webkit-overflow-scrolling: touch; max-height: 500px; }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow-x: auto; overflow-y: auto; -webkit-overflow-scrolling: touch; box-shadow: var(--shadow); max-width: 100%; max-height: 500px; overscroll-behavior-x: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); }
.table-wrap::-webkit-scrollbar {
    height: 8px;
    width: 10px;
}
.table-wrap::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: var(--scroll-radius);
}
.table-wrap::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--scroll-radius);
}
.table-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}
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;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
.admin-table-card--subjects .admin-data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    box-shadow: inset 0 -1px 0 var(--border);
    font-weight: 700;
    color: #94a3b8;
}
.admin-table-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fafbfc 0%, var(--surface) 100%);
}
.admin-table-card-head--toggle {
    width: 100%;
    border: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
}
.admin-table-card-head--toggle .institute-card__chevron { transition: transform 0.15s ease; }
.admin-table-card-head--toggle[aria-expanded="true"] .institute-card__chevron { transform: rotate(90deg); }
.admin-table-card-head-text h2 {
    margin: 0 0 0.15rem;
    font-size: 1.0625rem;
    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;
    border-bottom: 1px solid #eef1f5;
}
.admin-data-table tbody tr:last-child {
    border-bottom: none;
}
.admin-data-table tbody tr:nth-child(even) {
    background: #fbfcfe;
}
.admin-data-table tbody tr:hover {
    background: #f0f7ff;
    box-shadow: inset 3px 0 0 var(--primary);
}
.admin-data-table tbody tr:hover:not(.is-inactive) .subject-code-chip {
    border-color: var(--primary);
    color: var(--primary-dark);
    background: var(--primary-light);
}
.admin-data-table tbody tr.is-inactive {
    background: #fef2f2;
    box-shadow: inset 3px 0 0 #dc2626;
}
.admin-data-table tbody tr.is-inactive:hover {
    background: #fee2e2;
}
.admin-data-table tbody tr.is-inactive td {
    color: #7f1d1d;
}
.admin-data-table tbody tr.is-inactive .subject-level,
.admin-data-table tbody tr.is-inactive .subject-status,
.admin-data-table tbody tr.is-inactive .subject-usage-badge {
    opacity: 0.72;
}
.admin-data-table tbody tr[hidden] { display: none; }
.admin-table-card--subjects .admin-data-table td {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}

.admin-table-card--subjects .col-subject { width: auto; min-width: 16rem; }
.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 .col-teacher { width: 7rem; white-space: nowrap; }
.admin-table-card--subjects .col-status { width: 5.75rem; white-space: nowrap; }
.admin-table-card--subjects th.col-actions,
.admin-table-card--subjects td.actions {
    width: 6rem;
    white-space: nowrap;
    padding-left: 0.5rem;
    padding-right: 0.75rem;
    overflow: visible;
}

.subject-level {
    font-size: 0.8125rem;
    color: var(--text);
}
.subject-level--empty {
    color: var(--text-muted);
}
.subject-units {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.subject-code-link {
    text-decoration: none !important;
    display: inline-block;
}
.subject-name-link {
    display: block;
    font-weight: 700;
    color: var(--text);
    text-decoration: none !important;
}
tr.table-row-link:hover .subject-name-link:not(.subject-name-link--disabled) { color: var(--primary); }
.subject-name-link--disabled {
    color: #9f1239;
    text-decoration: line-through !important;
    text-decoration-color: #f87171 !important;
}
.subject-code-chip {
    display: inline-block;
    padding: 0.25rem 0.55rem;
    border-radius: 0.4rem;
    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;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
    transition: border-color 0.12s, background 0.12s, color 0.12s, box-shadow 0.12s;
}
.subject-code-chip--disabled {
    border-color: #dc2626;
    background: #dc2626;
    color: #fff;
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
}
.admin-data-table tbody tr.is-inactive:hover .subject-code-chip--disabled {
    border-color: #b91c1c;
    color: #fff;
    background: #b91c1c;
}
.badge-inactive {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.subject-title {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.4;
    margin-top: 0.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.subject-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    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-status--warn {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}
/* Prerequisites gets its own table column (see .program-subject-table--curriculum below) so a
   subject's code/description and its prerequisite chip line up in clean, independent columns
   instead of wrapping together inside one crowded cell. */
.program-subject-table--curriculum {
    table-layout: fixed;
}
.program-subject-table--curriculum th:nth-child(1),
.program-subject-table--curriculum td:nth-child(1) { width: 40%; }
.program-subject-table--curriculum th:nth-child(2),
.program-subject-table--curriculum td:nth-child(2) { width: 60%; }
.program-subject-prereq-cell {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 1.35rem;
}
.program-subject-prereq-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--accent-l3, #eef2ff);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}
.program-subject-prereq-none {
    color: var(--text-muted);
    font-size: 0.8125rem;
}
.program-subject-prereq-edit-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-decoration: none;
    opacity: 0;
    transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.program-subject-table--curriculum tbody tr:hover .program-subject-prereq-edit-link,
.program-subject-prereq-edit-link:focus-visible {
    opacity: 1;
}
.program-subject-prereq-edit-link:hover {
    background: var(--accent-l3, #eef2ff);
    color: var(--primary);
}
.prereq-not-met-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: 0.5rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    font-size: 0.6875rem;
    font-weight: 700;
    white-space: nowrap;
}

.prereq-not-met-detail {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #92400e;
}

.program-subject-table-units {
    text-align: center;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.prereq-met-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: 0.5rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
    font-size: 0.6875rem;
    font-weight: 700;
    white-space: nowrap;
}

.subject-usage-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.65rem;
    height: 1.65rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #94a3b8;
    border: 1px solid #e2e8f0;
}
.subject-usage-badge.is-active {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: transparent;
}

.table-action-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;
    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;
}
.table-action-btn--success:hover {
    color: #15803d;
    border-color: #86efac;
    background: #f0fdf4;
}
.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,
tr.table-row-link:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    background: #e6edf6;
}
tr.table-row-link--unenrolled {
    background: #fbdfe1;
    border-left: 3px solid #c0202c;
}
tr.table-row-link--unenrolled:hover,
tr.table-row-link--unenrolled:focus-visible {
    background: #f7c9cc;
}
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-role,
.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: none;
    min-width: 10rem;
}
.admin-data-table--roster .col-program {
    width: auto;
    max-width: none;
    min-width: 8rem;
}

.admin-table-card .col-program { width: auto; }
.admin-table-card .col-code { width: 1%; white-space: nowrap; }
.admin-table-card .col-fee { width: 1%; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.admin-table-card .col-submitted { width: 1%; white-space: nowrap; color: var(--text-muted); }
.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 th.col-fee { text-align: right; }
.tuition-progress {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    min-width: 8rem;
}
.tuition-progress__amounts {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    white-space: nowrap;
}
.tuition-progress__paid {
    font-weight: 700;
    color: #b45309;
    font-variant-numeric: tabular-nums;
}
.tuition-progress__paid--full {
    color: var(--text);
}
.tuition-progress__total {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}
.tuition-progress__bar {
    width: 100%;
    height: 0.3rem;
    border-radius: 999px;
    background: var(--surface-2, #f1f5f9);
    overflow: hidden;
}
.tuition-progress__bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    transition: width 0.2s ease;
}
.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;
        min-width: 0;
        padding: 0;
    }
    .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,
    .admin-table-card--subjects .admin-data-table td.col-status {
        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-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: auto; min-width: 16rem; }
.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 .col-teacher { width: 7rem; white-space: nowrap; }
.admin-table-card--subjects .col-status { width: 5.75rem; white-space: nowrap; }
.admin-table-card--subjects th.col-actions,
.admin-table-card--subjects td.actions {
    width: 6rem;
    white-space: nowrap;
    padding-left: 0.5rem;
    padding-right: 0.75rem;
    overflow: visible;
}

.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; }
.badge-unenrolled { background: #c0202c; color: #fff; }
.status-badges { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }

.role-pill { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.role-pill--teacher { background: #f3e8ff; color: #7c3aed; }
.role-pill--school_admin { background: rgba(15, 108, 191, 0.12); color: var(--primary); }
.role-pill--position { background: #fef3c7; color: #92400e; }

.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; }

.page-content .pagination,
.admin-table-card .pagination,
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.25rem;
    flex-wrap: wrap;
    margin: 0 0 1.75rem;
    padding: 0.8rem 1rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.admin-table-card > .pagination {
    margin: 0;
    border: none;
    border-top: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    background: #f8fafc;
}
.admin-table-card:has(> .pagination) {
    margin-bottom: 1.75rem;
}
.pagination-meta {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.3;
    white-space: nowrap;
}
.pagination-meta strong {
    color: var(--ink-2);
    font-weight: 700;
}
.pagination-controls {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
    flex-wrap: nowrap;
}
.pagination-pages {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: nowrap;
}
.pagination-btn,
.pagination-page {
    box-sizing: border-box;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 2.1rem;
    height: 2.1rem;
    padding: 0 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    color: var(--ink-2) !important;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none !important;
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.04);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.pagination-btn i {
    font-size: 0.7rem;
    line-height: 1;
}
.pagination-btn:hover,
.pagination-page:hover {
    background: var(--primary-light);
    border-color: #c5daf0;
    color: var(--primary-dark) !important;
    text-decoration: none !important;
    box-shadow: none;
}
.pagination-page.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff !important;
    pointer-events: none;
    box-shadow: 0 1px 2px rgba(15, 108, 191, 0.35);
}
.pagination-btn.is-disabled {
    opacity: 0.38;
    pointer-events: none;
    background: var(--surface);
    color: var(--text-muted) !important;
    box-shadow: none;
}
.pagination-ellipsis {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 2.1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    user-select: none;
}
@media (max-width: 640px) {
    .page-content .pagination,
    .admin-table-card .pagination,
    .pagination {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
        padding: 0.75rem 0.85rem;
    }
    .pagination-meta {
        white-space: normal;
    }
    .pagination-controls {
        margin-left: 0;
        justify-content: center;
        width: 100%;
    }
    .pagination-pages {
        justify-content: center;
    }
}

.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-term-row td {
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.4rem 1rem;
    border-top: 1px solid var(--border);
}
.group-subjects-term-row:first-child td { border-top: none; }

.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;
    max-width: 16rem;
}
.group-subjects-table .group-subject-schedule {
    min-width: 11rem;
    max-width: 13rem;
    vertical-align: top;
}
.group-subjects-table .group-subject-cover {
    white-space: nowrap;
    overflow-wrap: normal;
    vertical-align: top;
}
.group-subjects-table .class-cover-summary-label {
    white-space: nowrap;
}
.group-subjects-table .group-subject-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    vertical-align: top;
}
.group-subjects-table td { vertical-align: top; }
.group-subjects-table .group-subject-teacher .text-muted {
    display: block;
    margin-top: 0.35rem;
    max-width: 18rem;
    line-height: 1.35;
}

.group-subject-coteachers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}
.co-teacher-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: var(--surface-2, var(--surface-muted));
    border: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}
.co-teacher-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
}
.co-teacher-chip__remove:hover {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
}
.group-subject-coteacher-add {
    margin-top: 0.5rem;
}
.group-subject-coteacher-add .form-control {
    min-width: 160px;
    max-width: 240px;
    font-size: 0.8rem;
    padding: 0.35rem 0.6rem;
}

.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-student-enroll {
    position: relative;
    z-index: 3;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background: linear-gradient(180deg, #fafbfc 0%, var(--surface) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.group-student-enroll-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}
.group-student-enroll-form .searchable-select {
    flex: 1 1 18rem;
    min-width: min(100%, 16rem);
    max-width: 32rem;
}
.group-student-enroll-form .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}
.group-student-enroll-hint {
    margin: 0.45rem 0 0;
    font-size: 0.75rem;
}
.group-student-enroll-empty {
    margin: 0.45rem 0 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.group-student-enroll-empty.hidden { display: none; }
.group-student-enroll-warning {
    margin: 0.5rem 0 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: #856404;
    background: #fff3cd;
    border: 1px solid #ffe69c;
    border-radius: 0.5rem;
}
.group-student-enroll-warning.hidden { display: none; }
@media (max-width: 640px) {
    .group-student-enroll-form .searchable-select,
    .group-student-enroll-form .btn {
        width: 100%;
        max-width: none;
    }
}

/* 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: 280px;
    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-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.6rem;
}
.user-profile-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: var(--surface-2, var(--surface-muted));
    border: 1px solid var(--border);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}
.user-profile-stat i { color: var(--primary); font-size: 0.75rem; }

/* ---- Profile hero (redesigned teacher profile header) ---- */
.user-profile-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 1.25rem;
    padding: 1.25rem 1.5rem 1.5rem;
}
.user-profile-hero::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #7c3aed);
}
.user-profile-hero__back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
}
.user-profile-hero__back:hover { color: var(--primary); text-decoration: none; }
.user-profile-hero__body {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem 1.5rem;
    flex-wrap: wrap;
}
.user-profile-hero__actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.user-profile-hero__actions .btn i { font-size: 0.8rem; }
.user-profile-avatar--hero {
    width: 5rem;
    height: 5rem;
    font-size: 1.5rem;
}

/* ---- Sidebar + main content layout ---- */
.user-profile-layout {
    display: grid;
    grid-template-columns: minmax(0, 300px) 1fr;
    gap: 1.25rem;
    align-items: start;
}
@media (max-width: 900px) {
    .user-profile-layout { grid-template-columns: 1fr; }
}
.user-profile-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 1rem;
}
@media (max-width: 900px) {
    .user-profile-sidebar { position: static; }
}
.user-profile-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}
.user-profile-main-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 700px) {
    .user-profile-main-row { grid-template-columns: 1fr 1fr; }
}
.user-profile-sidebar .user-profile-details {
    grid-template-columns: 1fr;
}

.teacher-class-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.teacher-class-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: 0.7rem;
    background: var(--surface-2, var(--surface-muted));
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.teacher-class-card:hover {
    border-color: rgba(15, 108, 191, 0.35);
    background: var(--surface);
    transform: translateX(2px);
    text-decoration: none;
}
.teacher-class-card__icon {
    flex: 0 0 auto;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.6rem;
    display: grid;
    place-items: center;
    background: rgba(15, 108, 191, 0.1);
    color: var(--primary);
    font-size: 0.9rem;
}
.teacher-class-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    flex: 1 1 auto;
}
.teacher-class-card__subject {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
}
.teacher-class-card__group {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.teacher-class-card__year {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.user-profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: start;
}
@media (min-width: 900px) {
    /* A regular 2-column grid pairs panels strictly by DOM order (1st+2nd in row one, 3rd+4th
       in row two, ...) — a short panel like "Academic information" next to a much taller one
       like "Program details" then leaves a large dead gap below it before the next row can
       start, even though the panel itself doesn't stretch. Switching to CSS multi-column
       ("masonry") flow lets each panel simply stack under the shortest column instead, so
       panels of very different heights no longer leave that gap. */
    .user-profile-grid {
        display: block;
        column-count: 2;
        column-gap: 1rem;
    }
    .user-profile-grid > * {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
    /* Panels containing tables read better at full width */
    .user-profile-grid > .user-profile-panel:has(.table-wrap) {
        column-span: all;
    }
}
.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;
    container-type: inline-size;
    container-name: profile;
}
.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; }
.quiz-start-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 1.35rem;
    padding-top: 1.15rem;
    border-top: 1px solid var(--border);
}
.quiz-start-cta {
    min-width: 11.5rem;
    padding: 0.85rem 1.45rem;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 8px 20px rgba(15, 108, 191, 0.28);
}
.quiz-start-cta i {
    margin-left: 0.35rem;
}

/* 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;
    /* Size to content (a short question shouldn't stretch to fill the viewport and strand
       Previous/Next far below it) but never exceed the viewport, so a long question still
       scrolls internally with the action bar staying reachable at the bottom of the shell
       instead of the true page bottom. */
    flex: 0 1 auto;
    min-height: 0;
    max-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-timer--warning {
    border-color: #f3b9b9;
    background: #fdecec;
    color: var(--danger, #b91c1c);
    font-weight: 700;
}
.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;
}
/* Nested inside .quiz-question-block itself (see renderQuizTakeQuestion's trailing-content
   hook) instead of sitting in a separate footer bar below the card — sits flush with the
   card's own padding rather than adding its own. */
.quiz-attempt-actions--inline {
    padding: 0.9rem 0 0;
    margin-top: 1rem;
    background: transparent;
    flex-shrink: initial;
}
@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.5rem 0.75rem;
        gap: 0.4rem;
        /* Bounded and internally scrollable, not "visible" — an unbounded question-number
           grid here can grow tall enough to push the Previous/Next bar (the sibling row)
           past the shell's clipped bottom, making it disappear entirely on short phone
           screens. Capped smaller than before so the toolbar+nav strip leaves more room
           for the actual question. */
        max-height: 20vh;
        overflow: auto;
    }
    .quiz-attempt-nav__head strong { font-size: 0.72rem; }
    .quiz-attempt-nav__head span { font-size: 0.65rem; }
    .quiz-attempt-nav__legend {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.3rem 0.6rem;
        font-size: 0.62rem;
    }
    .quiz-attempt-nav__grid {
        grid-template-columns: repeat(auto-fill, minmax(1.9rem, 1fr));
        gap: 0.35rem;
        max-width: 100%;
    }
    .quiz-nav-item {
        aspect-ratio: auto;
        height: 1.9rem;
        font-size: 0.75rem;
    }
    .quiz-attempt-nav__review { display: none; }
}
@media (max-width: 700px) {
    .quiz-start-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quiz-attempt-toolbar {
        flex-wrap: wrap;
        gap: 0.4rem;
        padding: 0.55rem 0.75rem;
    }
    .quiz-attempt-toolbar__title { font-size: 0.9rem; }
    .quiz-attempt-toolbar__meta { font-size: 0.68rem; margin-bottom: 0.25rem; }
    .quiz-attempt-progress { height: 0.28rem; }
    .quiz-attempt-toolbar__aside {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .quiz-attempt-toolbar .btn-sm { padding: 0.35rem 0.6rem; font-size: 0.75rem; }
    .quiz-attempt-stage { padding: 0.75rem; }
    .quiz-attempt-actions { padding: 0.75rem 0.9rem; }
    .quiz-attempt-shell--focus .quiz-question-block { padding: 0.9rem; }
}

.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: 6.5rem;
    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-direction: column;
    align-items: stretch;
    gap: 1.1rem;
    padding: 0 1.15rem 1.25rem;
    margin-top: -2.5rem;
}
.profile-hero__main {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.85rem;
    min-width: 0;
    width: 100%;
}
.profile-hero__avatar-ring {
    flex-shrink: 0;
    padding: 0.25rem;
    border-radius: 999px;
    background: #fff;
    box-shadow: var(--shadow-md);
}
.profile-hero__avatar {
    width: 5rem !important;
    height: 5rem !important;
    font-size: 1.6rem !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;
    flex: 1 1 auto;
    width: 100%;
    padding-top: 0;
}
.profile-hero__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.45rem;
    justify-content: center;
}
.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.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.profile-hero__email {
    display: inline-block;
    max-width: 100%;
    font-size: 0.875rem;
    color: var(--ink-2);
    text-decoration: none !important;
    margin-bottom: 0.45rem;
    overflow-wrap: anywhere;
}
.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.45rem 0.85rem;
    margin: 0;
    justify-content: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.profile-hero__meta i { margin-right: 0.25rem; color: var(--profile-accent); }
.profile-hero__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
    flex: 0 0 auto;
}
.profile-hero__actions .btn {
    justify-content: center;
    width: 100%;
}

/* Mid: avatar + text side-by-side; actions stay full-width below */
@container profile (min-width: 540px) {
    .profile-hero__cover { height: 7rem; }
    .profile-hero__content {
        padding: 0 1.35rem 1.35rem;
        margin-top: -2.75rem;
    }
    .profile-hero__main {
        flex-direction: row;
        align-items: flex-end;
        text-align: left;
        gap: 1.15rem;
    }
    .profile-hero__avatar {
        width: 5.5rem !important;
        height: 5.5rem !important;
        font-size: 1.75rem !important;
    }
    .profile-hero__text { padding-top: 2.75rem; }
    .profile-hero__name { font-size: 1.65rem; }
    .profile-hero__badges,
    .profile-hero__meta { justify-content: flex-start; }
    .profile-hero__actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        width: 100%;
    }
    .profile-hero__actions .btn { width: auto; }
}

/* Wide only: actions can sit to the right */
@container profile (min-width: 920px) {
    .profile-hero__content {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: flex-end;
        justify-content: space-between;
        gap: 1.25rem;
    }
    .profile-hero__main {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
    }
    .profile-hero__text { padding-top: 3rem; }
    .profile-hero__actions {
        display: flex;
        flex-wrap: wrap;
        width: auto;
        max-width: 42%;
        justify-content: flex-end;
        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;
}
@container profile (min-width: 560px) {
    .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; text-align: center; }
.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 {
    padding-bottom: 0.6rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.profile-photo-card__head h3 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    margin: 0 0 0.3rem;
    font-size: 1rem;
    font-weight: 700;
}
.profile-photo-card__head h3 i { color: var(--primary); }
.profile-photo-card__head p { margin: 0; font-size: 0.8125rem; }
.profile-photo-card__preview { text-align: center; margin-bottom: 0.75rem; }
.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; max-width: 20rem; margin: 0 auto; }
.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: 0.9rem 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.5rem 0 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
    text-align: center;
}
.profile-photo-form__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.65rem;
}
.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;
}

.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; }

.program-bg-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface-2, #f8faff);
}
.program-bg-preview__img {
    width: 4.5rem;
    height: 3rem;
    object-fit: cover;
    border-radius: 0.35rem;
    flex: none;
}
.program-bg-preview__remove {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    cursor: pointer;
}

/* 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) 7.5rem;
    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-group label .text-muted {
    text-transform: none;
    font-weight: 400;
    letter-spacing: normal;
    opacity: 0.75;
}
.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-top {
    margin-top: 0.35rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid #d4e4f7;
}
.admin-form-card--subject .grading-scheme-top .grading-scheme-total-badge {
    align-self: center;
}
.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;
}

/* Period panels live inside the featured fieldset — keep their own padding */
.admin-form-card--subject .grading-scheme-period .grading-scheme-preview--compact {
    padding: 0 0.85rem;
}
.admin-form-card--subject .grading-scheme-period .gb-weight-bar--admin .gb-weight-bar__track {
    height: 0.4rem;
}
.admin-form-card--subject .grading-scheme-period .grading-scheme-toolbar {
    padding: 0;
    margin-bottom: 0.55rem;
}
.admin-form-card--subject .grading-scheme-period .grading-scheme-table-head {
    margin: 0 0 0.35rem;
    padding: 0.3rem 0.45rem;
}
.admin-form-card--subject .grading-scheme-period .grading-scheme-rows {
    padding: 0;
}

/* Apply grading scheme to other subjects */
.admin-form-card--subject .grading-scheme-apply {
    margin: 0 0.85rem 0.85rem;
    padding: 0;
    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__summary {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    list-style: none;
}
.admin-form-card--subject .grading-scheme-apply__summary::-webkit-details-marker {
    display: none;
}
.admin-form-card--subject .grading-scheme-apply__summary::before {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.65rem;
    transition: transform 0.15s ease;
}
.admin-form-card--subject .grading-scheme-apply[open] .grading-scheme-apply__summary::before {
    transform: rotate(90deg);
}
.admin-form-card--subject .grading-scheme-apply__summary:hover {
    color: var(--text);
}
.admin-form-card--subject .grading-scheme-apply__body {
    padding: 0 0.85rem 0.85rem;
}
.admin-form-card--subject .scheme-apply-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.65rem;
}
.admin-form-card--subject .scheme-apply-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    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: 0;
    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.75rem;
    color: var(--text);
    font-weight: 700;
}
.admin-form-card--subject .scheme-apply-option__text small {
    display: none;
}
.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 {
    /* minmax(0, 1fr), not bare 1fr: a bare fr track won't shrink below its content's
       min-content width, so a student with many credited levels blows the whole panel out
       to fit every tab in one unbroken row instead of letting .program-level-nav's own
       overflow-x: auto scroll them. */
    grid-template-columns: minmax(0, 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: 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: minmax(0, 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;
}
/* Fixed, consistent column widths so Subject/Remarks/Grade line up across every term card
   instead of each table auto-sizing its columns to its own content (student.php's Subject
   Progress panel stacks several of these tables vertically, one per term). */
.program-subject-table--progress {
    table-layout: fixed;
}
.program-subject-table--progress th:nth-child(1),
.program-subject-table--progress td:nth-child(1) { width: 48%; }
.program-subject-table--progress th:nth-child(2),
.program-subject-table--progress td:nth-child(2) { width: 10%; }
.program-subject-table--progress th:nth-child(3),
.program-subject-table--progress td:nth-child(3) { width: 27%; }
.program-subject-table--progress th:nth-child(4),
.program-subject-table--progress td:nth-child(4) { width: 15%; }
.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);
}

.program-academic-level-form,
.program-level-billing-form {
    width: fit-content;
    max-width: 14rem;
}
.program-academic-level-form select,
.program-level-billing-form select {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    height: auto;
}
.program-unit-rate-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    max-width: 100%;
}
.program-unit-rate-form input[type="number"] {
    padding: 0.2rem 0.5rem 0.2rem 1.6rem;
    font-size: 0.75rem;
    height: auto;
    width: auto;
    max-width: 8rem;
}
.program-unit-rate-form__suffix {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.program-unit-rate-form__hint {
    flex-basis: 100%;
    font-size: 0.7rem;
    line-height: 1.3;
}
.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-layout[hidden] {
    display: none;
}
.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-level-nav-item--credited .program-level-nav-meta {
    color: #1e7e34;
}
.program-level-nav-item--credited .program-level-nav-meta i {
    margin-right: 0.2rem;
}

.program-level-credited-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin: 1rem 1.15rem 1.15rem;
    padding: 1rem 1.15rem;
    border-radius: 0.6rem;
    background: #eaf6ec;
    border: 1px solid #c3e6cb;
}
.program-level-credited-notice > i {
    color: #1e7e34;
    font-size: 1.25rem;
    margin-top: 0.15rem;
    flex-shrink: 0;
}
.program-level-credited-notice strong {
    display: block;
    color: #155724;
    margin-bottom: 0.25rem;
}

.program-curriculum-completed-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 1rem;
    padding: 1rem 1.15rem;
    border-radius: 0.6rem;
    background: #eaf6ec;
    border: 1px solid #c3e6cb;
}
.program-curriculum-completed-banner > i {
    color: #1e7e34;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.program-curriculum-completed-text {
    flex: 1 1 auto;
}
.program-curriculum-completed-text strong {
    display: block;
    color: #155724;
    margin-bottom: 0.15rem;
}

.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: minmax(0, 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; }
.confirm-dialog-highlight {
    background: #fde2e1;
    color: #9c1c1c;
    font-weight: 700;
    padding: 0.05rem 0.35rem;
    border-radius: 0.3rem;
}
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;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}
.school-public-main {
    max-width: none;
    padding: 0;
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}
.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--danger {
    border-color: #fecaca;
    background: #fff5f5;
}
.school-settings-card--danger .school-settings-card__head h3 i { color: #dc2626; }
.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;
}
.school-settings-hidden {
    display: none !important;
}
.school-settings-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.85rem;
    position: sticky;
    top: calc(var(--navbar-height) + 0.75rem);
    z-index: 5;
    padding: 0.75rem 0.9rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}
.school-settings-search-wrap {
    position: relative;
    flex: 1 1 15rem;
    min-width: 12rem;
}
.school-settings-search-wrap i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8125rem;
    pointer-events: none;
}
.school-settings-search-wrap .school-settings-search {
    padding-left: 2.25rem;
    width: 100%;
}
.school-settings-search-wrap .school-settings-search:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--accent-l);
}
.school-settings-quicknav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.school-settings-quicknav__link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
/* The quick-nav pills are now real tabs (<button role="tab">), so reset the button
   defaults the anchor version never needed and give the selected one a clear state —
   with only one panel on screen at a time, "which tab am I on" is the whole map. */
.school-settings-quicknav__link {
    cursor: pointer;
    font-family: inherit;
    line-height: 1.4;
}
.school-settings-quicknav__link.is-active {
    border-color: var(--primary, #2563eb);
    background: var(--primary, #2563eb);
    color: #fff;
}
.school-settings-quicknav__link.is-active i {
    color: #fff;
}
.school-settings-quicknav__link:focus-visible {
    outline: 2px solid var(--primary, #2563eb);
    outline-offset: 2px;
}
/* Defensive: .school-settings-section sets no display of its own today, so plain
   [hidden] already works. But any class rule that later gives it a display (flex/grid)
   would silently outrank the browser's [hidden] { display: none } and stack every tab's
   content onto one page — the same trap that hid nothing in the class-group picker. */
.school-settings-section[hidden] {
    display: none !important;
}
.school-settings-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted, #667085);
}
.school-settings-quicknav__link i {
    color: var(--primary);
    font-size: 0.75rem;
}
.school-settings-quicknav__link:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--accent-l);
    text-decoration: none;
}
.school-settings-card,
.feature-setting__card,
.atools-setting__card {
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.school-settings-card:hover {
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}
@media (max-width: 900px) {
    .school-settings-toolbar { position: static; }
    .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(340px, 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: 360px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
.notif-dropdown-body::-webkit-scrollbar {
    width: 8px;
}
.notif-dropdown-body::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}
.notif-dropdown-body::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--scroll-radius);
}
.notif-dropdown-body::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}
.notif-item {
    display: flex; align-items: flex-start; gap: 0.75rem;
    padding: 0.85rem 1rem; border-bottom: 1px solid var(--border);
    text-decoration: none !important; color: inherit;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); }
.notif-item--unread { background: #f0f7ff; }
.notif-item--unread:hover { background: #e7f1fb; }
.notif-item__icon {
    flex-shrink: 0; width: 2.25rem; height: 2.25rem; border-radius: 0.65rem;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.85rem; background: var(--accent-l); color: var(--primary);
}
.notif-item__icon--material { background: #e8f1fb; color: #0f6cbf; }
.notif-item__icon--assignment { background: #fef3c7; color: #b45309; }
.notif-item__icon--quiz { background: #ede9fe; color: #6d28d9; }
.notif-item__icon--notice { background: var(--accent-l); color: var(--primary); }
.notif-item__body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.notif-item__meta {
    display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
    font-size: 0.6875rem; color: var(--text-muted);
}
.notif-item__type {
    font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
    color: var(--primary-dark, #0a4d8c);
}
.notif-item__title {
    display: block; font-size: 0.875rem; font-weight: 700; line-height: 1.35;
    color: var(--text); margin: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.notif-item__class,
.notif-item__preview {
    margin: 0; font-size: 0.78rem; color: var(--text-muted); line-height: 1.4;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.notif-item__class i { margin-right: 0.2rem; opacity: 0.75; font-size: 0.7rem; }
.notif-item time { margin-left: auto; font-size: 0.6875rem; color: var(--text-muted); white-space: nowrap; }
.notif-item-priority {
    display: inline-block; 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; 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.65rem; }
.notification-item {
    display: flex; align-items: flex-start; gap: 0.9rem;
    text-decoration: none !important; color: inherit;
    padding: 1rem 1.1rem; transition: background 0.15s ease, border-color 0.15s ease;
}
.notification-item:hover { background: var(--surface-2); }
.notification-item--unread {
    border-left: 3px solid var(--primary);
    background: linear-gradient(90deg, #f0f7ff 0%, var(--surface) 40%);
}
.notification-item__icon {
    flex-shrink: 0; width: 2.75rem; height: 2.75rem; border-radius: 0.8rem;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1rem; background: var(--accent-l); color: var(--primary);
}
.notification-item__icon--material { background: #e8f1fb; color: #0f6cbf; }
.notification-item__icon--assignment { background: #fef3c7; color: #b45309; }
.notification-item__icon--quiz { background: #ede9fe; color: #6d28d9; }
.notification-item__icon--platform { background: #e0f2fe; color: #0369a1; }
.notification-item__icon--announcement { background: var(--accent-l); color: var(--primary); }
.notification-item__icon--registrar { background: #dcfce7; color: #15803d; }
.notification-item__body { min-width: 0; flex: 1; }
.notification-item__head {
    display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; flex-wrap: wrap;
}
.notification-item__type {
    font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
    color: var(--primary-dark, #0a4d8c);
}
.notification-item__title {
    display: block; font-size: 1rem; font-weight: 700; line-height: 1.35; color: var(--text);
    margin: 0 0 0.25rem;
}
.notification-item__preview { margin: 0 0 0.35rem; color: var(--text-muted); font-size: 0.9rem; }
.notification-item__class {
    display: inline-flex; align-items: center; gap: 0.35rem;
    margin: 0 0 0.4rem; color: var(--text-muted); font-size: 0.875rem;
}
.notification-item__class i { font-size: 0.75rem; opacity: 0.8; }
.notification-item__time { font-size: 0.8rem; }
.notification-detail__body { line-height: 1.6; margin: 1rem 0; }
.notification-detail--activity .notification-detail__eyebrow {
    display: inline-flex; align-items: center; gap: 0.4rem;
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--primary-dark, #0a4d8c); margin-bottom: 0.5rem;
}
.notification-detail--activity .notification-detail__class {
    display: inline-flex; align-items: center; gap: 0.4rem;
    color: var(--text-muted); font-size: 0.9rem; margin: 0 0 1rem;
}
.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--image {
    background:
        linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
        linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
        linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-color: #fff;
    text-align: center;
    padding: 0.75rem;
}
.material-file-preview--image img {
    max-height: min(70vh, 720px);
    width: auto;
    height: auto;
    border-radius: 0.35rem;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
}
.material-file-preview--pdf iframe { width: 100%; min-height: 480px; border: 0; }
.material-file-preview--office {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 2.5rem 1.5rem;
    background: var(--surface-alt, #f8fafc);
    color: var(--text-muted);
    text-align: center;
}
.material-file-preview--office i {
    font-size: 3rem;
}
.material-file-preview--office p {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

/* ===== Quiz module ===== */
.quiz-cover-preview { display: block; max-width: 200px; margin-top: 0.5rem; border-radius: var(--radius); }
.quiz-take-cover { height: 240px; 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; }

/* ── Minimal question image editor ─────────────────────── */
.qimg-editor {
    margin-bottom: 1rem;
    padding: 0.65rem 0.75rem 0.75rem;
    border: 1px solid #e2eaf2;
    border-radius: 0.75rem;
    background: #fafcfe;
}
.qimg-editor__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
}
.qimg-editor__label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #3d5a73;
}
.qimg-editor__label em {
    font-style: normal;
    font-weight: 500;
    color: #8aa0b4;
}
.qimg-editor__tabs {
    display: inline-flex;
    gap: 0.15rem;
    padding: 0.12rem;
    border-radius: 0.45rem;
    background: #e8eef5;
}
.qimg-editor__tab {
    border: 0;
    background: transparent;
    color: #5b738c;
    font-size: 0.72rem;
    font-weight: 650;
    padding: 0.22rem 0.55rem;
    border-radius: 0.35rem;
    cursor: pointer;
}
.qimg-editor__tab.is-active {
    background: #fff;
    color: #1f4f74;
    box-shadow: 0 1px 2px rgba(15, 48, 96, 0.08);
}
.qimg-editor__panel { min-width: 0; }
.qimg-editor__slot {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 0.55rem;
    min-height: 3.25rem;
}
.qimg-editor__slot.has-image {
    grid-template-columns: 4.5rem 1fr;
}
.qimg-editor__preview-img {
    width: 4.5rem;
    height: 3.25rem;
    object-fit: cover;
    border-radius: 0.45rem;
    border: 1px solid #d5e0ea;
    background: #eef3f8;
}
.qimg-editor__dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 3.25rem;
    padding: 0.55rem 0.75rem;
    border: 1px dashed #c5d4e2;
    border-radius: 0.55rem;
    background: #fff;
    color: #6b849c;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.qimg-editor__dropzone i { color: #8aa8c0; }
.qimg-editor__dropzone:hover,
.qimg-editor__dropzone.is-dragover {
    border-color: var(--primary);
    background: #f3f8fd;
    color: #2d5f86;
}
.qimg-editor__dropzone.is-hidden { display: none; }
.qimg-editor__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}
.qimg-editor__meta > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
    font-weight: 600;
    color: #355872;
}
.qimg-editor__meta-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}
.qimg-editor__change,
.qimg-editor__clear-btn,
.qimg-editor__remove-btn {
    border: 0;
    background: none;
    padding: 0;
    font-size: 0.74rem;
    font-weight: 650;
    cursor: pointer;
    color: #4d7ea6;
}
.qimg-editor__remove-btn,
.qimg-editor__clear-btn { color: #b45353; }
.qimg-editor__change:hover { text-decoration: underline; }
.qimg-editor__ai-input {
    min-height: 3.25rem;
    font-size: 0.85rem;
    resize: vertical;
}
.quiz-question-stem__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}
.quiz-question-stem__head > label { margin: 0; }
.quiz-question-stem__points {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.35rem 0.2rem 0.55rem;
    border-radius: 0.55rem;
    border: 1.5px solid #93c5fd;
    background: linear-gradient(180deg, #eff6ff, #dbeafe);
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.1);
}
.quiz-question-stem__points > label {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 750;
    color: #1d4ed8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.quiz-question-stem .quiz-points-input {
    width: 4.25rem;
    min-height: 1.85rem;
    padding: 0.2rem 0.35rem;
    text-align: center;
    font-weight: 800;
    color: #0f3d6b;
    border: 1.5px solid #60a5fa;
    border-radius: 0.4rem;
    background: #fff;
}
.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-width: 2.75;
    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: var(--match-border) !important;
    background: var(--match-bg) !important;
    box-shadow: inset 4px 0 0 var(--match-stroke);
}
.quiz-matching-item.is-connected.is-selected {
    border-color: var(--primary) !important;
    background: rgba(15, 108, 191, 0.1) !important;
    box-shadow: 0 0 0 3px var(--primary-light);
}
/* 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);
    --quiz-header-height: 10.5rem;
    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: var(--navbar-height);
    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;
    /* Sit just below the sticky workspace header (height measured in JS). */
    top: calc(var(--navbar-height) + var(--quiz-header-height, 10.5rem) + 0.75rem);
    z-index: 5;
    display: flex; flex-direction: column;
    max-height: calc(100vh - var(--navbar-height) - var(--quiz-header-height, 10.5rem) - 1.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.is-just-added {
    animation: quizRailCardGlow 5s ease-out both;
    z-index: 2;
}
.quiz-rail-card.is-just-updated {
    animation: quizRailCardPulse 5s ease-out both;
    z-index: 2;
}
@keyframes quizRailCardGlow {
    0% {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
        box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.35), 0 8px 24px rgba(34, 197, 94, 0.2);
        border-color: #4ade80;
        background: linear-gradient(180deg, #f0fdf4, #dcfce7);
    }
    12% {
        opacity: 1;
        transform: translateX(0) scale(1);
        box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.3), 0 8px 24px rgba(34, 197, 94, 0.18);
        border-color: #4ade80;
        background: linear-gradient(180deg, #f0fdf4, #dcfce7);
    }
    70% {
        box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2), 0 4px 12px rgba(34, 197, 94, 0.1);
        border-color: #86efac;
        background: linear-gradient(180deg, #f0fdf4, #ecfdf5);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
        box-shadow: 0 1px 2px rgba(15, 48, 96, 0.03);
        border-color: #e2ebf5;
        background: #fff;
    }
}
@keyframes quizRailCardPulse {
    0% {
        box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.3);
        border-color: #4ade80;
        background: #f0fdf4;
    }
    70% {
        box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
        border-color: #86efac;
        background: #f0fdf4;
    }
    100% {
        box-shadow: 0 1px 2px rgba(15, 48, 96, 0.03);
        border-color: #e2ebf5;
        background: #fff;
    }
}
.quiz-question-rail.is-receiving .quiz-question-rail__list {
    animation: quizRailListCatch 0.55s ease both;
}
@keyframes quizRailListCatch {
    0% { background: rgba(15, 108, 191, 0.04); }
    100% { background: transparent; }
}
.quiz-question-rail__head.is-pulse {
    animation: quizRailHeadPulse 0.65s ease both;
}
@keyframes quizRailHeadPulse {
    0%, 100% { background: linear-gradient(180deg, #f8fbff, #f1f6fc); }
    40% { background: linear-gradient(180deg, #e8f3ff, #dbebff); }
}
@media (prefers-reduced-motion: reduce) {
    .quiz-rail-card.is-just-added,
    .quiz-rail-card.is-just-updated,
    .quiz-question-rail.is-receiving .quiz-question-rail__list,
    .quiz-question-rail__head.is-pulse {
        animation: none;
    }
}
.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:focus-within .quiz-rail-card__actions,
.quiz-rail-card.is-active .quiz-rail-card__actions { opacity: 1; }
.quiz-icon-btn {
    display: grid; place-items: center; width: 2rem; height: 2rem;
    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); }
/* Separate Delete from the Move up/down pair above it (same stacked column, 0.08rem gap
   otherwise) so a slightly-off click on "Move down" can't land on Delete instead. */
.quiz-icon-btn--danger { margin-top: 0.4rem; padding-top: 0.4rem; border-top: 1px solid #e2ebf5; }

.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 { margin-bottom: 1.1rem; }
.quiz-type-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.quiz-type-chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.7rem; border: 1.5px solid #d6e0ea; border-radius: 0.6rem; background: #fff; color: #345978; font-size: 0.8rem; font-weight: 650; cursor: pointer; transition: border-color 0.13s, background 0.13s, color 0.13s, box-shadow 0.13s; }
.quiz-type-chip i { font-size: 0.78rem; color: #7ea3c7; }
.quiz-type-chip:hover { border-color: #8fb8dd; background: #f0f6fc; }
.quiz-type-chip.is-selected { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 2px 7px rgba(15,108,191,0.22); }
.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-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; }

/* Type-grid */
.quiz-type-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.4rem;
    align-items: stretch;
}
.quiz-type-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.28rem; padding: 0.6rem 0.3rem;
    border: 1.5px solid #dce6f0; border-radius: 0.65rem;
    background: #fff; cursor: pointer; min-width: 0;
    transition: border-color 0.13s, background 0.13s, box-shadow 0.13s;
}
.quiz-type-tile i {
    font-size: 1.05rem; color: #6c97bb; transition: color 0.13s;
}
.quiz-type-tile span {
    font-size: 0.67rem; font-weight: 700; color: #3d6482;
    text-align: center; line-height: 1.25; white-space: nowrap;
}
.quiz-type-tile:hover { border-color: #9bbfd8; background: #eef5fb; }
.quiz-type-tile:hover i { color: var(--primary); }
.quiz-type-tile.is-selected {
    background: var(--primary); border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(15,108,191,0.25);
}
.quiz-type-tile.is-selected i,
.quiz-type-tile.is-selected span { color: #fff; }
.quiz-points-input {
    width: 100%; padding: 0.2rem 0.3rem; min-height: 1.85rem;
    text-align: center; font-weight: 800; font-size: 0.97rem;
    border-radius: 0.45rem; border: 1.5px solid #cddae6; background: #fff;
    box-shadow: none;
}
.quiz-points-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(15,108,191,0.12); }
@media (max-width: 500px) {
    .quiz-type-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.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-schedule-enable {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.45rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}
.quiz-settings-schedule-enable input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary, #0f6cbf);
    flex-shrink: 0;
}
.quiz-settings-schedule-field:not(.is-enabled) input[type="datetime-local"] {
    opacity: 0.55;
    cursor: not-allowed;
    background: #eef2f6;
}

.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__preview {
    display: block;
    width: 4.5rem;
    height: 4.5rem;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 0.85rem;
    overflow: hidden;
    position: relative;
}
.quiz-settings-cover__preview:focus-visible {
    outline: 2px solid var(--primary, #0f6cbf);
    outline-offset: 2px;
}
.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__placeholder[hidden] { display: none !important; }
.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; display: block;
}
.quiz-settings-cover .quiz-cover-preview[hidden] { display: none !important; }
.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-card--danger {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    border-color: #fecaca;
    background: linear-gradient(180deg, #fff7f7 0%, #fff 55%);
}
.quiz-settings-card__icon--danger {
    background: #fef2f2;
    color: #dc2626;
}
.quiz-settings-danger-copy {
    margin: 0 0 0.85rem;
    font-size: 0.84rem;
    line-height: 1.45;
}
.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: 1200px) {
    .quiz-workspace-header {
        gap: 0.65rem;
        padding: 0.8rem 1rem 0.85rem;
    }
    .quiz-workspace-header__bar {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.65rem 1rem;
    }
    .quiz-workspace-header__identity {
        grid-column: 1 / -1;
    }
    .quiz-workspace-tabs {
        justify-self: start;
    }
    .quiz-workspace-header__actions {
        justify-self: end;
        justify-content: flex-end;
    }
    .quiz-workspace-chip--hint {
        flex: 1 1 12rem;
    }
    .quiz-settings-toggles { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .course-view--quiz-builder { margin: 0; padding: 0.25rem 0 1rem; }
    .quiz-workspace-header {
        position: static;
        gap: 0.7rem;
    }
    .quiz-workspace-header__bar {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.7rem;
    }
    .quiz-workspace-header__identity {
        grid-column: auto;
    }
    .quiz-workspace-tabs {
        width: 100%;
        justify-content: stretch;
    }
    .quiz-workspace-tab {
        flex: 1;
        justify-content: center;
    }
    .quiz-workspace-header__actions {
        width: 100%;
        justify-content: stretch;
        gap: 0.45rem;
    }
    .quiz-workspace-header__actions .btn {
        flex: 1;
        justify-content: center;
    }
    /* Avoid duplicate Continue: keep footer CTA, hide header Continue on compact screens */
    .quiz-workspace-header__actions .quiz-workspace-action--primary {
        display: none;
    }
    .quiz-workspace-header__meta {
        gap: 0.4rem;
    }
    .quiz-workspace-chip--hint {
        width: 100%;
        flex: 1 1 100%;
    }
    .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-editor-pane {
        padding: 0 1rem 1rem;
    }
    .quiz-editor-pane__head {
        margin: 0 -1rem 1rem;
        padding: 0.9rem 1rem;
        flex-wrap: wrap;
    }
    .quiz-workspace-footer {
        position: sticky;
        bottom: 0.5rem;
        z-index: 15;
        backdrop-filter: blur(10px);
    }
    .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-wizard-title {
        font-size: 1.1rem;
        white-space: normal;
    }
    .quiz-workspace-action span { display: none; }
    .quiz-workspace-header__actions .quiz-workspace-action--primary {
        display: none;
    }
    .quiz-workspace-chip--hint { display: none; }
    .quiz-type-grid { grid-template-columns: repeat(3, minmax(0, 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-mtf-correction {
    margin-top: 0.85rem;
    padding: 0.85rem 1rem;
    border: 1px solid #dbe5f0;
    border-radius: 0.75rem;
    background: #f8fafc;
}
.quiz-mtf-correction label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
}
.quiz-mtf-correction small {
    display: block;
    margin-top: 0.35rem;
}
.quiz-review-mtf-correction {
    margin-top: 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: #334155;
}
.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-choice.is-correct .form-control,
.quiz-mcq-choice.is-correct input[type="text"] {
    border-color: #86efac;
    background: #f0fdf4;
}
.quiz-mcq-choice.is-incorrect .form-control,
.quiz-mcq-choice.is-incorrect input[type="text"] {
    border-color: #fca5a5;
    background: #fef2f2;
}
.quiz-mcq-correct { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; cursor: pointer; }
.quiz-mcq-correct input { width: 1rem; height: 1rem; accent-color: #16a34a; }
.quiz-mcq-choice.is-incorrect .quiz-mcq-correct input { accent-color: #dc2626; }
.quiz-mcq-correct__badge {
    display: inline-flex;
    align-items: center;
    min-width: 3.6rem;
    justify-content: center;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.quiz-mcq-choice.is-correct .quiz-mcq-correct__badge {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}
.quiz-mcq-choice.is-incorrect .quiz-mcq-correct__badge {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}
.quiz-mcq-multi-settings {
    margin-top: 0.85rem;
    padding: 0.9rem 1rem;
    border: 1px solid #dbe5f0;
    border-radius: 0.75rem;
    background: #f8fafc;
    display: grid;
    gap: 0.75rem;
}
.quiz-mcq-multi-settings .form-group { margin: 0; }
.quiz-mcq-multi-hint {
    margin: 0 0 0.65rem;
    font-size: 0.82rem;
}
.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-canvas {
    border: 1.5px solid #d3dce6;
    border-radius: var(--radius-lg);
    background: #fff;
    padding: 0.6rem 0.75rem;
    transition: border-color 0.15s;
    min-height: 3.5rem;
}
.quiz-fib-canvas:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.08);
}
.quiz-fib-builder {
    display: inline;
    line-height: 2.4;
    font-size: 1rem;
    cursor: text;
    word-wrap: break-word;
}
.quiz-fib-builder:focus { outline: none; }
.quiz-fib-segment {
    display: inline;
    vertical-align: middle;
}
.quiz-fib-segment--text {
    display: inline;
}
.quiz-fib-text {
    display: inline-block;
    width: auto;
    min-width: 2ch;
    max-width: 100%;
    padding: 0.2rem 0.15rem;
    margin: 0;
    border: none;
    border-bottom: 1.5px solid transparent;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    line-height: 1.6;
    font-size: 1rem;
    font-family: inherit;
    vertical-align: middle;
    transition: border-color 0.12s, background 0.12s;
    box-sizing: content-box;
}
.quiz-fib-text:focus {
    outline: none;
    border-bottom-color: #b8c8d8;
    background: rgba(15, 108, 191, 0.03);
}
.quiz-fib-text::placeholder { color: #a0b0c0; font-style: italic; }
.quiz-fib-segment--blank {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin: 0.15rem 0.2rem;
    padding: 0;
    border: none;
    background: transparent;
    vertical-align: middle;
    position: relative;
}
.quiz-fib-blank-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0;
    background: linear-gradient(135deg, rgba(15, 108, 191, 0.06), rgba(15, 108, 191, 0.1));
    border: 2px solid var(--primary);
    border-radius: 0.5rem;
    padding: 0 0.15rem 0 0;
    transition: box-shadow 0.12s, border-color 0.12s;
}
.quiz-fib-segment--blank:hover .quiz-fib-blank-wrap,
.quiz-fib-segment--blank:focus-within .quiz-fib-blank-wrap {
    box-shadow: 0 2px 8px rgba(15, 108, 191, 0.15);
}
.quiz-fib-blank-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    align-self: stretch;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    background: var(--primary);
    border-radius: 0.3rem 0 0 0.3rem;
    user-select: none;
    flex-shrink: 0;
}
.quiz-fib-answer {
    display: inline-block;
    width: auto;
    min-width: 5ch;
    max-width: 24rem;
    padding: 0.2rem 0.45rem;
    box-sizing: border-box;
    margin: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.4;
    color: var(--primary);
    vertical-align: middle;
    box-shadow: none;
}
.quiz-fib-answer::placeholder { color: rgba(15, 108, 191, 0.4); font-weight: 500; }
.quiz-fib-answer:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.8);
}
.quiz-fib-segment .quiz-remove-row {
    opacity: 0;
    min-width: 1.1rem;
    width: 1.1rem;
    height: 1.1rem;
    padding: 0;
    font-size: 0.65rem;
    line-height: 1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e74c3c;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: opacity 0.12s;
    position: absolute;
    top: -0.3rem;
    right: -0.3rem;
    z-index: 2;
}
.quiz-fib-segment--blank:hover .quiz-remove-row,
.quiz-fib-segment--blank:focus-within .quiz-remove-row { opacity: 1; }
.quiz-fib-scoring-mode { margin-top: 0.85rem; }
.quiz-fib-scoring-mode small { display: block; margin-top: 0.35rem; }

.quiz-fib-preview-wrap {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    background: #f8fafb;
    border: 1px dashed #d3dce6;
}
.quiz-fib-preview-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7f94;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.quiz-fib-preview-label i { margin-right: 0.3rem; }
.quiz-fib-preview {
    font-size: 1rem;
    line-height: 2;
    color: #1c3349;
}
.quiz-fib-preview .fib-preview-blank {
    display: inline-block;
    min-width: 5rem;
    border-bottom: 2px solid #1c3349;
    margin: 0 0.2rem;
    padding: 0.1rem 0.5rem;
    text-align: center;
    font-weight: 600;
    color: transparent;
    position: relative;
}
.quiz-fib-preview .fib-preview-blank::after {
    content: attr(data-num);
    position: absolute;
    top: -0.15rem;
    right: -0.35rem;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--primary);
    background: rgba(15, 108, 191, 0.1);
    border-radius: 50%;
    width: 1rem;
    height: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.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;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    flex-wrap: nowrap;
}
.library-toolbar-form {
    margin: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
.library-toolbar-top {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    min-width: 0;
}
.library-toolbar-top .resources-search {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
}
.library-toolbar .resources-search-input {
    border-radius: 999px;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    background: var(--surface-2);
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}
.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;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
.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: hidden;
    background:
        radial-gradient(ellipse at top, rgba(56, 189, 248, 0.08), transparent 45%),
        #1e293b;
}
.book-editor-preview__fit {
    position: relative;
    flex: 0 0 auto;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
}
/* Exact editor paper size (760 × 1075). Scaled via JS to fit the stage. */
.book-editor-preview__sheet,
.book-editor-preview__sheet.book-reader-page-sheet,
.book-editor-preview__sheet.book-reader-page-sheet--html {
    position: absolute;
    top: 0;
    left: 0;
    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: none !important;
    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: top left;
}
.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: 1.75rem 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;
        padding: 0.5rem 0.65rem;
    }
    .book-editor-preview__title {
        order: -1;
        flex: 1 1 100%;
        text-align: left;
        font-size: 0.875rem;
    }
    .book-editor-preview__bar .btn span {
        display: none;
    }
    .book-editor-preview__page-label {
        min-width: 4.75rem;
        font-size: 0.72rem;
    }
    .book-editor-preview__stage {
        padding: 0.65rem 0.5rem 0.85rem;
        align-items: flex-start;
    }
    .book-editor-preview__sheet .book-reader-page-body {
        padding: 1.75rem 2.75rem 3rem;
        font-size: 1.0625rem;
    }
}

.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: 1.75rem 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: 1.75rem 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-service-icon--gemini { color: #0f766e; background: #ccfbf1; }
.ai-key-service-icon--groq { color: #b45309; background: #ffedd5; }
.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);
}
.threshold-picker {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-top: 0.85rem;
    flex-wrap: wrap;
}
.threshold-picker__field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1 1 12rem;
    min-width: 10rem;
}
.threshold-picker__field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}
.threshold-picker__or {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    background: var(--surface-2, #f1f5f9);
    border: 1px solid var(--border);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.03em;
    flex-shrink: 0;
    margin-bottom: 1.4rem;
}
.threshold-input {
    position: relative;
    display: flex;
    align-items: center;
}
.threshold-input .form-control {
    width: 100%;
}
.threshold-input__unit {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    pointer-events: none;
}
.threshold-input__unit--prefix { left: 0.65rem; }
.threshold-input__unit--suffix { right: 0.75rem; }
.threshold-input__control--prefixed { padding-left: 1.6rem; }
.threshold-input__control--suffixed { padding-right: 1.9rem; }
.threshold-picker__hint {
    margin: 0.5rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}
.threshold-picker__hint i {
    margin-top: 0.15rem;
    color: var(--feature-accent, #64748b);
    flex-shrink: 0;
}
@media (max-width: 560px) {
    .threshold-picker { flex-direction: column; align-items: stretch; }
    .threshold-picker__or { align-self: center; margin: 0; }
}

.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; }
/* Two independent toggles living in one card (see "Class group count on rollover"), each
   with its own label/description on the left and switch on the right — reuses the card's own
   look rather than the icon+badge header, since there's no single on/off state to summarize. */
.feature-setting__subrow {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 0.85rem 0;
}
.feature-setting__subrow-text {
    min-width: 0;
}
.feature-setting__subrow-text strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 0.2rem;
}
.feature-setting__subrow-text p {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.45;
    max-width: 36rem;
}
.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;
}
.registrar-toggle-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.registrar-toggle-row__label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}
.registrar-checkbox-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.registrar-checkbox-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 0.6rem;
    background: var(--surface-2, var(--surface-muted));
    border: 1px solid var(--border);
    font-size: 0.875rem;
}
.registrar-inline-add {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.registrar-inline-add .form-control {
    flex: 1 1 20rem;
}
.registrar-doc-item {
    border-radius: 0.6rem;
    background: var(--surface-2, var(--surface-muted));
    border: 1px solid var(--border);
    padding: 0.55rem 0.75rem;
}
.registrar-doc-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    cursor: pointer;
    list-style: none;
    font-size: 0.875rem;
}
.registrar-doc-item summary::-webkit-details-marker {
    display: none;
}
.registrar-doc-item__actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}
.registrar-doc-item--new {
    background: transparent;
    border-style: dashed;
    margin-bottom: 1rem;
}
.registrar-doc-item--new summary {
    color: var(--text-muted);
    font-weight: 600;
    gap: 0.4rem;
}
.registrar-doc-edit-form {
    margin-top: 0.75rem;
}
.registrar-doc-levels {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
}
.registrar-doc-levels__group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 8rem;
}
.registrar-doc-levels__program {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-muted);
}
.registrar-doc-levels__level {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    cursor: pointer;
}
.registrar-attachment-form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.registrar-attachment-form__checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
}
.registrar-settings-status {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.registrar-settings-status__icon {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 108, 191, 0.1);
    color: var(--primary);
    font-size: 1rem;
}
.registrar-settings-status__copy {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.registrar-settings-status__copy strong {
    font-size: 0.95rem;
    color: var(--text);
}
.registrar-settings-status__copy span {
    font-size: 0.82rem;
}
.registrar-attachment-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.registrar-attachment-list li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.6rem;
    background: var(--surface-2, var(--surface-muted));
    border: 1px solid var(--border);
    font-size: 0.875rem;
}
.registrar-attachment-list__icon {
    flex-shrink: 0;
    color: var(--primary);
}
.registrar-attachment-list__name {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.registrar-settings-panel {
    padding: 0;
    overflow: hidden;
}
.registrar-settings-panel__section {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}
.registrar-settings-panel__section:first-child {
    border-top: none;
}
.registrar-settings-panel__head {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1rem;
}
.registrar-settings-panel__head-icon {
    flex-shrink: 0;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 108, 191, 0.1);
    color: var(--primary);
    font-size: 0.95rem;
}
.registrar-settings-panel__head h3 {
    margin: 0 0 0.2rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}
.registrar-settings-panel__head p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.45;
}
@media (max-width: 640px) {
    .registrar-settings-panel__section { padding: 1.15rem; }
}
.registrar-scan-cta {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.registrar-scan-cta__copy {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.registrar-scan-cta__copy strong {
    font-size: 0.95rem;
    color: var(--text);
}
.registrar-scan-cta__copy span {
    font-size: 0.82rem;
}
.registrar-scan-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 480px;
    margin: 0 auto;
}
.registrar-scan-header {
    margin-bottom: 0;
    text-align: center;
}
.registrar-scan-header .admin-page-header__main {
    flex-direction: column;
    align-items: center;
}
.registrar-scan-camera {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #0b1220;
    border-radius: 1rem;
    overflow: hidden;
}
.registrar-scan-camera video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.registrar-scan-camera__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    color: #fff;
    text-align: center;
    padding: 1.5rem;
}
.registrar-scan-camera__overlay[hidden] {
    display: none;
}
.registrar-scan-camera__overlay i {
    font-size: 1.75rem;
    opacity: 0.85;
}
.registrar-scan-camera__overlay p {
    margin: 0;
    font-size: 0.85rem;
    max-width: 28ch;
}
.registrar-scan-manual {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.registrar-scan-manual label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}
.registrar-scan-manual__row {
    display: flex;
    gap: 0.5rem;
}
.registrar-scan-manual__row .form-control {
    flex: 1 1 auto;
}
.registrar-scan-result {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}
.registrar-scan-result[hidden] { display: none !important; }
.registrar-scan-result::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(15, 35, 58, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
body.registrar-scan-result-open { overflow: hidden; }

.registrar-scan-camera.is-stopped video {
    opacity: 0.12;
}
.registrar-scan-camera__overlay .fa-circle-check {
    color: #4ade80;
}

.registrar-scan-result__card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 24rem;
    max-height: calc(100vh - 2.5rem);
    overflow-y: auto;
    border-radius: 1.25rem;
    background: var(--surface, #fff);
    box-shadow: 0 32px 64px rgba(15, 35, 58, 0.3);
    animation: registrarScanResultPop 0.25s cubic-bezier(.2, .8, .3, 1.1);
}
@keyframes registrarScanResultPop {
    from { transform: scale(0.92) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.registrar-scan-result__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 3;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background 0.15s ease, transform 0.15s ease;
}
.registrar-scan-result__close:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}

.registrar-scan-result__hero {
    position: relative;
    height: 4.75rem;
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 55%, #4ade80 100%);
    overflow: hidden;
}
.registrar-scan-result__hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.16), transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(255, 255, 255, 0.12), transparent 45%);
}
.registrar-scan-result__card--error .registrar-scan-result__hero {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 55%, #f87171 100%);
}
.registrar-scan-result__eyebrow {
    position: absolute;
    top: 0.9rem;
    left: 1.5rem;
    z-index: 1;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.92);
}

.registrar-scan-result__badge-wrap {
    display: flex;
    justify-content: center;
    margin-top: -2.6rem;
    position: relative;
    z-index: 2;
}
.registrar-scan-result__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 999px;
    background: var(--surface, #fff);
    box-shadow: 0 10px 22px rgba(15, 35, 58, 0.18), 0 0 0 4px var(--surface, #fff);
    font-size: 2rem;
    color: #16a34a;
    animation: registrarScanFoundPop 0.4s cubic-bezier(.34, 1.56, .64, 1) 0.05s both;
}
.registrar-scan-result__card--error .registrar-scan-result__badge {
    color: #dc2626;
}
@keyframes registrarScanFoundPop {
    from { transform: scale(0.4) rotate(-8deg); opacity: 0; }
    to { transform: scale(1) rotate(0); opacity: 1; }
}

.registrar-scan-result__name {
    margin: 0.7rem 0 0;
    padding: 0 1.5rem;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
}
.registrar-scan-result__email {
    margin: 0.2rem 0 0;
    padding: 0 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.registrar-scan-result__body {
    padding: 1.1rem 1.5rem 1.5rem;
}
.registrar-scan-result__meta {
    display: flex;
    flex-direction: column;
    background: var(--surface-alt, #f7f9fb);
    border-radius: 0.85rem;
    overflow: hidden;
    margin: 1.1rem 0;
}
.registrar-scan-result__meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
}
.registrar-scan-result__meta-row + .registrar-scan-result__meta-row {
    border-top: 1px solid var(--border);
}
.registrar-scan-result__meta-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}
.registrar-scan-result__meta-label i {
    width: 1rem;
    text-align: center;
    color: var(--text-muted);
    opacity: 0.75;
    font-size: 0.8rem;
}
.registrar-scan-result__ref {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
}
.registrar-scan-result__fee {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.registrar-scan-result__meta-row--total {
    background: rgba(15, 108, 191, 0.06);
}
.registrar-scan-result__meta-row--total .registrar-scan-result__fee {
    font-size: 1.2rem;
}
.registrar-scan-result__pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.22rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: #fef3c7;
    color: #92400e;
}
.registrar-scan-result__pill--paid {
    background: #dcfce7;
    color: #15803d;
}

.registrar-scan-confirm {
    border-top: 1px dashed var(--border);
    padding-top: 1.1rem;
    margin-top: 0.2rem;
}
.registrar-scan-confirm__label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}
.registrar-scan-result__hint {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin: -0.15rem 0 0.85rem;
    line-height: 1.4;
}

.registrar-scan-result__actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 0.9rem;
}
.registrar-scan-result__actions form {
    margin: 0;
}
.registrar-scan-result__actions .btn {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 0.92rem;
    box-shadow: 0 8px 18px rgba(15, 108, 191, 0.22);
}
.registrar-scan-or-form {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.registrar-scan-or-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.registrar-scan-or-input-wrap i {
    position: absolute;
    left: 0.9rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}
.registrar-scan-or-input-wrap input {
    width: 100%;
    padding: 0.75rem 0.9rem 0.75rem 2.4rem;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 0.7rem;
    border: 1.5px solid var(--border);
    background: var(--surface, #fff);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.registrar-scan-or-input-wrap input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.15);
}
.registrar-scan-or-error {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    margin: -0.1rem 0 0;
    padding: 0.55rem 0.75rem;
    border-radius: 0.6rem;
    background: #fdecea;
    border: 1px solid #f3c2bd;
    color: #b91c1c;
    font-size: 0.8rem;
    line-height: 1.4;
    animation: registrarScanShake 0.3s ease;
}
.registrar-scan-or-error i {
    margin-top: 0.1rem;
    flex-shrink: 0;
}
.registrar-scan-or-error[hidden] {
    display: none;
}
@keyframes registrarScanShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}
.registrar-scan-confirm-success {
    border-radius: 0.7rem;
    background: #dcfce7;
    color: #15803d;
    overflow: hidden;
    animation: registrarScanFoundPop 0.3s ease;
}
.registrar-scan-confirm-success__row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    font-weight: 700;
    font-size: 0.88rem;
}
.registrar-scan-confirm-success i {
    font-size: 1.1rem;
    flex-shrink: 0;
}
.registrar-scan-confirm-success__bar {
    height: 3px;
    background: rgba(21, 128, 61, 0.18);
}
.registrar-scan-confirm-success__bar span {
    display: block;
    height: 100%;
    background: #15803d;
    animation: registrarScanAutoClose 5s linear forwards;
}
@keyframes registrarScanAutoClose {
    from { width: 100%; }
    to { width: 0%; }
}
.registrar-scan-result__scan-again {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background 0.15s ease;
}
.registrar-scan-result__scan-again:hover {
    background: rgba(15, 108, 191, 0.08);
}

.registrar-scan-result__error-text {
    margin: 1rem 0 0;
    padding: 0 1.5rem 1.25rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.or-number-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}
.or-number-modal[hidden] { display: none !important; }
.or-number-modal::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(15, 35, 58, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
body.or-number-modal-open { overflow: hidden; }
.or-number-modal__panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 22rem;
    max-height: calc(100vh - 2.5rem);
    overflow-y: auto;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 24px 48px rgba(15, 35, 58, 0.25);
    animation: registrarScanResultPop 0.2s ease;
}
.or-number-modal__panel h3 {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
}
.or-number-modal__panel .text-muted {
    margin: 0 0 1rem;
    font-size: 0.85rem;
}
.scholarship-settle-impact {
    display: grid;
    gap: 0.55rem;
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid #86efac;
    border-left: 5px solid #16a34a;
    border-radius: 0.65rem;
    background: #f0fdf4;
    color: #14532d;
}
.scholarship-settle-impact[hidden] { display: none; }
.scholarship-settle-impact__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}
.scholarship-settle-impact__row span { font-size: 0.82rem; font-weight: 700; }
.scholarship-settle-impact__row strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scholarship-settle-impact__row--due { padding-top: 0.45rem; border-top: 1px solid #bbf7d0; }
.scholarship-settle-impact__row--due strong { color: #b45309; }
.or-number-modal__panel label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}
.or-number-modal__error {
    color: #dc2626;
    font-size: 0.8rem;
    margin: 0.4rem 0 0;
}
.or-number-modal__actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

.or-number-modal__panel--wide {
    max-width: 34rem;
}

.enroll-group-search {
    margin-bottom: 0.6rem;
}
.enroll-group-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 17rem;
    overflow-y: auto;
    padding-right: 0.15rem;
}
.enroll-group-card {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
/* These three set an explicit `display`, which outranks the browser's own
   `[hidden] { display: none }` — without these guards the class-group picker's JS could set
   .hidden on a card, its "Recommended" badge, or the show-all toggle and nothing would
   visually disappear, leaving every program's every level on screen, each one badged
   "Recommended". */
.enroll-group-card[hidden],
.enroll-group-card__recommended[hidden],
.enroll-group-toggle[hidden] {
    display: none !important;
}
.enroll-group-card:hover {
    border-color: var(--primary, #2563eb);
}
.enroll-group-card.is-selected {
    border-color: var(--primary, #2563eb);
    background: rgba(37, 99, 235, 0.06);
}
.enroll-group-card:has(input:disabled) {
    opacity: 0.55;
    cursor: not-allowed;
    background: var(--surface-muted, #f3f4f6);
}
.enroll-group-card input[type="radio"] {
    margin-top: 0.15rem;
    accent-color: var(--primary, #2563eb);
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}
.enroll-group-card__body {
    flex: 1;
    min-width: 0;
}
.enroll-group-card__name {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
}
.enroll-group-card__meta {
    display: block;
    font-size: 0.76rem;
    color: var(--text-muted, #667085);
    margin-top: 0.1rem;
}
.enroll-group-card__capacity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
}
.enroll-group-card__bar {
    flex: 1;
    height: 0.35rem;
    border-radius: 1rem;
    background: var(--border);
    overflow: hidden;
}
.enroll-group-card__bar > span {
    display: block;
    height: 100%;
    background: var(--primary, #2563eb);
    border-radius: 1rem;
}
.enroll-group-card__bar > span.is-full {
    background: #dc2626;
}
.enroll-group-card__count {
    font-size: 0.72rem;
    color: var(--text-muted, #667085);
    white-space: nowrap;
}
.enroll-group-card__badge {
    flex-shrink: 0;
    font-size: 0.68rem;
    font-weight: 700;
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    white-space: nowrap;
    align-self: flex-start;
}
.enroll-group-empty {
    font-size: 0.85rem;
    color: var(--text-muted, #667085);
    padding: 0.75rem;
    text-align: center;
}
.enroll-group-card__recommended {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #15803d;
    background: rgba(21, 128, 61, 0.1);
    padding: 0.1rem 0.45rem;
    border-radius: 1rem;
    vertical-align: middle;
    margin-left: 0.35rem;
}
.enroll-group-toggle {
    display: inline-block;
    margin-top: 0.6rem;
    padding: 0;
    border: none;
    background: none;
    color: var(--primary, #2563eb);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.enroll-group-toggle:hover {
    text-decoration: underline;
}
.payment-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.75rem;
}
.payment-history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
}
.payment-history-row__meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.82rem;
    color: var(--text-muted, #6b7280);
}
.payment-history-row__amount {
    font-weight: 700;
    white-space: nowrap;
}
.fin-row-clickable {
    cursor: pointer;
}
.fin-row-clickable:hover {
    background: var(--surface-hover, rgba(15, 35, 58, 0.03));
}

.doc-preview-modal__panel {
    max-width: 56rem;
    width: calc(100vw - 2.5rem);
    height: calc(100vh - 2.5rem);
    display: flex;
    flex-direction: column;
    padding: 1rem;
}
.doc-preview-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.doc-preview-modal__head h3 {
    margin: 0;
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-preview-modal__head-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}
.doc-preview-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    overflow: hidden;
    background: var(--surface-2, var(--surface-muted));
}
.doc-preview-modal__body iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}
.doc-preview-sheet {
    width: 100%;
    height: 100%;
    background: #fff;
    overflow: auto;
}
.doc-preview-sheet__scroll {
    padding: 0.75rem;
}
.doc-preview-sheet__scroll table {
    border-collapse: collapse;
    font-size: 0.8125rem;
    white-space: nowrap;
}
.doc-preview-sheet__scroll table td,
.doc-preview-sheet__scroll table th {
    border: 1px solid var(--border);
    padding: 0.3rem 0.55rem;
}
.doc-preview-sheet__scroll table tr:first-child td {
    background: #f1f5f9;
    font-weight: 600;
}
.doc-preview-sheet__status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 100%;
    margin: 0;
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.doc-preview-sheet__status--error {
    color: #c0392b;
}
@media (max-width: 640px) {
    .doc-preview-modal__panel {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }
}
.or-number-modal__actions .btn {
    flex: 1 1 auto;
}

.pay-qr-modal__panel {
    max-width: 20rem;
    text-align: center;
}
.pay-qr-modal__qr {
    display: inline-flex;
    background: #fff;
    border: 1.5px solid var(--border, #e2e6ea);
    border-radius: 0.85rem;
    padding: 1rem;
    margin: 0.5rem 0 1rem;
}
.pay-qr-modal__qr canvas {
    display: block;
    width: 200px;
    height: 200px;
}
.pay-qr-modal__title {
    margin: 0;
    font-weight: 700;
    color: var(--text, #1d2125);
}
.pay-qr-modal__amount {
    margin: 0.15rem 0 0;
    font-size: 1.15rem;
    font-weight: 800;
}
.pay-qr-modal__waiting {
    margin: 0.9rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted, #6a737b);
}

#payQrReceiptView {
    text-align: center;
    animation: payQrPanelIn 0.35s ease;
}

.receipt-check {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 0.6rem;
}
.receipt-check svg {
    width: 100%;
    height: 100%;
}
.receipt-check__circle {
    stroke: #22a35a;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 151;
    stroke-dashoffset: 151;
    animation: receiptCircleDraw 0.5s ease forwards;
}
.receipt-check__mark {
    stroke: #22a35a;
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 32;
    stroke-dashoffset: 32;
    animation: receiptCheckDraw 0.35s ease forwards 0.45s;
}

.receipt-headline {
    margin: 0 0 1rem;
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text, #1d2125);
    opacity: 0;
    animation: receiptFadeUp 0.4s ease forwards 0.5s;
}

.receipt-paper {
    position: relative;
    text-align: left;
    background: #fffdf8;
    color: #2b2b28;
    border-radius: 0.4rem;
    padding: 1.1rem 1.1rem 1.5rem;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
    font-family: 'Courier New', Consolas, monospace;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: 50vh;
    opacity: 0;
    transform: translateY(14px) rotate(-1deg) scale(0.97);
    animation: receiptPaperIn 0.45s cubic-bezier(.2, .8, .3, 1.2) forwards 0.15s;
}
#payQrPanel:has(#payQrReceiptView:not([hidden])) {
    overflow-y: hidden;
}
.receipt-paper__watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 62%;
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.07;
    filter: grayscale(1);
    z-index: -1;
    pointer-events: none;
}
.receipt-paper__stamp,
.receipt-stamp {
    position: absolute;
    top: 0.85rem;
    right: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.05rem;
    border: 2.5px solid #c0392b;
    color: #c0392b;
    padding: 0.2rem 0.5rem;
    border-radius: 0.3rem;
    transform: rotate(-10deg) scale(1.7);
    opacity: 0;
    animation: receiptStampIn 0.4s cubic-bezier(.34, 1.56, .64, 1) forwards 0.75s;
}
.receipt-stamp__label {
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    line-height: 1;
}
.receipt-stamp__or {
    font-weight: 700;
    font-size: 0.5rem;
    letter-spacing: 0.04em;
    line-height: 1;
    white-space: nowrap;
}
.receipt-paper__brand-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
    padding-right: 3.5rem;
}
.receipt-paper__logo {
    flex-shrink: 0;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 0.4rem;
    object-fit: contain;
    background: #fff;
    border: 1px solid #ece8da;
}
.receipt-paper__brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.receipt-paper__brand {
    display: block;
    font-weight: 800;
    letter-spacing: 0.01em;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.receipt-paper__sub {
    display: block;
    font-size: 0.65rem;
    color: #7a7a72;
    margin-top: 0.1rem;
}
.receipt-paper__divider {
    border-top: 1px solid #d8d4c4;
    margin: 0.6rem 0;
}
.receipt-paper__divider--dashed {
    border-top-style: dashed;
}
.receipt-paper__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    font-size: 0.8rem;
    padding: 0.25rem 0;
}
.receipt-paper__row span {
    color: #7a7a72;
    flex-shrink: 0;
}
.receipt-paper__row strong {
    min-width: 0;
    text-align: right;
    word-break: break-word;
}
.receipt-paper__row--sub {
    font-size: 0.68rem;
}
.receipt-paper__row--total {
    font-size: 0.95rem;
    font-weight: 800;
}
.receipt-paper__meta-group {
    padding-bottom: 0.4rem;
    margin-bottom: 0.45rem;
    border-bottom: 1px dashed #d8d4c4;
}
.receipt-paper__meta-group .receipt-paper__row {
    padding: 0.08rem 0;
}
.receipt-paper__jagged {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 10px;
    background:
        linear-gradient(135deg, #fffdf8 50%, transparent 50%) 0 0 / 12px 12px repeat-x,
        linear-gradient(-135deg, #fffdf8 50%, transparent 50%) 0 0 / 12px 12px repeat-x;
    background-color: transparent;
}

@keyframes payQrPanelIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes receiptCircleDraw {
    to { stroke-dashoffset: 0; }
}
@keyframes receiptCheckDraw {
    to { stroke-dashoffset: 0; }
}
@keyframes receiptFadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes receiptPaperIn {
    to { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}
@keyframes receiptStampIn {
    to { opacity: 1; transform: rotate(-10deg) scale(1); }
}

.admin-table-card-head--stacked {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
}
.admin-table-card-head-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.billing-filter-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.billing-filter-form--full {
    width: 100%;
}
.billing-filter-form--full .admin-table-search {
    flex: 1 1 260px;
    max-width: 420px;
}
.billing-filter-form__clear {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.4rem 0.3rem;
    border-radius: 0.35rem;
    transition: color 0.15s ease;
}
.billing-filter-form__clear:hover {
    color: var(--primary);
    text-decoration: underline;
}
.billing-filter-form__clear:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
@media (max-width: 640px) {
    .billing-filter-form {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .billing-filter-form .admin-table-search,
    .billing-filter-form .admin-table-filter {
        flex: 0 0 auto;
        min-width: 0;
        max-width: none;
        width: 100%;
    }
    .billing-filter-form__clear {
        text-align: center;
    }
}

.cashier-report-filter-form__date {
    max-width: 10.5rem;
}
.cashier-report-filter-form__category {
    max-width: 13rem;
}
.cashier-report-filter-form__date .form-control,
.cashier-report-filter-form__category .form-control {
    width: 100%;
}

/* The report header/total only make sense on the printed page — the on-screen view already has
   the topbar, page title, and stat tiles doing that job. */
.print-only { display: none; }
.cashier-report-print-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 2px solid var(--text);
    font-size: 0.95rem;
}
.cashier-report-print-note {
    margin-top: 0.5rem;
    font-size: 0.75rem;
}
.cashier-report-total-row td {
    border-top: 2px solid var(--text);
    background: var(--surface-alt, #f8fafc);
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

@media print {
    @page { size: landscape; margin: 12mm; }
    .moodle-drawer, .drawer-overlay, .drawer-toggle,
    .moodle-navbar, .breadcrumbs, .page-header,
    .no-print { display: none !important; }
    .moodle-layout, .moodle-main, .page-content { display: block !important; margin: 0 !important; padding: 0 !important; }
    body { background: #fff !important; }
    .print-only { display: block !important; }
    .admin-table-card { border: none !important; box-shadow: none !important; }
    .cashier-report-print-header {
        margin-bottom: 1.25rem;
        padding-bottom: 0.75rem;
        border-bottom: 2px solid #000;
    }
    .cashier-report-print-header h1 { margin: 0 0 0.25rem; font-size: 1.25rem; }
    .cashier-report-print-header p { margin: 0.1rem 0; font-size: 0.85rem; color: #333; }
    .cashier-report-print-header__meta { margin-top: 0.4rem !important; font-style: italic; color: #666 !important; }
    .cashier-report-print-header__logo { display: block; height: 52px; width: auto; margin: 0 0 0.5rem; }
    /* Full gridlines on printed report tables so they read like a spreadsheet printout. */
    .admin-table-card .admin-data-table,
    .admin-table-card .admin-data-table th,
    .admin-table-card .admin-data-table td {
        border: 1px solid #999 !important;
        border-collapse: collapse;
    }
    .admin-table-card .admin-data-table thead th { background: #eef4fb !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .fin-row { break-inside: avoid; }
}

/* Statement of Account — printed layout only, mirroring the school's own paper SOA format
   (bordered charges table + Total, a plain payments list with OR numbers, then a Balance line). */
.soa-doc { display: none; }
@media print {
    .soa-doc { display: block !important; color: #000; }
    .soa-doc__header { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.75rem; margin-bottom: 1rem; }
    .soa-doc__logo { height: 52px; width: auto; flex: 0 0 auto; }
    .soa-doc__school { flex: 1 1 140px; min-width: 0; text-align: center; }
    .soa-doc__school h1 { margin: 0 0 0.15rem; font-size: 0.72rem; }
    .soa-doc__school p { margin: 0.05rem 0; font-size: 0.55rem; }
    /* The site-wide `table { width: 100% }` rule resolves flex-basis:auto to 100%, which is what
       stretched this into a full-width bar — pin an explicit width so it sizes to its own content
       like the reference's compact info box instead. */
    .soa-doc__info-table { flex: 0 0 auto; width: auto; margin-left: auto; border-collapse: collapse; font-size: 0.52rem; }
    .soa-doc__info-table th, .soa-doc__info-table td {
        border: 1px solid #000;
        padding: 0.1rem 0.3rem;
        text-align: center;
        white-space: nowrap;
        font-weight: normal;
    }
    .soa-doc__ledger { width: 100%; border-collapse: collapse; margin-bottom: 0.85rem; font-size: 0.65rem; }
    .soa-doc__ledger th, .soa-doc__ledger td { border: none; padding: 0.2rem 0.4rem; }
    .soa-doc__ledger th { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; text-align: left; }
    .soa-doc__ledger .col-fee { text-align: right; white-space: nowrap; }
    .soa-doc__ledger .soa-doc__spacer td { height: 0.5rem; padding: 0; }
    .soa-doc__summary { text-align: right; margin-bottom: 1.25rem; font-size: 0.72rem; font-weight: 700; break-inside: avoid; }
    .soa-doc__summary-row strong { display: inline-block; min-width: 6rem; margin-left: 1rem; }
    .soa-doc__footer { break-inside: avoid; }
    .soa-doc__signature { width: 200px; margin-left: auto; text-align: center; }
    .soa-doc__signatory-name { margin: 0 0 0.1rem; font-weight: 700; font-size: 0.7rem; border-bottom: 1px solid #000; padding-bottom: 0.2rem; min-height: 1.1em; }
    .soa-doc__signature-line { margin: 0.1rem 0 0; font-size: 0.6rem; }
    .soa-doc__disclaimer { margin-top: 0.85rem; font-size: 0.58rem; color: #c00; }
    /* Scholarship / subsidy emphasis */
    .soa-doc__sch-row td { background: #e8f3ff !important; font-weight: 700; color: #0b3d7a; border-top: 1px solid #0b3d7a; border-bottom: 1px solid #0b3d7a; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .soa-doc__sch-row td:first-child { border-left: 4px solid #0b3d7a; }
    .soa-doc__sch-tag { display: inline-block; padding: 0.02rem 0.35rem; margin-right: 0.3rem; background: #0b3d7a !important; color: #fff; border-radius: 3px; font-size: 0.5rem; letter-spacing: 0.06em; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .soa-doc__summary-row { margin: 0.1rem 0; }
    .soa-doc__summary-row--sch { display: inline-block; margin: 0.15rem 0; padding: 0.25rem 0.6rem; background: #e8f3ff !important; border: 2px solid #0b3d7a; border-radius: 4px; color: #0b3d7a; font-size: 0.8rem; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .soa-doc__summary { display: flex; flex-direction: column; align-items: flex-end; }
    .soa-doc__summary-row--balance { font-size: 0.85rem; border-top: 1px solid #000; padding-top: 0.2rem; }
    .soa-doc__sch { margin: 0.4rem 0 1rem; break-inside: avoid; }
    .soa-doc__sch-banner { text-align: center; font-weight: 800; font-size: 0.72rem; letter-spacing: 0.04em; color: #0b3d7a; padding: 0.25rem 0; border-top: 2px solid #0b3d7a; border-bottom: 2px solid #0b3d7a; margin-bottom: 0.4rem; }
    .soa-doc__sch-table th { background: #e8f3ff !important; color: #0b3d7a; }
    .soa-doc__sch-note { margin: 0.4rem 0 0; font-size: 0.62rem; font-weight: 700; color: #c00; }
}

.billing-analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.1rem;
    margin-bottom: 1.25rem;
    align-items: stretch;
}
@media (max-width: 860px) {
    .billing-analytics-grid {
        grid-template-columns: 1fr;
    }
}
.billing-analytics-card {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.billing-meter-wrap {
    padding: 0.5rem 1.25rem 1.35rem;
}
.billing-meter {
    height: 0.65rem;
    border-radius: 999px;
    background: #fdecea;
    overflow: hidden;
}
.billing-meter__fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(180deg, #179743 0%, #15803d 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: width 0.4s ease;
}
.billing-meter__labels {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.9rem;
}
.billing-meter__pct {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
}
.billing-meter__legend {
    display: flex;
    gap: 0.9rem;
    flex-wrap: wrap;
}
.billing-meter__legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.billing-meter__dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    flex-shrink: 0;
}
.billing-meter__dot--paid {
    background: #15803d;
}
.billing-meter__dot--unpaid {
    background: #fdecea;
    border: 1.5px solid #c0392b;
}

.billing-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 0.4rem 1.25rem 1.1rem;
}
.billing-breakdown__row {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.billing-breakdown__label {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.82rem;
    color: var(--text);
}
.billing-breakdown__value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.billing-breakdown__track {
    height: 0.55rem;
    border-radius: 999px;
    background: var(--surface-alt, #f1f4f8);
    overflow: hidden;
}
.billing-breakdown__bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(180deg, #2384d6 0%, var(--primary, #0f6cbf) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    min-width: 4px;
}

.billing-group-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem 0.8rem;
}
.billing-group {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface, #fff);
}
.billing-group--single {
    border-color: var(--border);
}
.billing-group__head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.65rem 1.1rem;
}
.billing-group:not(.billing-group--single) .billing-group__head {
    background: var(--surface-alt, #f7f9fb);
    border-bottom: 1px solid var(--border);
}
.billing-group__identity {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    min-width: 0;
}
button.billing-group__toggle {
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    font: inherit;
    text-align: left;
    cursor: pointer;
    color: inherit;
    border-radius: 0.4rem;
}
button.billing-group__toggle:hover {
    color: var(--primary);
}
button.billing-group__toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.billing-group__chevron {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: transform 0.15s ease;
}
.billing-group__toggle[aria-expanded="true"] .billing-group__chevron {
    transform: rotate(90deg);
}
/* Single-bill rows have no toggle button, but still reserve the chevron's width so student
   avatars line up in the same column as multi-bill rows. */
.billing-group__chevron--spacer {
    visibility: hidden;
}
.billing-group__summary {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.billing-group__summary--fee {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.35;
}
.billing-group__badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: #fff3cd;
    color: #856404;
    font-size: 0.7rem;
    font-weight: 700;
}
.billing-group__batch-label {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--surface-2, #f1f5f9);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
}
.billing-group__head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.9rem;
}
.billing-group__total {
    display: inline-block;
    text-align: right;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.billing-group__head .mark-paid-form {
    margin: 0;
}
.billing-group__items {
    display: flex;
    flex-direction: column;
    background: var(--surface, #fff);
}
.billing-group__items[hidden] {
    display: none;
}
.fin-row.billing-row--nested {
    padding: 0.65rem 1.75rem 0.65rem 3.75rem;
    gap: 1.25rem;
    border-bottom: 1px solid var(--border);
}
.fin-row.billing-row--nested:last-child {
    border-bottom: none;
}
.billing-row--nested .fin-row__main {
    gap: 0.3rem;
}
@media (max-width: 640px) {
    .fin-row.billing-row--nested {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
}
@media (max-width: 640px) {
    .billing-group__head-actions {
        justify-content: space-between;
        width: 100%;
    }
    .billing-group__head .mark-paid-form {
        flex: 1 1 auto;
    }
    .billing-group__head .mark-paid-form .btn {
        width: 100%;
    }
}

.billing-bulk-picker {
    margin-bottom: 1rem;
}
.billing-bulk-picker label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}
.billing-bulk-picker__row {
    display: flex;
    gap: 0.5rem;
}
.billing-bulk-picker__row .form-control {
    flex: 1 1 auto;
}
.billing-student-search {
    position: relative;
    margin-bottom: 0.75rem;
}
.billing-student-search i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.billing-student-search .form-control {
    padding-left: 2.25rem;
}
.billing-student-list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    max-height: 22rem;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
}
.billing-student-list--compact {
    max-height: 13rem;
    margin-bottom: 1rem;
}
.billing-student-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid transparent;
    border-radius: 0.6rem;
    cursor: pointer;
}
a.billing-student-row {
    color: inherit;
    text-decoration: none;
}
.curriculum-irregular-enroll-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}
.curriculum-irregular-enroll-link:hover { text-decoration: underline; }

.irregular-subject-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.irregular-subject-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.3rem 0.2rem 0.6rem;
    background: var(--surface-alt, #f8fafc);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.8125rem;
}
.irregular-subject-chip a { color: var(--primary); text-decoration: none; font-weight: 600; }
.irregular-subject-chip a:hover { text-decoration: underline; }
.irregular-subject-chip__status {
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
}
.irregular-subject-chip__status--paid { background: #dcfce7; color: #166534; }
.irregular-subject-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.7rem;
}
.irregular-subject-chip__remove:hover { background: #fee2e2; color: #dc2626; }

.irregular-enroll-preview {
    margin: 0.5rem 0 1rem;
    padding: 0.6rem 0.85rem;
    background: var(--surface-alt, #f8fafc);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    font-size: 0.85rem;
}
.irregular-enroll-preview [data-irregular-preview-amount] {
    display: block;
    margin-top: 0.2rem;
    font-weight: 700;
    color: var(--text);
}
.billing-student-row[hidden] {
    display: none;
}
.billing-student-row:hover {
    background: var(--primary-light);
}
.billing-student-row input[type="checkbox"] {
    flex-shrink: 0;
}
.billing-student-row__email {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.billing-template-title-icon {
    color: var(--primary);
    margin-right: 0.15rem;
}
.billing-template-search-wrap {
    position: relative;
    margin-bottom: 0.75rem;
}
.billing-template-search-wrap i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8125rem;
    pointer-events: none;
}
.billing-template-search-wrap .form-control {
    padding-left: 2.25rem;
}
.billing-template-search-wrap .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--accent-l);
}
.billing-template-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    max-height: 26rem;
    overflow-y: auto;
    padding: 0.15rem 0.4rem 0.15rem 0.15rem;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-l2) transparent;
}
.billing-template-items::-webkit-scrollbar {
    width: 8px;
}
.billing-template-items::-webkit-scrollbar-thumb {
    background: var(--accent-l2);
    border-radius: 999px;
}
.billing-template-items::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}
.billing-template-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    border-radius: 0.6rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.billing-template-item[hidden] {
    display: none;
}
.billing-template-item:hover {
    border-color: #c5daf0;
    border-left-color: var(--accent-l2);
    background: var(--primary-light);
}
.billing-template-item:has(input:checked) {
    border-color: var(--primary);
    border-left-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 1px rgba(15, 108, 191, 0.12);
}
.billing-template-item__text {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.billing-template-item__default {
    display: inline-flex;
    align-self: flex-start;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    background: var(--accent-l);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
}
.billing-template-item__amount {
    width: 8rem;
    flex-shrink: 0;
}
.billing-template-empty {
    padding: 0.75rem;
    text-align: center;
}

.academic-choice.is-disabled,
.academic-choice__option.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}
.billing-due-date {
    max-width: 16rem;
    margin-top: 1.1rem;
}
.billing-due-date label i {
    color: var(--text-muted);
    margin-right: 0.15rem;
}

.form-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 0.5rem;
    vertical-align: middle;
    box-shadow: 0 2px 6px rgba(15, 108, 191, 0.35);
}

.billing-step .form-section-title {
    font-size: 1rem;
}

.academic-choice__option--fee .academic-choice__icon {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1d4ed8;
}
.academic-choice__option--template .academic-choice__icon {
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    color: #6d28d9;
}
.academic-choice__option--fee:has(input:checked) {
    border-color: #93c5fd;
    background: #eff6ff;
    box-shadow: 0 0 0 1px rgba(29, 78, 216, 0.15);
}
.academic-choice__option--fee:has(input:checked) .academic-choice__icon {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    color: #fff;
}
.academic-choice__option--template:has(input:checked) {
    border-color: #c4b5fd;
    background: #f5f3ff;
    box-shadow: 0 0 0 1px rgba(109, 40, 217, 0.15);
}
.academic-choice__option--template:has(input:checked) .academic-choice__icon {
    background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 100%);
    color: #fff;
}

.billing-mode-detail {
    margin-top: 1.1rem;
    padding: 1.1rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 55%);
}
.billing-mode-detail--template {
    border-left-color: #7c3aed;
}
.billing-mode-detail__label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.85rem;
}
.billing-mode-detail--fee .billing-mode-detail__label i {
    color: #1d4ed8;
}
.billing-mode-detail--template .billing-mode-detail__label i {
    color: #7c3aed;
}
.billing-mode-detail .form-row:last-child {
    margin-bottom: 0;
}

.billing-student-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.billing-student-list-head .billing-student-search {
    flex: 1 1 16rem;
    margin-bottom: 0;
}
.billing-student-list-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
.billing-selected-count {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-dark);
    background: var(--primary-light);
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
}
.billing-link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.8125rem;
    cursor: pointer;
    padding: 0;
}
.billing-link-btn:hover {
    text-decoration: underline;
}
.billing-student-row:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
}
.billing-student-search-empty {
    text-align: center;
    padding: 1.25rem 0.5rem;
}
.billing-student-search-empty[hidden] {
    display: none;
}

.billing-stats-grid {
    grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 720px) {
    .billing-stats-grid {
        grid-template-columns: 1fr;
    }
}

.billing-cta {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1.1rem;
    margin-bottom: 1.1rem;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-lg);
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 0.85rem;
}
.billing-cta i {
    color: #2563eb;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.billing-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.billing-history-title {
    margin: 0;
    font-size: 1rem;
}
.billing-history-filters {
    display: flex;
    gap: 0.4rem;
}
.billing-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface, #fff);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.billing-filter-btn span {
    font-size: 0.72rem;
    opacity: 0.8;
}
.billing-filter-btn:hover {
    border-color: #c5daf0;
    background: var(--primary-light);
}
.billing-filter-btn.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.billing-history-empty {
    text-align: center;
    padding: 1.5rem 0.5rem;
}
.billing-history-empty[hidden] {
    display: none;
}

.fin-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.85rem 1rem 1.1rem;
}
.fin-pagination[hidden] {
    display: none;
}
.fin-pagination__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    background: var(--surface, #fff);
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}
.fin-pagination__btn:hover:not(:disabled) {
    background: var(--surface-alt, #f1f4f8);
}
.fin-pagination__btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.fin-pagination__info {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 7ch;
    text-align: center;
}

.billing-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.billing-history-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface, #fff);
}
.billing-history-card[hidden] {
    display: none;
}
.billing-history-card.is-unpaid {
    border-left: 3px solid var(--warning, #f59e0b);
}
.billing-history-card.is-paid {
    border-left: 3px solid var(--success, #16a34a);
}
.billing-history-card.is-overdue {
    border-left-color: #dc2626;
    background: #fef2f2;
}
.billing-overdue-text {
    color: #dc2626;
    font-weight: 600;
}
.billing-history-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 1rem;
}
.billing-history-card.is-unpaid .billing-history-card__icon {
    background: #fff4e6;
    color: var(--warning, #d97706);
}
.billing-history-card.is-overdue .billing-history-card__icon {
    background: #fee2e2;
    color: #dc2626;
}
.billing-history-card.is-paid .billing-history-card__icon {
    background: #e8f5e9;
    color: var(--success, #16a34a);
}
.billing-history-card__body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.billing-history-card__body strong {
    font-size: 0.9rem;
}
.billing-history-card__body span {
    font-size: 0.78rem;
}
.billing-history-card__amount {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    flex-shrink: 0;
}
.billing-history-card__amount strong {
    font-size: 1rem;
    color: var(--text);
}
@media (max-width: 560px) {
    .billing-history-card {
        flex-wrap: wrap;
    }
    .billing-history-card__amount {
        align-items: flex-start;
        margin-left: calc(2.5rem + 0.9rem);
    }
}

.billing-summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #fafbfc;
}
.billing-summary-bar__text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.billing-summary-bar__text strong {
    font-size: 0.9rem;
}
.billing-summary-bar__text span {
    font-size: 0.78rem;
}
.billing-summary-bar__total {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
}
.billing-summary-bar__total span {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.billing-summary-bar__total strong {
    font-size: 1.35rem;
    color: var(--primary-dark);
}

.billing-review__section {
    margin-top: 1.25rem;
}
.billing-review__section:first-child {
    margin-top: 0;
}
.billing-review__section h4 {
    margin: 0 0 0.6rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.billing-review__heading {
    margin: 1.25rem 0 0.5rem;
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.billing-review__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
.billing-review__label {
    color: var(--text-muted);
}
.billing-review__value {
    font-weight: 700;
    color: var(--text);
    text-align: right;
}
.billing-review__fees {
    margin: 0.5rem 0 0.75rem;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    background: #fafbfc;
}
.billing-review__fee-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.82rem;
    padding: 0.2rem 0;
}
.billing-review__students {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.billing-review__student-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 600;
}
.billing-template-preview {
    align-self: flex-end;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    padding: 0.75rem 0.9rem;
    min-width: 16rem;
}
.billing-template-preview:empty {
    display: none;
}
.billing-template-preview__label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}
.billing-template-preview__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.8125rem;
    padding: 0.2rem 0;
}
.billing-template-preview__row--total {
    margin-top: 0.35rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    font-weight: 700;
    color: var(--text);
}

.registrar-tabs-wrap {
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.registrar-tabs-wrap--inline {
    border: none;
    margin-bottom: 0;
    background: transparent;
}
.registrar-tabs-wrap--inline .registrar-tabs {
    padding: 0;
}
.fin-tab-count {
    font-size: 0.7rem;
    opacity: 0.75;
}

.fin-hero {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1.15rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface, #fff);
}
.fin-hero__icon {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}
.fin-hero--warn {
    border-color: #f3c98b;
    background: linear-gradient(135deg, #fff8ec 0%, var(--surface, #fff) 65%);
}
.fin-hero--warn .fin-hero__icon {
    background: #fff3cd;
    color: #b45309;
}
.fin-hero--good .fin-hero__icon {
    background: #d4edda;
    color: #15803d;
}
.fin-hero__body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.fin-hero__label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.fin-hero__value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.15;
}
.fin-hero--warn .fin-hero__value {
    color: #b45309;
}
.fin-hero__hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.fin-hero {
    flex-wrap: wrap;
}
.fin-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-left: auto;
    align-self: center;
}
@media (max-width: 720px) {
    .fin-hero__actions {
        width: 100%;
        margin-left: 0;
    }
    .fin-hero__actions .btn {
        flex: 1 1 auto;
    }
}

.fin-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}
.billing-stat-grid--3 {
    grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 720px) {
    .billing-stat-grid--3 {
        grid-template-columns: 1fr 1fr;
    }
}
.fin-stat-tile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 1.1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: #fafbfc;
    min-width: 0;
    transition: all 0.2s ease;
}

.fin-stat-tile--link {
    text-decoration: none;
    color: inherit;
}

.fin-stat-tile--link:hover {
    border-color: #d1d5db;
    background: #f3f4f6;
    transform: none;
}

.fin-stat-tile--link:active {
    transform: none;
    box-shadow: none;
}

.fin-stat-tile--link:focus-visible {
    outline: 2px solid #4b5563;
    outline-offset: 2px;
}

.fin-stat-tile--link .fin-stat-tile__sub {
    color: #4b5563;
    font-weight: 500;
}

.fin-stat-tile--link .fin-stat-tile__sub i {
    font-size: 0.65rem;
    margin-left: 0.1rem;
}

.fin-stat-tile__icon {
    flex-shrink: 0;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 0.4rem;
    background: #f3f4f6;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.fin-stat-tile__body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.fin-stat-tile__label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #9ca3af;
}

.fin-stat-tile__value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fin-stat-tile__sub {
    font-size: 0.65rem;
    color: #9ca3af;
}

.fin-stat-tile__icon--warn {
    background: #f3f4f6;
    color: #9ca3af;
}

.fin-stat-tile__icon--good {
    background: #f3f4f6;
    color: #9ca3af;
}

.fin-stat-tile__icon--danger {
    background: #f3f4f6;
    color: #9ca3af;
}

.fin-stat-tile__icon--info {
    background: #f3f4f6;
    color: #0f766e;
}
@media (max-width: 420px) {
    .fin-stat-grid {
        grid-template-columns: 1fr;
    }
}

.fin-statement {
    display: flex;
    flex-direction: column;
    padding: 0.25rem 1.1rem 0.5rem;
}
.fin-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.85rem 0.15rem;
    border-bottom: 1px solid var(--border);
}
.fin-row:last-child {
    border-bottom: none;
}
.fin-row[hidden] {
    display: none;
}
.fin-row[data-billing-status="paid"] {
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background-color 0.15s ease;
}
.fin-row[data-billing-status="paid"]:hover {
    background-color: var(--surface-hover, rgba(15, 108, 191, 0.06));
}
.fin-row[data-billing-status="voided"] {
    opacity: 0.72;
}
.fin-row__status--voided {
    color: #9b1c1c;
}
.fin-status-dot--voided {
    background: #dc2626;
}
.cashier-transaction-void-form {
    flex: 0 0 auto;
    margin-left: auto;
}
.cashier-transaction-void-form--group {
    display: flex;
    justify-content: flex-end;
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--border);
}
.cashier-transaction-void-dialog {
    width: min(30rem, calc(100vw - 2rem));
    max-width: none;
    padding: 1.5rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    box-shadow: 0 1.5rem 4rem rgba(15, 23, 42, 0.22);
}
.cashier-transaction-void-dialog::backdrop {
    background: rgba(15, 23, 42, 0.55);
}
.cashier-transaction-void-dialog h2 {
    margin: 0 0 0.75rem;
    font-size: 1.2rem;
}
.cashier-transaction-void-dialog__note {
    padding: 0.75rem;
    color: #713f12;
    background: #fffbeb;
    border-radius: 0.5rem;
}
.cashier-transaction-void-dialog__online-warning {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 0.8rem 0;
    padding: 0.75rem;
    color: #7f1d1d;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
}
.cashier-transaction-void-dialog__online-warning[hidden] {
    display: none;
}
.cashier-transaction-void-dialog textarea {
    width: 100%;
    margin-top: 0.35rem;
}
.cashier-transaction-void-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1.25rem;
}
.fin-row-group {
    border-bottom: 1px solid var(--border);
}
.fin-row-group:last-child {
    border-bottom: none;
}
.fin-row-group__summary {
    border-bottom: none;
    list-style: none;
}
.fin-row-group__summary::-webkit-details-marker {
    display: none;
}
.fin-row-group__chevron {
    font-size: 0.7rem;
    transition: transform 0.15s ease;
}
.fin-row-group[open] .fin-row-group__chevron {
    transform: rotate(180deg);
}
.fin-row-group__items {
    padding-left: 1.5rem;
    border-top: 1px dashed var(--border);
}
.fin-category-header {
    padding: 0.9rem 0.15rem 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.fin-category-header:first-child {
    padding-top: 0.15rem;
}
.fin-row-group__items .fin-row {
    padding-left: 0.5rem;
}
@media print {
    /* A collapsed <details> group would otherwise hide its line items on paper entirely —
       force every group open when printing regardless of its on-screen collapsed state. */
    .fin-row-group:not([open]) > *:not(summary) {
        display: block !important;
    }
}
.fin-row__main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.fin-row__main strong {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}
.fin-row.is-overdue .fin-row__main strong {
    color: #b91c1c;
}
.fin-row__meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.6rem;
}
.fin-row__main .table-user-cell + .fin-row__title,
.fin-row__main .table-user-cell + .fin-row__meta,
.fin-row__main .table-user-cell + .fin-row__title + .fin-row__meta {
    margin-left: 3rem;
}
.fin-row__meta > *:not(:last-child)::after {
    content: '\2022';
    margin-left: 0.6rem;
    color: var(--border);
}

.fin-row__title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}
.fin-row__or {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.72rem;
    background: var(--surface-2, #f1f5f9);
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    padding: 0.05rem 0.4rem;
    color: var(--text-muted);
}
/* Opt-in zebra striping for long fin-statement lists (pass class="... billing-list--recent") */
.billing-list--recent .fin-row:nth-child(even) {
    background-color: var(--surface-2, rgba(15, 23, 42, 0.02));
    border-radius: var(--radius, 0.5rem);
}
.fin-row__amount {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 6rem;
    text-align: right;
    color: var(--text);
    flex-shrink: 0;
}
.fin-row__amount-remaining {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: #b45309;
    margin-top: 0.15rem;
    white-space: nowrap;
}
.fin-row__status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 5rem;
    justify-content: flex-end;
    flex-shrink: 0;
}
.fin-row__status--paid {
    color: #15803d;
}
.fin-row__status--unpaid {
    color: #b45309;
}
.fin-row__status--overdue {
    color: #b91c1c;
}
.fin-status-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    flex-shrink: 0;
}
.fin-status-dot--paid {
    background: #15803d;
}
.fin-status-dot--unpaid {
    background: #b45309;
}
.fin-status-dot--overdue {
    background: #b91c1c;
}
.fin-cell-overdue {
    color: #b91c1c;
    font-weight: 600;
}
.fin-row__action {
    flex-shrink: 0;
}
.fin-row__check {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    /* The checkbox itself stays visually small (a full 44px box here would look oversized next
       to the rest of this row), but the label wrapping it — the actual tap target — is padded
       out to size instead. */
    min-width: 2.75rem;
    min-height: 2.75rem;
    cursor: pointer;
}
.fin-row__check input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--primary, #0f6cbf);
    cursor: pointer;
}
@media (max-width: 640px) {
    .fin-row {
        flex-wrap: wrap;
        row-gap: 0.5rem;
        padding: 1rem 0.15rem;
    }
    .fin-row__check {
        order: 1;
    }
    .fin-row__main {
        flex-basis: calc(100% - 2rem);
        order: 1;
    }
    .fin-row__amount {
        text-align: left;
        order: 2;
        font-size: 1.05rem;
    }
    .fin-row__status {
        justify-content: flex-end;
        margin-left: auto;
        order: 3;
    }
    .fin-row__action {
        order: 4;
        flex-basis: 100%;
    }
    .cashier-transaction-void-form {
        order: 4;
        flex-basis: 100%;
    }
    .fin-row__action .btn {
        width: 100%;
    }
}

.fin-bulk-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--surface, #fff);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.14);
    padding: 0.75rem 1.1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    animation: finBulkBarIn 0.2s ease;
}
.fin-bulk-bar[hidden] {
    display: none !important;
}
.fin-bulk-bar__info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.fin-bulk-bar__total {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text);
}
@keyframes finBulkBarIn {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
body.has-fin-bulk-bar {
    padding-bottom: 4.5rem;
}

.pay-qr-group-list {
    margin: 0.5rem 0;
    border: 1px solid var(--border, #e2e6ea);
    border-radius: 0.6rem;
    overflow: hidden;
    text-align: left;
}
.pay-qr-group-item {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--border, #e2e6ea);
}
.pay-qr-group-item:last-child {
    border-bottom: none;
}
.pay-qr-group-total {
    display: flex;
    justify-content: space-between;
    font-weight: 800;
    font-size: 1.05rem;
    padding: 0 0.1rem;
}

.receipt-paper__row--item {
    align-items: flex-start;
}
.receipt-paper__row--item strong {
    flex-shrink: 0;
    white-space: nowrap;
}
.receipt-paper__item-label {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.receipt-paper__item-or {
    font-size: 0.65rem;
    color: #9a9a90;
}
.registrar-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 0;
    border-bottom: 2px solid #e5e7eb;
    background: #f8fafb;
    border-radius: 0.5rem;
    overflow: hidden;
}
.registrar-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1.1rem;
    border: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    border-bottom: 3px solid transparent;
    margin: 0;
    background: transparent;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}
.registrar-tab:first-child {
    border-left: none;
    border-radius: 0.5rem 0 0 0;
}
.registrar-tab:last-child {
    border-right: none;
    border-radius: 0 0.5rem 0 0;
}
.registrar-tab:hover {
    color: #374151;
    background: #f0f1f3;
    text-decoration: none;
    border-color: #d1d5db;
}
.registrar-tab.is-active {
    color: #0f6cbf;
    border-bottom-color: #0f6cbf;
    background: #ffffff;
    border-color: #d1d5db;
}
.registrar-tab i {
    font-size: 0.72rem;
    color: inherit;
}
.registrar-tab-badge {
    padding: 0.1rem 0.4rem;
    background: var(--warning);
    color: #fff;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.3;
}
@media (max-width: 640px) {
    .registrar-tab span {
        display: none;
    }
    .registrar-tab {
        padding: 0.85rem 0.9rem;
    }
    .registrar-tab i {
        font-size: 0.95rem;
    }
}
.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;
}
.student-subject-row--debug-gradable {
    cursor: pointer;
}
.student-subject-row--debug-gradable:hover {
    background: var(--accent-l, #eff6ff);
}
.student-subject-debug-icon {
    margin-left: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
}
.debug-grade-dialog {
    max-width: 32rem;
    width: min(32rem, calc(100vw - 2rem));
    max-height: 85vh;
}
.debug-grade-dialog .practice-password-form {
    max-height: 85vh;
    overflow-y: auto;
}
.debug-grade-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.6rem;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.8125rem;
    font-weight: 600;
}
.debug-grade-hint {
    margin: 0 0 0.85rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.debug-grade-locked-notice {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.85rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.6rem;
    background: #fee2e2;
    color: #991b1b;
    font-size: 0.8125rem;
    font-weight: 600;
}
.debug-grade-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.debug-grade-footer__danger,
.debug-grade-footer__main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.feature-setting__divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.1rem 0;
}
.debug-bulk-fill-toolbar {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1rem;
}
.debug-bulk-fill-toolbar span {
    flex: 1 1 auto;
}
.debug-bulk-fill-toolbar__actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.debug-bulk-fill-toolbar__term {
    width: auto;
    min-width: 8rem;
    height: 2rem;
    font-size: 0.8125rem;
}
.debug-grade-fields {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.debug-grade-period__title {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.debug-grade-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.debug-grade-row__label {
    font-size: 0.875rem;
    color: var(--text);
}
.debug-grade-row__input {
    max-width: 8rem;
}
@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-topic-field { margin-bottom: 0; }
.ai-topic-field__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
}
.ai-topic-field__head .ai-field__label { margin: 0; }
.ai-topic-refine-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid #ddd6fe;
    background: linear-gradient(180deg, #faf5ff, #f5f3ff);
    color: #6d28d9;
    border-radius: 999px;
    padding: 0.32rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.15s;
}
.ai-topic-refine-btn:hover:not(:disabled) {
    border-color: #a78bfa;
    background: #f5f3ff;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
.ai-topic-refine-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.ai-topic-refine-btn.is-active {
    border-color: #7c3aed;
    background: #7c3aed;
    color: #fff;
}
.ai-topic-field__input {
    min-height: 7.5rem;
    resize: vertical;
    line-height: 1.5;
}
.ai-topic-field__tip {
    display: flex;
    gap: 0.45rem;
    align-items: flex-start;
    margin: 0.55rem 0 0;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--ink-3, #64748b);
}
.ai-topic-field__tip i {
    color: #c026d3;
    margin-top: 0.12rem;
    flex-shrink: 0;
}
.ai-topic-field.is-planning .ai-topic-field__tip { display: none; }

.ai-topic-plan {
    margin-top: 0.9rem;
    border: 1px solid #ddd6fe;
    border-radius: 1rem;
    background:
        radial-gradient(120% 80% at 0% 0%, rgba(237, 233, 254, 0.85), transparent 55%),
        linear-gradient(180deg, #fcfbff, #f8fafc);
    box-shadow: 0 8px 24px rgba(91, 33, 182, 0.06);
    overflow: hidden;
    animation: aiTopicPlanIn 0.22s ease-out;
}
@keyframes aiTopicPlanIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.ai-topic-plan__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.95rem 1rem 0.75rem;
    border-bottom: 1px solid rgba(196, 181, 253, 0.45);
}
.ai-topic-plan__brand {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
}
.ai-topic-plan__badge {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #7c3aed;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 6px 14px rgba(124, 58, 237, 0.28);
}
.ai-topic-plan__brand strong {
    display: block;
    font-size: 0.92rem;
    color: #312e81;
    line-height: 1.2;
}
.ai-topic-plan__stage {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: #6d28d9;
    font-weight: 600;
}
.ai-topic-plan__close {
    width: 1.85rem;
    height: 1.85rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ai-topic-plan__close:hover {
    background: #fff;
    border-color: #e2e8f0;
    color: #0f172a;
}
.ai-topic-plan__loading {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin: 0.85rem 1rem 0;
    padding: 0.85rem 0.95rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid #e9d5ff;
}
.ai-topic-plan__loading[hidden] { display: none !important; }
.ai-topic-plan__loading-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.ai-topic-plan__loading strong {
    display: block;
    font-size: 0.86rem;
    color: #4c1d95;
}
.ai-topic-plan__loading-pct {
    font-size: 0.78rem;
    font-weight: 800;
    color: #6d28d9;
    font-variant-numeric: tabular-nums;
}
.ai-topic-plan__loading p {
    margin: 0.2rem 0 0;
    font-size: 0.78rem;
    color: #64748b;
}
.ai-topic-plan__progress {
    height: 0.55rem;
    border-radius: 999px;
    background: #ede9fe;
    overflow: hidden;
}
.ai-topic-plan__progress-bar {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    transition: width 0.35s ease;
}
.ai-topic-plan__spinner {
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0.15rem;
    border-radius: 50%;
    border: 2px solid #ddd6fe;
    border-top-color: #7c3aed;
    animation: aiTopicSpin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes aiTopicSpin {
    to { transform: rotate(360deg); }
}
.ai-topic-plan.is-loading .ai-topic-plan__actions {
    opacity: 0.35;
    pointer-events: none;
}
.ai-topic-plan__coach {
    margin: 0.85rem 1rem 0;
    padding: 0.75rem 0.9rem;
    border-radius: 0.7rem;
    background: #fff;
    border: 1px solid #e9d5ff;
    font-size: 0.86rem;
    line-height: 1.45;
    color: #334155;
}
.ai-topic-plan__coach[hidden] { display: none !important; }
.ai-topic-plan__history {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-height: 9.5rem;
    overflow: auto;
    margin: 0.75rem 1rem 0;
    padding-right: 0.15rem;
}
.ai-topic-plan__history[hidden] { display: none !important; }
.ai-topic-plan__turn {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.55rem;
    align-items: start;
    padding: 0.55rem 0.7rem;
    border-radius: 0.65rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e8f0;
}
.ai-topic-plan__turn.is-assistant {
    border-color: #ddd6fe;
    background: #faf5ff;
}
.ai-topic-plan__avatar {
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    flex-shrink: 0;
}
.ai-topic-plan__turn.is-assistant .ai-topic-plan__avatar {
    background: #7c3aed;
    color: #fff;
}
.ai-topic-plan__turn.is-user .ai-topic-plan__avatar {
    background: #e2e8f0;
    color: #334155;
}
.ai-topic-plan__turn-meta {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 0.15rem;
}
.ai-topic-plan__turn p {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.45;
    white-space: pre-wrap;
    color: #1e293b;
}
.ai-topic-plan__questions {
    padding: 0.75rem 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.ai-topic-plan__question {
    padding: 0.85rem 0.9rem;
    border-radius: 0.8rem;
    background: #fff;
    border: 1px solid #e2e8f0;
}
.ai-topic-plan__q-head {
    display: flex;
    gap: 0.55rem;
    align-items: flex-start;
    margin-bottom: 0.55rem;
}
.ai-topic-plan__q-num {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 999px;
    background: #ede9fe;
    color: #6d28d9;
    font-size: 0.72rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.05rem;
}
.ai-topic-plan__q-head label {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 650;
    color: #1e293b;
    line-height: 1.35;
}
.ai-topic-plan__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 0.55rem 1.95rem;
}
.ai-topic-plan__chip {
    border: 1px solid #ddd6fe;
    background: #faf5ff;
    color: #5b21b6;
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ai-topic-plan__chip:hover,
.ai-topic-plan__chip.is-selected {
    border-color: #7c3aed;
    background: #7c3aed;
    color: #fff;
}
.ai-topic-plan__comment-label {
    display: block;
    margin: 0 0 0.3rem 1.95rem;
    font-size: 0.74rem;
    font-weight: 650;
    color: #64748b;
}
.ai-topic-plan__comment-label span {
    font-weight: 500;
    color: #94a3b8;
}
.ai-topic-plan__question .form-control {
    margin-left: 1.95rem;
    width: calc(100% - 1.95rem);
    font-size: 0.84rem;
}
.ai-topic-plan__preview {
    margin: 0.85rem 1rem 0;
    border-radius: 0.8rem;
    border: 1px solid #bbf7d0;
    background: linear-gradient(180deg, #f0fdf4, #fff);
    overflow: hidden;
}
.ai-topic-plan__preview[hidden] { display: none !important; }
.ai-topic-plan__preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid #dcfce7;
    font-size: 0.78rem;
    font-weight: 700;
    color: #166534;
}
.ai-topic-plan__preview-tag {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #15803d;
    background: #dcfce7;
    border-radius: 999px;
    padding: 0.18rem 0.5rem;
}
.ai-topic-plan__preview-body {
    padding: 0.75rem 0.85rem;
    font-size: 0.84rem;
    line-height: 1.5;
    color: #14532d;
    white-space: pre-wrap;
    max-height: 11rem;
    overflow: auto;
}
.ai-topic-plan__status {
    margin: 0.65rem 1rem 0;
    font-size: 0.8rem;
    color: #64748b;
}
.ai-topic-plan__status.is-error { color: #b91c1c; }
.ai-topic-plan__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.85rem 1rem 1rem;
    margin-top: 0.75rem;
    border-top: 1px solid rgba(196, 181, 253, 0.4);
    background: rgba(255, 255, 255, 0.55);
}
.ai-topic-plan__skip {
    padding-left: 0;
    color: #64748b;
    text-decoration: none;
}
.ai-topic-plan__skip:hover { color: #334155; }
.ai-topic-plan__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-left: auto;
}
.ai-topic-plan.is-loading .ai-topic-plan__questions,
.ai-topic-plan.is-loading .ai-topic-plan__preview,
.ai-topic-plan.is-loading .ai-topic-plan__coach {
    opacity: 0.45;
    pointer-events: none;
}
.ai-topic-plan.is-ready {
    border-color: #86efac;
    background:
        radial-gradient(120% 80% at 0% 0%, rgba(220, 252, 231, 0.9), transparent 55%),
        linear-gradient(180deg, #f7fff9, #f8fafc);
}
@media (max-width: 640px) {
    .ai-topic-field__head { align-items: flex-start; flex-direction: column; }
    .ai-topic-plan__chips,
    .ai-topic-plan__question .form-control {
        margin-left: 0;
        width: 100%;
    }
}

.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);
    cursor: pointer;
}
.ai-upload-zone.is-dragover,
.ai-upload-zone:hover { border-color: #a78bfa; background: #faf5ff; }
.ai-upload-zone.has-file {
    padding: 0;
    border-style: solid;
    cursor: default;
}
.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-focus {
    margin-top: 1rem;
    margin-bottom: 0.85rem;
}
.ai-upload-focus .form-control {
    font-size: 0.88rem;
    line-height: 1.45;
}
.ai-upload-focus__hint {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.76rem;
    line-height: 1.4;
    color: var(--ink-3, #64748b);
}
.ai-upload-scan-hint {
    display: flex;
    gap: 0.45rem;
    align-items: flex-start;
    margin: 0.75rem 0 0;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--ink-3, #64748b);
}
.ai-upload-scan-hint i {
    margin-top: 0.12rem;
    flex-shrink: 0;
}
.ai-upload-focus-summary {
    margin-top: 0.85rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.8rem;
    border: 1px solid #dbe4ee;
    background: #f8fafc;
}
.ai-upload-focus-summary__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}
.ai-upload-focus-summary__head strong {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #334155;
}
.ai-upload-focus-summary p {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.45;
    color: #1e293b;
    white-space: pre-wrap;
}

.ai-doc-plan {
    margin-top: 0;
    padding: 1rem 1.05rem 1.1rem;
    border: 1px solid #d7e6f4;
    border-radius: 0.95rem;
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(15, 108, 191, 0.08), transparent 55%),
        linear-gradient(180deg, #fafdff 0%, #f3f8fd 100%);
}
section.is-doc-planning .ai-builder-card__body {
    padding-top: 0.55rem;
}
section.is-doc-planning .ai-source-panel[data-source-panel="upload"] {
    max-width: 28rem;
}
section.is-doc-planning .ai-source-cards,
section.is-doc-planning .ai-upload-zone,
section.is-doc-planning .ai-upload-scan-hint,
section.is-doc-planning .ai-source-panel__note,
section.is-doc-planning .ai-upload-focus-summary,
section.is-doc-planning > .ai-flow-actions,
.ai-source-cards[hidden],
.ai-upload-zone[hidden],
.ai-upload-scan-hint[hidden],
.ai-source-panel__note[hidden],
.ai-upload-focus-summary[hidden],
.ai-flow-actions[hidden] {
    display: none !important;
}
.ai-doc-plan__topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.ai-doc-plan__cancel {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid #b8cee3;
    background: #fff;
    color: #183b5b;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.45rem 0.75rem;
    border-radius: 0.55rem;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.ai-doc-plan__cancel i {
    font-size: 0.72rem;
    opacity: 0.85;
}
.ai-doc-plan__cancel:hover {
    border-color: var(--primary, #0f6cbf);
    color: var(--primary, #0f6cbf);
    background: #edf7ff;
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.1);
}
.ai-doc-plan__cancel:focus-visible {
    outline: none;
    border-color: var(--primary, #0f6cbf);
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.18);
}
.ai-doc-plan__file {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    max-width: 62%;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid #dbe7f2;
    background: rgba(255, 255, 255, 0.92);
    font-size: 0.75rem;
    font-weight: 650;
    color: #475569;
}
.ai-doc-plan__file i {
    flex-shrink: 0;
    color: var(--primary, #0f6cbf);
    font-size: 0.78rem;
}
.ai-doc-plan__file > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ai-doc-plan__ask {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}
.ai-doc-plan__coach {
    display: inline-flex;
    align-self: flex-start;
    margin: 0;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    background: rgba(15, 108, 191, 0.1);
    color: #0b5ea8;
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.3;
}
.ai-doc-plan__loading-top,
.ai-doc-plan__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.ai-doc-plan__loading-top strong {
    font-size: 0.95rem;
    color: #183b5b;
}
.ai-doc-plan__loading-top span,
#aiDocPlanLoadingPct {
    font-size: 0.78rem;
    font-weight: 700;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}
.ai-doc-plan__loading p {
    margin: 0.35rem 0 0.75rem;
    font-size: 0.86rem;
    line-height: 1.45;
    color: #475569;
}
.ai-doc-plan__coach[hidden] { display: none !important; }
.ai-doc-plan__progress {
    height: 0.45rem;
    border-radius: 999px;
    background: #e2ebf4;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}
.ai-doc-plan__progress-bar {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #1e3a5f, var(--primary, #0f6cbf));
    transition: width 0.3s ease;
}
.ai-doc-plan__question + .ai-doc-plan__question { margin-top: 1rem; }
.ai-doc-plan__prompt {
    margin: 0 0 0.85rem;
    font-size: 1.28rem;
    font-weight: 700;
    color: #183b5b;
    line-height: 1.28;
    letter-spacing: -0.022em;
}
.ai-doc-plan__choices {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.ai-doc-plan__choice {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    text-align: left;
    border: 1px solid #d5e3f0;
    background: #fff;
    border-radius: 0.75rem;
    padding: 0.78rem 0.9rem;
    font-size: 0.92rem;
    line-height: 1.35;
    color: #1e293b;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.ai-doc-plan__choice-mark {
    flex-shrink: 0;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 50%;
    border: 2px solid #b8c9db;
    background: #fff;
    box-shadow: inset 0 0 0 0 var(--primary, #0f6cbf);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.ai-doc-plan__choice-label {
    min-width: 0;
}
.ai-doc-plan__choice:hover {
    border-color: #8ab7de;
    background: #f7fbff;
    box-shadow: 0 4px 12px rgba(15, 108, 191, 0.08);
    transform: translateY(-1px);
}
.ai-doc-plan__choice:hover .ai-doc-plan__choice-mark {
    border-color: var(--primary, #0f6cbf);
}
.ai-doc-plan__choice.is-selected {
    border-color: #1e3a5f;
    background: linear-gradient(135deg, #1e3a5f 0%, #254a73 100%);
    color: #fff;
    font-weight: 650;
    box-shadow: 0 6px 16px rgba(30, 58, 95, 0.22);
}
.ai-doc-plan__choice.is-selected .ai-doc-plan__choice-mark {
    border-color: #fff;
    background: #fff;
    box-shadow: inset 0 0 0 0.28rem #1e3a5f;
}
.ai-doc-plan__custom-wrap {
    margin-top: 0.55rem;
    padding-top: 0.7rem;
    border-top: 1px dashed #d5e3f0;
}
.ai-doc-plan__custom-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
    font-weight: 650;
    color: #64748b;
}
.ai-doc-plan__custom {
    font-size: 0.9rem;
    border-radius: 0.7rem;
    border-color: #d5e3f0;
    background: #fff;
    padding: 0.72rem 0.9rem;
}
.ai-doc-plan__custom:focus {
    border-color: var(--primary, #0f6cbf);
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.14);
}
.ai-doc-plan__status {
    margin: 0;
    font-size: 0.8rem;
    color: #64748b;
}
.ai-doc-plan__status.is-error { color: #b91c1c; }
.ai-doc-plan__footer {
    margin-top: 0.2rem;
    padding-top: 0.9rem;
    border-top: 1px solid #dbe7f2;
}
.ai-doc-plan__footer .btn-link,
.ai-doc-plan__skip {
    padding: 0.35rem 0.15rem;
    color: #334155;
    font-size: 0.84rem;
    font-weight: 650;
    text-decoration: none;
}
.ai-doc-plan__footer .btn-link:hover,
.ai-doc-plan__skip:hover {
    color: var(--primary, #0f6cbf);
    text-decoration: underline;
}
.ai-doc-plan__ready-label {
    margin: 0 0 0.4rem;
    display: inline-flex;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    background: rgba(15, 108, 191, 0.1);
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #0b5ea8;
}
.ai-doc-plan__ready-body {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
    color: #0f172a;
    white-space: pre-wrap;
}
section.is-doc-planning .ai-builder-card__head p {
    display: none;
}
.ai-upload-file {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
}
.ai-upload-file i { font-size: 1.5rem; color: #475569; }
.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; }
.academic-k12-fieldset { border: none; padding: 0; margin: 0; }
.college-track-note { margin: -0.25rem 0 1rem; font-size: 0.85rem; }
.college-track-note[hidden] { display: none; }
.college-picker-hint { margin: 0 0 0.85rem; font-size: 0.85rem; display: flex; align-items: center; gap: 0.4rem; }
.college-picker-hint[hidden] { display: none; }
.transferee-fields { display: none; margin-top: 1rem; }
.transferee-fields.is-visible { display: block; }

.academic-grade-level-collapse {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.35s ease, opacity 0.25s ease;
}
.academic-grade-level-collapse.is-visible {
    grid-template-rows: 1fr;
    opacity: 1;
}
.academic-grade-level-collapse__inner {
    overflow: hidden;
    min-height: 0;
}
.required { color: var(--danger); }

.academic-section .academic-field {
    margin-bottom: 1.25rem;
}
.academic-field__label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-bottom: 0.7rem;
}
.academic-field__label > span {
    font-weight: 600;
    color: var(--ink-2);
    font-size: 0.875rem;
}
.academic-field__label small {
    color: var(--text-muted);
    font-size: 0.75rem;
}
.academic-level-picker {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.academic-level-picker[data-new-enrollee-picker],
.academic-level-picker[data-transferee-picker] {
    display: none;
}
.academic-level-picker[data-new-enrollee-picker].is-active,
.academic-level-picker[data-transferee-picker].is-active {
    display: flex;
}
.academic-level-picker--simple .academic-level-grid {
    padding: 0;
}
.academic-program-block {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #fafbfc;
    overflow: hidden;
}
.academic-program-block__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}
.academic-program-block__head i {
    color: var(--primary);
    font-size: 0.85rem;
}
.academic-program-block__head strong {
    font-size: 0.8125rem;
    color: var(--ink-2);
}
.academic-program-block__head span {
    margin-left: auto;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.academic-level-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0.75rem;
}
.academic-level-chip {
    position: relative;
    display: inline-flex;
    cursor: pointer;
    margin: 0;
}
.academic-level-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.academic-level-chip__text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.15rem;
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-2);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.academic-level-chip:hover .academic-level-chip__text {
    border-color: #c5daf0;
    background: var(--primary-light);
    color: var(--primary-dark);
}
.academic-level-chip.is-selected .academic-level-chip__text,
.academic-level-chip input:checked + .academic-level-chip__text {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(15, 108, 191, 0.3);
}
.academic-level-chip input:focus-visible + .academic-level-chip__text {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.academic-choice {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}
.academic-choice__option {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    margin: 0;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.academic-choice__option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.academic-choice__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 0.65rem;
    background: var(--primary-light);
    color: var(--primary);
    flex-shrink: 0;
}
.academic-choice__copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.academic-choice__copy strong {
    font-size: 0.875rem;
    color: var(--ink-2);
}
.academic-choice__copy small {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.academic-choice__option:hover {
    border-color: #c5daf0;
    background: #f8fbff;
}
.academic-choice__option.is-selected,
.academic-choice__option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 1px rgba(15, 108, 191, 0.12);
}
.academic-choice__option.is-selected .academic-choice__icon,
.academic-choice__option:has(input:checked) .academic-choice__icon {
    background: var(--primary);
    color: #fff;
}
.academic-choice__option input:focus-visible ~ .academic-choice__icon {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.transferee-panel {
    padding: 1rem;
    border: 1px solid #d7e6f5;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, #f7fbff 0%, #fff 100%);
}
.transferee-panel__head {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-bottom: 0.9rem;
}
.transferee-panel__head > i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    background: var(--primary-light);
    color: var(--primary);
    flex-shrink: 0;
}
.transferee-panel__head strong {
    display: block;
    font-size: 0.875rem;
    color: var(--ink-2);
}
.transferee-panel__head p {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}
@media (max-width: 720px) {
    .academic-choice {
        grid-template-columns: 1fr;
    }
}

/* Student curriculum progress on profile */
.student-curriculum-panel { margin-top: 1.25rem; }
.student-curriculum-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.student-curriculum-panel__head h3 { margin: 0; }
.student-curriculum-program-switch__buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}
.student-curriculum-program-switch__button {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    cursor: pointer;
    transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.student-curriculum-program-switch__button:hover,
.student-curriculum-program-switch__button:focus-visible,
.student-curriculum-program-switch__button.is-active {
    border-color: var(--primary);
    color: var(--primary);
}
.student-curriculum-program-switch__button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(15,108,191,.15);
}
.student-curriculum-program-switch__button.is-active {
    background: var(--primary-light);
    font-weight: 600;
}
.student-curriculum-program-switch__button span {
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 400;
}
.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--failed { color: var(--danger); }
.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); }
.student-subject-row--failed { background: rgba(202, 49, 32, 0.05); }

/* Gradebook passed column */
.gb-table__pass-col {
    min-width: 6.5rem;
    width: 6.5rem;
    max-width: none;
    text-align: center;
    white-space: nowrap;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    word-break: normal;
    overflow-wrap: normal;
    vertical-align: middle;
}
.gb-table thead th.gb-table__pass-col {
    white-space: nowrap;
    letter-spacing: 0.02em;
}
.gb-pass-toggle {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    writing-mode: horizontal-tb;
    max-width: none;
}
.gb-pass-toggle > span {
    display: inline;
    white-space: nowrap;
    writing-mode: horizontal-tb;
}
.gb-pass-toggle.is-disabled { opacity: 0.45; cursor: not-allowed; }
.gb-pass-toggle input { margin: 0; flex-shrink: 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); }

/* A wizard nested inside a card (e.g. the New Charge card) shouldn't re-box its panels */
.new-charge-card .charge-wizard .panel {
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
}
.new-charge-card .charge-wizard .wizard-nav {
    margin-bottom: 1.25rem;
}
.new-charge-card .charge-wizard .panel-title {
    font-size: 1rem;
}

/* 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: 0.95rem 2.5rem 0.95rem 0.95rem;
    }
    .content-builder-format__icon {
        flex-shrink: 0;
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.05rem;
    }
    .content-builder-format__copy small {
        font-size: 0.78rem;
        line-height: 1.35;
    }
}

.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,
.content-builder-preview-media__frame img[data-preview-image] {
    display: block;
    width: 100%;
    height: min(62vh, 560px);
    border: 0;
    background: #fff;
}

.content-builder-preview-media__frame img[data-preview-image] {
    height: auto;
    max-height: min(62vh, 560px);
    object-fit: contain;
    background: #0f172a;
}

.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 {
        padding-bottom: 5.5rem;
    }

    .content-builder__hero {
        margin-bottom: 1rem;
        padding: 0.85rem 0.95rem 1rem;
    }

    .content-builder__hero-top {
        flex-wrap: wrap;
        gap: 0.65rem;
    }

    .content-builder__hero-meta {
        width: 100%;
        flex-wrap: wrap;
    }

    .content-builder__hero-row {
        align-items: flex-start;
        gap: 0.75rem;
        margin-top: 0.7rem;
    }

    .content-builder__hero-icon {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
        border-radius: 14px;
    }

    .content-builder__hero h1 {
        font-size: 1.25rem;
        line-height: 1.25;
    }

    .content-builder__steps {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        gap: 0;
        padding: 0.65rem 0.35rem;
        scroll-snap-type: x proximity;
    }

    .content-builder__steps,
    .content-builder__steps--four,
    .content-builder__steps--seven {
        grid-template-columns: none;
    }

    .content-builder__steps > a,
    .content-builder__steps > button,
    .content-builder__steps > span {
        flex: 0 0 auto;
        min-width: 4.75rem;
        max-width: 6.5rem;
        flex-direction: column;
        gap: .35rem;
        text-align: center;
        scroll-snap-align: start;
    }

    .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;
    }

    .content-builder__step-copy strong {
        font-size: 0.72rem;
        line-height: 1.25;
    }

    .content-builder__type-step,
    .content-builder__panel {
        padding: 0.95rem 0.9rem 1.1rem;
    }

    .content-builder__panel-head,
    .content-builder__step-heading {
        gap: 0.75rem;
    }

    .content-builder__step-heading > span,
    .content-builder__panel-num {
        min-width: 36px;
        height: 36px;
        padding: 0 0.55rem;
        border-radius: 10px;
        font-size: 0.72rem;
    }

    .content-builder__step-heading h2,
    .content-builder__panel-head h2 {
        font-size: 1.05rem;
        line-height: 1.3;
    }

    .content-builder__panel-head p,
    .content-builder__step-heading p {
        font-size: 0.84rem;
    }

    .content-builder__format-intro {
        margin-bottom: 0.85rem;
        font-size: 0.84rem;
    }

    .content-builder__format-grid {
        gap: 0.65rem;
        margin-bottom: 1rem;
    }

    .content-builder-format {
        min-height: 3.25rem;
        gap: 0.7rem;
        padding: 0.85rem 2.35rem 0.85rem 0.85rem;
        border-radius: 0.85rem;
    }

    .content-builder-format__check {
        top: 0.65rem;
        right: 0.65rem;
        width: 1.25rem;
        height: 1.25rem;
    }

    .content-builder-format__icon {
        width: 2.35rem;
        height: 2.35rem;
        border-radius: 0.7rem;
        font-size: 1rem;
    }

    .content-builder-format__copy strong {
        font-size: 0.92rem;
    }

    .content-builder-format__copy small {
        margin-top: 0.15rem;
        font-size: 0.75rem;
    }

    .content-builder__format-panel {
        padding: 0.9rem 0.85rem 1rem;
        border-radius: 0.85rem;
    }

    .content-builder__format-panel-head {
        margin-bottom: 0.7rem;
    }

    .content-builder__format-panel-head h3 {
        font-size: 0.9rem;
    }

    .content-builder__format-panel-head p {
        font-size: 0.78rem;
    }

    .content-builder-dropzone {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 0.7rem;
        min-height: 0;
        margin: 0.75rem 0;
        padding: 1.15rem 1rem;
        text-align: center;
    }

    .content-builder-dropzone__icon {
        width: 3rem;
        height: 3rem;
    }

    .content-builder-dropzone__copy {
        align-items: center;
        width: 100%;
    }

    .content-builder-dropzone__status {
        margin-inline: auto;
    }

    .content-builder-dropzone__copy strong {
        font-size: 0.92rem;
    }

    .content-builder-dropzone small,
    .content-builder-dropzone em {
        font-size: 0.78rem;
    }

    .content-builder-access-card {
        padding: 0.95rem 0.9rem 1.05rem;
        border-radius: 14px;
    }

    .content-builder-access-card__head {
        gap: 0.7rem;
        margin-bottom: 0.85rem;
    }

    .content-builder-review {
        flex-direction: column;
        gap: 0.85rem;
        padding: 1rem 0.95rem;
    }

    .content-builder-review dl {
        gap: 0.75rem;
    }

    .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;
        gap: 0.75rem;
        padding: 0.95rem;
    }

    .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__preview {
        margin-top: 1rem;
        padding: 0.85rem;
    }

    .content-builder-preview-media__frame iframe,
    .content-builder-preview-media__frame img[data-preview-image] {
        height: min(48vh, 360px);
    }

    .content-builder-preview-media__frame img[data-preview-image] {
        max-height: min(48vh, 360px);
    }

    .content-builder__panel-actions {
        position: sticky;
        bottom: 0;
        z-index: 5;
        gap: 0.55rem;
        margin-inline: -0.9rem;
        margin-bottom: -1.1rem;
        padding: 0.75rem 0.9rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
        background: color-mix(in srgb, var(--surface-color) 92%, transparent);
        backdrop-filter: blur(8px);
        border-top: 1px solid var(--border-color);
    }

    .content-builder__panel-actions .btn {
        min-height: 2.65rem;
        padding-inline: 0.9rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .content-builder__hero-meta > span {
        padding: 0.28rem 0.5rem;
        font-size: 0.65rem;
    }

    .content-builder__back {
        padding: 0.45rem 0.6rem;
        font-size: 0.74rem;
    }

    .content-builder__steps > a,
    .content-builder__steps > button,
    .content-builder__steps > span {
        min-width: 4.25rem;
        max-width: 5.5rem;
        padding-inline: 0.2rem;
    }

    .content-builder-format {
        align-items: flex-start;
        padding: 0.8rem 2.2rem 0.8rem 0.75rem;
    }

    .content-builder-dropzone {
        padding: 1rem 0.85rem;
    }

    .content-builder__panel-actions {
        flex-wrap: wrap;
    }

    .content-builder__panel-actions .btn {
        flex: 1 1 calc(50% - 0.3rem);
    }

    .content-builder__panel-actions .btn-primary {
        order: -1;
        flex: 1 1 100%;
    }
}


/* Academic year viewing banner (school admin) */
.academic-year-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.85rem 1.1rem;
    margin: 0 0 1.15rem;
    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);
}
.academic-year-banner__icon {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 50%;
    background: #fff3cd;
    color: var(--warning);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.academic-year-banner__text {
    flex: 1;
    min-width: 12rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.academic-year-banner__text strong {
    font-size: 0.9375rem;
    color: var(--text);
}
.academic-year-banner__text span {
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.academic-year-banner__action {
    margin: 0;
}
.school-course-section {
    padding: 1rem 0;
    border-top: 1px solid rgba(0,0,0,0.06);
}
.school-course-section:first-of-type {
    border-top: 0;
}
.school-course-activity-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.school-course-activity-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.55rem 0.75rem;
    background: #f8fafc;
    border-radius: var(--radius);
}
.school-course-activity-list li i {
    color: var(--primary);
}

/* ========================================================
   SCROLL UTILITIES & LAYOUT ENHANCEMENTS
   Cross-browser consistent scrolling, scrollbar styling,
   and responsive layout helpers aligned with the design system.
   ======================================================== */

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
    width: var(--scrollbar-w);
    height: var(--scrollbar-h);
}

*::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: var(--scroll-radius);
}

*::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--scroll-radius);
    border: 2px solid var(--scrollbar-track);
    background-clip: padding-box;
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    border-color: var(--scrollbar-track);
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:active {
    background: var(--scrollbar-thumb-active);
    border-color: var(--scrollbar-track);
    background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
    background: var(--scrollbar-track);
}

select, input, textarea {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.scroll-container {
    position: relative;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-mask-image: linear-gradient(to bottom, #000 96%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 96%, transparent 100%);
}

.scroll-container-y {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
}

.scroll-container-x {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-gutter: stable;
    white-space: nowrap;
}

.scroll-container-both {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.scroll-container--no-mask {
    -webkit-mask-image: none;
    mask-image: none;
}

.scroll-hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scroll-hide-scrollbar::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.scroll-snap-x {
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 1rem;
}
.scroll-snap-x > * {
    scroll-snap-align: start;
}

.scroll-snap-y {
    scroll-snap-type: y proximity;
    scroll-padding-block: var(--scroll-smooth-offset);
}
.scroll-snap-y > * {
    scroll-snap-align: start;
}

.scroll-fade-x {
    --fade-w: 2rem;
    mask-image: linear-gradient(
        to right,
        transparent 0,
        #000 var(--fade-w),
        #000 calc(100% - var(--fade-w)),
        transparent 100%
    );
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0,
        #000 var(--fade-w),
        #000 calc(100% - var(--fade-w)),
        transparent 100%
    );
}

.scroll-fade-y {
    --fade-h: 1.5rem;
    mask-image: linear-gradient(
        to bottom,
        transparent 0,
        #000 var(--fade-h),
        #000 calc(100% - var(--fade-h)),
        transparent 100%
    );
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0,
        #000 var(--fade-h),
        #000 calc(100% - var(--fade-h)),
        transparent 100%
    );
}

.layout-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.layout-stack--tight { gap: 0.5rem; }
.layout-stack--loose { gap: 1.75rem; }

.layout-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.layout-grid {
    display: grid;
    gap: 1rem;
}
.layout-grid--cols-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.layout-grid--cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.layout-grid--cols-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.layout-sidebar {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 768px) {
    .layout-sidebar { grid-template-columns: minmax(260px, 0.35fr) minmax(0, 1fr); }
    .layout-sidebar--wide { grid-template-columns: minmax(300px, 0.4fr) minmax(0, 1fr); }
}

.layout-center {
    box-sizing: content-box;
    margin-inline: auto;
    max-inline-size: var(--measure, 68ch);
    padding-inline: 1rem;
}

.content-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    overflow: hidden;
}
@media (max-width: 480px) {
    .content-card { padding: 0.9rem; border-radius: var(--radius); }
}

.content-card__scroll {
    margin: 0 -1.25rem;
    padding: 0 1.25rem;
    max-height: min(62vh, 560px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
@media (max-width: 480px) {
    .content-card__scroll { margin: 0 -0.9rem; padding: 0 0.9rem; }
}

.pad-responsive {
    padding: clamp(0.75rem, 2vw, 1.5rem);
}

.eyebrow {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.hierarchy-title {
    font-size: clamp(1.25rem, 2.2vw, 1.625rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text);
}

.hierarchy-subtitle {
    font-size: 0.9375rem;
    color: var(--text-muted);
    line-height: 1.5;
}

[id] {
    scroll-margin-top: var(--scroll-smooth-offset);
}

.sticky-thead thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-2, #f8fafc);
    box-shadow: 0 1px 0 var(--border);
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        scroll-behavior: auto !important;
    }
    .scroll-container, .scroll-container-y,
    .scroll-container-x, .scroll-container-both {
        scroll-behavior: auto;
    }
}

/* Online payment methods (pay-online flow + pending status) */
.fin-row__status--pending {
    color: #0f6cbf;
}
.fin-status-dot--pending {
    background: #0f6cbf;
}
.fin-row__declined {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.76rem;
    color: #b91c1c;
}
.fin-row__declined i {
    margin-right: 0.2rem;
}
.fin-row__action--multi {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-shrink: 0;
}
.fin-bulk-bar__actions {
    display: flex;
    gap: 0.6rem;
    flex-shrink: 0;
}
@media (max-width: 640px) {
    .fin-bulk-bar {
        flex-wrap: wrap;
    }
    .fin-bulk-bar__actions {
        width: 100%;
    }
    .fin-bulk-bar__actions .btn {
        flex: 1 1 auto;
    }
}

.pay-online-modal__panel {
    max-width: 24rem;
}
.pay-online-channel-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
    gap: 0.6rem;
    margin: 0.75rem 0 0.25rem;
}
.pay-online-channel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.85rem 0.5rem;
    background: var(--surface-2, #f8fafc);
    border: 1px solid var(--border, #e2e6ea);
    border-radius: 0.75rem;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.pay-online-channel:hover {
    border-color: var(--primary, #0f6cbf);
    background: rgba(15, 108, 191, 0.06);
}
.pay-online-channel__logo {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: contain;
    border-radius: 0.5rem;
}
.pay-online-channel__logo--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e6ea);
    color: var(--text-muted);
    font-size: 1.1rem;
}
.pay-online-channel__name {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--text);
}
.pay-online-channel__tag {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.pay-online-account {
    background: var(--surface-2, #f8fafc);
    border: 1px solid var(--border, #e2e6ea);
    border-radius: 0.75rem;
    padding: 0.9rem 1rem;
    margin: 0.5rem 0 0.85rem;
    text-align: left;
}
.pay-online-account__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.pay-online-account__provider {
    font-weight: 800;
    font-size: 0.95rem;
}
.pay-online-account__tag {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e2e6ea);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
}
.pay-online-account__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.82rem;
    padding: 0.3rem 0;
}
.pay-online-account__row strong {
    margin-left: auto;
}
.pay-online-copy-btn {
    border: none;
    background: transparent;
    color: var(--primary, #0f6cbf);
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    font-size: 0.85rem;
}
.pay-online-copy-btn.is-copied {
    color: #22a35a;
}
.pay-online-account__instructions {
    margin: 0.4rem 0 0;
    font-size: 0.78rem;
}
.pay-online-amount {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.9rem;
}
.pay-online-amount strong {
    font-size: 1.1rem;
    color: var(--text);
}
.pay-online-submitted-text {
    text-align: center;
}
.online-payment-row {
    align-items: flex-start;
}
.online-payment-thumb {
    display: block;
    flex-shrink: 0;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--border, #e2e6ea);
    padding: 0;
    background: none;
    cursor: pointer;
}
.online-payment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.online-payment-thumbs {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}
.online-payment-thumb {
    position: relative;
}
.online-payment-thumb__more {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
}

/* ============================================================
   Billing - Fee Items workspace (compact/modern)
   ============================================================ */
.fee-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}
@media (max-width: 900px) {
    .fee-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .fee-stat-grid { grid-template-columns: 1fr; }
}
.fee-stat-grid .fin-stat-tile {
    padding: 0.65rem 0.8rem;
    gap: 0.6rem;
}
.fee-stat-grid .fin-stat-tile__icon {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 0.5rem;
    font-size: 0.82rem;
}
.fee-stat-grid .fin-stat-tile__label {
    font-size: 0.62rem;
}
.fee-stat-grid .fin-stat-tile__value {
    font-size: 0.98rem;
}
.fee-stat-grid .fin-stat-tile__sub {
    font-size: 0.68rem;
}

.fee-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 17rem;
    gap: 0.75rem;
    align-items: start;
}
@media (max-width: 1024px) {
    .fee-workspace { grid-template-columns: 1fr; }
}
.fee-workspace__main { min-width: 0; }
.fee-workspace__side {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

/* -- Category filter chips (replaces the old category <select> toolbar) --
   All categories stay visible with their color + count, so filtering is one click and the
   catalog's shape is readable at a glance. */
.fee-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.fee-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.fee-chip:hover {
    border-color: var(--accent-l2, var(--primary));
    color: var(--text);
}
.fee-chip.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.fee-chip:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.fee-chip__dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    flex: none;
}
.fee-chip__dot--none { background: #94a3b8; }
.fee-chip.is-active .fee-chip__dot { background: rgba(255, 255, 255, 0.85); }
.fee-chip__count {
    font-variant-numeric: tabular-nums;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.05rem 0.35rem;
    border-radius: 999px;
    background: var(--surface-2, #f1f5f9);
    color: var(--text-muted);
}
.fee-chip.is-active .fee-chip__count {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

/* -- Fee catalog table -- */
.fee-table { width: 100%; table-layout: auto; }
.fee-table .col-cat { width: 1%; white-space: nowrap; }
.fee-table .col-fee {
    width: 1%;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.fee-table .col-status { width: 1%; white-space: nowrap; }
.fee-table th.col-actions,
.fee-table td.actions { width: 1%; white-space: nowrap; }
.fee-table .col-name {
    width: auto;
    min-width: 10rem;
    overflow-wrap: break-word;
}
.fee-table tbody tr.is-inactive td { opacity: 0.55; }
.fee-table tbody tr[hidden] { display: none; }
.fee-table td.col-name strong {
    display: block;
    font-size: 0.8125rem;
}
.fee-table td.col-name small {
    display: block;
    margin-top: 0.05rem;
    font-size: 0.7rem;
}
/* Roomier rows + a category-colored left accent, so scanning down the catalog groups
   visually by category without needing to read every pill. */
.fee-table tbody td { padding-top: 0.6rem; padding-bottom: 0.6rem; }
.fee-table tbody tr { transition: background-color 0.12s; }
.fee-table tbody tr:hover { background-color: var(--surface-2, rgba(15, 23, 42, 0.025)); }
/* Accent lives on the first cell, not the row: tables here are border-collapse: collapse,
   where box-shadow on <tr> is not painted by most browsers. */
.fee-table tbody tr td:first-child {
    border-left: 0.1875rem solid var(--fee-row-accent, transparent);
    padding-left: 0.85rem;
}
/* Keep the header aligned with the accented body cells. */
.fee-table thead th:first-child {
    border-left: 0.1875rem solid transparent;
    padding-left: 0.85rem;
}
.fee-row--c0 { --fee-row-accent: #0f6cbf; }
.fee-row--c1 { --fee-row-accent: #15803d; }
.fee-row--c2 { --fee-row-accent: #7c3aed; }
.fee-row--c3 { --fee-row-accent: #b45309; }
.fee-row--c4 { --fee-row-accent: #0f766e; }
.fee-row--c5 { --fee-row-accent: #be185d; }
.fee-row--cnone { --fee-row-accent: #cbd5e1; }
/* Row actions stay reachable but recede until the row is hovered/focused. */
.fee-table .table-row-actions { opacity: 0.45; transition: opacity 0.12s; }
.fee-table tbody tr:hover .table-row-actions,
.fee-table .table-row-actions:focus-within { opacity: 1; }

/* -- Status indicator (lighter than a full badge) -- */
.fee-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}
.fee-status__dot {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    flex: none;
}
.fee-status--on { color: #15803d; }
.fee-status--on .fee-status__dot { background: #15803d; }
.fee-status--off { color: var(--text-muted); }
.fee-status--off .fee-status__dot { background: #94a3b8; }

/* -- Financial ledger table -- */
.ledger-table { width: 100%; table-layout: auto; }
.ledger-table .col-name {
    width: auto;
    min-width: 10rem;
    overflow-wrap: break-word;
}
/* Student name column stays visible while scrolling across the fee-item matrix. */
.ledger-table td.col-name,
.ledger-table th.col-name {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--surface, #fff);
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.05);
}
.ledger-table thead th.col-name { z-index: 3; background: #f8fafc; }
.ledger-total-row td.col-name { background: #0f172a !important; }
.ledger-table .col-item-amt,
.ledger-table .col-amount {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.ledger-table th.col-item-amt,
.ledger-table th.col-amount { text-align: right; }
.ledger-table .col-item-amt {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.8125rem;
}
.ledger-th-items {
    text-align: center;
    background: #f8fafc;
}
.ledger-table td.col-name small {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.7rem;
}
.ledger-balance--due { color: #b91c1c; font-weight: 700; }
.ledger-balance--clear { color: #15803d; font-weight: 700; }

/* Zebra striping + category color bands */
.ledger-table tbody tr:nth-child(even) td:not([class*="fee-cat-"]):not(.col-amount--payable):not(.col-amount--collected) {
    background: #f8fafc;
}
.ledger-table td.fee-cat-pill--none,
.ledger-table th.fee-cat-pill--none {
    background: #eef0f3;
    color: #64748b;
}
.ledger-table .col-amount--payable { background: #eef2ff; }
.ledger-table th.col-amount--payable { background: #e0e7ff; color: #4338ca; }
.ledger-table .col-amount--collected { background: #ecfdf5; }
.ledger-table th.col-amount--collected { background: #d1fae5; color: #047857; }

/* Total row */
.ledger-total-row {
    background: #0f172a !important;
}
.ledger-total-row td {
    background: #0f172a !important;
    color: #f8fafc !important;
    font-weight: 700;
    border-top: 2px solid #1e293b;
}
.ledger-total-row .ledger-balance--due { color: #fca5a5 !important; }
.ledger-total-row .ledger-balance--clear { color: #86efac !important; }

.fee-no-results {
    margin: 0;
    padding: 2rem 1rem 2.25rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}
.fee-no-results[hidden] { display: none; }
.fee-no-results i {
    font-size: 1.35rem;
    color: var(--border);
}
.fee-no-results p { margin: 0; }

/* -- Category color palette --
   Six distinct hues so categories are recognizable by color, not just by name text.
   Applied consistently to table pills (.fee-cat-pill) and sidebar dots (.fee-cat-item__dot). */
.fee-cat-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.16rem 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.4;
}
.fee-cat-pill--none {
    background: #eef0f3;
    color: #64748b;
}
.fee-cat-color-0 { background: #e7f0fa; color: #0f6cbf; } /* blue     */
.fee-cat-color-1 { background: #e3f5ea; color: #15803d; } /* green    */
.fee-cat-color-2 { background: #f2e9fd; color: #7c3aed; } /* purple   */
.fee-cat-color-3 { background: #fdf1dd; color: #b45309; } /* amber    */
.fee-cat-color-4 { background: #e3f7f7; color: #0f766e; } /* teal     */
.fee-cat-color-5 { background: #fde4ef; color: #be185d; } /* rose     */

/* Solid fills for small dots — the .fee-cat-color-N rules above are the light pill tint,
   which is too washed out at dot size. */
.fee-cat-item__dot.fee-cat-color-0,
.fee-chip__dot.fee-cat-color-0,
.ledger-legend__dot.fee-cat-color-0 { background: #0f6cbf; }
.fee-cat-item__dot.fee-cat-color-1,
.fee-chip__dot.fee-cat-color-1,
.ledger-legend__dot.fee-cat-color-1 { background: #15803d; }
.fee-cat-item__dot.fee-cat-color-2,
.fee-chip__dot.fee-cat-color-2,
.ledger-legend__dot.fee-cat-color-2 { background: #7c3aed; }
.fee-cat-item__dot.fee-cat-color-3,
.fee-chip__dot.fee-cat-color-3,
.ledger-legend__dot.fee-cat-color-3 { background: #b45309; }
.fee-cat-item__dot.fee-cat-color-4,
.fee-chip__dot.fee-cat-color-4,
.ledger-legend__dot.fee-cat-color-4 { background: #0f766e; }
.fee-cat-item__dot.fee-cat-color-5,
.fee-chip__dot.fee-cat-color-5,
.ledger-legend__dot.fee-cat-color-5 { background: #be185d; }
/* Ledger legend: explains the fee-item matrix's paid/partial/unpaid text colors and the
   category color bands, above the table. */
.ledger-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    margin-top: 0.6rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.ledger-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.ledger-legend__swatch {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 0.2rem;
    background: var(--surface-2, #f1f5f9);
    border: 1px solid var(--border);
}
.ledger-legend__swatch.ledger-item--unpaid { background: #fef2f2; border-color: #fecaca; }
.ledger-legend__swatch.ledger-item--partial { background: #fefce8; border-color: #fde68a; }
.ledger-legend__swatch.ledger-item--paid { background: #f8fafc; border-color: var(--border); }
.ledger-legend__dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    flex: none;
}

/* Ledger cell payment status — wins over the .fee-cat-color-N background tint's text color
   (three-class selector outranks the single-class category rule) so a cell always reads
   red/yellow/black for unpaid/partial/paid regardless of which fee-category color it has. */
.ledger-table td.col-item-amt.ledger-item--unpaid { color: #b91c1c; font-weight: 700; }
.ledger-table td.col-item-amt.ledger-item--partial { color: #ca8a04; font-weight: 700; }
.ledger-table td.col-item-amt.ledger-item--paid { color: #111827; }

/* -- Sidebar cards -- */
.fee-side-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.8rem;
}
.fee-side-card__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}
.fee-side-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    flex: none;
    border-radius: 0.5rem;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.75rem;
}
.fee-side-card__head h2 {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 700;
}
.fee-side-card__head p {
    margin: 0.1rem 0 0;
    font-size: 0.7rem;
    line-height: 1.3;
    color: var(--text-muted);
}
.fee-side-card .btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

/* -- Category manager list -- */
.fee-cat-list {
    list-style: none;
    margin: 0 0 0.6rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.fee-cat-item {
    border: 1px solid var(--border);
    border-radius: 0.45rem;
    background: var(--surface-2);
    transition: border-color 0.15s;
}
.fee-cat-item:hover { border-color: var(--accent-l2); }
.fee-cat-item.is-disabled { opacity: 0.6; }
.fee-cat-item__view {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.45rem;
}
.fee-cat-item__view[hidden] { display: none; }
.fee-cat-item__dot {
    width: 0.5rem;
    height: 0.5rem;
    flex: none;
    border-radius: 999px;
}
.fee-cat-item.is-disabled .fee-cat-item__dot { background: var(--text-muted) !important; }
.fee-cat-item__text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}
.fee-cat-item__text strong {
    font-size: 0.775rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fee-cat-item__text small {
    font-size: 0.66rem;
    color: var(--text-muted);
}
.fee-cat-item__actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex: none;
}
.fee-cat-item__actions .table-action-btn {
    width: 1.4rem;
    height: 1.4rem;
    font-size: 0.68rem;
}
.fee-cat-item__edit {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.45rem;
}
.fee-cat-item__edit[hidden] { display: none; }
.fee-cat-item__edit--party {
    flex-wrap: wrap;
}
.fee-cat-item__edit--party .form-control {
    flex: 1 1 100%;
}
.fee-cat-item__edit--party .table-action-btn {
    flex: 0 0 auto;
}
.fee-cat-item__edit .form-control {
    height: 1.7rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.775rem;
    min-width: 0;
    flex: 1 1 auto;
}
.fee-cat-item__edit .table-action-btn {
    width: 1.4rem;
    height: 1.4rem;
    font-size: 0.68rem;
}
.table-action-btn--primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.table-action-btn--primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}
.fee-cat-add {
    display: flex;
    gap: 0.3rem;
}
.fee-cat-add .form-control {
    height: 1.85rem;
    padding: 0.25rem 0.55rem;
    font-size: 0.775rem;
    min-width: 0;
    flex: 1 1 auto;
}
.fee-cat-add .btn {
    flex: none;
    white-space: nowrap;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
}
.fee-cat-add--wrap {
    flex-wrap: wrap;
}
.fee-cat-add--wrap input[name="name"] {
    flex: 1 1 100%;
}
.fee-cat-add--wrap .fee-input-prefix {
    flex: 1 1 auto;
}
.fee-cat-add--wrap .fee-input-prefix .form-control {
    height: 1.85rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    font-size: 0.775rem;
}

/* -- Peso-prefixed amount input -- */
.fee-input-prefix { position: relative; }
.fee-input-prefix__sign {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    pointer-events: none;
}
.fee-input-prefix .form-control { padding-left: 1.6rem; }

/* -- Add / edit fee item form -- */
.fee-form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    max-width: 42rem;
}
.fee-form-card__head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}
.fee-form-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex: none;
    border-radius: 0.55rem;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.85rem;
}
.fee-form-card__head h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}
.fee-form-card__head p {
    margin: 0.1rem 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.new-charge-card {
    max-width: none;
}
.new-charge-body {
    padding-top: 0.25rem;
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
}

/* -- Canonical in-page section tabs, used to split a page (or a card, like the teacher
   gradebook workspace) into panels — an underline style, distinct from the pill-shaped
   .registrar-tabs page-level nav. Works two ways depending on the consumer: plain <a> links
   with the active state decided server-side by a GET param (no JS, survives reloads/POST
   redirects — see billing-manage.php), or <button> elements toggled client-side via JS
   (see grade-submissions.php + gradebook-class.js, which needs live in-page updates without
   a full reload). Both consumers share this same CSS/markup contract. -- */
.section-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}
.section-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.7rem 0.9rem;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.section-tab:hover { color: var(--primary); }
.section-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.section-tab__badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background: var(--surface-2, #f1f5f9);
    color: var(--text-muted);
}
.section-tab.is-active .section-tab__badge {
    background: var(--primary-light);
    color: var(--primary);
}
.section-tab__badge--warn { background: #f0ad4e; color: #5c3d00; }
.section-tab.is-active .section-tab__badge--warn { background: #f0ad4e; color: #5c3d00; }
.section-tab-panel { display: none; }
.section-tab-panel.is-active { display: block; }
/* Gradebook workspace variant: tabs sit on the workspace strip background and the active
   tab lifts to the card surface color; panels get breathing room inside the card. */
.gb-workspace .section-tabs { border-bottom: 1px solid var(--border); background: var(--bg); padding: 0 0.5rem; margin-bottom: 0; }
.gb-workspace .section-tab { padding: 0.85rem 1rem; }
.gb-workspace .section-tab.is-active { background: var(--surface); }
/* Organizations / Fee items panels held one narrow sidebar-sized card before; keep that
   width now that they're full tab panels instead of stretching to the full content area. */
.ext-panel-narrow { max-width: 30rem; }
.charge-type-tabs {
    display: flex;
    gap: 0.25rem;
    margin: 0.9rem 0 1.1rem;
    border-bottom: 1px solid var(--border);
}
.charge-type-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.9rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}
.charge-type-tab:hover {
    color: var(--text);
}
.charge-type-tab.is-active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.charge-type-tab__note {
    font-weight: 500;
    font-size: 0.7rem;
    color: var(--text-muted);
}
.charge-type-panel__hint {
    margin: 0 0 0.9rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.charge-quick-add {
    padding: 0.9rem 1rem;
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}
.charge-quick-add p {
    margin: 0 0 0.6rem;
}
.charge-quick-add__form {
    display: flex;
    gap: 0.5rem;
}
.charge-quick-add__form .form-control {
    flex: 1 1 auto;
}
@media (max-width: 640px) {
    .charge-quick-add__form {
        flex-direction: column;
    }
}
.fee-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.15rem 1rem;
}
@media (max-width: 640px) {
    .fee-form-grid { grid-template-columns: 1fr; }
}
.fee-form-grid .form-group { margin-bottom: 0.75rem; }
.fee-form-grid__full { grid-column: 1 / -1; }

.fee-form-mode-toggle {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.25rem;
    background: var(--surface-alt, #f8fafc);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
}
.fee-form-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border: none;
    background: transparent;
    border-radius: 0.6rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}
.fee-form-mode-btn.is-active {
    background: var(--surface);
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.fee-item-subject-tag {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--primary);
}

/* Fee catalog table collapses into stacked cards on narrow screens, mirroring the
   admin-table-card treatment (which does not reach this standalone-styled table). */
@media (max-width: 720px) {
    .fee-table,
    .fee-table tbody { display: block; width: 100%; }
    .fee-table thead { display: none; }

    .fee-table tbody tr {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 0.3rem 0.6rem;
        padding: 0.6rem 0.75rem;
        border-bottom: 1px solid var(--border);
    }
    .fee-table tbody tr:last-child { border-bottom: none; }
    .fee-table tbody tr[hidden] { display: none; }

    .fee-table td {
        display: block;
        border: none;
        padding: 0;
    }
    .fee-table td.col-cat { grid-column: 1 / -1; grid-row: 1; }
    .fee-table td.col-name { grid-column: 1 / -1; grid-row: 2; }
    .fee-table td.col-fee {
        grid-column: 1;
        grid-row: 3;
        text-align: left;
        font-size: 0.9rem;
    }
    .fee-table td.col-fee::before {
        content: attr(data-label) ": ";
        font-weight: 500;
        font-size: 0.68rem;
        color: var(--text-muted);
    }
    .fee-table td.col-status { grid-column: 2; grid-row: 3; justify-self: end; }
    .fee-table td.actions { grid-column: 1 / -1; grid-row: 4; }
    .fee-table td.actions .table-row-actions { justify-content: flex-start; }
}

/* ============================================================
   Registrar - Registration Settings workspace
   ============================================================ */
/* ============================================================
   Registrar - Registration Settings workspace
   ============================================================ */
.rs-stat-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    margin-left: auto;
    margin-right: auto;
    padding: 1.25rem;
    background: linear-gradient(135deg, #f8fafb 0%, #f3f5f7 100%);
    border-radius: 0.75rem;
    border: 1px solid #e5e7eb;
    max-width: 900px;
}
@media (max-width: 1100px) {
    .rs-stat-grid { 
        grid-template-columns: repeat(3, minmax(0, 1fr)); 
    }
}
@media (max-width: 640px) {
    .rs-stat-grid { 
        grid-template-columns: repeat(2, minmax(0, 1fr)); 
    }
}

/* -- Jump nav: improved styling for single-page navigation -- */
.rs-jump-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #f8fafb 0%, #f3f5f7 100%);
    border-radius: 0.875rem;
    border: 1px solid #e5e7eb;
    max-width: 900px;
    position: sticky;
    top: 80px;
    z-index: 40;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-left: auto;
    margin-right: auto;
}

.rs-jump-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.8rem;
    border-radius: 0.625rem;
    border: 1px solid #d5dce0;
    background: #ffffff;
    color: #4b5563;
    font-size: 0.65rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.rs-jump-chip:hover {
    background: #f8fafb;
    border-color: #4b5563;
    color: #1f2937;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.rs-jump-chip:focus {
    outline: 2px solid #0f6cbf;
    outline-offset: 2px;
}

.rs-jump-chip i { 
    font-size: 0.55rem;
    color: #8b92a0;
}

/* -- Unified neutral color palette for a professional, minimal look -- */
.rs-accent-0, .rs-accent-1, .rs-accent-2, .rs-accent-3, .rs-accent-4, .rs-accent-5, .rs-accent-6 {
    --rs-accent: #5b6b7c;
    --rs-accent-bg: #f1f3f5;
}

.rs-jump-chip.rs-accent-0:hover, 
.rs-jump-chip.rs-accent-1:hover, 
.rs-jump-chip.rs-accent-2:hover, 
.rs-jump-chip.rs-accent-3:hover, 
.rs-jump-chip.rs-accent-4:hover, 
.rs-jump-chip.rs-accent-5:hover, 
.rs-jump-chip.rs-accent-6:hover {
    border-color: var(--rs-accent);
    color: var(--rs-accent);
}

/* -- Unified single-column layout: clean, focused, professional -- */
.rs-section-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* Unified card styling */
.rs-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 2rem;
    scroll-margin-top: 5rem;
    transition: all 0.2s ease;
    position: relative;
    border-left: 4px solid #5b6b7c;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafb 100%);
}

.rs-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* No special child-specific grid columns needed - all are 1 column now */
.rs-card:nth-child(1),
.rs-card:nth-child(2),
.rs-card:nth-child(3) {
    border-left-color: #5b6b7c;
}

/* Privacy & Policy Section */
.rs-card:nth-child(4) {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, #ffffff 0%, #f0f5fb 100%);
    border-top: 1px solid #bfdbfe;
}

/* Checkboxes and Attachments */
.rs-card:nth-child(5),
.rs-card:nth-child(6) {
    border-left-color: #10b981;
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

/* Documents Section */
.rs-card:nth-child(7) {
    border-left-color: #8b5cf6;
    background: linear-gradient(135deg, #ffffff 0%, #faf5ff 100%);
    border-top: 1px solid #e9d5ff;
}

@media (max-width: 1024px) {
    .rs-section-grid {
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .rs-section-grid {
        gap: 1.5rem;
    }
    .rs-card {
        padding: 1.5rem;
    }
}

.rs-card--wide {
    grid-column: 1 / -1;
}

.rs-card__head {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f3f4f6;
}

.rs-card__icon {
    flex-shrink: 0;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f1f3;
    color: #5b6b7c;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

/* Color accents for different sections */
.rs-card:nth-child(1) .rs-card__icon,
.rs-card:nth-child(2) .rs-card__icon,
.rs-card:nth-child(3) .rs-card__icon {
    background: #e2e7f0;
    color: #4b5563;
}

.rs-card:nth-child(4) .rs-card__icon {
    background: #dbeafe;
    color: #1e40af;
}

.rs-card:nth-child(5) .rs-card__icon,
.rs-card:nth-child(6) .rs-card__icon {
    background: #dcfce7;
    color: #15803d;
}

.rs-card:nth-child(7) .rs-card__icon {
    background: #f3e8ff;
    color: #6d28d9;
}

.rs-card:hover .rs-card__icon {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.rs-card__head h3 {
    margin: 0 0 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
    letter-spacing: -0.3px;
}

.rs-card__head p {
    margin: 0;
    font-size: 0.7rem;
    line-height: 1.4;
    color: #6b7280;
}

.rs-card__note {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.5;
}

.rs-card__note a {
    color: #5b6b7c;
    font-weight: 500;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.rs-card__note a:hover {
    color: #374151;
}

.rs-card__empty {
    margin-bottom: 1.25rem;
    font-size: 0.8rem;
    color: #9ca3af;
}

.rs-readonly-amount {
    margin: 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
    .rs-card { padding: 1rem; }
    .rs-jump-nav {
        margin-bottom: 1.5rem;
        gap: 0.4rem;
        padding: 1rem;
    }
    .rs-jump-chip {
        padding: 0.5rem 0.85rem;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .rs-section-grid {
        max-width: 100%;
        gap: 1rem;
    }
    .rs-card {
        padding: 1rem;
        border-radius: 0.5rem;
    }
    .rs-card__head {
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    .rs-jump-nav {
        position: static;
        margin-bottom: 1.5rem;
    }
}

/* ============================================================
   Cashier workspace
   ============================================================ */
.cashier-stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 1rem;
}
@media (max-width: 900px) {
    .cashier-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
    .cashier-stat-grid { grid-template-columns: 1fr; }
}

/* Section color accents: each card gets a colored top border matching its stat
   tile above, so the page reads as distinct zones instead of one flat repeat. */
.cashier-card {
    border-top: 3px solid var(--cashier-accent, var(--primary));
}
.cashier-accent-warn { --cashier-accent: #b45309; --cashier-accent-bg: #fdf1dd; }
.cashier-accent-info { --cashier-accent: #0f766e; --cashier-accent-bg: #e3f7f7; }
.cashier-accent-danger { --cashier-accent: #c0392b; --cashier-accent-bg: #fdecea; }
.cashier-accent-good { --cashier-accent: #15803d; --cashier-accent-bg: #e3f5ea; }

.cashier-card-head-group {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-width: 0;
}
.cashier-card__icon {
    flex-shrink: 0;
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cashier-accent-bg, var(--primary-light));
    color: var(--cashier-accent, var(--primary));
    font-size: 0.9rem;
}

/* Marks "Your confirmed payments" as history, not another action queue, below the
   tabbed section above it. */
.cashier-section-divider {
    margin: 1.75rem 0 0.75rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

/* ============================================================
   Student dashboard - required documents checklist
   ============================================================ */
.sd-doc-checklist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.sd-doc-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.7rem 0.85rem;
    border-radius: 0.7rem;
    border: 1px solid var(--border);
    background: var(--surface-2, #f8fafc);
}
.sd-doc-item__icon {
    flex-shrink: 0;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 0.55rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    background: #eef0f3;
    color: #64748b;
}
.sd-doc-item__body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.sd-doc-item__body strong {
    font-size: 0.875rem;
    color: var(--text);
}
.sd-doc-item__note {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.sd-doc-item__status {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    padding-top: 0.15rem;
}

.sd-doc-item--approved .sd-doc-item__icon { background: #d4edda; color: #15803d; }
.sd-doc-item--approved .sd-doc-item__status { color: #15803d; }

.sd-doc-item--pending .sd-doc-item__icon { background: #dbeafe; color: #1e40af; }
.sd-doc-item--pending .sd-doc-item__status { color: #1e40af; }

.sd-doc-item--rejected { border-color: #f3c6c6; background: #fef2f2; }
.sd-doc-item--rejected .sd-doc-item__icon { background: #fdecea; color: #c0392b; }
.sd-doc-item--rejected .sd-doc-item__status { color: #c0392b; }
.sd-doc-item--rejected .sd-doc-item__note { color: #b91c1c; }

.sd-doc-item--missing .sd-doc-item__icon { background: #fff3cd; color: #b45309; }
.sd-doc-item--missing .sd-doc-item__status { color: #b45309; }

.sd-panel--docs {
    margin-top: 1.15rem;
}

/* ============================================================
   Registrar - documents-awaiting-review table
   ============================================================ */
.doc-review-table .col-name:nth-child(2) { width: 22rem; }
.doc-review-table td.col-name { vertical-align: middle; }

.doc-review-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none !important;
    color: inherit;
}
.doc-review-link:hover .doc-review-link__text strong {
    color: var(--primary);
    text-decoration: underline;
}
.doc-review-link__text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}
.doc-review-link__text strong {
    font-size: 0.8125rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-file-icon {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}
.doc-file-icon--pdf { background: #fdecea; color: #c0392b; }
.doc-file-icon--image { background: #f2e9fd; color: #7c3aed; }
.doc-file-icon--excel { background: #e3f5ea; color: #15803d; }
.doc-file-icon--word { background: #e7f0fa; color: #0f6cbf; }
.doc-file-icon--other { background: #eef0f3; color: #64748b; }

/* -- Billings overview page (school/billing.php): a distinct "overview" skin layered onto
   shared components (segmented pill tabs instead of the plain underline nav, accent-railed
   stat tiles, radial-gradient analytics cards). Scoped under .billing-ov since no other page
   currently wants this look; kept here (not page-local) so it's available if one does. -- */
.billing-ov {
    --bv-radius: 1.25rem;
    --bv-radius-sm: 0.75rem;
    --bv-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 20px -12px rgba(15, 23, 42, 0.10);
    --bv-shadow-hover: 0 16px 32px -14px rgba(15, 108, 191, 0.22), 0 2px 6px rgba(15, 23, 42, 0.06);
    --bv-success-bg: #eaf7ee;
    --bv-success-text: #1a7a34;
    --bv-warning-bg: #fdf3e4;
    --bv-warning-text: #a3620a;
    --bv-danger-bg: #fdeceb;
    --bv-danger-text: #c22a1c;
}

/* Tabs: underline strip -> segmented pill nav */
.billing-ov .registrar-tabs-wrap {
    background: var(--surface-2, #f8faff);
    border: 1px solid var(--border);
    border-radius: var(--bv-radius);
    padding: 0.35rem;
    margin-bottom: 1.5rem;
}
.billing-ov .registrar-tabs { padding: 0; gap: 0.2rem; }
.billing-ov .registrar-tab {
    border-bottom: none;
    margin-bottom: 0;
    border-radius: 0.6rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.78rem;
}
.billing-ov .registrar-tab:hover { background: rgba(15, 108, 191, 0.07); color: var(--primary-dark); }
.billing-ov .registrar-tab.is-active {
    background: var(--surface, #fff);
    color: var(--primary);
    box-shadow: var(--bv-shadow), 0 0 0 1px var(--border);
}

/* Page header */
.billing-ov .admin-page-header {
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: var(--bv-radius);
    box-shadow: var(--bv-shadow);
}

/* Stat tiles: accent rail + consistent semantic tints */
.billing-ov .fin-stat-grid { gap: 1rem; margin-bottom: 1.5rem; }
.billing-ov .fin-stat-tile {
    position: relative;
    padding: 1.15rem 1.25rem;
    border-radius: var(--bv-radius);
    box-shadow: var(--bv-shadow);
    gap: 0.9rem;
    overflow: hidden;
    transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.billing-ov .fin-stat-tile::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--border);
}
.billing-ov .fin-stat-tile:nth-child(1)::before { background: var(--bv-warning-text); }
.billing-ov .fin-stat-tile:nth-child(2)::before { background: var(--bv-success-text); }
.billing-ov .fin-stat-tile:nth-child(3)::before { background: var(--bv-danger-text); }
.billing-ov .fin-stat-tile--link:hover {
    box-shadow: var(--bv-shadow-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
}
.billing-ov .fin-stat-tile__icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--bv-radius-sm);
    font-size: 1.05rem;
}
.billing-ov .fin-stat-tile__icon--warn { background: linear-gradient(155deg, #fef1d6 0%, var(--bv-warning-bg) 100%); color: var(--bv-warning-text); }
.billing-ov .fin-stat-tile__icon--good { background: linear-gradient(155deg, #dff5e4 0%, var(--bv-success-bg) 100%); color: var(--bv-success-text); }
.billing-ov .fin-stat-tile__icon--danger { background: linear-gradient(155deg, #fde0dd 0%, var(--bv-danger-bg) 100%); color: var(--bv-danger-text); }
.billing-ov .fin-stat-tile__value { font-size: 1.4rem; letter-spacing: -0.01em; }
.billing-ov .fin-stat-tile__label { font-size: 0.7rem; }

/* Analytics cards */
.billing-ov .billing-analytics-grid { gap: 1.25rem; margin-bottom: 1.5rem; }
.billing-ov .admin-table-card {
    position: relative;
    border-radius: var(--bv-radius);
    box-shadow: var(--bv-shadow);
    overflow: hidden;
}
.billing-ov .billing-analytics-card::before {
    content: "";
    position: absolute;
    top: -60px;
    right: -60px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(15, 108, 191, 0.08) 0%, rgba(15, 108, 191, 0) 70%);
    pointer-events: none;
}
.billing-ov .billing-analytics-card:first-child::before {
    background: radial-gradient(circle, rgba(26, 122, 52, 0.08) 0%, rgba(26, 122, 52, 0) 70%);
}
.billing-ov .admin-table-card-head-text h2 { font-size: 0.95rem; font-weight: 700; }
.billing-ov .admin-table-card-head-text p { font-size: 0.8rem; }

.billing-ov .billing-meter { height: 0.75rem; background: var(--bv-danger-bg); }
.billing-ov .billing-meter__fill { background: linear-gradient(180deg, #22a35a 0%, var(--bv-success-text) 100%); }
.billing-ov .billing-meter__pct { font-size: 1.5rem; font-weight: 800; }
.billing-ov .billing-meter__dot--paid { background: var(--bv-success-text); }
.billing-ov .billing-meter__dot--unpaid { background: var(--bv-danger-bg); border-color: var(--bv-danger-text); }

.billing-ov .billing-breakdown__track { height: 0.6rem; }
.billing-ov .billing-breakdown__row:hover .billing-breakdown__label span:first-child { color: var(--primary); }
.billing-ov .billing-breakdown__bar {
    animation: billingBarGrow 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes billingBarGrow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}
.billing-ov .billing-breakdown__bar { transform-origin: left; }
@media (prefers-reduced-motion: reduce) {
    .billing-ov .billing-breakdown__bar { animation: none; }
}

/* Recent payments: status dot+text -> readable pill */
.billing-ov .fin-row { padding: 0.95rem 0.6rem; }
.billing-ov .fin-row[data-billing-status="paid"]:hover {
    background-color: var(--surface-2);
    border-radius: var(--bv-radius-sm);
}
.billing-ov .billing-list--recent .fin-row__main { gap: 0.3rem; }
.billing-ov .fin-row__status {
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    min-width: auto;
}
.billing-ov .fin-row__status--paid { background: var(--bv-success-bg); color: var(--bv-success-text); }
.billing-ov .fin-row__status--unpaid { background: var(--bv-warning-bg); color: var(--bv-warning-text); }
.billing-ov .fin-row__status--overdue { background: var(--bv-danger-bg); color: var(--bv-danger-text); }
.billing-ov .fin-status-dot--paid { background: var(--bv-success-text); }
.billing-ov .fin-status-dot--unpaid { background: var(--bv-warning-text); }
.billing-ov .fin-status-dot--overdue { background: var(--bv-danger-text); }

/* Report action menu (soa.php, billing-ar-summary.php, finance-report.php,
   finance-transactions.php) — a fixed-position "Print / Export as Excel" dropdown for a
   report page's single action button, JS-positioned via getBoundingClientRect since its
   trigger isn't inside a position:relative ancestor. Matches the .course-lesson-add-menu
   dropdown pattern used elsewhere. */
.report-action-menu {
    position: fixed;
    z-index: 2000;
    min-width: 12rem;
    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);
}
.report-action-menu[hidden] { display: none; }
.report-action-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;
    font-weight: 600;
    text-align: left;
    text-decoration: none !important;
    cursor: pointer;
    font-family: inherit;
}
.report-action-menu__item:hover {
    background: var(--bg);
    color: var(--primary);
}
.report-action-menu__item i {
    width: 1.1rem;
    text-align: center;
    color: var(--text-muted);
}
.report-action-menu__item:hover i {
    color: var(--primary);
}

/* -- Online payments: split-payment allocation UI (billing-online.php). Colors
   reuse the same tokens as .fin-status-dot--paid (#15803d) / --overdue (#b91c1c) instead of
   bespoke hex, so "unassigned/fully assigned" reads as the same green used for paid, and
   "over the amount received" reads as the same red used for overdue. -- */
.online-payment-unassigned-badge {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-weight: 700;
    background: rgba(21, 128, 61, 0.12);
    color: #15803d;
}
.online-payment-unassigned-badge--over {
    background: rgba(185, 28, 28, 0.12);
    color: #b91c1c;
}
.online-payment-allocate {
    margin-top: 0.5rem;
    padding: 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius, 8px);
}
.online-payment-allocate__hint {
    color: var(--text-muted);
    margin: 0 0 0.4rem;
}
.online-payment-allocate__row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}
.online-payment-allocate__input {
    max-width: 8.75rem;
}

/* -- Programs list: institute/department cards (school/programs.php). Each institute is a
   card with a collapsible header; the body is a responsive grid of program tiles. -- */
.institute-groups {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}
/* A card-per-program grid instead of a tall single-column stack — used where each card's own
   expanded content is small/self-contained (e.g. billing-auto.php's per-level table), unlike
   the institute picker's own program tiles which need the full row width. */
.institute-groups--grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
    align-items: start;
}
.institute-groups--grid .institute-card {
    height: fit-content;
}

.program-billing-modal__panel {
    max-width: 34rem;
}
.program-billing-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}
.program-billing-modal__head h3 { margin: 0; flex: 1; }
.program-billing-modal__per-subject-form { display: flex; margin: 0; }
.program-billing-modal__per-subject-form .btn { white-space: nowrap; }
.program-billing-modal__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    background: var(--bg, #f1f5f9);
    color: var(--text-muted);
    border-radius: 999px;
    cursor: pointer;
    flex: none;
}
.program-billing-modal__close:hover { background: var(--border); color: var(--text); }
#programBillingModalBody .table-wrap {
    max-height: none;
    border: none;
    box-shadow: none;
}
.institute-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.institute-card__header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border: none;
    cursor: pointer;
    text-align: left;
    padding: 0.85rem 1rem;
    background: linear-gradient(180deg, #fafbfc 0%, var(--surface) 100%);
    border-bottom: 1px solid var(--border);
}
.institute-card__icon {
    flex: none;
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.8rem;
    background: var(--accent-l3, #eef2ff);
    color: var(--primary);
    font-size: 1.25rem;
    overflow: hidden;
}
.institute-card__icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.2rem;
}
.institute-card__title {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}
.institute-card__title strong {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.institute-card__title small {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
}
.institute-card__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.institute-card__meta .badge { font-size: 0.62rem; padding: 0.05rem 0.4rem; }
.institute-card__chevron {
    margin-left: auto;
    flex: none;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.15s ease;
}
.institute-card__header[aria-expanded="true"] .institute-card__chevron {
    transform: rotate(90deg);
}
.institute-program-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
    gap: 0.75rem;
    padding: 0.85rem;
    /* A light gray "sunken" accent behind the white tiles — otherwise the header, panel body,
       and every tile are all the same pure white and the whole card reads as one flat block. */
    background: #f5f6f8;
}
.institute-program-grid[hidden] { display: none; }

/* The "choose your course" grid reuses the admin program-card markup, but as a plain radio
   pick rather than a management card — no stats/actions row, so the tall min-height from the
   base tile left a big empty gap under the description. This variant trims that, moves the
   native radio into a corner indicator, and highlights the whole card once it's checked. */
.program-tile.program-tile--selectable {
    position: relative;
    min-height: 0;
    cursor: pointer;
    padding: 1.1rem 2.75rem 1.1rem 1.2rem;
}
.program-tile--selectable input[type="radio"] {
    position: absolute;
    top: 50%;
    right: 1.1rem;
    transform: translateY(-50%);
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    accent-color: var(--primary);
    cursor: pointer;
}
.program-tile--selectable .program-tile__name {
    white-space: normal;
    overflow: visible;
}
.program-tile--selectable .program-tile__desc {
    -webkit-line-clamp: 3;
}
.program-tile.program-tile--selectable:hover {
    border-color: var(--accent-l2);
}
.program-tile.program-tile--selectable:has(input:checked) {
    border-color: var(--primary);
    background: var(--accent-l3, #eef2ff);
    box-shadow: 0 0 0 1px var(--primary);
}
.program-tile--selectable:has(input:checked) .program-tile__name {
    color: var(--primary-dark, var(--primary));
}

.program-tile {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-height: 11.5rem;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    background: var(--surface);
    padding: 0.9rem;
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.program-tile:hover {
    border-color: var(--accent-l2);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    transform: translateY(-2px);
}
.program-tile--archived {
    opacity: 0.65;
}
.program-tile--archived:hover {
    opacity: 0.9;
}
.program-tile--has-bg {
    position: relative;
    background-size: cover;
    background-position: center;
    color: #fff;
    isolation: isolate;
}
/* Sits between the background-image and the tile's own content — without it, name/description/
   stats become unreadable against a busy photo, since the tile has no other way to guarantee
   contrast for an image the admin picked without knowing what text will sit on top of it. */
.program-tile__bg-overlay {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.3) 0%, rgba(15, 23, 42, 0.55) 42%, rgba(15, 23, 42, 0.88) 100%);
    border-radius: inherit;
}
.program-tile--has-bg > * {
    position: relative;
    z-index: 1;
}
.program-tile--has-bg .program-tile__name,
.program-tile--has-bg .program-tile__desc,
.program-tile--has-bg .program-stat,
.program-tile--has-bg .program-stat i {
    color: #fff;
}
.program-tile--has-bg .program-tile__name:hover { color: #fff; text-decoration-color: #fff; }
.program-tile--has-bg .program-tile__actions {
    border-top-color: rgba(255, 255, 255, 0.25);
}
.program-tile--has-bg .program-stat {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(15, 23, 42, 0.42);
}
.program-tile--has-bg .table-action-btn {
    background: rgba(255, 255, 255, 0.9);
}
.program-tile__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}
.program-tile__name {
    font-size: 1.05rem;
    line-height: 1.2;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.program-tile__name:hover { color: var(--primary); text-decoration: underline; }
.program-tile__desc {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.program-tile__stats {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.program-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}
.program-stat i { font-size: 0.7rem; color: var(--text-muted); }
.program-tile__actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: auto;
    padding-top: 0.65rem;
    border-top: 1px dashed var(--border);
}
.program-tile__actions form { display: contents; }
.program-tile__actions .table-action-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
}
.program-tile {
    display: block;
    overflow: hidden;
    padding: 0;
}
.program-tile__cover {
    position: relative;
    min-height: 7.25rem;
    padding: 0.9rem;
    background: linear-gradient(135deg, #eaf3fb, #dceaf5);
    background-size: cover;
    background-position: center;
}
.program-tile__cover--has-bg {
    color: #fff;
}
.program-tile__cover > * {
    position: relative;
    z-index: 1;
}
.program-tile__cover .program-tile__name {
    color: var(--text);
}
.program-tile__cover--has-bg .program-tile__name {
    color: #fff;
}
.program-tile__body {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-height: 7.25rem;
    padding: 0.8rem 0.9rem 0.85rem;
    background:
        linear-gradient(
            180deg,
            rgba(245, 247, 250, 0) 0,
            rgba(245, 247, 250, 0.08) 18%,
            rgba(245, 247, 250, 0.3) 42%,
            rgba(245, 247, 250, 0.72) 72%,
            #f5f7fa 100%
        ) top / 100% 5rem no-repeat,
        #f5f7fa;
    color: var(--text);
}
.program-tile__body::before {
    content: none;
}
.program-tile__body .program-tile__desc {
    color: var(--text-muted);
}
.program-tile__body .program-tile__name {
    color: var(--text);
}
.program-tile__body .program-tile__name:hover {
    color: var(--primary);
}
.program-tile__body .program-stat {
    border-color: #e5eaf0;
    background: #f8fafc;
    color: var(--text-muted);
}
.program-tile__body .program-stat i {
    color: var(--primary);
}
.program-tile__body .program-tile__actions {
    margin-right: -0.9rem;
    margin-bottom: -0.85rem;
    margin-left: -0.9rem;
    padding: 0.65rem 0.9rem 0.85rem;
    background: #e9eef3;
    border-top-color: var(--border);
}
.program-tile__body .program-tile__actions .table-action-btn {
    background: #fff;
    color: var(--primary);
    border: 1px solid #d9e3ec;
}
.program-tile__body .program-tile__actions .table-action-btn:hover {
    background: #eef6ff;
    border-color: var(--primary);
}
.program-tile--has-bg > * {
    position: relative;
    z-index: auto;
}
.program-tile--has-bg .program-tile__actions {
    border-top-color: var(--border);
}
.program-tile--has-bg .program-tile__body .program-stat {
    border-color: #e5eaf0;
    background: #f8fafc;
    color: var(--text-muted);
}
.program-tile--has-bg .program-tile__body .program-stat i {
    color: var(--primary);
}

/* -- Class groups list (school/class-groups.php): card grid instead of a plain table. -- */
.classgroup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
    gap: 0.75rem;
    padding: 0.85rem;
}
.classgroup-tile {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    background: var(--surface-2);
    padding: 0.75rem 0.85rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.classgroup-tile:hover {
    border-color: var(--accent-l2);
    box-shadow: var(--shadow);
}
.classgroup-tile__top {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}
.classgroup-tile__icon {
    flex: none;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.55rem;
    background: var(--accent-l3, #eef2ff);
    color: var(--primary);
    font-size: 0.8rem;
}
.classgroup-tile__title {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
    flex: 1;
}
.classgroup-tile__name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.classgroup-tile__name:hover { color: var(--primary); text-decoration: underline; }
.classgroup-tile__title small {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.classgroup-tile__program {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.classgroup-tile__program i { font-size: 0.7rem; flex: none; }
.classgroup-tile__stats {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding-top: 0.35rem;
    border-top: 1px dashed var(--border);
}
.classgroup-stat {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.classgroup-stat i { font-size: 0.7rem; width: 1rem; text-align: center; }
.classgroup-stat--students {
    color: var(--text);
}
.classgroup-stat--students strong {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
}
.classgroup-stat--full strong {
    color: #b91c1c;
}
.classgroup-tile__actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.15rem;
}
/* A <details> disclosure, collapsed by default — with grouping now unpaginated, every class
   group in a department renders at once, so the per-card term picker (which can grow to 2-4
   pill rows) needs to stay closed until asked for, not expand every card's height up front. */
.classgroup-tile__term {
    padding-top: 0.5rem;
    margin-top: 0.35rem;
    border-top: 1px dashed var(--border);
}
.classgroup-tile__term-summary {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    list-style: none;
}
.classgroup-tile__term-summary::-webkit-details-marker { display: none; }
.classgroup-tile__term-summary::marker { content: ''; }
.classgroup-tile__term-summary strong { color: var(--text); font-weight: 700; }
.classgroup-tile__term-chevron {
    margin-left: auto;
    font-size: 0.65rem;
    transition: transform 0.15s ease;
}
.classgroup-tile__term[open] .classgroup-tile__term-chevron { transform: rotate(180deg); }
.classgroup-tile__term-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.5rem;
}
.term-pill {
    border: 1px solid var(--border);
    background: var(--surface, #fff);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    cursor: pointer;
    line-height: 1.4;
}
.term-pill:hover { border-color: var(--accent-l2); color: var(--text); }
.term-pill.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* -- Settings > Terms tab: one row per class group, term pills flush right ---------- */
.settings-terms-groups {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.settings-terms-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.settings-terms-row:last-child { border-bottom: none; }
.settings-terms-row__name { display: flex; flex-direction: column; gap: 0.1rem; }
.settings-terms-row__name a { font-weight: 600; }
.settings-terms-row__pills { margin-top: 0; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.settings-terms-row--dirty { background: var(--warning-l3, #fffbeb); border-radius: 0.4rem; padding-left: 0.5rem; padding-right: 0.5rem; margin: 0 -0.5rem; }

.settings-terms-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    position: sticky;
    top: 0;
    z-index: 5;
}
.settings-terms-savebar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 0.75rem);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
}
.settings-terms-savebar[hidden] { display: none; }

/* -- Nested collapsible sections inside a department's institute-card panel
      (school/class-groups.php): department > program > year level > section tiles.
      Each level down is its own collapsed-by-default disclosure, same [data-institute-toggle]
      delegated handler as the department cards — only the department itself starts as an
      institute-card; program and level rows are plainer toggle buttons one size down each. -- */
.classgroup-institute-grid { align-items: start; padding: 0.6rem; gap: 0.6rem; }

/* The animated wrapper: collapsed to max-height:0 (content never actually leaves layout/DOM —
   [hidden] can't be transitioned to/from display:none). JS measures the real content height
   (scrollHeight) and sets it as an explicit px max-height when opening/closing, rather than
   using the CSS-only grid-template-rows:0fr/1fr trick — that trick breaks when the collapsed
   content itself contains a nested `display: grid` (the tiles grid below does), producing
   squashed/blank tiles and a sliver of the next row peeking through while it animates. A plain
   max-height transition has none of that: it doesn't care what's inside. */
.classgroup-collapsible {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.22s ease;
}
.classgroup-collapsible.is-open {
    /* Static fallback for the rare panel with no toggle button at all (nothing to route a
       click through, so nothing ever sets an inline max-height) — see class-groups.php's
       "no program"/"no level" bucket. Every JS-toggled panel overrides this with an inline
       max-height instead. */
    max-height: none;
    overflow: visible;
}

.classgroup-dept-panel {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.65rem;
    background: #f5f6f8;
}
.classgroup-program-panel {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding-left: 0.5rem;
    margin: 0.1rem 0 0.25rem;
    border-left: 2px solid var(--border);
}

.classgroup-program-toggle,
.classgroup-level-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface, #fff);
    border-radius: 0.6rem;
    cursor: pointer;
    text-align: left;
}
.classgroup-program-toggle {
    padding: 0.55rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
}
.classgroup-program-toggle i:first-child { color: var(--primary); font-size: 0.8rem; }
.classgroup-level-toggle {
    padding: 0.45rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    background: var(--surface-alt, #f8fafc);
}
.classgroup-program-toggle small,
.classgroup-level-toggle small {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: normal;
}
.classgroup-program-toggle__chevron,
.classgroup-level-toggle__chevron {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.15s ease;
}
.classgroup-program-toggle[aria-expanded="true"] .classgroup-program-toggle__chevron,
.classgroup-level-toggle[aria-expanded="true"] .classgroup-level-toggle__chevron {
    transform: rotate(90deg);
}
.classgroup-level-toggle + .classgroup-collapsible .institute-program-grid.classgroup-institute-grid {
    margin-top: 0.3rem;
    margin-bottom: 0;
    border-radius: 0.6rem;
}

/* -- Institute / department manager (school/programs.php #programGroups) -- */
.institute-manager-body {
    padding: 0.85rem 1.1rem 1.1rem;
}
.institute-manager-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.institute-manager-card .fee-cat-item__text strong {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}
.institute-manager-card {
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    background: var(--surface-2);
    transition: border-color 0.15s;
}
.institute-manager-card:hover { border-color: var(--accent-l2); }
.institute-manager-card.is-disabled { opacity: 0.6; }
.institute-manager-card__view {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.7rem;
}
.institute-manager-card__view[hidden] { display: none; }
.institute-manager-card__icon {
    flex: none;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: var(--accent-l3, #eef2ff);
    color: var(--primary);
    font-size: 0.8rem;
    overflow: hidden;
}
.institute-manager-card__icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.institute-manager-card__icon-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.image-picker {
    margin-top: 0.35rem;
}
.image-picker__input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.image-picker__dropzone {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 5.25rem;
    padding: 0.65rem 0.8rem;
    border: 1px dashed #b8c6d8;
    border-radius: 0.7rem;
    background: linear-gradient(135deg, #f8fbff, #f1f6fc);
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.image-picker__dropzone:hover,
.image-picker__dropzone:focus-visible,
.image-picker.is-dragging .image-picker__dropzone {
    border-color: var(--primary);
    background: #eef6ff;
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.1);
    outline: none;
}
.image-picker__preview {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 3.6rem;
    height: 3.6rem;
    overflow: hidden;
    border: 1px solid #d7e1ec;
    border-radius: 0.6rem;
    background: #fff;
    color: #7e9ab7;
    font-size: 1.15rem;
}
.image-picker__preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.image-picker__copy {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-width: 0;
}
.image-picker__copy strong {
    color: var(--text);
    font-size: 0.82rem;
}
.image-picker__copy small {
    font-size: 0.72rem;
    line-height: 1.35;
}
.image-picker__copy u {
    color: var(--primary);
    text-underline-offset: 2px;
}
.image-picker__upload-icon {
    margin-left: auto;
    color: var(--primary);
    font-size: 1rem;
}
.image-picker__remove {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
    color: #a33a3a;
    font-size: 0.74rem;
    cursor: pointer;
}
.image-picker--compact .image-picker__dropzone {
    min-height: 3.25rem;
    padding: 0.4rem 0.5rem;
    gap: 0.5rem;
}
.image-picker--compact .image-picker__preview {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.45rem;
    font-size: 0.8rem;
}
.image-picker--compact .image-picker__copy strong { font-size: 0.75rem; }
.image-picker--compact .image-picker__copy small { font-size: 0.66rem; }
.image-picker--compact .image-picker__upload-icon { font-size: 0.8rem; }
.institute-manager-card.is-disabled .institute-manager-card__icon {
    background: var(--surface-3, #eef1f4);
    color: var(--text-muted);
}
.institute-manager-card .fee-cat-item__edit {
    padding: 0.6rem 0.7rem;
}
.institute-manager-card:has(.institute-manager-card__edit-form:not([hidden])) {
    grid-column: 1 / -1;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.08);
}
.institute-manager-card__edit-form {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(10rem, 0.8fr);
    gap: 0.65rem;
    align-items: start;
}
.institute-manager-card__edit-form[hidden] { display: none; }
.institute-manager-card__edit-form > .image-picker,
.institute-manager-card__edit-form > .category-pill-picker,
.institute-manager-card__edit-form > p,
.institute-manager-card__edit-form > .institute-manager-card__edit-actions {
    grid-column: 1 / -1;
}
.institute-manager-card__edit-form .image-picker--compact .image-picker__dropzone {
    min-height: 4.25rem;
}
.institute-manager-card__edit-form .image-picker--compact .image-picker__preview {
    width: 3.25rem;
    height: 3.25rem;
}
.institute-manager-card__edit-form .image-picker--compact .image-picker__copy strong {
    font-size: 0.82rem;
}
.institute-manager-card__edit-form .image-picker--compact .image-picker__copy small {
    font-size: 0.72rem;
}
.institute-manager-add {
    max-width: 26rem;
}
.institute-manager-card__edit-actions {
    display: flex;
    gap: 0.4rem;
}

/* Toggleable category pills — a checkbox hidden inside a label, styled by its own :checked
   state via :has() so clicking anywhere on the pill toggles it with zero JS. */
.category-pill-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.6rem 0;
}
.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    user-select: none;
}
.category-pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.category-pill:hover { border-color: var(--accent-l2); }
.category-pill:has(input:checked) {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Compact "Categories" bar — sits above the institute grid inside the same card instead of
   being its own separate card, saving a whole header + margin of vertical space. */
.category-manager-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 0.65rem;
    margin-bottom: 0.65rem;
    border-bottom: 1px dashed var(--border);
}
.category-manager-bar__label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    flex: none;
}
.category-manager-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    flex: 1 1 auto;
}
.category-manager-bar__add {
    display: flex;
    gap: 0.3rem;
    flex: none;
}
.category-manager-bar__add .form-control {
    height: 1.9rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.78rem;
    width: 10rem;
}
.category-manager-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.25rem 0.15rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    font-size: 0.76rem;
    font-weight: 600;
}
.category-manager-chip button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.05rem;
    height: 1.05rem;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.65rem;
}
.category-manager-chip button:hover { background: #fde2e2; color: #b91c1c; }

/* Compact institute grid/card variants. */
.institute-manager-body--compact { padding: 0.7rem 0.9rem 0.9rem; }
.institute-manager-grid--compact {
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}
.institute-manager-card--compact .institute-manager-card__view {
    padding: 0.4rem 0.55rem;
    gap: 0.5rem;
}
.institute-manager-card--compact .institute-manager-card__icon {
    width: 1.6rem;
    height: 1.6rem;
    font-size: 0.68rem;
}
.institute-manager-card__title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    line-height: 1.3;
}
.institute-manager-card__title-row .badge { font-size: 0.65rem; padding: 0.05rem 0.45rem; }
.institute-manager-card--compact .fee-cat-item__edit { padding: 0.5rem 0.55rem; }

/* Unified Billing/Transaction history card (student/billings.php) — the two tabs live in one
   card's head instead of a separate pill bar, so the page reads as a single continuous panel. */
.fin-history-tabs-head {
    padding: 0 0.6rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #fafbfc 0%, var(--surface) 100%);
}
.fin-history-tabs-head .registrar-tabs {
    padding: 0 0.4rem;
}
.fin-history-tabs-head .registrar-tab {
    padding: 0.8rem 0.7rem;
    font-size: 0.78rem;
}
.fin-history-subhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.85rem 1.1rem 0.15rem;
}
.fin-history-subhead p {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}
@media (max-width: 640px) {
    .fin-history-tabs-head .registrar-tab span {
        display: none;
    }
}

/* Transaction history — live-refresh indicator + method icon badges (student/billings.php) */
.fin-live-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
}
.fin-live-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #16a34a;
    flex-shrink: 0;
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55);
    animation: finLivePulse 2s ease-out infinite;
}
@keyframes finLivePulse {
    0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55); }
    70% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}
@media (prefers-reduced-motion: reduce) {
    .fin-live-dot { animation: none; }
}
.tx-row__icon {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
}
.tx-row__icon--cashier { background: #dcfce7; color: #15803d; }
.tx-row__icon--online { background: #dbeafe; color: #1d4ed8; }
.tx-row__icon--wallet { background: #ede9fe; color: #6d28d9; }
.tx-row__icon--default { background: var(--surface-2, #f1f5f9); color: var(--text-muted); }
.fin-row--tx-new {
    animation: finRowIn 0.5s ease;
}
@keyframes finRowIn {
    from { background-color: rgba(22, 163, 74, 0.12); }
    to { background-color: transparent; }
}
@media (max-width: 640px) {
    .tx-row__icon {
        order: 0;
    }
}

/* -- Enrollment schemes (school/enrollment-schemes.php) -- */
.scheme-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.scheme-toolbar__form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-width: 16rem;
}
.scheme-toolbar__form input[type="text"] { max-width: 22rem; }
.scheme-toolbar__delete { color: #b91c1c; border-color: #f0b8b8; }
.scheme-field-form .form-row { margin-bottom: 0.75rem; }
.scheme-field-form .checkbox-label { margin-right: 1.25rem; }

.scheme-flow-templates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 0.85rem;
    padding: 1rem;
}
.scheme-flow-template-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.scheme-flow-template-card.is-active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}
.scheme-flow-template-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.scheme-flow-template-card p { font-size: 0.82rem; margin: 0; flex: 1 1 auto; }
.scheme-flow-template-card button { width: 100%; justify-content: center; }

.scheme-flow-diagram {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0 1rem 1.25rem;
    padding: 1.25rem;
    background:
        radial-gradient(circle, #e2e8f0 1px, transparent 1px) 0 0 / 16px 16px,
        #f8fafc;
    border: 1px solid var(--border);
    border-radius: 0.85rem;
}
.scheme-flow-diagram__row { display: flex; flex-direction: column; gap: 0.6rem; }
.scheme-flow-diagram__row-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.scheme-flow-diagram__track {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}
.scheme-flow-diagram__gate {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    align-self: center;
    margin: 0.65rem 0;
    padding: 0.35rem 0.9rem;
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}
.scheme-flow-diagram__step {
    position: relative;
    display: flex;
    flex: 0 0 8.5rem;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.3rem;
    min-height: 7.25rem;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.75rem 0.6rem 0.6rem;
    text-align: center;
    filter: drop-shadow(0 2px 5px rgba(15, 23, 42, 0.07));
}
.scheme-flow-diagram__step.is-optional { border-style: dashed; }
.scheme-flow-diagram__step-num {
    position: absolute;
    top: -0.5rem;
    left: -0.5rem;
    width: 1.3rem;
    height: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--text);
    color: #fff;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 700;
}
.scheme-flow-diagram__step-icon {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light, #eef2ff);
    color: var(--primary);
    border-radius: 50%;
    font-size: 0.85rem;
}
.scheme-flow-diagram__step.is-optional .scheme-flow-diagram__step-icon { background: #f1f5f9; color: var(--text-muted); }
.scheme-flow-diagram__step-label {
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    min-height: 1.8em;
    display: flex;
    align-items: center;
}
.scheme-flow-diagram__step-tag {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: #f1f5f9;
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
}
.scheme-flow-diagram__arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    flex: 0 0 auto;
    height: 7.25rem;
}

/* Program detail form builder (school/program-detail-form.php) */
.detail-form-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .detail-form-layout { grid-template-columns: 1fr; } }

.detail-field-list { list-style: none; margin: 0; padding: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.detail-field-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    background: var(--surface, #fff);
}
.detail-field-row__icon {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.85rem;
}
.detail-field-row__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.detail-field-row__main strong { font-size: 0.9rem; }
.detail-field-row__meta { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; font-size: 0.75rem; color: var(--text-muted); }
.detail-field-row__meta code { background: #f3f4f6; padding: 0.05rem 0.35rem; border-radius: 4px; font-size: 0.7rem; }
.detail-field-row__delete { flex: 0 0 auto; }
.detail-field-edit-btn { flex: 0 0 auto; }

.detail-form-add .panel h2 { display: flex; align-items: center; gap: 0.4rem; font-size: 1rem; }
.detail-form-add .checkbox-label { display: flex; align-items: center; gap: 0.4rem; margin: 0.75rem 0; }
.detail-form-add form .form-row #detail-field-cancel { align-self: flex-end; }

.detail-field-group { margin-bottom: 0.9rem; }
.detail-field-group:last-child { margin-bottom: 0; }
.detail-field-group__head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.detail-field-group__head i { color: var(--primary); font-size: 0.75rem; }
.detail-field-group__desc { margin-left: auto; font-weight: 400; text-transform: none; letter-spacing: normal; font-size: 0.75rem; }

/* Detailed form review page (school/detailed-form-review.php) */
.review-header { display: flex; align-items: center; gap: 1rem; }
.review-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.review-header__body h2 { margin: 0 0 0.25rem; }
.review-header__meta { display: flex; align-items: center; gap: 0.6rem; color: var(--text-muted); font-size: 0.9rem; flex-wrap: wrap; }

.review-answers-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1rem; align-items: start; }
@media (min-width: 900px) { .review-answers-grid { grid-template-columns: 1fr 1fr; } }
.review-answers-panel h3 { display: flex; align-items: center; gap: 0.4rem; font-size: 1rem; margin: 0 0 0.75rem; }
.review-answer { flex: 0 0 auto; max-width: 55%; text-align: right; font-size: 0.85rem; }
.review-answers-grid--single { grid-template-columns: 1fr !important; }

/* Subjects & teachers table (school/class-group.php) — a modest list (rarely more than
   ~20 rows), so let it grow naturally with the page instead of scrolling in both directions
   inside a cramped 500px box, which made the vertical scrollbar visually collide with the
   Actions column. */
.group-subjects-wrap { max-height: none; overflow-y: visible; }

/* Highlights the class group's current term in the Subject Progress panel, so it doesn't
   read identically to every other quarter (school/student.php curriculum browser). */
.program-term-card.is-current-term { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.program-term-card.is-current-term .program-term-toggle { background: var(--primary-light); }
.program-term-card.is-current-term .program-term-order { background: var(--primary); color: #fff; }
.program-term-current-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: 0.5rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

/* Briefly draws the eye to the billing-template control when linked to directly (e.g. from
   school/billing-auto.php's "Configure" action) — assets/js/program-curriculum.js. */
.program-level-billing-form.is-hash-highlighted {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 6px;
    transition: outline-color 2s ease;
}

/* ---- Subject enrollment (school/subject-enrollment.php) ---- */
.subj-enroll-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}
.subj-enroll-steps__item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1 1 12rem;
    min-width: 0;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 0.75rem);
    background: var(--surface, #fff);
}
.subj-enroll-steps__item.is-current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.subj-enroll-steps__item.is-todo { opacity: 0.55; }
.subj-enroll-steps__marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 999px;
    background: var(--surface-alt, #f1f5f9);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
}
.subj-enroll-steps__item.is-current .subj-enroll-steps__marker { background: var(--primary); color: #fff; }
.subj-enroll-steps__item.is-done .subj-enroll-steps__marker { background: #dcfce7; color: #166534; }
.subj-enroll-steps__text { display: flex; flex-direction: column; min-width: 0; }
.subj-enroll-steps__label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 700; }
.subj-enroll-steps__value { font-size: 0.875rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subj-enroll-steps__change { margin-left: auto; font-size: 0.75rem; font-weight: 600; color: var(--primary); text-decoration: none; }
.subj-enroll-steps__change:hover { text-decoration: underline; }

.subj-enroll-group { justify-content: space-between; }
.subj-enroll-group__name { overflow: hidden; text-overflow: ellipsis; }
.subj-enroll-group__tag {
    flex: 0 0 auto;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #ede9fe;
    color: #5b21b6;
}

.subj-enroll-note {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0 0 1rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    background: var(--surface-alt, #f8fafc);
    font-size: 0.85rem;
}
.subj-enroll-note i { color: var(--primary); margin-top: 0.15rem; }

.subj-enroll-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.6rem; border: 0; padding: 0; margin: 0 0 1.1rem; }
.subj-enroll-modes legend { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 700; padding: 0; margin-bottom: 0.45rem; }
.subj-enroll-mode {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    cursor: pointer;
}
.subj-enroll-mode:has(input:checked) { border-color: var(--primary); background: var(--surface-alt, #f8fafc); box-shadow: 0 0 0 1px var(--primary) inset; }
.subj-enroll-mode input { margin-top: 0.2rem; flex: 0 0 auto; }
.subj-enroll-mode__body { display: flex; flex-direction: column; gap: 0.2rem; }
.subj-enroll-mode__title { font-weight: 700; font-size: 0.9rem; }
.subj-enroll-mode__title i { color: var(--primary); margin-right: 0.15rem; }
.subj-enroll-mode__desc { font-size: 0.8rem; color: var(--text-muted); }
.subj-enroll-mode__warn { color: #b45309; }

.subj-enroll-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 26rem;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 0.75rem);
    padding: 0.5rem;
}
.subj-enroll-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid transparent;
    border-radius: 0.6rem;
    cursor: pointer;
}
.subj-enroll-item:hover { background: var(--surface-alt, #f8fafc); }
.subj-enroll-item:has(input:checked) { border-color: var(--primary); background: var(--surface-alt, #f8fafc); }
.subj-enroll-item.is-disabled { opacity: 0.55; cursor: not-allowed; }
.subj-enroll-item input { flex: 0 0 auto; }
.subj-enroll-item__body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; flex: 1 1 auto; }
.subj-enroll-item__name { font-weight: 600; font-size: 0.9rem; }
.subj-enroll-item__meta { display: flex; flex-wrap: wrap; gap: 0.4rem; font-size: 0.75rem; color: var(--text-muted); }
.subj-enroll-item__units--missing { color: #b45309; font-weight: 600; }
.subj-enroll-item__term { padding: 0 0.45rem; border-radius: 999px; background: var(--surface-alt, #f1f5f9); }
.subj-enroll-item__right { flex: 0 0 auto; margin-left: auto; text-align: right; }
.subj-enroll-item__cost { font-weight: 700; font-size: 0.875rem; }
.subj-enroll-item__badge {
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
}
.subj-enroll-item.is-blocked { background: #fffbeb; }
.subj-enroll-item.is-blocked:has(input:checked) { border-color: #b45309; }
.subj-enroll-item__warning {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: #b45309;
}
.subj-enroll-item__warning i { margin-top: 0.15rem; flex-shrink: 0; }

.subj-enroll-override {
    border: 1px solid #fde68a;
    background: #fffbeb;
    border-radius: var(--radius-lg, 0.75rem);
    padding: 0.75rem 0.9rem;
    margin: 0 0 1.1rem;
}
.subj-enroll-override__toggle { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.subj-enroll-override__note { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.3rem; }
.subj-enroll-override__note label { font-size: 0.75rem; color: var(--text-muted); }

.subj-enroll-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0.9rem 0 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--primary);
    border-radius: 0.7rem;
    background: var(--surface-alt, #f8fafc);
}
.subj-enroll-summary.is-free { border-color: var(--border); }
.subj-enroll-summary__counts { display: flex; flex-direction: column; gap: 0.1rem; font-size: 0.85rem; }
.subj-enroll-summary__total { text-align: right; display: flex; flex-direction: column; gap: 0.1rem; }
.subj-enroll-summary__total span { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.subj-enroll-summary__total strong { font-size: 1.15rem; }

@media (max-width: 640px) {
    .subj-enroll-steps__item { flex: 1 1 100%; }
    .subj-enroll-summary { align-items: stretch; }
    .subj-enroll-summary__total { text-align: left; }
}

.program-enrollment-mode {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 0.75rem);
    background: var(--surface, #fff);
}
.program-enrollment-mode.is-on { border-color: var(--primary); }
.program-enrollment-mode.is-locked { background: var(--surface-alt, #f8fafc); opacity: 0.75; }
.program-enrollment-mode__text { flex: 1 1 auto; min-width: 0; }
.program-enrollment-mode__text strong { display: block; font-size: 0.925rem; }
.program-enrollment-mode__text strong i { color: var(--primary); margin-right: 0.3rem; }
.program-enrollment-mode__text p { margin: 0.2rem 0 0; font-size: 0.8rem; }
@media (max-width: 640px) {
    .program-enrollment-mode { align-items: flex-start; flex-wrap: wrap; }
}

.enroll-blocked {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 0.75rem;
    background: #fef3c7;
    color: #92400e;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: normal;
    text-align: left;
    /* The parent .actions column is `width: 1%` (shrink-to-fit) — combined with the site-wide
       `overflow-wrap: anywhere` on every td/th, an unconstrained badge here lets the table's
       auto-layout treat this text as breakable at any character, so it collapses the column to
       near-zero width and wraps the whole sentence one letter per line. Overriding overflow-wrap
       back to word boundaries and giving the badge its own width stops that column collapse. */
    overflow-wrap: break-word;
    word-break: normal;
    width: 11rem;
}
.enroll-blocked i { flex: 0 0 auto; margin-top: 0.15rem; }

/* ---- Class schedule (school/class-schedule.php, class-group.php offerings) ---- */
.schedule-chip-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.35rem;
}
.schedule-chip {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: var(--surface-alt, #f1f5f9);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}
.schedule-edit-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}
.schedule-edit-link:hover { text-decoration: underline; }

/* ---- Weekly timetable grid (includes/layout/timetable.php) ---- */
.timetable-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 3rem 1rem;
    color: var(--text-muted);
    text-align: center;
}
.timetable-empty i { font-size: 1.75rem; opacity: 0.5; }

.timetable {
    display: grid;
    grid-template-columns: 4.5rem repeat(var(--timetable-days), minmax(7rem, 1fr));
    grid-template-rows: 2.5rem repeat(var(--timetable-slots), minmax(1.6rem, auto));
    gap: 0;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 0.75rem);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    overflow: auto;
}
.timetable-corner {
    grid-column: 1; grid-row: 1;
    background: var(--surface, #fff);
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    position: sticky; top: 0; left: 0; z-index: 3;
}
.timetable-day-head {
    grid-row: 1;
    background: var(--surface-alt, #f8fafc);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700;
    color: var(--text, #1e293b);
    position: sticky; top: 0; z-index: 2;
    padding: 0.25rem;
    border-bottom: 1px solid var(--border);
    border-left: 1px solid var(--border);
}
.timetable-hour {
    grid-column: 1;
    background: var(--surface, #fff);
    display: flex; align-items: center; justify-content: flex-end;
    font-size: 0.6875rem; font-weight: 600; color: var(--text-muted);
    padding: 0 0.6rem 0 0;
    position: sticky; left: 0; z-index: 1;
    border-top: 1px solid var(--border-light, var(--border));
    border-right: 1px solid var(--border);
}
.timetable-hour + .timetable-hour,
.timetable-day-head ~ .timetable-hour {
    border-top-color: var(--border);
}
/* Real gridlines behind each day/hour, so empty time still reads as a grid rather than
   blank space — one bordered cell per day per hour, sized to line up with the hour labels. */
.timetable-cell {
    background: var(--surface, #fff);
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border-light, #eef1f5);
}
.timetable-block {
    background: #eef2ff;
    border-left: 4px solid #4f46e5;
    border-radius: 0.5rem;
    padding: 0.35rem 0.5rem;
    margin: 2px 3px;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    overflow: hidden;
    font-size: 0.7rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    cursor: default;
}
.timetable-block:hover {
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
    z-index: 4;
}
.timetable-block strong {
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.timetable-block__time {
    font-weight: 600;
    letter-spacing: 0.01em;
}
.timetable-block span { color: var(--text-muted); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timetable-block span i { width: 0.9em; text-align: center; opacity: 0.75; }

.timetable-block--a { background: #eef2ff; border-left-color: #4f46e5; }
.timetable-block--b { background: #ecfdf5; border-left-color: #059669; }
.timetable-block--c { background: #fff7ed; border-left-color: #ea580c; }
.timetable-block--d { background: #fdf2f8; border-left-color: #db2777; }
.timetable-block--e { background: #f0fdfa; border-left-color: #0d9488; }
.timetable-block--f { background: #fefce8; border-left-color: #ca8a04; }

.course-view-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.15rem;
    gap: 0.15rem;
    margin-left: auto;
}
.course-view-toggle button {
    border: none;
    background: transparent;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}
.course-view-toggle button.is-active { background: var(--primary); color: #fff; }

@media (max-width: 640px) {
    .timetable { grid-template-columns: 3.5rem repeat(var(--timetable-days), minmax(5.5rem, 1fr)); }
}

/* ---- Student subject self-selection (student/select-subjects.php) ---- */
.select-subjects-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 21rem;
    gap: 1.35rem;
    align-items: start;
    max-width: 1200px;
    margin: 0 auto;
}
.select-subjects-layout form { display: contents; }
.select-subjects-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}
.select-subjects-main > .panel,
.select-subjects-extras,
.select-subjects-summary {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--border);
    border-radius: 1rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}
.select-subjects-main > .panel {
    padding: 1.1rem 1.25rem;
}
.select-subjects-rail {
    position: sticky;
    top: 1rem;
}
.select-subjects-summary {
    padding: 1rem 1rem 0.85rem;
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
    border-color: rgba(15, 108, 191, 0.18);
}
.select-subjects-summary h3 {
    margin: 0 0 0.6rem;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.select-subjects-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.1rem;
    align-items: center;
    padding-top: 0.15rem;
}
.select-subjects-filters .select-subjects-filter-time {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}
.select-subjects-filters input[type="time"] {
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.8rem;
    color: var(--text);
    background: var(--surface);
}
.select-subjects-filters input[type="time"]:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Hide-full / hide-conflicts as pill toggles instead of bare checkboxes — same underlying
   <input type="checkbox">, just visually promoted to match the rest of the toolbar. */
.select-subjects-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem 0.35rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.select-subjects-filter-toggle:hover { border-color: var(--primary-light); }
.select-subjects-filter-toggle input { accent-color: var(--primary); width: 1rem; height: 1rem; margin: 0; }
.select-subjects-filter-toggle:has(input:checked) {
    border-color: var(--primary);
    color: var(--primary-dark);
    background: var(--primary-light);
}

.select-subjects-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
}
.select-subjects-panel-head h3 {
    margin: 0 0 0.2rem;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}
.select-subjects-progress-pill {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: #edf3ff;
    color: var(--primary-dark);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid rgba(15, 108, 191, 0.12);
}
.select-subjects-progress-pill[data-progress-complete="1"] { background: #eaf7ec; color: var(--success); }

.select-subjects-subject {
    position: relative;
    padding: 0.95rem 1rem;
    border: 1px solid var(--border);
    border-left: 4px solid transparent;
    border-radius: 0.9rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.02);
    transition: opacity .15s ease, transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.select-subjects-subject + .select-subjects-subject { margin-top: 0.8rem; }
.select-subjects-subject:first-of-type { border-top: none; padding-top: 0.95rem; }
.select-subjects-subject:hover {
    border-color: rgba(15, 108, 191, 0.2);
    border-left-color: rgba(15, 108, 191, 0.38);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.04);
    transform: translateY(-1px);
}
.select-subjects-subject-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.7rem;
}
.select-subjects-subject h4 {
    margin: 0;
    font-size: 1rem;
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    flex-wrap: wrap;
    letter-spacing: -0.01em;
    color: var(--text);
}
.select-subjects-subject-status {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: var(--bg);
}
.select-subjects-subject-status i { font-size: 0.7rem; }
.select-subjects-subject[data-picked="1"] .select-subjects-subject-status {
    background: #eaf7ec;
    color: var(--success);
}
/* A subject whose prerequisite isn't met — no pickable sections are rendered at all, just the
   warning below, so this is purely a visual "why" rather than something JS needs to enforce. */
.select-subjects-subject.is-prereq-blocked {
    background: #fdf1dd;
    border-left-color: #b45309;
    opacity: 0.9;
}
.select-subjects-subject.is-prereq-blocked:hover {
    transform: none;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.02);
}
.select-subjects-subject.is-prereq-blocked .select-subjects-subject-status {
    background: #fce8cc;
    color: #b45309;
}
.select-subjects-prereq-warning {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0;
    padding: 0.6rem 0.75rem;
    border-radius: 0.6rem;
    background: #fce8cc;
    color: #7c4a05;
    font-size: 0.82rem;
    line-height: 1.4;
}
.select-subjects-prereq-warning i { margin-top: 0.15rem; flex-shrink: 0; }
.select-subjects-extra-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.95rem;
}
.select-subjects-extras {
    padding: 0.85rem 1rem 0.75rem;
}
.select-subjects-extras summary { cursor: pointer; padding: 0.25rem 0; list-style: none; }
.select-subjects-extras summary::-webkit-details-marker { display: none; }
.select-subjects-extras summary::before {
    content: "\f0da";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    display: inline-block;
    width: 1rem;
    margin-right: 0.4rem;
    color: var(--text-muted);
    transition: transform .15s ease;
}
.select-subjects-extras[open] summary::before { transform: rotate(90deg); }
.select-subjects-extra-options { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.6rem; }
.select-subjects-extra-options[hidden] { display: none; }

.select-subjects-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border);
    border-left: 3px solid transparent;
    border-radius: 0.7rem;
    margin-bottom: 0.45rem;
    cursor: pointer;
    background: #fff;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease;
}
.select-subjects-option:last-child { margin-bottom: 0; }
.select-subjects-option:hover {
    border-color: var(--primary-light);
    background: #f8fbff;
    transform: translateY(-1px);
}
.select-subjects-option:has(input:checked) {
    border-color: rgba(15, 108, 191, 0.3);
    border-left-color: var(--primary);
    background: linear-gradient(180deg, rgba(15,108,191,0.06) 0%, rgba(255,255,255,1) 100%);
    box-shadow: 0 8px 18px rgba(15, 108, 191, 0.08);
}
.select-subjects-option input[data-radio] { accent-color: var(--primary); width: 1.05rem; height: 1.05rem; flex: 0 0 auto; }
.select-subjects-option.is-full { opacity: 0.6; }
.select-subjects-option.is-full:hover { background: transparent; border-color: var(--border); }
.select-subjects-option[hidden] { display: none; }
.select-subjects-option__body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.select-subjects-option__name { font-weight: 600; font-size: 0.875rem; }
.select-subjects-option__meta { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; font-size: 0.75rem; }
.select-subjects-option__meta .schedule-chip {
    background: #edf4ff;
    color: var(--primary-dark);
    border: 1px solid rgba(15, 108, 191, 0.12);
}
.select-subjects-teacher { color: var(--text-muted); display: inline-flex; align-items: center; gap: 0.3rem; }
.select-subjects-teacher::before {
    content: "\f007";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.7rem;
    opacity: 0.6;
}
.select-subjects-option__seats {
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    color: var(--text-muted);
    background: var(--bg);
}
.select-subjects-option__seats.is-open { color: var(--success); background: #eaf7ec; }
.select-subjects-option__seats.is-near-full { color: var(--warning); background: #fdf1e2; }
.select-subjects-option__seats.is-full { color: var(--danger); background: #fbeae7; }

.select-subjects-summary-count {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.7rem;
    color: var(--text);
}
.select-subjects-summary-list { list-style: none; margin: 0 0 0.75rem; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; font-size: 0.8rem; }
.select-subjects-summary-list li {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 0.7rem;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    color: var(--text);
}

.select-subjects-summary-list li .select-subjects-summary-text {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}
.select-subjects-summary-list li .select-subjects-summary-text::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(15, 108, 191, 0.1);
}
.select-subjects-summary-list li span.select-subjects-summary-text { min-width: 0; }
.select-subjects-summary-remove {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    padding: 0.15rem;
    border-radius: 0.3rem;
}
.select-subjects-summary-remove:hover { color: var(--danger); background: #fbeae7; }
.select-subjects-summary-totals {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.55rem 0;
    border-top: 1px dashed var(--border);
    font-size: 0.85rem;
}
.select-subjects-summary-totals strong { font-size: 1rem; }
.select-subjects-summary-empty {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    padding: 0.6rem 0.7rem;
    margin: 0 0 0.75rem;
}
.select-subjects-summary .btn-primary {
    width: 100%;
    margin-top: 0.75rem;
    border: none;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 8px 18px rgba(15, 108, 191, 0.18);
}
.select-subjects-summary .btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: 0 10px 22px rgba(15, 108, 191, 0.22);
}
.select-subjects-submit-hint { font-size: 0.72rem; color: var(--text-muted); text-align: center; margin: 0.5rem 0 0; }
.select-subjects-conflict-warning {
    margin-top: 0.6rem;
    padding: 0.5rem 0.7rem;
    background: #fbeae7;
    color: var(--danger);
    border-radius: 0.5rem;
    font-size: 0.78rem;
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}
/* An author-stylesheet `display` rule beats the browser's own `[hidden] { display: none }`
   default at equal specificity (author origin always wins over user-agent origin), so setting
   display:flex here without this override meant JS toggling the `hidden` attribute did nothing
   visible — the warning (and its "Two selected sections overlap" text) stayed on screen
   permanently, which is exactly the bug this was reported as. */
.select-subjects-conflict-warning[hidden] { display: none; }

@media (max-width: 900px) {
    .select-subjects-layout { grid-template-columns: 1fr; }
    .select-subjects-rail { position: static; }
}

.select-subjects-picks-preview { display: flex; flex-wrap: wrap; gap: 0.3rem; max-width: 22rem; }

/* Same author-CSS-vs-native-[hidden] issue as select-subjects-conflict-warning above: .btn sets
   display:inline-flex unconditionally, which otherwise beats the browser's default
   [hidden]{display:none} for the schedule form's Cancel button (school/class-schedule.php). */
[data-meeting-form-cancel][hidden] { display: none; }
.course-grid[hidden] { display: none; }

/* ============================================================================
   `hidden` must always win.

   The browser's own [hidden] { display: none } lives in the user-agent sheet, so ANY author
   rule that sets `display` unconditionally outranks it — `.card { display: flex }` silently
   defeats `<div class="card" hidden>`. That has been patched one class at a time all over this
   file (search "[hidden]" — there are ~100 of them, plus three separate comments explaining the
   same surprise). This single rule makes the attribute authoritative everywhere instead, which
   is what `hidden` is supposed to mean, and stops the bug reappearing in new components.

   Placed last, and marked !important, so it also beats same-specificity !important display
   rules (e.g. .pagination-controls) that would otherwise win on source order. The only rules
   that legitimately reference the attribute in the other direction use :not([hidden]), which
   simply stops matching once the element is hidden — so they are unaffected.
   ============================================================================ */
[hidden] { display: none !important; }

/* Attendance schedule setup — one small inline-save form per scope row (school default, staff,
   institute, program, year level), indented to show the institute > program > level nesting. */
.attendance-schedule-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.attendance-schedule-row:last-child { border-bottom: none; }
.attendance-schedule-row__label { flex: 1 1 240px; font-weight: 500; }
.attendance-schedule-row__field {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
}
.attendance-schedule-row__field .form-control { width: auto; }
.attendance-schedule-subgroup { margin-left: 1.25rem; }
.attendance-schedule-subgroup__level { margin-left: 1.25rem; }

/* ID Assignment page — whole row opens the assign/unassign modal. */
.assignment-row { cursor: pointer; }
.assignment-row:focus-visible { outline: 2px solid var(--primary, #2563eb); outline-offset: -2px; }

.assign-modal { position: relative; max-width: 420px; padding: 1.75rem; }
.assign-modal__close {
    position: absolute; top: 0.9rem; right: 0.9rem;
    width: 2rem; height: 2rem; border-radius: 50%; border: none;
    background: transparent; color: var(--ink-2, #64748b); font-size: 1.5rem; line-height: 1;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.assign-modal__close:hover { background: var(--surface-alt, #f1f5f9); }

.assign-modal__header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.assign-modal__avatar {
    flex: 0 0 auto; width: 56px; height: 56px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; font-weight: 800; color: #fff;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
}
.assign-modal__identity { min-width: 0; }
.assign-modal__name { font-size: 1.25rem; font-weight: 800; margin: 0 0 0.15rem; color: var(--ink, #0f172a); }
.assign-modal__role {
    display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--ink-2, #64748b); background: var(--surface-alt, #f1f5f9);
    padding: 0.15rem 0.6rem; border-radius: 999px;
}

.assign-modal__body { border-top: 1px solid var(--border, #e2e8f0); padding-top: 1.25rem; }

.assign-modal__card-chip {
    display: flex; align-items: center; gap: 0.6rem; width: fit-content;
    background: var(--surface-alt, #f1f5f9); border-radius: 10px;
    padding: 0.6rem 1rem; margin-bottom: 1.25rem;
    font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.95rem; font-weight: 600;
}
.assign-modal__card-chip i { color: #2563eb; }

.assign-modal__warning {
    display: flex; align-items: flex-start; gap: 0.5rem;
    background: #fef3c7; color: #92400e; border-radius: 10px;
    padding: 0.7rem 0.9rem; margin: 0 0 1.25rem; font-size: 0.875rem;
}

.assign-modal__cta { width: 100%; justify-content: center; padding-top: 0.75rem; padding-bottom: 0.75rem; }

.assign-modal-hidden-input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.assign-modal__waiting { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0.75rem 0 1.25rem; }
.assign-modal__waiting p { margin: 0.9rem 0 0; font-weight: 600; color: var(--ink-2, #64748b); }
.assign-modal__waiting-ring {
    position: relative;
    width: 64px; height: 64px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
}
.assign-modal__waiting-ring i { color: #fff; font-size: 1.5rem; }
.assign-modal__waiting-ring::before, .assign-modal__waiting-ring::after {
    content: ''; position: absolute; inset: -6px; border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.35);
    animation: assignModalPulse 2s ease-out infinite;
}
.assign-modal__waiting-ring::after { animation-delay: 1s; }
@keyframes assignModalPulse {
    0% { transform: scale(0.9); opacity: 0.9; }
    100% { transform: scale(1.4); opacity: 0; }
}

.assign-modal__actions { display: flex; gap: 0.5rem; justify-content: flex-end; }

/* Cashier scan bar */
.cashier-scan-bar { margin-bottom: 1rem; padding: 0.85rem 1rem; }
.cashier-scan-bar form { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.cashier-scan-bar__label { font-weight: 600; margin: 0; white-space: nowrap; }
.cashier-scan-bar__input { flex: 1 1 260px; font-size: 1.05rem; padding: 0.6rem 0.8rem; }
.cashier-scan-bar__status { margin: 0.5rem 0 0; font-size: 0.85rem; }
.cashier-scan-bar__status.is-error { color: var(--danger, #b91c1c); }
.cashier-scan-bar__filter { margin: 0.5rem 0 0; font-size: 0.85rem; }

/* Cashier point-of-sale terminal */
.moodle-main:has(.pos-app) { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.moodle-main:has(.pos-app) .breadcrumbs { display: none; }
.pos-app {
    --pos-navy: #262b33;
    --pos-slate: #5c6570;
    --pos-red: #e4132f;
    --pos-green: #12b04a;
    display: flex; flex-direction: column; gap: 0.6rem;
    height: calc(100vh - var(--navbar-height) - 1.5rem);
    min-height: 640px;
}
.pos-app button { font-family: inherit; cursor: pointer; }
.pos { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(280px, 5fr) minmax(380px, 7fr); gap: 0.75rem; }

/* left: scan strip + ticket */
.pos-left { display: flex; flex-direction: column; gap: 0.5rem; min-height: 0; }
.pos-app .cashier-scan-bar { margin: 0; padding: 0.5rem 0.75rem; border-radius: 999px; }
.pos-app .cashier-scan-bar form { flex-wrap: nowrap; gap: 0.5rem; }
.pos-app .cashier-scan-bar__label { font-size: 0.85rem; }
.pos-app .cashier-scan-bar__input { flex: 1 1 auto; min-width: 0; font-size: 0.9rem; padding: 0.35rem 0.6rem; }
.pos-app .cashier-scan-bar__status, .pos-app .cashier-scan-bar__filter { margin: 0.35rem 0 0 0.25rem; font-size: 0.8rem; }
.pos-ticket { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--primary); border-radius: 6px; overflow: hidden; }
.pos-ticket__head { padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); }
.pos-ticket__student { display: flex; align-items: center; gap: 0.75rem; }
.pos-ticket__student strong { display: block; font-size: 1.05rem; }
.pos-ticket__student small { color: var(--text-muted); }
.pos-ticket__avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.pos-ticket__lines { flex: 1; min-height: 0; overflow-y: auto; padding: 0.25rem 1rem; }
.pos-ticket__empty { color: var(--text-muted); text-align: center; margin: 3rem 0; }
.pos-ticket__empty i { display: block; font-size: 2rem; margin-bottom: 0.5rem; opacity: 0.5; }
.pos-line { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
.pos-line strong { display: block; font-weight: 700; }
.pos-line small { display: block; color: var(--primary); font-size: 0.8rem; }
.pos-line span { font-weight: 700; text-align: right; white-space: nowrap; }
.pos-ticket__totals { margin: 0.4rem; padding: 0.7rem 0.9rem; background: var(--primary-light); border-radius: 4px; }
.pos-ticket__totals div { display: flex; justify-content: space-between; padding: 0.1rem 0; font-size: 0.85rem; }
.pos-ticket__totals dt { color: var(--text-muted); font-weight: 700; }
.pos-ticket__totals dd { margin: 0; font-weight: 700; color: var(--text-muted); }
.pos-ticket__totals .is-ok { color: var(--primary); }
.pos-ticket__totals .is-short { color: var(--pos-red); }
.pos-ticket__totals .pos-ticket__grand { margin-top: 0.3rem; font-size: 1.5rem; }
.pos-ticket__grand dt, .pos-ticket__grand dd { font-weight: 800; color: var(--text); }
.pos-ticket__actions { display: flex; gap: 0.5rem; }
.pos-btn { position: relative; flex: 1; padding: 0.85rem; border-radius: 6px; border: 1px solid var(--border); font-weight: 800; font-size: 1.05rem; letter-spacing: 0.01em; }
.pos-btn--ghost { background: var(--border); color: var(--text-muted); }
.pos-btn--recall { flex: 0 0 3.4rem; background: var(--pos-navy); color: #fff; border-color: transparent; font-size: 1.2rem; }
.pos-btn__badge { position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 999px; background: #f5b400; color: #111; font-size: 0.72rem; line-height: 20px; }
.pos-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* right: tabs, queue, display, keys */
.pos-pad { display: flex; flex-direction: column; gap: 0.5rem; min-height: 0; background: var(--bg); }
.pos-tabs { display: flex; gap: 0.25rem; align-self: center; padding: 0.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; }
.pos-tab { border: 0; background: transparent; color: var(--text-muted); font-weight: 700; font-size: 0.9rem; padding: 0.45rem 1.1rem; border-radius: 999px; }
.pos-tab.is-active { background: var(--pos-slate); color: #fff; }
.pos-tab__n { display: inline-block; margin-left: 0.25rem; min-width: 1.3rem; padding: 0 0.3rem; border-radius: 999px; background: rgba(127, 127, 127, 0.25); font-size: 0.72rem; line-height: 1.3rem; text-align: center; }
.pos-panels { flex: 1; min-height: 120px; overflow-y: auto; }
.pos-panel[hidden] { display: none; }
.pos-queue__filter { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.pos-queue__search { flex: 1; display: flex; align-items: center; gap: 0.5rem; padding: 0 0.7rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.pos-queue__search input { flex: 1; border: 0; outline: 0; background: transparent; padding: 0.5rem 0; color: var(--text); min-width: 0; }
.pos-queue__filter select { border: 1px solid var(--border); border-radius: 999px; padding: 0.45rem 0.75rem; background: var(--surface); color: var(--text); max-width: 10rem; }
.pos-queue__clear { font-size: 0.85rem; }
.pos-queue__empty { margin: 1.5rem; text-align: center; color: var(--text-muted); }
.pos-queue__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.4rem; }
.pos-tile { display: flex; flex-direction: column; gap: 0.15rem; text-align: left; padding: 0.55rem 0.65rem; background: var(--surface); border: 2px solid var(--border); border-radius: 4px; color: var(--text); min-height: 78px; }
.pos-tile:hover { border-color: var(--primary); }
.pos-tile.is-active { border-color: var(--primary); color: var(--primary); }
.pos-tile__name { font-weight: 700; font-size: 0.88rem; line-height: 1.2; text-align: center; align-self: center; }
.pos-tile__label, .pos-tile__count { font-size: 0.72rem; color: var(--text-muted); text-align: center; align-self: center; }
.pos-tile__label { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; line-height: 1.3; }
.pos-ticket__bill { display: flex; align-items: center; justify-content: space-between; gap: 0.65rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.pos-ticket__bill-check { display: flex; flex: 1; min-width: 0; align-items: center; gap: 0.65rem; cursor: pointer; }
.pos-ticket__bill-check input { width: 1rem; height: 1rem; flex: none; accent-color: var(--primary); }
.pos-ticket__bill-details { display: flex; flex: 1; min-width: 0; flex-direction: column; }
.pos-ticket__bill-details strong { overflow-wrap: anywhere; }
.pos-ticket__bill-details small { color: var(--text-muted); }
.pos-ticket__bill-pay { display: flex; flex: none; flex-direction: column; gap: 0.15rem; width: 7.5rem; }
.pos-ticket__bill-pay small { color: var(--text-muted); font-size: 0.68rem; }
.pos-ticket__bill-pay input { width: 100%; min-width: 0; padding: 0.3rem 0.4rem; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); font: inherit; font-size: 0.85rem; text-align: right; }
.pos-tile__amount { margin-top: auto; font-weight: 800; color: var(--pos-red); text-align: center; align-self: center; }
.pos-panel[data-pos-panel="online"] .cashier-card { margin: 0; }
.pos-panel[data-pos-panel="online"] #onlinePaymentsCard[hidden] { display: block; }

.pos-display { display: flex; align-items: center; gap: 0.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 0.4rem 0.6rem; }
.pos-display__or { display: flex; flex-direction: column; font-size: 0.75rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; width: 15rem; flex: none; }
.pos-display__or input { border: 1px solid var(--border); border-radius: 6px; padding: 0.55rem 0.75rem; font-size: 1.25rem; font-weight: 700; min-height: 3rem; text-transform: none; background: var(--bg); color: var(--text); }
.pos-display__amount-wrap { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 0.1rem; color: var(--text-muted); font-size: 0.68rem; font-weight: 800; text-align: right; text-transform: uppercase; }
.pos-display__amount-input { display: flex; align-items: center; justify-content: flex-end; gap: 0.2rem; color: var(--text); font-size: 2rem; font-variant-numeric: tabular-nums; }
.pos-display__amount-input > span { color: var(--text-muted); opacity: 0.7; }
.pos-display__amount-input input { width: min(100%, 13rem); min-width: 0; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; font-weight: 800; text-align: right; }
.pos-display__amount-input input[readonly] { opacity: 0.8; }
.pos-error { margin: 0; padding: 0.4rem 0.7rem; border-radius: 4px; background: color-mix(in srgb, var(--pos-red) 12%, var(--surface)); color: var(--pos-red); font-weight: 700; font-size: 0.9rem; }

.pos-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.pos-action { min-height: 52px; padding: 0.45rem 0.65rem; border: 1px solid transparent; border-radius: 4px; color: #fff; font: inherit; font-size: 0.95rem; font-weight: 800; cursor: pointer; }
.pos-action:disabled { opacity: 0.4; cursor: not-allowed; }
.pos-action--wallet { background: var(--pos-red); }
.pos-action--exact { background: var(--pos-navy); }
.pos-action--pay { background: var(--pos-green); font-size: 1.1rem; }

/* bottom bar */
.pos-bar { display: flex; align-items: center; gap: 1rem; padding: 0.45rem 0.9rem; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.pos-bar__cashier { display: flex; align-items: center; gap: 0.6rem; min-width: 9rem; }
.pos-bar__cashier strong { display: block; font-size: 0.9rem; line-height: 1.15; }
.pos-bar__cashier small { color: var(--text-muted); font-size: 0.72rem; }
.pos-bar__avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.pos-bar__nav { flex: 1; display: flex; justify-content: center; gap: 0.25rem; flex-wrap: wrap; }
.pos-bar__item { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; min-width: 4.5rem; padding: 0.15rem 0.4rem; border: 0; background: transparent; color: var(--text-muted); font-size: 0.68rem; text-decoration: none; }
.pos-bar__item i { width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; color: var(--primary); }
.pos-bar__item:hover i { background: var(--primary-light); }
.pos-bar__totals { display: flex; gap: 1rem; text-align: right; }
.pos-bar__totals small { display: block; color: var(--text-muted); font-size: 0.68rem; }
.pos-bar__totals strong { font-size: 0.95rem; color: var(--pos-red); }

/* history drawer */
.pos-drawer { position: fixed; inset: 0; z-index: 1100; background: rgba(15, 23, 42, 0.45); display: flex; justify-content: flex-end; }
.pos-drawer[hidden] { display: none; }
.pos-drawer__panel { position: relative; width: min(520px, 100%); height: 100%; overflow-y: auto; background: var(--bg); padding: 1rem; }
.pos-drawer__panel .cashier-card { margin: 2rem 0 0; }
.pos-drawer__close { position: absolute; top: 0.6rem; right: 0.6rem; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--border); color: var(--text); }

@media (max-width: 900px) {
    .pos-app { height: auto; }
    .pos { grid-template-columns: 1fr; }
    .pos-ticket { min-height: 340px; }
    .pos-bar { flex-wrap: wrap; }
    .pos-bar__totals { display: none; }
}
@media (max-width: 520px) {
    .pos-display { flex-wrap: wrap; }
    .pos-display__or { width: 100%; }
    .pos-ticket__bill { align-items: flex-start; flex-wrap: wrap; }
    .pos-ticket__bill-check { min-width: 100%; }
    .pos-ticket__bill-pay { margin-left: auto; }
}

/* Cashier camera popup */
.pos-cam { position: fixed; inset: 0; z-index: 1200; background: rgba(15, 23, 42, 0.6); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.pos-cam[hidden] { display: none; }
.pos-cam__panel { width: min(420px, 100%); background: var(--surface); border-radius: 12px; padding: 0.9rem; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); }
.pos-cam__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.pos-cam__head .pos-drawer__close { position: static; }
.pos-cam__view { position: relative; aspect-ratio: 1 / 1; background: #0b1220; border-radius: 10px; overflow: hidden; }
.pos-cam__view video { width: 100%; height: 100%; object-fit: cover; }
.pos-cam__msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; padding: 1.5rem; text-align: center; color: #fff; }
.pos-cam__msg[hidden] { display: none; }
.pos-cam__hint { margin: 0.6rem 0 0; text-align: center; font-size: 0.85rem; color: var(--text-muted); }

/* Cashier "Scan ID" popup */
button.cashier-scan-bar__label { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
button.cashier-scan-bar__label:hover { color: var(--primary); }
.pos-scanid { text-align: center; }
.pos-scanid__pulse { width: 96px; height: 96px; margin: 0.5rem auto; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2.4rem; color: var(--primary); background: var(--primary-light); animation: pos-scanid-pulse 1.6s ease-out infinite; }
.pos-scanid__title { margin: 0.4rem 0 0; font-size: 1.6rem; font-weight: 800; }
/* Visually hidden but focusable, so the handheld scanner still types into it. */
.pos-scanid__input { position: absolute; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; pointer-events: none; }
@keyframes pos-scanid-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 40%, transparent); } 100% { box-shadow: 0 0 0 26px transparent; } }
@media (prefers-reduced-motion: reduce) { .pos-scanid__pulse { animation: none; } }

/* Billing "Bill Students" register (reuses the cashier POS styles) */
.pos-app--embedded { height: auto; min-height: 0; }
.pos-app--embedded .pos { min-height: 0; }
.pos-app--embedded .pos-ticket__lines { min-height: 0; }
.pos-tile { position: relative; }
.pos-tile[hidden] { display: none; }
.pos-tile__check { position: absolute; top: 6px; right: 6px; color: var(--pos-green, #12b04a); opacity: 0; }
.pos-tile.is-selected { border-color: var(--pos-green, #12b04a); }
.pos-tile.is-selected .pos-tile__check { opacity: 1; }
.pos-tile__amount--ok { color: var(--primary); }
.pos-display__amount.is-default { opacity: 0.6; }
.pos-mini { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 0.4rem 0.85rem; font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.pos-mini:hover { border-color: var(--primary); color: var(--primary); }
.pos-queue__filter { flex-wrap: wrap; }
.pos-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; max-height: 96px; overflow-y: auto; padding: 0.5rem 0.75rem; border-top: 1px solid var(--border); }
.pos-chip { border: 0; border-radius: 999px; background: var(--primary-light); color: var(--primary); font-size: 0.75rem; font-weight: 700; padding: 0.2rem 0.6rem; cursor: pointer; }
.pos-chip i { margin-left: 0.2rem; opacity: 0.7; }
.pos-chip--more { cursor: default; background: var(--border); color: var(--text-muted); }
.pos-btn--link { display: flex; align-items: center; justify-content: center; text-decoration: none; }
@media (max-width: 900px) { .pos-app--embedded .pos { height: auto; } }
.pos { grid-template-rows: minmax(0, 1fr); }
.pos-panels { min-height: 0; }
.pos-app--embedded .pos-queue__grid { align-content: start; }
/* When the layout stacks, the page grows — cap the lists so they scroll inside their own box. */
@media (max-width: 900px) {
    .pos-panels { flex: none; max-height: 55vh; }
    .pos-ticket__lines { max-height: 40vh; }
}
.pos-more { display: block; width: 100%; margin-top: 0.5rem; padding: 0.7rem; border: 1px dashed var(--border); border-radius: 6px; background: var(--surface); color: var(--primary); font-weight: 700; cursor: pointer; }
.pos-more:hover { border-color: var(--primary); }
.pos-more[hidden] { display: none; }
#bpStudentGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(84px, auto); }
#bpStudentGrid .pos-tile__name, #bpStudentGrid .pos-tile__label { overflow-wrap: anywhere; }
#bpStudentGrid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); grid-auto-rows: 84px; gap: 0.5rem; }
#bpStudentGrid .pos-tile { min-height: 0; height: 100%; align-items: center; justify-content: center; text-align: center; padding: 0.5rem 1.4rem; overflow: hidden; }
#bpStudentGrid .pos-tile__name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: break-word; width: 100%; }
#bpStudentGrid .pos-tile__label { display: block; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; -webkit-line-clamp: unset; }
#billPos .pos-panels { scrollbar-width: none; padding-right: 0; }
#billPos .pos-panels::-webkit-scrollbar { display: none; }
@media (min-width: 901px) { #billPos .pos .pos-panels { flex: 1 1 0; height: 0; min-height: 0; max-height: none; overflow-y: auto; } #billPos .pos .pos-ticket__lines { max-height: none; } }
#bpStudentGrid { padding-top: 0.15rem; }
.pos-pager { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.5rem; font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.pos-pager[hidden] { display: none; }
.pos-pager .pos-mini:disabled { opacity: 0.4; cursor: not-allowed; }
.pos-display__or--amount { flex: 1; width: auto; }
.pos-display__or--amount input { font-size: 1.1rem; font-weight: 700; text-align: right; }

/* Billing flow: Students > Billing > Review > Confirm */
.pos-steps { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.pos-steps li { flex: 1; min-width: 0; }
.pos-step { width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.45rem 0.4rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-muted); font-weight: 700; font-size: 0.85rem; }
.pos-step__n { display: inline-flex; align-items: center; justify-content: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--border); color: var(--text-muted); font-size: 0.75rem; flex: none; }
.pos-step.is-active { background: var(--pos-slate); color: #fff; border-color: transparent; }
.pos-step.is-active .pos-step__n { background: #fff; color: var(--pos-slate); }
.pos-step.is-done { color: var(--pos-green, #12b04a); cursor: pointer; }
.pos-step.is-done .pos-step__n { background: var(--pos-green, #12b04a); color: #fff; }
.pos-step:disabled { cursor: default; opacity: 0.7; }
.pos-tabs[hidden], .pos-stepnav [hidden] { display: none; }
.pos-review__h { margin: 0.2rem 0 0.4rem; font-size: 0.9rem; font-weight: 800; color: var(--text); }
.pos-review__students { display: flex; flex-wrap: wrap; gap: 0.3rem; max-height: 9rem; overflow-y: auto; margin-bottom: 0.75rem; }
.pos-review__lines { margin-bottom: 0.75rem; }
.pos-confirm { display: flex; flex-direction: column; align-items: stretch; gap: 0.5rem; text-align: center; }
.pos-confirm__icon { font-size: 2rem; color: var(--pos-green, #12b04a); }
.pos-confirm__h { margin: 0; font-size: 1.1rem; font-weight: 800; }
.pos-confirm__text { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.pos-stepnav { display: flex; gap: 0.5rem; }
.pos-stepnav .pos-btn { flex: 0 0 7rem; }
.pos-stepnav .pos-bill { flex: 1; width: auto; }
.pos-bill { width: 100%; min-height: 64px; grid-column: auto; }

/* Cashier payment confirmation */
.pos-confirm__lines { max-height: 32vh; overflow-y: auto; margin: 0.5rem 0; }
.pos-confirm__totals { margin: 0.5rem 0; padding: 0.6rem 0.8rem; background: var(--primary-light); border-radius: 6px; }
.pos-confirm__totals div { display: flex; justify-content: space-between; padding: 0.15rem 0; }
.pos-confirm__totals dt { color: var(--text-muted); font-weight: 600; }
.pos-confirm__totals dd { margin: 0; font-weight: 700; }
.pos-confirm__change dd { color: var(--primary); }
.pos-confirm__note { font-size: 0.8rem; margin: 0.25rem 0 0; }

/* Bill Students register: fee-item and group lists scroll inside their own box instead of stretching the page. */
#billPos .pos-panels { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
@media (max-width: 900px) { #billPos .pos-panels { max-height: 50vh; } }
#billPos .pos-ticket__lines { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 900px) { #billPos .pos-ticket__lines { max-height: 40vh; } }

/* POS bottom bar: one tidy row (identity | shortcuts | totals) instead of wrapping "Online" onto a second line. */
.pos-bar { flex-wrap: nowrap; gap: 0.75rem; padding: 0.4rem 0.85rem; }
.pos-bar__cashier { flex: 0 1 190px; min-width: 0; }
.pos-bar__cashier > div { min-width: 0; }
.pos-bar__cashier strong, .pos-bar__cashier small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-bar__avatar { flex: none; }
.pos-bar__nav { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; justify-content: center; gap: 0.1rem; overflow-x: auto; scrollbar-width: none; }
.pos-bar__nav::-webkit-scrollbar { display: none; }
.pos-bar__item { flex: 0 1 4.4rem; min-width: 3.4rem; padding: 0.15rem 0.2rem; white-space: nowrap; }
.pos-bar__item span { display: block; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pos-bar__totals { flex: 0 0 auto; gap: 1rem; padding-left: 0.75rem; border-left: 1px solid var(--border); }
.pos-bar__totals strong { white-space: nowrap; }
@media (max-width: 1100px) { .pos-bar__totals { display: flex; } }
@media (max-width: 900px) { .pos-bar__cashier > div { display: none; } .pos-bar__cashier { flex: none; } .pos-bar__totals { padding-left: 0.5rem; gap: 0.6rem; } }
@media (max-width: 560px) { .pos-bar__totals small { display: none; } .pos-bar__item { min-width: 3rem; } }

.pos-billing-opts[hidden] { display: none; }
.pos-billing-opts { flex-wrap: wrap; }

/* Bill Students, step 3 (Confirm): hide the left ticket and let the summary use the full width. */
#billPos.is-confirm-step .pos { grid-template-columns: 1fr; }
#billPos.is-confirm-step .pos-left { display: none; }

.pos-confirm__students { display: flex; flex-wrap: wrap; gap: 0.3rem; max-height: 9.5rem; overflow-y: auto; margin: 0.6rem 0; padding: 0.55rem 0.65rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.pos-confirm__students[hidden] { display: none; }
.pos-chip--static { cursor: default; }

/* Confirm step: the totals stay pinned to the bottom of the panel while the bill lines scroll. */
#billPos .pos-confirm .pos-ticket__totals { position: sticky; bottom: 0; z-index: 2; margin: 0.6rem 0 0; background: var(--primary-light); box-shadow: 0 -8px 10px -6px rgba(15, 23, 42, 0.18); }

/* Bill Students: the search / class-group / category bar stays put while only the lists below it scroll. */
#billPos .pos-queue__filter { position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 0.15rem 0 0.5rem; margin-bottom: 0; }

/* Bill Students: fill the remaining viewport so the ticket totals, Clear/Cancel, and Next stay on screen. */
@media (min-width: 901px) {
    .moodle-main:has(#billPos) {
        display: flex;
        flex-direction: column;
        height: calc(100dvh - var(--navbar-height));
        max-height: calc(100dvh - var(--navbar-height));
        min-height: 0;
        overflow: hidden;
        padding-top: 0.75rem;
        padding-bottom: 0.5rem;
    }
    .moodle-main:has(#billPos) .toast-container,
    .moodle-main:has(#billPos) .academic-year-banner {
        flex: 0 0 auto;
    }
    .moodle-main:has(#billPos) .page-content {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        padding-bottom: 0;
    }
    .moodle-main:has(#billPos) .registrar-tabs-wrap:not(.registrar-tabs-wrap--inline) {
        flex: 0 0 auto;
        margin-bottom: 0.5rem;
    }
    .moodle-main:has(#billPos) .registrar-tabs-wrap--inline {
        flex: 0 0 auto;
        margin-bottom: 0.45rem;
    }
    #billPos.pos-app--embedded {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
        overflow: hidden;
        gap: 0.5rem;
    }
    #billPos .pos {
        flex: 1 1 auto;
        min-height: 0;
        height: auto;
    }
    #billPos .pos-left,
    #billPos .pos-pad {
        min-height: 0;
        height: 100%;
        overflow: hidden;
    }
    #billPos .pos-ticket {
        min-height: 0;
        overflow: hidden;
    }
    #billPos .pos-ticket__empty {
        margin: 1.25rem 0;
    }
    #billPos .pos-ticket__actions,
    #billPos .pos-stepnav,
    #billPos .pos-bar,
    #billPos .pos-billing-opts,
    #billPos .pos-error,
    #billPos .pos-steps,
    #billPos .pos-tabs {
        flex: 0 0 auto;
    }
}

@media (min-width: 901px) and (max-height: 780px) {
    #billPos .pos-ticket__head { padding: 0.45rem 0.75rem; }
    #billPos .pos-ticket__totals { margin: 0.3rem; padding: 0.45rem 0.7rem; }
    #billPos .pos-ticket__totals .pos-ticket__grand { font-size: 1.25rem; }
    #billPos .pos-step { padding: 0.35rem 0.35rem; }
    #billPos .pos-bill { min-height: 48px; }
}

/* ==========================================================================
   Mobile: cashier and billing point-of-sale screens (Cashier, Bill Students)
   Everything below is inside max-width media queries, so desktop is untouched — except the
   "Next" / "Confirm & Bill" button, which had lost its styling and is restyled at every width.
   ========================================================================== */

/* The Bill Students "Next" / "Confirm & Bill" buttons still carried the old numpad classes (.pos-key)
   whose rules no longer exist, so they rendered as plain grey boxes. */
.pos-bill { min-height: 52px; border: 0; border-radius: 4px; background: var(--pos-green, #12b04a); color: #fff; font: inherit; font-size: 1.1rem; font-weight: 800; cursor: pointer; }
.pos-bill:disabled { opacity: 0.45; cursor: not-allowed; }
.pos-stepnav .pos-btn { min-height: 52px; }

@media (max-width: 900px) {
    /* One column, in the order a cashier works: find the student -> see the bill -> pay. */
    .moodle-main:has(.pos-app) { padding-left: 0.6rem; padding-right: 0.6rem; }
    .pos-app { height: auto; min-height: 0; gap: 0.6rem; }
    .pos, .pos-app--embedded .pos { display: flex; flex-direction: column; gap: 0.6rem; height: auto; min-height: 0; grid-template-rows: none; }
    .pos-left, .pos-pad { display: contents; }
    .pos-app .cashier-scan-bar { order: 1; }
    .pos-steps { order: 2; }
    .pos-tabs { order: 3; }
    .pos-panels { order: 4; }
    .pos-billing-opts { order: 5; }
    .pos-ticket { order: 6; min-height: 0; flex: none; }
    .pos-ticket__actions { order: 7; }
    .pos-display { order: 8; }
    .pos-error { order: 9; }
    .pos-actions, .pos-stepnav { order: 10; }
    .pos-ticket__lines { max-height: 34dvh; min-height: 0; }
    .pos-ticket__empty { margin: 1.25rem 0; }
    .pos-ticket__totals .pos-ticket__grand { font-size: 1.35rem; }

    /* The pay / next controls stay reachable while the list above them scrolls. */
    .pos-actions, .pos-stepnav {
        position: sticky; bottom: 0; z-index: 40;
        margin: 0 -0.6rem; padding: 0.5rem 0.6rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
        background: var(--bg); box-shadow: 0 -10px 14px -10px rgba(15, 23, 42, 0.3);
    }
    .pos-actions { grid-template-columns: 1fr 1fr 1fr 1.35fr; gap: 0.4rem; }
    .pos-action { min-height: 52px; padding: 0.3rem 0.2rem; font-size: 0.8rem; line-height: 1.15; }
    .pos-action--pay { font-size: 1rem; }

    /* Tabs and steps: one full-width row that scrolls instead of wrapping. */
    .pos-tabs { align-self: stretch; overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .pos-tabs::-webkit-scrollbar { display: none; }
    .pos-tab { flex: 1 0 auto; min-height: 40px; padding: 0.4rem 0.8rem; white-space: nowrap; }
    .pos-step { min-height: 40px; }

    /* Filter bar: the search box gets its own row; controls share the next. */
    .pos-queue__filter { flex-wrap: wrap; gap: 0.4rem; }
    .pos-queue__search { flex: 1 1 100%; }
    .pos-queue__filter select { flex: 1 1 0; min-width: 0; max-width: none; min-height: 40px; }
    .pos-mini { min-height: 40px; padding: 0.4rem 0.9rem; }

    /* Tiles: two per row, finger-sized. */
    .pos-queue__grid, #bpStudentGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
    .pos-tile { min-height: 84px; padding: 0.6rem 0.55rem; }
    .pos-chip { min-height: 34px; padding: 0.3rem 0.7rem; }

    /* Inputs at 16px so iOS Safari does not zoom the page when one is focused. */
    .pos-queue__search input, .pos-queue__filter select, .pos-display__or input, .pos-ticket__bill-pay input,
    .pos-app .cashier-scan-bar__input, .pos-display__amount-input input { font-size: 16px; }
    .pos-display__or input { min-height: 40px; }
    .pos-display__amount-input { font-size: 1.6rem; }
    .pos-display__or { width: auto; flex: 1 1 8rem; }

    /* Nothing on these screens is smaller than 12px. */
    .pos-app small, .pos-app .pos-tile__label, .pos-app .pos-tile__count, .pos-app .pos-tab__n,
    .pos-app .pos-display__or, .pos-app .pos-display__amount-wrap, .pos-app .pos-btn__badge,
    .pos-app .pos-ticket__bill-pay small, .pos-app .pos-bar__item, .pos-app .pos-bar__totals small { font-size: 0.75rem; }
    .pos-btn, .pos-btn--recall { min-height: 48px; }

    /* Bottom bar: identity + totals on the first row, shortcuts across the second. */
    .pos-bar { flex-wrap: wrap; row-gap: 0.4rem; padding: 0.5rem 0.6rem; }
    .pos-bar__cashier { flex: 1 1 auto; min-width: 0; }
    .pos-bar__cashier > div { display: block; }
    .pos-bar__totals { display: flex; flex: 0 0 auto; gap: 0.8rem; padding-left: 0; border-left: 0; }
    .pos-bar__totals small { display: block; }
    .pos-bar__nav { order: 3; flex: 1 0 100%; justify-content: space-between; overflow: visible; gap: 0; }
    .pos-bar__item { flex: 1 1 0; min-width: 0; min-height: 44px; }
    .pos-bar__item span { overflow: visible; text-overflow: clip; white-space: normal; text-align: center; line-height: 1.1; }

    /* Charge Center: options strip and confirm summary use the full width. */
    .pos-billing-opts { flex-wrap: wrap; }
    .pos-confirm__students { max-height: 7rem; }
}

@media (max-width: 600px) {
    /* Dialogs become bottom sheets. */
    .or-number-modal { place-items: end center; padding: 0; }
    .or-number-modal__panel, .or-number-modal__panel--wide {
        max-width: none; width: 100%; max-height: 92dvh; margin: 0;
        border-radius: 1rem 1rem 0 0; padding: 1.1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    }
    .or-number-modal__actions { flex-direction: column-reverse; gap: 0.5rem; }
    .or-number-modal__actions .btn { width: 100%; min-height: 46px; justify-content: center; }
    .or-number-modal input.form-control, .or-number-modal select.form-control { font-size: 16px; min-height: 44px; }
    .pos-cam { align-items: flex-end; padding: 0; }
    .pos-cam__panel { width: 100%; max-width: none; border-radius: 1rem 1rem 0 0; padding-bottom: calc(0.9rem + env(safe-area-inset-bottom, 0px)); }
    .pos-drawer__panel { width: 100%; padding: 0.75rem; }
    .pos-drawer__close { width: 44px; height: 44px; }
}

@media (max-width: 400px) {
    .pos-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .pos-actions .pos-action--pay { grid-column: 1 / -1; order: -1; min-height: 56px; font-size: 1.1rem; }
    .pos-tab { padding: 0.4rem 0.6rem; font-size: 0.85rem; }
    .pos-bar__totals { gap: 0.6rem; }
}

/* Mobile: the other Billings / Cashier pages (Overview, Records, Fee Catalog, Auto Bill, Online, AR summary, Transactions, Report).
   They already stack correctly; this raises small text to 12px and small controls to a finger-sized 40px. */
@media (max-width: 600px) {
    .fin-stat-tile__label, .fin-stat-tile__sub, .fee-chip__count, .fee-cat-pill, .fee-status, .fin-row__or,
    .fin-row__status, .billing-group__badge, .billing-group__batch-label, .fin-tab-count,
    .admin-table-card table th, .admin-table-card small.text-muted, .fin-row__meta small { font-size: 0.75rem; }
    .admin-table-card .btn, .admin-page-header .btn, .billing-filter-form .btn, .cashier-card .btn, .billing-group .btn, .fin-row .btn, .table-action-btn, .fee-chip, .registrar-tab,
    .billing-filter-form__clear, .page-secondary-action, .pagination-controls a, .pagination-controls button { min-height: 40px; }
    .table-action-btn { min-width: 40px; }
    .billing-filter-form .form-control, .admin-table-search .form-control, .admin-table-card .form-control,
    .cashier-report-filter-form .form-control, .or-number-modal .form-control { font-size: 16px; min-height: 42px; }
}

/* Mobile round 2: finger-sized controls on the register and on the Billings / Cashier admin pages, and the bottom-bar label. */
.pos-bar .pos-bar__short { display: none; }
@media (max-width: 600px) {
    .pos-bar .pos-bar__long { display: none; }
    .pos-bar .pos-bar__short { display: inline; }
}
@media (max-width: 900px) {
    .pos-app .cashier-scan-bar__label, .pos-app .cashier-scan-bar .btn { min-height: 40px; display: inline-flex; align-items: center; }
    .pos-app input:not([type="checkbox"]):not([type="radio"]) { min-height: 40px; }
    .pos-display__amount-input input { min-height: 44px; }
    .pos-chip { min-height: 40px; }
}
@media (max-width: 600px) {
    /* Scoped to the Billings tabs pages, the register screens and the cashier report/transactions pages. */
    .moodle-main:is(:has(.registrar-tabs a[href*="/school/billing"]), :has(.pos-app), :has(.cashier-card), :has(.cashier-report-filter-form)) :is(.btn, .btn-sm) { min-height: 40px; }
    .moodle-main:is(:has(.registrar-tabs a[href*="/school/billing"]), :has(.pos-app), :has(.cashier-card), :has(.cashier-report-filter-form)) .form-control { font-size: 16px; min-height: 42px; }
    .moodle-main:is(:has(.registrar-tabs a[href*="/school/billing"]), :has(.cashier-card), :has(.cashier-report-filter-form)) :is(.fin-stat-tile__label, .fin-stat-tile__sub, small, .badge, .section-tab__badge, .charge-type-tab__note) { font-size: 0.75rem; }
    .moodle-main:has(.registrar-tabs a[href*="/school/billing"]) button.billing-group__toggle { min-height: 44px; }
}

/* Charge Center > External Billing type tabs: finger-sized on phones. */
@media (max-width: 600px) { .charge-type-tab { min-height: 40px; } }

@media (max-width: 900px) { .pos-display.pos-billing-opts { order: 5; } }

/* Touch tablets (up to 900px): same finger-sized controls as phones on the Billings / Cashier pages. */
@media (max-width: 900px) {
    .moodle-main:is(:has(.registrar-tabs a[href*="/school/billing"]), :has(.pos-app), :has(.cashier-card), :has(.cashier-report-filter-form)) :is(.btn, .btn-sm) { min-height: 40px; }
    .moodle-main:is(:has(.registrar-tabs a[href*="/school/billing"]), :has(.pos-app), :has(.cashier-card), :has(.cashier-report-filter-form)) .form-control { font-size: 16px; min-height: 42px; }
    .moodle-main:is(:has(.registrar-tabs a[href*="/school/billing"]), :has(.pos-app), :has(.cashier-card), :has(.cashier-report-filter-form)) :is(.table-action-btn, .fee-chip, .pagination-page, .pagination-btn) { min-height: 40px; min-width: 40px; }
}

@media (max-width: 900px) {
    .moodle-main:has(.registrar-tabs a[href*="/school/billing"]) :is(.registrar-tab, .billing-filter-form__clear) { min-height: 40px; }
    .moodle-main:has(.registrar-tabs a[href*="/school/billing"]) button.billing-group__toggle { min-height: 44px; }
}

/* ============================================================================
   Attendance workspace (Logs, Kiosk Locations, Schedules, ID Assignment).
   Shared att-* pieces: status pills, person cell, chips/tabs, filter bar.
   ============================================================================ */
.att-status {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.15rem 0.6rem; border-radius: 999px;
    font-size: 0.75rem; font-weight: 700; line-height: 1.5; white-space: nowrap;
}
.att-status--ok { background: #e8f5e9; color: var(--success); }
.att-status--late { background: #fdecea; color: var(--danger); }
.att-status--early { background: #fff4e6; color: var(--warning); }
.att-status--none { background: #f1f3f5; color: var(--text-muted); }

.att-person { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.att-avatar {
    flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary-light); color: var(--primary);
    font-size: 0.78rem; font-weight: 800; letter-spacing: 0.02em;
}
.att-person__text { display: flex; flex-direction: column; min-width: 0; }
.att-person__text strong { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-person__text small { color: var(--text-muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.att-table-scroll { overflow-x: auto; }
.att-table td { vertical-align: middle; }
.att-table__muted { color: var(--text-muted); }
.att-table__time { text-align: right; white-space: nowrap; }
.att-table__time strong { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
.att-table__time small { color: var(--text-muted); font-size: 0.78rem; }
.att-table__action { text-align: right; width: 1%; white-space: nowrap; }

.att-type { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 600; font-size: 0.85rem; white-space: nowrap; }
.att-type i { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; }
.att-type--in i { background: #e8f5e9; color: var(--success); }
.att-type--out i { background: #eef0f3; color: #475569; }

/* Today summary strip (Logs) */
.att-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.att-stat {
    display: flex; align-items: center; gap: 0.8rem;
    padding: 0.9rem 1rem; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.att-stat__icon { flex: none; width: 2.4rem; height: 2.4rem; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; }
.att-stat__icon--blue { background: var(--primary-light); color: var(--primary); }
.att-stat__icon--purple { background: #f3e8ff; color: #7c3aed; }
.att-stat__icon--green { background: #e8f5e9; color: var(--success); }
.att-stat__icon--orange { background: #fff4e6; color: var(--warning); }
.att-stat__value { font-size: 1.4rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.att-stat__label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }

.att-live {
    display: inline-flex; align-items: center; gap: 0.35rem; margin-left: 0.5rem; vertical-align: middle;
    padding: 0.1rem 0.55rem; border-radius: 999px; background: #e8f5e9; color: var(--success);
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.att-live__dot { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor; animation: att-pulse 1.8s ease-in-out infinite; }
@keyframes att-pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .att-live__dot { animation: none; } }

/* Tabs (card filter) */
.att-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; }
.att-tab {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.35rem 0.85rem; border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface); color: var(--text); font-size: 0.8125rem; font-weight: 600; text-decoration: none;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.att-tab:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.att-tab.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.att-tab__n { min-width: 1.4rem; padding: 0 0.35rem; border-radius: 999px; background: rgba(127, 127, 127, 0.16); font-size: 0.72rem; line-height: 1.35rem; text-align: center; }
.att-tab.is-active .att-tab__n { background: rgba(255, 255, 255, 0.25); }

/* Filter bar: a grid so every field lines up; search takes two columns. The explicit width matters:
   the stacked card head is a wrapping column flexbox, which otherwise measures this form's height at a
   narrower shrink-to-fit width and leaves an empty band above the fields. */
.att-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); align-items: end; gap: 0.6rem; width: 100%; margin: 0; }
.att-filters__search { grid-column: span 2; }
@media (min-width: 1200px) {
    /* Wide enough for one row: search, four filters, then the buttons. */
    .att-filters { grid-template-columns: minmax(12rem, 2fr) repeat(4, minmax(8rem, 1fr)) auto; }
    .att-filters__search { grid-column: auto; }
}
.att-filters__search .admin-table-search { display: block; max-width: none; min-width: 0; }
/* One control height across the row, so labelled fields and the unlabelled search line up. */
.att-filters .form-control { height: 2.4rem; padding-top: 0; padding-bottom: 0; font-size: 0.8125rem; border-radius: 999px; background: var(--bg); }
.att-filters__actions .btn { height: 2.4rem; display: inline-flex; align-items: center; padding: 0 1rem; border-radius: 999px; }
.att-filters__field { display: flex; flex-direction: column; gap: 0.2rem; margin: 0; }
.att-filters__field > span { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.att-filters__field .form-control { width: 100%; min-width: 0; padding-left: 0.85rem; padding-right: 0.65rem; }
.att-filters__field .admin-table-search .form-control { padding-left: 2rem; }
.att-filters__actions { display: flex; gap: 0.4rem; }

/* Logs toolbar: date segmented control on the left, search + two dropdowns on the right; the
   From/To row only appears for a custom range. width: 100% keeps the stacked card head (a wrapping
   column flexbox) from measuring these rows at a narrower width. */
.att-logbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; width: 100%; }
.att-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); }
.att-seg__item {
    display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.8rem; border-radius: 999px;
    color: var(--text-muted); font-size: 0.8125rem; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.att-seg__item:hover { color: var(--text); text-decoration: none; }
.att-seg__item.is-active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }
.att-logbar__filters { display: flex; flex: 1 1 540px; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.5rem; margin: 0; }
.att-logbar__filters .form-control { height: 2.25rem; padding-top: 0; padding-bottom: 0; font-size: 0.8125rem; border-radius: 999px; background: var(--surface); }
.att-logbar__search.admin-table-search { flex: 1 1 200px; min-width: 0; max-width: none; }
.att-logbar__select { margin: 0; }
.att-logbar__select .form-control { width: auto; min-width: 8.5rem; padding-left: 0.85rem; padding-right: 2rem; }
.att-logbar__reset { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); text-decoration: none; }
.att-logbar__reset:hover { color: var(--danger); text-decoration: none; }
.att-logbar__custom {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; width: 100%;
    padding: 0.6rem 0.75rem; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface);
}
.att-logbar__custom label { display: inline-flex; align-items: center; gap: 0.45rem; margin: 0; font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); }
.att-logbar__custom .form-control { width: auto; height: 2.25rem; padding-top: 0; padding-bottom: 0; font-size: 0.8125rem; }

/* Kiosk Locations: card grid */
.att-loc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 1rem; }
.att-loc {
    display: flex; flex-direction: column; gap: 0.9rem; padding: 1.1rem 1.15rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.att-loc.is-inactive { background: var(--surface-2); }
.att-loc.is-inactive .att-loc__icon { background: #f1f3f5; color: var(--text-muted); }
.att-loc__head { display: flex; align-items: center; gap: 0.7rem; }
.att-loc__icon { flex: none; width: 2.4rem; height: 2.4rem; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; background: var(--primary-light); color: var(--primary); }
.att-loc__name { flex: 1; min-width: 0; margin: 0; font-size: 1rem; font-weight: 700; overflow-wrap: anywhere; }
.att-loc__link { display: flex; flex-direction: column; gap: 0.3rem; }
.att-loc__link-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.att-loc__actions { display: flex; gap: 0.5rem; margin-top: auto; padding-top: 0.8rem; border-top: 1px solid var(--border); }
.att-loc__actions form { margin: 0; }
.att-loc--add {
    align-items: center; justify-content: center; min-height: 180px;
    border: 2px dashed var(--border); background: transparent; box-shadow: none;
    color: var(--text-muted); font-weight: 700; text-decoration: none;
}
.att-loc--add i { font-size: 1.3rem; }
.att-loc--add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); text-decoration: none; }
.att-loc-form { margin-bottom: 1rem; }

.att-copy { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.att-copy__input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0.45rem 0.65rem; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.78rem; color: var(--text); }
.att-copy__input:focus { outline: none; }
.att-copy__btn {
    flex: none; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0 0.7rem;
    border: 0; border-left: 1px solid var(--border); background: var(--surface);
    color: var(--primary); font-size: 0.78rem; font-weight: 700; text-decoration: none; cursor: pointer;
}
.att-copy__btn:hover { background: var(--primary-light); text-decoration: none; }
.att-copy__btn.is-copied { color: var(--success); }

/* Schedules */
.att-sched-priority {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem;
    padding: 0.75rem 1rem; margin-bottom: 1rem;
    background: var(--primary-light); border-radius: var(--radius-lg); font-size: 0.85rem;
}
.att-sched-priority__label { font-weight: 700; color: var(--primary); }
.att-sched-priority__steps { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin: 0; padding: 0; list-style: none; counter-reset: att-step; }
.att-sched-priority__steps li { counter-increment: att-step; display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--surface); font-weight: 600; }
.att-sched-priority__steps li::before { content: counter(att-step); font-size: 0.7rem; color: var(--text-muted); }
.att-sched-priority__steps li + li { margin-left: 1rem; position: relative; }
.att-sched-priority__steps li + li::after { content: "›"; position: absolute; left: -0.85rem; color: var(--text-muted); font-weight: 700; }
.att-sched-priority__note { color: var(--text-muted); }

.att-sched-top { display: grid; gap: 1rem; margin-bottom: 1.25rem; }
.att-sched-card { margin: 0; }
.att-sched-card h3 { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.25rem; font-size: 1rem; }
.att-sched-card h3 i { color: var(--primary); }

.att-sched-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem;
    padding: 0.7rem 0.5rem; margin: 0 -0.5rem; border-bottom: 1px solid var(--border); border-radius: var(--radius);
    transition: background 0.2s;
}
.att-sched-row:last-child { border-bottom: 0; }
.att-sched-row.is-dirty { background: #fffbeb; }
.att-sched-row.is-saved { animation: att-saved 2.4s ease-out; }
@keyframes att-saved { 0%, 40% { background: #e8f5e9; } 100% { background: transparent; } }
.att-sched-row__label { flex: 1 1 220px; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; min-width: 0; }
.att-sched-row__label strong { font-weight: 600; }
.att-sched-row__label small { flex-basis: 100%; font-size: 0.78rem; }
.att-sched-row__field { display: flex; flex-direction: column; gap: 0.15rem; margin: 0; }
.att-sched-row__field > span { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.att-sched-row__field .form-control { width: 8.5rem; }
.att-sched-row__minutes.form-control { width: 6rem; }
.att-sched-row__save { align-self: flex-end; min-width: 4.5rem; }
.att-sched-row__save:disabled { opacity: 0.4; cursor: default; }

.att-sched-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.6rem; }
.att-sched-toolbar h2 { margin: 0; font-size: 1.05rem; }

.att-sched-group { margin-bottom: 0.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.att-sched-group > summary {
    display: flex; align-items: center; gap: 0.6rem; padding: 0.85rem 1.1rem;
    cursor: pointer; list-style: none; border-radius: var(--radius-lg);
}
.att-sched-group > summary::-webkit-details-marker { display: none; }
.att-sched-group > summary:hover { background: var(--surface-2); }
.att-sched-group > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.att-sched-group__chev { color: var(--text-muted); font-size: 0.75rem; transition: transform 0.15s; }
.att-sched-group[open] .att-sched-group__chev { transform: rotate(90deg); }
.att-sched-group__name { font-weight: 700; }
.att-sched-group__kind { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.att-sched-group__count { margin-left: auto; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.att-sched-group__count.has-set { color: var(--success); }
.att-sched-group__body { padding: 0 1.1rem 0.6rem; border-top: 1px solid var(--border); }
.att-sched-program { padding-left: 1rem; border-left: 2px solid var(--primary-light); margin: 0.4rem 0; }
.att-sched-levels { padding-left: 1rem; border-left: 2px dashed var(--border); margin-left: 0.25rem; }

/* ID Assignment */
.att-coverage { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.25rem; padding: 0.9rem 1.1rem; margin-bottom: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.att-coverage__text { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.att-coverage__text strong { font-size: 1.05rem; }
.att-coverage__bar { flex: 1 1 200px; height: 0.5rem; border-radius: 999px; background: #eef0f3; overflow: hidden; }
.att-coverage__bar span { display: block; height: 100%; border-radius: inherit; background: var(--success); transition: width 0.3s; }

.att-role { display: inline-block; padding: 0.12rem 0.55rem; border-radius: 999px; background: #f1f3f5; color: #475569; font-size: 0.75rem; font-weight: 600; }
.att-card-uid { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.6rem; border-radius: var(--radius); background: var(--primary-light); color: var(--primary); font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.8rem; font-weight: 600; }
.att-row-action { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--text-muted); font-size: 0.8125rem; font-weight: 600; }
.att-row-action i { font-size: 0.7rem; }
.att-row-action--primary { color: var(--primary); }
.assignment-row:hover { background: var(--surface-2); }
.assignment-row:hover .att-row-action { color: var(--primary); }

@media (max-width: 900px) {
    .att-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .att-seg { width: 100%; }
    .att-seg__item { flex: 1 1 auto; justify-content: center; }
    .att-logbar__search.admin-table-search { flex-basis: 100%; max-width: none; }
    .att-logbar__select { flex: 1 1 0; }
    .att-logbar__select .form-control { width: 100%; min-width: 0; }
    .att-stat { padding: 0.7rem; gap: 0.6rem; }
    .att-stat__icon { width: 2rem; height: 2rem; }
    .att-stat__value { font-size: 1.15rem; }
    .att-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .att-sched-row__field { flex: 1 1 calc(50% - 0.5rem); }
    .att-sched-row__field .form-control { width: 100%; }
    .att-sched-row__save { flex-basis: 100%; }
    .att-table__time small { display: block; }
}

/* Bill Students: compact step bar and Fee items / Group billing switch */
#billPos .pos-steps { gap: 0.2rem; }
#billPos .pos-step { gap: 0.3rem; padding: 0.25rem 0.45rem; font-size: 0.78rem; }
#billPos .pos-step__n { width: 1.1rem; height: 1.1rem; font-size: 0.66rem; }
#billPos .pos-step .pos-tab__n { min-width: 1.1rem; line-height: 1.1rem; font-size: 0.66rem; }
#billPos .pos-tabs { padding: 0.15rem; gap: 0.15rem; }
#billPos .pos-tab { padding: 0.25rem 0.75rem; font-size: 0.8rem; }
#billPos .pos-tab .pos-tab__n { min-width: 1.1rem; line-height: 1.1rem; font-size: 0.66rem; }

/* Bill Students ticket, step 2: due date + editable bill lines */
.pos-ticket__opts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.75rem; padding: 0.45rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.pos-ticket__opts label { display: flex; align-items: center; gap: 0.45rem; margin: 0; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); }
.pos-ticket__opts input { height: 1.95rem; padding: 0 0.5rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; font-size: 0.85rem; font-weight: 600; text-transform: none; letter-spacing: 0; }
.pos-ticket__opts input:focus { outline: none; border-color: var(--primary); }
.pos-ticket__opts small { flex: 1 1 12rem; color: var(--text-muted); font-size: 0.72rem; line-height: 1.3; }
.pos-line--edit { display: grid; grid-template-columns: minmax(0, 1fr) 6.75rem auto auto; align-items: center; gap: 0.5rem; }
.pos-line__main { min-width: 0; }
.pos-line__title { width: 100%; margin-left: -0.3rem; padding: 0.15rem 0.3rem; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--text); font: inherit; font-weight: 700; }
.pos-line__title:hover { border-color: var(--border); background: var(--surface); }
.pos-line__title:focus { outline: none; border-color: var(--primary); background: var(--surface); }
.pos-line__amt { display: flex; align-items: center; gap: 0.2rem; margin: 0; padding: 0 0.45rem; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); }
.pos-line__amt:focus-within { border-color: var(--primary); }
.pos-line .pos-line__amt span { font-weight: 600; color: var(--text-muted); font-size: 0.8rem; }
.pos-line__amt input { width: 100%; min-width: 0; padding: 0.3rem 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-weight: 700; font-size: 0.85rem; text-align: right; }
.pos-line__remove { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; flex: none; border: 0; border-radius: 50%; background: transparent; color: var(--text-muted); }
.pos-line__remove:hover { background: #fdecea; color: #c0392b; }
.pos-line--group { align-items: flex-start; }
.pos-line--group > div { flex: 1; min-width: 0; }
.pos-line__items { list-style: none; margin: 0.3rem 0 0; padding: 0 0 0 0.6rem; border-left: 2px solid var(--border); font-size: 0.75rem; color: var(--text-muted); }
.pos-line__items li { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.05rem 0; }
.pos-line .pos-line__items span { font-weight: 500; white-space: normal; text-align: left; }
.pos-line .pos-line__items span:last-child { flex: none; white-space: nowrap; }
@media (max-width: 520px) {
    .pos-line--edit { grid-template-columns: minmax(0, 1fr) auto auto; }
    .pos-line--edit .pos-line__main { grid-column: 1 / -1; }
}
