:root {
    --bg-main: #fcfdfc;
    --bg-white: #ffffff;
    --forest: #2a4028;
    --forest-light: #365233;
    --text-dark: #1e241e;
    --text-muted: #626e61;
    --border-gray: #e6eae5;
    --font-brand: 'Syne', sans-serif;
    --font-ui: 'Plus Jakarta Sans', sans-serif;
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    background-color: var(--bg-main);
    color: var(--text-dark);
    font-family: var(--font-ui);
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

.login-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 1fr 1.2fr;
}

/* ==========================================================================
LEFT HERO
========================================================================== */

.login-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4rem;
    overflow: hidden;
    padding: 3.5rem;
    background-color: var(--forest);
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 22px 22px;
    color: var(--bg-white);
}

.login-hero::before {
    position: absolute;
    right: -100px;
    bottom: -100px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(163, 184, 153, 0.15), transparent 70%);
    content: '';
    pointer-events: none;
}

.back-link {
    position: absolute;
    top: 3.5rem;
    left: 3.5rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--bg-white);
    transform: translateX(-4px);
}

.hero-content-wrap {
    z-index: 2;
    max-width: 460px;
    margin-top: 2rem;
}

.hero-brand-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.hero-logo-left {
    width: 110px;
    height: 110px;
    object-fit: contain;
    border-radius: 50%;
}

.hero-brand-title {
    color: var(--bg-white);
    font-family: var(--font-brand);
    font-size: 2.8rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.02em;
}

.login-hero h1 {
    margin-bottom: 1.5rem;
    font-family: var(--font-brand);
    font-size: clamp(3rem, 5vw, 4.2rem);
    font-weight: 500;
    line-height: 1.1;
}

.login-hero p {
    margin-bottom: 2.5rem;
    color: #cbd6c5;
    font-size: 1.05rem;
    line-height: 1.6;
}

.hero-points {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.hero-points span {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.065);
    color: #f0f3f0;
    font-size: 0.82rem;
    white-space: nowrap;
}

/* ==========================================================================
RIGHT FORM PANEL
========================================================================== */

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background-color: var(--bg-main);
}

.login-card {
    width: 100%;
    max-width: 440px;
}

.login-header {
    margin-bottom: 2rem;
}

.login-header h2 {
    margin-bottom: 0.25rem;
    color: var(--text-dark);
    font-family: var(--font-brand);
    font-size: 2.5rem;
    font-weight: 500;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.portal-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.3rem;
    border-radius: 10px;
    background-color: #f0f2f0;
}

.portal-option {
    padding: 0.65rem 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.portal-option:hover {
    color: var(--text-dark);
}

.portal-option.active {
    background-color: var(--bg-white);
    color: var(--forest);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.portal-option:focus-visible {
    outline: 2px solid var(--forest);
    outline-offset: 2px;
}

.portal-description {
    min-height: 1.4em;
    margin: 0 0 1.4rem;
    color: var(--text-muted);
    font-size: 0.84rem;
    line-height: 1.4;
}

.login-message,
.error-banner {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid #f8b4b4;
    border-radius: 10px;
    background-color: #fdf2f2;
    color: #9b1c1c;
    font-size: 0.88rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    color: var(--text-dark);
    font-size: 0.85rem;
    font-weight: 700;
}

.input-container {
    position: relative;
    display: flex;
    width: 100%;
    align-items: center;
}

.form-input {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-gray);
    border-radius: 10px;
    outline: none;
    background-color: var(--bg-white);
    color: var(--text-dark);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--forest);
    box-shadow: 0 0 0 3px rgba(42, 64, 40, 0.08);
}

.input-container .form-input {
    padding-right: 4.5rem;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    z-index: 2;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.password-toggle:hover {
    color: var(--text-dark);
}

.login-btn {
    margin-top: 0.5rem;
    padding: 0.95rem;
    border: none;
    border-radius: 10px;
    background-color: var(--forest);
    color: var(--bg-white);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.login-btn:hover {
    background-color: var(--forest-light);
    box-shadow: 0 8px 16px rgba(42, 64, 40, 0.1);
    transform: translateY(-1px);
}

#loginBtn {
    border: 1px solid var(--forest);
    box-shadow: 0 8px 18px rgba(42, 64, 40, 0.16);
    transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

#loginBtn:hover {
    border-color: #3c6742;
    background-color: #3c6742;
    box-shadow: 0 12px 24px rgba(42, 64, 40, 0.24);
    transform: translateY(-2px);
}

#loginBtn:active {
    background-color: var(--forest);
    box-shadow: 0 4px 10px rgba(42, 64, 40, 0.18);
    transform: translateY(0);
}

#loginBtn:focus-visible {
    outline: 3px solid rgba(60, 103, 66, 0.32);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    #loginBtn {
        transition: none;
    }
}

