body.auth-page {
    min-height: 100vh;
    color: var(--ink);
    background: var(--background);
}

.auth-shell {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    margin: 0 auto;
    padding: 0 24px;
    max-width: 1160px;
}

.auth-topbar,
.auth-utilities,
.auth-footer,
.auth-dashboard-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-topbar {
    min-height: 84px;
}

.auth-utilities {
    gap: 10px;
}

.auth-main {
    display: grid;
    flex: 1;
    place-items: center;
    padding: 36px 0 56px;
}

.auth-card {
    width: min(100%, 480px);
    padding: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.auth-eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .11em;
}

.auth-card h1 {
    margin: 0;
    font-size: clamp(25px, 5vw, 32px);
    line-height: 1.25;
}

.auth-intro {
    margin: 10px 0 24px;
    color: var(--muted);
}

.auth-form {
    display: grid;
    gap: 17px;
}

.auth-field {
    display: grid;
    gap: 7px;
}

.auth-field label {
    font-size: 13px;
    font-weight: 700;
}

.auth-field input {
    width: 100%;
    min-height: 47px;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    outline: none;
    color: var(--ink);
    background: var(--surface);
}

.auth-field input:focus {
    border-color: #91a9ed;
    box-shadow: 0 0 0 3px rgba(49, 94, 219, .12);
}

.auth-field input[aria-invalid="true"] {
    border-color: #d96a63;
}

.auth-hint,
.auth-field-error {
    color: var(--muted);
    font-size: 12px;
}

.auth-field-error {
    color: #b33d36;
}

.auth-submit {
    width: 100%;
    margin-top: 3px;
    font-size: 14px;
}

.auth-alert {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
}

.auth-alert--error {
    color: #8a302a;
    background: #fff0ed;
}

.auth-alert--success {
    color: #17683c;
    background: #eaf8ef;
}

.auth-alert--info,
.auth-note {
    color: #284c91;
    background: #edf3ff;
}

.auth-role-note {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.auth-role-note strong {
    color: var(--ink);
}

.auth-role-fieldset {
    display: grid;
    gap: 10px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.auth-role-fieldset legend {
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 700;
}

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

.auth-role-option {
    display: flex;
    min-height: 84px;
    align-items: flex-start;
    gap: 10px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.auth-role-option:hover,
.auth-role-option.is-selected {
    border-color: var(--primary);
    background: rgba(49, 94, 219, .06);
}

.auth-role-option:focus-within {
    outline: 3px solid rgba(49, 94, 219, .22);
    outline-offset: 2px;
}

.auth-role-option input {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    margin: 2px 0 0;
    accent-color: var(--primary);
}

.auth-role-option span {
    display: grid;
    gap: 5px;
}

.auth-role-option strong {
    font-size: 13px;
}

.auth-role-option small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.teacher-request-list {
    display: grid;
    gap: 12px;
    margin: 22px 0;
}

.teacher-request-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.teacher-request-card h2,
.teacher-request-card p {
    margin: 0;
}

.teacher-request-card h2 {
    font-size: 15px;
}

.teacher-request-card p {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.teacher-request-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.auth-switch,
.auth-teacher-note {
    margin: 20px 0 0;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.auth-forgot-link {
    margin: -5px 0 0;
    font-size: 13px;
    text-align: right;
}

.auth-reset-email {
    margin: 0 0 18px;
    padding: 11px 13px;
    border: 1px solid #dce7ff;
    border-radius: 11px;
    color: #466084;
    background: #f4f7ff;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.auth-reset-email strong { color: var(--ink); }

.auth-secondary-form { margin-top: 12px; text-align: center; }
.auth-secondary-form button { padding: 0; border: 0; color: var(--primary); background: transparent; cursor: pointer; font-size: 13px; font-weight: 700; }
.auth-secondary-form button:hover { text-decoration: underline; }

.auth-card a:not(.btn),
.auth-footer a {
    color: var(--primary);
    font-weight: 700;
}

.auth-card a:not(.btn):hover,
.auth-footer a:hover {
    text-decoration: underline;
}

.auth-account-details {
    display: grid;
    gap: 12px;
    margin: 24px 0;
}

.auth-account-details > div {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.auth-account-details dt {
    color: var(--muted);
    font-size: 13px;
}

.auth-account-details dd {
    overflow-wrap: anywhere;
    font-weight: 700;
}

.auth-note {
    margin: 0 0 22px;
    padding: 13px 15px;
    border-radius: 10px;
    font-size: 13px;
}

.auth-dashboard-actions {
    flex-wrap: wrap;
    gap: 10px;
}

.auth-dashboard-actions form {
    margin: 0;
}

.auth-footer {
    gap: 16px;
    padding: 18px 0 24px;
    color: var(--muted);
    font-size: 12px;
}

.header-auth-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-auth-link {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    padding: 0 11px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--ink);
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.header-auth-link:hover {
    color: var(--primary);
    background: #f2f6ff;
}

.header-auth-link--primary {
    border-color: var(--primary);
    color: #fff;
    background: var(--primary);
}

.header-auth-link--primary:hover {
    color: #fff;
    background: var(--primary-dark);
}

.header-logout-form {
    margin: 0;
}

html[data-theme="dark"] body.auth-page {
    --ink: #e8edfa;
    --muted: #aab5ca;
    --line: #34415d;
    --surface: #1b2740;
    --background: #111b2e;
    --primary: #7795ff;
    --primary-dark: #5d7ce6;
}

html[data-theme="dark"] .auth-field input {
    color: var(--ink);
    background: #162139;
}

html[data-theme="dark"] .auth-role-option:hover,
html[data-theme="dark"] .auth-role-option.is-selected {
    background: #243657;
}

html[data-theme="dark"] .auth-alert--error {
    color: #ffc1bc;
    background: #482c36;
}

html[data-theme="dark"] .auth-alert--success {
    color: #a9edc0;
    background: #1e403a;
}

html[data-theme="dark"] .auth-alert--info,
html[data-theme="dark"] .auth-note {
    color: #c2d2ff;
    background: #243657;
}

html[data-theme="dark"] .auth-field-error {
    color: #ffaaa3;
}

html[data-theme="dark"] .header-auth-link:hover {
    background: #263858;
}

@media (max-width: 620px) {
    .auth-role-options { grid-template-columns: 1fr; }
    .teacher-request-card { align-items: stretch; flex-direction: column; }
    .teacher-request-actions { flex-wrap: wrap; }
    .teacher-request-actions > * { flex: 1 1 0; }
    .auth-shell {
        padding: 0 15px;
    }

    .auth-topbar {
        min-height: 70px;
    }

    .auth-main {
        padding: 24px 0 36px;
    }

    .auth-card {
        padding: 27px 21px;
        border-radius: 18px;
    }

    .auth-dashboard-actions > *,
    .auth-dashboard-actions .btn {
        flex: 1 1 100%;
        width: 100%;
    }

    .auth-footer {
        flex-wrap: wrap;
    }
}
