:root {
    --bg: #f3f5fb;
    --surface: #ffffff;
    --surface-soft: #f8f9fd;
    --surface-strong: #eef2fb;
    --border: #e4e9f3;
    --border-strong: #d7deeb;
    --text: #232a36;
    --text-soft: #6e778b;
    --heading: #171d28;
    --primary: #3a5af0;
    --primary-dark: #2f48c8;
    --primary-soft: #eef2ff;
    --success-soft: #f0fbf3;
    --success-border: #ccefd6;
    --danger-soft: #fff2f3;
    --danger-border: #f5c7ce;
    --shadow: 0 18px 45px rgba(29, 40, 79, 0.08);
    --shadow-soft: 0 10px 24px rgba(29, 40, 79, 0.06);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 18px;
    --radius-sm: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-width: 320px;
    background: linear-gradient(180deg, #f7f9ff 0%, #f3f5fb 180px, #f3f5fb 100%);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    line-height: 1.55;
}
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
h1, h2, h3, h4, p { margin: 0; }

.container-wide {
    width: min(1240px, calc(100% - 40px));
    margin: 0 auto;
}

.page-shell { padding: 28px 0 72px; }
.content-section + .content-section { margin-top: 24px; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(220, 226, 239, 0.9);
}

.header-inner {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 27px;
    font-weight: 800;
    color: var(--heading);
    letter-spacing: -0.04em;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, #3c5cf1, #5f83ff);
    color: #fff;
    font-size: 20px;
    box-shadow: 0 10px 22px rgba(58, 90, 240, 0.22);
}

.main-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px 18px;
}

.main-nav > a,
.link-button {
    color: var(--text-soft);
    font-weight: 600;
    transition: color 120ms ease;
}

.main-nav > a:hover,
.link-button:hover,
.account-link:hover { color: var(--heading); }

.link-button {
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.logout-form { margin: 0; }

.nav-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary) !important;
    font-weight: 700;
}

.nav-primary:hover { background: #e5ebff; }

.account-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px 6px 6px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
}

.topbar-avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    object-fit: cover;
    border-radius: 50%;
    background: #dce3f8;
}

.topbar-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #536fe7, #3b54d8);
    font-size: 15px;
    font-weight: 700;
}

.account-copy {
    display: grid;
    gap: 2px;
}
.account-copy strong {
    font-size: 14px;
    color: var(--heading);
}
.account-copy span {
    font-size: 12px;
    color: var(--text-soft);
}

.messages {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
}