.google-login-btn,
.google-login-btn:visited {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    margin-top: 0.75rem;
    border: 1px solid #b8dec3;
    background: linear-gradient(135deg, #f3fbf5 0%, #e7f5eb 100%);
    color: #234b31;
    text-decoration: none;
    box-shadow: 0 5px 14px rgba(22, 101, 52, 0.08);
    transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.google-login-btn:hover,
.google-login-btn:focus-visible {
    border-color: #86bd96;
    background: linear-gradient(135deg, #e9f7ed 0%, #d9efdf 100%);
    color: #173d24;
    box-shadow: 0 8px 20px rgba(22, 101, 52, 0.14);
    transform: translateY(-1px);
}

.google-login-btn:focus-visible {
    outline: 3px solid rgba(34, 123, 64, 0.3);
    outline-offset: 2px;
}

.google-login-btn[hidden] {
    display: none !important;
}

.google-mark {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}

.demo-credentials {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-gray);
}

.demo-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.demo-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.4rem;
}

.demo-grid span {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.demo-grid strong {
    display: inline-block;
    width: 48px;
    color: var(--text-dark);
    font-weight: 700;
}

/* ==========================================================================
RESPONSIVE
========================================================================== */

@media (max-width: 992px) {
    .login-shell {
        display: flex;
        flex-direction: column;
        min-height: 100vh;
    }

    .login-hero {
        min-height: auto;
        justify-content: flex-start;
        gap: 18px;
        padding: 24px 20px 28px;
        border-bottom-right-radius: 28px;
        border-bottom-left-radius: 28px;
    }

    .login-hero::before {
        right: -80px;
        bottom: -80px;
        width: 220px;
        height: 220px;
    }

    .back-link {
        position: static;
        width: fit-content;
        margin-bottom: 22px;
        font-size: 14px;
    }

    .hero-content-wrap {
        max-width: 100%;
        margin-top: 0;
    }

    .hero-brand-row {
        gap: 14px;
        margin-bottom: 24px;
    }

    .hero-logo-left {
        width: 74px;
        height: 74px;
    }

    .hero-brand-title {
        max-width: 240px;
        font-size: 34px;
        line-height: 1.05;
    }

    .login-hero h1 {
        margin-bottom: 14px;
        font-size: 44px;
        line-height: 1.05;
        letter-spacing: -1.5px;
    }

    .login-hero p {
        max-width: 100%;
        margin-bottom: 22px;
        font-size: 15px;
        line-height: 1.65;
    }

    .hero-points {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .hero-points span {
        width: 100%;
        justify-content: flex-start;
        padding: 12px 14px;
        border-radius: 14px;
        font-size: 13px;
    }

    .login-panel {
        padding: 28px 18px 40px;
    }

    .login-card {
        max-width: 100%;
        padding: 22px;
        border: 1px solid #e6eae5;
        border-radius: 24px;
        background: #ffffff;
        box-shadow: 0 18px 48px rgba(42, 64, 40, 0.08);
    }

    .login-header {
        margin-bottom: 22px;
    }

    .login-header h2 {
        font-size: 38px;
        line-height: 1.05;
        letter-spacing: -1.5px;
    }

    .subtitle {
        display: block;
        margin-top: 8px;
        font-size: 14px;
        line-height: 1.4;
    }

    .role-tabs {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        margin-bottom: 22px;
        padding: 6px;
        border-radius: 16px;
    }

    .role-tab {
        padding: 12px 8px;
        border-radius: 12px;
        font-size: 13px;
    }

    .login-form {
        gap: 16px;
    }

    .form-label {
        font-size: 14px;
    }

    .form-input {
        height: 54px;
        padding: 0 16px;
        border-radius: 14px;
        font-size: 15px;
    }

    .input-container .form-input {
        padding-right: 72px;
    }

    .password-toggle {
        right: 16px;
        font-size: 13px;
    }

    .login-btn {
        height: 56px;
        border-radius: 16px;
        font-size: 15px;
    }

    .demo-credentials {
        margin-top: 24px;
        padding-top: 18px;
    }

    .demo-title {
        font-size: 12px;
    }

    .demo-grid {
        gap: 8px;
    }

    .demo-grid span {
        padding: 10px 12px;
        border: 1px solid #e6eae5;
        border-radius: 12px;
        background: #fbfcfb;
        font-size: 12.5px;
    }
}

@media (max-width: 480px) {
    .login-hero {
        padding: 22px 18px 26px;
        border-bottom-right-radius: 24px;
        border-bottom-left-radius: 24px;
    }

    .hero-brand-row {
        align-items: center;
        gap: 12px;
        margin-bottom: 20px;
    }

    .hero-logo-left {
        width: 66px;
        height: 66px;
    }

    .hero-brand-title {
        font-size: 30px;
        line-height: 1.05;
    }

    .login-hero h1 {
        font-size: 38px;
    }

    .login-hero p {
        font-size: 14px;
    }

    .login-panel {
        padding: 24px 14px 36px;
    }

    .login-card {
        padding: 20px;
        border-radius: 22px;
    }

    .login-header h2 {
        font-size: 34px;
    }

    .portal-switch {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .portal-option {
        font-size: 12px;
    }

    .form-input {
        height: 52px;
    }
}