/* Auth screens (Admin / Candidate) — lean shell (no side/bottom nav) */

:root {
    --auth-primary: #2563eb;
    --auth-primary-hover: #1d4ed8;
    --auth-singpass: #e11d48;
    --auth-singpass-border: #fda4af;
    --auth-text: #111111;
    --auth-muted: #6b7280;
    --auth-border: #e5e7eb;
    --auth-surface: #ffffff;
    --auth-danger-bg: #fff1f2;
    --auth-danger-text: #be123c;
    --auth-danger-border: #fecdd3;
    --auth-success: #16a34a;
    --auth-radius: 12px;
    --auth-font-weight: 500;
}

/* The theme may paint <html> dark; keep auth pages white edge to edge (incl. overscroll). */
html:has(> body.auth-body) {
    background: var(--auth-surface);
}

.auth-body {
    background: var(--auth-surface);
    font-weight: var(--auth-font-weight);
    color: var(--auth-text);
}

.auth-shell {
    min-height: 100dvh;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: var(--auth-surface);
}

.auth-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
}

.auth-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    margin-bottom: 8px;
}

.auth-topbar-title {
    flex: 1;
    margin: 0;
    text-align: center;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--auth-text);
}

.auth-topbar-spacer {
    width: 40px;
}

.auth-lang {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding: 6px 10px;
    border: 1px solid var(--auth-border);
    border-radius: 999px;
    background: var(--auth-surface);
    color: var(--auth-muted);
    font-size: 0.875rem;
    font-weight: var(--auth-font-weight);
    cursor: default;
}

.auth-lang-caret {
    font-size: 0.7rem;
}

.auth-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--auth-text);
    text-decoration: none;
}

.auth-back:hover {
    background: #f3f4f6;
    color: var(--auth-text);
}

.auth-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px 0 32px;
}

.auth-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    margin-bottom: 20px;
    border-radius: 22px;
    background: #eff6ff;
    color: var(--auth-primary);
    font-size: 2.25rem;
}

.auth-brand-icon.auth-brand-logo {
    background: #f9fafb;
    overflow: hidden;
    padding: 0;
    border-radius: 50%;
    border: 1px solid #d1d5db;
}

.auth-brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.auth-brand-title {
    margin: 0 0 8px;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--auth-text);
}

.auth-brand-sub,
.auth-lead {
    margin: 0;
    max-width: 28rem;
    color: var(--auth-muted);
    font-size: 0.95rem;
    font-weight: var(--auth-font-weight);
    line-height: 1.45;
}

/* Combined Admin welcome + login (_AdminSignIn): smaller header so the form fits one phone screen. */
.auth-hero.auth-hero-compact {
    flex: 0 0 auto;
    padding: 4px 0 20px;
}

.auth-hero-compact .auth-brand-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 12px;
    border-radius: 18px;
    font-size: 1.625rem;
}

.auth-hero-compact .auth-brand-icon.auth-brand-logo {
    border-radius: 50%;
}

.auth-hero-compact .auth-brand-title {
    margin-bottom: 6px;
    font-size: 1.375rem;
}

.auth-hero-compact .auth-brand-sub {
    font-size: 0.875rem;
}

.auth-page-signin .auth-alert {
    margin-bottom: 12px;
}

.auth-page-signin .auth-form {
    margin-top: 0;
}

/* Centre logo + messages + form in the space under the language picker (auto margins share the free
   space; on short screens they shrink to 0, so nothing extra scrolls). */
.auth-page-signin .auth-hero-compact {
    margin-top: auto;
}

.auth-page-signin .auth-form {
    margin-bottom: auto;
}

.auth-heading {
    margin: 12px 0 8px;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--auth-text);
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: auto;
}

.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border-radius: var(--auth-radius);
    border: 1px solid transparent;
    font-size: 1rem;
    font-weight: var(--auth-font-weight);
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.auth-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.auth-btn-primary {
    background: var(--auth-primary);
    color: #fff;
}

.auth-btn-primary:hover {
    background: var(--auth-primary-hover);
    color: #fff;
}

.auth-btn-secondary {
    background: var(--auth-surface);
    border-color: var(--auth-border);
    color: var(--auth-text);
}

.auth-btn-secondary:hover {
    background: #f9fafb;
    color: var(--auth-text);
}

/* Official Singpass lockup; chrome matches sibling .auth-btn size (full width, 48px). */
.auth-btn-singpass {
    box-sizing: border-box;
    height: 48px;
    min-height: 48px;
    background: #ffffff;
    border-color: #aaabad;
    color: #141414;
    padding: 0 16px;
    gap: 0;
}

.auth-btn-singpass:hover {
    background: #f5f5f7;
    border-color: #aaabad;
    color: #141414;
}

.auth-btn.auth-btn-singpass:disabled {
    opacity: 1;
    background: #ffffff;
    border-color: #aaabad;
}