.message,
.error {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}
.message.success { background: var(--success-soft); border-color: var(--success-border); }
.message.error,
.error { background: var(--danger-soft); border-color: var(--danger-border); }
.message.info { background: #f4f7ff; border-color: #d7e2ff; }

.section-kicker,
.session-date,
.assignment-date {
    display: inline-flex;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.page-intro,
.hero-surface,
.form-card,
.sidebar-card,
.modern-card,
.settings-card,
.profile-sidebar-card,
.empty-state-card,
.empty-access-card,
.feature-card,
.hero-preview-card,
.auth-simple-card,
.catalog-card {
    border-radius: var(--radius-xl);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.page-intro,
.hero-surface,
.empty-access-card {
    padding: 34px;
}

.hero-surface,
.course-hero {
    display: grid;
    gap: 24px;
}

.hero-home {
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.7fr);
    align-items: stretch;
}

.hero-copy h1,
.page-intro h1,
.auth-heading h1,
.section-header h2,
.settings-card-heading h2,
.form-card-heading h2,
.profile-avatar-block h2 {
    margin-top: 10px;
    color: var(--heading);
    font-size: clamp(34px, 4vw, 54px);
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.page-intro h1,
.section-header h2,
.settings-card-heading h2,
.form-card-heading h2,
.profile-avatar-block h2,
.auth-simple-card h1 {
    font-size: clamp(30px, 4vw, 42px);
}

.hero-copy p,
.page-intro p,
.auth-heading p,
.settings-card-heading p,
.form-card-heading p,
.profile-side-note p,
.feature-card p,
.catalog-card p,
.empty-state-card p,
.empty-access-card p,
.session-notes,
.task-statement,
.legal-note {
    margin-top: 14px;
    color: var(--text-soft);
    font-size: 16px;
}

.hero-preview-stack {
    display: grid;
    gap: 16px;
}

.hero-preview-card {
    padding: 22px;
    background: linear-gradient(180deg, #fff, #f8faff);
}
.hero-preview-card span {
    display: block;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.hero-preview-card strong {
    display: block;
    margin-top: 8px;
    color: var(--heading);
    font-size: 20px;
    line-height: 1.3;
}
.hero-preview-card-accent {
    border-color: #d8e2ff;
    background: linear-gradient(180deg, #f8faff, #eef3ff);
}
.hero-preview-card-muted {
    background: linear-gradient(180deg, #fff, #fbfbfd);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.button,
.small-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 20px;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
    transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.button:hover,
.small-button:hover { transform: translateY(-1px); }
.button-primary,
.small-button {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 14px 30px rgba(58, 90, 240, 0.22);
}
.button-primary:hover,
.small-button:hover { background: var(--primary-dark); }
.button-secondary,
.small-button.secondary {
    background: var(--surface-soft);
    color: var(--heading);
    border: 1px solid var(--border);
    box-shadow: none;
}
.button-secondary:hover,
.small-button.secondary:hover { background: #eef2fb; }
.button-full { width: 100%; }
.small-button {
    min-height: 40px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 14px;
}

.content-section { margin-top: 26px; }
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.section-header h2 { margin-top: 6px; }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}
.feature-card {
    padding: 26px;
    background: linear-gradient(180deg, #fff, #fafbff);
}
.feature-card h3 {
    color: var(--heading);
    font-size: 22px;
    letter-spacing: -0.03em;
}

.auth-simple-shell {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.auth-simple-card {
    width: min(520px, 100%);
    padding: 34px;
}
.auth-simple-card-wide { width: min(640px, 100%); }
.auth-heading.compact h1 { margin-top: 6px; }
.auth-heading-centered { text-align: center; }
.auth-kicker {
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.auth-kicker-dark { color: var(--text-soft); }
.auth-footer {
    margin-top: 22px;
    color: var(--text-soft);
    font-size: 15px;
}
.auth-footer-centered { text-align: center; }
.auth-footer a { color: var(--primary); font-weight: 700; }
.legal-note.compact { margin-top: 20px; font-size: 14px; text-align: center; }

.form-stack { display: grid; gap: 18px; }
.form-grid { display: grid; gap: 18px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-field { display: grid; gap: 8px; }
.form-field-full { grid-column: 1 / -1; }
.form-field > span:first-child,
.form-field strong {
    color: var(--heading);
    font-size: 14px;
    font-weight: 700;
}
.form-field small {
    color: var(--text-soft);
    line-height: 1.55;
}
.form-field small ul { margin: 8px 0 0 18px; padding: 0; }
.field-error {
    color: #d65d69;
    font-size: 13px;
}

.form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-field select,
.form-field textarea,
.course-create-form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.course-create-form select,
.course-create-form textarea {
    width: 100%;
    min-height: 52px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border-strong);
    background: var(--surface-soft);
    color: var(--text);
    outline: none;
    transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.form-field input::placeholder,
.form-field textarea::placeholder,
.course-create-form input::placeholder,
.course-create-form textarea::placeholder {
    color: #9ca6ba;
}

.form-field textarea,
.course-create-form textarea {
    min-height: 126px;
    resize: vertical;
}
.form-field input[type="file"] {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px dashed var(--border-strong);
    background: var(--surface-soft);
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.course-create-form input:focus,
.course-create-form select:focus,
.course-create-form textarea:focus {
    background: #fff;
    border-color: #96a8ff;
    box-shadow: 0 0 0 4px rgba(58, 90, 240, 0.08);
}

.checkbox-tile {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
}
.checkbox-tile input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    accent-color: var(--primary);
}

.password-input-wrap { position: relative; display: block; }
.password-input-wrap input {
    width: 100%;
    padding-right: 52px !important;
}
.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #7d8598;
    cursor: pointer;
}
.password-toggle:hover {
    color: var(--primary);
    background: #edf2ff;
}
.eye-icon {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.eye-closed { display: none; }
.password-toggle.is-visible .eye-open { display: none; }
.password-toggle.is-visible .eye-closed { display: block; }

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}
.catalog-card { overflow: hidden; }
.catalog-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.catalog-card-cover {
    position: relative;
    min-height: 210px;
    padding: 18px;
    overflow: hidden;
    background: linear-gradient(140deg, #eef2ff, #d9e2ff);
}
.catalog-card[data-type="individual"] .catalog-card-cover {
    background: linear-gradient(140deg, #effaf3, #d6f0df);
}
.catalog-card[data-type="asynchronous"] .catalog-card-cover {
    background: linear-gradient(140deg, #fff3eb, #ffe4d2);
}
.catalog-card[data-type="hybrid"] .catalog-card-cover {
    background: linear-gradient(140deg, #f4eeff, #e4d8ff);
}
.catalog-card-cover-ui {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.catalog-card-type,
.catalog-card-status {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--heading);
    font-size: 12px;
    font-weight: 700;
}
.catalog-card-status {
    color: var(--text-soft);
    max-width: 46%;
    justify-content: center;
    text-align: center;
}
.catalog-card-illustration {
    position: absolute;
    inset: auto 22px 18px auto;
    width: 160px;
    height: 112px;
}
.catalog-card-illustration span {
    position: absolute;
    display: block;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(255, 255, 255, 0.36);
}
.catalog-card-illustration span:nth-child(1) {
    right: 0;
    bottom: 0;
    width: 118px;
    height: 76px;
}
.catalog-card-illustration span:nth-child(2) {
    right: 18px;
    bottom: 18px;
    width: 72px;
    height: 24px;
}
.catalog-card-illustration span:nth-child(3) {
    left: 0;
    top: 18px;
    width: 62px;
    height: 62px;
    border-radius: 22px;
}
.catalog-card-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
}
.catalog-card-copy { display: grid; gap: 12px; }
.catalog-card-body h2 {
    color: var(--heading);
    font-size: 28px;
    line-height: 1.1;
    letter-spacing: -0.035em;
}
.catalog-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
}
.catalog-card-footer-stack {
    flex-direction: column;
    align-items: stretch;
}
.catalog-meta {
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.5;
}
.catalog-card-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.course-hero {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.48fr);
    align-items: start;
}
.course-hero-meta {
    display: grid;
    gap: 12px;
}
.meta-pill {
    padding: 18px;
    border-radius: 18px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
}
.meta-pill strong {
    display: block;
    color: var(--heading);
    font-size: 14px;
    font-weight: 700;
}
.meta-pill span {
    display: block;
    margin-top: 8px;
    color: var(--text-soft);
}

.course-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}
.sticky-card {
    position: sticky;
    top: 94px;
}
.sidebar-card,
.profile-sidebar-card,
.settings-card,
.form-card,
.modern-card,
.empty-state-card,
.empty-access-card {
    padding: 26px;
}
.sidebar-card-title {
    color: var(--heading);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.sidebar-group + .sidebar-group {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}
.sidebar-group-title {
    margin-bottom: 12px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}
.sidebar-list li a,
.sidebar-empty {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--surface-soft);
}
.sidebar-list li a:hover { background: #edf2ff; }
.sidebar-list li a span { color: var(--heading); font-weight: 600; }
.sidebar-list li a small,
.sidebar-empty { color: var(--text-soft); font-size: 12px; }

.modern-list,
.task-list,
.lesson-list { display: grid; gap: 18px; }
.session-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}
.session-main { flex: 1 1 auto; }
.session-card h3,
.assignment-card h3,
.module h3 {
    margin-top: 8px;
    color: var(--heading);
    font-size: 25px;
    letter-spacing: -0.03em;
}
.session-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    min-width: 220px;
}
.assignment-header {
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.task-card {
    padding: 20px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
}
.task-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.task-heading h4 {
    font-size: 20px;
    color: var(--heading);
    letter-spacing: -0.02em;
}
.response-type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
}
.task-tex {
    margin-top: 14px;
    padding: 14px 16px;
    overflow-x: auto;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--border);
    font-family: "Times New Roman", serif;
    font-size: 18px;
}
.task-images {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    margin-top: 16px;
}
.task-image { margin: 0; }
.task-image img {
    display: block;
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--border);
}
.task-image figcaption {
    margin-top: 6px;
    color: var(--text-soft);
    font-size: 12px;
}
.modern-lesson {
    padding: 16px 18px;
    border-radius: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    color: var(--heading);
    font-weight: 600;
}
.muted { color: var(--text-soft); }

.profile-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}
.profile-avatar-block {
    display: grid;
    justify-items: center;
    gap: 18px;
    text-align: center;
}
.profile-avatar-large {
    width: 184px;
    height: 184px;
    object-fit: cover;
    border-radius: 50%;
    background: #dbe2fa;
    box-shadow: 0 14px 26px rgba(60, 79, 152, 0.12);
}
.profile-avatar-placeholder-large {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #566fe8, #334fd3);
}
.profile-avatar-block p {
    margin-top: 6px;
    color: var(--text-soft);
}
.profile-side-note {
    margin-top: 26px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.profile-side-note h3 {
    color: var(--heading);
    font-size: 20px;
    letter-spacing: -0.02em;
}
.settings-column { display: grid; gap: 24px; }
.settings-card-heading,
.form-card-heading,
.auth-heading { margin-bottom: 22px; }
.settings-card-heading h2,
.form-card-heading h2 { margin-top: 0; }

.course-create-form { display: grid; gap: 24px; }
.modern-form-layout { max-width: 980px; }
.course-type-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.course-type-option {
    position: relative;
    display: block;
    cursor: pointer;
}
.course-type-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.course-type-option-body {
    display: block;
    min-height: 130px;
    padding: 18px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}
.course-type-option-body strong {
    display: block;
    color: var(--heading);
    font-size: 18px;
    margin-bottom: 8px;
}
.course-type-option-body small {
    display: block;
    color: var(--text-soft);
}
.course-type-option:hover .course-type-option-body { border-color: #cbd5ff; }
.course-type-option input:checked + .course-type-option-body {
    background: #f2f5ff;
    border-color: #8fa4ff;
    box-shadow: 0 0 0 4px rgba(58, 90, 240, 0.08);
}
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}
.form-actions.left { justify-content: flex-start; }

.empty-state-card h3,
.empty-access-card h2 {
    color: var(--heading);
    font-size: 28px;
    letter-spacing: -0.03em;
}
.empty-access-card .actions { margin-top: 20px; }

@media (max-width: 1080px) {
    .hero-home,
    .course-hero,
    .course-layout,
    .profile-layout { grid-template-columns: 1fr; }
    .sticky-card { position: static; }
}

@media (max-width: 860px) {
    .feature-grid,
    .form-grid-2,
    .course-type-picker { grid-template-columns: 1fr; }

    .header-inner {
        align-items: flex-start;
        padding: 12px 0;
    }

    .main-nav { justify-content: flex-end; }
    .account-copy { display: none; }
    .course-hero-meta { grid-template-columns: 1fr; }
    .session-card {
        flex-direction: column;
    }
    .session-actions {
        min-width: 0;
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .container-wide { width: min(1240px, calc(100% - 24px)); }
    .page-shell { padding-top: 18px; }
    .page-intro,
    .hero-surface,
    .form-card,
    .sidebar-card,
    .modern-card,
    .settings-card,
    .profile-sidebar-card,
    .empty-state-card,
    .empty-access-card,
    .feature-card,
    .hero-preview-card,
    .auth-simple-card,
    .catalog-card-body {
        padding: 22px;
    }
    .catalog-card-cover { min-height: 180px; }
    .brand { font-size: 23px; }
    .brand-mark { width: 38px; height: 38px; }
    .main-nav { gap: 8px 14px; }
    .page-intro h1,
    .hero-copy h1,
    .auth-heading h1,
    .section-header h2,
    .settings-card-heading h2,
    .form-card-heading h2,
    .profile-avatar-block h2 { font-size: 30px; }
}

/* UI refresh v6 */
.compact-intro {
    padding: 28px 34px;
}

.catalog-intro {
    margin-bottom: 24px;
}

.auth-simple-shell-spacious {
    min-height: calc(100vh - 190px);
    align-items: center;
}

.auth-card-reference {
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 20px 50px rgba(33, 51, 96, 0.1);
}

.auth-form-stack {
    margin-top: 22px;
}

.button-large {
    min-height: 54px;
    font-size: 15px;
}

.course-hero-refined {
    background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.course-layout-refined {
    margin-top: 26px;
}

.course-structure-card {
    background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
}

.sidebar-course-name {
    margin-top: 8px;
    color: var(--heading);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.02em;
}

.profile-layout-enhanced .profile-sidebar-card {
    padding-top: 34px;
}

.profile-layout-enhanced .settings-card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.profile-layout-enhanced .profile-avatar-block h2 {
    margin: 0;
}

.profile-layout-enhanced .profile-avatar-block p {
    margin-top: 4px;
}

.profile-layout-enhanced .profile-side-note {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
}

.task-images {
    display: grid;
}

.message.info {
    display: inline-flex;
    align-items: center;
}

@media (max-width: 860px) {
    .compact-intro {
        padding: 24px;
    }

    .auth-simple-shell-spacious {
        min-height: auto;
    }
}

/* Course creation & global spacing refresh v7 */
.page-shell {
    padding: 36px 0 88px;
}

.page-intro.compact-intro {
    padding: 34px 38px;
    margin-bottom: 28px;
}

.modern-form-layout {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
}

.course-create-form {
    gap: 28px;
}

.form-card,
.settings-card,
.profile-sidebar-card {
    padding: 32px;
}

.form-card-heading,
.settings-card-heading {
    margin-bottom: 26px;
}

.form-card-heading p,
.settings-card-heading p {
    margin-top: 8px;
    max-width: 760px;
}

.form-grid,
.form-stack {
    gap: 22px;
}

.form-grid-2 {
    column-gap: 24px;
    row-gap: 22px;
}

.form-field {
    gap: 10px;
}

.course-type-picker {
    gap: 16px;
}

.course-type-option-body {
    min-height: 118px;
    padding: 20px 22px;
}

.schedule-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.schedule-heading-row .button {
    flex: 0 0 auto;
}

.schedule-list {
    display: grid;
    gap: 12px;
}

.schedule-empty {
    display: grid;
    gap: 4px;
    min-height: 118px;
    place-content: center;
    text-align: center;
    padding: 24px;
    border: 1px dashed var(--border-strong);
    border-radius: 18px;
    background: var(--surface-soft);
    color: var(--text-soft);
}

.schedule-empty strong {
    color: var(--heading);
    font-size: 17px;
}

.schedule-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-soft);
}

.schedule-item-main {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.schedule-item-main > div:last-child {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.schedule-item-main strong {
    color: var(--heading);
    font-size: 16px;
}

.schedule-item-main span,
.schedule-item-main a {
    color: var(--text-soft);
    font-size: 13px;
}

.schedule-item-main a {
    color: var(--primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 520px;
}

.schedule-item-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 800;
}

.schedule-item-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.small-button.danger {
    color: #c64857;
    background: #fff4f5;
    border-color: #f2cbd1;
}

.sticky-form-actions {
    padding: 4px 0 0;
}

.modal-open {
    overflow: hidden;
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(18, 24, 39, 0.44);
    backdrop-filter: blur(5px);
}

.modal-dialog {
    width: min(620px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 28px 80px rgba(20, 29, 55, 0.22);
}

.modal-header,
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 28px;
}

.modal-header {
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin-top: 5px;
    color: var(--heading);
    font-size: 26px;
    letter-spacing: -0.03em;
}

.modal-body {
    padding: 28px;
}

.modal-footer {
    justify-content: flex-end;
    border-top: 1px solid var(--border);
    background: var(--surface-soft);
}

.icon-button {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 12px;
    background: var(--surface-soft);
    color: var(--text-soft);
    font-size: 25px;
    cursor: pointer;
}

.icon-button:hover {
    background: var(--surface-strong);
    color: var(--heading);
}

.schedule-meta-pill {
    min-width: 240px;
}

@media (max-width: 760px) {
    .page-shell {
        padding: 22px 0 56px;
    }

    .page-intro.compact-intro,
    .form-card,
    .settings-card,
    .profile-sidebar-card {
        padding: 24px;
    }

    .schedule-heading-row,
    .schedule-item {
        align-items: stretch;
        flex-direction: column;
    }

    .schedule-heading-row .button,
    .schedule-item-actions .small-button {
        width: 100%;
    }

    .schedule-item-actions {
        width: 100%;
    }

    .modal-backdrop {
        padding: 12px;
        place-items: end center;
    }

    .modal-dialog {
        width: 100%;
        border-radius: 22px 22px 0 0;
        max-height: 92vh;
    }
}

.catalog-grid > .empty-state-card {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 170px;
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 30px 34px;
}

.page-intro + .catalog-grid,
.page-intro + .profile-layout,
.page-intro + .course-layout {
    margin-top: 28px;
}

/* Layout rhythm & course form polish v8 */
:root {
    --space-card-x: 32px;
    --space-card-y: 30px;
    --space-section: 24px;
    --space-field: 9px;
}

.page-shell {
    padding: 34px 0 84px;
}

.page-intro.compact-intro,
.form-card,
.settings-card,
.profile-sidebar-card,
.sidebar-card,
.modern-card,
.empty-state-card,
.empty-access-card {
    padding: var(--space-card-y) var(--space-card-x);
}

.page-intro.compact-intro {
    margin-bottom: var(--space-section);
}

.course-create-form,
.modern-form-layout {
    gap: var(--space-section);
}

.form-card-heading,
.settings-card-heading {
    margin: 0 0 24px;
}

.form-card-heading h2,
.settings-card-heading h2 {
    margin: 0;
}

.form-card-heading p,
.settings-card-heading p {
    margin: 8px 0 0;
    line-height: 1.45;
}

.form-grid,
.form-stack {
    gap: 20px;
}

.form-grid-2 {
    column-gap: 20px;
    row-gap: 20px;
}

.form-field {
    gap: var(--space-field);
    align-content: start;
}

.form-field > span:first-child,
.form-field > label:first-child,
.end-date-field > label:first-child {
    min-height: 20px;
    display: flex;
    align-items: flex-end;
}

.form-field small {
    margin: 0;
    line-height: 1.4;
}

.form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-field select,
.form-field textarea,
.course-create-form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.course-create-form select,
.course-create-form textarea {
    width: 100%;
}

.end-date-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    column-gap: 14px;
    row-gap: 9px;
}

.end-date-field > label:first-child,
.end-date-field > .field-error {
    grid-column: 1 / -1;
}

.end-date-field > input[type="date"] {
    grid-column: 1;
}

.inline-check.end-date-undefined {
    grid-column: 2;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 50px;
    margin: 0;
    white-space: nowrap;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
}

.inline-check.end-date-undefined input {
    width: 16px;
    height: 16px;
    margin: 0;
}

.form-field input.is-disabled {
    color: var(--text-soft);
    background: #f0f2f7;
    border-color: var(--border);
    cursor: not-allowed;
}

.schedule-builder-card {
    display: grid;
    gap: 22px;
}

.schedule-heading-row {
    margin: 0;
}

.schedule-list {
    gap: 10px;
}

.schedule-item {
    padding: 16px 18px;
    gap: 18px;
}

.schedule-item-main {
    gap: 0;
    min-width: 0;
}

.schedule-item-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.schedule-item-copy strong {
    color: var(--heading);
    font-size: 16px;
}

.schedule-item-copy > span,
.schedule-item-copy > a {
    font-size: 13px;
}

.schedule-item-icon {
    display: none !important;
}

.schedule-meeting-link {
    display: inline-flex;
    width: fit-content;
    color: var(--primary);
    font-weight: 600;
}

.schedule-meeting-link:hover {
    text-decoration: underline;
}

.sticky-form-actions {
    padding-top: 0;
    gap: 10px;
}

.catalog-card-body {
    padding: 24px;
}

.catalog-card-copy {
    display: grid;
    gap: 10px;
}

.catalog-card-footer {
    margin-top: 22px;
}

@media (max-width: 760px) {
    :root {
        --space-card-x: 22px;
        --space-card-y: 22px;
    }

    .end-date-field {
        grid-template-columns: 1fr;
    }

    .end-date-field > label:first-child,
    .end-date-field > input[type="date"],
    .inline-check.end-date-undefined,
    .end-date-field > .field-error {
        grid-column: 1;
    }

    .inline-check.end-date-undefined {
        min-height: auto;
    }
}

/* Course editing toolkit v9 */
.catalog-card-cover.has-image {
    position: relative;
    overflow: hidden;
    background: #dfe5f5;
}

.catalog-card-cover-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.catalog-card-cover.has-image::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(18, 26, 52, 0.04), rgba(18, 26, 52, 0.28));
    pointer-events: none;
}

.catalog-card-cover.has-image .catalog-card-cover-ui {
    position: relative;
    z-index: 2;
}

.course-cover-field input[type="file"],
.content-editor-form input[type="file"] {
    padding: 11px 12px;
    background: #fff;
}

.course-cover-editor-preview {
    display: grid;
    grid-template-columns: minmax(0, 320px) 1fr;
    gap: 18px;
    align-items: center;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-soft);
}

.course-cover-editor-preview img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 12px;
}

.course-admin-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    padding: 18px 22px;
    margin-bottom: 18px;
    border: 1px solid #d8e0f2;
    border-radius: 18px;
    background: #eef3ff;
}

.course-admin-toolbar strong {
    display: block;
    margin-top: 4px;
    color: var(--heading);
    font-size: 18px;
}

.course-admin-toolbar-actions,
.assignment-admin-actions,
.admin-content-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.course-admin-toolbar-actions form,
.assignment-admin-actions form,
.admin-content-actions form,
.session-actions form {
    margin: 0;
}

.course-hero-with-cover {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr);
    gap: 26px;
    align-items: start;
}

.course-hero-with-cover .course-hero-meta {
    grid-column: 1 / -1;
}

.course-hero-cover img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 18px;
    border: 1px solid var(--border);
}

.content-editor-form,
.assignment-task-editor {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
}

.assignment-task-editor {
    margin-top: 24px;
}

.admin-content-list {
    display: grid;
    gap: 12px;
}

.admin-content-item {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-soft);
}

.admin-content-copy {
    min-width: 0;
}

.admin-content-copy p {
    margin: 8px 0 0;
}

.admin-content-copy code {
    display: block;
    margin-top: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #53627d;
}

.admin-content-copy small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
}

