/* WhatsApp Passive Auth — shared styles. No build step, no framework. */

:root {
  color-scheme: light dark;

  --bg: #f7f8fa;
  --bg-elevated: #ffffff;
  --bg-subtle: #f0f2f5;
  --border: #e2e5ea;
  --border-strong: #cbd2dc;
  --text: #101418;
  --text-muted: #5c6674;
  --text-faint: #8a94a2;
  --accent: #0f8a4a;
  --accent-hover: #0c7440;
  --accent-soft: #e6f4ec;
  --danger: #c0392b;
  --danger-soft: #fdeceb;
  --warn: #b4690e;
  --warn-soft: #fdf3e3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 20, 24, 0.04), 0 8px 24px rgba(16, 20, 24, 0.06);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --bg-elevated: #161b22;
    --bg-subtle: #1c222b;
    --border: #262d38;
    --border-strong: #38414f;
    --text: #e8ecf1;
    --text-muted: #9aa5b4;
    --text-faint: #6b7686;
    --accent: #25d366;
    --accent-hover: #1fb457;
    --accent-soft: #12261a;
    --danger: #ff6b5e;
    --danger-soft: #2a1614;
    --warn: #e0a44a;
    --warn-soft: #2a2115;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 720px; }

/* ---------- header ---------- */

header.site {
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 10;
}
header.site .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 58px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand:hover { text-decoration: none; }
nav.site { margin-left: auto; display: flex; gap: 18px; flex-wrap: wrap; }
nav.site a { color: var(--text-muted); font-size: 14px; }
nav.site a:hover, nav.site a.active { color: var(--text); }

/* System status, far right of the header: green = a pool number can take a
   message now, amber = API up but the pool is empty, red = no answer. Grey
   until /health comes back. */
.sysdot {
  width: 9px; height: 9px; flex: none; border-radius: 50%;
  background: var(--text-faint);
  box-shadow: 0 0 0 3px var(--bg-subtle);
}
.sysdot.ok { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sysdot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.sysdot.bad { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

/* ---------- typography ---------- */

h1 { font-size: 34px; line-height: 1.2; letter-spacing: -0.022em; margin: 0 0 12px; }
h2 { font-size: 20px; letter-spacing: -0.015em; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
p { margin: 0 0 14px; }
.lede { font-size: 17px; color: var(--text-muted); max-width: 60ch; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); font-size: 13px; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }

/* ---------- layout ---------- */

section { padding: 40px 0; }
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.grid { display: grid; gap: 18px; }
@media (min-width: 760px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }

/* ---------- controls ---------- */

button, .btn {
  font: inherit;
  font-weight: 550;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}
button:hover, .btn:hover { background: var(--accent-hover); text-decoration: none; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary, .btn.secondary {
  background: var(--bg-subtle);
  color: var(--text);
  border-color: var(--border-strong);
}
button.secondary:hover { background: var(--border); }
button.danger { background: transparent; color: var(--danger); border-color: var(--border-strong); }
button.danger:hover { background: var(--danger-soft); }
button.small, .btn.small { padding: 5px 11px; font-size: 13px; }

input, select, textarea {
  font: inherit;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
label { display: block; font-size: 13px; font-weight: 550; color: var(--text-muted); margin-bottom: 5px; }
fieldset { border: 0; padding: 0; margin: 0; }

.seg { display: inline-flex; background: var(--bg-subtle); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.seg button {
  background: transparent; color: var(--text-muted);
  padding: 6px 14px; font-size: 14px; border-radius: 6px;
}
.seg button[aria-pressed="true"] { background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow); }

/* ---------- pills / badges ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 550;
  background: var(--bg-subtle); color: var(--text-muted);
  border: 1px solid var(--border);
}
.pill.ok { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* ---------- code blocks ---------- */

pre {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 14px;
}
.secret {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  word-break: break-all;
  user-select: all;
}

/* ---------- tables ---------- */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- live demo ---------- */

.code-display {
  font-family: var(--mono);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--accent);
}
.qr {
  display: inline-flex;
  padding: 12px;
  background: #fff;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.qr img, .qr canvas { display: block; }

.status-line {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  font-size: 14px;
}
.status-line.ok { background: var(--accent-soft); color: var(--accent); }
.status-line.bad { background: var(--danger-soft); color: var(--danger); }
.status-line.warn { background: var(--warn-soft); color: var(--warn); }

.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- authenticated profile ---------- */

.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.avatar {
  width: 88px; height: 88px; flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}
/* The initials placeholder, and what stays on screen when WhatsApp has no
   picture for the sender or the bytes never arrived. */
.avatar.empty {
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 600; color: var(--text-faint);
}
.profile-name { font-size: 20px; font-weight: 650; letter-spacing: -0.015em; }

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--bg-subtle);
}
/* Cada painel é uma sanfona: o cabeçalho inteiro é o botão, e o "ver mais" à
   direita diz de longe que ainda há conteúdo ali embaixo. Só a leitura da foto
   e a identidade chegam abertas — o resto o visitante abre se quiser. */
.panel > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  cursor: pointer; list-style: none;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-faint); font-weight: 600;
}
.panel[open] > summary { margin-bottom: 10px; }
.panel-toggle {
  font-size: 12px; line-height: 1.4; white-space: nowrap;
  padding: 2px 10px; border-radius: 999px;
  border: 1px solid var(--border-strong); color: var(--text-muted);
  background: var(--bg-elevated);
}
.panel-toggle::after { content: 'ver mais'; }
.panel[open] .panel-toggle::after { content: 'ver menos'; }
.panel > summary:hover .panel-toggle {
  border-color: var(--accent); color: var(--accent-hover);
}
.panel > summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}
.kv { display: grid; gap: 8px 18px; }
@media (min-width: 620px) { .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kv > div { min-width: 0; }
.kv dt { font-size: 12px; color: var(--text-faint); }
.kv dd {
  margin: 0; font-size: 14px;
  overflow-wrap: anywhere;
}
.kv dd.empty { color: var(--text-faint); }


/* ---------- análise da foto ---------- */

/* A frase que resume o perfil inteiro: é o que se lê primeiro. */
.analysis-summary {
  font-size: 15px; line-height: 1.45; margin-bottom: 12px;
  color: var(--text);
}
.analysis-foot { margin-top: 10px; font-size: 12px; }

/* Quatro sinais 0–1. Barra em vez de número solto, para comparar de relance. */
.signals { display: grid; gap: 6px; margin-top: 12px; }
.signal { display: grid; grid-template-columns: 84px 1fr 38px; align-items: center; gap: 8px; }
.signal-name { font-size: 12px; color: var(--text-faint); }
.signal-track {
  height: 6px; border-radius: 3px; background: var(--border); overflow: hidden;
}
.signal-fill {
  display: block; height: 100%; border-radius: 3px; background: var(--accent);
  transition: width 240ms ease-out;
}
.signal-pct { font-size: 12px; color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }

/* Só as marcas verdadeiras viram chip — um "false" não é informação na tela. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  font-size: 12px; padding: 3px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-hover);
  border: 1px solid transparent;
}

/* O esqueleto enquanto o modelo responde (~2 s). */
.skeleton-lines { display: grid; gap: 8px; margin-top: 10px; }
.skeleton {
  display: block; height: 10px; border-radius: 4px;
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-subtle) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: skeleton-sweep 1.3s ease-in-out infinite;
}
.skeleton.short { width: 55%; }
@keyframes skeleton-sweep {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .signal-fill { transition: none; }
}

