:root {
    --auth-blue: #00295d;
    --auth-blue-2: #0b3a6d;
    --auth-orange: #e85c3a;
    --auth-ink: #17263d;
    --auth-muted: #62748b;
    --auth-line: rgba(0, 41, 93, 0.12);
    --auth-soft: #f4f7fb;
    --auth-panel: rgba(255, 255, 255, 0.96);
    --auth-shadow: 0 24px 64px rgba(12, 28, 52, 0.18);
    --auth-success: #0f9d58;
    --auth-danger: #d14343;
    --auth-warning: #f59e0b;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body.auth-page {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--auth-ink);
    background:
        radial-gradient(circle at top right, rgba(232, 92, 58, 0.14), transparent 24rem),
        radial-gradient(circle at top left, rgba(0, 41, 93, 0.18), transparent 30rem),
        linear-gradient(180deg, #082349 0%, #0d2441 24%, #edf3f8 24%, #edf3f8 100%);
}

body.auth-page.auth-theme-dark {
    color: #eef4fb;
    background:
        radial-gradient(circle at top right, rgba(232, 92, 58, 0.16), transparent 24rem),
        radial-gradient(circle at top left, rgba(65, 125, 197, 0.18), transparent 28rem),
        linear-gradient(180deg, #091322 0%, #101a2b 24%, #0f1724 24%, #0f1724 100%);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1.25rem;
}

.auth-frame {
    width: min(1080px, 100%);
    display: grid;
    grid-template-columns: minmax(18rem, 26rem) minmax(0, 32rem);
    border: 1px solid var(--auth-line);
    border-radius: 18px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: var(--auth-shadow);
    backdrop-filter: blur(16px);
}

.auth-side {
    padding: 2rem 1.9rem;
    background:
        linear-gradient(180deg, rgba(0, 41, 93, 0.96), rgba(9, 50, 95, 0.93)),
        var(--auth-blue);
    color: #fff;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: #fff;
    min-width: 10.5rem;
}

.auth-brand img {
    width: 8.5rem;
    height: auto;
    object-fit: contain;
}

.auth-kicker {
    margin: 1.35rem 0 0.55rem;
    color: rgba(255, 255, 255, 0.74);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-side h1 {
    margin: 0;
    font-size: clamp(2rem, 2.8vw, 2.7rem);
    line-height: 1.02;
}

.auth-side p {
    margin: 0.9rem 0 0;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.55;
}

.auth-feature-list {
    margin: 1.5rem 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.75rem;
}

.auth-feature-list li {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    padding: 0.85rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.07);
}

.auth-feature-list strong {
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.95rem;
}

.auth-feature-list span {
    color: rgba(255, 255, 255, 0.74);
    font-size: 0.84rem;
    line-height: 1.45;
}

.auth-feature-bullet {
    width: 0.7rem;
    height: 0.7rem;
    margin-top: 0.32rem;
    border-radius: 50%;
    flex: 0 0 0.7rem;
    background: var(--auth-orange);
    box-shadow: 0 0 0 0.22rem rgba(232, 92, 58, 0.2);
}

.auth-card {
    padding: 2rem 1.9rem;
    background: var(--auth-panel);
}

body.auth-page.auth-theme-dark .auth-card {
    background: rgba(16, 27, 43, 0.96);
}

.auth-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.35rem;
}

.auth-card-header h2 {
    margin: 0;
    font-size: 1.55rem;
    line-height: 1.08;
}

.auth-card-header p {
    margin: 0.45rem 0 0;
    color: var(--auth-muted);
    line-height: 1.5;
}

body.auth-page.auth-theme-dark .auth-card-header p,
body.auth-page.auth-theme-dark .auth-meta,
body.auth-page.auth-theme-dark .auth-helper,
body.auth-page.auth-theme-dark .auth-links a {
    color: #b8c5d8;
}

.auth-theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--auth-line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--auth-blue);
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
}

.auth-theme-toggle:hover,
.auth-theme-toggle:focus {
    color: var(--auth-blue);
    text-decoration: none;
    background: #fff;
}

body.auth-page.auth-theme-dark .auth-theme-toggle {
    background: rgba(255, 255, 255, 0.06);
    color: #d9e5f4;
    border-color: rgba(255, 255, 255, 0.14);
}

.auth-alert {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 0.94rem;
    line-height: 1.45;
}

.auth-alert-danger {
    color: #7b1d1d;
    background: rgba(209, 67, 67, 0.12);
    border-color: rgba(209, 67, 67, 0.22);
}

.auth-alert-success {
    color: #0b6a3a;
    background: rgba(15, 157, 88, 0.12);
    border-color: rgba(15, 157, 88, 0.22);
}

