:root {
    --green-900: #0d3d2e;
    --green-800: #145c42;
    --green-700: #1a6b4f;
    --green-600: #228b63;
    --green-500: #2ea872;
    --green-100: #e8f5ef;
    --green-50: #f4faf7;
    --gray-900: #1a1f1c;
    --gray-700: #4a5650;
    --gray-500: #7a8680;
    --gray-300: #d4ddd8;
    --gray-100: #f0f4f2;
    --white: #ffffff;
    --error: #c0392b;
    --error-bg: #fdecea;
    --success: #1a6b4f;
    --success-bg: #e8f5ef;
    --shadow: 0 24px 64px rgba(13, 61, 46, 0.22);
    --login-card-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.72),
        0 1px 2px rgba(13, 61, 46, 0.05),
        0 4px 12px rgba(13, 61, 46, 0.07),
        0 12px 32px rgba(13, 61, 46, 0.09),
        0 24px 56px rgba(20, 92, 66, 0.11),
        0 40px 88px rgba(34, 139, 99, 0.1),
        0 64px 128px rgba(46, 168, 114, 0.08);
    --radius: 18px;
    --login-footer-height: 2.75rem;
}

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

html.login-page-root,
body.login-page {
    font-family: 'DM Sans', system-ui, sans-serif;
    color: var(--gray-900);
    background: linear-gradient(
        118deg,
        #0d3d2e 0%,
        #145c42 22%,
        #228b63 42%,
        #4db88a 58%,
        #9fd9bc 72%,
        #d4f0e3 84%,
        #f2faf6 92%,
        #ffffff 100%
    );
}

body.login-page {
    min-height: 100vh;
    overflow-x: hidden;
}

.login-shell {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(380px, 480px);
    align-items: center;
    gap: 2rem;
    padding: 2.5rem clamp(1.25rem, 4vw, 4rem) 4.5rem;
    max-width: 1320px;
    margin: 0 auto;
}

#particles-js {
    position: fixed;
    inset: 0;
    z-index: 0;
}

.login-ambient-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(circle at 12% 28%, rgba(46, 168, 114, 0.28) 0%, transparent 48%),
        radial-gradient(circle at 88% 42%, rgba(255, 255, 255, 0.72) 0%, transparent 52%),
        radial-gradient(circle at 72% 88%, rgba(255, 255, 255, 0.45) 0%, transparent 40%),
        linear-gradient(180deg, rgba(13, 61, 46, 0.08) 0%, rgba(255, 255, 255, 0.12) 100%);
}

.login-intro {
    color: var(--white);
    padding-right: 1rem;
}

.login-intro-logo {
    margin-bottom: 2.5rem;
}

.login-intro-logo img {
    display: block;
    height: clamp(72px, 8vw, 96px);
    width: auto;
    max-width: min(320px, 100%);
    object-fit: contain;
}

.login-intro-headline {
    font-size: clamp(2rem, 4.2vw, 3.15rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.02em;
    margin-bottom: 1.15rem;
    max-width: 14ch;
}

.login-intro-text {
    font-size: clamp(1rem, 1.5vw, 1.12rem);
    line-height: 1.65;
    opacity: 0.9;
    max-width: 520px;
    margin-bottom: 2rem;
}

/* Desktop: single viewport, no page scroll */
@media (min-width: 981px) {
    html.login-page-root,
    body.login-page {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }

    body.login-page {
        min-height: 0;
        padding-bottom: 0;
    }

    .login-shell {
        height: calc(100vh - var(--login-footer-height));
        height: calc(100dvh - var(--login-footer-height));
        min-height: 0;
        max-height: calc(100vh - var(--login-footer-height));
        max-height: calc(100dvh - var(--login-footer-height));
        padding: clamp(1.25rem, 2.5vh, 2rem) clamp(1.25rem, 4vw, 4rem) clamp(0.75rem, 1.5vh, 1.25rem);
        overflow: visible;
    }

    .login-intro {
        max-height: 100%;
        overflow: hidden;
    }

    .login-intro-logo {
        margin-bottom: clamp(1.25rem, 3vh, 2rem);
    }

    .login-intro-headline {
        font-size: clamp(1.75rem, 3.2vw, 2.85rem);
        margin-bottom: clamp(0.65rem, 1.5vh, 1rem);
    }

    .login-intro-text {
        font-size: clamp(0.92rem, 1.2vw, 1.05rem);
        margin-bottom: clamp(1rem, 2vh, 1.5rem);
    }

    .login-form-area {
        max-height: 100%;
        overflow: visible;
        padding: 1.25rem 0.75rem;
    }

    .login-card {
        max-height: calc(100vh - var(--login-footer-height) - 2.5rem);
        max-height: calc(100dvh - var(--login-footer-height) - 2.5rem);
    }

    .login-card-inner {
        max-height: calc(100vh - var(--login-footer-height) - 2.5rem);
        max-height: calc(100dvh - var(--login-footer-height) - 2.5rem);
        overflow-y: auto;
        scrollbar-width: thin;
    }
}

.btn-about-video {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 1.2rem 0.7rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    color: var(--white);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.btn-about-video:hover,
.btn-about-video:focus-visible {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.55);
    transform: translateY(-1px);
    outline: none;
}

.btn-about-video-play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--green-800);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.login-form-area {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    border-radius: var(--radius);
    isolation: isolate;
    overflow: visible;
}