/* ---------- misc ---------- */


.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--shadow); z-index: 100;
}
.hidden { display: none !important; }
hr { border: 0; border-top: 1px solid var(--border); margin: 22px 0; }
footer.site { border-top: 1px solid var(--border); padding: 26px 0; color: var(--text-faint); font-size: 13px; }
.empty { padding: 26px; text-align: center; color: var(--text-faint); font-size: 14px; }

/* ---------- landing: sign-in buttons ---------- */

/* Deliberately shaped like the "Sign in with Google" button: white surface,
   hairline border, brand glyph on the left, label centred in what's left. */
.gbtn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 16px;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 550;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.gbtn:hover { background: var(--bg-subtle); box-shadow: var(--shadow); }
.gbtn .gicon { width: 20px; height: 20px; flex: none; color: #25d366; }
.gbtn .gicon svg { display: block; width: 100%; height: 100%; }
/* The 20px margin mirrors the glyph, so the label sits centred in the button. */
.gbtn .glabel { flex: 1; text-align: center; margin-right: 20px; }

.linkish {
  background: transparent; border: 0; padding: 0;
  color: var(--accent); font-size: 13px; font-weight: 550;
}
.linkish:hover { background: transparent; text-decoration: underline; }

/* ---------- landing: the two questions the demo can ask ---------- */

/* "Entrar" and "Criar conta" are the same passive login: the same message, the
   same screen, and only the label differs. */
.pick > * + * { margin-top: 10px; }
.pick-note { margin: 0; font-size: 12px; line-height: 1.45; color: var(--text-faint); }
.gbtn + .gbtn { margin-top: 8px; }


/* Confirming an identity you already hold is not a way in, so it sits outside
   the sign-in card: its own grey surface, a neutral glyph instead of the
   WhatsApp one, and a quiet button — an internal check, never something the end
   user clicks. */
.demo-col { min-width: 0; }
.verify-box {
  display: block;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  padding: 18px;
}
.verify-box > * + * { margin-top: 14px; }
.vb-head { display: flex; gap: 12px; align-items: flex-start; }
.vb-icon {
  width: 30px; height: 30px; flex: none;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
.vb-icon svg { width: 17px; height: 17px; display: block; }
.vb-title { margin: 0 0 4px; font-size: 14px; font-weight: 650; color: var(--text); }
.vb-copy { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-muted); }

/* The phone only appears once the confirmation is asked for. */
#verify-field > * + * { margin-top: 8px; }

.head-row { display: flex; align-items: center; gap: 10px; }
.iconbtn {
  background: transparent; color: var(--text-muted);
  border: 0; padding: 2px 8px; font-size: 17px; line-height: 1; border-radius: 6px;
}
.iconbtn:hover { background: var(--bg-subtle); }

.ticks { list-style: none; margin: 22px 0 0; padding: 0; }
.ticks li {
  color: var(--text-muted); font-size: 14px; padding: 4px 0 4px 24px; position: relative;
}
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
/* Closing the integration section: the guarantees you check off once you are
   actually wiring this up. */
.ticks.specs { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); }