.auth-alert-warning {
    color: #8a5300;
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.22);
}

body.auth-page.auth-theme-dark .auth-alert-danger {
    color: #ffd1d1;
}

body.auth-page.auth-theme-dark .auth-alert-success {
    color: #d0ffe5;
}

body.auth-page.auth-theme-dark .auth-alert-warning {
    color: #ffe8bb;
}

.auth-form {
    display: grid;
    gap: 1rem;
}

.auth-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.auth-field label,
.auth-fieldset-label {
    display: block;
    margin-bottom: 0.38rem;
    color: var(--auth-muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.auth-input,
.auth-select {
    width: 100%;
    min-height: 2.9rem;
    padding: 0.78rem 0.9rem;
    border: 1px solid var(--auth-line);
    border-radius: 12px;
    background: #fff;
    color: var(--auth-ink);
    font: inherit;
}

body.auth-page.auth-theme-dark .auth-input,
body.auth-page.auth-theme-dark .auth-select {
    background: rgba(8, 16, 28, 0.88);
    border-color: rgba(255, 255, 255, 0.12);
    color: #eef4fb;
}

.auth-input:focus,
.auth-select:focus {
    outline: none;
    border-color: rgba(0, 41, 93, 0.42);
    box-shadow: 0 0 0 0.22rem rgba(0, 41, 93, 0.12);
}

.auth-helper {
    margin-top: 0.36rem;
    color: var(--auth-muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

.auth-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}

.auth-row-start {
    justify-content: flex-start;
}

.auth-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.9rem;
    padding: 0.78rem 1rem;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--auth-blue);
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
}

.auth-button:hover,
.auth-button:focus {
    color: #fff;
    text-decoration: none;
    background: #001f45;
}

.auth-button-secondary {
    background: transparent;
    color: var(--auth-blue);
    border-color: rgba(0, 41, 93, 0.22);
}

.auth-button-secondary:hover,
.auth-button-secondary:focus {
    color: #fff;
    background: var(--auth-blue);
}

body.auth-page.auth-theme-dark .auth-button-secondary {
    color: #e5eef9;
    border-color: rgba(255, 255, 255, 0.16);
}

body.auth-page.auth-theme-dark .auth-button-secondary:hover,
body.auth-page.auth-theme-dark .auth-button-secondary:focus {
    background: rgba(255, 255, 255, 0.12);
}

.auth-button-ghost {
    background: transparent;
    color: var(--auth-blue);
    border-color: transparent;
    padding-left: 0;
    padding-right: 0;
    min-height: auto;
}

.auth-button-ghost:hover,
.auth-button-ghost:focus {
    color: #001f45;
    background: transparent;
}

body.auth-page.auth-theme-dark .auth-button-ghost {
    color: #dbe8f8;
}

.auth-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1.1rem;
}

.auth-links a {
    color: var(--auth-blue);
    font-weight: 700;
    text-decoration: none;
}

.auth-links a:hover,
.auth-links a:focus {
    text-decoration: underline;
}

.auth-divider {
    height: 1px;
    margin: 1rem 0;
    background: var(--auth-line);
}

.auth-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    padding: 0.38rem 0.68rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.78rem;
    font-weight: 800;
}

.auth-code-input {
    font-size: 1.2rem;
    letter-spacing: 0.3em;
    text-align: center;
}

.auth-meta {
    color: var(--auth-muted);
    font-size: 0.86rem;
}

.auth-note-card {
    margin-top: 1rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--auth-line);
    border-radius: 12px;
    background: var(--auth-soft);
}

body.auth-page.auth-theme-dark .auth-note-card {
    background: rgba(255, 255, 255, 0.04);
}

.auth-qr {
    display: block;
    width: min(15rem, 100%);
    margin: 0 auto;
    border-radius: 14px;
    border: 1px solid var(--auth-line);
    background: #fff;
    padding: 0.75rem;
}

.auth-secret {
    width: 100%;
    margin-top: 0.7rem;
    padding: 0.75rem 0.85rem;
    border: 1px dashed rgba(0, 41, 93, 0.24);
    border-radius: 10px;
    background: rgba(0, 41, 93, 0.04);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.92rem;
    word-break: break-all;
}

body.auth-page.auth-theme-dark .auth-secret {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.04);
}

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

    .auth-side,
    .auth-card {
        padding: 1.5rem 1.25rem;
    }
}

@media (max-width: 640px) {
    .auth-shell {
        padding: 0.9rem;
    }

    .auth-grid-2,
    .auth-row {
        grid-template-columns: 1fr;
    }

    .auth-card-header {
        flex-direction: column;
    }

    .auth-theme-toggle {
        width: 100%;
        justify-content: center;
    }
}
