.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(440px, 1.1fr);
    background: #f8f9fc;
}

.auth-shell[hidden],
#appShell[hidden],
.auth-view[hidden],
.auth-alert[hidden] {
    display: none !important;
}

.auth-context {
    min-height: 100vh;
    padding: clamp(40px, 7vw, 88px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #ffffff;
    background: #1e3a5f;
}

.auth-brand {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.auth-brand-mark {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #e31937;
    color: #ffffff;
    font-size: 28px;
    font-weight: 700;
}

.auth-eyebrow,
.auth-step {
    margin: 0 0 8px;
    color: #b7c7da;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.auth-context h1 {
    max-width: 12ch;
    margin: 0;
    font-size: clamp(30px, 4vw, 48px);
    line-height: 1.12;
    letter-spacing: -0.03em;
}

.auth-context-copy {
    max-width: 52ch;
    margin: 36px 0 32px;
    color: #d7e1ed;
    font-size: 16px;
    line-height: 1.75;
}

.auth-boundaries {
    max-width: 580px;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0;
    list-style: none;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.auth-boundaries li {
    padding: 18px 0;
    display: grid;
    grid-template-columns: 112px 1fr;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.auth-boundaries strong {
    color: #ffffff;
    font-size: 14px;
}

.auth-boundaries span {
    color: #c9d6e5;
    font-size: 13px;
    line-height: 1.6;
}

.auth-panel {
    min-height: 100vh;
    padding: 40px;
    display: grid;
    place-items: center;
}

.auth-card {
    width: min(100%, 520px);
    padding: clamp(28px, 5vw, 48px);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #ffffff;
}

.auth-toolbar {
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.auth-locale-control select {
    min-height: 36px;
    padding: 6px 30px 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #334155;
    background: #ffffff;
    font: inherit;
    font-size: 12px;
}

.auth-locale-control select:focus-visible {
    outline: 3px solid rgba(227, 25, 55, 0.28);
    outline-offset: 2px;
}

.auth-mode {
    width: fit-content;
    margin: 0;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(245, 158, 11, 0.42);
    border-radius: 999px;
    color: #7c4308;
    background: #fff8e8;
    font-size: 12px;
    font-weight: 700;
}

.auth-mode-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #b45309;
}

.auth-heading {
    margin-bottom: 28px;
}

.auth-heading h2,
.auth-loading h2 {
    margin: 0;
    color: #1a1a2e;
    font-size: 28px;
    line-height: 1.25;
}

.auth-heading > p:last-child,
.auth-loading p {
    margin: 10px 0 0;
    color: #526174;
    font-size: 14px;
    line-height: 1.65;
}

.auth-step {
    color: #b81430;
}

.auth-field {
    margin-bottom: 20px;
}

.auth-field label,
.auth-secret-label {
    display: block;
    margin-bottom: 8px;
    color: #26364b;
    font-size: 14px;
    font-weight: 700;
}

.auth-field input {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #ffffff;
    color: #1a1a2e;
    font: inherit;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.auth-field input:hover {
    border-color: #94a3b8;
}

.auth-field input:focus-visible,
.auth-confirmation input:focus-visible,
.auth-primary:focus-visible,
.auth-secondary:focus-visible,
.auth-link:focus-visible,
.logout-button:focus-visible {
    outline: 3px solid rgba(227, 25, 55, 0.28);
    outline-offset: 2px;
}

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

.auth-hint {
    margin: 7px 0 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
}

.auth-primary,
.auth-secondary,
.logout-button {
    min-height: 46px;
    padding: 11px 20px;
    border-radius: 9px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease;
}

.auth-primary {
    width: 100%;
    border: 1px solid #e31937;
    color: #ffffff;
    background: #e31937;
}

.auth-primary:hover:not(:disabled) {
    border-color: #b81430;
    background: #b81430;
}

.auth-secondary {
    border: 1px solid #b8c3d1;
    color: #334155;
    background: #ffffff;
}

.auth-secondary:hover:not(:disabled) {
    border-color: #64748b;
    background: #f8fafc;
}

.auth-primary:disabled,
.auth-secondary:disabled,
.logout-button:disabled {
    cursor: wait;
    opacity: 0.58;
}

.auth-actions {
    display: grid;
    grid-template-columns: minmax(120px, 0.65fr) minmax(160px, 1fr);
    gap: 12px;
}

.auth-actions .auth-primary {
    width: auto;
}

.auth-link {
    min-height: 44px;
    padding: 8px 0;
    border: 0;
    color: #a5112a;
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.auth-link-centered {
    width: 100%;
    margin-top: 10px;
}

.auth-alert,
.auth-status {
    margin-bottom: 20px;
    padding: 12px 14px;
    border-radius: 9px;
    font-size: 13px;
    line-height: 1.55;
}

.auth-alert {
    border: 1px solid #fecaca;
    color: #991b1b;
    background: #fef2f2;
}

.auth-status:empty {
    display: none;
}

.auth-status {
    border: 1px solid #bbf7d0;
    color: #166534;
    background: #f0fdf4;
}

.auth-loading {
    padding: 40px 0;
    text-align: center;
}

.auth-spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto 20px;
    border: 3px solid #e2e8f0;
    border-top-color: #e31937;
    border-radius: 50%;
    animation: auth-spin 700ms linear infinite;
}

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

.auth-enrollment {
    margin-bottom: 22px;
    padding: 18px;
    display: grid;
    grid-template-columns: 136px minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.auth-enrollment img {
    width: 136px;
    height: 136px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
}

.auth-enrollment code {
    display: block;
    overflow-wrap: anywhere;
    color: #1e3a5f;
    font-size: 15px;
    line-height: 1.6;
}

.auth-recovery-codes {
    margin: 0 0 18px;
    padding: 16px 16px 16px 42px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 20px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    color: #1e3a5f;
    background: #f8fafc;
    font-family: Consolas, "SFMono-Regular", monospace;
    font-size: 13px;
}

.auth-confirmation {
    margin: 18px 0;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #334155;
    font-size: 13px;
    line-height: 1.5;
    cursor: pointer;
}

.auth-confirmation input {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: #e31937;
}

.auth-full-width {
    width: 100%;
}

.auth-footer {
    margin: 30px 0 0;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 11px;
    line-height: 1.6;
    text-align: center;
}

.logout-button {
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid #cbd5e1;
    color: #475569;
    background: #ffffff;
}

.logout-button:hover:not(:disabled) {
    border-color: #e31937;
    color: #b81430;
    background: #fff7f8;
}

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

    .auth-context {
        min-height: auto;
        padding: 32px clamp(24px, 6vw, 48px);
    }

    .auth-context h1 {
        max-width: 18ch;
        font-size: 30px;
    }

    .auth-context-copy {
        margin: 22px 0 0;
    }

    .auth-boundaries {
        display: none;
    }

    .auth-panel {
        min-height: auto;
        padding: 32px 20px;
        align-items: start;
    }
}

@media (max-width: 520px) {
    .auth-brand {
        gap: 14px;
    }

    .auth-brand-mark {
        width: 48px;
        height: 48px;
        flex-basis: 48px;
        font-size: 24px;
    }

    .auth-context h1 {
        font-size: 25px;
    }

    .auth-card {
        padding: 24px 20px;
        border-radius: 12px;
    }

    .auth-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .auth-locale-control select,
    .auth-mode {
        width: 100%;
    }

    .auth-heading h2,
    .auth-loading h2 {
        font-size: 24px;
    }

    .auth-actions,
    .auth-enrollment {
        grid-template-columns: 1fr;
    }

    .auth-enrollment img {
        justify-self: center;
    }

    .auth-recovery-codes {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-spinner {
        animation-duration: 1400ms;
    }

    .auth-field input,
    .auth-primary,
    .auth-secondary,
    .logout-button {
        transition: none;
    }
}
