/* ==========================================================
   CNCD Brasil – Tela de login
   ========================================================== */

:root {
  --navy: #0C2C56;
  --navy-deep: #081E3C;
  --green: #2C6C32;
  --gold: #EB9402;
  --ink: #14213A;
  --muted: #5B6778;
  --line: #D5DCE6;
  --paper: #F6F8FB;
  --error: #B42318;
  --font: "Sora", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  display: grid;
  grid-template-columns: minmax(320px, 5fr) 7fr;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; }

/* ---------- Painel da marca ---------- */
.brand {
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px 56px 40px;
}

.brand-logo { width: min(320px, 100%); }

.brand-copy { max-width: 26ch; }
.brand-copy h1 {
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  line-height: 1.2;
  font-weight: 700;
  margin: 0 0 14px;
}
.brand-copy p {
  margin: 0;
  color: rgba(255, 255, 255, .72);
  line-height: 1.6;
  font-size: .95rem;
}

/* As três cores da marca */
.stripe { display: flex; gap: 6px; margin-top: 28px; }
.stripe span { height: 4px; border-radius: 2px; }
.stripe span:nth-child(1) { width: 56px; background: var(--gold); }
.stripe span:nth-child(2) { width: 28px; background: var(--green); }
.stripe span:nth-child(3) { width: 14px; background: #fff; }

.brand-foot { font-size: .78rem; color: rgba(255, 255, 255, .5); }

/* ---------- Formulário ---------- */
.form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.login { width: 100%; max-width: 380px; }

.login-shield { width: 52px; display: block; margin-bottom: 24px; }

.login h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--navy);
}
.login .sub {
  margin: 0 0 32px;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.5;
}

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.input-wrap { position: relative; }

.field input {
  width: 100%;
  font: inherit;
  font-size: .95rem;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: #98A2B3; }
.field input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 4px rgba(12, 44, 86, .12);
}
.field input.pw { padding-right: 84px; }

.toggle-pw {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  color: var(--navy);
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.toggle-pw:hover { background: var(--paper); }
.toggle-pw:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }

.row-link { display: flex; justify-content: flex-end; margin: -4px 0 26px; }
.forgot {
  color: var(--green);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
}
.forgot:hover { text-decoration: underline; }
.forgot:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 3px; }

/* ---------- Botão ---------- */
.btn {
  width: 100%;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
  background: var(--navy);
  border: 0;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background .15s;
}
.btn:hover { background: var(--navy-deep); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn[disabled] { opacity: .75; cursor: progress; }

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}
.btn.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Erro ---------- */
#error-message {
  display: none;
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: #FEF3F2;
  border: 1px solid #FECDCA;
  color: var(--error);
  font-size: .88rem;
  line-height: 1.45;
}
#error-message.show { display: block; }

/* ---------- Celular / tablet ---------- */
@media (max-width: 860px) {
  body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .brand { padding: 28px 24px; }
  .brand-logo { width: 200px; }
  .brand-copy, .brand-foot, .login-shield { display: none; }
  .form-side { align-items: flex-start; padding-top: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .spinner { animation-duration: 1.5s; }
}
