:root {
    --auth-navy-deep: #04104c;
    --auth-navy: #071b70;
    --auth-blue: #0879d9;
    --auth-cyan: #08aeea;
    --auth-ink: #101827;
    --auth-muted: #5e6f89;
    --auth-line: #c8dceb;
    --auth-danger: #b42318;
    --auth-success: #087a56;
    --auth-radius: 12px;
    --auth-focus: 0 0 0 3px rgba(8, 174, 234, .24);
}

* { box-sizing: border-box; }

html {
    min-height: 100%;
    background: #edf7fd;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: clamp(14px, 3vw, 32px);
    display: grid;
    place-items: center;
    color: var(--auth-ink);
    background:
        radial-gradient(circle at 12% 16%, rgba(8, 174, 234, .11), transparent 28rem),
        linear-gradient(135deg, #f9fcff 0%, #edf7fd 48%, #e3f1f9 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: var(--auth-blue);
    font-weight: 750;
    text-decoration: none;
    text-underline-offset: 3px;
}

a:hover { color: var(--auth-navy); text-decoration: underline; }
button, input { font: inherit; }

.auth-shell {
    width: min(100%, clamp(940px, 58vw, 1120px));
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
    overflow: hidden;
    border: 1px solid var(--auth-line);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(7, 27, 112, .16);
}

.auth-shell-compact {
    width: min(470px, 100%);
    grid-template-columns: 1fr;
}

.auth-brand {
    position: relative;
    min-height: 520px;
    padding: clamp(34px, 4vw, 52px);
    display: grid;
    place-items: center;
    overflow: hidden;
    background: linear-gradient(158deg, #050d2f 0%, var(--auth-navy) 57%, #062477 100%);
}

.auth-brand::before,
.auth-brand::after {
    position: absolute;
    border: 1px solid rgba(105, 220, 248, .14);
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

.auth-brand::before {
    width: 330px;
    height: 330px;
    right: -205px;
    top: -170px;
}

.auth-brand::after {
    width: 230px;
    height: 230px;
    left: -150px;
    bottom: -128px;
}

.auth-brand-content {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
}

.auth-logo {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.auth-brand-message {
    max-width: 370px;
    margin: 24px auto 0;
    color: #c7def0;
    text-align: center;
    font-size: 14px;
    line-height: 1.55;
}

.auth-brand-message strong {
    display: block;
    margin-bottom: 6px;
    color: #fff;
    font-size: 17px;
}

.auth-card {
    align-self: stretch;
    width: 100%;
    min-width: 0;
    padding: clamp(30px, 4vw, 48px) clamp(24px, 4vw, 44px);
    display: grid;
    align-items: center;
    background: #fff;
}

.auth-card-content { width: 100%; }
.auth-card-header { margin-bottom: 26px; }

.auth-kicker {
    margin: 0 0 7px;
    color: var(--auth-blue);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.auth-card h1 {
    margin: 0;
    color: var(--auth-navy);
    font-size: clamp(24px, 2.2vw, 29px);
    line-height: 1.15;
    letter-spacing: -.025em;
}

.auth-card-header > p:last-child,
.auth-card > p {
    margin: 9px 0 0;
    color: var(--auth-muted);
    font-size: 14px;
    line-height: 1.5;
}

.auth-card > p { margin: -14px 0 20px; }
.auth-field { margin-bottom: 17px; }

.auth-field label {
    display: block;
    margin: 0 0 7px;
    color: var(--auth-navy);
    font-size: 14px;
    font-weight: 800;
}

.auth-field input:not([type="checkbox"]) {
    width: 100%;
    height: 50px;
    border: 1px solid #b8cada;
    border-radius: 8px;
    padding: 0 13px;
    outline: none;
    color: var(--auth-ink);
    background: #f8fbfd;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.auth-field input:not([type="checkbox"]):hover { border-color: #91adc2; }
.auth-field input:not([type="checkbox"]):focus {
    border-color: var(--auth-cyan);
    background: #fff;
    box-shadow: var(--auth-focus);
}

.auth-field input[aria-invalid="true"] { border-color: var(--auth-danger); }
.auth-field input:-webkit-autofill { -webkit-text-fill-color: var(--auth-ink); box-shadow: 0 0 0 1000px #f8fbfd inset; }
.auth-password { position: relative; }
.auth-password input { padding-right: 54px; }

.auth-eye {
    position: absolute;
    top: 50%;
    right: 3px;
    width: 44px;
    height: 44px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 7px;
    color: #60758d;
    background: transparent;
    cursor: pointer;
}

.auth-eye:hover,
.auth-eye:focus-visible {
    color: var(--auth-navy);
    background: #e9f6fd;
    outline: 0;
    box-shadow: var(--auth-focus);
}

.auth-eye svg,
.auth-submit svg { width: 18px; height: 18px; }
.auth-error { margin-top: 7px; color: var(--auth-danger); font-size: 13px; font-weight: 750; line-height: 1.4; }
.auth-alert { margin: 0 0 18px; padding: 11px 12px; border-radius: 8px; font-size: 14px; font-weight: 700; line-height: 1.45; }
.auth-alert-success { border: 1px solid #aee5cf; color: var(--auth-success); background: #eafaf4; }

.auth-options {
    margin: 1px 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
}

.auth-options > a,
.auth-check {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.auth-check { gap: 9px; color: #334155; cursor: pointer; }
.auth-check input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.auth-check > span[aria-hidden="true"] {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    display: grid;
    place-items: center;
    border: 1px solid #91abc0;
    border-radius: 5px;
    background: #fff;
}

.auth-check input:checked + span { border-color: var(--auth-blue); background: var(--auth-blue); }
.auth-check input:checked + span::after {
    width: 8px;
    height: 4px;
    margin-top: -2px;
    border: solid #fff;
    border-width: 0 0 2px 2px;
    transform: rotate(-45deg);
    content: "";
}

.auth-check input:focus-visible + span { box-shadow: var(--auth-focus); }

.auth-submit,
.auth-cookie-accept {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(100deg, var(--auth-navy), var(--auth-blue) 72%, var(--auth-cyan));
    font-weight: 850;
    cursor: pointer;
    transition: filter .15s ease, box-shadow .15s ease, transform .15s ease;
}

.auth-submit { width: 100%; }
.auth-submit:hover,
.auth-submit:focus-visible,
.auth-cookie-accept:hover,
.auth-cookie-accept:focus-visible {
    filter: brightness(1.06);
    outline: 0;
    box-shadow: var(--auth-focus);
}

.auth-submit:hover { transform: translateY(-1px); }
.auth-legal {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0 8px;
    font-size: 12px;
}

.auth-legal a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0 5px;
}

.auth-footer {
    grid-column: 1 / -1;
    min-height: 44px;
    padding: 11px 20px;
    display: grid;
    place-items: center;
    border-top: 1px solid #dbe7ef;
    color: var(--auth-muted);
    background: #f8fbfd;
    text-align: center;
    font-size: 12px;
}

.auth-footer strong { color: var(--auth-navy); }
.auth-cookie {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 50;
    width: min(380px, calc(100vw - 36px));
    padding: 18px;
    border: 1px solid var(--auth-line);
    border-radius: var(--auth-radius);
    background: #fff;
    box-shadow: 0 16px 46px rgba(7, 27, 112, .18);
}

.auth-cookie h2 { margin: 0 40px 8px 0; color: var(--auth-navy); font-size: 17px; }
.auth-cookie p { margin: 0 0 12px; color: #334155; font-size: 13px; line-height: 1.45; }
.auth-cookie-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 7px;
    color: var(--auth-muted);
    background: transparent;
    font-size: 22px;
    cursor: pointer;
}

.auth-cookie-close:focus-visible { outline: 0; box-shadow: var(--auth-focus); }
.auth-cookie-accept { padding: 8px 16px; }
.auth-network {
    position: fixed;
    left: 50%;
    bottom: 16px;
    z-index: 60;
    max-width: calc(100vw - 32px);
    padding: 11px 14px;
    transform: translateX(-50%);
    border-radius: 8px;
    color: #fff;
    background: #9b2c2c;
    font-size: 14px;
    font-weight: 750;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}

.error-sheet {
    width: min(680px, 100%);
    padding: clamp(22px, 4vw, 42px);
    border: 1px solid var(--auth-line);
    border-top: 4px solid var(--auth-cyan);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 18px 52px rgba(7, 27, 112, .12);
}

.error-sheet .auth-logo { width: min(270px, 70%); margin: 0 0 22px; }
.error-code { color: var(--auth-blue); font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.error-sheet h1 { margin: 7px 0 9px; color: var(--auth-navy); font-size: clamp(24px, 5vw, 38px); line-height: 1.1; }
.error-sheet p { max-width: 62ch; margin: 0; color: var(--auth-muted); font-size: 15px; line-height: 1.55; }
.error-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 24px; }
.error-action {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border: 1px solid var(--auth-navy);
    border-radius: 6px;
    color: #fff;
    background: var(--auth-navy);
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.error-action:hover,
.error-action:focus-visible { color: #fff; text-decoration: none; filter: brightness(1.06); outline: 0; box-shadow: var(--auth-focus); }
.error-action-secondary { border-color: var(--auth-line); color: var(--auth-navy); background: #fff; }
.error-action-secondary:hover,
.error-action-secondary:focus-visible { color: var(--auth-navy); }

.auth-shell-compact .auth-brand {
    min-height: auto;
    padding: 24px 28px 18px;
}

.auth-shell-compact .auth-logo { width: min(310px, 80vw); margin: auto; }
.auth-shell-compact .auth-brand-message { display: none; }
.auth-shell-compact .auth-card { padding: 30px 28px; }

@media (max-width: 820px) {
    body { align-items: start; }
    .auth-shell { width: min(520px, 100%); grid-template-columns: 1fr; border-radius: 14px; }
    .auth-brand { min-height: auto; padding: 24px 28px 18px; }
    .auth-brand-content { width: min(320px, 72vw); }
    .auth-brand-message { display: none; }
    .auth-card { padding: 30px 28px 32px; }
}

@media (max-width: 420px) {
    body { padding: 8px; }
    .auth-shell { border-radius: 10px; }
    .auth-brand { padding: 17px 20px 12px; }
    .auth-brand-content { width: min(250px, 76vw); }
    .auth-card { padding: 24px 18px 26px; }
    .auth-card-header { margin-bottom: 22px; }
    .auth-options { align-items: flex-start; flex-direction: column; gap: 0; }
    .auth-options > a { margin-top: -4px; }
    .auth-legal { gap: 0 2px; }
    .auth-cookie { right: 8px; bottom: 8px; width: calc(100vw - 16px); }
    .error-sheet { min-height: calc(100dvh - 16px); border-width: 4px 0 0; border-radius: 0; box-shadow: none; }
    .error-actions { display: grid; }
    .error-action { width: 100%; }
}

@media (max-height: 620px) and (min-width: 821px) {
    body { align-items: start; }
    .auth-brand { min-height: 470px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .auth-field input:not([type="checkbox"]),
    .auth-submit,
    .auth-cookie-accept { transition: none; animation: none; }
}
