:root {
    --primary: #2f5d48;
    --accent: #806638;
    --text: #26382f;
    --muted: #5e6d64;
    --border: #d9ddd8;
    --radius: 10px;
    --radius-lg: 20px;
    --auth-font: "Segoe UI", Tahoma, Arial, sans-serif;
}

body.auth-page,
body.auth-page button,
body.auth-page input,
body.auth-page select,
body.auth-page textarea {
    font-family: var(--auth-font);
}

body.auth-page {
    min-height: 100vh;
    margin: 0;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 12% 14%, rgba(228, 199, 128, .18), transparent 30%),
        radial-gradient(ellipse at 88% 86%, rgba(84, 132, 102, .36), transparent 34%),
        linear-gradient(135deg, #173b32 0%, #245342 54%, #193c33 100%);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
}

body.auth-page::before,
body.auth-page::after {
    position: fixed;
    z-index: 0;
    pointer-events: none;
    content: "";
}

body.auth-page::before {
    inset: 0;
    background: repeating-linear-gradient(
        135deg,
        transparent 0,
        transparent 54px,
        rgba(255, 255, 255, .025) 55px,
        rgba(255, 255, 255, .025) 57px
    );
}

body.auth-page::after {
    right: -190px;
    bottom: -330px;
    width: min(48vw, 620px);
    aspect-ratio: 1;
    border: 1px solid rgba(228, 199, 128, .20);
    border-radius: 50%;
    box-shadow:
        0 0 0 34px rgba(228, 199, 128, .045),
        0 0 0 70px rgba(255, 255, 255, .035),
        0 0 0 108px rgba(228, 199, 128, .03);
}

.auth-layout {
    position: relative;
    z-index: 1;
    width: min(100%, 1360px);
    min-height: clamp(600px, calc(100vh - 48px), 800px);
    display: grid;
    grid-template-columns: minmax(0, .94fr) minmax(0, 1.06fr);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .64);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: 0 28px 76px rgba(8, 28, 21, .28), 0 2px 8px rgba(8, 28, 21, .12);
}

.auth-aside {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px;
    background: #1b3b2d;
}

.auth-aside::before {
    position: absolute;
    z-index: 0;
    inset: 0;
    background:
        linear-gradient(120deg, rgba(24, 53, 40, .82), rgba(24, 53, 40, .72)),
        url("../images/auth-residential.jpg") center / cover no-repeat;
    content: "";
}

.auth-aside > * {
    position: relative;
    z-index: 1;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    text-decoration: none;
}

.auth-brand img {
    display: block;
    width: 250px;
    max-width: 100%;
    height: auto;
    max-height: 60px;
    object-fit: contain;
}

.auth-mobile-brand { display: none; }

.auth-aside-copy { margin: auto 0; padding: 48px 0; }

.auth-kicker {
    color: #e4c780;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.auth-aside h1 {
    max-width: 520px;
    margin: 16px 0;
    color: #fff;
    font-size: clamp(36px, 3.4vw, 48px);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.02em;
}

.auth-aside h1 em { color: #e4c780; font-style: normal; }

.auth-aside p {
    max-width: 460px;
    margin: 0;
    color: #f0f2ed;
    font-size: clamp(16px, 1.15vw, 18px);
    line-height: 1.7;
}

.auth-aside-links {
    display: grid;
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.auth-aside-links li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f0f2ed;
    font-size: 16px;
    font-weight: 500;
}

.auth-aside-links li span {
    color: #e4c780;
    font-size: 18px;
    font-weight: 700;
}

.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

.auth-form-content,
.auth-register .register-content {
    width: min(100%, 460px);
}

.auth-form-content h1 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: clamp(30px, 2.4vw, 36px);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.02em;
}

.auth-intro {
    margin: 0 0 28px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.6;
}

.auth-form-content .form-label {
    display: block;
    margin-bottom: 8px;
    color: #34483c;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.auth-form-content .form-control,
.auth-form-content .form-select {
    width: 100%;
    height: 46px;
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: #fff;
    color: var(--text);
    font-size: 16px;
    line-height: 1.4;
}

.auth-form-content .form-control:focus,
.auth-form-content .form-select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(54, 98, 80, .15);
}

