:root {
    --auth-brand: #f36f2d;
    --auth-brand-dark: #c94d12;
    --auth-brand-soft: #fff0e8;
    --auth-ink: #26332c;
    --auth-muted: #6b7770;
    --auth-border: #d9e1dc;
    --auth-surface: #ffffff;
    --auth-surface-soft: #f5f8f6;
    --auth-success: #337654;
    --auth-danger: #b94135;
}

html {
    min-width: 320px;
    min-height: 100%;
}

.auth-page,
.auth-page *,
.auth-page *::before,
.auth-page *::after {
    box-sizing: border-box;
}

body.auth-page {
    display: flex;
    min-height: 100vh;
    margin: 0;
    flex-direction: column;
    overflow-x: hidden;
    color: var(--auth-ink);
    background: #3d4b43 url("soilmap1.jpg") center / cover fixed no-repeat;
    font-family: "Open Sans", sans-serif;
}

body.auth-page::before {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        linear-gradient(115deg, rgba(28, 41, 34, 0.72), rgba(39, 55, 47, 0.42) 48%, rgba(22, 34, 28, 0.62)),
        radial-gradient(circle at 78% 18%, rgba(243, 111, 45, 0.18), transparent 32%);
    content: "";
    pointer-events: none;
}

.auth-shell {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100%;
    min-height: calc(100vh - 54px);
    align-items: center;
    justify-content: center;
    padding: 38px 22px;
}

.auth-card {
    position: relative;
    width: min(100%, 470px);
    padding: 30px 34px 28px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 24px 70px rgba(19, 31, 24, 0.28);
    backdrop-filter: blur(14px);
}

.auth-card::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--auth-brand), #ff9c68 62%, #d8e6dd);
    content: "";
}

.auth-card--wide {
    width: min(100%, 720px);
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    margin-bottom: 15px;
    border-radius: 10px;
}

.auth-brand img {
    display: block;
    width: min(100%, 218px);
    height: auto;
}

.auth-brand:focus-visible {
    outline: 3px solid rgba(243, 111, 45, 0.28);
    outline-offset: 4px;
}

.auth-heading {
    margin-bottom: 22px;
}

.auth-eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--auth-brand-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.auth-heading h1 {
    margin: 0;
    color: var(--auth-ink);
    font-size: clamp(27px, 4vw, 34px);
    font-weight: 780;
    letter-spacing: -0.04em;
    line-height: 1.16;
}

.auth-intro {
    max-width: 580px;
    margin: 7px 0 0;
    color: var(--auth-muted);
    font-size: 14px;
    line-height: 1.55;
}

.auth-intro:empty {
    display: none;
}

.auth-form {
    margin: 0;
}

.auth-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

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

.auth-form-grid .auth-field {
    margin-bottom: 0;
}

.auth-field--full {
    grid-column: 1 / -1;
}

.auth-field label,
.auth-field-label {
    display: block;
    margin: 0 0 6px;
    color: #46534c;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.3;
}

.auth-input-shell {
    position: relative;
}

.auth-input-icon {
    position: absolute;
    top: 50%;
    left: 15px;
    z-index: 1;
    color: #8b9690;
    font-size: 14px;
    transform: translateY(-50%);
    pointer-events: none;
}

.auth-input-shell input {
    padding-left: 42px !important;
}

.auth-field input:not([type="checkbox"]),
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    display: block;
    width: 100%;
    min-height: 47px;
    margin: 0;
    padding: 10px 13px;
    border: 1px solid var(--auth-border);
    border-radius: 11px;
    color: var(--auth-ink);
    background: #fbfcfb;
    box-shadow: none;
    font: inherit;
    font-size: 14px;
    transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.auth-field input::placeholder,
.auth-form input::placeholder {
    color: #9aa49e;
    opacity: 1;
}

.auth-field input:not([type="checkbox"]):hover,
.auth-form input[type="text"]:hover,
.auth-form input[type="email"]:hover,
.auth-form input[type="password"]:hover {
    border-color: #bdc9c1;
    background: #fff;
}

.auth-field input:not([type="checkbox"]):focus,
.auth-form input[type="text"]:focus,
.auth-form input[type="email"]:focus,
.auth-form input[type="password"]:focus {
    border-color: var(--auth-brand);
    outline: 0;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(243, 111, 45, 0.13);
}

.auth-field-error,
.auth-error-list li,
.errorlist li {
    color: var(--auth-danger);
    font-size: 11.5px;
    font-weight: 650;
    line-height: 1.4;
}

.auth-field-error {
    display: block;
    margin-top: 5px;
}

.auth-error-list,
.errorlist {
    margin: 0 0 14px;
    padding: 10px 12px 10px 28px;
    border: 1px solid #efcbc6;
    border-radius: 10px;
    background: #fff4f2;
}

.auth-field .errorlist {
    margin: 5px 0 0;
}

.auth-checkbox {
    display: flex;
    grid-column: 1 / -1;
    align-items: flex-start;
    gap: 9px;
    margin-top: 2px;
    padding: 11px 12px;
    border: 1px solid #e0e6e2;
    border-radius: 11px;
    color: #4b5851;
    background: var(--auth-surface-soft);
    font-size: 12.5px;
    line-height: 1.45;
}

.auth-checkbox input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin: 1px 0 0;
    flex: 0 0 auto;
    accent-color: var(--auth-brand);
}

.auth-checkbox label {
    margin: 0;
    cursor: pointer;
}