/* ---------- landing: the connect screen ---------- */

/* Wider than the shared grid-2 breakpoint: between 760 and 900 the two columns
   squeeze the demo card until the QR and its alternatives stop fitting on one
   line, and a full-width card reads better than a split one. */
.hero { grid-template-columns: 1fr; }
/* The copy gets the wider half: it is what has to be read, and the card next
   to it only needs room for the QR beside its alternatives. */
@media (min-width: 900px) { .hero { grid-template-columns: 1.12fr 1fr; gap: 28px; } }

/* The whole product in three steps: what the user sends, what you get back,
   and what happens when they come back. The bold line is the step; the rest is
   the detail that makes it concrete. */
.steps { list-style: none; counter-reset: step; margin: 26px 0 0; padding: 0; }
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 36px;
  font-size: 14.5px; line-height: 1.5;
  color: var(--text-muted);
}
.steps li + li { margin-top: 16px; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 1px;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-hover);
  font-size: 12px; font-weight: 700;
}
.steps strong { display: block; color: var(--text); font-weight: 650; }

/* What you don't have to do, one per line. */
/* Indented to the step text above, not to the numbers. */
.nos { list-style: none; margin: 28px 0 0; padding-left: 36px; display: grid; gap: 7px; }
.nos li {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 550; color: var(--text);
}
.nos .no-emoji { width: 20px; text-align: center; font-size: 15px; line-height: 1; }