.session-title-row,
.assignment-header-admin {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.draft-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #fff2d6;
    color: #866218;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.session-notes-block {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.session-notes-block h4 {
    margin: 0 0 8px;
    font-size: 15px;
}

.text-link {
    display: inline-flex;
    margin-top: 10px;
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
}

.task-image-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
}

.task-image-admin-item {
    display: grid;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
}

.task-image-admin-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
}

@media (max-width: 820px) {
    .course-admin-toolbar,
    .admin-content-item,
    .session-title-row,
    .assignment-header-admin {
        align-items: stretch;
        flex-direction: column;
    }

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

    .course-hero-with-cover .course-hero-meta {
        grid-column: auto;
    }

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

.existing-file-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
}

/* ===== Admin workspace v10: compact, functional editing ===== */
.admin-workspace {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    width: min(1120px, 100%);
    margin: 0 auto;
}

.admin-workspace-sidebar {
    position: sticky;
    top: 98px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
}

.admin-workspace-course {
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--border);
}

.admin-sidebar-kicker {
    display: block;
    margin-bottom: 5px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.admin-workspace-course strong {
    display: block;
    color: var(--heading);
    font-size: 16px;
    line-height: 1.35;
}

.admin-sidebar-nav {
    display: grid;
    padding: 8px;
    gap: 3px;
}

.admin-sidebar-nav a {
    display: grid;
    gap: 2px;
    padding: 10px 11px;
    border-radius: 11px;
    color: var(--text-soft);
}

.admin-sidebar-nav a span {
    color: inherit;
    font-size: 14px;
    font-weight: 700;
}

.admin-sidebar-nav a small {
    color: #98a1b2;
    font-size: 11px;
}

.admin-sidebar-nav a:hover,
.admin-sidebar-nav a.is-active {
    background: var(--primary-soft);
    color: var(--primary);
}

.admin-sidebar-danger {
    padding: 10px 18px 18px;
    border-top: 1px solid var(--border);
}

.admin-sidebar-danger form { margin: 0; }

.admin-danger-link {
    border: 0;
    padding: 0;
    background: transparent;
    color: #c94355;
    font-weight: 700;
    cursor: pointer;
}

.admin-danger-link:hover { text-decoration: underline; }

.admin-workspace-main {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
}

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

.admin-editor-header h1 {
    margin-top: 3px;
    color: var(--heading);
    font-size: 27px;
    line-height: 1.15;
    letter-spacing: -.035em;
}

.admin-editor-header p {
    margin-top: 5px;
    color: var(--text-soft);
    font-size: 13px;
}

.admin-editor-header-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 8px;
}

.button-compact {
    min-height: 36px !important;
    padding: 7px 13px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
}

.admin-editor-form { margin: 0; }

.admin-editor-section {
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
}

.admin-editor-section:last-child { border-bottom: 0; }

.admin-editor-section-title {
    margin-bottom: 15px;
}

.admin-editor-section-title.row-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.admin-editor-section-title h2 {
    color: var(--heading);
    font-size: 18px;
    line-height: 1.25;
    letter-spacing: -.02em;
}

.admin-editor-section-title p {
    margin-top: 4px;
    color: var(--text-soft);
    font-size: 12px;
}

.admin-editor-fields {
    display: grid;
    gap: 14px;
}

.admin-editor-fields.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-editor-fields .span-2 { grid-column: 1 / -1; }

.admin-workspace .form-field {
    gap: 6px;
}

.admin-workspace .form-field > span:first-child,
.admin-workspace .form-field > label:first-child {
    font-size: 12px;
}

.admin-workspace .form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.admin-workspace .form-field select,
.admin-workspace .form-field textarea,
.admin-workspace input[type="date"],
.admin-workspace input[type="datetime-local"] {
    min-height: 42px;
    padding: 9px 11px;
    border-radius: 10px;
}

.admin-workspace .form-field textarea {
    min-height: 92px;
}

.admin-workspace .form-field small {
    font-size: 11px;
    line-height: 1.4;
}

.compact-course-type-picker {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.compact-type-option .course-type-option-body {
    min-height: 46px;
    padding: 10px 11px;
}

.compact-type-option .course-type-option-body strong { font-size: 12px; }

.cover-editor-compact {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
}

.cover-editor-compact img,
.cover-editor-placeholder {
    width: 150px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
}

.cover-editor-placeholder {
    display: grid;
    place-items: center;
    color: var(--text-soft);
    font-size: 11px;
}

.cover-editor-controls {
    display: grid;
    justify-items: start;
    gap: 7px;
}

.file-input-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
}

.upload-picker {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 42px;
    overflow: hidden;
    border: 1px dashed var(--border-strong);
    border-radius: 10px;
    background: var(--surface-soft);
    cursor: pointer;
}

.upload-picker:hover {
    border-color: #aeb9d1;
    background: #f5f7fc;
}

.upload-picker-button {
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0 12px;
    border-right: 1px solid var(--border);
    background: #fff;
    color: var(--heading);
    font-size: 12px;
    font-weight: 700;
}

.upload-picker-name {
    min-width: 0;
    overflow: hidden;
    padding: 0 12px;
    color: var(--text-soft);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-picker-wide { max-width: 560px; }

.existing-file-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-soft);
    font-size: 12px;
}

.existing-file-compact > a {
    color: var(--primary);
    font-weight: 700;
}

.compact-check {
    gap: 6px !important;
    font-size: 11px;
}

.compact-check input { width: 14px; height: 14px; }

.compact-schedule-list {
    gap: 7px;
}

.compact-schedule-list .schedule-item {
    padding: 11px 12px;
    border-radius: 10px;
    box-shadow: none;
}

.compact-schedule-list .schedule-item-copy {
    gap: 1px;
}

.compact-schedule-list .schedule-item-copy strong { font-size: 13px; }
.compact-schedule-list .schedule-item-copy span,
.compact-schedule-list .schedule-meeting-link { font-size: 11px; }

.compact-empty-state {
    display: grid;
    justify-items: center;
    gap: 3px;
    padding: 22px;
    border: 1px dashed var(--border-strong);
    border-radius: 11px;
    background: var(--surface-soft);
    color: var(--text-soft);
    text-align: center;
}

.compact-empty-state strong {
    color: var(--heading);
    font-size: 13px;
}

.compact-empty-state span { font-size: 11px; }

.compact-modal { max-width: 620px; }

/* Assignment task list */
.assignment-builder-section { border-top: 0; }

.compact-content-list {
    display: grid;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.compact-content-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.compact-content-row:last-child { border-bottom: 0; }

.compact-content-index {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
}

.compact-content-main { min-width: 0; }
.compact-content-title { color: var(--heading); font-size: 13px; font-weight: 800; }
.compact-content-preview {
    overflow: hidden;
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.compact-content-meta { margin-top: 3px; color: #9aa3b3; font-size: 10px; }
.compact-content-actions { display: flex; align-items: center; gap: 5px; }
.compact-content-actions form { margin: 0; }

.icon-text-button {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 9px;
    background: #fff;
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.icon-text-button:hover { background: var(--surface-soft); }
.icon-text-button.danger { color: #c94355; border-color: var(--danger-border); }
.icon-text-button.danger:hover { background: var(--danger-soft); }

/* Unified task editor */
.task-workspace-main { overflow: visible; }

.task-editor-shell {
    border-bottom: 1px solid var(--border);
}

.task-editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 18px;
    background: var(--surface-soft);
    border-bottom: 1px solid var(--border);
}

.compact-field-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
}

.compact-field-inline select {
    min-height: 34px;
    padding: 5px 30px 5px 9px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 12px;
}

.task-tex-tools { display: flex; gap: 5px; }

.editor-tool-button {
    min-height: 32px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 5px 9px;
    background: #fff;
    color: var(--text-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    cursor: pointer;
}

.editor-tool-button:hover { color: var(--primary); border-color: #b9c4ff; background: var(--primary-soft); }

.task-editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 390px;
}

.task-editor-pane {
    min-width: 0;
    background: #fff;
}

.task-editor-pane + .task-editor-pane { border-left: 1px solid var(--border); }

.task-editor-pane-title {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.task-editor-input {
    display: block;
    width: 100%;
    min-height: 310px !important;
    resize: vertical;
    border: 0 !important;
    border-radius: 0 !important;
    padding: 16px !important;
    background: #fff !important;
    box-shadow: none !important;
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.65;
    outline: none;
}

.editor-help {
    display: block;
    padding: 8px 14px 12px;
    border-top: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 10px;
}

.task-live-preview {
    min-height: 345px;
    padding: 16px;
    white-space: pre-wrap;
    color: var(--text);
    font-size: 14px;
    line-height: 1.65;
}

.task-live-preview.is-empty { color: #a2aabb; }

.compact-upload-section { border-bottom: 0; }

.compact-image-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    margin-top: 14px;
}

.compact-image-grid .task-image-admin-item {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.image-remove-button {
    position: absolute;
    top: 6px;
    right: 6px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: rgba(25, 30, 42, .82);
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

/* Course content preview is more compact for admins and students. */
.course-admin-toolbar {
    padding: 12px 16px;
    border-radius: 14px;
}

.course-admin-toolbar-actions .button {
    min-height: 36px;
    padding: 7px 11px;
    border-radius: 9px;
    font-size: 12px;
}

.course-layout-refined { gap: 16px; }
.sidebar-card { padding: 18px; }
.modern-card { padding: 18px; border-radius: 14px; }
.session-card { gap: 14px; }
.task-card { padding: 14px 0; }
.compact-notes-block { margin-top: 12px; padding-top: 10px; }

@media (max-width: 900px) {
    .admin-workspace { grid-template-columns: 1fr; }
    .admin-workspace-sidebar { position: static; }
    .admin-sidebar-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-sidebar-danger { padding-top: 12px; }
    .admin-editor-header { align-items: flex-start; }
    .compact-course-type-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .task-editor-grid { grid-template-columns: 1fr; }
    .task-editor-pane + .task-editor-pane { border-left: 0; border-top: 1px solid var(--border); }
}

@media (max-width: 620px) {
    .admin-editor-header,
    .admin-editor-section { padding: 18px; }
    .admin-editor-header { flex-direction: column; }
    .admin-editor-header-actions { width: 100%; }
    .admin-editor-header-actions .button { flex: 1; }
    .admin-editor-fields.grid-2 { grid-template-columns: 1fr; }
    .admin-editor-fields .span-2 { grid-column: auto; }
    .cover-editor-compact { grid-template-columns: 1fr; }
    .compact-content-row { grid-template-columns: 28px minmax(0, 1fr); }
    .compact-content-actions { grid-column: 2; }
    .task-editor-toolbar { align-items: flex-start; flex-direction: column; }
}

/* ===== Course editor workspace v11 ===== */
.course-editor-workspace,
.admin-workspace {
    width: 100%;
    max-width: 1240px;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 14px;
}

.editor-sidebar-v11 {
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(29, 40, 79, 0.045);
}

.editor-sidebar-course {
    padding: 14px;
    border-bottom: 1px solid var(--border);
}

.editor-sidebar-cover {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin-bottom: 12px;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
}

.editor-sidebar-course-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
}

.editor-sidebar-course-head strong {
    display: block;
    color: var(--heading);
    font-size: 15px;
    line-height: 1.35;
}

.editor-sidebar-edit {
    padding: 5px 7px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.editor-sidebar-edit:hover {
    border-color: #cfd7e8;
    background: var(--surface-soft);
    color: var(--heading);
}

.editor-sidebar-meta {
    display: grid;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.editor-sidebar-meta-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-soft);
    font-size: 11px;
}

.editor-sidebar-meta-row strong {
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
    text-align: right;
}

.editor-sidebar-schedule {
    display: grid;
    gap: 3px;
    margin-top: 3px;
    color: var(--text-soft);
    font-size: 11px;
}

.editor-sidebar-content {
    padding: 13px 10px 10px;
}

.editor-sidebar-content-title {
    padding: 0 6px 8px;
    color: var(--heading);
    font-size: 13px;
    font-weight: 800;
}

.editor-sidebar-section + .editor-sidebar-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.editor-sidebar-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 6px 5px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.editor-sidebar-plus {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    color: var(--primary);
    font-size: 17px;
    line-height: 1;
}

.editor-sidebar-plus:hover {
    border-color: #cfd8ff;
    background: var(--primary-soft);
}

.editor-sidebar-items {
    display: grid;
    gap: 2px;
}

.editor-sidebar-item {
    display: grid;
    gap: 1px;
    padding: 8px 9px;
    border-radius: 8px;
    color: var(--text);
}

.editor-sidebar-item span {
    overflow: hidden;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-sidebar-item small {
    color: #929bad;
    font-size: 10px;
}

.editor-sidebar-item:hover,
.editor-sidebar-item.is-active {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.editor-sidebar-item.is-static:hover {
    background: transparent;
    color: var(--text);
}

.editor-sidebar-empty {
    padding: 7px 9px;
    color: #a0a8b8;
    font-size: 11px;
}

.editor-canvas-home {
    min-height: 590px;
    display: grid;
    place-items: center;
    background: #fff;
}

.editor-canvas-empty {
    max-width: 410px;
    padding: 48px 28px;
    text-align: center;
}

.editor-canvas-empty-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 20px;
    font-weight: 800;
}

.editor-canvas-empty h1 {
    color: var(--heading);
    font-size: 24px;
    letter-spacing: -.03em;
}

.editor-canvas-empty p {
    margin-top: 8px;
    color: var(--text-soft);
    font-size: 13px;
}

/* The editor itself gets the available space; navigation stays in the sidebar. */
.admin-workspace-main {
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(29, 40, 79, 0.045);
}

.admin-editor-header {
    padding: 18px 20px;
}

.admin-editor-section {
    padding: 18px 20px;
}

.admin-editor-header-actions {
    gap: 6px;
}

.admin-sidebar-danger {
    padding: 10px 16px 14px;
}

@media (max-width: 980px) {
    .course-editor-workspace,
    .admin-workspace {
        grid-template-columns: 250px minmax(0, 1fr);
    }
}

@media (max-width: 760px) {
    .course-editor-workspace,
    .admin-workspace {
        grid-template-columns: 1fr;
    }

    .editor-sidebar-v11,
    .admin-workspace-sidebar {
        position: static;
    }

    .editor-sidebar-cover {
        max-width: 260px;
    }
}

/* ===== Editor polish v12 ===== */
.account-page-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 26px auto 0;
}

.account-page-heading {
    margin-bottom: 14px;
}

.account-page-heading h1 {
    margin: 4px 0 0;
    color: var(--heading);
    font-size: 30px;
    letter-spacing: -.035em;
}

.account-profile-form {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.account-profile-card,
.account-profile-main {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(29, 40, 79, .045);
}

.account-profile-card {
    padding: 18px;
    position: sticky;
    top: 86px;
}

.account-avatar-wrap {
    display: grid;
    justify-items: center;
    gap: 9px;
}

.account-avatar-wrap .profile-avatar-large {
    width: 112px;
    height: 112px;
    margin: 0;
}

.avatar-upload-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid #cfd8ff;
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.avatar-upload-button:hover { background: #e9edff; }
.avatar-upload-name { color: #98a0af; font-size: 10px; text-align: center; }
.avatar-remove-control { color: #d84b5f; font-size: 11px; cursor: pointer; }

.account-profile-name {
    display: grid;
    gap: 2px;
    margin: 14px 0 16px;
    text-align: center;
}
.account-profile-name strong { color: var(--heading); font-size: 20px; }
.account-profile-name span { color: var(--text-soft); font-size: 12px; }

.account-profile-main { padding: 22px; }
.compact-settings-heading { margin-bottom: 18px; }
.compact-settings-heading h2 { margin: 0; font-size: 24px; }
.compact-settings-heading p { margin: 5px 0 0; color: var(--text-soft); font-size: 12px; }
.account-save-row { margin-top: 18px; }
.password-modal-dialog { width: min(520px, calc(100% - 28px)); }
.password-modal-form { padding: 18px 20px 20px; }
.password-modal-footer { padding: 16px 0 0; }

.course-create-compact-page {
    width: min(1120px, calc(100% - 32px));
    margin: 26px auto 0;
}

.course-create-compact {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(29, 40, 79, .045);
    overflow: hidden;
}

.course-create-compact-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.course-create-compact-header h1 { margin: 2px 0 0; font-size: 26px; letter-spacing: -.03em; }

.course-create-type-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: #fbfcff;
}

.compact-create-type {
    min-height: auto;
    padding: 10px 12px;
    border-radius: 10px;
}
.compact-create-type .course-type-option-body strong { font-size: 12px; }

.course-create-compact-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr);
}

.course-create-panel { padding: 18px 20px; }
.course-create-panel + .course-create-panel { border-left: 1px solid var(--border); }
.course-create-panel-title h2 { margin: 0 0 14px; font-size: 18px; }
.course-create-compact textarea { min-height: 110px; }

.compact-schedule-create {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.compact-schedule-create-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.compact-schedule-create-head > div { display: grid; gap: 1px; }
.compact-schedule-create-head strong { font-size: 13px; color: var(--heading); }
.compact-schedule-create-head span { font-size: 10px; color: var(--text-soft); }
.compact-schedule-create .schedule-item { padding: 8px 10px; }
.compact-schedule-create .compact-empty-state { min-height: auto; padding: 12px; }

.editor-sidebar-course-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-top: 12px;
}

.editor-sidebar-edit,
.editor-sidebar-performance {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 11px;
    font-weight: 750;
}

.editor-sidebar-performance:hover,
.editor-sidebar-performance.is-active,
.editor-sidebar-edit:hover {
    border-color: #cfd8ff;
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.editor-sidebar-plus-form { margin: 0; }
.editor-sidebar-plus-form .editor-sidebar-plus { padding: 0; cursor: pointer; }

.editor-sidebar-sortable-row {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: stretch;
    border-radius: 8px;
}
.editor-sidebar-sortable-row.is-dragging { opacity: .38; background: var(--primary-soft); }
.editor-sidebar-drag-handle {
    display: grid;
    place-items: center;
    color: #b4bbc8;
    font-size: 12px;
    cursor: grab;
    user-select: none;
}
.editor-sidebar-drag-handle:active { cursor: grabbing; }
.editor-sidebar-sortable-row .editor-sidebar-item { min-width: 0; }

.compact-editor-section { padding: 15px 20px; }
.compact-editor-section .admin-editor-section-title { margin-bottom: 10px; }
.compact-editor-section .admin-editor-section-title h2 { font-size: 16px; }
.compact-editor-section .admin-editor-section-title p { margin-top: 3px; font-size: 11px; }

.notes-upload-section .admin-editor-fields,
.notes-file-field,
.notes-file-field .upload-picker-wide {
    width: 100%;
    max-width: none;
}

.assignment-inline-header {
    align-items: end;
}
.assignment-title-editor { flex: 1; min-width: 0; }
.assignment-title-field { margin-top: 8px; }
.assignment-title-field input { font-size: 20px !important; font-weight: 750; }
.assignment-workspace-main .assignment-builder-section { border-top: 1px solid var(--border); }
.task-row-actions { flex-wrap: wrap; }
.reviewed-toggle.is-reviewed {
    border-color: #b9dfc7;
    background: #edf9f1;
    color: #257844;
}
.reviewed-flag { font-size: 13px; }

.compact-task-toolbar { justify-content: flex-start; }

.performance-table-wrap { width: 100%; overflow-x: auto; }
.performance-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.performance-table th,
.performance-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.performance-table th { color: var(--text-soft); font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.performance-table tbody tr:hover { background: #fafbff; }
.performance-empty { color: var(--text-soft); text-align: center !important; padding: 32px !important; }

.session-description {
    margin-top: 8px;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.55;
}

@media (max-width: 900px) {
    .account-profile-form { grid-template-columns: 1fr; }
    .account-profile-card { position: static; }
    .course-create-compact-grid { grid-template-columns: 1fr; }
    .course-create-panel + .course-create-panel { border-left: 0; border-top: 1px solid var(--border); }
    .course-create-type-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
    .course-create-compact-header { align-items: flex-start; flex-direction: column; }
    .course-create-type-strip { grid-template-columns: 1fr; }
}

/* UI polish v13 */
.upload-picker,
.upload-picker-wide,
.notes-file-field .upload-picker-wide {
    display: inline-flex;
    width: auto;
    max-width: 100%;
    min-height: 34px;
    gap: 10px;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
}

.upload-picker:hover {
    border-color: transparent;
    background: transparent;
}

.upload-picker-button {
    align-self: auto;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    background: #fff;
    color: var(--heading);
    font-size: 11px;
    font-weight: 750;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.upload-picker:hover .upload-picker-button {
    border-color: #c8d2ff;
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.upload-picker-name {
    align-self: center;
    max-width: 300px;
    padding: 0;
    color: var(--text-soft);
    font-size: 11px;
}

.notes-file-field {
    width: 100%;
    max-width: none;
}

.notes-file-field .upload-picker {
    width: auto;
}

.task-live-preview {
    display: grid;
    align-content: start;
    gap: 14px;
}

.task-live-preview-text {
    min-height: 40px;
    white-space: pre-wrap;
}

.task-live-preview-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.task-live-preview-images:empty {
    display: none;
}

.task-live-preview-images > img,
.task-live-preview-image {
    width: 100%;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.task-live-preview-images > img,
.task-live-preview-image img {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    background: #fff;
}

.editor-sidebar-drag-handle {
    cursor: grab;
    touch-action: none;
}

body.sidebar-sorting,
body.sidebar-sorting * {
    cursor: grabbing !important;
    user-select: none !important;
}

.editor-sidebar-sortable-row.is-dragging {
    opacity: .72;
    background: var(--primary-soft);
    box-shadow: inset 0 0 0 1px #d6ddff;
}

.course-create-access-grid .span-2 {
    grid-column: 1 / -1;
}

.create-end-date-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
}

.create-end-date-field > label:first-child {
    min-height: 20px;
    display: flex;
    align-items: flex-end;
}

.create-end-date-field > input[type="date"] {
    width: 100%;
}

.create-end-date-undefined {
    justify-self: start;
    min-height: auto !important;
    margin-top: 2px !important;
}

.compact-create-type .course-type-option-body {
    display: grid;
    align-content: start;
    gap: 6px;
    min-height: 74px;
}

.compact-create-type .course-type-option-body small {
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.45;
}

.site-confirm-dialog {
    width: min(460px, calc(100% - 28px));
}

.site-confirm-message {
    margin: 0;
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
}

.button-danger {
    border: 1px solid #f2c9ce;
    background: #e54855;
    color: #fff;
}

.button-danger:hover {
    background: #d83d4a;
}

@media (max-width: 900px) {
    .upload-picker-name { max-width: 190px; }
}

/* v14: themes, accent colors, fixed course type, task references */
html[data-accent="blue"] {
    --primary: #3a5af0;
    --primary-dark: #2f48c8;
    --primary-soft: #eef2ff;
}
html[data-accent="violet"] {
    --primary: #7c3aed;
    --primary-dark: #6528ca;
    --primary-soft: #f2ecff;
}
html[data-accent="green"] {
    --primary: #16a34a;
    --primary-dark: #12823c;
    --primary-soft: #eaf8ef;
}
html[data-accent="orange"] {
    --primary: #ea580c;
    --primary-dark: #c64708;
    --primary-soft: #fff0e8;
}
html[data-accent="red"] {
    --primary: #dc2626;
    --primary-dark: #b91c1c;
    --primary-soft: #ffeded;
}
html[data-accent="teal"] {
    --primary: #0d9488;
    --primary-dark: #0b766d;
    --primary-soft: #e8f7f5;
}
html[data-accent="pink"] {
    --primary: #db2777;
    --primary-dark: #b91f63;
    --primary-soft: #fdebf3;
}

.brand-mark,
.topbar-avatar-placeholder {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.brand-mark { box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 24%, transparent); }
.nav-primary:hover,
.sidebar-list li a:hover,
.editor-sidebar-item:hover,
.avatar-upload-button:hover { background: var(--primary-soft); }

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f131b;
    --surface: #171c26;
    --surface-soft: #1d2430;
    --surface-strong: #252e3d;
    --border: #2d3748;
    --border-strong: #3a465b;
    --text: #d8deea;
    --text-soft: #929db1;
    --heading: #f3f6fb;
    --success-soft: #12271a;
    --success-border: #285d39;
    --danger-soft: #2a171b;
    --danger-border: #65303a;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
    --shadow-soft: 0 10px 24px rgba(0, 0, 0, 0.18);
}
html[data-theme="dark"][data-accent] {
    --primary-soft: color-mix(in srgb, var(--primary) 18%, var(--surface));
}
html[data-theme="dark"] body { background: var(--bg); }
html[data-theme="dark"] .site-header {
    background: rgba(15, 19, 27, 0.92);
    border-bottom-color: var(--border);
}
html[data-theme="dark"] .message.info {
    background: var(--surface-strong);
    border-color: var(--border-strong);
}
html[data-theme="dark"] .page-intro,
html[data-theme="dark"] .hero-surface,
html[data-theme="dark"] .form-card,
html[data-theme="dark"] .sidebar-card,
html[data-theme="dark"] .modern-card,
html[data-theme="dark"] .settings-card,
html[data-theme="dark"] .profile-sidebar-card,
html[data-theme="dark"] .empty-state-card,
html[data-theme="dark"] .empty-access-card,
html[data-theme="dark"] .feature-card,
html[data-theme="dark"] .hero-preview-card,
html[data-theme="dark"] .auth-simple-card,
html[data-theme="dark"] .catalog-card,
html[data-theme="dark"] .auth-card-reference,
html[data-theme="dark"] .account-profile-card,
html[data-theme="dark"] .account-profile-main,
html[data-theme="dark"] .course-create-compact,
html[data-theme="dark"] .admin-workspace-sidebar,
html[data-theme="dark"] .admin-workspace-main,
html[data-theme="dark"] .editor-canvas-home,
html[data-theme="dark"] .task-editor-pane,
html[data-theme="dark"] .task-live-preview-images,
html[data-theme="dark"] .task-live-preview-images > img,
html[data-theme="dark"] .task-live-preview-image img {
    background: var(--surface);
}
html[data-theme="dark"] .course-hero-refined,
html[data-theme="dark"] .course-structure-card,
html[data-theme="dark"] .profile-layout-enhanced .settings-card,
html[data-theme="dark"] .auth-card-reference {
    background: var(--surface);
}
html[data-theme="dark"] .form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
html[data-theme="dark"] .form-field select,
html[data-theme="dark"] .form-field textarea,
html[data-theme="dark"] .course-create-form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
html[data-theme="dark"] .course-create-form select,
html[data-theme="dark"] .course-create-form textarea,
html[data-theme="dark"] .admin-workspace input[type="date"],
html[data-theme="dark"] .admin-workspace input[type="datetime-local"],
html[data-theme="dark"] .compact-field-inline select,
html[data-theme="dark"] .task-editor-input,
html[data-theme="dark"] .task-answer-input,
html[data-theme="dark"] .task-solution-input {
    background: var(--surface-soft) !important;
    color: var(--text);
    border-color: var(--border-strong);
}
html[data-theme="dark"] .form-field input:focus,
html[data-theme="dark"] .form-field select:focus,
html[data-theme="dark"] .form-field textarea:focus {
    background: var(--surface-strong) !important;
}
html[data-theme="dark"] .upload-picker-button,
html[data-theme="dark"] .icon-text-button,
html[data-theme="dark"] .editor-sidebar-plus,
html[data-theme="dark"] .small-button.secondary,
html[data-theme="dark"] .button-secondary {
    background: var(--surface-soft);
    color: var(--text);
    border-color: var(--border);
}
html[data-theme="dark"] .task-tex,
html[data-theme="dark"] .task-image img,
html[data-theme="dark"] .task-image-admin-item img {
    background: var(--surface-soft);
}
html[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, 0.62); }
html[data-theme="dark"] .modal-dialog { background: var(--surface); color: var(--text); }
html[data-theme="dark"] .topbar-avatar { background: var(--surface-strong); }

/* Profile appearance picker */
.profile-appearance-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.appearance-grid { display: grid; gap: 24px; }
.appearance-group { display: grid; gap: 10px; }
.appearance-label { font-size: 13px; font-weight: 750; color: var(--heading); }
.theme-choice-row { display: grid; grid-template-columns: repeat(2, minmax(0, 180px)); gap: 12px; }
.theme-choice-card { cursor: pointer; display: grid; gap: 8px; }
.theme-choice-card input,
.accent-choice input { position: absolute; opacity: 0; pointer-events: none; }
.theme-choice-preview {
    height: 84px;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 12px;
    display: grid;
    gap: 8px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.theme-choice-preview-light { background: #f3f5fb; }
.theme-choice-preview-dark { background: #111722; }
.theme-preview-bar { height: 13px; border-radius: 6px; background: var(--primary); width: 58%; }
.theme-preview-body { border-radius: 7px; background: #fff; border: 1px solid #dfe5ef; }
.theme-choice-preview-dark .theme-preview-body { background: #1d2430; border-color: #354054; }
.theme-choice-card input:checked + .theme-choice-preview {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 13%, transparent);
}
.theme-choice-card strong { font-size: 12px; color: var(--text); }
.accent-choice-row { display: flex; flex-wrap: wrap; gap: 10px; }
.accent-choice {
    min-width: 82px;
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 9px 8px;
    border: 1px solid var(--border);
    border-radius: 11px;
    cursor: pointer;
    background: var(--surface-soft);
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 700;
}
.accent-swatch { width: 28px; height: 28px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.accent-blue { background: #3a5af0; }
.accent-violet { background: #7c3aed; }
.accent-green { background: #16a34a; }
.accent-orange { background: #ea580c; }
.accent-red { background: #dc2626; }
.accent-teal { background: #0d9488; }
.accent-pink { background: #db2777; }
.accent-choice:has(input:checked) {
    border-color: var(--primary);
    color: var(--heading);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 11%, transparent);
}

/* Course type is immutable after creation. */
.fixed-course-type {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
}
.fixed-course-type strong { color: var(--heading); }
.fixed-course-type span { color: var(--text-soft); font-size: 11px; }
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
}
.cover-delete-button { width: fit-content; }

/* Fix schedule placeholder lingering after a meeting is added. */
.compact-empty-state[hidden],
#schedule-empty[hidden] { display: none !important; }

/* Task reference answer and hidden teacher solution. */
.task-reference-section[hidden] { display: none !important; }
.task-reference-section .admin-editor-fields { max-width: none; }
.task-answer-input { min-height: 84px !important; }
.task-solution-input { min-height: 160px !important; }
.solution-image-grid { margin-top: 12px; }

@media (max-width: 760px) {
    .theme-choice-row { grid-template-columns: 1fr 1fr; }
    .fixed-course-type { align-items: flex-start; flex-direction: column; gap: 3px; }
}

.course-type-option:hover .course-type-option-body,
.editor-sidebar-plus:hover,
.editor-sidebar-performance:hover,
.editor-sidebar-performance.is-active,
.editor-sidebar-edit:hover,
.editor-tool-button:hover {
    border-color: var(--primary);
}
.course-type-option input:checked + .course-type-option-body,
.compact-create-type:has(input:checked) .course-type-option-body {
    background: var(--primary-soft);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 10%, transparent);
}
html[data-theme="dark"] .editor-sidebar-edit,
html[data-theme="dark"] .editor-sidebar-performance,
html[data-theme="dark"] .editor-sidebar-plus,
html[data-theme="dark"] .icon-text-button,
html[data-theme="dark"] .upload-picker-button,
html[data-theme="dark"] .small-button.secondary {
    background: var(--surface-soft);
    color: var(--text);
}

/* v15: submission workflow, rating matrix, dropdowns and full theme audit */
[hidden] { display: none !important; }

:root {
    --input-bg: #ffffff;
    --input-bg-hover: #fbfcff;
    --hover: #f3f6fb;
    --overlay: rgba(12, 18, 32, .72);
    --success: #218a4b;
    --success-strong: #176d3a;
    --success-surface: #eaf8ef;
    --warning: #b87810;
    --warning-strong: #8c5b0b;
    --warning-surface: #fff5df;
    --danger: #d94755;
    --danger-strong: #b73543;
    --danger-surface: #fff0f2;
    --table-head: #f7f9fd;
}

html[data-theme="dark"] {
    --input-bg: #171d27;
    --input-bg-hover: #202836;
    --hover: #202735;
    --overlay: rgba(0, 0, 0, .82);
    --success: #49b973;
    --success-strong: #63ca86;
    --success-surface: #173122;
    --warning: #d7a13c;
    --warning-strong: #edbb5b;
    --warning-surface: #332717;
    --danger: #e46a76;
    --danger-strong: #f0838e;
    --danger-surface: #351d22;
    --table-head: #1b222e;
}

/* One consistent native dropdown skin everywhere. */
select:not([multiple]) {
    appearance: none;
    -webkit-appearance: none;
    min-height: 42px;
    padding: 9px 42px 9px 13px !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: 10px !important;
    background-color: var(--input-bg) !important;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-soft) 50%),
        linear-gradient(135deg, var(--text-soft) 50%, transparent 50%);
    background-position:
        calc(100% - 17px) calc(50% - 2px),
        calc(100% - 12px) calc(50% - 2px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    color: var(--text) !important;
    box-shadow: none !important;
    outline: none;
    cursor: pointer;
}
select:not([multiple]):hover { border-color: color-mix(in srgb, var(--primary) 55%, var(--border-strong)) !important; }
select:not([multiple]):focus {
    border-color: var(--primary) !important;
    background-color: var(--input-bg-hover) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 13%, transparent) !important;
}
select option { background: var(--surface); color: var(--text); }

/* Theme audit: make ordinary controls and surfaces follow semantic variables. */
body { background: var(--bg); color: var(--text); }
.site-header { border-color: var(--border); }
.form-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-field textarea,
.course-create-form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.course-create-form textarea,
.admin-workspace input[type="date"],
.admin-workspace input[type="datetime-local"],
.task-editor-input,
.task-answer-input,
.task-solution-input {
    background: var(--input-bg) !important;
    color: var(--text) !important;
    border-color: var(--border-strong) !important;
}
.form-field input:focus,
.form-field textarea:focus,
.course-create-form input:focus,
.course-create-form textarea:focus,
.task-editor-input:focus,
.task-answer-input:focus,
.task-solution-input:focus {
    background: var(--input-bg-hover) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent) !important;
}
.form-field input::placeholder,
.form-field textarea::placeholder,
.course-create-form input::placeholder,
.course-create-form textarea::placeholder { color: color-mix(in srgb, var(--text-soft) 78%, transparent); }

.button-primary,
.small-button:not(.secondary):not(.danger),
.nav-primary {
    background: var(--primary);
    color: #fff !important;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 22%, transparent);
}
.button-primary:hover,
.small-button:not(.secondary):not(.danger):hover,
.nav-primary:hover { background: var(--primary-dark); }
.button-secondary,
.small-button.secondary,
.icon-text-button,
.upload-picker-button,
.editor-sidebar-plus,
.editor-sidebar-edit,
.editor-sidebar-performance,
.solution-toggle-button {
    background: var(--surface-soft);
    color: var(--text);
    border-color: var(--border);
}
.button-secondary:hover,
.small-button.secondary:hover,
.icon-text-button:hover,
.upload-picker-button:hover,
.solution-toggle-button:hover { background: var(--hover); }
.button-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.button-danger:hover { background: var(--danger-strong); }
.button-success { background: var(--success); color: #fff; border: 1px solid var(--success); }
.button-success:hover { background: var(--success-strong); }
.button-warning { background: var(--warning); color: #fff; border: 1px solid var(--warning); }
.button-warning:hover { background: var(--warning-strong); }

.page-intro,
.hero-surface,
.form-card,
.sidebar-card,
.modern-card,
.settings-card,
.profile-sidebar-card,
.empty-state-card,
.empty-access-card,
.feature-card,
.hero-preview-card,
.auth-simple-card,
.catalog-card,
.account-profile-card,
.account-profile-main,
.course-create-compact,
.course-create-panel,
.admin-workspace-sidebar,
.admin-workspace-main,
.editor-canvas-home,
.task-editor-pane,
.schedule-item,
.compact-content-row,
.performance-summary-card,
.review-table-wrap,
.review-filter-bar,
.review-queue-header {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text);
}

.course-type-option-body,
.fixed-course-type,
.meta-pill,
.modern-lesson,
.compact-empty-state,
.task-editor-toolbar,
.student-task-progress-line,
.student-reference-solution,
.review-solution-grid > section {
    background: var(--surface-soft);
    border-color: var(--border);
    color: var(--text);
}

/* End-date checkbox alignment. */
.inline-check,
.inline-check.end-date-undefined,
.create-end-date-undefined,
.assignment-no-deadline,
.task-show-solution-check {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start;
    gap: 8px;
    margin: 0 !important;
    color: var(--text);
    line-height: 1.2;
}
.inline-check input[type="checkbox"],
.create-end-date-undefined input[type="checkbox"],
.assignment-no-deadline input[type="checkbox"],
.task-show-solution-check input[type="checkbox"] {
    width: 17px !important;
    height: 17px !important;
    min-width: 17px;
    margin: 0 !important;
    accent-color: var(--primary);
}
.create-end-date-undefined { min-height: 24px !important; }
.form-field input.is-disabled,
[data-assignment-deadline].is-disabled { background: var(--surface-strong) !important; color: var(--text-soft) !important; opacity: .72; }

/* Assignment package deadline editor. */
.assignment-header-fields { display: grid; gap: 12px; }
.assignment-deadline-row {
    display: grid;
    grid-template-columns: minmax(230px, 360px) auto;
    gap: 14px;
    align-items: end;
}
.assignment-no-deadline { min-height: 44px; padding-bottom: 1px; }
.assignment-student-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.assignment-deadline-label { color: var(--text-soft); font-size: 12px; font-weight: 700; }

/* Student-identical task preview: do not thumbnail or crop task images. */
.task-live-preview {
    margin: 14px;
    min-height: 0;
    padding: 18px !important;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface) !important;
}
.task-preview-heading { margin-bottom: 12px; }
.task-live-preview-text { min-height: 0; white-space: pre-wrap; }
.task-live-preview-images {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 14px;
    margin-top: 16px;
}
.task-live-preview-images > .task-image,
.task-live-preview-image { width: 100%; margin: 0; }
.task-live-preview-images .task-image img,
.task-live-preview-image img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: none !important;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
    background: var(--surface) !important;
}
.task-editor-pane.preview-pane { background: var(--surface-soft) !important; }
.task-editor-input { background: var(--surface) !important; }

/* Task acceptance settings and reviewed button. */
.task-settings-grid { align-items: end; }
.task-attempts-input { max-width: 180px; }
.task-show-solution-check {
    min-height: 48px;
    padding: 0 2px 8px;
    font-size: 13px;
    font-weight: 650;
}
.task-row-actions form { display: inline-flex; align-items: center; }
.icon-text-button,
.reviewed-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 32px;
    padding: 6px 9px;
    line-height: 1;
}
.reviewed-toggle.is-reviewed {
    border-color: color-mix(in srgb, var(--success) 48%, var(--border));
    background: var(--success-surface);
    color: var(--success-strong);
}
.reviewed-flag { display: inline-flex; align-items: center; line-height: 1; }

/* Student task workflow. */
.task-heading-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.task-state-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 800;
}
.task-state-badge.status-accepted { background: var(--success-surface); color: var(--success-strong); border-color: color-mix(in srgb, var(--success) 38%, var(--border)); }
.task-state-badge.status-revision { background: var(--warning-surface); color: var(--warning-strong); border-color: color-mix(in srgb, var(--warning) 38%, var(--border)); }
.task-state-badge.status-failed { background: var(--danger-surface); color: var(--danger-strong); border-color: color-mix(in srgb, var(--danger) 38%, var(--border)); }
.task-state-badge.status-pending_review { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 38%, var(--border)); }
.task-state-badge.reviewed { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 38%, var(--border)); }
.student-task-progress-line {
    margin-top: 16px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
}
.student-task-submit { display: grid; gap: 12px; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.student-task-submit textarea { min-height: 110px; }
.student-reference-solution { margin-top: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; }
.student-reference-title { color: var(--heading); font-size: 13px; font-weight: 800; margin-bottom: 10px; }
.reference-answer { margin-bottom: 10px; color: var(--text); }
.reference-solution-text { color: var(--text); }
.course-performance-link {
    display: flex;
    align-items: center;
    min-height: 38px;
    margin: 14px 0;
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb, var(--primary) 26%, var(--border));
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
}

/* Top-bar review queue. */
.review-queue-link { display: inline-flex; align-items: center; gap: 7px; }
.review-queue-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
}

/* Review queue. */
.review-queue-page { display: grid; gap: 18px; }
.review-queue-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 18px;
}
.review-queue-header h1 { margin-top: 4px; color: var(--heading); font-size: 32px; letter-spacing: -.035em; }
.review-queue-header p { margin-top: 7px; color: var(--text-soft); }
.review-queue-count { padding: 7px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 800; white-space: nowrap; }
.review-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
}
.review-filter-bar .compact-field-inline { display: grid; gap: 5px; min-width: 220px; }
.review-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; }
.review-table { width: 100%; min-width: 980px; border-collapse: collapse; background: var(--surface); }
.review-table th,
.review-table td { padding: 12px 13px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; font-size: 12px; }
.review-table thead th { background: var(--table-head); color: var(--text-soft); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.review-main-row:hover { background: var(--hover); }
.solution-toggle-button {
    min-height: 32px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}
.solution-toggle-button.is-open { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 42%, var(--border)); }
.review-actions { display: flex; gap: 7px; align-items: center; }
.review-actions form { margin: 0; }
.review-solution-row > td { padding: 0 !important; background: var(--surface-soft); }
.review-solution-grid { display: grid; grid-template-columns: 2fr 1fr; min-height: 240px; }
.review-solution-grid > section { padding: 18px; border-top: 1px solid var(--border); }
.review-reference-solution { border-left: 1px solid var(--border); }
.review-solution-title { margin-bottom: 12px; color: var(--heading); font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.review-solution-text { color: var(--text); line-height: 1.65; }
.review-image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.review-image-button { padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); cursor: zoom-in; }
.review-image-button img { display: block; width: 100%; height: 150px; object-fit: contain; background: var(--surface); }
.image-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 52px;
    background: var(--overlay);
}
.image-overlay img { max-width: min(1500px, 96vw); max-height: 90vh; object-fit: contain; border-radius: 10px; box-shadow: 0 30px 90px rgba(0,0,0,.45); }
.image-overlay-close { position: fixed; top: 18px; right: 22px; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; background: rgba(0,0,0,.42); color: #fff; font-size: 28px; cursor: pointer; }

/* Rating matrix based on package/task columns. */
.performance-page-shell { max-width: 100%; }
.performance-page-main { display: grid; gap: 18px; }
.performance-page-header { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); padding: 20px; }
.performance-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.performance-summary-card { padding: 16px; border: 1px solid var(--border); border-radius: 13px; }
.performance-summary-card span { display: block; color: var(--text-soft); font-size: 11px; font-weight: 700; }
.performance-summary-card strong { display: block; margin-top: 4px; color: var(--heading); font-size: 22px; }
.rating-matrix-wrap { max-width: 100%; overflow: auto; border: 1px solid var(--border); border-radius: 12px; }
.rating-matrix { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); }
.rating-matrix th,
.rating-matrix td { min-width: 68px; height: 46px; padding: 8px 10px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; white-space: nowrap; }
.rating-matrix thead th { position: sticky; top: 0; z-index: 4; background: var(--table-head); color: var(--text-soft); font-size: 10px; font-weight: 800; }
.rating-matrix .rating-task-row th { top: 46px; }
.rating-package-head { color: var(--heading) !important; font-size: 11px !important; text-transform: none !important; letter-spacing: 0 !important; }
.rating-task-head.is-reviewed { background: var(--primary-soft); color: var(--primary); }
.rating-student-name { min-width: 190px !important; max-width: 240px; text-align: left !important; color: var(--heading); }
.sticky-student-col { position: sticky !important; left: 0; z-index: 6 !important; background: var(--surface) !important; }
.sticky-rating-col { position: sticky !important; left: 190px; z-index: 5 !important; min-width: 110px !important; background: var(--surface) !important; }
thead .sticky-student-col,
thead .sticky-rating-col { background: var(--table-head) !important; z-index: 8 !important; }
.rating-overall { color: var(--primary); }
.rating-task-cell span { display: inline-flex; justify-content: center; min-width: 34px; padding: 4px 6px; border-radius: 7px; font-size: 10px; font-weight: 800; }
.rating-task-cell.status-accepted span { background: var(--success-surface); color: var(--success-strong); }
.rating-task-cell.status-revision span { background: var(--warning-surface); color: var(--warning-strong); }
.rating-task-cell.status-failed span { background: var(--danger-surface); color: var(--danger-strong); }
.rating-task-cell.status-pending_review span { background: var(--primary-soft); color: var(--primary); }
.rating-task-cell.status-not_started span { color: var(--text-soft); }
.rating-package-total { font-weight: 800; color: var(--heading); background: var(--surface-soft); }
.rating-solved-row th,
.rating-solved-row td { position: sticky; bottom: 0; background: var(--table-head) !important; color: var(--text-soft); font-size: 10px; font-weight: 800; }
.rating-solved-row .sticky-student-col { z-index: 8 !important; }

/* Dark-theme audit for lingering legacy literals. */
html[data-theme="dark"] .task-image img,
html[data-theme="dark"] .task-image-admin-item img,
html[data-theme="dark"] .task-live-preview-images img,
html[data-theme="dark"] .cover-editor-placeholder,
html[data-theme="dark"] .cover-editor-compact,
html[data-theme="dark"] .catalog-card-cover,
html[data-theme="dark"] .compact-content-row,
html[data-theme="dark"] .schedule-item,
html[data-theme="dark"] .course-type-option-body,
html[data-theme="dark"] .modal-dialog,
html[data-theme="dark"] .password-modal-dialog,
html[data-theme="dark"] .site-confirm-dialog {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
html[data-theme="dark"] .performance-table tbody tr:hover,
html[data-theme="dark"] .review-main-row:hover { background: var(--hover); }
html[data-theme="dark"] .compact-content-meta,
html[data-theme="dark"] .avatar-upload-name,
html[data-theme="dark"] .editor-sidebar-drag-handle { color: var(--text-soft); }
html[data-theme="dark"] .icon-text-button.danger { background: var(--danger-surface); color: var(--danger-strong); border-color: color-mix(in srgb, var(--danger) 42%, var(--border)); }
html[data-theme="dark"] .message.info { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); color: var(--text); }

@media (max-width: 900px) {
    .review-solution-grid { grid-template-columns: 1fr; }
    .review-reference-solution { border-left: 0; border-top: 1px solid var(--border); }
    .performance-summary-grid { grid-template-columns: 1fr; }
    .assignment-deadline-row { grid-template-columns: 1fr; }
    .assignment-no-deadline { min-height: 24px; }
}

@media (max-width: 700px) {
    .review-queue-header { align-items: flex-start; flex-direction: column; }
    .review-filter-bar .compact-field-inline { min-width: 100%; }
    .task-editor-grid { grid-template-columns: 1fr; }
    .task-editor-pane + .task-editor-pane { border-left: 0; border-top: 1px solid var(--border); }
    .image-overlay { padding: 48px 14px 14px; }
}
/* Preview uses the exact same image geometry as the student task card. */
.student-task-card .task-images,
.task-live-preview-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
    gap: 14px;
}
.student-task-card .task-image img,
.task-live-preview .task-image img {
    display: block;
    width: 100%;
    max-height: 420px !important;
    height: auto;
    object-fit: contain;
    border-radius: 14px;
    background: var(--surface) !important;
    border: 1px solid var(--border);
}
.review-course-link { color: var(--primary); font-weight: 750; }
.review-task-meta { display: block; margin-top: 3px; color: var(--text-soft); font-size: 10px; font-weight: 600; }

/* Final semantic theme pass for legacy components. */
.catalog-card-type,
.catalog-card-status {
    background: color-mix(in srgb, var(--surface) 94%, transparent) !important;
    color: var(--text) !important;
    border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
}
.catalog-card-status { color: var(--text-soft) !important; }
.task-tex,
.task-image-admin-item img,
.course-cover-field input[type="file"],
.content-editor-form input[type="file"] {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
.course-create-type-strip { background: var(--surface-soft) !important; }
.course-type-option:hover .course-type-option-body { border-color: var(--primary) !important; }
.small-button.danger,
.icon-text-button.danger {
    background: var(--danger-surface) !important;
    color: var(--danger-strong) !important;
    border-color: color-mix(in srgb, var(--danger) 38%, var(--border)) !important;
}
.draft-badge {
    background: var(--warning-surface) !important;
    color: var(--warning-strong) !important;
    border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border));
}
.upload-picker:hover { background: transparent !important; }
.upload-picker:hover .upload-picker-button {
    background: var(--primary-soft) !important;
    color: var(--primary) !important;
    border-color: color-mix(in srgb, var(--primary) 48%, var(--border)) !important;
}
.checkbox-tile,
.course-cover-editor-preview,
.assignment-card,
.session-card,
.module,
.modern-lesson,
.task-card,
.student-task-submit,
.student-reference-solution,
.rating-matrix-wrap,
.review-table-wrap {
    border-color: var(--border) !important;
}
.checkbox-tile,
.course-cover-editor-preview,
.student-task-submit {
    background: var(--surface-soft) !important;
    color: var(--text) !important;
}
.message.success { background: var(--success-surface) !important; border-color: color-mix(in srgb, var(--success) 34%, var(--border)) !important; color: var(--success-strong) !important; }
.message.error,
.error { background: var(--danger-surface) !important; border-color: color-mix(in srgb, var(--danger) 34%, var(--border)) !important; color: var(--danger-strong) !important; }
.message.info { background: var(--primary-soft) !important; border-color: color-mix(in srgb, var(--primary) 30%, var(--border)) !important; color: var(--text) !important; }

html[data-theme="dark"] .catalog-card-illustration span {
    background: color-mix(in srgb, var(--surface-strong) 80%, transparent);
    border-color: var(--border-strong);
}
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="datetime-local"] { color-scheme: dark; }

/* The task preview gets the same effective content width as the student course column. */
.task-workspace-main .task-editor-grid { grid-template-columns: 1fr; }
.task-workspace-main .task-editor-pane + .task-editor-pane {
    border-left: 0;
    border-top: 1px solid var(--border);
}
.task-workspace-main .task-editor-input { min-height: 250px !important; }
.task-workspace-main .task-live-preview { width: auto; }

/* v15.2: stable rating matrix geometry and manual course enrollment. */
.performance-section,
.admin-workspace-main,
.performance-page-main { min-width: 0; }
.rating-matrix-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-gutter: stable;
}
.rating-matrix {
    width: max-content !important;
    min-width: 100%;
    table-layout: auto;
}
.rating-matrix .sticky-student-col {
    box-sizing: border-box;
    width: 220px !important;
    min-width: 220px !important;
    max-width: 220px !important;
    left: 0 !important;
}
.rating-matrix .sticky-rating-col {
    box-sizing: border-box;
    width: 128px !important;
    min-width: 128px !important;
    max-width: 128px !important;
    left: 220px !important;
}
.rating-matrix .rating-task-head,
.rating-matrix .rating-task-cell {
    width: 82px;
    min-width: 82px;
    max-width: 82px;
}
.rating-matrix .rating-package-total-head,
.rating-matrix .rating-package-total {
    width: 104px;
    min-width: 104px;
    max-width: 104px;
}
.rating-matrix .rating-package-head {
    min-width: 0;
    padding-inline: 16px;
}
.rating-matrix thead th,
.rating-matrix tbody th,
.rating-matrix tbody td,
.rating-matrix tfoot th,
.rating-matrix tfoot td {
    box-sizing: border-box;
}
.rating-student-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.course-students-section { display: grid; gap: 16px; }
.course-student-search { max-width: 680px; }
.course-student-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.course-student-results,
.course-student-list { display: grid; gap: 8px; }
.course-student-list-head { display: flex; align-items: center; justify-content: space-between; color: var(--text-soft); font-size: 12px; }
.course-student-list-head strong { color: var(--heading); font-size: 13px; }
.course-student-list-head span { display: inline-flex; min-width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--border); color: var(--text-soft); font-weight: 800; }
.course-student-row { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-soft); }
.course-student-identity { display: grid; min-width: 0; gap: 2px; }
.course-student-identity strong { color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-student-identity span { color: var(--text-soft); font-size: 11px; }
.student-enrolled-badge { display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; border-radius: 999px; background: var(--success-surface); color: var(--success-strong); border: 1px solid color-mix(in srgb, var(--success) 28%, var(--border)); font-size: 11px; font-weight: 800; }

@media (max-width: 720px) {
    .course-student-search-row { grid-template-columns: 1fr; }
    .course-student-row { align-items: flex-start; flex-direction: column; }
    .course-student-row form,
    .course-student-row .button { width: 100%; }
    .rating-matrix .sticky-student-col { width: 170px !important; min-width: 170px !important; max-width: 170px !important; }
    .rating-matrix .sticky-rating-col { left: 170px !important; width: 112px !important; min-width: 112px !important; max-width: 112px !important; }
}

/* v15.3: compact student course workspace and unclipped creation controls. */
.course-create-access-grid > .form-field.span-2 {
    min-width: 0;
}
.course-create-access-grid > .form-field.span-2 select {
    width: 100%;
    min-width: 0;
    padding-right: 44px !important;
    text-overflow: clip;
}

.student-course-workspace {
    align-items: start;
}
.student-course-sidebar {
    max-height: calc(100vh - 118px);
    overflow-y: auto;
    scrollbar-width: thin;
}
.student-course-sidebar-actions {
    display: grid;
    gap: 6px;
    margin-top: 12px;
}
.student-course-sidebar .editor-sidebar-performance {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    width: 100%;
    padding: 7px 10px;
    border: 1px solid color-mix(in srgb, var(--primary) 32%, var(--border));
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}
.student-course-sidebar .editor-sidebar-performance:hover {
    border-color: color-mix(in srgb, var(--primary) 62%, var(--border));
    background: color-mix(in srgb, var(--primary-soft) 72%, var(--primary) 8%);
}
.student-course-main {
    min-width: 0;
}
.student-course-header {
    align-items: center;
}
.student-course-header-copy {
    min-width: 0;
    flex: 1;
}
.student-course-header-copy h1 {
    overflow-wrap: anywhere;
}
.student-course-header-copy p {
    max-width: 720px;
    line-height: 1.55;
}
.student-course-header-cover {
    width: 180px;
    max-width: 28%;
    aspect-ratio: 16 / 9;
    flex: 0 0 auto;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-soft);
}
.student-content-section {
    scroll-margin-top: 92px;
}
.student-content-list,
.student-assignment-list,
.student-task-list {
    display: grid;
    gap: 9px;
}
.student-content-card,
.student-assignment-card {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-soft);
}
.student-content-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 13px;
}
.student-content-card-main {
    min-width: 0;
    flex: 1;
}
.student-content-meta {
    margin-bottom: 4px;
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 700;
}
.student-content-card h3,
.student-assignment-card h3 {
    margin: 0;
    color: var(--heading);
    font-size: 14px;
    line-height: 1.35;
}
.student-content-description {
    margin-top: 7px;
    color: var(--text);
    font-size: 12px;
    line-height: 1.55;
}
.student-inline-action {
    margin-top: 9px;
}
.student-assignment-card {
    overflow: hidden;
    background: var(--surface);
}
.student-assignment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-soft);
}
.student-assignment-header > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}
.student-assignment-header > div > span {
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 650;
}
.student-assignment-count {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}
.student-task-list {
    padding: 10px;
}
.compact-student-task {
    min-width: 0;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
}
.compact-student-task .task-heading {
    margin-bottom: 10px;
}
.compact-student-task .task-heading h4 {
    margin: 0;
    color: var(--heading);
    font-size: 13px;
}
.compact-student-task .task-statement {
    color: var(--text);
    font-size: 13px;
    line-height: 1.62;
}
.compact-student-task .task-images {
    margin-top: 12px;
}
.student-submit-button {
    justify-self: start;
}
.student-module-lessons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.student-module-lessons > span {
    padding: 5px 7px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 10px;
}
.compact-course-access {
    width: min(680px, calc(100% - 32px));
    margin: 26px auto 0;
}

