:root {
    color-scheme: light;
    --page: #fffaf1;
    --page-soft: #fffdf8;
    --ink: #003f50;
    --ink-soft: #456974;
    --muted: #8b9294;
    --gold: #d8a750;
    --gold-soft: #ead2aa;
    --gold-faint: rgba(205, 156, 79, 0.22);
    --field: rgba(255, 253, 248, 0.84);
    --field-border: #dec79e;
    --card: rgba(255, 251, 243, 0.9);
    --card-border: #d6a552;
    --button: #004e61;
    --button-end: #00647a;
    --button-text: #fffdf7;
    --header: rgba(255, 251, 244, 0.86);
    --shadow: 0 18px 38px rgba(79, 53, 21, 0.14);
    --danger: #a63e35;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--ink);
    background:
        radial-gradient(circle at 51% 46%, rgba(255, 255, 255, 0.84), transparent 36%),
        linear-gradient(90deg, #fff9ef, var(--page) 45%, #fffaf2);
    font-family: "Segoe UI", Arial, sans-serif;
    transition: color 0.25s ease, background 0.25s ease;
}

button,
input {
    font: inherit;
}

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

.login-scene {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.login-scene__pattern {
    position: absolute;
    inset: 116px 0 0;
    background: url('../../login/background-pattern.png') center / 620px 620px repeat;
    mix-blend-mode: multiply;
    opacity: 0.42;
}

.login-scene__architecture,
.login-scene__hanging,
.login-scene__khiva,
.login-card__floral,
.login-card__corner {
    user-select: none;
}

.login-scene__architecture {
    position: absolute;
    left: -1px;
    top: 0;
    width: auto;
    height: 118vh;
    min-height: 1020px;
    opacity: 0.94;
}

.login-scene__hanging {
    position: absolute;
    left: 34px;
    top: 104px;
    width: 112px;
    height: auto;
    opacity: 0.96;
}

.login-scene__glow {
    position: absolute;
    right: -3vw;
    bottom: -13vh;
    width: min(56vw, 900px);
    aspect-ratio: 1.45;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(221, 184, 118, 0.2), transparent 70%);
}

.login-scene__khiva {
    position: absolute;
    right: -160px;
    bottom: -17px;
    width: clamp(600px, 46.5vw, 820px);
    height: auto;
    opacity: 1;
    filter: saturate(1.45) contrast(1.08);
}

.login-header {
    position: relative;
    z-index: 10;
    height: 116px;
    padding: 12px 42px 11px 43px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: var(--header);
    border-bottom: 1px solid var(--gold);
    box-shadow: 0 3px 12px rgba(112, 78, 31, 0.06);
    backdrop-filter: blur(7px);
}

.login-header::before {
    content: '';
    position: absolute;
    left: 31px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--gold);
    opacity: 0.72;
}

.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
    color: var(--ink);
    text-decoration: none;
}

.login-brand__crest {
    width: 100px;
    height: 100px;
    object-fit: contain;
    filter: drop-shadow(0 5px 5px rgba(49, 45, 28, 0.2));
}

.login-brand__copy {
    display: grid;
    gap: 2px;
    white-space: nowrap;
}

.login-brand__copy strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.6rem, 2vw, 2rem);
    font-weight: 500;
    letter-spacing: 0.045em;
    line-height: 1;
}

.login-brand__copy small {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.78rem;
    font-weight: 700;
}

