:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --text: #1d2433;
    --muted: #667085;
    --line: #d9e0ea;
    --primary: #146c63;
    --primary-dark: #0d4f49;
    --accent: #b26a00;
    --danger: #b42318;
    --ok: #087443;
    --shadow: 0 10px 30px rgba(18, 35, 61, 0.08);
}

* {
    box-sizing: border-box;
}

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

a {
    color: var(--primary);
    text-decoration: none;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    font-size: 2rem;
    line-height: 1.15;
}

h2 {
    font-size: 1.15rem;
}

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

.brand {
    color: var(--text);
    font-weight: 800;
}

.nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav form {
    margin: 0;
}

.link-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    cursor: pointer;
}

.shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 36px 0 56px;
}

.app-footer {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 0 0 22px;
    color: var(--muted);
    font-size: 0.82rem;
    text-align: center;
}

.auth-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 430px;
    gap: 42px;
    align-items: start;
    min-height: calc(100vh - 150px);
    padding-top: 56px;
}

.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 22% 18%, rgba(203, 169, 104, 0.16), transparent 34%),
        radial-gradient(circle at 82% 72%, rgba(17, 94, 89, 0.16), transparent 32%),
        linear-gradient(135deg, #061521 0%, #0a1d2a 48%, #07101a 100%);
    color: #f6f0e6;
}

.login-page .topbar {
    background: rgba(5, 18, 29, 0.78);
    border-bottom-color: rgba(203, 169, 104, 0.22);
}

.login-page .brand {
    color: #d9bd80;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-page .shell {
    width: min(1180px, calc(100% - 32px));
}

.login-page .app-footer {
    color: rgba(215, 223, 223, 0.66);
}

.login-page .auth-grid {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 410px);
    gap: 56px;
    align-items: center;
    min-height: calc(100vh - 150px);
    padding-top: 24px;
}

.auth-copy {
    max-width: 700px;
}

.auth-logo {
    display: block;
    width: min(430px, 100%);
    margin: 0 0 30px;
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

.auth-copy h1 {
    max-width: 760px;
    margin-bottom: 18px;
    color: #e3c58a;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.1rem, 5vw, 4.4rem);
    font-weight: 500;
    line-height: 1.02;
}

.auth-copy h1 span {
    color: #8aa4aa;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 0.7em;
}

.login-page .lead {
    max-width: 720px;
    color: #d7dfdf;
    font-size: 1.08rem;
    line-height: 1.75;
}

.auth-panel {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(203, 169, 104, 0.42);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.auth-panel h2 {
    color: #13202b;
}

.auth-panel button {
    background: #b88943;
    color: #07101a;
}

.auth-panel button:hover {
    background: #d0aa69;
}

@media (max-width: 1100px) {
    .login-page .shell {
        width: min(100% - 28px, 620px);
        padding-top: 20px;
    }

    .login-page .auth-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 22px;
        align-items: stretch;
        min-height: 0;
        padding-top: 0;
    }

    .auth-panel {
        order: 1;
        width: 100%;
        max-width: 100%;
    }

    .auth-copy {
        order: 2;
        max-width: 100%;
    }

    .auth-logo {
        width: min(220px, 60vw);
        margin: 0 auto 18px;
    }

    .auth-copy h1 {
        font-size: clamp(1.45rem, 8vw, 2.15rem);
        line-height: 1.08;
        text-align: center;
    }

    .login-page .lead {
        font-size: 0.95rem;
        line-height: 1.55;
    }
}

.lead {
    max-width: 650px;
    color: var(--muted);
    font-size: 1.08rem;
}

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

.panel {
    padding: 24px;
}

.narrow {
    max-width: 560px;
}

.tabs {
    display: grid;
    gap: 24px;
}

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

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 650;
}

