:root {
    --brand-blue: #1767c7;
    --brand-blue-dark: #0b3e7b;
    --brand-navy: #082f63;
    --brand-orange: #ff7a00;
    --text-main: #172033;
    --text-muted: #687386;
    --border: #dce4ee;
    --surface: #ffffff;
    --page-bg: #eef3f9;
    --focus: rgba(23, 103, 199, 0.18);
    --danger: #c7363f;
    --danger-bg: #fff3f3;
    --warning: #9a6500;
    --warning-bg: #fff8e8;
    --shadow: 0 28px 80px rgba(10, 38, 75, 0.16);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--page-bg);
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    min-height: 100svh;
    color: var(--text-main);
    background: var(--page-bg);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input {
    font: inherit;
}

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

.login-page {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 4vw, 54px);
    overflow: hidden;
    isolation: isolate;
}

.login-background {
    position: absolute;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(239, 245, 252, 0.84)),
        var(--page-bg);
}

.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    opacity: 0.72;
    pointer-events: none;
}

.glow-one {
    width: min(44vw, 720px);
    aspect-ratio: 1;
    left: -15vw;
    top: -22vw;
    background: radial-gradient(circle, rgba(23, 103, 199, 0.16) 0%, rgba(23, 103, 199, 0) 68%);
}

.glow-two {
    width: min(40vw, 650px);
    aspect-ratio: 1;
    right: -12vw;
    bottom: -20vw;
    background: radial-gradient(circle, rgba(255, 122, 0, 0.11) 0%, rgba(255, 122, 0, 0) 68%);
}

.grid-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.34;
    background-image:
        linear-gradient(rgba(25, 71, 123, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(25, 71, 123, 0.035) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent 82%);
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent 82%);
}

.login-shell {
    width: min(1100px, 100%);
    min-height: 650px;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid rgba(216, 226, 238, 0.9);
    border-radius: 30px;
    box-shadow: var(--shadow);
}

.brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: clamp(38px, 5vw, 62px);
    color: #fff;
    overflow: hidden;
    background:
        radial-gradient(circle at 90% 12%, rgba(59, 142, 240, 0.42), transparent 31%),
        radial-gradient(circle at 16% 88%, rgba(255, 122, 0, 0.14), transparent 28%),
        linear-gradient(145deg, #0a3b78 0%, #0b529f 58%, #1369bc 100%);
}

.brand-panel::before,
.brand-panel::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    pointer-events: none;
}

.brand-panel::before {
    width: 360px;
    height: 360px;
    right: -190px;
    top: 80px;
}

.brand-panel::after {
    width: 520px;
    height: 520px;
    right: -258px;
    top: 0;
}

.brand-top,
.brand-copy,
.brand-features,
.brand-footer {
    position: relative;
    z-index: 1;
}

.brand-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.brand-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 192px;
    height: 58px;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(5, 34, 71, 0.16);
}

.brand-logo {
    display: block;
    width: 100%;
    height: auto;
}

.system-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 8px 11px;
    color: rgba(255, 255, 255, 0.88);
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    backdrop-filter: blur(8px);
}

.system-badge svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
}

.brand-copy {
    max-width: 510px;
    margin-top: auto;
    padding-top: 52px;
}

.eyebrow {
    display: inline-block;
    margin-bottom: 18px;
    color: #bcd8f7;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.17em;
}

.brand-copy h1 {
    margin: 0;
    max-width: 500px;
    font-size: clamp(36px, 4vw, 50px);
    line-height: 1.08;
    letter-spacing: -0.035em;
    font-weight: 730;
}

.brand-copy p {
    max-width: 470px;
    margin: 23px 0 0;
    color: rgba(239, 247, 255, 0.84);
    font-size: 16px;
    line-height: 1.7;
}

.brand-features {
    display: grid;
    gap: 12px;
    margin-top: 42px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
}

.feature-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: #dbeeff;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 12px;
}

.feature-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.feature-item > span:last-child {
    display: grid;
    gap: 3px;
}

.feature-item strong {
    color: #fff;
    font-size: 14px;
    font-weight: 650;
}

.feature-item small {
    color: rgba(229, 241, 253, 0.67);
    font-size: 12px;
    line-height: 1.4;
}

.brand-footer {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: auto;
    padding-top: 42px;
    color: rgba(226, 239, 252, 0.68);
    font-size: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #5ce19e;
    border: 2px solid rgba(255, 255, 255, 0.23);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(92, 225, 158, 0.09);
}

.form-panel {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: clamp(34px, 4.2vw, 58px);
    background: rgba(255, 255, 255, 0.99);
}

.mobile-brand {
    display: none;
}

.form-content {
    width: min(100%, 430px);
    margin: auto;
}

.form-header {
    margin-bottom: 34px;
}

.form-kicker {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--brand-blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
}

.form-header h2 {
    margin: 0;
    color: #152238;
    font-size: clamp(30px, 3vw, 37px);
    line-height: 1.16;
    letter-spacing: -0.035em;
    font-weight: 730;
}

.form-header p {
    margin: 12px 0 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 25px;
    padding: 14px 15px;
    border: 1px solid;
    border-radius: 13px;
    font-size: 13px;
}

.login-alert-error {
    color: #8e252d;
    background: var(--danger-bg);
    border-color: #f1c9cc;
}

.login-alert-warning {
    color: #785005;
    background: var(--warning-bg);
    border-color: #efdca6;
}

.alert-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    margin-top: 1px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.62);
}

.alert-icon svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.login-alert strong {
    display: block;
    margin-bottom: 3px;
    color: currentColor;
    font-size: 13px;
    font-weight: 700;
}