/* Individual journals do not show group-only solved-count analytics. */
.performance-page-shell .rating-matrix,
.student-course-workspace .rating-matrix {
    color: var(--text);
}

@media (max-width: 980px) {
    .student-course-header-cover {
        width: 150px;
    }
}

@media (max-width: 760px) {
    .student-course-sidebar {
        max-height: none;
    }
    .student-course-header {
        align-items: flex-start;
        flex-direction: column;
    }
    .student-course-header-cover {
        width: min(280px, 100%);
        max-width: 100%;
    }
    .student-content-card {
        align-items: flex-start;
        flex-direction: column;
    }
    .student-content-card > .button {
        width: 100%;
    }
}

@media (max-width: 620px) {
    .student-assignment-header {
        align-items: flex-start;
        flex-direction: column;
    }
    .task-heading-badges {
        justify-content: flex-start;
    }
}

/* Object-storage video uploads */
.video-upload-panel {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
}
.video-upload-empty,
.video-asset-card,
.legacy-recording-note {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.video-upload-empty > div,
.video-asset-copy,
.legacy-recording-note {
    min-width: 0;
}
.video-upload-empty strong,
.video-upload-empty span,
.video-asset-copy strong,
.video-asset-copy span,
.legacy-recording-note strong,
.legacy-recording-note span {
    display: block;
}
.video-upload-empty span,
.video-asset-copy span,
.legacy-recording-note span,
.video-upload-status {
    margin-top: 3px;
    color: var(--text-soft);
    font-size: 12px;
}
.video-asset-icon {
    display: grid;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 10px;
    color: #fff;
    background: var(--primary);
}
.video-asset-copy { flex: 1 1 auto; }
.video-asset-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.video-asset-actions,
.video-upload-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.video-upload-progress {
    display: grid;
    gap: 7px;
}
.video-upload-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}
.video-upload-progress-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}
.video-upload-progress-track {
    overflow: hidden;
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: var(--surface-strong);
}
.video-upload-progress-track > span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    transition: width 120ms linear;
}
.video-upload-error { margin: 0; }
.video-file-button { cursor: pointer; }
.legacy-recording-note {
    padding: 10px 12px;
    border: 1px dashed var(--border);
    border-radius: 10px;
}
.legacy-recording-note > span { flex: 1 1 auto; }
.student-session-video {
    width: min(100%, 920px);
    margin-top: 12px;
}
.student-session-video video {
    display: block;
    width: 100%;
    max-height: 70vh;
    border-radius: 12px;
    background: #000;
}
@media (max-width: 720px) {
    .video-asset-card,
    .legacy-recording-note { align-items: flex-start; flex-direction: column; }
    .video-asset-actions { width: 100%; }
}