/* The QR sits beside its alternatives — numbering them read as a sequence of
   steps, when any one of the three on its own gets the message sent. */
.connect { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.alts { flex: 1; min-width: 180px; display: grid; gap: 7px; }
.alt { display: flex; gap: 10px; align-items: center; font-size: 14.5px; }
.alt .aicon {
  width: 28px; height: 28px; flex: none;
  border-radius: 50%; background: var(--bg-subtle); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
.alt .aicon svg { width: 15px; height: 15px; display: block; }
.alt-link { font-weight: 600; }
.or { font-size: 12px; color: var(--text-faint); padding-left: 38px; }

.code-chip {
  font-family: var(--mono); font-weight: 700; letter-spacing: 0.04em;
  color: var(--accent); background: var(--accent-soft);
  padding: 1px 7px; border-radius: 6px;
}

/* The placeholder that holds the QR's spot while the session is being created. */
.qr.loading {
  width: 166px; height: 166px;
  background: var(--bg-subtle);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.55; } }

.demo-key summary { cursor: pointer; list-style: none; }
.demo-key summary::-webkit-details-marker { display: none; }
.demo-key #demo-key { font-size: 12px; word-break: break-all; margin-top: 8px; }

/* ---------- landing: code snippets ---------- */

.snippet { border-top: 1px solid var(--border); padding: 16px 0; }
.snippet:first-of-type { border-top: 0; }
.snippet h3 { margin: 0; }
.snippet .clip { position: relative; max-height: 118px; overflow: hidden; margin-top: 10px; }
.snippet .clip pre:last-child { margin-bottom: 0; }
.snippet .clip::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 46px;
  background: linear-gradient(to bottom, transparent, var(--bg-elevated));
  pointer-events: none;
}
.snippet.open .clip { max-height: none; }
.snippet.open .clip::after { display: none; }
.snippet .more { margin-top: 8px; }

/* ---------- landing: API / AI tabs ---------- */

.tabs {
  display: flex; gap: 4px; margin: 18px 0 20px;
  border-bottom: 1px solid var(--border);
}
.tabs .tab {
  background: none; border: 0; border-bottom: 2px solid transparent;
  border-radius: 0; box-shadow: none;
  padding: 8px 14px; margin-bottom: -1px;
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
}
.tabs .tab:hover { color: var(--text); background: none; }
.tabs .tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.tabpanel > .lede { margin-top: 0; }

/* ---------- landing: LGPD tab ---------- */

/* The picker sits above the text, out of the reading column: it only matters
   when the browser guessed wrong. */
.lgpd-top { display: flex; justify-content: flex-end; margin-bottom: 4px; }
select.lgpd-lang { width: auto; min-width: 150px; padding: 6px 10px; font-size: 13px; }

.lgpd-body { max-width: 68ch; }
.lgpd-body > .lede { margin-top: 0; }
/* A <section> inherits the 40px page-section padding; here it is just a block. */
.lgpd-sec { margin-top: 22px; padding: 0; }
.lgpd-sec h3 { margin-bottom: 6px; }
/* Logical properties throughout, so Arabic and Urdu need no rules of their own. */
.lgpd-sec ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; }
.lgpd-sec li { color: var(--text-muted); }
/* An endpoint or a JSON key stays left-to-right inside a right-to-left line. */
.lgpd-body code { direction: ltr; unicode-bidi: isolate; }
.lgpd-note { margin: 22px 0 0; padding-top: 14px; border-top: 1px solid var(--border); }

/* The prompt is long on purpose: show more of it before clipping, and keep the
   opened state scrollable so the page doesn't stretch by a screenful. */
#ai-snippet .clip { max-height: 240px; }
#ai-snippet.open .clip { max-height: 60vh; overflow: auto; }
#ai-snippet pre { white-space: pre-wrap; word-break: break-word; }
