:root {
    --bg: #07090d;
    --panel: #0d1118;
    --panel-soft: #111720;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #f4f7fb;
    --text-secondary: #c5ccd6;
    --text-muted: #737d8c;
    --accent: #66e3a4;
    --accent-soft: rgba(102, 227, 164, 0.10);
    --danger: #ff7272;
    --warning: #f3c969;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    background:
        radial-gradient(
            circle at 20% 10%,
            rgba(102, 227, 164, 0.06),
            transparent 32%
        ),
        radial-gradient(
            circle at 90% 90%,
            rgba(70, 110, 255, 0.05),
            transparent 30%
        ),
        var(--bg);

    color: var(--text);

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input {
    font: inherit;
}

.login-page {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 28px;
}

.login-card {
    width: min(430px, 100%);
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.018),
            transparent
        ),
        var(--panel);

    box-shadow:
        0 30px 90px rgba(0, 0, 0, 0.40);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 13px;
}

.login-logo {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(102, 227, 164, 0.22);
    border-radius: 13px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.login-eyebrow {
    display: block;
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 8px;
    font-weight: 650;
    letter-spacing: 0.11em;
}

.login-brand h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 650;
}

.login-copy {
    margin-top: 40px;
}

.login-copy h2 {
    margin: 0;
    font-size: 26px;
    font-weight: 620;
    letter-spacing: -0.03em;
}

.login-copy p {
    margin: 10px 0 0;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.65;
}

.login-form {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-form label > span {
    display: block;
    margin-bottom: 7px;
    color: var(--text-secondary);
    font-size: 9px;
    font-weight: 550;
}

.login-form input {
    width: 100%;
    height: 46px;
    padding: 0 13px;
    outline: none;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--text);
    font-size: 11px;

    transition:
        border-color 160ms ease,
        background 160ms ease,
        box-shadow 160ms ease;
}

.login-form input:focus {
    border-color: rgba(102, 227, 164, 0.35);
    background: rgba(102, 227, 164, 0.025);
    box-shadow:
        0 0 0 3px rgba(102, 227, 164, 0.05);
}

.login-form input:disabled {
    opacity: 0.55;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 70px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    height: 30px;
    padding: 0 9px;
    cursor: pointer;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    font-size: 9px;
}

.password-toggle:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
}

.login-message {
    min-height: 17px;
    color: var(--text-muted);
    font-size: 9px;
    line-height: 1.5;
}

.login-message[data-state="error"] {
    color: var(--danger);
}

.login-message[data-state="success"] {
    color: var(--accent);
}

.login-message[data-state="pending"] {
    color: var(--warning);
}

.login-submit {
    width: 100%;
    height: 46px;
    cursor: pointer;
    border: 1px solid rgba(102, 227, 164, 0.24);
    border-radius: 11px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 10px;
    font-weight: 650;

    transition:
        background 160ms ease,
        border-color 160ms ease,
        transform 160ms ease;
}

.login-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(102, 227, 164, 0.34);
    background: rgba(102, 227, 164, 0.15);
}

.login-submit:disabled {
    cursor: wait;
    opacity: 0.55;
}

.login-security {
    margin-top: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: var(--text-muted);
    font-size: 8px;
}

.security-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow:
        0 0 10px rgba(102, 227, 164, 0.35);
}

.login-footer {
    width: min(430px, 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.24);
    font-size: 8px;
}

@media (max-width: 520px) {
    .login-page {
        padding: 16px;
    }

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

    .login-copy {
        margin-top: 32px;
    }

    .login-footer {
        padding: 0 4px;
    }
}

/* =========================================================
   LOGIN MOBILE FIX
   Evita auto-zoom do Safari/iPhone e mantém o card na tela
   ========================================================= */

html {
    width: 100%;
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

@media (max-width: 600px) {

    html,
    body {
        width: 100%;
        min-height: 100%;
        margin: 0;
        overflow-x: hidden;
    }

    .login-page {
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;

        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;

        padding:
            max(16px, env(safe-area-inset-top))
            max(16px, env(safe-area-inset-right))
            max(16px, env(safe-area-inset-bottom))
            max(16px, env(safe-area-inset-left));

        overflow-x: hidden;
    }

    .login-card {
        width: 100%;
        max-width: 430px;
        margin: 0;

        padding: 24px 20px;

        border-radius: 16px;

        flex-shrink: 0;
    }

    .login-brand {
        gap: 12px;
    }

    .login-logo {
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
    }

    .login-copy {
        margin-top: 30px;
    }

    .login-copy h2 {
        font-size: 24px;
    }

    .login-copy p {
        font-size: 13px;
        line-height: 1.55;
    }

    .login-form {
        margin-top: 24px;
        gap: 16px;
    }

    .login-form label > span {
        margin-bottom: 7px;
        font-size: 12px;
    }

    /*
     * IMPORTANTE:
     * 16px impede o zoom automático do Safari/iPhone
     * quando o usuário toca no input.
     */
    .login-form input {
        width: 100%;
        height: 50px;

        padding: 0 14px;

        font-size: 16px;

        border-radius: 11px;

        -webkit-appearance: none;
        appearance: none;
    }

    .password-field {
        width: 100%;
    }

    .password-field input {
        padding-right: 78px;
    }

    .password-toggle {
        right: 8px;

        min-width: 58px;
        height: 34px;

        font-size: 12px;
    }

    .login-message {
        min-height: 20px;
        font-size: 12px;
    }

    .login-submit {
        height: 50px;
        font-size: 14px;
    }

    .login-security {
        margin-top: 20px;
        font-size: 10px;
    }

    .login-footer {
        width: 100%;
        max-width: 430px;

        padding: 0 4px;

        font-size: 9px;
    }
}


/*
 * Celulares com pouca altura ou teclado virtual aberto.
 * O card passa a usar o topo em vez de ficar cortado
 * verticalmente.
 */
@media (max-width: 600px) and (max-height: 650px) {

    .login-page {
        justify-content: flex-start;
        overflow-y: auto;
    }

    .login-card {
        margin-top: 0;
    }

    .login-copy {
        margin-top: 22px;
    }

    .login-footer {
        padding-bottom: 8px;
    }
}