/* v16.2: student workspace shows one selected content item at a time. */
.student-course-header-compact {
    min-height: 0;
}
.student-selected-content {
    min-width: 0;
    padding: 0;
    overflow: hidden;
}
.student-selected-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.student-selected-heading > div {
    min-width: 0;
}
.student-selected-heading h2,
.student-assignment-selected .student-assignment-header h2 {
    margin: 3px 0 0;
    color: var(--heading);
    font-size: 20px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.student-selected-description {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    line-height: 1.6;
    background: var(--surface-soft);
}
.student-selected-actions {
    padding: 16px 18px;
}
.student-assignment-selected {
    border: 0;
    border-radius: 0;
    background: transparent;
}
.student-assignment-selected .student-assignment-header {
    padding: 16px 18px;
}
.student-assignment-selected .student-task-list {
    padding: 14px;
}
.student-module-selected-lessons {
    display: grid;
    gap: 10px;
    padding: 14px;
}
.student-lesson-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
}
.student-lesson-card h3 {
    margin: 0;
    color: var(--heading);
    font-size: 14px;
}
.student-course-empty-selection {
    min-height: 360px;
}
.student-session-video.protected-video-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 16px 18px 18px;
    background: var(--surface-soft);
}
.student-session-video.protected-video-shell video {
    width: 100%;
    max-height: min(72vh, 860px);
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #000;
    -webkit-touch-callout: none;
    user-select: none;
}

