:root {
    color-scheme: dark;
    --bg: #03045e;
    --panel: #090b21;
    --panel-strong: #10143a;
    --border: rgba(148, 163, 184, .16);
    --border-strong: rgba(148, 163, 184, .27);
    --text: #f8fafc;
    --muted: #94a3b8;
    --accent: #00e5ff;
    --accent-dark: #00333a;
    --danger: #fb7185;
    --danger-soft: rgba(244, 63, 94, .1);
    --focus: rgba(0, 229, 255, .26);
    --shadow: 0 30px 90px rgba(0, 0, 0, .48);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    display: grid;
    place-items: center;
    padding: 28px;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 12% 15%, rgba(123, 44, 191, .3), transparent 28rem),
        radial-gradient(circle at 88% 85%, rgba(0, 180, 216, .22), transparent 30rem),
        linear-gradient(135deg, #5f1da8 0%, #03045e 52%, #0077a8 100%);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

.login-shell {
    width: min(1040px, 100%);
    min-height: 620px;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(9, 11, 33, .86);
    box-shadow: var(--shadow);
}

.brand-panel {
    position: relative;
    isolation: isolate;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 40px;
    overflow: hidden;
    border-right: 1px solid var(--border);
    background:
        linear-gradient(145deg, rgba(123, 44, 191, .28), transparent 50%),
        #070b2a;
}

.brand-panel::before,
.brand-panel::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    pointer-events: none;
}

.brand-panel::before {
    width: 390px;
    height: 390px;
    right: -190px;
    top: 90px;
    border: 1px solid rgba(0, 229, 255, .16);
    box-shadow: 0 0 0 50px rgba(123, 44, 191, .06), 0 0 0 100px rgba(0, 229, 255, .025);
}

.brand-panel::after {
    width: 180px;
    height: 180px;
    left: -70px;
    bottom: -70px;
    background: rgba(0, 229, 255, .1);
    filter: blur(8px);
}

.brand-top,
.mobile-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--accent), #fafafa);
    color: #6d7f88;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: -.04em;
    box-shadow: 0 10px 30px rgba(8, 122, 122, 0.2);
}

.brand-name strong,
.brand-name small { display: block; }

.brand-name strong { font-size: 15px; }

.brand-name small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.brand-copy {
    max-width: 470px;
    margin: auto 0;
    padding: 56px 0;
}

