/* Base das páginas da anamnese: marca pessoal (tokens.css) mais os componentes usados no celular, no telão e no painel. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; corner-shape: squircle; }
:root { --h-controle: 52px; --h-apoio: 40px; --largura: 600px; }

html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-wrap: break-word; min-height: 100vh;
}
:focus-visible { outline: 2px solid var(--accent-label); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
a { color: var(--accent-label); }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.skip { position: absolute; left: 16px; top: -64px; background: var(--bg); color: var(--text); padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-s); z-index: 20; }
.skip:focus-visible { top: 8px; }
.so-leitor { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.wrap { max-width: var(--largura); margin: 0 auto; padding: 0 16px; }
.wrap.larga { max-width: 880px; }
.wrap.cheia { max-width: 1280px; }

/* Barra do topo: marca e tema */
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 20px 0 0; }
.wordmark { font-size: 15px; line-height: 1; letter-spacing: var(--tracking-display); }
.wordmark .joao { font-family: var(--font-display); font-weight: 700; }
.wordmark .roque { font-weight: 600; letter-spacing: var(--tracking-roque); }
.wordmark .ponto { color: var(--accent); font-weight: 600; }

/* Botões segmentados */
.seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); }
.seg button { font-size: 13px; font-weight: 500; min-height: 32px; padding: 0 12px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--text-2); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); }
.seg.grande { display: flex; width: 100%; }
.seg.grande button { flex: 1; min-height: 44px; font-size: 15px; }

/* Tipografia */
.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
h1 { font-family: var(--font-display); font-weight: 900; font-size: clamp(26px, 6.4vw, 40px); line-height: 1.15; letter-spacing: -.01em; margin: 8px 0 12px; }
h2 { font-family: var(--font-display); font-weight: 900; font-size: clamp(20px, 4.6vw, 28px); line-height: 1.2; margin-bottom: 8px; }
h3 { font-size: 17px; line-height: 1.3; font-weight: 700; }
.sub { color: var(--text-2); font-size: 15px; margin-bottom: 16px; }
.pequeno { font-size: 13.5px; color: var(--text-2); }

/* Botões de ação */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--h-controle); padding: 0 24px; border: 1px solid transparent; border-radius: var(--radius-m); background: var(--accent-label); color: var(--bg); font-weight: 500; font-size: 16px; text-decoration: none; transition: background var(--dur-micro) var(--ease-out); }
.btn:hover { filter: brightness(.9); }
.btn.sec { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.sec:hover { background: var(--bg-alt); }
.btn.cheio { width: 100%; }
.btn.peq { min-height: 40px; padding: 0 16px; font-size: 14px; border-radius: var(--radius-s); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

/* Campos: rótulo, controle, apoio e erro, nesta ordem. A faixa de apoio tem altura reservada, com ou sem texto. */
.linha { display: grid; grid-template-columns: 1fr; gap: 0 16px; align-items: start; }
@media (min-width: 640px) { .linha.duas { grid-template-columns: 1fr 1fr; } }
.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rotulo { font-weight: 500; font-size: 15px; min-height: 1.5em; }
.apoio { min-height: var(--h-apoio); font-size: 13px; line-height: 1.45; color: var(--text-2); }
.apoio.erro { color: var(--accent-label); font-weight: 500; }
.campo input[type="text"], .campo input[type="password"], .campo input[type="search"], .campo input[type="date"], .campo input[type="number"], .campo textarea {
  width: 100%; min-height: var(--h-controle); padding: 12px 14px; font: inherit; font-size: 16px; line-height: 1.5;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
}
.campo textarea { resize: vertical; min-height: 140px; }
.campo input:focus-visible, .campo textarea:focus-visible { border-color: var(--accent-label); outline: 1px solid var(--accent-label); outline-offset: 0; }
::placeholder { color: var(--muted); opacity: 1; }

/* Escolhas: botões grandes e chips */
.opcoes { display: grid; gap: 8px; grid-template-columns: 1fr; }
.opcoes.duas { grid-template-columns: 1fr 1fr; }
.opcoes.tres { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 420px) { .opcoes.tres { grid-template-columns: 1fr; } .opcoes.duas.empilha { grid-template-columns: 1fr; } }
.opc { display: flex; align-items: center; justify-content: flex-start; text-align: left; gap: 10px; min-height: var(--h-controle); padding: 10px 16px; line-height: 1.35; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); color: var(--text); }
.opc:hover { background: var(--bg-alt); }
.opc[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-label); box-shadow: inset 0 0 0 1px var(--accent-label); font-weight: 500; }
.opc::before { content: ""; flex: none; width: 18px; height: 18px; border: 1.5px solid var(--muted); border-radius: var(--radius-pill); background: transparent; }
.opc[aria-pressed="true"]::before { border-color: var(--accent-label); background: radial-gradient(circle, var(--accent-label) 0 45%, transparent 50%); }
.opcoes.multi .opc::before { border-radius: 0; }
.opcoes.multi .opc[aria-pressed="true"]::before { background: var(--accent-label); box-shadow: inset 0 0 0 3px var(--surface); }
.opc.curta { min-height: 44px; padding: 6px 12px; font-size: 14.5px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.chip { min-height: 44px; padding: 0 16px; font-size: 15px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill); color: var(--text); }
.chip:hover { background: var(--bg-alt); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-label); box-shadow: inset 0 0 0 1px var(--accent-label); font-weight: 500; }

