:root {
    color-scheme: light;
    --bg: #eef2f6;
    --panel: #ffffff;
    --panel-soft: #f7fafc;
    --ink: #17212b;
    --muted: #64748b;
    --line: #d8e0e8;
    --nav: #101820;
    --nav-soft: #172331;
    --teal: #0f766e;
    --teal-soft: #d7f3ef;
    --amber: #b7791f;
    --amber-soft: #fff3d6;
    --red: #b42318;
    --red-soft: #fde2df;
    --green: #287a3e;
    --green-soft: #def5e5;
    --blue: #2457a6;
    --blue-soft: #e2ecff;
    --shadow: 0 14px 35px rgba(23, 33, 43, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
}

.sidebar {
    background: var(--nav);
    color: #e5edf5;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.brand {
    display: grid;
    gap: 4px;
    padding: 4px 6px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-title {
    font-weight: 800;
    font-size: 20px;
    letter-spacing: 0;
}

.brand-subtitle {
    color: #9fb1c3;
    font-size: 12px;
    text-transform: uppercase;
}

.nav-group {
    display: grid;
    gap: 6px;
}

.nav-label {
    color: #91a3b5;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0 10px 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 9px 10px;
    border-radius: 8px;
    color: #cbd7e3;
}

.nav-link:hover,
.nav-link.active {
    background: var(--nav-soft);
    color: #ffffff;
}

.nav-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #5fb7b1;
    flex: 0 0 auto;
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 10px;
    padding: 12px 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.role-pill {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    padding: 5px 9px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    color: #cbd7e3;
    font-size: 12px;
}

.main {
    min-width: 0;
    display: grid;
    grid-template-rows: auto 1fr;
}

.topbar {
    height: 70px;
    background: rgba(255, 255, 255, 0.86);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(12px);
}

.topbar h1 {
    margin: 0;
    font-size: 22px;
    letter-spacing: 0;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 14px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--teal);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.page {
    padding: 28px;
    display: grid;
    gap: 22px;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid.metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.metric-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 18px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: start;
    margin-bottom: 16px;
}

.panel-title {
    display: grid;
    gap: 3px;
}

.panel-title h2,
.panel-title h3 {
    margin: 0;
    font-size: 17px;
    letter-spacing: 0;
}

.panel-title p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.metric-card {
    padding: 16px;
    display: grid;
    gap: 12px;
    min-height: 118px;
}

.metric-label {
    color: var(--muted);
    font-size: 13px;
}

.metric-value {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 0;
}

.metric-note {
    color: var(--muted);
    font-size: 12px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}

.form-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
    display: grid;
    gap: 6px;
    align-content: start;
}

.field.full {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 6px;
}

.form-actions.full {
    grid-column: 1 / -1;
}

.form-actions .btn {
    min-width: min(320px, 100%);
}

.compact-form {
    max-width: 1120px;
}

.field label {
    color: #334155;
    font-weight: 700;
    font-size: 13px;
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 9px 11px;
}

.input:disabled,
.select:disabled,
.textarea:disabled {
    background: #f8fafc;
    color: var(--muted);
    cursor: not-allowed;
}

.textarea {
    min-height: 105px;
    resize: vertical;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.checkbox-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 66px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    padding: 11px;
}

.checkbox-card input {
    flex: 0 0 auto;
    margin-top: 4px;
}

.checkbox-card span {
    display: grid;
    gap: 3px;
}

.btn {
    border: 0;
    border-radius: 8px;
    min-height: 40px;
    padding: 9px 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 750;
}

.btn.primary {
    background: var(--teal);
    color: #fff;
}

.btn.secondary {
    background: #e7edf3;
    color: #23313f;
}

.btn.registration {
    background: var(--red);
    color: #ffffff;
}

.btn.warning {
    background: var(--amber);
    color: #fff;
}

.btn.link {
    background: transparent;
    color: #cbd7e3;
    justify-content: start;
    padding: 8px 0;
}

.action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.action-group form {
    margin: 0;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 780px;
    background: #fff;
}

th,
td {
    padding: 12px 13px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: #415166;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: #f8fafc;
}

tr:last-child td {
    border-bottom: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.badge.published,
.badge.active,
.badge.completed,
.badge.graded,
.badge.submitted {
    background: var(--green-soft);
    color: var(--green);
}

.badge.draft,
.badge.pending,
.badge.in_progress,
.badge.reviewed,
.badge.needs_review,
.badge.inactive {
    background: var(--amber-soft);
    color: var(--amber);
}

.badge.archived,
.badge.locked,
.badge.late,
.badge.needs_attention,
.badge.suspended {
    background: var(--red-soft);
    color: var(--red);
}

.badge.returned,
.badge.revised,
.badge.published-soft {
    background: var(--blue-soft);
    color: var(--blue);
}

.progress {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.progress span {
    display: block;
    height: 100%;
    background: var(--teal);
}

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.alert.success {
    background: var(--green-soft);
    color: var(--green);
    border-color: #b8e7c5;
}

.alert.error {
    background: var(--red-soft);
    color: var(--red);
    border-color: #f5b9b3;
}

.empty-state {
    padding: 26px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: var(--panel-soft);
    text-align: center;
}

.material-content {
    min-height: 220px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: #263445;
    font-size: 16px;
    line-height: 1.7;
    white-space: normal;
}

.forum-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.forum-card-main {
    min-width: 0;
}

.forum-card-side {
    display: grid;
    justify-items: end;
    align-content: center;
    gap: 6px;
    border-left: 1px solid var(--line);
    padding-left: 12px;
}

.forum-card-side strong {
    font-size: 28px;
}

.forum-detail-action {
    width: 100%;
    margin-top: 6px;
    white-space: nowrap;
}

.forum-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: end;
}

.forum-prompt {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.forum-post {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.forum-post p {
    margin: 8px 0 0;
}

.quiz-builder {
    display: grid;
    gap: 14px;
}

.quiz-question-panel {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.quiz-question-panel legend {
    padding: 0 6px;
    color: #334155;
    font-weight: 800;
}

.quiz-answer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.quiz-review-card .material-content {
    min-height: 96px;
}

.answer-option {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
}

.answer-key {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-weight: 700;
}

.rubric-builder {
    display: grid;
    gap: 14px;
}

.rubric-criteria-panel {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
}

.rubric-criteria-panel legend {
    padding: 0 6px;
    color: #334155;
    font-weight: 800;
}

.rubric-criteria-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rubric-criterion-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-soft);
    font-size: 13px;
}

.stack {
    display: grid;
    gap: 12px;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 13px;
}

.split-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.home-page {
    min-height: 100vh;
    background: #f3f7fb;
    color: var(--ink);
}

.home-nav {
    min-height: 72px;
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
    z-index: 2;
}

.home-brand {
    font-size: 20px;
    font-weight: 850;
    color: #ffffff;
    text-shadow: 0 1px 12px rgba(10, 23, 38, 0.42);
}

.home-nav-actions,
.home-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.home-hero {
    min-height: min(780px, calc(100vh - 28px));
    display: grid;
    grid-template-rows: auto 1fr;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(5, 24, 38, 0.92) 0%, rgba(5, 24, 38, 0.74) 40%, rgba(5, 24, 38, 0.24) 74%, rgba(5, 24, 38, 0.10) 100%),
        url("/images/home-esp-tourism-hero.png") center right / cover no-repeat;
}

.home-hero-copy {
    display: grid;
    gap: 18px;
    align-content: center;
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: clamp(46px, 8vh, 96px) 0 clamp(74px, 10vh, 118px);
    max-width: none;
    color: #ffffff;
    position: relative;
    z-index: 2;
}

.home-kicker {
    width: fit-content;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #c8fff8;
    border: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 13px;
    font-weight: 800;
}

.home-hero h1 {
    margin: 0;
    max-width: 680px;
    font-size: clamp(48px, 8vw, 104px);
    line-height: 0.92;
    letter-spacing: 0;
    text-wrap: balance;
}

.home-hero p {
    margin: 0;
    max-width: 660px;
    color: #d6e4ef;
    font-size: 18px;
    line-height: 1.65;
}

.home-hero .btn.secondary,
.home-cta .btn.secondary {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.20);
}

.home-hero .btn.registration,
.home-cta .btn.registration {
    background: #d92d20;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 12px 28px rgba(180, 35, 24, 0.30);
}

.home-metrics,
.home-product-section,
.home-workflow,
.home-cta {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
}

.home-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: -46px;
    position: relative;
    z-index: 3;
}

