:root {
    --bg-dark: #020617;
    --bg-panel: rgba(15, 23, 42, 0.96);
    --bg-panel-soft: rgba(30, 41, 59, 0.72);
    --blue: #2563eb;
    --blue-light: #60a5fa;
    --text: #f8fafc;
    --muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.18);
    --danger: #ef4444;
    --success: #22c55e;
}

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

html {
    min-height: 100%;
}

body.auth-page {
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 18% 18%, rgba(37, 99, 235, 0.24), transparent 28%),
        radial-gradient(circle at 82% 28%, rgba(96, 165, 250, 0.16), transparent 30%),
        linear-gradient(135deg, #020617 0%, #07111f 48%, #0b1324 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font-family: inherit;
}

/* =========================
   AUTH LAYOUT
   ========================= */

.auth-shell {
    width: min(480px, 100%);
}

.auth-card {
    width: 100%;
    padding: 42px;
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(7, 12, 22, 0.98));
    border: 1px solid rgba(96, 165, 250, 0.18);
    box-shadow:
        0 30px 90px rgba(0, 0, 0, 0.55),
        0 0 40px rgba(37, 99, 235, 0.12);
    backdrop-filter: blur(16px);
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 34px;
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 900;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: linear-gradient(145deg, #020617 0%, #0f172a 45%, #2563eb 100%);
    border: 1px solid rgba(96, 165, 250, 0.35);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.28);
    font-size: 0.95rem;
    letter-spacing: 1px;
}

.auth-heading {
    margin-bottom: 28px;
}

.auth-heading span {
    display: inline-block;
    margin-bottom: 10px;
    color: #60a5fa;
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.auth-heading h1 {
    margin-bottom: 10px;
    color: #ffffff;
    font-size: clamp(2rem, 5vw, 2.7rem);
    line-height: 1.05;
    letter-spacing: -1px;
}

.auth-heading p {
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.6;
}

/* =========================
   FORM
   ========================= */

.auth-form {
    width: 100%;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #dbeafe;
    font-size: 0.92rem;
    font-weight: 800;
}

.form-group input {
    width: 100%;
    min-height: 50px;
    padding: 14px 15px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.045);
    color: #ffffff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-group input::placeholder {
    color: #64748b;
}

.form-group input:focus {
    border-color: rgba(96, 165, 250, 0.75);
    background: rgba(255, 255, 255, 0.065);
    box-shadow:
        0 0 0 4px rgba(37, 99, 235, 0.16),
        0 0 22px rgba(37, 99, 235, 0.12);
}

.form-group input:invalid:not(:placeholder-shown) {
    border-color: rgba(239, 68, 68, 0.7);
}

.form-group input:valid:not(:placeholder-shown) {
    border-color: rgba(34, 197, 94, 0.55);
}

/* =========================
   BUTTONS
   ========================= */

.btn,
.auth-submit,
button[type="submit"] {
    width: 100%;
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 18px;
    border: none;
    border-radius: 14px;
    color: #ffffff;
    background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 55%, #60a5fa 100%);
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.28);
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn:hover,
.auth-submit:hover,
button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 38px rgba(37, 99, 235, 0.38);
    filter: brightness(1.04);
}

.btn:active,
.auth-submit:active,
button[type="submit"]:active {
    transform: translateY(0);
}

/* =========================
   MESSAGES
   ========================= */

.alert-error,
.alert-success,
.error-message,
.login-error,
.success-message {
    margin-bottom: 18px;
    padding: 13px 15px;
    border-radius: 14px;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.45;
}

.alert-error,
.error-message,
.login-error {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.36);
}

.alert-success,
.success-message {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.34);
}

/* =========================
   LINKS
   ========================= */

.auth-switch {
    margin-top: 24px;
    color: var(--muted);
    text-align: center;
    font-size: 0.96rem;
}

.auth-switch a {
    color: #60a5fa;
    font-weight: 900;
}

.auth-switch a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

/* Compatibilidade com HTML antigo */

.back-link,
.auth-footer {
    margin-top: 24px;
    color: var(--muted);
    text-align: center;
    font-size: 0.96rem;
}

.back-link a,
.auth-footer a {
    color: #60a5fa;
    font-weight: 900;
}

.back-link a:hover,
.auth-footer a:hover {
    color: #93c5fd;
    text-decoration: underline;
}