.auth-primary-button {
    display: inline-flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 5px;
    padding: 11px 18px;
    border: 0;
    border-radius: 12px;
    color: #fff !important;
    background: linear-gradient(135deg, var(--auth-brand), #ff8144);
    box-shadow: 0 10px 24px rgba(201, 77, 18, 0.2);
    font: inherit;
    font-size: 14px;
    font-weight: 780;
    text-decoration: none !important;
    cursor: pointer;
    transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.auth-primary-button:hover {
    color: #fff;
    box-shadow: 0 13px 29px rgba(201, 77, 18, 0.26);
    filter: saturate(1.04);
    transform: translateY(-1px);
}

.auth-primary-button:focus-visible {
    outline: 3px solid rgba(243, 111, 45, 0.3);
    outline-offset: 3px;
}

.auth-link-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 18px;
    color: var(--auth-muted);
    font-size: 12.5px;
    line-height: 1.45;
    text-align: center;
}

.auth-link-row + .auth-link-row {
    margin-top: 9px;
}

.auth-link,
.auth-link-row a {
    color: var(--auth-brand-dark);
    font-weight: 750;
    text-decoration: none;
}

.auth-link:hover,
.auth-link-row a:hover {
    color: #a93b09;
    text-decoration: underline;
}

.auth-messages {
    display: grid;
    gap: 8px;
    margin: -5px 0 17px;
}

.auth-message {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 11px;
    border: 1px solid #d8e1db;
    border-radius: 10px;
    color: #45534b;
    background: var(--auth-surface-soft);
    font-size: 12px;
    line-height: 1.45;
}

.auth-message i {
    margin-top: 2px;
    color: var(--auth-brand-dark);
}

.auth-message--success {
    border-color: #cbe3d4;
    color: #275e43;
    background: #f0f8f3;
}

.auth-message--error {
    border-color: #efcbc6;
    color: #96372d;
    background: #fff4f2;
}

.auth-state {
    text-align: center;
}

.auth-state-icon {
    display: inline-flex;
    width: 58px;
    height: 58px;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border-radius: 18px;
    color: var(--auth-brand-dark);
    background: var(--auth-brand-soft);
    font-size: 24px;
}

.auth-state-icon--success {
    color: var(--auth-success);
    background: #eaf6ee;
}

.auth-state-icon--error {
    color: var(--auth-danger);
    background: #fff0ee;
}

.auth-state h2 {
    margin: 0 0 7px;
    color: var(--auth-ink);
    font-size: 20px;
    font-weight: 770;
    letter-spacing: -0.025em;
}

.auth-state p {
    margin: 0;
    color: var(--auth-muted);
    font-size: 13px;
    line-height: 1.55;
}

.auth-state .auth-primary-button {
    margin-top: 20px;
}

.auth-help {
    margin: 13px 0 0;
    padding: 11px 12px;
    border-left: 3px solid #d8e4dc;
    color: var(--auth-muted);
    background: var(--auth-surface-soft);
    font-size: 11.5px;
    line-height: 1.5;
}

.auth-footer {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 54px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 18px;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(22, 31, 26, 0.88);
    box-shadow: 0 -8px 30px rgba(12, 18, 14, 0.12);
    backdrop-filter: blur(12px);
    font-size: 12px;
}

.auth-footer a {
    color: #fff;
    font-weight: 650;
    text-decoration: none;
}

.auth-footer a:hover {
    color: #ffc3a5;
    text-decoration: none;
}

.auth-page .modal-content {
    position: relative;
    display: flex;
    width: 100%;
    max-height: calc(100vh - 56px);
    flex-direction: column;
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 22px 65px rgba(20, 30, 24, 0.3);
    pointer-events: auto;
}

.auth-page .modal:not(.show) {
    display: none !important;
}

.auth-page .modal.show {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: block !important;
    overflow-x: hidden;
    overflow-y: auto;
    background: rgba(19, 29, 23, 0.52);
}

.auth-page .modal-dialog {
    position: relative;
    width: auto;
    max-width: 560px;
    margin: 28px auto;
    pointer-events: none;
}

.auth-page .modal-dialog-centered {
    display: flex;
    min-height: calc(100% - 56px);
    align-items: center;
}

.auth-page .modal-header,
.auth-page .modal-footer {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    padding: 16px 18px;
}

.auth-page .modal-header {
    justify-content: space-between;
}

.auth-page .modal-header {
    border-bottom-color: #e2e7e4;
}

.auth-page .modal-body {
    flex: 1 1 auto;
    padding: 18px;
    overflow-y: auto;
    color: #4c5952;
    font-size: 13px;
    line-height: 1.55;
}

.auth-page .modal-footer {
    justify-content: flex-end;
    border-top: 1px solid #e2e7e4;
}

.auth-page .modal-title {
    margin: 0;
    color: var(--auth-ink);
    font-weight: 750;
}

.auth-page .modal .close {
    border: 0;
    color: #66736c;
    background: transparent;
    font-size: 25px;
    cursor: pointer;
}

.auth-page .modal .btn-secondary {
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: #34433b;
    font-size: 12px;
    font-weight: 720;
}

@media (max-width: 680px) {
    body.auth-page {
        background-attachment: scroll;
    }

    .auth-shell {
        min-height: calc(100vh - 74px);
        align-items: flex-start;
        padding: 18px 12px;
    }

    .auth-card {
        padding: 25px 20px 23px;
        border-radius: 18px;
    }

    .auth-brand img {
        width: 185px;
    }

    .auth-form-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 13px;
    }

    .auth-field--full,
    .auth-checkbox {
        grid-column: 1;
    }

    .auth-footer {
        min-height: 74px;
        flex-wrap: wrap;
        gap: 6px 10px;
    }

    .auth-page .modal-dialog {
        max-width: calc(100% - 24px);
        margin: 12px auto;
    }

    .auth-page .modal-dialog-centered {
        min-height: calc(100% - 24px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-page *,
    .auth-page *::before,
    .auth-page *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
