:root {
    --blue: #087b46;
    --blue-dark: #063f28;
    --green: #0b8f52;
    --gold: #c99a2e;
    --gold-soft: #f4e3b5;
    --ink: #111318;
    --muted: #6d7480;
    --line: #e2e7de;
    --bg: #f7f9f4;
}

body { background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
*,
*::before,
*::after { box-sizing: border-box; }
a { text-decoration: none; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 282px; padding: 20px; background: #fff; border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.brand.large { align-items: flex-start; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; background: linear-gradient(135deg, var(--blue), var(--gold)); color: #fff; font-weight: 800; }
.brand img { display: block; width: 178px; max-width: 100%; height: auto; border-radius: 6px; }
.brand.large img { width: 260px; }
.brand strong { display: block; font-size: 1.25rem; }
.brand small { display: block; color: var(--muted); line-height: 1.35; }
.sidebar .nav-link { display: flex; align-items: center; gap: 10px; color: #41506a; border-radius: 8px; padding: 10px 12px; font-weight: 600; }
.sidebar .nav-link:hover { background: #eef7ef; color: var(--blue); }
.main { margin-left: 282px; width: calc(100% - 282px); padding: 24px; padding-bottom: 88px; }
.app-footer { margin-top: 34px; padding: 18px 0 0; color: var(--muted); text-align: center; border-top: 1px solid var(--line); font-size: .92rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 22px; }
.topbar h1 { font-size: 1.65rem; margin: 0; }
.breadcrumb-line { display: flex; gap: 8px; color: var(--muted); font-size: .85rem; }
.breadcrumb-line span + span:before { content: "/"; margin-right: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.user-chip span, .user-chip small { display: block; }
.user-chip small { color: var(--muted); }
.hero-band { display: flex; justify-content: space-between; gap: 24px; align-items: center; padding: 26px; color: #fff; background: linear-gradient(120deg, #063f28, #087b46 58%, #c99a2e); border-radius: 8px; margin-bottom: 20px; }
.hero-band h2 { font-size: 2rem; margin: 4px 0; }
.hero-band p { margin: 0; opacity: .9; }
.eyebrow { display: inline-flex; color: #ffdc75; font-weight: 700; letter-spacing: 0; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.metric-grid, .module-grid, .course-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric-card, .panel, .module-card, .course-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.metric-card { padding: 18px; }
.metric-card span { display: block; color: var(--muted); font-weight: 600; }
.metric-card strong { display: block; font-size: 1.8rem; margin-top: 8px; }
.panel { padding: 20px; }
.panel-head, .toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px; }
.panel-head h3 { font-size: 1.1rem; margin: 0; }
.panel-head span { color: var(--muted); }
.chart-placeholder { height: 260px; display: flex; gap: 18px; align-items: end; padding: 16px; background: #f8fbff; border-radius: 8px; }
.chart-placeholder div { flex: 1; min-width: 34px; background: linear-gradient(180deg, var(--gold), var(--blue)); border-radius: 8px 8px 0 0; }
.module-card { padding: 20px; color: var(--ink); min-height: 132px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.module-card:hover { border-color: var(--blue); box-shadow: 0 14px 34px rgba(8, 123, 70, .14); }
.module-card i { color: var(--blue); font-size: 1.5rem; }
.module-card span { color: var(--muted); }
.toolbar .search-form { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: #fff; min-width: min(420px, 100%); }
.search-form input { border: 0; outline: 0; width: 100%; }
.table th { color: #5b6578; font-size: .82rem; text-transform: uppercase; }
.empty-state { padding: 32px; text-align: center; color: var(--muted); background: #f8fbff; border-radius: 8px; }
.course-card { overflow: hidden; }
.course-thumb { height: 128px; background: linear-gradient(135deg, #063f28, #087b46 70%, #c99a2e); }
.course-card h3 { font-size: 1.05rem; margin: 10px 0 6px; }
.ai-answer { border-left: 4px solid var(--green); background: #f4fbf7; padding: 16px; border-radius: 8px; }
.profile-card { text-align: center; }
.profile-photo { width: 148px; height: 148px; object-fit: cover; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 12px 30px rgba(17, 19, 24, .12); margin-bottom: 16px; }
.profile-card h3 { margin: 0 0 4px; font-size: 1.25rem; }
.profile-card p { color: var(--muted); margin-bottom: 10px; }
.participant-cell { display: flex; align-items: center; gap: 10px; }
.participant-cell img { width: 36px; height: 36px; object-fit: cover; border-radius: 50%; border: 1px solid var(--line); }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #f4f8f1; }
.subject-link { color: var(--blue); font-weight: 800; }
.qb-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.qb-nav a { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-weight: 700; }
.qb-nav a:hover { color: var(--blue); border-color: var(--blue); background: #eef7ef; }
.category-tree { display: grid; gap: 10px; }
.category-row { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-left: 5px solid var(--blue); border-radius: 8px; background: #fff; cursor: grab; }
.category-row small { display: block; color: var(--muted); margin-top: 2px; }
.qb-section { border: 1px solid var(--line); border-radius: 8px; padding: 18px; background: #fff; }
.qb-section h3 { font-size: 1.05rem; margin-bottom: 14px; }
.student-preview { display: grid; gap: 14px; max-width: 820px; margin: 0 auto; }
.timer-sim { justify-self: end; padding: 8px 12px; background: #eef7ef; border-radius: 8px; color: var(--blue-dark); font-weight: 800; }
.question-text { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 1.05rem; }
.answer-option { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.question-mini { display: flex; justify-content: space-between; gap: 12px; padding: 12px; border-bottom: 1px solid var(--line); }
.pagination-lite { color: var(--muted); padding-top: 14px; border-top: 1px solid var(--line); }
.icon-action { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top left, rgba(201,154,46,.18), transparent 30%), linear-gradient(135deg, #f7f9f4, #eef6ee); }
.auth-footer { position: fixed; left: 0; right: 0; bottom: 12px; text-align: center; color: var(--muted); font-size: .9rem; padding: 0 16px; }
.auth-panel { width: min(1080px, 100%); display: grid; grid-template-columns: 1.1fr .9fr; gap: 26px; align-items: center; }
.auth-panel.single { grid-template-columns: 1fr; width: min(760px, 100%); }
.auth-copy h1 { font-size: 2.4rem; margin: 24px 0 12px; }
.auth-copy p { color: var(--muted); font-size: 1.05rem; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 28px; box-shadow: 0 24px 70px rgba(23, 32, 51, .08); }
.auth-card.wide { padding: 30px; }
.auth-card h2 { margin-bottom: 18px; }
.auth-logo-link { display: inline-flex; color: inherit; margin-bottom: 18px; }
.auth-logo-link:hover { opacity: .92; }
.auth-title { margin-bottom: 20px; text-align: center; }
.auth-title h2 { margin-bottom: 8px; }
.auth-title p { margin: 0; color: var(--muted); line-height: 1.6; }
.register-card { border-top: 4px solid var(--gold); }
.auth-links { display: flex; justify-content: space-between; margin-top: 18px; }
.demo-logins { display: grid; gap: 3px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.mobile-nav { display: none; }

@media (max-width: 992px) {
    .sidebar { display: none; }
    .main { margin-left: 0; width: 100%; padding: 16px; }
    .topbar { align-items: flex-start; }
    .metric-grid, .module-grid, .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .auth-panel { grid-template-columns: 1fr; }
    .auth-copy h1 { font-size: 1.9rem; }
    .mobile-nav { position: fixed; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; inset: auto 0 0 0; background: #fff; border-top: 1px solid var(--line); padding: 7px 8px; z-index: 20; }
    .mobile-nav a { color: #41506a; display: grid; place-items: center; font-size: .68rem; }
    .mobile-nav i { font-size: 1.1rem; }
}

@media (max-width: 640px) {
    .hero-band, .topbar, .toolbar { flex-direction: column; align-items: stretch; }
    .metric-grid, .module-grid, .course-grid { grid-template-columns: 1fr; }
    .user-chip { justify-content: space-between; }
}

/* Public frontpage */
.front-body {
    background: #f7f9fc;
    min-width: 320px;
}
.site-shell {
    min-height: 100vh;
    overflow-x: hidden;
}
.front-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    width: min(1180px, calc(100% - 32px));
    margin: 16px auto 0;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(219, 227, 236, .9);
    border-radius: 8px;
    backdrop-filter: blur(18px);
    box-shadow: 0 12px 40px rgba(20, 31, 53, .08);
}
.front-brand {
    min-width: max-content;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 12px;
}
.front-brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--blue), var(--gold));
    font-weight: 800;
}
.front-brand strong,
.front-footer strong {
    display: block;
    font-size: 16px;
    line-height: 1.2;
}
.front-brand img {
    display: block;
    width: 198px;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}
.front-brand small {
    display: block;
    color: #647084;
    font-size: 12px;
    line-height: 1.3;
}
.front-nav,
.front-actions,
.front-hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.front-nav a {
    color: #647084;
    border-radius: 8px;
    padding: 10px 12px;
    font-weight: 700;
}
.front-nav a:hover {
    color: var(--blue);
    background: #eef7ef;
}
.front-primary,
.front-secondary,
.front-ghost,
.front-light {
    min-height: 44px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    padding: 0 18px;
    font-weight: 800;
    transition: transform .16s, background .16s, border-color .16s, color .16s, box-shadow .16s;
}
.front-primary {
    color: #fff;
    background: var(--blue);
    box-shadow: 0 10px 24px rgba(8, 123, 70, .24);
}
.front-primary:hover {
    color: #fff;
    background: var(--blue-dark);
    transform: translateY(-1px);
}
.front-secondary {
    color: var(--blue);
    background: #fff;
    border: 1px solid #dbe3ec;
}
.front-secondary:hover,
.front-ghost:hover {
    color: var(--blue);
    background: #eef7ef;
}
.front-ghost {
    color: var(--ink);
}
.front-light {
    color: var(--blue-dark);
    background: #fff;
}
.front-primary.large,
.front-secondary.large {
    min-height: 52px;
    padding-inline: 22px;
}
.front-hero,
.front-section,
.front-cta,
.front-footer {
    width: min(1180px, calc(100% - 32px));
    margin-inline: auto;
}
.front-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(360px, .98fr);
    align-items: center;
    gap: 46px;
    padding: 82px 0 72px;
}
.front-eyebrow {
    display: inline-flex;
    color: var(--blue);
    text-transform: uppercase;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0;
}
.front-eyebrow.light {
    color: #cfe0ff;
}
.front-hero-copy h1,
.front-heading h2,
.front-cta h2 {
    color: var(--ink);
    letter-spacing: 0;
    margin: 0;
    line-height: 1.08;
}
.front-hero-copy h1 {
    max-width: 720px;
    font-size: clamp(34px, 4.5vw, 54px);
}
.front-hero-copy p,
.front-heading p,
.front-cta p,
.front-footer p,
.front-feature-grid p,
.front-level-grid p {
    color: #647084;
    line-height: 1.7;
}
.front-hero-copy > p {
    max-width: 690px;
    margin: 22px 0 28px;
    font-size: 19px;
}
.front-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    max-width: 620px;
    margin-top: 34px;
}
.front-stats div,
.front-feature-grid article,
.front-level-grid article,
.front-table-card,
.front-preview {
    background: #fff;
    border: 1px solid #dbe3ec;
    border-radius: 8px;
}
.front-stats div {
    padding: 18px;
}
.front-stats strong {
    display: block;
    font-size: 26px;
    line-height: 1;
}
.front-stats span,
.front-preview small,
.front-table-card small {
    color: #647084;
    font-size: 13px;
}
.front-hero-panel {
    min-height: 430px;
    display: grid;
    gap: 20px;
    padding: 34px;
    border: 1px solid #dbe3ec;
    border-radius: 8px;
    background: linear-gradient(160deg, rgba(8, 123, 70, .14), rgba(201, 154, 46, .12)), #fff;
    box-shadow: 0 20px 50px rgba(20, 31, 53, .12);
}
.level-shortcuts h2 {
    max-width: 380px;
    color: var(--ink);
    margin: 0 0 18px;
    font-size: clamp(30px, 4vw, 44px);
    line-height: 1.1;
}
.level-shortcuts div {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.level-shortcuts button {
    min-height: 58px;
    color: var(--blue-dark);
    background: rgba(255, 255, 255, .75);
    border: 1px solid rgba(8, 123, 70, .18);
    border-radius: 8px;
    font-size: 18px;
    font-weight: 900;
}
.level-shortcuts button:hover {
    color: #fff;
    background: var(--blue);
}
.front-preview {
    display: grid;
    gap: 12px;
    padding: 18px;
    box-shadow: 0 18px 42px rgba(20, 31, 53, .14);
}
.preview-title {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dbe3ec;
    color: #647084;
}
.preview-title strong {
    color: var(--ink);
}
.preview-title span {
    color: var(--green);
    font-weight: 900;
}
.front-preview-row {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 12px;
}
.front-preview-row i {
    font-size: 24px;
}
.front-preview-row i.teal { color: var(--green); }
.front-preview-row i.blue { color: var(--blue); }
.front-preview-row i.gold { color: var(--gold); }
.front-preview-row strong {
    display: block;
    color: var(--ink);
    font-size: 14px;
}
.front-section {
    padding: 72px 0;
}
.front-section.muted {
    width: 100%;
    max-width: none;
    padding-left: max(16px, calc((100% - 1180px) / 2));
    padding-right: max(16px, calc((100% - 1180px) / 2));
    background: #eef5ec;
    overflow: hidden;
}
.front-heading {
    max-width: 760px;
    margin-bottom: 34px;
}
.front-heading.split {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    max-width: none;
}
.front-heading.split > div {
    max-width: 740px;
}
.front-heading h2,
.front-cta h2 {
    font-size: clamp(32px, 4.6vw, 52px);
}
.front-heading p {
    margin: 12px 0 0;
    font-size: 18px;
}
.front-feature-grid,
.front-level-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    max-width: none;
    width: 100%;
    min-width: 0;
}
.front-feature-grid article {
    min-height: 250px;
    padding: 24px;
    box-shadow: 0 10px 28px rgba(20, 31, 53, .06);
}
.front-feature-grid span {
    color: var(--gold);
    font-size: 13px;
    font-weight: 900;
}
.front-feature-grid h3,
.front-level-grid h3 {
    color: var(--ink);
    margin: 10px 0;
    font-size: 24px;
    line-height: 1.2;
}
.front-feature-grid p,
.front-level-grid p {
    margin: 0;
}
.front-level-grid article {
    padding: 22px;
    box-shadow: 0 10px 28px rgba(20, 31, 53, .08);
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
}
.front-level-grid article > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 0;
}
.front-level-grid span {
    color: #647084;
    text-transform: uppercase;
    font-size: 13px;
    font-weight: 900;
}
.front-level-grid strong {
    display: grid;
    place-items: center;
    width: 68px;
    min-width: 0;
    min-height: 46px;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--blue), var(--gold));
    font-size: 20px;
}

@media (max-width: 1180px) {
    .front-section.muted {
        padding-inline: 16px;
    }
}
.front-table-card {
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(20, 31, 53, .12);
}
.front-table-card table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}
.front-table-card th,
.front-table-card td {
    padding: 18px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #dbe3ec;
}
.front-table-card th {
    color: #647084;
    text-transform: uppercase;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 900;
}
.front-table-card tr:last-child td {
    border-bottom: 0;
}
.front-table-card strong {
    display: block;
    color: var(--ink);
}
.front-cta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 34px;
    padding: 42px;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, rgba(6, 63, 40, .96), rgba(8, 123, 70, .94) 62%, rgba(201, 154, 46, .92)), #063f28;
}
.front-cta h2 {
    max-width: 760px;
    color: #fff;
}
.front-cta p {
    max-width: 680px;
    margin: 14px 0 0;
    color: #eaf3ff;
}
.front-footer {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 26px 0 42px;
    color: #647084;
}
.front-footer.rich {
    align-items: flex-start;
    padding-top: 34px;
    border-top: 1px solid var(--line);
}
.front-copyright {
    width: min(1180px, calc(100% - 32px));
    margin: -18px auto 0;
    padding: 0 0 28px;
    color: #647084;
    text-align: center;
    font-size: .92rem;
}
.front-footer p {
    max-width: 560px;
    margin: 8px 0 0;
}
.front-footer span {
    display: block;
    text-align: right;
    line-height: 1.7;
}
.footer-brand-block {
    max-width: 390px;
}
.footer-brand-block img {
    display: block;
    width: 210px;
    max-width: 100%;
    height: auto;
    margin-bottom: 12px;
    border-radius: 6px;
}
.footer-links,
.footer-contact {
    display: grid;
    gap: 8px;
    min-width: 180px;
}
.footer-links strong,
.footer-contact strong {
    color: var(--ink);
}
.footer-links a {
    color: #647084;
}
.footer-links a:hover {
    color: var(--blue);
}
.footer-contact span {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
}
.footer-contact i {
    color: var(--gold);
}

@media (max-width: 980px) {
    .front-topbar {
        flex-wrap: wrap;
        align-items: flex-start;
    }
    .front-nav {
        order: 3;
        width: 100%;
        padding-top: 4px;
        overflow-x: auto;
    }
    .front-hero {
        grid-template-columns: 1fr;
        padding-top: 58px;
    }
    .front-feature-grid,
    .front-level-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .front-heading.split,
    .front-cta,
    .front-footer {
        flex-direction: column;
        align-items: flex-start;
    }
    .front-footer span {
        text-align: left;
    }
}

@media (max-width: 640px) {
    .front-topbar,
    .front-hero,
    .front-section,
    .front-cta,
    .front-footer {
        width: min(calc(100% - 20px), 1180px);
    }
    .front-actions,
    .front-hero-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .front-primary,
    .front-secondary,
    .front-ghost,
    .front-light,
    .front-brand {
        width: 100%;
    }
    .front-hero-copy h1 {
        font-size: 32px;
    }
    .front-hero-copy > p,
    .front-heading p {
        font-size: 16px;
    }
    .front-stats,
    .front-feature-grid,
    .front-level-grid {
        grid-template-columns: 1fr;
    }
    .front-level-grid article > div {
        margin-bottom: 18px;
    }
    .front-hero-panel {
        padding: 18px;
    }
    .level-shortcuts div {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .front-table-card {
        overflow-x: auto;
    }
}
