/* =============================================================================
   REDE DE APOIO — folha de estilo única
   =============================================================================
   Direção: neutralidade partidária é requisito jurídico (§1.4 do CONTEXTO),
   então é também requisito visual. Nenhuma cor de partido brasileiro.
   Índigo elétrico como ação, âmbar exclusivamente para marcos.

   Onboarding é claro (é um formulário, registro civil).
   O painel é escuro (é seu território, e a constelação precisa brilhar).
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,800&family=Instrument+Sans:wght@400;500;600&family=JetBrains+Mono:wght@700&display=swap');

:root {
  --ink: #0e1116;
  --graphite: #1b2029;
  --mist: #e7eaf0;
  --paper: #ffffff;
  --slate: #656e82;
  --volt: #4534e8;
  --volt-soft: #6d5eff;
  --ember: #ff9a1f;
  --danger: #d92d20;

  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --r: 14px;
  --shell: 460px;
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--body);
  background: var(--mist);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body.is-dark { background: var(--ink); color: var(--paper); }

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 28px 20px 48px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* --- Tipografia ---------------------------------------------------------- */

h1, h2 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.028em;
  line-height: 1.04;
  margin: 0 0 12px;
}

h1 { font-size: clamp(30px, 8vw, 40px); }
h2 { font-size: 22px; }

p { line-height: 1.55; margin: 0 0 16px; color: var(--slate); }
body.is-dark p { color: #9aa3b6; }

.eyebrow {
  font-family: var(--body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--volt);
  margin: 0 0 14px;
}

body.is-dark .eyebrow { color: var(--volt-soft); }

.fineprint { font-size: 13px; line-height: 1.5; color: var(--slate); }

/* --- Telas --------------------------------------------------------------- */

.screen { display: none; flex: 1; flex-direction: column; }
.screen.active { display: flex; animation: rise .34s cubic-bezier(.2,.7,.3,1) both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.spacer { flex: 1; min-height: 20px; }

/* --- Progresso ----------------------------------------------------------- */

.steps { display: flex; gap: 5px; margin-bottom: 26px; }
.steps span {
  height: 3px;
  flex: 1;
  border-radius: 99px;
  background: rgba(14, 17, 22, .12);
  transition: background .3s;
}
.steps span.done { background: var(--volt); }

/* --- Formulários --------------------------------------------------------- */

label.field { display: block; margin-bottom: 16px; }

label.field > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

input[type="text"], input[type="tel"], select {
  width: 100%;
  padding: 14px 15px;
  font-family: var(--body);
  font-size: 16px; /* 16px evita o zoom automático do iOS */
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid rgba(14, 17, 22, .14);
  border-radius: var(--r);
  outline: none;
  transition: border-color .18s;
}

input:focus-visible, select:focus-visible, button:focus-visible {
  border-color: var(--volt);
  outline: 2px solid var(--volt);
  outline-offset: 2px;
}

input.code {
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: .28em;
  text-align: center;
}

/* --- Botões -------------------------------------------------------------- */

button {
  font-family: var(--body);
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: var(--r);
  cursor: pointer;
}

.btn {
  display: block;
  width: 100%;
  padding: 16px;
  background: var(--volt);
  color: #fff;
  transition: transform .12s, opacity .18s;
}

.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .38; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--slate);
  padding: 13px;
  width: 100%;
  font-size: 14px;
}

body.is-dark .btn-ghost { color: #7b859b; }

.btn-danger { color: var(--danger); }

/* --- Cartão de quem convidou --------------------------------------------- */

.inviter {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px;
  background: var(--paper);
  border-radius: var(--r);
  margin-bottom: 24px;
}

.avatar {
  width: 42px; height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  background: var(--volt);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 17px;
}

/* --- Campos: apoio e marcação de opcional --------------------------------
   O que é opcional precisa PARECER opcional. Um campo sem marca é lido como
   obrigatório, e a pessoa trava procurando um dado que ela não precisa dar.
   ------------------------------------------------------------------------ */

label.field > span .opt {
  font-style: normal;
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--slate);
  background: rgba(101, 110, 130, .12);
  padding: 2px 6px;
  border-radius: 5px;
  margin-left: 6px;
  vertical-align: 1px;
}

.fineprint.hint { display: block; margin-top: 7px; }

/* --- Endereço resolvido pelo CEP -----------------------------------------
   O resultado da consulta fica sempre visível e sempre corrigível. CEP de
   empresa e de caixa postal devolvem bairro errado com frequência, e um
   endereço que a pessoa não consegue corrigir é pior que campo em branco.
   ------------------------------------------------------------------------ */

.resolved {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  background: rgba(69, 52, 232, .07);
  border: 1.5px solid rgba(69, 52, 232, .22);
  border-radius: var(--r);
  margin: -4px 0 16px;
}

.resolved > div { flex: 1; min-width: 0; }
.resolved b { display: block; font-size: 15px; font-weight: 600; }

.resolved small {
  display: block;
  font-size: 12.5px;
  color: var(--slate);
  margin-top: 1px;
}