.login-card::before {
    content: '';
    position: absolute;
    inset: -20px;
    border-radius: calc(var(--radius) + 20px);
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(ellipse 85% 70% at 50% 45%, rgba(46, 168, 114, 0.22) 0%, transparent 68%),
        radial-gradient(ellipse 100% 90% at 50% 100%, rgba(13, 61, 46, 0.14) 0%, transparent 72%);
    filter: blur(18px);
    opacity: 0.95;
}

.login-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: -1;
    pointer-events: none;
    box-shadow: var(--login-card-shadow);
}

.login-card-inner {
    position: relative;
    z-index: 1;
    padding: 2.1rem 2rem 1.75rem;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.92);
}

.login-card h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--gray-900);
}

.login-card .subtitle {
    color: var(--gray-500);
    font-size: 0.92rem;
    line-height: 1.5;
    margin-bottom: 1.35rem;
}

.role-switcher {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
    background: var(--gray-100);
    border-radius: 12px;
    padding: 0.35rem;
    margin-bottom: 1.35rem;
}

.role-btn {
    border: none;
    background: transparent;
    padding: 0.62rem 0.35rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.role-btn .icon { font-size: 1.05rem; }
.role-btn:hover { color: var(--green-800); }

.role-btn.active {
    background: var(--white);
    color: var(--green-800);
    box-shadow: 0 2px 8px rgba(13, 61, 46, 0.1);
}

.form-group { margin-bottom: 1.15rem; }

.form-group label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: 0.45rem;
}

.input-wrap {
    display: flex;
    align-items: stretch;
    border: 1.5px solid var(--gray-300);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--white);
}

.input-wrap:focus-within {
    border-color: var(--green-600);
    box-shadow: 0 0 0 3px rgba(34, 139, 99, 0.15);
}

.input-prefix {
    display: flex;
    align-items: center;
    padding: 0 0.9rem;
    background: var(--gray-100);
    color: var(--gray-700);
    font-weight: 600;
    font-size: 0.95rem;
    border-right: 1.5px solid var(--gray-300);
    white-space: nowrap;
}

.input-wrap input {
    flex: 1;
    border: none;
    outline: none;
    padding: 0.85rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--gray-900);
    background: transparent;
    min-width: 0;
}

.input-wrap input::placeholder { color: var(--gray-500); }

.otp-inputs {
    display: flex;
    gap: 0.55rem;
    justify-content: center;
}

.otp-inputs input {
    width: 46px;
    height: 52px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    border: 1.5px solid var(--gray-300);
    border-radius: 10px;
    outline: none;
    font-family: inherit;
    color: var(--gray-900);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.otp-inputs input:focus {
    border-color: var(--green-600);
    box-shadow: 0 0 0 3px rgba(34, 139, 99, 0.15);
}

.btn {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 0.92rem 1.25rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, opacity 0.2s;
}

.btn:active:not(:disabled) { transform: scale(0.98); }

.btn-primary {
    background: var(--green-800);
    color: var(--white);
}

.btn-primary:hover:not(:disabled) { background: var(--green-900); }

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.88rem;
    margin-bottom: 1.15rem;
    display: none;
    line-height: 1.45;
}

