:root {
    --bg: #eef4fb;
    --bg-soft: #f7faff;
    --panel: rgba(255, 255, 255, 0.92);
    --line: rgba(41, 71, 122, 0.12);
    --text: #13233d;
    --muted: #60718d;
    --primary: #1f5eff;
    --primary-strong: #1647be;
    --accent: #66a8ff;
    --accent-strong: #0d2d73;
    --shadow: 0 26px 60px rgba(30, 74, 153, 0.12);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    color: var(--text);
    background:
    radial-gradient(circle at top left, rgba(31, 94, 255, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(102, 168, 255, 0.12), transparent 24%),
    linear-gradient(180deg, #f7faff 0%, #edf3fb 100%);
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
}

textarea {
    resize: vertical;
}

label span {
    display: block;
    margin-bottom: 0.45rem;
    font-weight: 600;
}

.field-hint {
    display: block;
    margin-top: 0.45rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.course-banner-preview {
    width: min(100%, 320px);
    aspect-ratio: 16 / 9;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.75);
}

.course-banner-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.site-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    backdrop-filter: blur(20px);
    background: linear-gradient(180deg, rgba(13, 33, 75, 0.96), rgba(20, 54, 126, 0.94));
    color: #eff4ff;
}

.sidebar-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.sidebar-close,
.sidebar-backdrop {
    display: none;
}

.sidebar-close {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    color: #eff4ff;
    cursor: pointer;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    border: 0;
    background: rgba(7, 18, 43, 0.42);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 19;
}

.brand,
.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand strong,
.auth-brand strong {
    display: block;
    font-size: 1.05rem;
}

.brand small,
.auth-brand small,
.sidebar-user small {
    color: rgba(239, 244, 255, 0.68);
}

.nav-links {
    margin-top: 2rem;
    display: grid;
    gap: 0.6rem;
}

.nav-links a {
    padding: 0.95rem 1rem;
    border-radius: 14px;
    color: #eff4ff;
    background: rgba(255, 255, 255, 0.06);
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.14);
}

.nav-links i {
    width: 20px;
    margin-right: 0.5rem;
}

.sidebar-user {
    padding: 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
}

.user-role,
.eyebrow,
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    font-weight: 700;
}

.user-role,
.eyebrow {
    color: var(--accent);
}

.main-panel {
    padding: 1.5rem;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: nowrap;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.topbar-site-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--accent-strong);
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.topbar-page {
    min-width: 0;
    margin-left: auto;
    text-align: right;
}

.topbar h1,
.section-head h2,
.hero-panel h2,
.auth-card h1,
.auth-card h2,
.lesson-panel h2 {
    margin: 0.2rem 0 0;
}

.menu-toggle {
    display: none;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    box-shadow: none;
    color: var(--accent-strong);
    cursor: pointer;
}

.sidebar-close span {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
}

.menu-toggle-icon {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.menu-toggle-icon::before,
.menu-toggle-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.menu-toggle-icon::before {
    top: -6px;
}

.menu-toggle-icon::after {
    top: 6px;
}

.content-area {
    display: grid;
    gap: 1.5rem;
}

.hero-panel,
.panel-card,
.history-card,
.auth-card,
.quiz-card,
.lesson-panel,
.empty-card,
.section-box {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: var(--shadow);
    border-radius: var(--radius-lg);
}

.hero-panel,
.lesson-panel,
.panel-card,
.auth-card,
.history-card,
.section-box {
    padding: 1.5rem;
}

.hero-panel {
    display: flex;
    justify-content: space-between;
    gap: 1.25rem;
    background: linear-gradient(135deg, rgba(15, 46, 104, 0.98), rgba(30, 88, 194, 0.94));
    color: #f5f9ff;
}

.hero-panel .eyebrow,
.hero-panel p {
    color: rgba(245, 249, 255, 0.84);
}

.hero-panel.compact {
    background: linear-gradient(135deg, var(--hero-accent, var(--primary)), #173c8f);
}

.dashboard-hero {
    display: grid;
    gap: 1.25rem;
}

.hero-panel-dashboard {
    align-items: stretch;
}

.hero-actions {
    margin-top: 1.4rem;
    justify-content: flex-start;
}

.hero-panel .btn-secondary {
    background: rgba(255, 255, 255, 0.16);
    color: #f5f9ff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-feature-card {
    width: min(320px, 100%);
    padding: 1.2rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.14);
    display: grid;
    gap: 0.9rem;
}

.hero-feature-card h3 {
    margin: 0.3rem 0 0.55rem;
}

.dashboard-stat-strip {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-stat-card {
    padding: 1.15rem 1.2rem;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--shadow);
}

.dashboard-stat-card span {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.dashboard-stat-card strong {
    font-size: 1.7rem;
}

.hero-feature-link {
    width: fit-content;
}

.hero-stat-grid,
.stats-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.stat-card {
    padding: 1.1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.14);
}

.stat-card span {
    display: block;
    color: rgba(245, 249, 248, 0.74);
    margin-bottom: 0.35rem;
}

.stat-card strong {
    font-size: 1.9rem;
}

.section-head,
.list-card,
.history-row,
.action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.section-head.tight {
    margin-bottom: 1rem;
}

.section-copy {
    margin: 0.45rem 0 0;
    color: var(--muted);
    max-width: 58ch;
}

.course-grid,
.card-list,
.auth-layout,
.split-layout,
.feature-grid {
    display: grid;
    gap: 1.25rem;
}

.course-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.course-card,
.list-card,
.option-card {
    background: var(--panel);
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: var(--shadow);
}

.course-card {
    overflow: hidden;
    display: grid;
    gap: 0;
    padding: 0;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 30px 70px rgba(27, 65, 136, 0.16);
}

.course-card-banner {
    position: relative;
    min-height: 180px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent, var(--primary)) 55%, #0d2d73), #3f82ff);
}

