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

:root {
    --red: #c62830;
    --red-dark: #a01e25;
    --red-light: #f9ecec;
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-400: #adb5bd;
    --gray-500: #6c757d;
    --gray-700: #495057;
    --gray-900: #212529;
    --white: #ffffff;
    --shadow-md: 0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
    --radius: 10px;
    --radius-sm: 6px;
}

html, body {
    height: 100%;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: var(--gray-900);
    background: var(--gray-100);
    -webkit-font-smoothing: antialiased;
}

.login-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.brand-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42%;
    min-height: 100vh;
    background: linear-gradient(145deg, #8b0000 0%, var(--red) 55%, #e05560 100%);
    padding: 3rem 2.5rem;
    position: relative;
    overflow: hidden;
}

.brand-panel::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: rgba(255,255,255,.06);
}

.brand-panel::after {
    content: '';
    position: absolute;
    bottom: -100px;
    left: -60px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(255,255,255,.04);
}

.brand-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    z-index: 1;
}

.brand-logo {
    width: 160px;
    height: auto;
    filter: brightness(0) invert(1);
    opacity: .92;
}

.brand-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--white);
    line-height: 1.25;
    letter-spacing: -.01em;
}

.brand-tagline {
    font-size: .95rem;
    font-weight: 500;
    color: rgba(255,255,255,.85);
    letter-spacing: .02em;
}

.brand-divider {
    width: 48px;
    height: 2px;
    background: rgba(255,255,255,.35);
    border-radius: 2px;
    margin: .25rem 0;
}

.brand-sub {
    font-size: .82rem;
    color: rgba(255,255,255,.65);
    max-width: 220px;
    line-height: 1.5;
}

.form-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 2rem 1.5rem;
    background: var(--gray-50);
    gap: 1.5rem;
}

.form-card {
    width: 100%;
    max-width: 400px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 2.25rem 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    animation: slideUp .35s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.form-header {
    margin-bottom: 1.75rem;
}

.form-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -.02em;
    margin-bottom: .3rem;
}

.form-header p {
    font-size: .83rem;
    color: var(--gray-500);
}

.alert {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .7rem .9rem;
    border-radius: var(--radius-sm);
    font-size: .82rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert svg { flex-shrink: 0; }

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

.field-group {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.field-group label {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--gray-700);
}

.field-group input {
    width: 100%;
    padding: .65rem .85rem;
    font-size: .9rem;
    color: var(--gray-900);
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color .18s, box-shadow .18s;
}

.field-group input:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(198,40,48,.1);
}

.field-group input.input-error {
    border-color: var(--red);
    background: var(--red-light);
}

.field-group input::placeholder { color: var(--gray-400); }

.password-wrapper { position: relative; }

.password-wrapper input { padding-right: 2.75rem; }

.toggle-password {
    position: absolute;
    right: .65rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    display: flex;
    align-items: center;
    padding: 0;
    transition: color .15s;
}

.toggle-password:hover { color: var(--gray-700); }

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: -.25rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: .4rem;
    cursor: pointer;
    font-size: .82rem;
    color: var(--gray-700);
    font-weight: 500;
}

.remember-me input[type=checkbox] {
    accent-color: var(--red);
    width: 14px;
    height: 14px;
}

.forgot-link {
    font-size: .82rem;
    font-weight: 500;
    color: var(--red);
    text-decoration: none;
    transition: color .15s;
}

.forgot-link:hover {
    color: var(--red-dark);
    text-decoration: underline;
}

.btn-submit {
    width: 100%;
    padding: .75rem 1rem;
    margin-top: .5rem;
    font-size: .9rem;
    font-weight: 600;
    color: var(--white);
    background: var(--red);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    transition: background .18s, transform .12s, box-shadow .18s;
    box-shadow: 0 2px 8px rgba(198,40,48,.25);
}

.btn-submit:hover:not(:disabled) {
    background: var(--red-dark);
    box-shadow: 0 4px 14px rgba(198,40,48,.35);
    transform: translateY(-1px);
}

.btn-submit:active:not(:disabled) { transform: translateY(0); }

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

.btn-spinner {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.spinner-circle {
    animation: spin 0.8s linear infinite;
    transform-origin: center;
    stroke-dasharray: 31.4;
    stroke-dashoffset: 10;
}

@keyframes spin {
    to { stroke-dashoffset: -31.4; }
}

.form-footer {
    font-size: .75rem;
    color: var(--gray-400);
}

@media (max-width: 700px) {
    .login-wrapper { flex-direction: column; }
    .brand-panel { width: 100%; min-height: auto; padding: 2rem 1.5rem; }
    .brand-logo { width: 100px; }
    .brand-title { font-size: 1.25rem; }
    .brand-sub { display: none; }
    .form-panel { padding: 1.5rem 1rem; }
    .form-card { padding: 1.75rem 1.25rem; }
}

/* ── Logo acima do formulário (painel direito) ──────────────────────── */
.form-logo-wrap {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    margin-bottom: -.5rem;
}

.form-logo {
    width: 130px;
    height: auto;
    filter: drop-shadow(0 2px 8px rgba(198,40,48,.15));
    animation: slideUp .35s ease;
}

/* ── Bolas decorativas no painel direito ────────────────────────────── */
.form-panel {
    position: relative;
    overflow: hidden;
}

.deco-ball {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* canto superior-direito — grande */
.deco-ball--tr {
    width: 300px;
    height: 300px;
    top: -90px;
    right: -90px;
    background: rgba(198,40,48,.055);
}

/* canto inferior-esquerdo — médio */
.deco-ball--bl {
    width: 240px;
    height: 240px;
    bottom: -80px;
    left: -70px;
    background: rgba(198,40,48,.04);
}

/* meio-direito — pequeno accent */
.deco-ball--mr {
    width: 140px;
    height: 140px;
    top: 50%;
    right: -50px;
    transform: translateY(-50%);
    background: rgba(198,40,48,.03);
}

/* Garante que o conteúdo fica acima das bolas */
.form-logo-wrap,
.form-card,
.form-footer {
    position: relative;
    z-index: 1;
}

@media (max-width: 700px) {
    .form-logo { width: 100px; }
    .deco-ball--tr { width: 180px; height: 180px; top: -50px; right: -50px; }
    .deco-ball--bl { width: 150px; height: 150px; bottom: -50px; left: -40px; }
    .deco-ball--mr { display: none; }
}