.auth-btn-singpass-art {
    display: block;
    height: 40px;
    width: auto;
    max-width: 100%;
    pointer-events: none;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0;
    color: var(--auth-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.auth-label {
    font-size: 0.875rem;
    font-weight: var(--auth-font-weight);
    color: var(--auth-text);
}

.auth-required {
    font-size: 0.75rem;
    font-weight: var(--auth-font-weight);
    color: var(--auth-singpass);
    letter-spacing: 0.02em;
}

.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-wrap > i:first-child {
    position: absolute;
    left: 14px;
    color: var(--auth-muted);
    pointer-events: none;
}

.auth-input {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    background: var(--auth-surface);
    color: var(--auth-text);
    font-size: 1rem;
    font-weight: var(--auth-font-weight);
    outline: none;
}

.auth-input-wrap .auth-input {
    padding-left: 42px;
}

.auth-input-wrap.has-toggle .auth-input {
    padding-right: 44px;
}

.auth-input:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.auth-input.is-invalid {
    border-color: var(--auth-singpass);
    box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.1);
}

.auth-toggle-password {
    position: absolute;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-muted);
    cursor: pointer;
}

.auth-field-error {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: var(--auth-font-weight);
    color: var(--auth-danger-text);
}

/* "Contact your administrator" note sits under the right-aligned Forgot Password link. */
.auth-forgot-hint {
    text-align: right;
}

/* Error slots are always rendered (so JS can fill them); hide them while empty. */
.auth-field-error:empty {
    display: none;
}

.auth-field-hint {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: var(--auth-font-weight);
    color: var(--auth-muted);
}

.auth-alert {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--auth-danger-border);
    border-radius: var(--auth-radius);
    background: var(--auth-danger-bg);
    color: var(--auth-danger-text);
}

/* Icon uses the title's size and line height so both are centred on the first line
   (it was 13px with a 13px line at the top, ~4-5px above the title text). */
.auth-alert > i {
    flex: 0 0 auto;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.auth-alert-title {
    margin: 0 0 2px;
    font-size: 0.9375rem;
    font-weight: 600;
}

.auth-alert-text {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: var(--auth-font-weight);
    line-height: 1.4;
}

/* Banners the user can close (data-auth-banner + close button, auth.js). */
.auth-alert[hidden] {
    display: none;
}

.auth-alert-body,
.auth-note-text {
    flex: 1 1 auto;
    min-width: 0;
}

.auth-banner-close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin: -2px -4px 0 0;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
}

.auth-banner-close:hover,
.auth-banner-close:focus-visible {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
    outline: none;
}

/* Small blue info note above the username (the "contact your administrator" note from Forgot Password). */
.auth-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 12px;
    padding: 8px 12px;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    background: #eff6ff;
    color: #1e40af;
    text-align: left;
}

/* display:flex above would otherwise beat the hidden attribute the Forgot Password toggle sets. */
.auth-note[hidden] {
    display: none;
}

.auth-note > i {
    flex: 0 0 auto;
    font-size: 0.875rem;
    line-height: 1.4;
}

.auth-note-text {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: var(--auth-font-weight);
    line-height: 1.4;
}

.auth-link-row {
    display: flex;
    justify-content: flex-end;
}

.auth-link {
    color: var(--auth-primary);
    font-size: 0.875rem;
    font-weight: var(--auth-font-weight);
    text-decoration: none;
}

.auth-link:hover {
    text-decoration: underline;
    color: var(--auth-primary-hover);
}

.auth-hint {
    margin: 0;
    text-align: center;
    color: var(--auth-muted);
    font-size: 0.8125rem;
    font-weight: var(--auth-font-weight);
    line-height: 1.4;
}

.auth-footer-text {
    margin: 20px 0 0;
    text-align: center;
    color: var(--auth-muted);
    font-size: 0.875rem;
    font-weight: var(--auth-font-weight);
}

.auth-password-rules {
    margin: 0;
    padding: 12px 14px;
    border-radius: var(--auth-radius);
    background: #f3f4f6;
    list-style: none;
}

.auth-password-rules-title {
    margin: 0 0 8px;
    font-size: 0.8125rem;
    font-weight: var(--auth-font-weight);
    color: var(--auth-muted);
}

.auth-password-rules ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.auth-password-rules li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    font-weight: var(--auth-font-weight);
    color: var(--auth-success);
}

.auth-password-rules li + li {
    margin-top: 4px;
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    background: rgba(17, 24, 39, 0.45);
}

.auth-modal.is-open {
    display: flex;
}

.auth-modal-card {
    width: 100%;
    max-width: 420px;
    padding: 28px 22px 22px;
    border-radius: 20px 20px 16px 16px;
    background: var(--auth-surface);
    text-align: center;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.auth-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 14px;
    border-radius: 999px;
    background: #dcfce7;
    color: var(--auth-success);
    font-size: 1.75rem;
}

.auth-modal-title {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 700;
}

.auth-modal-text {
    margin: 0 0 20px;
    color: var(--auth-muted);
    font-size: 0.9rem;
    font-weight: var(--auth-font-weight);
    line-height: 1.45;
}

@media (min-width: 768px) {
    /* Space around the card lives inside the body. A margin on .auth-shell pushed the whole
       body 24px down (margin collapse), showing a dark strip on top and a 24px page scroll. */
    .auth-body {
        padding: 24px 0;
    }

    .auth-shell {
        max-width: 440px;
        min-height: calc(100dvh - 48px);
        margin: 0 auto;
        border: 1px solid var(--auth-border);
        border-radius: 20px;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    }

    .auth-modal {
        align-items: center;
    }

    .auth-modal-card {
        border-radius: 16px;
    }
}