@media (max-width: 760px) {
    .student-selected-heading {
        align-items: flex-start;
        flex-direction: column;
    }
    .student-selected-heading > .button {
        width: 100%;
    }
    .student-session-video.protected-video-shell {
        padding: 10px;
    }
}

/* v16.3: task attempts, compact creation forms, rating cleanup and theme consistency. */
.student-notes-button {
    box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 24%, transparent) !important;
}

/* Keep the selected accent responsible for primary controls everywhere. */
.button-primary,
.nav-primary,
.small-button:not(.secondary):not(.danger) {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 24%, transparent) !important;
}
.button-primary:hover,
.nav-primary:hover,
.small-button:not(.secondary):not(.danger):hover {
    background: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
    box-shadow: 0 9px 20px color-mix(in srgb, var(--primary) 30%, transparent) !important;
}
.button-danger,
.small-button.danger,
.icon-text-button.danger {
    box-shadow: none !important;
}
.button-danger {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
    color: #fff !important;
}
.button-secondary,
.icon-text-button,
.upload-picker-button,
.editor-sidebar-edit,
.editor-sidebar-performance {
    box-shadow: none !important;
}

/* Student task cards: stable containers and attempt badge in the heading. */
.compact-student-task {
    overflow: hidden;
}
.compact-student-task .task-heading {
    align-items: center;
    gap: 10px;
}
.compact-student-task .task-heading-badges {
    align-items: center;
    gap: 6px;
}
.compact-student-task .response-type {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}
.compact-student-task .task-images {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}
.compact-student-task .task-image {
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
}
.compact-student-task .task-image img {
    display: block;
    width: 100%;
    max-height: 560px;
    object-fit: contain;
    background: var(--surface-soft);
}
.student-task-submit {
    margin-top: 12px;
    padding: 12px;
    border-radius: 10px;
}

