/* ==========================================================================
   APM — Área do Associado
   Sistema visual conforme o Livro da Marca APM:
   - só cores oficiais (verdes 329C/3285C, azul 302C, Cool Gray 10C, amarelo 1235C);
   - cor sólida no painel (texto sobre área branca ou forma de cor sólida, p. 36);
   - UM canto arredondado por caixa — a regra do "box" (p. 36);
   - linha de pulso arredondada (p. 24, 28); Neo Sans Light nos títulos (p. 32, 47);
   - manuscrita só em uma palavra de destaque (p. 33);
   - barra superior igual à do site apm.org.br: logo colorido num cartão branco pendurado.
   ========================================================================== */
:root {
  --apm-verde:       #00675a;   /* Pantone 329C — painel, ações, títulos */
  --apm-verde-claro: #009581;   /* Pantone 3285C — só forma decorativa (não leva texto branco pequeno) */
  --apm-azul:        #004165;   /* Pantone 302C */
  --apm-cinza:       #616365;   /* Cool Gray 10C — texto secundário */
  --gold:            #ffb612;   /* Amarelo 1235C — destaque; só em texto ≥ 24px (contraste) */

  --paper:  #ffffff;
  --band-bg:    var(--apm-verde);
  --band-shape: var(--apm-verde-claro);
  /* barra superior: mesmo degradê do cabeçalho do site (escurece para a direita e para baixo) */
  --bar-h:    70px;
  --bar-from: #0f645d;
  --bar-to:   #0d534d;
  --bar-ink:  #ffffff;
  /* cartão do logo: o painel começa onde o cartão termina (vão branco abaixo da barra) */
  --logo-w:     232px;
  --logo-pad-t: 28px;
  --logo-pad-b: 30px;
  --logo-card-h: calc(var(--logo-pad-t) + var(--logo-w) * 416 / 1587 + var(--logo-pad-b));
  --action:       var(--apm-verde);
  --action-hover: #00564b;
  --title:  var(--apm-verde);
  --ink:    #2f3133;
  --muted:  var(--apm-cinza);
  --line:   #d6d0c9;
  --rule:   #e7e2dc;
  --legal:  #8b8884;

  --danger: #b5341f;
  --ok:     #1e7e4f;

  --radius:    88px;   /* painéis e formas: um canto só */
  --radius-sm: 12px;   /* campos e botões: um canto só */
  --ring: 0 0 0 3px rgba(0, 103, 90, 0.18);
  --font: "Neo Sans", Verdana, sans-serif;
  --script: "Allura", "Brush Script MT", cursive;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ Layout */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(420px, 42%) 1fr;
  grid-template-rows: auto 1fr;
}

/* --------------------------------------------------------- Barra superior */
/* Altura fixa: o cartão do logo é mais alto que a barra e "pendura" sobre o painel,
   como no cabeçalho do site. z-index acima do painel, que vem depois no DOM. */
.login__bar {
  grid-column: 1 / -1;
  position: relative;
  z-index: 2;
  height: var(--bar-h);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(24px, 5vw, 64px) 0 56px;
  color: var(--bar-ink);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.16) 100%),
    linear-gradient(90deg, var(--bar-from), var(--bar-to));
}

.login__logo {
  flex: none;
  display: block;
  padding: var(--logo-pad-t) 40px var(--logo-pad-b);
  background: #fff;
  border-radius: 0 0 18px 18px;
  /* sombra: a base do cartão encosta no vão branco abaixo da barra e sumiria nele */
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.08);
}
.login__logo img { display: block; width: var(--logo-w); height: auto; }
.login__logo:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