.login-alert p {
    margin: 0;
    color: currentColor;
    line-height: 1.45;
    opacity: 0.88;
}

.login-form {
    display: grid;
    gap: 21px;
}

.field-group {
    display: grid;
    gap: 8px;
}

.field-group label {
    color: #27364b;
    font-size: 13px;
    font-weight: 650;
}

.label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.field-control {
    position: relative;
    display: flex;
    align-items: center;
    height: 52px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field-control:focus-within {
    border-color: #6da8e9;
    box-shadow: 0 0 0 4px var(--focus);
}

.field-control.has-error {
    border-color: #dc777d;
    background: #fffbfb;
}

.field-control.has-error:focus-within {
    box-shadow: 0 0 0 4px rgba(199, 54, 63, 0.11);
}

.field-icon {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 49px;
    height: 100%;
    color: #8290a3;
}

.field-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.field-control input {
    min-width: 0;
    flex: 1;
    align-self: stretch;
    padding: 0 14px 0 0;
    color: #172337;
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 14px;
}

.field-control input::placeholder {
    color: #a0abba;
}

.field-control input:-webkit-autofill,
.field-control input:-webkit-autofill:hover,
.field-control input:-webkit-autofill:focus {
    -webkit-text-fill-color: #172337;
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    transition: background-color 9999s ease-in-out 0s;
}

.password-toggle {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-right: 2px;
    padding: 0;
    color: #7c899b;
    background: transparent;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    transition: color 150ms ease, background 150ms ease;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--brand-blue);
    background: #f1f6fc;
    outline: 0;
}

.password-toggle svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

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

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

.field-feedback,
.caps-lock {
    min-height: 0;
    color: var(--danger);
    font-size: 11px;
    line-height: 1.35;
}

.field-feedback:empty {
    display: none;
}

.caps-lock {
    display: none;
    color: #9a6500;
}

.caps-lock.is-visible {
    display: block;
}

.login-button {
    position: relative;
    width: 100%;
    height: 52px;
    margin-top: 2px;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(100deg, #1767c7 0%, #0b55aa 100%);
    border: 0;
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(13, 87, 173, 0.2);
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.login-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 15px 28px rgba(13, 87, 173, 0.25);
    filter: brightness(1.025);
}

.login-button:active:not(:disabled) {
    transform: translateY(0);
}

.login-button:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 4px var(--focus), 0 12px 24px rgba(13, 87, 173, 0.2);
}

.login-button:disabled {
    cursor: wait;
    opacity: 0.88;
}

.button-content,
.button-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100%;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 700;
}

.button-content svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    transition: transform 160ms ease;
}

.login-button:hover .button-content svg {
    transform: translateX(2px);
}

.button-loading {
    display: none;
}

.login-button.is-loading .button-content {
    display: none;
}

.login-button.is-loading .button-loading {
    display: flex;
}

.spinner {
    width: 17px;
    height: 17px;
    border: 2px solid rgba(255, 255, 255, 0.38);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.access-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 25px;
    color: #8290a1;
    font-size: 11px;
}

.access-note svg {
    width: 14px;
    height: 14px;
    fill: #8393a7;
}

.form-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 42px;
    color: #9aa4b2;
    font-size: 11px;
}

.footer-separator {
    color: #c9d0d9;
}

@media (max-width: 960px) {
    .login-page {
        padding: 24px;
    }

    .login-shell {
        min-height: 600px;
        grid-template-columns: minmax(0, 0.88fr) minmax(390px, 1.12fr);
    }

    .brand-panel {
        padding: 38px;
    }

    .brand-top {
        display: block;
    }

    .system-badge {
        margin-top: 18px;
    }

    .brand-copy h1 {
        font-size: 37px;
    }

    .form-panel {
        padding: 42px 36px;
    }
}

@media (max-width: 760px) {
    .login-page {
        align-items: stretch;
        padding: 0;
        background: #fff;
    }

    .login-background {
        display: none;
    }

    .login-shell {
        min-height: 100vh;
        min-height: 100svh;
        display: block;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .brand-panel {
        display: none;
    }

    .form-panel {
        min-height: 100vh;
        min-height: 100svh;
        padding: max(26px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
    }

    .mobile-brand {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        width: 100%;
        max-width: 430px;
        margin: 0 auto;
        padding-bottom: 34px;
    }

    .mobile-brand img {
        display: block;
        width: 144px;
        height: auto;
    }

    .mobile-brand span {
        color: #748094;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.04em;
    }

    .form-content {
        margin: auto;
    }

    .form-header {
        margin-bottom: 30px;
    }

    .form-header h2 {
        font-size: 31px;
    }

    .form-footer {
        margin-top: 34px;
    }
}

@media (max-width: 420px) {
    .form-panel {
        padding-left: 18px;
        padding-right: 18px;
    }

    .mobile-brand {
        padding-bottom: 27px;
    }

    .mobile-brand img {
        width: 132px;
    }

    .form-header h2 {
        font-size: 29px;
    }

    .form-header p {
        font-size: 13px;
    }

    .field-control,
    .login-button {
        height: 50px;
    }
}

@media (max-height: 720px) and (min-width: 761px) {
    .login-page {
        align-items: flex-start;
        overflow: auto;
    }

    .login-shell {
        min-height: 590px;
    }

    .brand-panel,
    .form-panel {
        padding-top: 36px;
        padding-bottom: 36px;
    }

    .brand-copy {
        padding-top: 35px;
    }

    .brand-features {
        margin-top: 30px;
    }

    .brand-footer,
    .form-footer {
        padding-top: 26px;
        margin-top: 26px;
    }
}

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