.course-card-banner img,
.course-card-banner-fallback {
    width: 100%;
    height: 100%;
    min-height: 180px;
    object-fit: cover;
    display: block;
}

.course-card-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(8, 24, 58, 0.04), rgba(8, 24, 58, 0.48));
}

.course-card-body {
    display: grid;
    gap: 0.9rem;
    padding: 1.25rem;
}

.course-card-body h3 {
    margin: 0;
}

.course-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    color: var(--muted);
}

.hero-panel > * {
    min-width: 0;
}

.inline-form {
    margin: 0;
}

.action-row-wrap {
    flex-wrap: wrap;
    justify-content: flex-start;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    border: 0;
    border-radius: 14px;
    padding: 0.9rem 1.15rem;
    cursor: pointer;
    font-weight: 700;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #f8fdfa;
}

.btn-secondary {
    background: rgba(31, 94, 255, 0.1);
    color: var(--primary-strong);
}

.btn-ghost {
    background: rgba(216, 78, 78, 0.09);
    color: #b83a3a;
}

.alert {
    padding: 1rem 1.15rem;
    border-radius: 18px;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.alert-success {
    background: rgba(31, 94, 255, 0.12);
    color: #1745ad;
}

.alert-error {
    background: rgba(239, 68, 68, 0.14);
    color: #8a2630;
}

.split-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
}

.admin-split {
    align-items: start;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.auth-layout {
    width: min(1160px, 100%);
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
    align-items: stretch;
}

.auth-layout.single-card {
    max-width: 720px;
    grid-template-columns: 1fr;
}

.auth-card {
    position: relative;
    overflow: hidden;
}

.auth-card-feature {
    background: linear-gradient(145deg, rgba(10, 31, 78, 0.96), rgba(28, 82, 184, 0.92));
    color: #f8fbff;
}

.auth-card-feature::after {
    content: '';
    position: absolute;
    inset: auto -60px -60px auto;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(255, 209, 102, 0.35), transparent 68%);
}

.auth-copy {
    max-width: 42ch;
    color: rgba(248, 252, 255, 0.82);
}

.feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 2rem;
}

.feature-grid article {
    padding: 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
}

.feature-grid i {
    font-size: 1.4rem;
    color: #9cc6ff;
}

.stack-form {
    display: grid;
    gap: 1rem;
}

.auth-note,
.lesson-description,
.course-card p,
.list-card p,
td,
th {
    color: var(--muted);
}

.list-card {
    padding: 1rem 1.15rem;
}

.question-card {
    display: grid;
    align-items: stretch;
    justify-content: initial;
    gap: 1rem;
    padding: 1.25rem;
}

.question-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.question-card-head h3 {
    margin: 0.3rem 0 0;
}

.question-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    color: var(--muted);
}

.question-card-meta span {
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: rgba(31, 94, 255, 0.08);
}

.question-card-body {
    margin: 0;
    padding: 1rem;
    border-radius: 18px;
    background: rgba(13, 45, 115, 0.04);
    color: var(--text);
    line-height: 1.7;
}

.pill {
    padding: 0.38rem 0.7rem;
    border-radius: 999px;
    color: var(--primary-strong);
    background: rgba(31, 94, 255, 0.12);
}

.pill-accent {
    color: #1647be;
    background: rgba(102, 168, 255, 0.18);
}

.history-card h3,
.section-box h3 {
    margin-top: 0;
}

.history-row {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--line);
}

.history-row:last-child {
    border-bottom: 0;
}

.quiz-form,
.table-wrap {
    display: grid;
    gap: 1rem;
}

.quiz-card {
    padding: 1.25rem;
}

.quiz-options {
    display: grid;
    gap: 0.85rem;
    margin-top: 1rem;
}

.option-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
}

.option-card input {
    width: auto;
}

.lesson-panel {
    display: grid;
    gap: 1.25rem;
}

.media-frame {
    overflow: hidden;
    border-radius: 24px;
    background: #0b1832;
    min-height: 360px;
}

.course-hero {
    position: relative;
    overflow: hidden;
}

.course-hero-banner {
    width: min(360px, 100%);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(10, 27, 74, 0.22);
}

.course-hero-banner img {
    width: 100%;
    height: 100%;
    min-height: 210px;
    object-fit: cover;
    display: block;
}

.media-frame iframe,
.media-frame video {
    width: 100%;
    min-height: 360px;
    border: 0;
}

.doc-frame iframe {
    background: #fff;
}

.panel-card,
.section-box {
    display: grid;
    gap: 1rem;
}

.question-editor-card {
    padding: 1.2rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.62);
}

.question-option-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.inline-check input {
    width: auto;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 0.85rem 0.5rem;
    border-bottom: 1px solid var(--line);
}

.empty-card {
    padding: 2rem;
    text-align: center;
}

.empty-card.small {
    padding: 1.25rem;
}

@media (max-width: 1024px) {
    .site-shell,
    .split-layout,
    .auth-layout,
    .feature-grid,
    .dashboard-stat-strip {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        width: min(320px, 88vw);
        z-index: 20;
        transition: transform 0.25s ease;
        overflow-y: auto;
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    body.sidebar-open {
        overflow: hidden;
    }

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: relative;
        flex: 0 0 auto;
        z-index: 21;
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 14px;
        background: transparent;
        color: var(--accent-strong);
        border: 0;
        box-shadow: none;
    }

    body.sidebar-open .menu-toggle {
        opacity: 0;
        pointer-events: none;
        transform: translateX(-0.35rem);
    }

    .sidebar-close,
    .sidebar-backdrop {
        display: block;
    }

    .main-panel {
        padding: 1rem;
    }

    .hero-panel,
    .hero-panel-dashboard,
    .course-hero,
    .section-head,
    .list-card,
    .action-row {
        flex-direction: column;
        align-items: start;
    }

    .hero-feature-card,
    .course-hero-banner {
        width: 100%;
    }

    .topbar {
        align-items: center;
        justify-content: space-between;
        gap: 0.85rem;
    }

    .topbar-site-name {
        font-size: 1rem;
    }

    .topbar-page h1 {
        font-size: 1.35rem;
    }

    .question-option-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .hero-stat-grid,
    .stats-grid,
    .course-grid,
    .dashboard-stat-strip {
        grid-template-columns: 1fr;
    }

    .hero-panel,
    .panel-card,
    .history-card,
    .auth-card,
    .lesson-panel,
    .section-box,
    .quiz-card,
    .empty-card {
        padding: 1rem;
        border-radius: 20px;
    }

    .course-card-body {
        padding: 1rem;
    }

    .topbar {
        gap: 0.75rem;
    }

    .topbar-brand {
        gap: 0.7rem;
        min-width: 0;
    }

    .topbar-site-name {
        font-size: 0.98rem;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar-page h1 {
        font-size: 1.1rem;
        margin-top: 0;
    }

    .btn,
    .hero-feature-link,
    .action-row .btn,
    .action-row .inline-form,
    .action-row .inline-form .btn {
        width: 100%;
    }

    .topbar h1,
    .hero-panel h2,
    .section-head h2,
    .auth-card h1,
    .auth-card h2,
    .lesson-panel h2 {
        font-size: 1.5rem;
    }

    .sidebar {
        width: min(280px, 86vw);
        padding: 1rem;
    }

    .nav-links a {
        width: 100%;
    }

    .media-frame,
    .media-frame iframe,
    .media-frame video {
        min-height: 220px;
    }

    .auth-page,
    .main-panel {
        padding: 0.85rem;
    }

    .dashboard-stat-card,
    .stat-card {
        padding: 1rem;
    }
}