input,
select {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 16px;
    border: 0;
    border-radius: 6px;
    background: var(--primary);
    color: white;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

button:hover,
.button:hover {
    background: var(--primary-dark);
}

.button.secondary {
    background: #eef2f7;
    color: var(--text);
}

.button.secondary:hover {
    background: #e2e8f0;
}

.danger-button {
    background: var(--danger);
}

.danger-button:hover {
    background: #8f1d14;
}

.danger-button.subtle {
    min-height: 34px;
    padding: 6px 10px;
    background: #fff1f0;
    color: var(--danger);
    border: 1px solid #ffccc7;
    font-size: 0.88rem;
}

.danger-button.subtle:hover {
    background: #ffe4e0;
}

.secondary-button {
    background: #eef2f7;
    color: var(--text);
    border: 1px solid var(--line);
}

.secondary-button:hover {
    background: #e2e8f0;
}

.table-button {
    min-height: 32px;
    padding: 5px 10px;
    font-size: 0.88rem;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.table-actions form {
    margin: 0;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
}

.status-badge.active {
    background: #e7f7ed;
    color: #166534;
    border: 1px solid #bbebcb;
}

.status-badge.blocked {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #d8e0ea;
}

.admin-create-user {
    margin-bottom: 20px;
}

.admin-create-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.mentor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.mentor-actions form {
    margin: 0;
}

.mentor-report-panel {
    max-width: 920px;
}

.mentor-report-panel .text-block {
    margin-bottom: 0;
}

.page-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.source-counts {
    margin: 8px 0 0;
    color: var(--muted);
}

.source-counts strong {
    color: var(--text);
    font-weight: 800;
}

.eyebrow {
    margin-bottom: 6px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 26px;
}

.metrics div {
    display: grid;
    gap: 4px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metrics span,
.muted {
    color: var(--muted);
}

.metrics strong {
    font-size: 1.7rem;
}

.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
}

.two-col > div,
.two-col > article,
section > article {
    padding: 22px;
}

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

.section-title-row h2,
.section-title-row form {
    margin: 0;
}

.profile-list {
    display: grid;
    gap: 14px;
}

.progression-panel {
    margin-top: 20px;
}

.trend-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.trend-card {
    display: grid;
    gap: 4px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.trend-card span {
    color: var(--muted);
}

.trend-card b {
    width: fit-content;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e8f3f1;
    color: var(--primary-dark);
    font-size: 0.78rem;
}

.trend-card small {
    color: var(--muted);
    font-weight: 700;
}

.trend-progredindo {
    border-left: 4px solid var(--ok);
}

.trend-piorando {
    border-left: 4px solid var(--danger);
}

.trend-estavel,
.trend-aguardando {
    border-left: 4px solid var(--accent);
}

.progress-row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(120px, 180px) 52px;
    gap: 12px;
    align-items: center;
}

.progress-row span {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
}

meter {
    width: 100%;
    height: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.notice,
.warning {
    padding: 12px 14px;
    border-radius: 6px;
    background: #fff7e6;
    color: #7a4b00;
}

.warning {
    margin-bottom: 18px;
    border: 1px solid #ffd591;
}

.danger-panel {
    border-color: #ffccc7;
}

.check-line {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    color: var(--text);
    font-weight: 600;
}

.check-line input {
    width: 18px;
    min-height: 18px;
    margin-top: 3px;
}

.exam {
    display: grid;
    gap: 18px;
}

.question-card {
    padding: 22px;
}

.question-card h2 {
    white-space: pre-wrap;
    font-size: 1rem;
    font-weight: 650;
}

.choices {
    display: grid;
    gap: 10px;
}

.choice {
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    font-weight: 500;
}

.choice input {
    width: 18px;
    min-height: 18px;
    margin-top: 3px;
}

.choice span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.submit-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    justify-content: flex-end;
    padding: 14px 0;
    background: linear-gradient(180deg, rgba(245, 247, 251, 0), var(--bg) 35%);
}

.exam-timer {
    position: fixed;
    right: 18px;
    bottom: 76px;
    z-index: 30;
    display: grid;
    gap: 2px;
    min-width: 132px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.exam-timer span {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.exam-timer strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
    font-size: 1.2rem;
}

.processing-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(29, 36, 51, 0.45);
    backdrop-filter: blur(3px);
}

.processing-overlay[hidden] {
    display: none;
}

.processing-box {
    display: grid;
    justify-items: center;
    gap: 12px;
    width: min(420px, 100%);
    padding: 28px;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
}

.processing-box h2,
.processing-box p {
    margin-bottom: 0;
}

.processing-box p {
    color: var(--muted);
}

.spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #d9e0ea;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.is-processing {
    cursor: wait;
}

.is-processing button {
    cursor: wait;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.text-block {
    white-space: pre-wrap;
}

.review-item {
    margin-bottom: 10px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.review-item summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
}

.review-answer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin: 14px 0;
}

.review-answer-grid p {
    margin: 0;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.review-alternatives-block {
    margin-top: 14px;
}

.review-alternatives-block h3 {
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.review-alternatives {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.review-alternative {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
}

.review-alternative.is-correct {
    border-color: #a8e0bd;
    background: #eefbf3;
}

.review-alternative.is-selected:not(.is-correct) {
    border-color: #ffd0c9;
    background: #fff5f3;
}

.review-letter {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #e8edf4;
    font-weight: 800;
}

.review-alternative.is-correct .review-letter {
    background: var(--ok);
    color: #ffffff;
}

.review-alternative.is-selected:not(.is-correct) .review-letter {
    background: var(--danger);
    color: #ffffff;
}

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

.bad {
    color: var(--danger);
}

code {
    padding: 2px 5px;
    border-radius: 4px;
    background: #eef2f7;
}

@media (max-width: 780px) {
    .topbar,
    .page-head,
    .nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar {
        padding: 14px 18px;
    }

    .login-page .topbar {
        position: static;
        min-height: 52px;
        padding: 12px 16px;
    }

    .login-page .shell {
        width: min(100% - 24px, 520px);
        padding: 18px 0 34px;
    }

    .auth-grid,
    .two-col,
    .metrics,
    .admin-create-form {
        grid-template-columns: 1fr;
    }

    .auth-logo {
        width: min(190px, 58vw);
        margin: 0 auto 16px;
        box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
    }

    .auth-copy h1 {
        margin-bottom: 12px;
        font-size: 1.85rem;
        line-height: 1.08;
        text-align: center;
    }

    .auth-copy h1 span {
        display: block;
        margin: 4px 0;
        font-size: 0.55em;
    }

    .login-page .lead {
        margin-bottom: 0;
        font-size: 0.94rem;
        line-height: 1.52;
        text-align: left;
    }

    .auth-panel {
        padding: 18px;
        box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
    }

    .mentor-actions {
        justify-content: flex-start;
    }

    .progress-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 430px) {
    .login-page .brand {
        font-size: 0.92rem;
    }

    .auth-logo {
        width: min(150px, 52vw);
        margin-bottom: 12px;
    }

    .auth-copy h1 {
        font-size: 1.45rem;
    }

    .login-page .lead {
        font-size: 0.9rem;
        line-height: 1.45;
    }

    .auth-panel {
        padding: 16px;
    }

    .auth-panel h2 {
        margin-bottom: 12px;
        font-size: 1.05rem;
    }
}