.login__top {
  align-self: center;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 16px;
  font-size: 0.875rem;
}
.login__help { color: rgba(255, 255, 255, 0.85); }
.pill {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 22px;
  font-weight: 500;
  text-decoration: none;
  border: 1.5px solid #fff;
  border-radius: 999px;
  transition: background .15s, color .15s;
}
.pill--outline { color: #fff; background: transparent; }
.pill--outline:hover { color: var(--apm-verde); background: #fff; }
.pill--solid { color: var(--apm-verde); background: #fff; }
.pill--solid:hover { color: #fff; background: transparent; }
.pill:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* ----------------------------------------------------------- Painel marca */
.login__brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* vão branco entre a barra e o painel até logo abaixo do cartão do logo (416/1587 = proporção do PNG) */
  margin-top: calc(var(--logo-card-h) - var(--bar-h) + 6px);   /* +6px: o cartão não encosta no painel */
  padding: 32px 56px 44px;
  color: #fff;
  background: var(--band-bg);
  border-radius: var(--radius) 0 var(--radius) 0;   /* cantos opostos: sup. esquerdo e inf. direito */
}
.login__brand > * { position: relative; z-index: 1; }

.login__eyebrow {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
}
.login__script {
  margin: 14px 0 -4px;
  font-family: var(--script);
  font-size: 3.6rem;
  font-weight: 400;
  line-height: 1;
  color: var(--gold);
}
.login__script:empty { display: none; }
.login__title {
  margin: 0 0 18px;
  font-size: 2.625rem;
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.005em;
  text-wrap: balance;
  color: #fff;
}
.login__lead {
  margin: 0;
  max-width: 34ch;
  font-size: 1.06rem;
  font-weight: 300;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.86);
}

.login__shape {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 0;
  width: 48%;
  height: 26%;
  background: var(--band-shape);
  border-radius: var(--radius) 0 0 0;
}

/* frequência cardíaca: linha estática de borda a borda do painel (as margens negativas
   anulam o padding lateral) com um ponto de luz que percorre o traçado */
.ecg {
  display: block;
  width: calc(100% + 112px);
  height: 64px;
  margin: auto -56px 0;
  overflow: visible;
}
.ecg path {
  fill: none;
  stroke: #fff;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ecg__line {
  stroke-width: 2;
  opacity: 0.6;
  vector-effect: non-scaling-stroke;
}
.ecg__light {
  stroke-width: 3;
  stroke-dasharray: 70 1000;
  stroke-dashoffset: 70;
  filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 6px rgba(255, 255, 255, 0.7));
  animation: ecg-light 3.6s linear infinite;
}
@keyframes ecg-light {
  from { stroke-dashoffset: 70; }
  to   { stroke-dashoffset: -1000; }
}

.login__foot {
  margin: 40px 0 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.82);
}
.login__foot strong { font-weight: 500; color: #fff; }

/* ------------------------------------------------------- Área do formulário */
.login__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 36px clamp(24px, 5vw, 64px) 32px;
  background: var(--paper);
}
.login__legal a { text-decoration: none; }
.login__legal a:hover { text-decoration: underline; }
.login__center { flex: 1; display: grid; place-items: center; padding: 40px 0; }
.panel__inner { width: 100%; max-width: 384px; }
.login__legal {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  font-size: 0.78rem;
  color: var(--legal);
}
.login__legal a { color: var(--legal); }

/* formulário solto sobre o branco: sem cartão, sem sombra */
.form-card__title {
  margin: 0 0 6px;
  font-size: 2.125rem;
  font-weight: 300;
  line-height: 1.15;
  text-wrap: balance;
  color: var(--title);
}
.form-card__sub {
  margin: 0 0 28px;
  font-size: 0.97rem;
  line-height: 1.5;
  color: var(--muted);
}
.form-card__sub a { color: var(--action); font-weight: 500; }

/* --------------------------------------------------------------- Formulário */
label {
  display: block;
  margin: 18px 0 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
}
.form-card form > label:first-of-type { margin-top: 0; }
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 18px 0 8px;
}
.label-row label { margin: 0; }
.label-row a { font-size: 0.85rem; font-weight: 500; color: var(--action); text-decoration: none; }
.label-row a:hover { text-decoration: underline; }

input[type="text"], input[type="password"], input:not([type]) {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm) 0 0 0;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #9a958f; }
input:focus {
  outline: none;
  border-color: var(--action);
  box-shadow: var(--ring);
}

/* senha com "Mostrar/Ocultar" (senha.js) */
.field-senha { position: relative; }
.field-senha input { padding-right: 96px; }
.panel__inner .field-senha__toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: auto;
  height: auto;
  margin: 0;
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border-radius: var(--radius-sm) 0 0 0;
}
.panel__inner .field-senha__toggle:hover { color: var(--action); background: none; }
.panel__inner .field-senha__toggle:active { transform: translateY(-50%); }