.resolved button {
  background: transparent;
  color: var(--volt);
  font-size: 13px;
  padding: 6px 2px;
  flex: 0 0 auto;
}

/* --- Seleção de candidatos ----------------------------------------------- */

.pick {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--paper);
  border: 1.5px solid transparent;
  border-radius: var(--r);
  margin-bottom: 9px;
  cursor: pointer;
  transition: border-color .16s;
}

.pick.on { border-color: var(--volt); }
.pick input { accent-color: var(--volt); width: 19px; height: 19px; flex: 0 0 19px; }
.pick .who { flex: 1; min-width: 0; }
.pick .who b { display: block; font-size: 15px; font-weight: 600; }
.pick .who small { color: var(--slate); font-size: 12.5px; }

.pick .num {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--volt);
}

/* --- Consentimento -------------------------------------------------------
   Os obrigatórios e o opcional são visualmente distintos de propósito.
   O opcional NUNCA nasce marcado (§R2). Se algum dia alguém "otimizar" a
   conversão marcando por padrão, o consentimento perde validade.
   ------------------------------------------------------------------------ */

.consent {
  display: flex;
  gap: 12px;
  padding: 15px;
  background: var(--paper);
  border-radius: var(--r);
  margin-bottom: 10px;
  cursor: pointer;
}

.consent.optional {
  background: transparent;
  border: 1.5px dashed rgba(14, 17, 22, .2);
}

.consent input { accent-color: var(--volt); width: 20px; height: 20px; flex: 0 0 20px; margin-top: 1px; }
.consent .txt { font-size: 13.5px; line-height: 1.5; }
.consent .txt b { display: block; margin-bottom: 3px; font-size: 14.5px; font-weight: 600; }
.consent a { color: var(--volt); }

.tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 5px;
  margin-bottom: 6px;
}

.tag.req { background: rgba(69, 52, 232, .1); color: var(--volt); }
.tag.opt { background: rgba(101, 110, 130, .13); color: var(--slate); }

/* --- Painel (escuro) ------------------------------------------------------ */

.panel-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.tally { display: flex; gap: 26px; margin: 4px 0 22px; }

.tally .n {
  font-family: var(--mono);
  font-size: 40px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.tally .direct .n { color: var(--paper); }
.tally .network .n { color: var(--volt-soft); }

.tally small {
  display: block;
  margin-top: 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #6d768b;
}

/* --- Constelação: o elemento de assinatura -------------------------------
   Seu nó no centro, convidados diretos em órbita, rede indireta como anel
   externo. As linhas se desenham no carregamento. É a única coisa que se
   move na tela inteira.
   ------------------------------------------------------------------------ */

.constellation {
  background: var(--graphite);
  border-radius: 20px;
  padding: 6px;
  margin-bottom: 22px;
  overflow: hidden;
}

.constellation svg { display: block; width: 100%; height: auto; }

.edge {
  stroke: var(--volt-soft);
  stroke-width: 1.1;
  fill: none;
  opacity: .5;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: draw .7s ease forwards;
}

@keyframes draw { to { stroke-dashoffset: 0; } }

.node { fill: var(--volt-soft); opacity: 0; animation: pop .32s ease forwards; }
.node.far { fill: #454f6b; }
.node.me { fill: var(--paper); }

@keyframes pop { to { opacity: 1; } }

.empty-net {
  text-align: center;
  padding: 34px 20px;
  color: #6d768b;
  font-size: 14px;
  line-height: 1.55;
}

/* --- Link de compartilhamento -------------------------------------------- */

.mylink {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--graphite);
  border-radius: var(--r);
  padding: 13px 15px;
  margin-bottom: 10px;
}

.mylink code {
  flex: 1;
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: .1em;
  color: var(--paper);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mylink button {
  background: transparent;
  color: var(--volt-soft);
  font-size: 13px;
  padding: 4px 2px;
}

/* --- Marcos (único lugar onde o âmbar aparece) ---------------------------- */

.milestone {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
  background: rgba(255, 154, 31, .1);
  border-radius: var(--r);
  margin-bottom: 22px;
  font-size: 14px;
  color: var(--ember);
}

/* --- Ranking -------------------------------------------------------------- */

.rank-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  font-size: 14.5px;
}

.rank-row .pos {
  font-family: var(--mono);
  font-size: 13px;
  color: #6d768b;
  width: 26px;
}

.rank-row .nm { flex: 1; }
.rank-row .ct { font-family: var(--mono); color: var(--volt-soft); }
.rank-row.me { color: var(--ember); }
.rank-row.me .ct, .rank-row.me .pos { color: var(--ember); }

/* --- Mensagens ------------------------------------------------------------ */

.alert {
  padding: 13px 15px;
  border-radius: var(--r);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
  display: none;
}

.alert.show { display: block; }
.alert.err { background: rgba(217, 45, 32, .1); color: var(--danger); }
.alert.ok { background: rgba(69, 52, 232, .1); color: var(--volt); }

body.is-dark .alert.err { background: rgba(217, 45, 32, .16); color: #ff8b80; }

/* --- Acessibilidade ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .edge { stroke-dashoffset: 0; }
  .node { opacity: 1; }
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
