:root {
    --auth-navy: #102d59;
    --auth-blue: #2164d9;
    --auth-blue-bright: #4f8df5;
    --auth-muted: #647493;
    --auth-border: #cfd9e8;
    --auth-danger: #b4233c;
    --auth-success: #17805d;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-width: 320px;
    min-height: 100%;
    margin: 0;
}

body {
    color: var(--auth-navy);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: #25699f;
}

button,
input {
    font: inherit;
}

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

.auth-stage {
    position: relative;
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 38px 24px;
    overflow: hidden;
    isolation: isolate;
}

.auth-stage::before,
.auth-stage::after {
    position: absolute;
    inset: -18px;
    z-index: -2;
    content: "";
}

.auth-stage::before {
    background: url("../img/medica-login.png") center / cover no-repeat;
    filter: blur(3px) saturate(0.85);
    transform: scale(1.035);
}

.auth-stage::after {
    z-index: -1;
    background:
        linear-gradient(110deg, rgba(33, 107, 161, 0.72), rgba(77, 132, 202, 0.48)),
        radial-gradient(circle at 80% 12%, rgba(255, 255, 255, 0.34), transparent 36%),
        linear-gradient(180deg, rgba(21, 76, 128, 0.18), rgba(33, 126, 181, 0.28));
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(400px, 500px) minmax(560px, 700px);
    width: min(1210px, 100%);
    min-height: 720px;
    overflow: visible;
}

.auth-brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 82px 68px 68px;
    overflow: hidden;
    color: #fff;
    background:
        linear-gradient(165deg, rgba(39, 124, 181, 0.58), rgba(13, 59, 112, 0.9)),
        rgba(19, 79, 128, 0.68);
    backdrop-filter: blur(16px) saturate(1.1);
    -webkit-backdrop-filter: blur(16px) saturate(1.1);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 26px;
    box-shadow: 0 28px 80px rgba(16, 47, 91, 0.2);
}

.auth-brand-panel::after {
    position: absolute;
    right: -48px;
    bottom: -40px;
    width: 190px;
    height: 190px;
    content: "";
    opacity: 0.14;
    background-image: radial-gradient(circle, #a9d8ff 1.5px, transparent 1.5px);
    background-size: 13px 13px;
    transform: rotate(-8deg);
}

.auth-brand-logo {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 17px;
    width: max-content;
    color: #fff;
    filter: drop-shadow(0 5px 18px rgba(8, 42, 81, 0.16));
}

.auth-brand-logo img {
    width: 52px;
    height: 61px;
    object-fit: contain;
}

.auth-brand-logo span {
    font-size: 46px;
    font-weight: 350;
    line-height: 1;
    letter-spacing: -1.5px;
}

.auth-brand-copy {
    position: relative;
    z-index: 1;
    margin-top: 94px;
}

.auth-brand-copy h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(36px, 3.2vw, 49px);
    font-weight: 750;
    line-height: 1.17;
    letter-spacing: -1.4px;
}

