:root {
  --fundo: #f5f6f8;
  --cartao: #ffffff;
  --texto: #1a1d23;
  --suave: #5f6673;
  --fraco: #8b919c;
  --linha: #e3e6eb;
  --marca: #1f3864;
  --marca-texto: #ffffff;
  --botao: #1f3864;
  --link: #1a4f8a;
  --roxo: #6a1b9a;
  --roxo-fundo: #f3e5f5;
  --verde: #137333;
  --verde-fundo: #e6f4ea;
  --ouro: #c9a227;
  --ouro-fundo: #fbf9f2;
  --sombra: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --raio: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #0e1218;
    --cartao: #171c24;
    --texto: #e8eaee;
    --suave: #a5acb8;
    --fraco: #7d8491;
    --linha: #283040;
    --marca: #0d1726;
    --botao: #2f5597;
    --link: #8ab4f8;
    --roxo: #ce93d8;
    --roxo-fundo: #2a1a30;
    --verde: #81c995;
    --verde-fundo: #13261a;
    --ouro: #d9b84a;
    --ouro-fundo: #221e12;
    --sombra: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--link); }
button { font: inherit; color: inherit; }

/* ------------------------------------------------------------ topo */
.topo {
  position: sticky; top: 0; z-index: 10;
  background: var(--marca); color: var(--marca-texto);
  padding: calc(env(safe-area-inset-top) + 8px) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
}
.topo-linha { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.marca { flex: 1; min-width: 0; }
.marca-t { font-weight: 700; font-size: 19px; letter-spacing: -.01em; }
.marca-s { font-size: 12.5px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icone-btn, .voltar {
  border: 0; background: rgba(255,255,255,.12); color: #fff; border-radius: 10px;
  width: 40px; height: 40px; font-size: 20px; cursor: pointer; flex: none;
}
.voltar { font-size: 30px; line-height: 1; padding-bottom: 4px; }
.icone-btn.girando-btn { animation: gira 1s linear infinite; }
.busca { margin-top: 8px; }
.busca input {
  width: 100%; border: 0; border-radius: 10px; padding: 10px 12px;
  font-size: 16px; /* 16px: abaixo disso o iPhone dá zoom ao tocar */
  background: rgba(255,255,255,.95); color: #1a1d23;
}

main { padding: 12px max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left)); max-width: 760px; margin: 0 auto; }

/* ------------------------------------------------------------ filtros */
.filtros { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--linha); background: var(--cartao); color: var(--texto);
  border-radius: 999px; padding: 7px 12px; font-size: 14px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip .n { color: var(--fraco); font-size: 12px; }
