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

:root {
    color-scheme: light;
    --page-bg: #f4f6f8;
    --card-bg: rgba(255, 255, 255, 0.94);
    --text: #17261f;
    --muted: #66736c;
    --green: #148a52;
    --green-dark: #0b5d3b;
    --green-bright: #1da760;
    --orange: #f58220;
    --orange-bright: #ff922e;
    --line: #d9e2dc;
    --error: #b42318;
    --focus: rgba(245, 130, 32, 0.18);
}

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

body {
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.96) 0 16rem, transparent 38rem),
        linear-gradient(135deg, #f7f9f8 0%, #f1f6f3 52%, #f8faf9 100%);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

a {
    color: var(--green);
    text-decoration: none;
}

a:hover {
    color: var(--green-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auth-page {
    position: relative;
    overflow-x: hidden;
}

.auth-background {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.auth-background::before {
    position: absolute;
    inset: 2rem;
    border: 1px solid rgba(11, 93, 59, 0.2);
    border-radius: 24px;
    content: "";
}

.leaf {
    position: absolute;
    width: 36rem;
    height: 56rem;
    border: 5rem solid rgba(20, 138, 82, 0.055);
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-radius: 100% 0 100% 0;
}

.leaf-left {
    bottom: -29rem;
    left: -17rem;
    transform: rotate(27deg);
}

.leaf-right {
    right: -18rem;
    bottom: -31rem;
    transform: scaleX(-1) rotate(18deg);
}

.login-shell {
    position: relative;
    z-index: 1;
    display: grid;
    min-height: 100vh;
    min-height: 100svh;
    place-items: center;
    padding: 3.25rem 1.5rem;
}

.auth-card {
    width: min(100%, 31rem);
    padding: clamp(2rem, 4vw, 3rem);
    border: 1px solid rgba(11, 93, 59, 0.14);
    border-radius: 22px;
    background: var(--card-bg);
    box-shadow:
        0 24px 60px rgba(11, 93, 59, 0.1),
        0 4px 12px rgba(11, 93, 59, 0.06);
    backdrop-filter: blur(16px);
}

.auth-header {
    margin-bottom: 2rem;
    text-align: center;
}

.auth-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.9rem;
    color: var(--green);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.auth-kicker span {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--orange);
    box-shadow: 0 0 0 5px rgba(245, 130, 32, 0.11);
}

.auth-header h1,
.auth-card > h1 {
    margin: 0;
    color: var(--green-dark);
    font-size: clamp(1.75rem, 4vw, 2.15rem);
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.auth-header > p:last-child,
.auth-card > p {
    margin: 0.75rem 0 0;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.55;
}

.login-form {
    display: grid;
    gap: 1.25rem;
}

.form-field {
    display: grid;
    gap: 0.5rem;
}

.login-form label,
.auth-card form > label,
.auth-card form > p label {
    color: #26342b;
    font-size: 0.9rem;
    font-weight: 600;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 3.35rem;
    border: 1px solid #d4ddd7;
    border-radius: 10px;
    background: #fff;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input-wrap:focus-within {
    border-color: var(--orange);
    box-shadow: 0 0 0 4px var(--focus);
}

.field-icon {
    position: absolute;
    left: 0.95rem;
    width: 1.3rem;
    height: 1.3rem;
    fill: none;
    stroke: var(--green);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.input-wrap input {
    width: 100%;
    min-width: 0;
    height: 3.25rem;
    padding: 0 3rem 0 3rem;
    border: 0;
    border-radius: inherit;
    outline: 0;
    color: var(--text);
    background: transparent;
    font-size: 1rem;
}

.input-wrap input::placeholder,
.auth-card input::placeholder {
    color: #929a95;
    opacity: 1;
}

.show-password {
    position: absolute;
    right: 0.55rem;
    display: grid;
    width: 2.45rem;
    height: 2.45rem;
    padding: 0;
    border: 0;
    border-radius: 8px;
    place-items: center;
    color: #6f7772;
    background: transparent;
    cursor: pointer;
}

.show-password:hover {
    color: var(--green);
    background: #f1f6f2;
}

.show-password:focus-visible,
.connect-btn:focus-visible,
a:focus-visible,
.remember input:focus-visible {
    outline: 3px solid rgba(245, 130, 32, 0.24);
    outline-offset: 2px;
}

.show-password svg {
    width: 1.35rem;
    height: 1.35rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

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

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

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: -0.1rem;
    font-size: 0.9rem;
}

.remember {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    user-select: none;
}

.remember input {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    accent-color: var(--green);
}

.connect-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    min-height: 3.35rem;
    margin-top: 0.15rem;
    padding: 0.75rem 1.25rem;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(100deg, var(--green-dark) 0%, var(--green) 100%);
    box-shadow: 0 10px 24px rgba(11, 93, 59, 0.22);
    font-weight: 700;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.connect-btn:hover {
    filter: brightness(0.98);
    transform: translateY(-1px);
    box-shadow: 0 13px 28px rgba(11, 93, 59, 0.28);
    text-decoration: none;
}

.connect-btn:active {
    transform: translateY(0);
}

.connect-btn:disabled,
.connect-btn.loading {
    cursor: wait;
    filter: saturate(0.75);
}

.connect-btn svg {
    width: 1.2rem;
    height: 1.2rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.support-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    color: #505a54;
    font-size: 0.88rem;
    text-align: center;
}

.support-note svg {
    flex: 0 0 auto;
    width: 1.45rem;
    height: 1.45rem;
    fill: none;
    stroke: var(--orange);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.support-note p {
    margin: 0;
}

.form-errors,
.field-error,
.errornote,
.errorlist {
    color: var(--error);
    font-size: 0.85rem;
    line-height: 1.45;
}

.form-errors,
.errornote {
    margin: 0 0 1.25rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid #f3c7c2;
    border-radius: 9px;
    background: #fff4f2;
}

.errorlist {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Password-reset templates use the same calm card and controls. */
.auth-card > .auth-title {
    margin-bottom: 1rem;
    color: var(--green);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-align: center;
    text-transform: uppercase;
}

.auth-card > .auth-title span {
    display: none;
}

.auth-card > h1 {
    text-align: center;
}

.auth-card > p {
    margin-bottom: 1.4rem;
    text-align: center;
}

.auth-card > a:not(.connect-btn) {
    display: block;
    margin-top: 1.25rem;
    text-align: center;
}

.auth-card form > input,
.auth-card form > p input {
    width: 100%;
    min-height: 3.35rem;
    padding: 0 0.95rem;
    border: 1px solid #d4ddd7;
    border-radius: 10px;
    outline: 0;
    color: var(--text);
    background: #fff;
}

.auth-card form > input:focus,
.auth-card form > p input:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 4px var(--focus);
}

.auth-card form > p {
    display: grid;
    gap: 0.5rem;
    margin: 0;
}

.auth-card .helptext {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.auth-card .helptext ul {
    margin: 0.35rem 0 0;
    padding-left: 1.2rem;
}

@media (max-width: 640px) {
    .auth-background::before {
        display: none;
    }

    .leaf {
        width: 20rem;
        height: 32rem;
        border-width: 3rem;
        opacity: 0.7;
    }

    .leaf-left {
        bottom: -18rem;
        left: -11rem;
    }

    .leaf-right {
        right: -12rem;
        bottom: -19rem;
    }

    .login-shell {
        align-items: center;
        padding: 1rem;
    }

    .auth-card {
        padding: 2rem 1.25rem 1.5rem;
        border-radius: 18px;
        box-shadow: 0 14px 38px rgba(37, 62, 44, 0.1);
    }

    .auth-header {
        margin-bottom: 1.75rem;
    }

    .auth-header h1,
    .auth-card > h1 {
        font-size: 1.7rem;
    }

    .form-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.85rem;
    }

    .connect-btn {
        margin-top: 0.3rem;
    }

    .support-note {
        align-items: flex-start;
    }
}

@media (max-height: 650px) and (min-width: 641px) {
    .login-shell {
        align-items: start;
        padding-block: 1.25rem;
    }

    .auth-card {
        padding-block: 1.75rem;
    }

    .auth-header {
        margin-bottom: 1.25rem;
    }

    .support-note {
        margin-top: 1.25rem;
        padding-top: 1rem;
    }
}

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