/* =========================
   COMPATIBILIDADE COM PAGE-WRAPPER ANTIGO
   ========================= */

.page-wrapper {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    overflow: hidden;
    border-radius: 30px;
    background: rgba(7, 12, 22, 0.9);
    border: 1px solid rgba(96, 165, 250, 0.18);
    box-shadow:
        0 30px 90px rgba(0, 0, 0, 0.55),
        0 0 40px rgba(37, 99, 235, 0.12);
    backdrop-filter: blur(16px);
}

.brand-panel {
    position: relative;
    overflow: hidden;
    padding: 52px;
    min-height: 640px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background:
        linear-gradient(90deg, rgba(2, 6, 23, 0.92), rgba(2, 6, 23, 0.58)),
        url("https://images.unsplash.com/photo-1517836357463-d25dfeac3438?auto=format&fit=crop&w=1400&q=80");
    background-size: cover;
    background-position: center;
}

.brand-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(0deg, rgba(96, 165, 250, 0.06) 0 1px, transparent 1px 34px),
        repeating-linear-gradient(90deg, rgba(96, 165, 250, 0.05) 0 1px, transparent 1px 34px);
    pointer-events: none;
}

.brand-panel > * {
    position: relative;
    z-index: 1;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.logo-mark {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: linear-gradient(145deg, #020617 0%, #0f172a 45%, #2563eb 100%);
    border: 1px solid rgba(96, 165, 250, 0.35);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.28);
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 1px;
}

.brand-logo strong {
    color: #ffffff;
    font-size: 1.6rem;
    font-weight: 900;
}

.brand-content {
    max-width: 540px;
}

.brand-tag {
    display: inline-flex;
    margin-bottom: 16px;
    padding: 8px 14px;
    border-radius: 999px;
    color: #93c5fd;
    background: rgba(37, 99, 235, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.24);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.brand-content h1 {
    margin-bottom: 18px;
    color: #ffffff;
    font-size: clamp(2.4rem, 5vw, 4.6rem);
    line-height: 0.96;
    letter-spacing: -2px;
}

.brand-content p {
    color: #cbd5e1;
    font-size: 1.04rem;
    line-height: 1.7;
}

.brand-stats {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.stat-box {
    min-width: 120px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(96, 165, 250, 0.18);
}

.stat-box strong {
    display: block;
    margin-bottom: 4px;
    color: #ffffff;
    font-size: 1.1rem;
}

.stat-box span {
    color: #93c5fd;
    font-size: 0.82rem;
}

.brand-footer {
    color: #93c5fd;
    font-size: 0.92rem;
}

.signup-panel {
    padding: 56px 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(7, 12, 22, 0.98));
    border-left: 1px solid rgba(96, 165, 250, 0.12);
}

.signup-header {
    margin-bottom: 30px;
}

.signup-header span {
    display: inline-block;
    margin-bottom: 10px;
    color: #60a5fa;
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.signup-header h2 {
    margin-bottom: 10px;
    color: #ffffff;
    font-size: 2.1rem;
    line-height: 1.1;
}

.signup-header p {
    color: var(--muted);
    line-height: 1.6;
}

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

@media (max-width: 900px) {
    body.auth-page {
        align-items: flex-start;
    }

    .auth-shell {
        width: min(540px, 100%);
    }

    .auth-card {
        padding: 34px 28px;
    }

    .page-wrapper {
        max-width: 540px;
        grid-template-columns: 1fr;
    }

    .brand-panel {
        min-height: auto;
        padding: 38px 32px;
    }

    .brand-content {
        margin-top: 38px;
    }

    .signup-panel {
        padding: 40px 32px;
        border-left: 0;
        border-top: 1px solid rgba(96, 165, 250, 0.12);
    }
}

@media (max-width: 520px) {
    body.auth-page {
        padding: 14px;
    }

    .auth-card,
    .page-wrapper {
        border-radius: 22px;
    }

    .auth-card {
        padding: 28px 22px;
    }

    .auth-heading h1 {
        font-size: 1.9rem;
    }

    .brand-panel,
    .signup-panel {
        padding: 28px 22px;
    }

    .brand-content h1 {
        font-size: 2rem;
        letter-spacing: -1.2px;
    }

    .signup-header h2 {
        font-size: 1.7rem;
    }

    .brand-logo strong {
        font-size: 1.35rem;
    }

    .logo-mark,
    .brand-mark {
        width: 44px;
        height: 44px;
    }
}