.auth-brand-rule {
    display: block;
    width: 62px;
    height: 4px;
    margin: 34px 0;
    background: linear-gradient(90deg, #a987ff, #3a89f0);
    border-radius: 999px;
    box-shadow: 0 0 18px rgba(103, 158, 255, 0.64);
}

.auth-brand-copy p {
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 18px;
    line-height: 1.55;
}

.auth-protection {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 22px;
    margin-top: auto;
}

.auth-protection-icon {
    display: grid;
    flex: 0 0 78px;
    width: 78px;
    height: 78px;
    place-items: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.auth-protection-icon svg {
    width: 36px;
    height: 36px;
    fill: none;
    stroke: #fff;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-protection p {
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 15px;
    line-height: 1.52;
}

.auth-protection strong {
    display: block;
    margin-bottom: 3px;
    color: #fff;
    font-size: 16px;
}

.auth-brand-decoration {
    position: absolute;
    width: 52px;
    height: 16px;
    opacity: 0.09;
    background: #fff;
    border-radius: 3px;
}

.auth-brand-decoration::after {
    position: absolute;
    top: -18px;
    left: 18px;
    width: 16px;
    height: 52px;
    content: "";
    background: #fff;
    border-radius: 3px;
}

.auth-brand-decoration--one {
    top: 52px;
    left: 30px;
}

.auth-brand-decoration--two {
    top: 178px;
    right: 22px;
    transform: scale(0.7);
}

.auth-brand-dots {
    position: absolute;
    top: 185px;
    left: 28px;
    width: 90px;
    height: 90px;
    opacity: 0.12;
    background-image: radial-gradient(circle, #fff 2px, transparent 2px);
    background-size: 16px 16px;
}

.auth-form-panel {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    width: 100%;
    margin-left: -18px;
    place-items: center;
    padding: 48px 64px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 26px;
    box-shadow: 0 28px 80px rgba(16, 47, 91, 0.22);
}

.auth-card {
    width: 100%;
    max-width: 510px;
    min-width: 0;
}

.auth-state-icon {
    position: relative;
    display: grid;
    width: 72px;
    height: 72px;
    margin: 0 auto 28px;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, #4f8df5, #174bb5);
    border-radius: 50%;
    box-shadow:
        0 0 0 13px rgba(66, 128, 235, 0.1),
        0 0 0 25px rgba(66, 128, 235, 0.055),
        0 13px 30px rgba(31, 89, 190, 0.28);
}

.auth-state-icon svg {
    width: 29px;
    height: 29px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-card-heading {
    margin-bottom: 34px;
    text-align: center;
}

.auth-card-heading h2 {
    margin: 0;
    color: #0d2852;
    font-size: clamp(31px, 3vw, 39px);
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: -1px;
}

.auth-card-heading p {
    max-width: 470px;
    margin: 14px auto 0;
    color: #62718f;
    font-size: 16px;
    line-height: 1.55;
}

.auth-card-heading .auth-email-hint {
    margin-top: 7px;
    color: #315b9d;
    font-size: 14px;
    font-weight: 700;
}

.auth-alert {
    margin: -12px 0 22px;
    padding: 12px 15px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
    text-align: center;
    border: 1px solid;
    border-radius: 11px;
}

.auth-alert--error {
    color: var(--auth-danger);
    background: #fff2f4;
    border-color: #ffd0d9;
}

.auth-alert--success {
    color: var(--auth-success);
    background: #eefbf6;
    border-color: #c7efdf;
}

.auth-form {
    width: 100%;
    min-width: 0;
}

.auth-field {
    display: block;
    min-width: 0;
    margin-bottom: 20px;
}

.auth-field > span:first-child,
.auth-field-heading > span {
    display: block;
    margin-bottom: 9px;
    color: #243c65;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.auth-control {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 62px;
    color: #2769d7;
    background: #fff;
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-control:focus-within {
    border-color: #4b86eb;
    box-shadow: 0 0 0 4px rgba(52, 117, 225, 0.1);
}

.auth-control > svg {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    margin-left: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-control input {
    width: 100%;
    height: 100%;
    min-width: 0;
    padding: 0 18px;
    color: #172f56;
    font-size: 16px;
    outline: 0;
    background: transparent;
    border: 0;
}

.auth-control input::placeholder {
    color: #9ba8bd;
}

.auth-control input.auth-otp-input {
    font-weight: 650;
    letter-spacing: 0.04em;
}

.auth-password-toggle {
    display: grid;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin-right: 7px;
    padding: 0;
    place-items: center;
    color: #526c96;
    cursor: pointer;
    background: transparent;
    border: 0;
    border-radius: 9px;
}

.auth-password-toggle:hover {
    color: #1c62d4;
    background: #eff5ff;
}

.auth-password-toggle svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-form-options {
    display: flex;
    justify-content: flex-end;
    margin: -5px 0 18px;
}

.auth-form-options a,
.auth-resend a,
.auth-back-link {
    color: #1761d7;
    font-weight: 650;
    text-decoration: none;
}

.auth-form-options a:hover,
.auth-resend a:hover,
.auth-back-link:hover {
    text-decoration: underline;
}

.auth-primary-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    min-height: 62px;
    padding: 13px 22px;
    color: #fff;
    font-size: 17px;
    font-weight: 750;
    cursor: pointer;
    background: linear-gradient(120deg, #194fb8, #4f8df5);
    border: 0;
    border-radius: 12px;
    box-shadow: 0 13px 26px rgba(36, 94, 199, 0.23);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.auth-primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 17px 32px rgba(36, 94, 199, 0.29);
}

.auth-primary-button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
    transform: none;
    box-shadow: none;
}

.auth-primary-button svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 32px 0;
    color: #6c7b96;
    font-size: 15px;
}

.auth-divider::before,
.auth-divider::after {
    flex: 1;
    height: 1px;
    content: "";
    background: #d5ddea;
}

.auth-back-link {
    display: block;
    width: max-content;
    margin: 0 auto;
    font-size: 16px;
}

.auth-resend {
    margin: 0;
    color: #51617d;
    font-size: 14px;
    text-align: center;
}

.auth-security-note {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
    max-width: 430px;
    margin: 34px auto 0;
    color: #7886a0;
    font-size: 14px;
    line-height: 1.45;
    text-align: center;
}

.auth-security-note svg {
    flex: 0 0 19px;
    width: 19px;
    height: 19px;
    fill: none;
    stroke: #526c96;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-security-note--success svg {
    stroke: #16835e;
}

.auth-captcha {
    margin-bottom: 16px;
}

.auth-field-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-field-heading button {
    padding: 2px;
    color: #1761d7;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    background: transparent;
    border: 0;
}

.auth-captcha-row {
    display: grid;
    grid-template-columns: 154px 1fr;
    gap: 12px;
}

.auth-captcha-image {
    display: grid;
    height: 54px;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
    border: 1px solid var(--auth-border);
    border-radius: 11px;
}

.auth-captcha-image img {
    width: 100%;
    height: 100%;
    object-fit: fill;
}

.auth-control--captcha {
    height: 54px;
}

.auth-control--captcha input {
    padding-left: 16px;
}

.auth-requirements {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 18px;
    margin: 4px 0 18px;
    padding: 16px 20px;
    color: #667695;
    font-size: 13px;
    background: #f6f9fd;
    border: 1px solid #dce5f2;
    border-radius: 12px;
}

.auth-requirements span {
    display: flex;
    align-items: center;
    gap: 9px;
}

.auth-requirements span::before {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    content: "";
    background: #76a4ef;
    border-radius: 50%;
}

.auth-requirements span.is-valid {
    color: #167453;
}

.auth-requirements span.is-valid::before {
    background: #21a875;
    box-shadow: 0 0 0 3px rgba(33, 168, 117, 0.11);
}

.auth-field-error {
    min-height: 20px;
    margin: -5px 0 9px;
    color: var(--auth-danger);
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

.auth-view-login .auth-card-heading {
    margin-bottom: 25px;
}

.auth-view-login .auth-state-icon {
    margin-bottom: 23px;
}

.auth-view-login .auth-card-heading h2 {
    font-size: 35px;
}

.auth-view-login .auth-card-heading p {
    margin-top: 9px;
    font-size: 14px;
}

.auth-view-login .auth-field {
    margin-bottom: 15px;
}

.auth-view-login .auth-control {
    height: 56px;
}

.auth-view-login .auth-primary-button {
    min-height: 56px;
}

@media (max-width: 1060px) {
    .auth-shell {
        grid-template-columns: minmax(330px, 0.78fr) minmax(500px, 1.22fr);
    }

    .auth-brand-panel {
        padding-right: 46px;
        padding-left: 46px;
    }

    .auth-form-panel {
        padding-right: 46px;
        padding-left: 46px;
    }
}

@media (max-width: 860px) {
    .auth-stage {
        padding: 24px 16px;
    }

    .auth-shell {
        display: block;
        width: min(620px, 100%);
        min-height: 0;
    }

    .auth-brand-panel {
        display: none;
    }

    .auth-form-panel {
        min-height: calc(100vh - 48px);
        margin-left: 0;
        padding: 52px 48px;
    }
}

@media (max-width: 560px) {
    .auth-stage {
        padding: 0;
    }

    .auth-shell {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
    }

    .auth-form-panel {
        min-height: 100vh;
        padding: 38px 22px;
        border: 0;
        border-radius: 0;
    }

    .auth-state-icon {
        width: 62px;
        height: 62px;
        margin-bottom: 23px;
        box-shadow:
            0 0 0 10px rgba(66, 128, 235, 0.1),
            0 0 0 19px rgba(66, 128, 235, 0.055),
            0 12px 25px rgba(31, 89, 190, 0.25);
    }

    .auth-card-heading {
        margin-bottom: 27px;
    }

    .auth-card-heading h2,
    .auth-view-login .auth-card-heading h2 {
        font-size: 29px;
        overflow-wrap: anywhere;
    }

    .auth-card-heading p {
        font-size: 14px;
    }

    .auth-control {
        height: 57px;
    }

    .auth-captcha-row {
        grid-template-columns: 130px 1fr;
    }

    .auth-primary-button {
        min-height: 57px;
        font-size: 15px;
    }

    .auth-requirements {
        grid-template-columns: 1fr;
    }
}

@media (max-height: 780px) and (min-width: 861px) {
    .auth-stage {
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .auth-shell {
        min-height: 660px;
    }

    .auth-brand-panel {
        padding-top: 58px;
        padding-bottom: 50px;
    }

    .auth-brand-copy {
        margin-top: 62px;
    }

    .auth-form-panel {
        padding-top: 30px;
        padding-bottom: 30px;
    }

    .auth-state-icon {
        width: 62px;
        height: 62px;
        margin-bottom: 20px;
    }

    .auth-card-heading {
        margin-bottom: 24px;
    }

    .auth-card-heading h2 {
        font-size: 31px;
    }

    .auth-field {
        margin-bottom: 15px;
    }

    .auth-control {
        height: 54px;
    }

    .auth-primary-button {
        min-height: 54px;
    }

    .auth-divider {
        margin: 23px 0;
    }

    .auth-security-note {
        margin-top: 24px;
    }
}
