:root {
    --bg-green: #dfeecb;
    --bg-green-strong: #cfe0ad;
    --green: #1b6b3d;
    --green-dark: #174f31;
    --green-soft: #eaf6e8;
    --card: rgba(255, 255, 255, 0.86);
    --gold: #f4c54a;
    --gold-soft: #f8df85;
    --text: #1c2a1e;
    --muted: #5d6d60;
    --line: #d6dfd0;
    --shadow: rgba(21, 56, 32, 0.12);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--bg-green);
    color: var(--text);
}

body {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    overscroll-behavior: none;
}

.auth-body {
    background: linear-gradient(180deg, #d9ebc7 0%, #d2e4bb 100%);
    padding: 18px 12px;
}

body.auth-body:not(.auth-login-page) {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
}

body.auth-login-page {
    height: auto;
    min-height: 100vh;
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    background: linear-gradient(135deg, #eef8dc 0%, #dff1ca 48%, #f7fbef 100%);
}

.auth-login-page .auth-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-login-page .field-error {
    margin: 5px 12px 0;
    color: #a33b3b;
    font-size: 12px;
    text-align: left;
}

.leaf {
    position: absolute;
    width: 220px;
    height: 220px;
    background: rgba(27, 107, 61, 0.14);
    border-radius: 0 100% 0 100%;
    transform: rotate(18deg);
}

.leaf-left {
    left: -60px;
    bottom: -25px;
}

.leaf-right {
    right: -70px;
    top: -20px;
    transform: scaleX(-1) rotate(20deg);
}

.auth-shell {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(100%, 664px);
    min-height: 0;
}

.auth-logo {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(100%, 340px);
    height: 220px;
    margin-bottom: 0;
    flex: 0 0 auto;
}

.agrihub-logo-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 8px 12px rgba(19, 60, 35, 0.12));
}

.login-card {
    width: min(100%, 432px);
    flex: 0 0 auto;
    overflow: visible;
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.52);
    box-shadow: 0 18px 40px var(--shadow);
    border-radius: 16px;
    padding: 20px 28px 16px;
}

.login-card h1 {
    margin: 0 0 14px;
    text-align: center;
    font-size: clamp(1.5rem, 2.6vw, 1.8rem);
    color: var(--text);
    font-weight: 700;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 0 12px 0 14px;
    min-height: 40px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.52);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--muted);
}

.input-icon {
    font-size: 18px;
    opacity: 0.8;
}

.input-wrapper input {
    flex: 1;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
    padding-right: 8px;
}

.toggle-password {
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 0.8rem;
    cursor: pointer;
}

.primary-btn,
.secondary-btn,
.pill-btn {
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}

.primary-btn {
    display: block;
    width: 100%;
    min-height: 42px;
    background: linear-gradient(180deg, #1c6d3b, #195f35);
    color: white;
    box-shadow: 0 10px 18px rgba(25, 95, 53, 0.2);
    font-size: 1rem;
    margin-top: 6px;
}

.help-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 16px 0 12px;
    color: var(--muted);
    font-size: 0.82rem;
}

.help-links a {
    color: var(--green-dark);
    text-decoration: none;
    font-weight: 600;
}

.secondary-btn {
    width: 100%;
    min-height: 42px;
    background: #f9faf7;
    border: 1px solid var(--line);
    color: var(--text);
    margin-top: 4px;
}

.secondary-btn:disabled {
    color: var(--muted);
    cursor: not-allowed;
    opacity: 0.72;
}

.form-intro {
    margin: -4px 0 18px;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
    text-align: center;
}

.form-status {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid rgba(27, 107, 61, 0.18);
    border-radius: 9px;
    background: var(--green-soft);
    color: var(--green-dark);
    font-size: 0.88rem;
    line-height: 1.45;
}

.signup-link {
    margin: 18px 0 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

.signup-link a {
    color: var(--green-dark);
    text-decoration: none;
    font-weight: 700;
}

.form-error {
    margin: 0 0 12px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(211, 65, 65, 0.08);
    color: #a33b3b;
    font-size: 0.85rem;
    text-align: center;
}

@media (max-width: 520px) {
    .login-card {
        padding-inline: 20px;
    }

    .auth-logo {
        width: min(100%, 310px);
        height: 200px;
    }
}

@media (max-height: 700px) {
    .auth-logo {
        width: min(100%, 340px);
        height: 190px;
    }

    .login-card {
        padding-block: 20px 14px;
    }

    .login-card h1 {
        margin-bottom: 14px;
        font-size: clamp(1.5rem, 2.6vw, 1.8rem);
    }

    .input-wrapper {
        min-height: 42px;
        margin-bottom: 10px;
    }

    .help-links {
        margin-block: 12px 8px;
    }

    .signup-link {
        margin-top: 12px;
    }
}

@media (max-height: 560px) {
    .auth-logo {
        width: min(100%, 290px);
        height: 155px;
    }

    .login-card {
        padding: 14px 20px 12px;
    }

    .login-card h1 {
        margin-bottom: 10px;
        font-size: 1.5rem;
    }

    .input-wrapper {
        min-height: 38px;
        margin-bottom: 8px;
    }

    .primary-btn {
        min-height: 40px;
    }

    .help-links {
        gap: 5px;
        margin-block: 9px 7px;
    }

    .secondary-btn {
        min-height: 38px;
    }

    .signup-link {
        margin-top: 9px;
    }
}
