.login-body { min-height: 100vh; background: var(--cream-050); }
.login-body [hidden] { display: none !important; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

/* Painel da marca (esquerda) */
.login-side { position: relative; background: var(--navy-700); color: var(--cream-050); overflow: hidden; }
.login-side-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(247,244,239,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(247,244,239,0.06) 1px, transparent 1px);
  background-size: 56px 56px;
  animation: drift 14s linear infinite;
}
.login-side-inner {
  position: relative; height: 100%; min-height: 100vh;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: 40px 56px;
}
.login-side-copy { max-width: 26em; }
.login-side-copy h1 {
  font-weight: 700; font-size: clamp(28px, 3.4vw, 42px); line-height: 1.1; letter-spacing: -0.03em;
  margin: 14px 0 0; text-wrap: balance;
}
.login-perks { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 12px; }
.login-perks li { display: flex; gap: 11px; font-size: 15.5px; line-height: 1.5; color: rgba(247,244,239,0.84); }
.login-perks li span { color: var(--blue-200); flex: none; }
.login-side-foot { font-size: 13px; color: rgba(247,244,239,0.62); }

/* Formulário (direita) */
.login-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 40px 24px; }
.login-card {
  width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line-200); border-radius: 16px;
  padding: 36px 32px; box-shadow: 0 30px 70px rgba(12,47,74,0.12);
}
.login-card h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.025em; }
.login-sub { font-size: 15px; line-height: 1.55; color: var(--ink-500); margin-top: 6px; }

#loginForm, #resetForm { margin-top: 24px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-family: 'Sora', sans-serif; font-size: 13.5px; font-weight: 600; color: var(--navy-900); }
.field input {
  width: 100%; font: inherit; font-size: 16px; color: var(--navy-900);
  background: var(--cream-100); border: 1.5px solid var(--line-200); border-radius: 8px; padding: 12px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.field input::placeholder { color: #8A979D; }
.field input:focus { outline: none; background: #fff; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(15,108,181,0.18); }
.field input[aria-invalid="true"] { border-color: #B42318; background: #FFF8F7; }
.field input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(180,35,24,0.15); }
.field-error { font-size: 13px; color: #B42318; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 88px; }
.password-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  font-family: 'Sora', sans-serif; font-size: 12.5px; font-weight: 600; color: var(--blue-700);
  background: none; border: none; border-radius: 6px; padding: 8px 10px; cursor: pointer;
}
.password-toggle:hover { background: var(--blue-050); }

.login-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-600); cursor: pointer; padding: 6px 0; }
.check input { width: 17px; height: 17px; accent-color: var(--blue-700); margin: 0; }
.link-btn {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--blue-700);
  background: none; border: none; padding: 6px 0; cursor: pointer;
}
.link-btn:hover { color: var(--blue-500); text-decoration: underline; }

.login-submit { width: 100%; font-size: 16px; padding: 15px 20px; margin-top: 4px; }
.login-submit[disabled] { opacity: 0.7; cursor: wait; transform: none; }

.reset-done {
  margin-top: 20px; font-size: 14.5px; line-height: 1.55; color: var(--ink-600);
  background: var(--blue-050); border: 1px solid var(--blue-075); border-radius: 10px; padding: 14px 16px;
}
.back-to-login { margin-top: 18px; }

.login-foot { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line-100); font-size: 14.5px; color: var(--ink-500); text-align: center; }
.login-foot a { font-weight: 600; color: var(--blue-700); }
.login-back { font-size: 14px; color: var(--ink-500); padding: 8px; }
.login-back:hover { color: var(--blue-700); }

/* Celular: painel da marca vira um cabeçalho compacto em cima do formulário */
@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-side-inner { min-height: 0; padding: 22px 20px 28px; gap: 20px; }
  .login-side-copy h1 { font-size: 26px; }
  .login-perks, .login-side-foot { display: none; }
  .login-main { justify-content: flex-start; padding: 24px 16px 32px; }
  .login-card { padding: 28px 20px; box-shadow: none; }
}

/* Botão de tema: canto superior direito da área do formulário (fundo claro no modo claro) */
.login-main { position: relative; }
.theme-toggle.on-light { color: var(--navy-900); border-color: var(--line-200); }
.theme-toggle.on-light:hover { border-color: var(--blue-500); background: var(--blue-050); }
.login-theme { position: absolute; top: 16px; right: 16px; }
/* 16 (topo) + 44 (botão no celular) + 16 de respiro antes do cartão */
@media (max-width: 860px) { .login-main { padding-top: 76px; } }

/* ============ Modo escuro ============ */
:where([data-theme="dark"]) .login-body { background: var(--d-bg); }
:where([data-theme="dark"]) .theme-toggle.on-light { color: var(--d-text); border-color: var(--d-line); }
:where([data-theme="dark"]) .theme-toggle.on-light:hover { border-color: var(--blue-200); background: rgba(124,184,230,0.1); }
:where([data-theme="dark"]) .login-card { background: var(--d-card); border-color: var(--d-line); box-shadow: 0 30px 70px rgba(0,0,0,0.4); }
:where([data-theme="dark"]) .login-sub { color: var(--d-muted); }
:where([data-theme="dark"]) .field label { color: var(--d-text); }
:where([data-theme="dark"]) .field input { background: var(--d-bg); border-color: var(--d-line); color: var(--d-text); }
:where([data-theme="dark"]) .field input::placeholder { color: #6F8391; }
:where([data-theme="dark"]) .field input:focus { background: var(--d-bg); border-color: var(--blue-200); box-shadow: 0 0 0 3px rgba(124,184,230,0.22); }
:where([data-theme="dark"]) .field input[aria-invalid="true"] { border-color: #F97066; background: rgba(249,112,102,0.08); }
:where([data-theme="dark"]) .field-error { color: #FDA29B; }
:where([data-theme="dark"]) .password-toggle,
:where([data-theme="dark"]) .link-btn { color: var(--blue-200); }
:where([data-theme="dark"]) .password-toggle:hover { background: rgba(124,184,230,0.12); }
:where([data-theme="dark"]) .check { color: var(--d-muted); }
:where([data-theme="dark"]) .reset-done { background: rgba(124,184,230,0.1); border-color: var(--d-line); color: var(--d-text); }
:where([data-theme="dark"]) .login-foot { border-top-color: var(--d-line); color: var(--d-muted); }
:where([data-theme="dark"]) .login-foot a { color: var(--blue-200); }
:where([data-theme="dark"]) .login-back { color: var(--d-muted); }
