:root {
    --bg: #060a12;
    --bg-deep: #050911;
    --panel: #0a121e;
    --cyan: #48c9eb;
    --cyan-strong: #a1e8f8;
    --text: #f3f6fb;
    --text-soft: #a5b2c3;
    --muted: #6a7c92;
    --red: #fb8191;
    --green: #71d4ba;
    --line: rgba(138, 169, 199, .16);
    color-scheme: dark;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg-deep); -webkit-text-size-adjust: 100%; }
body { margin: 0; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.gateway-body {
    display: flow-root;
    min-height: 100vh;
    min-height: 100svh;
    color: var(--text);
    background:
        radial-gradient(ellipse at 24% 44%, rgba(23, 57, 80, .22), transparent 44%),
        radial-gradient(ellipse at 78% 36%, rgba(15, 40, 66, .16), transparent 38%),
        var(--bg-deep);
}
.gateway-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    width: calc(100% - 48px);
    min-height: calc(100vh - 48px);
    min-height: calc(100svh - 48px);
    margin: 24px;
    border: 1px solid var(--line);
    background: linear-gradient(120deg, rgba(8, 15, 25, .65), rgba(6, 11, 20, .82));
    isolation: isolate;
}
.gateway-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: .3;
    background:
        linear-gradient(rgba(97, 128, 158, .07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(97, 128, 158, .07) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: radial-gradient(ellipse at 30% 44%, #000, transparent 66%);
}
.corner { position: absolute; width: 24px; height: 24px; pointer-events: none; }
.corner::before, .corner::after { content: ""; position: absolute; background: rgba(72, 201, 235, .62); }
.corner::before { width: 20px; height: 1px; }
.corner::after { width: 1px; height: 20px; }
.corner-tl { top: -1px; left: -1px; }
.corner-tr { top: -1px; right: -1px; }
.corner-bl { bottom: -1px; left: -1px; }
.corner-br { bottom: -1px; right: -1px; }
.corner-tr::before, .corner-br::before, .corner-tr::after, .corner-br::after { right: 0; }
.corner-bl::before, .corner-br::before, .corner-bl::after, .corner-br::after { bottom: 0; }

.gateway-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 29px 40px 16px;
}
.brand-block { display: flex; align-items: center; gap: 18px; min-width: 0; }
.brand-wordmark { color: #f6f8fc; font-size: 18px; font-weight: 750; letter-spacing: .19em; line-height: 1; }
.brand-logo { display: block; width: 135px; height: auto; }
.brand-kicker, .network-state, .panel-eyebrow, .field-label, .gateway-footer, .verification {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.brand-kicker { color: var(--muted); font-size: 9px; letter-spacing: .12em; line-height: 1.5; }
.brand-meta, .gateway-id { display: none; }
.network-state { display: flex; align-items: center; gap: 8px; color: #8b9bad; font-size: 9px; letter-spacing: .08em; line-height: 1.5; }
.state-dot { display: inline-block; flex: 0 0 auto; width: 5px; height: 5px; border-radius: 50%; }
.state-dot-green { background: var(--green); }
.state-dot-cyan { background: var(--cyan); }

.gateway-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(40px, 6vw, 94px);
    flex: 1;
    width: min(1080px, 100%);
    margin: 0 auto;
    padding: 45px 52px 66px;
}
.identity-visual { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; }
.identity-visual::before {
    content: "";
    position: absolute;
    width: 118%;
    aspect-ratio: 1;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(38, 103, 145, .11), transparent 68%);
}
.identity-stage { position: relative; display: grid; place-items: center; width: min(100%, 430px); aspect-ratio: 1; }
.orbit { position: absolute; border: 1px solid rgba(104, 175, 208, .15); border-radius: 50%; pointer-events: none; }
.orbit-outer { inset: 0; border-style: dashed; border-color: rgba(104, 175, 208, .14); animation: gateway-orbit 100s linear infinite; }
.orbit-mid { inset: 8%; border-color: rgba(104, 175, 208, .18); border-top-color: rgba(99, 210, 237, .55); border-right-color: transparent; transform: rotate(28deg); }
.orbit-inner { inset: 17%; border-color: rgba(104, 175, 208, .12); border-left-color: rgba(99, 210, 237, .36); }
.orbit-break { position: absolute; height: 1px; width: 28px; background: rgba(114, 208, 231, .5); pointer-events: none; }
.orbit-break-a { right: -2px; top: 48%; }
.orbit-break-b { left: -2px; top: 48%; }
.logo-core { position: relative; display: grid; place-items: center; width: 52%; aspect-ratio: 1; }
.emblem-window { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; }
/* Display the emblem region of the existing 2172 × 724 brand image. */
.brand-emblem { position: absolute; display: block; width: 350.322581%; height: auto; max-width: none; left: -30.645161%; top: -6.451613%; }
.center-emblem { display: block; width: 100%; height: auto; }
.ambient-map, .data-ray, .scan-line, .system-log, .telemetry, .authorization-strip { display: none; }

.login-panel {
    position: relative;
    width: 100%;
    max-width: 430px;
    min-width: 0;
    justify-self: start;
    padding: 40px 34px 28px;
    border: 1px solid rgba(107, 157, 193, .29);
    background: linear-gradient(145deg, rgba(13, 24, 38, .94), rgba(8, 16, 27, .98));
    box-shadow: 0 22px 65px rgba(0, 0, 0, .2), inset 0 1px 0 rgba(232, 245, 255, .025);
}
.login-panel::before, .login-panel::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    pointer-events: none;
    background: var(--bg-deep);
}
.login-panel::before { left: -1px; top: -1px; border-right: 1px solid rgba(107, 157, 193, .36); transform: rotate(45deg) translate(-50%, -50%); }
.login-panel::after { right: -1px; bottom: -1px; border-left: 1px solid rgba(107, 157, 193, .36); transform: rotate(45deg) translate(50%, 50%); }
.panel-marker { position: absolute; background: rgba(72, 201, 235, .8); }
.marker-top { top: -1px; right: 30px; width: 37px; height: 1px; }
.marker-side { top: 47px; left: -1px; width: 1px; height: 30px; }
.panel-eyebrow { margin-bottom: 20px; color: #79a0b9; font-size: 9px; letter-spacing: .13em; line-height: 1.6; }
.panel-title-row { display: flex; align-items: center; gap: 12px; }
.panel-title-row h1 { margin: 0; color: var(--text); font-size: clamp(28px, 2.6vw, 36px); font-weight: 600; letter-spacing: -.035em; line-height: 1.15; }
.lock-icon { display: none; }
.panel-subtitle { margin: 12px 0 31px; color: #94a5b8; font-size: 14px; line-height: 1.6; }
.login-form { display: grid; gap: 14px; min-width: 0; }
.field-label { color: #a1b4c8; font-size: 10px; line-height: 1.5; letter-spacing: .1em; }
.field-shell { position: relative; display: flex; align-items: center; min-height: 54px; min-width: 0; border: 1px solid rgba(128, 162, 191, .24); background: rgba(5, 12, 22, .7); transition: border-color 160ms ease, box-shadow 160ms ease; }
.field-shell.credential-field { margin-top: 18px; }
.credential-field .field-label { position: absolute; top: -23px; left: -1px; }
.field-shell:focus-within { border-color: rgba(91, 208, 237, .78); box-shadow: 0 0 0 3px rgba(72, 201, 235, .08); }
.field-shell.field-error { border-color: rgba(251, 129, 145, .58); }
.field-icon { display: flex; flex: 0 0 auto; width: 18px; height: 18px; margin-left: 16px; color: #7691a8; }
.field-icon svg { width: 100%; height: 100%; }
.field-shell input { width: 100%; min-width: 0; min-height: 52px; padding: 0 52px 0 13px; border: 0; outline: 0; background: transparent; color: #eaf3fb; font-size: 16px; line-height: 1.3; }
.field-shell input::placeholder { color: #61768b; opacity: 1; font-size: 13px; }
.field-shell input[readonly] { color: #8197ac; font-size: 12px; letter-spacing: .06em; }
.field-shell.identity-field { min-height: 44px; border-color: rgba(128, 162, 191, .16); background: rgba(6, 13, 23, .4); }
.identity-field input { min-height: 42px; }
.password-toggle { position: absolute; right: 5px; top: 50%; display: grid; place-items: center; width: 44px; height: 44px; padding: 11px; transform: translateY(-50%); border: 1px solid #536a7d; background: #182534; color: #d1dde9; cursor: pointer; }
.password-toggle svg { width: 20px; height: 20px; }
.gateway-submit { position: relative; display: flex; align-items: center; width: 100%; min-height: 54px; padding: 13px 48px 13px 18px; margin-top: 2px; border: 1px solid #77def5; background: var(--cyan); color: #04101a; box-shadow: inset 0 1px 0 rgba(161, 232, 248, .5), 0 3px 12px rgba(0, 0, 0, .2); font-size: 14px; font-weight: 600; line-height: 1.4; letter-spacing: .01em; cursor: pointer; text-align: left; transition: background 160ms ease, border-color 160ms ease; }
.submit-arrow { position: absolute; top: 50%; right: 18px; transform: translateY(-52%); color: inherit; font-size: 23px; line-height: 1; font-weight: 400; }
.gateway-submit:disabled { opacity: .65; cursor: wait; }
.gateway-submit.is-processing { border-color: var(--cyan-strong); }
.login-panel .login-form + .login-form .gateway-submit { min-height: 46px; border-color: #536a7d; background: #182534; color: #d1dde9; font-size: 13px; box-shadow: none; }
.gateway-submit:not(:disabled):active { transform: translateY(1px); }
.verification { display: flex; align-items: flex-start; justify-content: center; gap: 8px; margin-top: 24px; color: #7b9db0; font-size: 9px; letter-spacing: .045em; line-height: 1.6; }
.verification-dot { flex: 0 0 auto; width: 4px; height: 4px; margin-top: 5px; border-radius: 50%; background: var(--cyan); }
.verification.is-error { color: #eda1ad; }
.verification.is-error .verification-dot { background: var(--red); }
.verification.is-verifying .verification-dot { animation: gateway-pulse 1s ease-in-out infinite; }
.security-note { display: flex; align-items: flex-start; gap: 9px; padding-top: 18px; margin-top: 22px; border-top: 1px solid var(--line); color: #7a91a6; }
.security-note-icon { display: grid; place-items: center; flex: 0 0 auto; width: 15px; height: 15px; margin-top: 1px; border: 1px solid rgba(139, 164, 186, .4); border-radius: 50%; font-size: 9px; }
.security-note strong { display: block; font-size: 9px; font-weight: 600; letter-spacing: .07em; line-height: 1.6; }
.security-note span:not(.security-note-icon) { display: block; margin-top: 3px; font-size: 9px; line-height: 1.6; letter-spacing: .025em; }
.gateway-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; padding: 12px 40px 26px; color: #6e8197; font-size: 8px; line-height: 1.7; letter-spacing: .055em; }
.gateway-footer .state-dot { margin-right: 7px; vertical-align: middle; }
.footer-muted { margin-left: 8px; color: #53667c; }
.footer-right { margin-left: auto; }
.has-error .login-panel { border-color: rgba(202, 106, 123, .46); }
.has-error .panel-marker { background: var(--red); }
:where(button, a):focus-visible { outline: 2px solid var(--cyan-strong); outline-offset: 4px; }

@media (hover: hover) {
    .gateway-submit:not(:disabled):hover { background: #6bd8f2; border-color: var(--cyan-strong); }
    .login-panel .login-form + .login-form .gateway-submit:not(:disabled):hover { background: #24384c; border-color: #8099ae; }
    .password-toggle:hover { color: #edf5fb; border-color: #8099ae; background: #24384c; }
}

@media (max-width: 980px) {
    .gateway-header { padding: 25px 28px 12px; }
    .gateway-layout { gap: 32px; padding: 35px 34px 50px; }
    .identity-stage { width: min(100%, 340px); }
    .login-panel { padding: 34px 26px 26px; }
    .gateway-footer { padding-right: 28px; padding-left: 28px; }
}

@media (max-width: 700px) {
    .gateway-shell { width: calc(100% - 24px); min-height: calc(100svh - 24px); margin: 12px; }
    .gateway-header { padding: calc(20px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 8px max(20px, env(safe-area-inset-left)); gap: 16px; }
    .brand-block { align-items: flex-start; flex-direction: column; gap: 6px; }
    .brand-wordmark { font-size: 16px; }
    .brand-logo { width: 118px; }
    .brand-kicker { font-size: 8px; }
    .network-state { font-size: 8px; letter-spacing: .045em; }
    .gateway-layout { grid-template-columns: minmax(0, 1fr); gap: 22px; padding: 12px max(20px, env(safe-area-inset-right)) 30px max(20px, env(safe-area-inset-left)); }
    .identity-stage { width: 160px; }
    .orbit-outer { animation: none; }
    .logo-core { width: 55%; }
    .login-panel { justify-self: center; max-width: 390px; padding: 28px 24px 22px; }
    .panel-eyebrow { margin-bottom: 16px; font-size: 8px; }
    .panel-title-row h1 { font-size: 29px; }
    .panel-subtitle { margin: 10px 0 25px; font-size: 13px; }
    .verification { margin-top: 21px; }
    .security-note { margin-top: 18px; padding-top: 15px; }
    .gateway-footer { padding: 4px max(20px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); font-size: 7px; }
    .footer-muted { display: block; margin-left: 13px; }
}

@media (max-width: 370px) {
    .gateway-header { padding-right: 16px; padding-left: 16px; }
    .network-state { max-width: 95px; font-size: 7px; }
    .gateway-layout { padding-right: 14px; padding-left: 14px; gap: 18px; }
    .identity-stage { width: 140px; }
    .login-panel { padding-right: 18px; padding-left: 18px; }
    .panel-title-row h1 { font-size: 27px; }
}

@media (max-height: 700px) and (min-width: 701px) {
    .gateway-layout { padding-top: 20px; padding-bottom: 32px; }
    .gateway-header { padding-top: 22px; }
    .identity-stage { width: min(100%, 350px); }
}

@media (max-height: 600px) and (max-width: 1100px) and (orientation: landscape) {
    .identity-visual { display: none; }
    .gateway-layout { grid-template-columns: minmax(0, 1fr); padding-top: 12px; padding-bottom: 24px; }
    .login-panel { justify-self: center; max-width: 430px; }
    .gateway-header { padding-top: calc(18px + env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

@keyframes gateway-orbit { to { transform: rotate(360deg); } }
@keyframes gateway-pulse { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }
