/* ═══════════════════════════════════════════════════════════════
   IDENTIDADE DAS TELAS DE AUTH — CRM + Portal do Cliente
   ───────────────────────────────────────────────────────────────
   Split: arte à esquerda, formulário à direita, sobre um fundo só.
   Usada por login, cadastro, reset-senha e pelas 4 telas do portal.
   A arte é injetada por /js/auth-art.js (não repetir SVG por página).

   A arte tem dois layouts (LCR-189):
   · .com-marca — logo, nome e subtítulo da tela Empresa em destaque,
     cena isométrica recolhida no canto;
   · sem marca  — cena no centro. A marca nunca tem valor de reserva
     aqui (#22): sem config, o destaque não aparece.

   NÃO confundir com portal-auth.css — aquele é da SPA portal-cliente
   e continua intocado.

   Paleta clara com o acento --brand do CRM (#6C63FF). Trocar para
   dark = mexer só no bloco :root abaixo.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --brand:       #6C63FF;
  --brand-hover: #7C74FF;
  --brand-deep:  #574FD6;
  --brand-soft:  #8B7FFF;
  --brand-ring:  rgba(108,99,255,.16);

  --srf:    #FFFFFF;   /* painel do formulário */
  --art-bg: #F2F5FC;   /* fundo do conjunto */
  --field:  #EFF2FA;
  --line:   #E4E8F3;

  --ink:   #171B2E;
  --ink2:  #4E5670;
  /* 4.6:1 sobre branco — tons mais claros reprovam no AA para 13px */
  --muted: #676E89;
  /* nome da empresa em destaque na arte */
  --ink-marca: #0F1A3D;

  /* arte: acento azul e ondas — decoração da tela, não marca do cliente */
  --art-acento: #3E6AF0;
  --art-fio:    #D5DBEE;
  --art-onda-1: rgba(104,134,246,.58);
  --art-onda-2: rgba(176,192,250,.12);
  --art-onda-3: rgba(80,112,240,.80);
  --art-onda-4: rgba(132,156,248,.36);
  --art-onda-5: rgba(206,216,252,0);

  --danger:     #C7304B;
  --danger-bg:  #FDEEF1;
  --danger-bd:  #F5CBD4;
  --success:    #12764E;
  --success-bg: #E9F7F0;
  --success-bd: #BFE6D4;

  /* olho do "mostrar senha" — desenhado em CSS, ver .field-action */
  --ico-olho: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
  --ico-olho-fechado: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 19c-6.4 0-10-7-10-7a18.5 18.5 0 0 1 5.06-5.94'/%3E%3Cpath d='M9.9 4.24A9.1 9.1 0 0 1 12 4c6.4 0 10 7 10 7a18.5 18.5 0 0 1-2.16 3.19'/%3E%3Cpath d='M14.12 14.12a3 3 0 1 1-4.24-4.24'/%3E%3Cpath d='M2 2l20 20'/%3E%3C/svg%3E");

  --font-display: 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans:    'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --r-sm: 8px;
  --r-md: 10px;
}

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

html, body {
  min-height: 100%;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--srf);
  -webkit-font-smoothing: antialiased;
}

/* ── SPLIT ─────────────────────────────────────────────────────── */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr);
  /* O fundo é do conjunto, não de cada painel: arte e formulário dividem a
     mesma luz, sem uma divisória entre eles. */
  background:
    radial-gradient(110% 80% at 14% 6%,  #FFFFFF 0%, transparent 55%),
    radial-gradient(75% 60% at 0% 100%,  rgba(92,124,245,.20) 0%, transparent 65%),
    radial-gradient(60% 60% at 58% 100%, rgba(108,99,255,.08) 0%, transparent 60%),
    var(--art-bg);
}

/* ── PAINEL DA ARTE ────────────────────────────────────────────── */
.auth-art {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  /* pé mais alto: as ondas ocupam o terço de baixo */
  padding: 40px 40px 11vh;
}
/* feixes de luz diagonais — o brilho de estúdio da referência */
.auth-art::before,
.auth-art::after {
  content: '';
  position: absolute;
  top: -30%;
  width: 44%;
  height: 170%;
  background: linear-gradient(180deg, rgba(255,255,255,.85), rgba(255,255,255,0));
  transform: rotate(24deg);
  pointer-events: none;
}
.auth-art::before { left: -6%; }
.auth-art::after  { left: 46%; width: 20%; opacity: .55; }