.chip.on { background: var(--texto); color: var(--fundo); border-color: var(--texto); }
.chip.on .n { color: inherit; opacity: .7; }
.ponto { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.resumo-lista { font-size: 13px; color: var(--suave); margin: 2px 2px 10px; }

/* ------------------------------------------------------------ lista */
.grupo-titulo {
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--suave); margin: 18px 4px 8px;
}
.item {
  display: block; text-decoration: none; color: inherit; background: var(--cartao);
  border-radius: var(--raio); box-shadow: var(--sombra); margin-bottom: 10px;
  border-left: 6px solid var(--marca); padding: 12px 14px;
}
.item:active { opacity: .7; }
.item .linha1 { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--suave); }
.item .num { font-weight: 700; color: var(--texto); }
.item .titulo { font-weight: 650; font-size: 16.5px; line-height: 1.3; margin: 4px 0 4px; }
.item .situ { font-size: 13px; color: var(--suave); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag {
  display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
  border: 1px solid var(--linha); color: var(--suave); background: transparent; white-space: nowrap;
}
.tag.part { color: var(--roxo); border-color: var(--roxo); }
.tag.part.rel { background: var(--roxo-fundo); }
.tag.norma { color: var(--verde); border-color: var(--verde); background: var(--verde-fundo); }
.tag.camara { color: var(--verde); border-color: transparent; background: var(--verde-fundo); }
.vazio { text-align: center; color: var(--suave); padding: 40px 10px; }

/* ------------------------------------------------------------ detalhe */
.pbar {
  background: var(--cartao); border-radius: var(--raio); box-shadow: var(--sombra);
  border-left: 8px solid var(--marca); padding: 12px 14px; margin-bottom: 12px;
}
.pbar .pb1 { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pbar .pbgrupo { font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; width: 100%; }
.pbar .pb2 { margin-top: 8px; }
.pbar .pbnum { font-weight: 700; color: var(--suave); font-size: 14px; }
.pbar h1 { font-size: 22px; line-height: 1.25; margin: 2px 0 0; letter-spacing: -.01em; }
.subtitulo { font-style: italic; color: var(--suave); margin: 8px 0 0; font-size: 15px; }
.data-apr { font-size: 13px; color: var(--fraco); margin-top: 6px; }
.foto { width: 100%; border-radius: var(--raio); display: block; margin: 0 0 4px; max-height: 260px; object-fit: cover; }
.credito { font-size: 11px; color: var(--fraco); }

.acoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 0 0 12px; }
.acao {
  display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center;
  background: var(--cartao); border: 1px solid var(--linha); border-radius: 12px; padding: 11px 10px;
  color: var(--link); text-decoration: none; font-weight: 600; font-size: 14.5px; cursor: pointer;
}
.acao.principal { background: var(--botao); color: #fff; border-color: var(--botao); }
.figura { margin: 0 0 12px; }

.secao { background: var(--cartao); border-radius: var(--raio); box-shadow: var(--sombra); padding: 14px; margin-bottom: 12px; }
.secao h2 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--fraco); margin: 0 0 6px; font-weight: 700; }
.secao p { margin: 0 0 4px; }
.secao + .secao { margin-top: 0; }
.bloco + .bloco { margin-top: 14px; }
.destaque { background: var(--ouro-fundo); border-left: 4px solid var(--ouro); }
.norma { background: var(--verde-fundo); color: var(--verde); font-weight: 700; border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }

.ficha { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.ficha td { padding: 6px 0; vertical-align: top; border-top: 1px solid var(--linha); }
.ficha tr:first-child td { border-top: 0; }
.ficha td:first-child { color: var(--fraco); width: 38%; padding-right: 10px; }

.linha-tempo { list-style: none; margin: 0; padding: 0; }
.linha-tempo li { position: relative; padding: 0 0 12px 18px; font-size: 14px; }
.linha-tempo li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--marca); }
.linha-tempo li::after { content: ""; position: absolute; left: 7px; top: 16px; bottom: 0; width: 1px; background: var(--linha); }
.linha-tempo li:last-child::after { display: none; }
.linha-tempo .q { font-size: 12.5px; color: var(--fraco); }
.ao-vivo { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--verde); font-weight: 600; text-transform: none; letter-spacing: 0; }
.ao-vivo::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.erro { color: #b3261e; font-size: 14px; }
.mais { background: none; border: 0; color: var(--link); padding: 6px 0 0; cursor: pointer; font-weight: 600; }

.rodape { text-align: center; font-size: 12px; color: var(--fraco); margin: 24px 0 8px; line-height: 1.6; }

/* ------------------------------------------------------------ estados */
.carregando { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 60px 0; color: var(--suave); }
.girando { width: 28px; height: 28px; border: 3px solid var(--linha); border-top-color: var(--marca); border-radius: 50%; animation: gira .8s linear infinite; }
.mini-girando { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--linha); border-top-color: var(--suave); border-radius: 50%; animation: gira .8s linear infinite; vertical-align: -2px; }
@keyframes gira { to { transform: rotate(360deg); } }
.offline { background: #fff4e5; color: #8a5300; border-radius: 10px; padding: 8px 12px; font-size: 13px; margin-bottom: 10px; }
@media (prefers-color-scheme: dark) { .offline { background: #2b2111; color: #f0c674; } .erro { color: #f28b82; } }

.aviso-instalar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 20;
  background: var(--texto); color: var(--fundo); border-radius: 14px; padding: 12px 40px 12px 14px; font-size: 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.aviso-instalar button { position: absolute; right: 8px; top: 8px; border: 0; background: none; color: inherit; font-size: 16px; cursor: pointer; }