.eyebrow {
    display: block;
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.brand-copy h1 {
    max-width: 460px;
    margin: 16px 0 0;
    font-size: clamp(34px, 5vw, 52px);
    line-height: 1.06;
    letter-spacing: -.055em;
}

.brand-copy > p {
    max-width: 440px;
    margin: 20px 0 0;
    color: #b5c0d1;
    font-size: 15px;
    line-height: 1.7;
}

.feature-list {
    display: grid;
    gap: 14px;
    margin: 30px 0 0;
    padding: 0;
    list-style: none;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 11px;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.45;
}

.feature-list svg {
    width: 21px;
    height: 21px;
    flex: 0 0 auto;
    padding: 4px;
    border-radius: 7px;
    background: rgba(0, 229, 255, .1);
    color: var(--accent);
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand-footer {
    margin: 0;
    color: #64748b;
    font-size: 10px;
}

.form-panel {
    min-width: 0;
    display: grid;
    place-items: center;
    padding: 48px;
    background: rgba(9, 11, 33, .85);
}

.form-wrap { width: min(100%, 390px); }

.mobile-brand { display: none; }

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

.form-heading h2 {
    margin: 12px 0 0;
    font-size: 30px;
    line-height: 1.15;
    letter-spacing: -.04em;
}

.form-heading p {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    padding: 12px 14px;
    border: 1px solid rgba(251, 113, 133, .28);
    border-radius: 11px;
    background: var(--danger-soft);
    color: #fecdd3;
    font-size: 12px;
    line-height: 1.5;
}

.login-alert svg {
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
    fill: none;
    stroke: var(--danger);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.login-alert-success {
    border-color: rgba(34, 197, 94, .3);
    background: rgba(34, 197, 94, .1);
    color: #bbf7d0;
}

.login-alert-success svg { stroke: #4ade80; }

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

.field { min-width: 0; }

.field label {
    display: block;
    margin-bottom: 7px;
    color: #dbe4f0;
    font-size: 12px;
    font-weight: 700;
}

.input-wrap { position: relative; }

.input-wrap > svg {
    position: absolute;
    top: 50%;
    left: 14px;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: #64748b;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.input-wrap input {
    width: 100%;
    min-height: 50px;
    padding: 12px 45px;
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    outline: 0;
    background: rgba(5, 8, 18, .52);
    color: var(--text);
    font-size: 14px;
    transition: border-color .18s, box-shadow .18s, background .18s;
}

.input-wrap input::placeholder { color: #64748b; }

.input-wrap:focus-within > svg { color: var(--accent); }

.input-wrap input:focus {
    border-color: var(--accent);
    background: rgba(5, 8, 18, .75);
    box-shadow: 0 0 0 4px var(--focus);
}

.password-wrap input { padding-right: 52px; }

.password-toggle {
    position: absolute;
    inset: 3px 3px 3px auto;
    width: 44px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #8090a7;
    cursor: pointer;
}

.password-toggle:hover { color: var(--text); background: rgba(148, 163, 184, .08); }

.password-toggle:focus-visible,
.submit-button:focus-visible,
.support-copy a:focus-visible,
.form-link-row a:focus-visible,
.back-link:focus-visible,
.secondary-button:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.password-toggle svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.eye-closed,
.password-toggle.showing .eye-open { display: none; }

.password-toggle.showing .eye-closed { display: block; }

.caps-warning {
    display: block;
    margin-top: 7px;
    color: #fbbf24;
    font-size: 11px;
}

.caps-warning[hidden] { display: none; }

.form-link-row {
    display: flex;
    justify-content: flex-end;
    margin-top: -7px;
}

.form-link-row a,
.back-link {
    width: fit-content;
    display: inline-block;
    color: var(--accent);
    font-size: 12px;
    font-weight: 750;
    text-decoration: none;
}

.form-link-row a:hover,
.back-link:hover { text-decoration: underline; }

.field-help {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.code-input {
    padding-inline: 16px !important;
    text-align: center;
    letter-spacing: .38em;
    font-size: 20px !important;
    font-weight: 800;
}

.recovery-actions {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.recovery-actions form { display: grid; }

.secondary-button {
    width: 100%;
    min-height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    background: rgba(148, 163, 184, .06);
    color: #dbe4f0;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
}

.secondary-button:hover { background: rgba(148, 163, 184, .11); }

.password-requirements {
    margin: -4px 0 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(5, 8, 18, .3);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.55;
}

.submit-button {
    min-height: 50px;
    display: grid;
    place-items: center;
    margin-top: 4px;
    border: 0;
    border-radius: 11px;
    background: var(--accent);
    color: #001b22;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
    transition: transform .18s, filter .18s, box-shadow .18s;
}

.submit-button:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 12px 32px rgba(0, 229, 255, .2);
}

.submit-button:disabled { cursor: wait; opacity: .78; }

.button-loading { display: none; align-items: center; gap: 9px; }

.submit-button.loading .button-label { display: none; }
.submit-button.loading .button-loading { display: flex; }

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 27, 34, .3);
    border-top-color: #001b22;
    border-radius: 50%;
    animation: spin .65s linear infinite;
}

.support-copy {
    margin: 24px 0 0;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.support-copy a { color: var(--accent); font-weight: 700; text-decoration: none; }
.support-copy a:hover { text-decoration: underline; }

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0 1000px #090b21 inset;
    caret-color: var(--text);
}

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

@media (max-width: 820px) {
    body { padding: 18px; }
    .login-shell { grid-template-columns: minmax(0, 1fr); min-height: 0; max-width: 520px; }
    .brand-panel { display: none; }
    .form-panel { min-height: min(680px, calc(100dvh - 36px)); padding: 40px; }
    .mobile-brand { display: flex; margin-bottom: 52px; }
    .mobile-brand strong { font-size: 15px; }
}

@media (max-width: 480px) {
    body { display: block; padding: 0; background: var(--panel-strong); }
    .login-shell { width: 100%; min-height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
    .form-panel { min-height: 100dvh; padding: max(28px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom)); }
    .mobile-brand { margin-bottom: 44px; }
    .form-heading h2 { font-size: 27px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