.auth-form-content .form-control:-webkit-autofill,
.auth-form-content .form-control:-webkit-autofill:hover,
.auth-form-content .form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    box-shadow: 0 0 0 1000px #fff inset;
}

.auth-form-content .form-text {
    margin-top: 8px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.5;
}

.auth-submit {
    min-height: 48px;
    padding: 12px 16px;
    border: 0;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.5;
    transition: background-color .2s ease, transform .2s ease, opacity .2s ease;
}

.auth-submit:hover,
.auth-submit:focus-visible {
    background: #3c6c54;
    color: #fff;
}

.auth-submit:active { transform: translateY(1px); }
.auth-submit:disabled { cursor: wait; opacity: .65; }

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
    font-size: 16px;
    line-height: 1.5;
}

.auth-links a,
.auth-back-link {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}

.auth-links a:hover,
.auth-back-link:hover { text-decoration: underline; }

.auth-note {
    margin: 24px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
}

.auth-back-link {
    display: inline-block;
    margin-top: 24px;
    font-size: 16px;
}

.auth-form-content .alert {
    margin-bottom: 24px;
    padding: 12px 16px;
    border: 0;
    border-left: 3px solid;
    border-radius: var(--radius);
    font-size: 16px;
    line-height: 1.5;
}

.auth-form-content .alert-danger {
    border-left-color: #a83232;
    background: #fff0ef;
    color: #702222;
}

.auth-form-content .alert-success {
    border-left-color: #2e704b;
    background: #edf7ef;
    color: #245738;
}

.auth-form-content .alert-info,
.auth-form-content .alert-warning {
    border-left-color: #806638;
    background: #f8f3e8;
    color: #59451f;
}

.password-field { position: relative; }
.password-field .form-control { padding-right: 48px; }

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.password-toggle:hover { background: #f0f3f0; color: var(--primary); }
.password-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.password-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.auth-register .auth-aside-copy { padding: 32px 0; }
.auth-register .auth-form-panel { padding: 40px; }
.auth-register .auth-intro { margin-bottom: 24px; }

.register-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.register-form .register-field { min-width: 0; margin: 0 !important; }
.register-form .register-field > .form-text { margin-top: 8px; }
.register-submit { grid-column: 1 / -1; width: 100%; }
.auth-register .register-content .auth-links { margin-top: 24px; }
.auth-register .register-content .auth-note { margin-top: 16px; }

.otp-input { text-align: center; letter-spacing: .2em; }

@media (max-width: 767.98px) {
    body.auth-page { padding: 16px; }
    .auth-layout {
        width: 100%;
        min-height: 0;
        display: flex;
        border-radius: var(--radius-lg);
    }
    .auth-aside { display: none; }
    .auth-form-panel {
        width: 100%;
        flex-direction: column;
        align-items: center;
        padding: 32px 24px;
    }
    .auth-mobile-brand {
        display: block;
        width: min(100%, 460px);
        margin-bottom: 28px;
    }
    .auth-mobile-brand img {
        display: block;
        width: 230px;
        max-width: 100%;
        height: auto;
        max-height: 58px;
        object-fit: contain;
    }
    .auth-form-content,
    .auth-register .register-content { width: min(100%, 460px); margin: auto; }
    .auth-register .auth-form-panel { padding: 32px 24px; }
}

@media (max-width: 520px) {
    body.auth-page { padding: 12px; }

    .auth-form-content h1 { font-size: 30px; }
    .auth-form-panel,
    .auth-register .auth-form-panel { padding: 28px 20px; }
    .auth-mobile-brand { margin-bottom: 24px; }
    .auth-mobile-brand img { width: 210px; max-height: 54px; object-fit: contain; }
    .auth-form-content .form-label { font-size: 15px; }
    .auth-links { font-size: 15px; }

    .register-form { grid-template-columns: 1fr; }
    .register-submit { grid-column: auto; }
    .auth-links { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-submit { transition: none; }
}