/* Rating tables are data tables, not a collection of hoverable cards. */
.admin-workspace-main > .performance-summary-grid {
    margin: 12px 0;
}
.performance-page-main > .performance-summary-grid {
    margin: 0;
}
.performance-section {
    margin-top: 12px;
    padding: 12px !important;
    overflow: hidden;
}
.rating-matrix-wrap {
    margin: 0;
    border-radius: 10px;
}
.rating-matrix th,
.rating-matrix td {
    height: 42px !important;
    padding: 8px 10px !important;
}
.rating-matrix tbody tr,
.rating-matrix tbody tr:hover,
.performance-table tbody tr,
.performance-table tbody tr:hover {
    background: transparent !important;
}
.rating-matrix tbody tr:hover td,
.rating-matrix tbody tr:hover th,
.performance-table tbody tr:hover td,
.performance-table tbody tr:hover th {
    filter: none !important;
}
.rating-matrix .rating-student-name,
.rating-matrix .sticky-rating-col {
    background: var(--surface) !important;
}
.rating-matrix thead .sticky-student-col,
.rating-matrix thead .sticky-rating-col,
.rating-matrix thead th {
    background: var(--table-head) !important;
}
.rating-matrix .rating-package-total {
    background: var(--surface-soft) !important;
}

/* Creation forms should be compact enough to scan without a vertical expedition. */
.content-create-compact .admin-editor-header {
    padding: 14px 16px;
}
.content-create-compact .admin-editor-header p {
    margin-top: 3px;
    font-size: 11px;
}
.content-create-compact .compact-editor-section,
.content-create-compact .task-reference-section,
.content-create-compact .task-settings-section {
    padding: 12px 14px;
}
.content-create-compact .admin-editor-section-title {
    margin-bottom: 8px;
}
.content-create-compact .admin-editor-section-title h2 {
    font-size: 14px;
}
.content-create-compact .admin-editor-section-title p {
    margin-top: 2px;
    font-size: 10px;
}
.content-create-compact .form-field {
    gap: 5px;
}
.content-create-compact textarea {
    min-height: 88px !important;
}
.content-create-compact .task-editor-input {
    min-height: 150px !important;
}
.content-create-compact .task-solution-input {
    min-height: 120px !important;
}
.content-create-compact .task-editor-grid {
    gap: 0;
}
.content-create-compact .video-upload-panel {
    padding: 11px;
}

/* Pending video upload is available before the session itself exists. */
.video-upload-panel[data-upload-mode="pending"] .video-upload-actions {
    margin-top: 2px;
}
.video-upload-panel[data-upload-mode="pending"] .video-upload-status {
    color: var(--text-soft);
}

/* Avatar control should not advertise the native empty file state forever. */
.account-avatar-wrap input[type="file"] {
    display: none !important;
}

@media (max-width: 760px) {
    .performance-section { padding: 8px !important; }
    .compact-student-task .task-heading { align-items: flex-start; }
}

/* v16.4: journal readability, stable caching UI and direct deletion controls. */

/* Every focus ring and primary glow follows the chosen accent. */
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.course-create-form input:focus,
.course-create-form select:focus,
.course-create-form textarea:focus,
.admin-workspace input[type="date"]:focus,
.admin-workspace input[type="datetime-local"]:focus {
    background: var(--input-bg-hover) !important;
    border-color: color-mix(in srgb, var(--primary) 72%, var(--border-strong)) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent) !important;
    outline: none !important;
}
.button-primary,
.nav-primary,
.small-button:not(.secondary):not(.danger),
.student-notes-button {
    box-shadow: 0 8px 18px color-mix(in srgb, var(--primary) 24%, transparent) !important;
}
.button-secondary:hover,
.small-button.secondary:hover,
.icon-text-button:hover,
.upload-picker-button:hover {
    background: var(--surface-strong) !important;
    border-color: color-mix(in srgb, var(--primary) 26%, var(--border)) !important;
    color: var(--heading) !important;
    box-shadow: none !important;
}
.course-type-option input:checked + .course-type-option-body,
.compact-create-type:has(input:checked) .course-type-option-body {
    background: var(--primary-soft) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent) !important;
}

/* Direct deletion buttons replace destructive checkboxes. */
.existing-file-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.avatar-delete-button {
    width: 100%;
    margin-top: 4px;
}

/* Keep the student manager in view and preserve the current query after actions. */
#students {
    scroll-margin-top: 96px;
}
.course-student-results {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}
.course-student-results + .course-student-list {
    margin-top: 4px;
}

/* Performance pages use the available desktop width instead of crushing the matrix. */
.performance-workspace,
.performance-page-shell {
    width: min(1480px, calc(100vw - 40px));
    max-width: none !important;
    margin-left: 50%;
    transform: translateX(-50%);
}
.performance-workspace {
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 16px;
}
.performance-workspace .admin-workspace-main,
.performance-page-main {
    overflow: visible;
}
.performance-page-main {
    gap: 14px;
}
.performance-page-header {
    padding: 18px 20px;
    box-shadow: none;
}
.performance-summary-grid {
    gap: 10px;
}
.performance-summary-card {
    min-height: 82px;
    padding: 14px 16px;
    background: var(--surface);
    border-color: var(--border-strong);
}
.performance-summary-card strong {
    font-size: 20px;
}
.performance-section {
    margin-top: 0 !important;
    padding: 14px !important;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.performance-page-main .performance-section {
    border: 1px solid var(--border);
    border-radius: 14px;
}

.rating-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-soft);
    color: var(--text-soft);
    font-size: 11px;
}
.rating-legend > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.legend-value {
    display: inline-flex;
    min-width: 25px;
    height: 24px;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: var(--surface);
    color: var(--heading);
    font-size: 11px;
    font-weight: 850;
}
.legend-accepted { background: var(--success-surface); color: var(--success-strong); border-color: color-mix(in srgb, var(--success) 44%, var(--border)); }
.legend-failed { background: var(--danger-surface); color: var(--danger-strong); border-color: color-mix(in srgb, var(--danger) 42%, var(--border)); }
.legend-reviewed { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 42%, var(--border)); }
.legend-revision { background: var(--warning-surface); color: var(--warning-strong); border-color: color-mix(in srgb, var(--warning) 42%, var(--border)); }
.legend-pending { background: color-mix(in srgb, var(--primary) 10%, var(--surface)); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.legend-not-started { color: var(--text); }

.rating-matrix-wrap {
    border-color: var(--border-strong);
    border-radius: 11px;
    background: var(--surface);
    scrollbar-color: var(--border-strong) var(--surface-soft);
}
.rating-matrix {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.rating-matrix th,
.rating-matrix td {
    height: 44px !important;
    padding: 8px 9px !important;
    border-right-color: var(--border-strong);
    border-bottom-color: var(--border-strong);
}
.rating-matrix thead th {
    background: var(--table-head) !important;
    color: var(--text) !important;
    font-weight: 800;
}
.rating-matrix .rating-group-row th {
    height: 42px !important;
}
.rating-matrix .rating-task-row th {
    top: 42px;
    height: 38px !important;
}
.rating-matrix .sticky-student-col {
    width: 210px !important;
    min-width: 210px !important;
    max-width: 210px !important;
}
.rating-matrix .sticky-rating-col {
    left: 210px !important;
    width: 118px !important;
    min-width: 118px !important;
    max-width: 118px !important;
}
.rating-matrix .rating-task-head,
.rating-matrix .rating-task-cell {
    width: 74px;
    min-width: 74px;
    max-width: 74px;
}
.rating-matrix .rating-package-total-head,
.rating-matrix .rating-package-total {
    width: 94px;
    min-width: 94px;
    max-width: 94px;
    font-weight: 800;
}
.rating-matrix .rating-package-total {
    background: var(--surface-soft) !important;
    color: var(--heading);
}
.rating-matrix .rating-student-name,
.rating-matrix .sticky-rating-col {
    background: var(--surface) !important;
}
.rating-matrix .rating-student-name {
    padding-left: 12px !important;
    font-size: 11px;
}
.rating-matrix .rating-overall strong {
    color: var(--primary);
    font-size: 12px;
}
.rating-task-cell span {
    display: inline-flex;
    min-width: 30px;
    height: 26px;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 850;
    line-height: 1;
}
.rating-task-cell.status-accepted span {
    background: var(--success-surface);
    color: var(--success-strong);
    border-color: color-mix(in srgb, var(--success) 42%, var(--border));
}
.rating-task-cell.status-failed span {
    background: var(--danger-surface);
    color: var(--danger-strong);
    border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}
.rating-task-cell.status-revision span {
    background: var(--warning-surface);
    color: var(--warning-strong);
    border-color: color-mix(in srgb, var(--warning) 40%, var(--border));
}
.rating-task-cell.status-reviewed span {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}
.rating-task-cell.status-pending_review span {
    background: color-mix(in srgb, var(--primary) 10%, var(--surface));
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}
.rating-task-cell.status-not_started span {
    background: transparent;
    color: var(--text-soft);
    border-color: transparent;
}
.rating-matrix tbody tr,
.rating-matrix tbody tr:hover,
.rating-matrix tbody tr:hover td,
.rating-matrix tbody tr:hover th,
.rating-matrix tfoot tr,
.rating-matrix tfoot tr:hover {
    background: transparent !important;
    filter: none !important;
    box-shadow: none !important;
    transform: none !important;
}
.rating-solved-row th,
.rating-solved-row td {
    background: var(--surface-soft) !important;
    color: var(--text-soft);
    font-size: 10px;
    font-weight: 800;
}

/* Stronger light-theme contrast for data-heavy screens. */
html[data-theme="light"] .performance-page-header,
html[data-theme="light"] .performance-summary-card,
html[data-theme="light"] .performance-section,
html[data-theme="light"] .rating-matrix-wrap,
html[data-theme="light"] .rating-matrix,
html[data-theme="light"] .rating-student-name,
html[data-theme="light"] .rating-matrix .sticky-rating-col {
    background: #fff !important;
}
html[data-theme="light"] .rating-matrix thead th {
    background: #eef2f8 !important;
    color: #243044 !important;
}
html[data-theme="light"] .rating-matrix th,
html[data-theme="light"] .rating-matrix td {
    border-color: #d5dce8 !important;
}
html[data-theme="light"] .rating-task-cell.status-accepted span,
html[data-theme="light"] .legend-accepted {
    background: #dff5e6;
    color: #0c6330;
    border-color: #aadfbb;
}
html[data-theme="light"] .rating-task-cell.status-failed span,
html[data-theme="light"] .legend-failed {
    background: #ffe4e8;
    color: #9e1f2e;
    border-color: #f3b6bf;
}
html[data-theme="light"] .rating-task-cell.status-revision span,
html[data-theme="light"] .legend-revision {
    background: #fff0c9;
    color: #744700;
    border-color: #ebcf84;
}
html[data-theme="light"] .rating-task-cell.status-reviewed span,
html[data-theme="light"] .legend-reviewed {
    background: var(--primary-soft);
    color: var(--primary-dark);
    border-color: color-mix(in srgb, var(--primary) 38%, #d5dce8);
}
html[data-theme="light"] .rating-overall strong {
    color: var(--primary-dark);
}

@media (max-width: 980px) {
    .performance-workspace,
    .performance-page-shell {
        width: min(100%, calc(100vw - 24px));
    }
    .performance-workspace {
        grid-template-columns: 240px minmax(0, 1fr);
    }
}
@media (max-width: 760px) {
    .performance-workspace,
    .performance-page-shell {
        width: 100%;
        margin-left: 0;
        transform: none;
    }
    .performance-workspace {
        grid-template-columns: 1fr;
    }
    .rating-legend {
        gap: 6px;
    }
    .rating-matrix .sticky-student-col {
        width: 160px !important;
        min-width: 160px !important;
        max-width: 160px !important;
    }
    .rating-matrix .sticky-rating-col {
        left: 160px !important;
        width: 104px !important;
        min-width: 104px !important;
        max-width: 104px !important;
    }
}
html[data-theme="light"] .performance-page-header .section-kicker,
html[data-theme="light"] .performance-page-header p,
html[data-theme="light"] .rating-legend {
    color: #56627a;
}
html[data-theme="light"] .performance-summary-card span {
    color: #5d687c;
}
