:root {
  --deep: #061328;
  --blue: #0866FF;
  --sky: #E8F2FF;
  --ice: #F5F7FA;
  --graphite: #27313B;
  --muted: #5B6773;
  --line: #D9E2EE;
  --white: #FFFFFF;
  --alta: #C62828;
  --alta-fundo: #FDECEC;
  --media: #9A5B00;
  --media-fundo: #FFF4DE;
  --fonte: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ice);
  color: var(--graphite);
  font: 16px/1.5 var(--fonte);
  min-height: 100dvh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.topo {
  background: var(--deep);
  color: var(--white);
  padding: calc(14px + env(safe-area-inset-top)) 16px 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 5;
}
.topo-rotulo { font-size: 11px; letter-spacing: .18em; opacity: .65; }
.topo h1 { font-size: 24px; font-weight: 600; line-height: 1.2; }
.botao-texto { background: none; border: 0; color: inherit; opacity: .8; padding: 8px 0 4px 16px; }

.faixa { background: var(--media-fundo); color: var(--media); font-size: 13px; padding: 8px 16px; }

main { padding: 16px; max-width: 720px; margin: 0 auto; display: grid; gap: 12px; }

.cartao {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: grid;
  gap: 6px;
  text-align: left;
  width: 100%;
}
button.cartao:active { background: var(--sky); }
.cartao h3 { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.cartao p { overflow-wrap: anywhere; }
.linha-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.meta { color: var(--muted); font-size: 13px; }
.destaque { background: var(--deep); color: var(--white); border-color: var(--deep); }
.destaque .meta { color: #B8C4D6; }
.destaque p { white-space: pre-line; }

.secao { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }

.selo { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 10px; white-space: nowrap; background: var(--sky); color: var(--blue); }
.selo.alta { background: var(--alta-fundo); color: var(--alta); }
.selo.media { background: var(--media-fundo); color: var(--media); }
.selo.neutro { background: var(--ice); color: var(--muted); }

.lista { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.vazio { color: var(--muted); text-align: center; padding: 32px 8px; }

.campo {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--white);
  font-size: 16px; /* abaixo de 16px o iPhone dá zoom ao focar */
}
.filtros { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.filtro { border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 6px 14px; font-size: 14px; white-space: nowrap; }
.filtro.ativa { background: var(--deep); border-color: var(--deep); color: var(--white); }

.botao { background: var(--blue); color: var(--white); border: 0; border-radius: 12px; padding: 13px 16px; font-weight: 600; width: 100%; }
.botao:disabled { opacity: .6; }
.erro { color: var(--alta); font-size: 14px; }

.abas {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  background: var(--white);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 6;
}
.abas button { flex: 1; background: none; border: 0; padding: 16px 4px; font-size: 14px; color: var(--muted); border-top: 2px solid transparent; }
.abas button.ativa { color: var(--blue); font-weight: 600; border-top-color: var(--blue); }

.folha {
  position: fixed;
  inset: 0;
  background: var(--ice);
  z-index: 10;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
.folha .topo { align-items: center; }
.folha .topo h2 { font-size: 19px; font-weight: 600; overflow-wrap: anywhere; }
.folha .corpo { padding: 16px; max-width: 720px; margin: 0 auto; display: grid; gap: 12px; }
.ficha-texto { white-space: pre-line; }

.conversa { display: grid; gap: 6px; }
.balao { max-width: 85%; padding: 8px 12px; border-radius: 14px; background: var(--white); border: 1px solid var(--line); overflow-wrap: anywhere; white-space: pre-line; justify-self: start; }
.balao.enviada { background: var(--sky); border-color: #C9DEFF; justify-self: end; }
.balao small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }

.entrar { display: grid; gap: 12px; padding-top: 24px; }
.balao strong { display: block; font-size: 12px; color: var(--blue); font-weight: 600; }
.balao .lido { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); font-size: 14px; color: var(--muted); }