/* botão primário. Escopo no conteúdo: o `button` global também pegaria os do SweetAlert. */
.panel__inner button {
  width: 100%;
  height: 52px;
  margin-top: 26px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.03rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  font-family: inherit;
  color: #fff;
  background: var(--action);
  border: 0;
  border-radius: var(--radius-sm) 0 0 0;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.panel__inner button:hover { background: var(--action-hover); }
.panel__inner button:active { transform: translateY(1px); }
.panel__inner button:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------- Escolha de canal */
.choices { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 4px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  font-weight: 400;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm) 0 0 0;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.choice:hover { border-color: var(--action); background: #f2f8f7; }
.choice:has(input:checked) { border-color: var(--action); background: #e8f3f1; }
.choice input { width: auto; height: auto; margin: 0; accent-color: var(--action); }
.choice__label { font-size: 0.92rem; color: var(--ink); }
.choice__label strong { font-weight: 500; color: var(--action); }

/* código OTP */
.otp {
  text-align: center;
  letter-spacing: 0.5em;
  font-size: 1.35rem;
  font-weight: 500;
  padding-left: 0.5em;
}

/* ------------------------------------------------------------------ Textos */
.hint {
  margin: 12px 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
}
.link-row {
  margin: 26px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  font-size: 0.94rem;
  text-align: center;
  color: var(--muted);
}
.link-row + .link-row { margin-top: 14px; padding-top: 14px; }
.link-row a, .linklike {
  color: var(--action);
  font-weight: 500;
  text-decoration: none;
}
/* o link nunca quebra no meio: se faltar espaço, desce inteiro para a linha de baixo */
.link-row a { display: inline-block; }
.link-row a:hover, .linklike:hover { text-decoration: underline; }

.inline-form { margin-top: 12px; text-align: center; }
.panel__inner .link-btn {
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  background: none;
  color: var(--action);
  font-size: 0.88rem;
  font-weight: 500;
}
.panel__inner .link-btn:hover { background: none; text-decoration: underline; }

/* aviso Central (fallback) */
.notice {
  margin: 4px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-sm) 0 0 0;
  background: #fffaf0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink);
}
.notice strong { font-weight: 500; color: var(--action); }

/* área autenticada */
.welcome__id {
  display: inline-block;
  margin: 2px 0 24px;
  padding: 8px 14px;
  font-weight: 500;
  color: var(--action);
  background: #e8f3f1;
  border: 1px solid #cfe4e0;
  border-radius: var(--radius-sm) 0 0 0;
}
.btn-ghost {
  display: inline-block;
  padding: 12px 24px;
  text-decoration: none;
  color: var(--action);
  background: #fff;
  border: 1.5px solid var(--action);
  border-radius: var(--radius-sm) 0 0 0;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.btn-ghost:hover { background: var(--action); color: #fff; }

/* ---------------------------------------------- Alertas inline (fallback) */
.alert {
  margin: 0 0 16px;
  padding: 11px 14px;
  border-radius: var(--radius-sm) 0 0 0;
  font-size: 0.88rem;
  border: 1px solid;
}
.alert ul { margin: 0; padding-left: 18px; }
.alert--error { background: #fdecea; color: var(--danger); border-color: #f3c4bd; }
.alert--warn  { background: #fff6e6; color: #8a5a00; border-color: #f0dcae; }
.alert--ok    { background: #eafaf1; color: var(--ok);   border-color: #b7e4c7; }
html.js .alert { display: none; }   /* com JS, os avisos vão pelo SweetAlert */

/* SweetAlert — lista de erros */
.swal-list { text-align: left; margin: 0; padding-left: 1.15em; line-height: 1.6; }

/* ------------------------------------------------------------- Responsivo */
@media (max-width: 900px) {
  :root { --bar-h: 56px; --logo-w: 140px; --logo-pad-t: 16px; --logo-pad-b: 18px; }
  .login { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .login__bar { gap: 12px; padding: 0 16px; }
  .login__logo { padding: var(--logo-pad-t) 22px var(--logo-pad-b); border-radius: 0 0 14px 14px; }
  .login__brand { padding: 22px 22px 16px; border-radius: 64px 0 64px 0; }
  .login__eyebrow { font-size: 0.69rem; }
  .login__script { margin-top: 8px; font-size: 2.6rem; }
  .login__title { margin: 0; font-size: 1.625rem; }
  .login__lead, .login__foot, .login__help, .pill--outline { display: none; }
  .pill { height: 32px; padding: 0 16px; font-size: 0.8rem; }
  .login__shape { width: 130px; height: 74px; border-radius: 64px 0 0 0; }
  .ecg { height: 40px; margin: 18px -22px 0; width: calc(100% + 44px); }
  .login__main { padding: 28px 22px 22px; }
  .login__center { place-items: start center; padding: 0 0 32px; }
  .panel__inner { max-width: 480px; }
  .form-card__title { font-size: 1.75rem; }
  .form-card__sub { margin-bottom: 22px; }
  .login__legal { justify-content: center; }
}

/* --------------------------------------------------- Preferências do user */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .ecg__light { display: none; }          /* só a linha, sem a luz percorrendo */
}