.login-header__actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-pill {
    min-width: 124px;
    height: 51px;
    padding: 0 23px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 1px solid var(--gold-soft);
    border-radius: 999px;
    color: var(--ink);
    background: rgba(255, 253, 248, 0.7);
    box-shadow: 0 4px 12px rgba(99, 71, 34, 0.07);
    font-size: 0.97rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.header-pill:hover {
    transform: translateY(-2px);
    border-color: var(--gold);
}

.header-pill:focus-visible,
.password-toggle:focus-visible,
.login-button:focus-visible,
.remember-control input:focus-visible + .remember-control__box {
    outline: 3px solid rgba(216, 167, 80, 0.36);
    outline-offset: 3px;
}

.header-pill svg {
    width: 23px;
    height: 23px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.login-main {
    position: relative;
    z-index: 5;
    min-height: calc(100vh - 116px);
    padding: 64px 24px 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    position: relative;
    width: min(666px, calc(100vw - 44px));
    min-height: 686px;
    margin-top: 0;
    padding: 24px 55px 24px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    border-radius: 37px;
    color: var(--ink);
    background:
        radial-gradient(circle at 52% 45%, rgba(255, 255, 255, 0.76), transparent 56%),
        var(--card);
    box-shadow: var(--shadow), inset 0 0 28px rgba(255, 255, 255, 0.32);
    backdrop-filter: blur(7px);
    opacity: 0;
    transform: translate(-14px, 12px);
    transition: opacity 0.42s ease, transform 0.42s ease, background 0.25s ease, color 0.25s ease;
}

.login-card.is-ready {
    opacity: 1;
    transform: translate(-14px, 0);
}

.login-card__corner {
    position: absolute;
    z-index: 0;
    bottom: -45px;
    width: 185px;
    height: 185px;
    opacity: 0.82;
}

.login-card__corner--right {
    right: -36px;
}

.login-card__corner--left {
    left: -36px;
    transform: scaleX(-1);
}

.login-card__intro,
.login-form,
.login-alert,
.ornament-rule,
.security-note {
    position: relative;
    z-index: 1;
}

.login-card__intro {
    padding-top: 7px;
    text-align: center;
}

.login-card__floral {
    display: block;
    width: 340px;
    height: 54px;
    margin: -3px auto 4px;
    object-fit: cover;
    object-position: center;
    opacity: 0.95;
}

.login-card__intro h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.3rem, 4vw, 3.1rem);
    font-weight: 500;
    letter-spacing: 0.075em;
    line-height: 1.08;
}

.login-card__intro p {
    margin: 9px 0 0;
    color: var(--ink-soft);
    font-size: 1rem;
}

.ornament-rule {
    height: 20px;
    margin: 8px 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ornament-rule::before,
.ornament-rule::after {
    content: '';
    height: 1px;
    flex: 1;
    background: linear-gradient(90deg, transparent, var(--gold-faint));
}

.ornament-rule::after {
    background: linear-gradient(90deg, var(--gold-faint), transparent);
}

.ornament-rule span {
    width: 9px;
    height: 9px;
    margin: 0 14px;
    background: var(--gold);
    transform: rotate(45deg);
}

.login-alert {
    min-height: 42px;
    margin: -1px 0 11px;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid color-mix(in srgb, var(--danger) 48%, transparent);
    border-radius: 10px;
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 8%, transparent);
    font-size: 0.88rem;
}

.login-alert svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

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

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

.form-field label {
    font-size: 0.96rem;
    font-weight: 700;
}

.input-shell {
    height: 58px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    border: 1px solid var(--field-border);
    border-radius: 11px;
    color: var(--ink);
    background: var(--field);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.25s ease;
}

.input-shell:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(216, 167, 80, 0.15);
}

.input-shell--invalid {
    border-color: var(--danger);
}

.input-shell input {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0 15px;
    border: 0;
    outline: 0;
    color: var(--ink);
    background: transparent;
    font-size: 0.96rem;
}

.input-shell input::placeholder {
    color: var(--muted);
    opacity: 0.86;
}

.input-shell__icon,
.input-shell__meta,
.password-toggle svg {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.input-shell__meta {
    width: 20px;
    height: 20px;
    color: #a9a9a6;
}

.password-toggle {
    width: 34px;
    height: 40px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    color: #7e8889;
    background: transparent;
    cursor: pointer;
}

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

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

.remember-control {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    font-size: 0.96rem;
    font-weight: 700;
    cursor: pointer;
}

.remember-control input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.remember-control__box {
    width: 21px;
    height: 21px;
    display: grid;
    place-items: center;
    border: 1px solid var(--gold);
    border-radius: 4px;
    color: #fff;
    background: transparent;
    transition: background 0.2s ease;
}

.remember-control__box svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
}