/* Blocos de conteúdo */
.cartao { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.cartao + .cartao { margin-top: 14px; }
.box { padding: 12px 14px; background: var(--bg-alt); border-radius: var(--radius-s); font-size: 14.5px; }
.codigo { font-family: var(--font-mono); font-size: 15px; overflow-wrap: anywhere; user-select: all; }
.frase-copia { font-size: 15.5px; line-height: 1.55; overflow-wrap: anywhere; user-select: all; }
.lbl { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); margin-bottom: 2px; }
.tag { align-self: flex-start; display: inline-block; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; padding: 3px 10px; border-radius: var(--radius-pill); border: 1px solid var(--accent-label); color: var(--accent-label); }
.tag.parte { background: var(--accent-soft); color: var(--text); border-color: transparent; }
.aviso { padding: 12px 14px; border: 1px solid var(--accent-label); background: var(--accent-soft); border-radius: var(--radius-s); font-size: 14.5px; }
.aviso ul { margin: 6px 0 0 18px; }
.aviso:focus { outline: none; }

.pilha > * + * { margin-top: 20px; }
.pilha.curta > * + * { margin-top: 12px; }

footer.rodape { margin-top: 44px; padding: 24px 0 48px; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
footer.rodape p + p { margin-top: 8px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Questionário do celular */
.voz-linha { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.progresso { padding: 20px 0 4px; }
.progresso .trilho { height: 6px; margin-top: 8px; background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius-pill); overflow: hidden; }
.progresso .preenche { height: 100%; width: var(--avanco, 0%); background: var(--accent); transition: width var(--dur-micro) var(--ease-out); }
.tela { padding: 12px 0 24px; }
.acoes { position: sticky; bottom: 0; display: flex; gap: 12px; padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); margin-top: 24px; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.acoes .btn:last-child { flex: 1; }
.aceite { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.aceite input { flex: none; width: 24px; height: 24px; margin-top: 2px; accent-color: var(--accent); }
.item-b { display: grid; gap: 10px; }
.item-b h3 { font-size: 16px; }
.contador { position: sticky; top: 0; z-index: 2; padding: 8px 0; background: var(--bg); }
.frases { display: grid; gap: 8px; list-style: none; }
.frase { width: 100%; text-align: left; padding: 12px 14px; line-height: 1.5; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); color: var(--text); }
.frase:hover { background: var(--bg-alt); }
.frase[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-label); box-shadow: inset 0 0 0 1px var(--accent-label); }
.frase .marca { display: none; margin-top: 6px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-label); }
.frase[aria-pressed="true"] .marca { display: block; }
.passos { list-style: none; counter-reset: passo; display: grid; gap: 10px; }
.passos li { counter-increment: passo; display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.passos li::before { content: counter(passo); font-family: var(--font-mono); font-size: 13px; color: var(--accent-label); border: 1px solid var(--accent-label); border-radius: var(--radius-pill); width: 28px; height: 28px; display: grid; place-items: center; }
details.ajuda { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 14px; background: var(--surface); }
details.ajuda summary { cursor: pointer; font-weight: 500; font-size: 15px; }
details.ajuda ul { margin: 10px 0 0 18px; font-size: 14.5px; color: var(--text-2); }
.conteudo { padding: 24px 0 64px; }