.home-metrics article,
.home-feature-grid article,
.home-workflow,
.home-cta {
    border: 1px solid rgba(216, 224, 232, 0.92);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.home-metrics article {
    min-height: 126px;
    padding: 18px;
    display: grid;
    align-content: space-between;
    gap: 12px;
}

.home-metrics strong {
    display: block;
    font-size: 30px;
    line-height: 1;
    color: #0c6b64;
}

.home-metrics span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.home-product-section,
.home-workflow {
    margin-top: 70px;
}

.section-heading {
    max-width: 760px;
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.section-heading .home-kicker,
.home-workflow .home-kicker,
.home-cta .home-kicker {
    background: var(--teal-soft);
    color: var(--teal);
    border-color: rgba(15, 118, 110, 0.16);
}

.section-heading h2,
.home-workflow h2,
.home-cta h2 {
    margin: 0;
    font-size: clamp(30px, 4vw, 52px);
    line-height: 1.02;
    letter-spacing: 0;
}

.home-feature-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.home-feature-grid article {
    min-height: 250px;
    padding: 18px;
    display: grid;
    align-content: start;
    gap: 14px;
    overflow: hidden;
    position: relative;
}

.home-feature-grid article::after {
    content: "";
    width: 100%;
    height: 5px;
    border-radius: 0;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.16), rgba(247, 178, 36, 0.22));
    position: absolute;
    right: 0;
    bottom: 0;
}