.remember-control input:checked + .remember-control__box {
    background: var(--button);
}

.remember-control input:checked + .remember-control__box svg {
    opacity: 1;
}

.login-button {
    height: 65px;
    margin-top: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    border: 1px solid #b78a3f;
    border-radius: 11px;
    color: var(--button-text);
    background:
        linear-gradient(rgba(0, 77, 96, 0.94), rgba(0, 91, 109, 0.94)),
        url('../../login/background-pattern.png') center / 330px 330px;
    box-shadow: 0 4px 9px rgba(74, 47, 17, 0.17);
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 1.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, filter 0.18s ease;
}

.login-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
}

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

.login-button svg {
    width: 27px;
    height: 27px;
    fill: none;
    stroke: var(--gold);
    stroke-width: 1.35;
}

.ornament-rule--bottom {
    margin: 29px 0 26px;
}

.security-note {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--muted);
    font-size: 0.87rem;
}

.security-note svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 1100px) {
    .login-brand__copy small {
        display: none;
    }

    .login-header__actions {
        gap: 10px;
    }

    .header-pill {
        min-width: auto;
        padding: 0 17px;
    }

    .login-scene__khiva {
        right: -160px;
        opacity: 0.65;
    }
}

@media (max-width: 760px) {
    .login-header {
        height: 86px;
        padding: 8px 14px 8px 24px;
    }

    .login-header::before {
        left: 12px;
    }

    .login-brand {
        gap: 9px;
    }

    .login-brand__crest {
        width: 68px;
        height: 68px;
    }

    .login-brand__copy strong {
        font-size: clamp(1rem, 4vw, 1.35rem);
        letter-spacing: 0.02em;
    }

    .header-pill {
        width: 42px;
        height: 42px;
        padding: 0;
    }

    .header-pill span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .login-main {
        min-height: calc(100vh - 86px);
        padding: 30px 15px 40px;
    }

    .login-card {
        width: min(100%, 540px);
        min-height: 0;
        padding: 22px 24px 21px;
        border-radius: 27px;
        transform: translateY(12px);
    }

    .login-card.is-ready {
        transform: translateY(0);
    }

    .login-card__intro h1 {
        font-size: clamp(1.8rem, 8vw, 2.5rem);
    }

    .login-card__floral {
        width: 290px;
        height: 46px;
    }

    .login-form {
        gap: 18px;
    }

    .input-shell {
        height: 55px;
    }

    .login-button {
        height: 59px;
        font-size: 1.45rem;
    }

    .login-scene__architecture {
        left: -70px;
        opacity: 0.35;
    }

    .login-scene__hanging {
        display: none;
    }

    .login-scene__khiva {
        right: -230px;
        width: 660px;
        opacity: 0.25;
    }
}

@media (max-width: 430px) {
    .login-brand__copy {
        display: none;
    }

    .login-header__actions {
        margin-left: auto;
    }

    .login-card {
        width: 100%;
        padding-inline: 18px;
    }

    .login-card__intro p,
    .security-note {
        font-size: 0.8rem;
    }

    .login-card__corner {
        width: 145px;
        height: 145px;
    }
}

@media (max-height: 800px) and (min-width: 761px) {
    .login-header {
        height: 92px;
    }

    .login-brand__crest {
        width: 76px;
        height: 76px;
    }

    .login-main {
        min-height: calc(100vh - 92px);
        padding-block: 28px;
    }

    .login-card {
        min-height: 0;
        padding-block: 18px;
    }

    .login-card__floral {
        height: 40px;
    }

    .login-form {
        gap: 14px;
    }

    .input-shell {
        height: 52px;
    }

    .login-button {
        height: 56px;
    }

    .ornament-rule--bottom {
        margin-top: 18px;
        margin-bottom: 12px;
    }
}

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