.alert.show { display: block; }

.alert-error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid #f5c6c0;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #b8e0cc;
}

.otp-sent-to {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 0.75rem;
}

.step { display: none; }
.step.active { display: block; }

.otp-meta {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.88rem;
    color: var(--gray-500);
}

.otp-meta button {
    background: none;
    border: none;
    color: var(--green-800);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    font-size: inherit;
    padding: 0;
}

.otp-meta button:disabled {
    color: var(--gray-500);
    cursor: not-allowed;
}

.otp-meta button:hover:not(:disabled) { text-decoration: underline; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: none;
    color: var(--gray-500);
    font-family: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    margin-bottom: 1rem;
    padding: 0;
}

.back-link:hover { color: var(--green-800); }

.dev-banner {
    margin-top: 1rem;
    padding: 0.65rem 0.85rem;
    background: #fff8e6;
    border: 1px dashed #e6c200;
    border-radius: 8px;
    font-size: 0.82rem;
    color: #7a6200;
    display: none;
}

.dev-banner.show { display: block; }

.demo-access {
    margin-top: 1.15rem;
    padding-top: 1.15rem;
    border-top: 1px dashed var(--gray-300);
    text-align: center;
}

.demo-access[hidden] { display: none; }

.demo-access p {
    font-size: 0.82rem;
    color: var(--gray-500);
    margin-bottom: 0.65rem;
}

.btn-demo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.55rem 1.1rem;
    border: 1.5px solid var(--green-600);
    background: var(--green-50);
    color: var(--green-800);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-demo:hover {
    background: var(--green-100);
    border-color: var(--green-700);
}

body.login-page .site-footer-login {
    background: rgba(8, 30, 22, 0.82);
    border-color: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
}

body.login-page .site-footer-login p,
body.login-page .site-footer-login a {
    color: rgba(255, 255, 255, 0.72);
}

body.login-page .site-footer-login a {
    color: rgba(168, 230, 198, 0.95);
}

/* About TMNP video modal */
.about-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 3vw, 2.5rem);
    background: rgba(4, 12, 9, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}

.about-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.about-modal-dialog {
    position: relative;
    width: min(920px, 100%);
    border-radius: 20px;
    overflow: hidden;
    background: #050505;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(46, 168, 114, 0.14);
    transform: translateY(14px) scale(0.965);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.about-modal-overlay.open .about-modal-dialog {
    transform: translateY(0) scale(1);
}

.about-modal-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    background: rgba(8, 8, 8, 0.62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.92);
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.about-modal-close:hover,
.about-modal-close:focus-visible {
    background: rgba(20, 92, 66, 0.85);
    border-color: rgba(255, 255, 255, 0.35);
    transform: scale(1.05);
    outline: none;
}

.about-video-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.about-video-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

@media (max-width: 520px) {
    .about-modal-dialog {
        border-radius: 14px;
    }

    .about-modal-close {
        top: 0.55rem;
        right: 0.55rem;
        width: 34px;
        height: 34px;
        font-size: 1.3rem;
    }
}

@media (max-width: 980px) {
    .login-shell {
        grid-template-columns: 1fr;
        padding: 1.5rem 1rem 4.5rem;
        gap: 1.5rem;
    }

    .login-intro {
        text-align: center;
        padding-right: 0;
    }

    .login-intro-logo {
        display: flex;
        justify-content: center;
        margin-bottom: 1.5rem;
    }

    .login-intro-headline {
        max-width: none;
        margin-left: auto;
        margin-right: auto;
    }

    .login-intro-text {
        margin-left: auto;
        margin-right: auto;
    }

    .btn-about-video {
        margin: 0 auto;
    }
}

@media (max-width: 520px) {
    .login-card-inner {
        padding: 1.5rem 1.15rem;
    }

    .otp-inputs input {
        width: 40px;
        height: 48px;
    }
}