.feature-index {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #10283d;
    color: #ffffff;
    font-weight: 850;
    font-size: 13px;
}

.home-feature-grid strong {
    display: block;
    font-size: 20px;
    line-height: 1.2;
}

.home-feature-grid p,
.home-workflow span {
    margin: 0;
    color: var(--muted);
}

.home-workflow {
    padding: 26px;
    display: grid;
    grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.2fr);
    gap: 26px;
    align-items: start;
}

.home-workflow > div:first-child {
    display: grid;
    gap: 12px;
}

.workflow-line {
    display: grid;
    gap: 10px;
}

.workflow-line article {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 12px;
    align-items: center;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.workflow-line article:last-child {
    border-bottom: 0;
}

.workflow-line strong {
    color: #0c6b64;
}

.home-cta {
    margin-top: 70px;
    margin-bottom: 54px;
    padding: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    background:
        linear-gradient(120deg, rgba(8, 30, 46, 0.94), rgba(9, 72, 80, 0.90)),
        #10283d;
    color: #ffffff;
}

.home-cta > div:first-child {
    display: grid;
    gap: 12px;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background:
        linear-gradient(120deg, rgba(15, 118, 110, 0.14), rgba(183, 121, 31, 0.12)),
        var(--bg);
}

.login-card {
    width: min(860px, 100%);
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.login-card.register-card {
    width: min(980px, 100%);
    grid-template-columns: 0.8fr 1.2fr;
}

.login-copy {
    padding: 34px;
    background: var(--nav);
    color: #f8fafc;
    display: grid;
    align-content: space-between;
    gap: 24px;
}

.login-copy .btn.secondary {
    width: fit-content;
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
}

.login-copy-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.login-copy h1 {
    margin: 0;
    font-size: 34px;
    line-height: 1.1;
    letter-spacing: 0;
}

.login-copy p {
    color: #b6c4d2;
}

.login-form {
    padding: 34px;
    display: grid;
    gap: 18px;
}

.form-note {
    margin: -4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.auth-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

.auth-links a {
    color: var(--teal);
    font-weight: 800;
}

.pagination {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.pagination nav,
.pagination div {
    width: 100%;
}

@media (max-width: 1080px) {
    .grid.metrics,
    .grid.three,
    .home-metrics,
    .home-feature-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-workflow {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .topbar {
        height: auto;
        align-items: start;
        padding: 18px;
        flex-direction: column;
    }

    .page {
        padding: 18px;
    }

    .grid.metrics,
    .grid.two,
    .grid.three,
    .form-grid,
    .form-grid.three,
    .quiz-answer-grid,
    .forum-card,
    .login-card,
    .login-card.register-card,
    .home-metrics,
    .home-feature-grid {
        grid-template-columns: 1fr;
    }

    .home-nav {
        height: auto;
        min-height: 68px;
        align-items: center;
    }

    .home-hero {
        min-height: 690px;
        background-position: 58% center;
    }

    .home-hero-copy {
        padding: 42px 0 96px;
    }

    .home-metrics {
        margin-top: -38px;
    }

    .home-product-section,
    .home-workflow,
    .home-cta {
        margin-top: 44px;
    }

    .workflow-line article,
    .home-cta {
        display: grid;
        grid-template-columns: 1fr;
    }

    .home-cta {
        align-items: start;
    }

    .home-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .forum-card-side {
        justify-items: start;
        border-left: 0;
        border-top: 1px solid var(--line);
        padding: 10px 0 0;
    }
}