/* Enquanto a marca não chega (auth-art.js) o conteúdo fica apagado e aparece
   já no layout certo. Os feixes são pseudo-elementos e ficam: a tela nunca
   abre em branco. */
.auth-art > * { transition: opacity .4s ease; }
.auth-art[data-estado="carregando"] > * { opacity: 0; }

/* ondas */
.art-ondas {
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 32%;
  pointer-events: none;
}
.art-onda-s1 { stop-color: var(--art-onda-1); }
.art-onda-s2 { stop-color: var(--art-onda-2); }
.art-onda-s3 { stop-color: var(--art-onda-3); }
.art-onda-s4 { stop-color: var(--art-onda-4); }
.art-onda-s5 { stop-color: var(--art-onda-5); }
.art-onda-fio   { fill: none; stroke: #FFFFFF; stroke-width: 2.2; opacity: .9; }
.art-onda-fio-2 { stroke-width: 1.2; opacity: .55; }

/* cena isométrica */
.art-cena {
  position: relative;
  width: 100%;
  max-width: 640px;
  display: flex;
  justify-content: center;
}
.art-scene {
  width: 100%;
  height: auto;
  /* em viewport baixa a cena encolhe (preserveAspectRatio) em vez de estourar */
  max-height: 60vh;
  overflow: visible;
}

/* faces isométricas */
.art-scene polygon { stroke: rgba(126,138,175,.22); stroke-width: .8; stroke-linejoin: round; }
.iso-t { fill: #FFFFFF; }
.iso-r { fill: #E8ECF6; }
.iso-l { fill: #D7DDEF; }
.iso-t-accent { fill: var(--brand-soft); }
.iso-r-accent { fill: var(--brand); }
.iso-l-accent { fill: var(--brand-deep); }
.iso-face     { fill: #FCFDFF; }
.iso-face-bar { fill: rgba(108,99,255,.30); stroke: none; }
.iso-trace {
  fill: none; stroke: #C5CDE4; stroke-width: 1.3;
  stroke-linecap: round; stroke-linejoin: round;
}
.iso-shadow { fill: rgba(88,100,140,.10); }
.iso-shield      { fill: var(--brand); }
.iso-shield-tick { fill: none; stroke: #FFFFFF; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.iso-wordmark {
  font-family: var(--font-display);
  font-size: 9px; font-weight: 600; letter-spacing: .18em;
  fill: rgba(108,99,255,.55);
}

.art-float { animation: floatY 7s ease-in-out infinite; }
.art-float-slow { animation: floatY 9s ease-in-out infinite reverse; }
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-9px); }
}

/* destaque da marca */
.art-hero {
  position: relative;
  /* acima do feixe ::after, que lavaria o logo */
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 520px;
  text-align: center;
}
.art-logo:empty,
.art-nome:empty,
.art-sub:empty { display: none; }
.art-logo img {
  display: block;
  /* width/height auto + máximos: logo quadrado ou largo cabe inteiro, sem
     distorcer e sem corte */
  width: auto; height: auto;
  max-width: min(420px, 100%);
  max-height: min(300px, 38vh);
}
.art-nome {
  font-family: var(--font-display);
  font-size: clamp(38px, 3.9vw, 58px);
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.04;
  color: var(--ink-marca);
}
.art-logo + .art-nome { margin-top: 4px; }
.art-sub {
  margin-top: 12px;
  font-size: clamp(13px, 1.15vw, 17px);
  font-weight: 500;
  letter-spacing: .32em;
  text-transform: uppercase;
  /* o tracking deixa um espaço depois da última letra; sem compensar do outro
     lado, o subtítulo fica deslocado à esquerda do nome */
  padding-left: .32em;
  color: var(--muted);
}
.art-fio { display: none; }

.art-legend { position: relative; max-width: 460px; text-align: center; }
.art-legend strong {
  display: block;
  font-family: var(--font-display);
  font-size: 19px; font-weight: 500; color: var(--muted);
  letter-spacing: -.015em; line-height: 1.4;
}

/* ── COM MARCA: logo no centro, cena recolhida no canto ────────── */
.auth-art.com-marca .art-cena {
  position: absolute;
  top: 3%; right: 2%;
  width: 40%;
  max-width: 380px;
}
.auth-art.com-marca .art-scene { max-height: 32vh; opacity: .5; }
.auth-art.com-marca .art-fio {
  display: block;
  width: 112px; height: 2px;
  margin: 26px 0 22px;
  border-radius: 2px;
  background: linear-gradient(90deg,
    var(--art-fio) 0 32%, var(--art-acento) 32% 68%, var(--art-fio) 68% 100%);
}
.auth-art.com-marca .art-legend strong {
  font-family: var(--font-sans);
  font-size: 18px; font-weight: 400;
  letter-spacing: 0;
  color: var(--ink2);
}

/* ── ARTE DO FORNECEDOR (telas da equipe): nome no alto, veleiro na onda ── */
/* O logo não fica no hero: o auth-art.js o põe DENTRO do SVG das ondas, entre a
   onda de trás e a da frente. Aqui só se sobe o texto e se abre altura para o
   barco. */
.auth-art.arte-fornecedor {
  justify-content: flex-start;
  padding-top: 25vh;
}
.auth-art.arte-fornecedor .art-ondas { height: 46%; }
.auth-art.arte-fornecedor .art-cena { width: 32%; }
.art-onda-barco image { filter: drop-shadow(0 8px 12px rgba(15,26,61,.14)); }
/* Nas telas da equipe o cabeçalho não recebe o subtítulo do cliente (a arte
   já traz o do fornecedor): vazio, não ocupa lugar. */
.brand-sub:empty { display: none; }

/* ── PAINEL DO FORMULÁRIO ──────────────────────────────────────── */
.auth-panel {
  position: relative;
  /* véu branco que se fecha da esquerda para a direita: o fundo da arte segue
     por baixo do formulário sem virar uma divisória */
  background: linear-gradient(90deg,
    rgba(255,255,255,.35) 0%, rgba(255,255,255,.88) 22%, rgba(255,255,255,.96) 60%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 56px;
}
.auth-inner { width: 100%; max-width: 372px; margin: 0 auto; }

/* marca do cliente (multi-tenant) */
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 42px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  /* --marca-cor vem da config (auth-art.js); o gradiente é só o visual de
     quando a config não diz cor nenhuma */
  background: var(--marca-cor, linear-gradient(140deg, var(--brand-soft), var(--brand)));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 16px; font-weight: 700;
  overflow: hidden;
}
.brand-mark img { display: none; width: 100%; height: 100%; object-fit: contain; padding: 3px; }
/* Na tela larga o logo já aparece grande na arte: o quadrado fica com a
   inicial. Só marca sem nome (sem inicial) mostra o logo aqui. */
.brand-mark.tem-logo:not(.tem-letra) { background: #FFFFFF; box-shadow: inset 0 0 0 1px var(--line); }
.brand-mark.tem-logo:not(.tem-letra) img { display: block; }
/* Marca nasce vazia no HTML e só aparece quando auth-art.js recebe o nome/logo
   de /api/public/config. Sem isto, o quadrado renderiza como um bloco colorido
   vazio até o fetch responder — e para sempre se ele falhar. Inicial fixa no
   HTML não é opção: este repo é upstream de N deploys-cliente. */
.brand-mark:empty { display: none; }
.brand-nome { font-family: var(--font-display); font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.brand-sub  { font-size: 10px; letter-spacing: .16em; color: var(--muted); font-weight: 600; margin-top: 2px; }

h1.title {
  font-family: var(--font-display);
  font-size: 36px; font-weight: 600; letter-spacing: -.03em;
  line-height: 1.12; margin-bottom: 10px;
}
.subtitle {
  font-size: 14px; color: var(--muted); line-height: 1.65;
  margin-bottom: 32px;
}

/* ── CAMPOS ────────────────────────────────────────────────────── */
.field { margin-bottom: 18px; position: relative; }
.field label {
  display: block; font-size: 12.5px; font-weight: 500;
  color: var(--ink2); margin-bottom: 7px;
}
.field input {
  width: 100%; padding: 13px 14px;
  background: var(--field);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-family: var(--font-sans); font-size: 14px; color: var(--ink);
  transition: background .15s, border-color .15s, box-shadow .15s;
  outline: none; -webkit-appearance: none;
}
.field:has(.field-action) input { padding-right: 46px; }
.field input::placeholder { color: #99A0B8; }
.field input:focus {
  background: var(--srf);
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-ring);
}
.field input.error { border-color: var(--danger); }
.field input[readonly] { color: var(--muted); }

/* Mostrar/ocultar senha. O emoji que o HTML escreve fica só como reserva sem
   CSS; o ícone é desenhado aqui e o estado sai do aria-label que o
   toggleSenha() de cada tela já troca. */
.field-action {
  position: absolute; right: 6px; top: 29px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--muted);
  font-size: 0; line-height: 0;
  border-radius: 6px; transition: color .15s, background .15s;
}
.field-action::before {
  content: '';
  width: 18px; height: 18px;
  background: currentColor;
  -webkit-mask: var(--ico-olho) center / contain no-repeat;
          mask: var(--ico-olho) center / contain no-repeat;
}
.field-action[aria-label="Ocultar senha"]::before {
  -webkit-mask-image: var(--ico-olho-fechado);
          mask-image: var(--ico-olho-fechado);
}
.field-action:hover { color: var(--ink2); background: rgba(0,0,0,.04); }

.field-hint { font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.45; }

.field-row { display: flex; justify-content: flex-end; margin: -4px 0 22px; }
.link-forgot { font-size: 12.5px; color: var(--ink2); text-decoration: none; transition: color .15s; }
.link-forgot:hover { color: var(--brand); }

/* ── REQUISITOS DE SENHA ───────────────────────────────────────── */
/* lista com bolinha (reset-senha, portal-ativar, portal-reset) */
.reqs {
  margin-top: 10px; padding: 12px 14px;
  background: var(--field); border-radius: var(--r-sm);
}
.req {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; color: var(--muted); margin-bottom: 5px;
}
.req:last-child { margin-bottom: 0; }
.req .dot {
  width: 7px; height: 7px; border-radius: 50%;
  border: 1.5px solid #B9C0D6; flex-shrink: 0;
  transition: background .18s, border-color .18s;
}
.req.ok { color: var(--success); }
.req.ok .dot { background: var(--success); border-color: var(--success); }

/* grade compacta (cadastro) */
.reqs-grid {
  margin-top: 10px; display: grid;
  grid-template-columns: 1fr 1fr; gap: 5px 14px;
}
.sr-item { font-size: 11.5px; color: var(--muted); transition: color .15s; }
.sr-item.ok { color: var(--success); font-weight: 500; }

/* ── CAIXA DE BOAS-VINDAS (portal-ativar) ──────────────────────── */
.welcome {
  background: rgba(108,99,255,.07);
  border: 1px solid rgba(108,99,255,.20);
  border-radius: var(--r-sm);
  padding: 13px 15px; margin-bottom: 20px;
  font-size: 13px; color: var(--ink2); line-height: 1.5;
}
.welcome b { color: var(--brand); font-weight: 600; }

/* ── BOTÕES (mesmo padrão do CRM) ──────────────────────────────── */
.btn-submit {
  width: 100%; padding: 14px;
  background: linear-gradient(180deg, var(--brand-hover), var(--brand));
  color: #fff;
  border: none; border-radius: var(--r-sm);
  font-family: var(--font-sans); font-size: 14.5px; font-weight: 600;
  cursor: pointer; transition: filter .15s, box-shadow .15s, transform .15s;
  box-shadow: 0 8px 20px rgba(108,99,255,.28), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-submit:hover:not(:disabled) {
  filter: brightness(1.05); transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(108,99,255,.32), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-submit:active:not(:disabled) { transform: translateY(0); }
.btn-submit:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-submit .btn-loading { display: none; }
.btn-submit.loading .btn-text { display: none; }
.btn-submit.loading .btn-loading { display: inline; }

.btn-ghost {
  display: inline-block;
  font-size: 13px; font-weight: 500;
  color: var(--brand); text-decoration: none;
  transition: color .15s;
}
.btn-ghost:hover { color: var(--brand-hover); text-decoration: underline; }

/* ── RODAPÉS ───────────────────────────────────────────────────── */
.foot-secure {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin-top: 24px; font-size: 11.5px; color: var(--muted);
}
.foot-help {
  margin-top: 40px; padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted); text-align: center;
}
.foot-help a { color: var(--brand); text-decoration: none; font-weight: 500; }
.foot-help a:hover { text-decoration: underline; }
/* direitos do fornecedor (telas da equipe), injetado pelo auth-art.js */
.auth-direitos {
  margin-top: 22px;
  font-size: 11.5px; color: var(--muted);
  text-align: center;
}
.sec-back { margin-top: 22px; text-align: center; }
.sec-back a { font-size: 12.5px; color: var(--ink2); text-decoration: none; transition: color .15s; }
.sec-back a:hover { color: var(--brand); }

/* ── ALERTAS ───────────────────────────────────────────────────── */
/* padrão único: .alert fica oculto, .show revela, .error/.success pintam */
.alert {
  display: none;
  padding: 11px 13px; border-radius: var(--r-sm);
  font-size: 13px; margin-bottom: 18px; line-height: 1.5;
}
.alert.show    { display: block; }
.alert.error   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid var(--danger-bd); }
.alert.success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-bd); }

/* ── ESTADOS ───────────────────────────────────────────────────── */
.loading { text-align: center; color: var(--muted); padding: 48px 0; font-size: 13px; }

.form-section { display: none; }
.form-section.active { display: block; }

.success-box { text-align: center; padding: 8px 0; }
.success-icon { font-size: 48px; margin-bottom: 16px; }
.success-box h2 {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 600; letter-spacing: -.02em;
  margin-bottom: 10px;
}
.success-box p { font-size: 13.5px; color: var(--muted); line-height: 1.65; margin-bottom: 24px; }

/* ── MODAL DE INATIVIDADE (login) ──────────────────────────────── */
.inactivity-overlay {
  display: none; position: fixed; inset: 0; z-index: 999;
  background: rgba(23,27,46,.45); backdrop-filter: blur(5px);
  align-items: center; justify-content: center;
}
.inactivity-overlay.show { display: flex; }
.inactivity-box {
  background: var(--srf); border: 1px solid var(--line);
  border-radius: 16px; padding: 38px 40px; max-width: 360px; width: 90%;
  text-align: center; box-shadow: 0 24px 60px rgba(23,27,46,.20);
}
.inactivity-box h3 { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin-bottom: 12px; }
.inactivity-box p { font-size: 13px; color: var(--muted); margin-bottom: 22px; line-height: 1.6; }
.inactivity-count { font-family: var(--font-display); font-size: 52px; font-weight: 600; color: var(--brand); line-height: 1; margin-bottom: 20px; }

/* ── RESPONSIVO ────────────────────────────────────────────────── */
/* Tela baixa com marca: logo e respiros encolhem para o destaque caber. */
@media (min-width: 1001px) and (max-height: 720px) {
  .art-logo img { max-height: 32vh; }
  .auth-art.com-marca .art-fio { margin: 18px 0 14px; }
}
@media (max-width: 1000px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-panel { background: var(--srf); padding: 40px 24px; }
  /* sem a arte, o logo volta para o quadrado do cabeçalho */
  .brand-mark.tem-logo { width: 42px; height: 42px; background: #FFFFFF; box-shadow: inset 0 0 0 1px var(--line); }
  .brand-mark.tem-logo img { display: block; }
  .brand-mark.tem-logo .bm-letra { display: none; }
}
@media (max-width: 420px) {
  .auth-panel { padding: 32px 20px; }
  h1.title { font-size: 30px; }
  .brand { margin-bottom: 32px; }
  .reqs-grid { grid-template-columns: 1fr; }
}
/* Gatilho por PONTEIRO, não por largura: celular deitado tem ~740px e continua
   sendo um dedo (mesma convenção do datas.js). */
@media (pointer: coarse) {
  /* O iOS dá ZOOM na página ao focar campo com fonte < 16px — e a primeira
     coisa que o cliente faz no celular é digitar o CPF aqui. */
  .field input { font-size: 16px; }
  /* Alvos de toque (44px, iOS HIG): o olho da senha media 26px e o "Esqueci
     minha senha" 16px de altura. */
  .field-action { width: 44px; height: 44px; top: 23px; right: 2px; }
  .link-forgot, .sec-back a { display: inline-flex; align-items: center; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .art-float, .art-float-slow { animation: none; }
  .auth-art > * { transition: none; }
  .btn-submit:hover { transform: none; }
}
