:root {
    color-scheme: dark;
    --bg: #090b12;
    --surface: rgba(21, 24, 38, 0.78);
    --surface-solid: #151826;
    --surface-input: rgba(8, 10, 18, 0.72);
    --border: rgba(198, 205, 255, 0.16);
    --border-strong: rgba(198, 205, 255, 0.28);
    --text: #f3f4fb;
    --muted: #aeb3c7;
    --subtle: #7f869f;
    --accent: #7276e8;
    --accent-deep: #6559c9;
    --danger: #ffb6c1;
    --danger-bg: rgba(115, 38, 57, 0.3);
    --success: #b8e0d1;
    --success-bg: rgba(35, 91, 76, 0.26);
    --panel-radius: 20px;
    --control-radius: 12px;
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html {
    min-width: 320px;
    background: var(--bg);
}

body {
    min-width: 320px;
    min-height: 100dvh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 18% 18%, rgba(87, 91, 189, 0.2), transparent 31rem),
        linear-gradient(145deg, #0d101a 0%, var(--bg) 52%, #10111d 100%);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(115deg, rgba(255, 255, 255, 0.025), transparent 34%);
}

button, input { font: inherit; }

.auth-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 500px);
    gap: clamp(3rem, 7vw, 8rem);
    width: min(1180px, calc(100% - 64px));
    min-height: 100dvh;
    margin: 0 auto;
    padding: clamp(36px, 6vw, 76px) 0;
}

.brand-pane, .form-pane { min-width: 0; }

.brand-pane {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 0;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand-mark {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    color: #e7e8ff;
    background: rgba(114, 118, 232, 0.13);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    font-size: 1.35rem;
    font-weight: 760;
    letter-spacing: -0.08em;
}

.brand-name, .brand-division, .environment-label, .environment-note,
.brand-footer, .panel-kicker, .panel-heading p, .security-note { margin: 0; }

.brand-name {
    font-size: 1.12rem;
    font-weight: 720;
    letter-spacing: -0.02em;
}

.brand-division {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 560;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.environment-copy {
    max-width: 550px;
    padding-left: clamp(22px, 3vw, 38px);
    border-left: 1px solid var(--border-strong);
}

.environment-label {
    color: #c7c9ff;
    font-size: clamp(2.5rem, 5.4vw, 5.2rem);
    font-weight: 660;
    letter-spacing: -0.064em;
    line-height: 0.94;
}

.environment-note {
    max-width: 42ch;
    margin-top: 24px;
    color: var(--muted);
    font-size: clamp(0.98rem, 1.4vw, 1.08rem);
    line-height: 1.7;
}

.brand-footer {
    color: var(--subtle);
    font-size: 0.82rem;
    letter-spacing: 0.015em;
}

.form-pane {
    display: flex;
    align-items: center;
}

.login-panel, .error-panel {
    position: relative;
    isolation: isolate;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012)),
        var(--surface);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 28px 80px rgba(5, 7, 16, 0.46);
    backdrop-filter: blur(24px) saturate(135%);
    -webkit-backdrop-filter: blur(24px) saturate(135%);
}

.login-panel { padding: clamp(28px, 4.2vw, 48px); }

.login-panel::before, .error-panel::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -120px;
    right: -90px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(111, 102, 217, 0.15);
    filter: blur(18px);
}

.panel-heading { margin-bottom: 30px; }

.panel-kicker {
    color: #c7c9ff;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h1 {
    max-width: 13ch;
    margin: 12px 0 14px;
    font-size: clamp(2rem, 4.1vw, 3.15rem);
    font-weight: 680;
    letter-spacing: -0.052em;
    line-height: 1.02;
}

.panel-heading > p:last-child, .error-panel > p {
    max-width: 46ch;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.65;
}

form { display: grid; gap: 20px; }
.field-group { display: grid; gap: 9px; }

label {
    color: #d9dbea;
    font-size: 0.82rem;
    font-weight: 650;
}

input {
    width: 100%;
    height: 52px;
    border: 1px solid var(--border);
    border-radius: var(--control-radius);
    outline: none;
    color: var(--text);
    background: var(--surface-input);
    padding: 0 16px;
    caret-color: #bfc2ff;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

input:hover { border-color: var(--border-strong); }

input:focus-visible {
    border-color: rgba(153, 158, 255, 0.78);
    background: rgba(10, 12, 22, 0.88);
    box-shadow: 0 0 0 4px rgba(114, 118, 232, 0.16);
}

button {
    width: 100%;
    min-height: 52px;
    margin-top: 4px;
    border: 0;
    border-radius: var(--control-radius);
    color: #f8f8ff;
    background: linear-gradient(115deg, var(--accent), var(--accent-deep));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 12px 30px rgba(54, 45, 145, 0.26);
    padding: 0 22px;
    cursor: pointer;
    font-weight: 720;
    letter-spacing: -0.01em;
    white-space: nowrap;
    transition: transform 150ms ease, filter 150ms ease, box-shadow 150ms ease;
}

button:hover {
    filter: brightness(1.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 15px 34px rgba(54, 45, 145, 0.32);
}

button:focus-visible, .text-link:focus-visible {
    outline: 3px solid rgba(188, 191, 255, 0.9);
    outline-offset: 3px;
}

button:active { transform: translateY(1px) scale(0.99); }

.message {
    margin: -8px 0 22px;
    border: 1px solid;
    border-radius: var(--control-radius);
    padding: 12px 14px;
    font-size: 0.86rem;
    line-height: 1.5;
}

.message-error { border-color: rgba(255, 182, 193, 0.24); color: var(--danger); background: var(--danger-bg); }
.message-success { border-color: rgba(184, 224, 209, 0.22); color: var(--success); background: var(--success-bg); }

.security-note {
    margin-top: 22px;
    color: var(--subtle);
    font-size: 0.76rem;
    line-height: 1.55;
    text-align: center;
}

.error-page { display: grid; place-items: center; padding: 24px; }
.error-panel { max-width: 620px; padding: clamp(30px, 6vw, 64px); }
.error-panel h1 { margin-bottom: 14px; }

.text-link {
    display: inline-block;
    margin-top: 24px;
    border-radius: 6px;
    color: #c7c9ff;
    font-weight: 650;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

@media (max-width: 820px) {
    .auth-shell {
        grid-template-columns: 1fr;
        gap: 36px;
        width: min(100% - 32px, 560px);
        padding: 28px 0;
    }
    .brand-pane { gap: 34px; padding: 0; }
    .environment-copy { padding-left: 20px; }
    .environment-label { max-width: 10ch; font-size: clamp(2.35rem, 12vw, 4rem); }
    .brand-footer { display: none; }
    .form-pane { align-items: flex-start; }
}

@media (max-width: 440px) {
    .auth-shell { width: min(100% - 24px, 560px); gap: 26px; padding: 20px 0; }
    .brand-mark { width: 44px; height: 44px; }
    .environment-note { margin-top: 16px; }
    .login-panel { padding: 25px 20px; }
    .panel-heading { margin-bottom: 25px; }
    h1 { font-size: 2rem; }
}

@media (prefers-reduced-transparency: reduce) {
    .login-panel, .error-panel {
        background: var(--surface-solid);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}
