:root {
  --fundo: #0b1020;
  --fundo2: #131a2e;
  --cartao: #182038;
  --borda: #26304d;
  --texto: #f2f4f8;
  --texto2: #a3acc2;
  --alerta: #ff3b3b;
  --alerta-escuro: #d92626;
  --ok: #34c77b;
  --aviso: #ffb020;
  --raio: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* Base para celular (skill mobile-native): sem flash cinza no toque, sem zoom de fonte no modo paisagem,
   sem "puxar para atualizar" brigando com o mapa, controles do sistema no tema escuro */
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  color-scheme: dark;
}
body {
  background: var(--fundo);
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100svh;
  overscroll-behavior: none;
}

/* Controles: toque instantâneo (sem atraso de 300 ms) e sem selecionar o texto ao segurar o dedo */
button, a.btn, .btn-190, .marca, .abas button, .link-btn, label.check {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
a { color: var(--texto); }
[hidden] { display: none !important; }

/* ---------- Topo com 190 ---------- */
.topo {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(11, 16, 32, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--borda);
}
.marca { display: flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; }
.marca i {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--alerta); box-shadow: 0 0 0 4px rgba(255, 59, 59, .25);
}
.btn-190 {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--alerta); color: #fff; text-decoration: none;
  font-weight: 800; padding: 0 16px; min-height: 44px; border-radius: 10px; font-size: 1rem;
  transition: transform 100ms ease-out;
}
.btn-190:active { transform: scale(.95); }

/* ---------- Layout ---------- */
.pagina {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px max(16px, env(safe-area-inset-right)) calc(48px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left));
}
h1 { font-size: 1.35rem; line-height: 1.25; margin-bottom: 8px; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin-bottom: 8px; }
p { color: var(--texto2); margin-bottom: 14px; }
p.forte { color: var(--texto); }
.passo { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--alerta); margin-bottom: 6px; }

.cartao {
  background: var(--cartao);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 16px;
  margin-bottom: 14px;
}

/* ---------- Formulário ---------- */
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=tel], input[type=password], input[type=number], select {
  width: 100%;
  font: inherit;
  color: var(--texto);
  background: var(--fundo2);
  border: 1px solid var(--borda);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 48px;
}
input, select, textarea { font-size: max(16px, 1em); }
input:focus, select:focus { outline: 2px solid var(--alerta); outline-offset: 1px; }
.dica { font-size: .88rem; color: var(--texto2); margin-top: 6px; }
.linha { display: flex; gap: 10px; }
.linha > * { flex: 1; }
.linha > .estreito { flex: 0 0 34%; }

.pin {
  letter-spacing: .5em;
  text-align: center;
  font-size: 1.4rem !important;
  font-variant-numeric: tabular-nums;
}

.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.check input { width: 24px; height: 24px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--alerta); }

/* ---------- Botões ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  min-height: 50px;
  margin-top: 16px;
  font: inherit; font-weight: 700;
  color: #fff;
  background: var(--alerta);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 100ms ease-out, filter 100ms ease-out;
}
.btn:active { transform: scale(.97); filter: brightness(.9); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn.secundario { background: transparent; border: 1px solid var(--borda); color: var(--texto); }
.btn.verde { background: var(--ok); color: #062814; }
.btn.pequeno { width: auto; min-height: 44px; margin-top: 0; padding: 0 14px; font-size: .92rem; }
.link-btn { display: block; min-height: 44px; background: none; border: 0; color: var(--texto2); font: inherit; text-decoration: underline; cursor: pointer; padding: 12px 0; }
.link-btn:active { color: var(--texto); }

/* ---------- Avisos ---------- */
.msg { border-radius: 12px; padding: 12px 14px; margin-top: 14px; font-size: .95rem; }
.msg.erro { background: rgba(255, 59, 59, .12); border: 1px solid rgba(255, 59, 59, .4); color: #ffb3b3; }
.msg.ok { background: rgba(52, 199, 123, .12); border: 1px solid rgba(52, 199, 123, .4); color: #a8f0c8; }
.msg.info { background: rgba(255, 176, 32, .1); border: 1px solid rgba(255, 176, 32, .35); color: #ffd98a; }

.regras { list-style: none; counter-reset: r; }
.regras li { counter-increment: r; position: relative; padding: 12px 0 12px 44px; border-bottom: 1px solid var(--borda); color: var(--texto); }
.regras li:last-child { border-bottom: 0; }
.regras li::before {
  content: counter(r);
  position: absolute; left: 0; top: 12px;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--alerta); color: #fff; font-weight: 800; font-size: .9rem;
}
.regras small { display: block; color: var(--texto2); font-size: .88rem; margin-top: 2px; }

/* ---------- Mapa ---------- */
.mapa { height: 320px; border-radius: var(--raio); overflow: hidden; border: 1px solid var(--borda); margin-top: 10px; background: var(--fundo2); }
.mapa.grande { height: 52svh; min-height: 300px; }
.leaflet-container { font: inherit; }
/* botões de zoom do mapa do tamanho do dedo */
.leaflet-touch .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; font-size: 22px; }
.pino-casa {
  font-size: 30px; line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .5));
}

/* ---------- Tabelas do admin ---------- */
.abas { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 4px; }
.abas button {
  flex: 0 0 auto;
  font: inherit; font-size: .95rem; font-weight: 600;
  color: var(--texto2); background: var(--fundo2);
  border: 1px solid var(--borda); border-radius: 99px;
  padding: 8px 14px; cursor: pointer;
}
.abas { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scrollbar-width: none; }
.abas button { min-height: 44px; transition: transform 100ms ease-out; }
.abas button:active { transform: scale(.96); }
.abas button.ativa { color: #fff; background: var(--alerta); border-color: var(--alerta); }
.selo { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--fundo2); border: 1px solid var(--borda); color: var(--texto2); vertical-align: middle; }
.selo.ativo { color: var(--ok); border-color: rgba(52, 199, 123, .5); }
.selo.pendente, .selo.verificando { color: var(--aviso); border-color: rgba(255, 176, 32, .5); }
.selo.suspenso, .selo.bloqueado { color: var(--alerta); border-color: rgba(255, 59, 59, .5); }
.acoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.codigo-grande { font-size: 1.6rem; font-weight: 800; letter-spacing: .2em; font-variant-numeric: tabular-nums; }
.vazio { text-align: center; color: var(--texto2); padding: 28px 0; }
.mini { font-size: .85rem; color: var(--texto2); }

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

/* ---------- Números do painel ---------- */
.numeros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.numero { background: var(--cartao); border: 1px solid var(--borda); border-radius: 12px; padding: 12px 8px; text-align: center; }
.numero strong { display: block; font-size: 1.5rem; line-height: 1.1; }
.numero span { font-size: .78rem; color: var(--texto2); }

/* =====================================================================
   App (tela principal) · pensado para celular
   ===================================================================== */
body.app { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.app .pagina { padding-top: 12px; }

/* barra de abas embaixo, como app nativo */
.abas-baixo {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: end;
  background: rgba(11, 16, 32, .97); backdrop-filter: blur(8px);
  border-top: 1px solid var(--borda);
  padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left));
}
.abas-baixo button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 52px; background: none; border: 0; color: var(--texto2);
  font: inherit; font-size: .78rem; font-weight: 600; border-radius: 10px;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.abas-baixo button span { font-size: 1.2rem; line-height: 1; }
/* Reportar: botão central destacado, encaixado na barra (não cobre o conteúdo) */
.abas-baixo .reportar { color: var(--texto); padding: 0 18px; gap: 4px; min-height: 0; }
.abas-baixo .reportar .circulo {
  display: grid; place-items: center;
  width: 62px; height: 62px; margin-top: -30px; border-radius: 50%;
  font-size: 1.6rem; background: var(--alerta);
  border: 4px solid var(--fundo);
  box-shadow: 0 6px 18px rgba(255, 59, 59, .45);
}
.abas-baixo .reportar:active .circulo { transform: scale(.94); }
.abas-baixo button.ativa { color: var(--texto); background: var(--fundo2); }
.abas-baixo .reportar.ativa { background: none; }
.abas-baixo button:active { transform: scale(.95); }

/* botão Reportar flutuante */
.fab {
  position: fixed; z-index: 1050;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 60px; padding: 0 24px;
  font: inherit; font-size: 1.1rem; font-weight: 800; color: #fff;
  background: var(--alerta); border: 0; border-radius: 99px;
  box-shadow: 0 8px 24px rgba(255, 59, 59, .45), 0 2px 6px rgba(0, 0, 0, .4);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: transform 100ms ease-out;
}
.fab:active { transform: scale(.95); }

.mapa.tempo { height: 52svh; min-height: 260px; margin-top: 0; }

/* ---------- pino de alerta tipo radar ---------- */
.radar-pino { position: relative; width: 44px; height: 44px; }
.radar-pino span {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--alerta); opacity: 0;
  animation: pulso-radar 2s ease-out infinite;
}
.radar-pino span + span { animation-delay: 1s; }
.radar-pino i {
  position: absolute; top: 50%; left: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px;
  display: grid; place-items: center; font-style: normal; font-size: 14px;
  border-radius: 50%; background: var(--alerta); box-shadow: 0 0 14px rgba(255, 59, 59, .9);
  border: 2px solid #fff;
}
.radar-pino.medio span { animation-duration: 3s; }
.radar-pino.antigo span { display: none; }
.radar-pino.antigo i { background: #b03a3a; box-shadow: none; opacity: .8; }
@keyframes pulso-radar {
  0% { transform: scale(.35); opacity: .95; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ---------- lista de alertas ---------- */
.lista-alertas { margin-top: 14px; }
.item-alerta {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left;
  background: var(--cartao); border: 1px solid var(--borda); border-radius: var(--raio);
  padding: 14px; margin-bottom: 10px; color: var(--texto); font: inherit;
  touch-action: manipulation;
}
.item-alerta:active { transform: scale(.99); }
.item-alerta .ico { font-size: 1.6rem; line-height: 1; flex: 0 0 auto; }
.item-alerta strong { display: block; font-size: 1rem; }
.item-alerta .mini { margin-top: 2px; }
.item-alerta.novo { border-color: rgba(255, 59, 59, .6); }
.sem-alertas { text-align: center; padding: 24px 12px; color: var(--texto2); }

/* ---------- folhas (bottom sheet em tela cheia) ---------- */
.folha {
  position: fixed; inset: 0; z-index: 2000;
  background: var(--fundo);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 0 max(16px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left));
  animation: subir 180ms ease-out;
}
@keyframes subir { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.folha-topo {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 calc(-1 * max(16px, env(safe-area-inset-right))) 12px calc(-1 * max(16px, env(safe-area-inset-left)));
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: rgba(11, 16, 32, .96); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--borda);
}
.fechar {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--borda);
  background: var(--fundo2); color: var(--texto); font-size: 1.2rem; touch-action: manipulation;
}
.fechar:active { transform: scale(.94); }
.folha .conteudo { max-width: 520px; margin: 0 auto; }

.opcoes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opcoes.uma { grid-template-columns: 1fr; }
.opcao {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px;
  min-height: 96px; padding: 14px; text-align: left;
  background: var(--cartao); border: 2px solid var(--borda); border-radius: var(--raio);
  color: var(--texto); font: inherit; font-weight: 700; font-size: .98rem; line-height: 1.25;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.opcao span { font-size: 1.8rem; line-height: 1; }
.opcao small { font-weight: 400; color: var(--texto2); font-size: .85rem; }
.opcao:active { transform: scale(.97); }
.opcao.marcada { border-color: var(--alerta); background: rgba(255, 59, 59, .1); }
.opcoes.uma .opcao { min-height: 72px; flex-direction: row; align-items: center; gap: 14px; }

textarea {
  width: 100%; min-height: 110px; resize: vertical;
  font: inherit; font-size: max(16px, 1em); color: var(--texto);
  background: var(--fundo2); border: 1px solid var(--borda); border-radius: 12px; padding: 14px;
}
textarea:focus { outline: 2px solid var(--alerta); outline-offset: 1px; }
.contador { text-align: right; font-size: .8rem; color: var(--texto2); margin-top: 4px; }

/* reações */
.reacoes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.reacao {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  min-height: 52px; padding: 0 12px;
  background: var(--fundo2); border: 1px solid var(--borda); border-radius: 12px;
  color: var(--texto); font: inherit; font-size: .9rem; font-weight: 600; text-align: left;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.reacao b { font-variant-numeric: tabular-nums; color: var(--texto2); }
.reacao.marcada { border-color: var(--alerta); background: rgba(255, 59, 59, .12); }
.reacao.marcada b { color: var(--texto); }
.reacao:active { transform: scale(.97); }

.galeria { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.galeria img, .galeria video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: #000; display: block; }
.galeria .processando { aspect-ratio: 1; border-radius: 12px; background: var(--fundo2); display: grid; place-items: center; color: var(--texto2); font-size: .85rem; text-align: center; padding: 8px; }
.midia-item { position: relative; }
.midia-item button { position: absolute; top: 6px; right: 6px; min-height: 32px; padding: 0 10px; border-radius: 99px; border: 0; background: rgba(0,0,0,.6); color: #fff; font: inherit; font-size: .75rem; }

.mapa.mini { height: 180px; margin-top: 10px; }

/* faixa de instalação / avisos */
.faixa-acao { display: flex; gap: 12px; align-items: center; }
.faixa-acao .texto { flex: 1; }
.faixa-acao .texto strong { display: block; }
.passos-ios { list-style: none; counter-reset: p; margin-top: 8px; }
.passos-ios li { counter-increment: p; position: relative; padding: 12px 0 12px 44px; border-bottom: 1px solid var(--borda); color: var(--texto); }
.passos-ios li:last-child { border-bottom: 0; }
.passos-ios li::before {
  content: counter(p); position: absolute; left: 0; top: 10px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--fundo2); border: 1px solid var(--borda); font-weight: 800;
}
.ico-compartilhar { display: inline-block; vertical-align: -4px; width: 20px; height: 20px; }

/* histórico */
.segmento { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--fundo2); border: 1px solid var(--borda); border-radius: 12px; padding: 4px; }
.segmento button { min-height: 44px; border: 0; border-radius: 9px; background: none; color: var(--texto2); font: inherit; font-weight: 700; touch-action: manipulation; }
.segmento button.ativa { background: var(--alerta); color: #fff; }
.ranking-item { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--borda); }
.ranking-item:last-child { border-bottom: 0; }
.ranking-item strong { font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: .82rem; padding: 4px 10px; border-radius: 99px; background: var(--fundo2); border: 1px solid var(--borda); color: var(--texto2); }

.interruptor { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; font-weight: 600; margin: 0; }
.interruptor input { width: 52px; height: 30px; accent-color: var(--alerta); }

.toast {
  position: fixed; left: 50%; z-index: 3000; transform: translateX(-50%);
  bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: #fff; color: #0b1020; font-weight: 700; font-size: .95rem; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: subir 160ms ease-out;
}

/* radar grande da tela de entrada */
.radar-grande { position: relative; width: 110px; height: 110px; margin: 12px auto 18px; }
.radar-grande span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--alerta); opacity: 0; animation: pulso-radar 2.4s ease-out infinite; }
.radar-grande span:nth-child(2) { animation-delay: .8s; }
.radar-grande span:nth-child(3) { animation-delay: 1.6s; }
.radar-grande i { position: absolute; top: 50%; left: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: var(--alerta); box-shadow: 0 0 24px var(--alerta); }
.selo-verif { display: inline-block; font-size: .72rem; font-weight: 800; padding: 1px 7px; border-radius: 99px; vertical-align: middle; background: rgba(52, 199, 123, .15); color: var(--ok); border: 1px solid rgba(52, 199, 123, .45); }
.selo-nao-verif { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; vertical-align: middle; background: var(--fundo2); color: var(--texto2); border: 1px solid var(--borda); }
.trancado { text-align: center; padding: 18px 12px; border: 1px dashed var(--borda); border-radius: 12px; color: var(--texto2); margin-top: 10px; }

/* topo: ⚙️ ao lado do 190 */
.topo-acoes { display: flex; align-items: center; gap: 8px; }
.btn-icone {
  width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--borda);
  background: var(--fundo2); color: var(--texto); font-size: 1.1rem;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn-icone:active { transform: scale(.94); }
.btn-icone.ativa { border-color: var(--alerta); }

/* faixa discreta de ativar avisos */
.faixa-aviso {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 12px; margin-bottom: 10px;
  background: var(--cartao); border: 1px solid var(--borda); border-radius: 12px;
  font-size: .88rem; color: var(--texto2);
}
.faixa-aviso span { flex: 1; }
.faixa-aviso .btn.pequeno { min-height: 36px; padding: 0 12px; font-size: .85rem; }
.fechar-mini { width: 32px; height: 32px; border: 0; background: none; color: var(--texto2); font-size: .95rem; touch-action: manipulation; }
.item-alerta { padding: 12px; }
.item-alerta .ico { font-size: 1.4rem; }
.item-alerta strong { font-size: .95rem; }
.opcao { min-height: 84px; font-size: .92rem; }
.opcao span { font-size: 1.6rem; }

.item-alerta .mini { display: block; }
/* histórico: grupos de alertas no mapa (número = quantos alertas ali) */
.grupo-alertas {
  display: grid; place-items: center; border-radius: 50%;
  background: rgba(255, 59, 59, .92); color: #fff; font-weight: 800; font-size: .9rem;
  border: 3px solid rgba(255, 255, 255, .9); box-shadow: 0 0 0 6px rgba(255, 59, 59, .25);
}
.pino-hist { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--alerta); border: 2px solid #fff; font-size: 14px; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.leaflet-popup-content { font: inherit; font-size: .9rem; line-height: 1.4; margin: 12px 14px; color: #0b1020; }
.leaflet-popup-content strong { display: block; font-size: .95rem; margin-bottom: 2px; }
.popup-abrir { display: block; width: 100%; margin-top: 8px; min-height: 38px; border: 0; border-radius: 8px; background: var(--alerta); color: #fff; font: inherit; font-weight: 700; touch-action: manipulation; }
.leaflet-popup-content .data { color: #555; font-size: .82rem; }

/* janela central (instalar o app) */
.modal-fundo {
  position: fixed; inset: 0; z-index: 2500;
  display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px);
  animation: subir 180ms ease-out;
}
.modal {
  width: 100%; max-width: 360px; text-align: center;
  background: var(--cartao); border: 1px solid var(--borda); border-radius: 18px;
  padding: 22px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
}
.modal-icone { border-radius: 16px; margin-bottom: 10px; }
.modal .btn { margin-top: 10px; }

/* histórico: 4 filtros numa linha só */
.filtros-hist { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.filtros-hist button, .filtros-hist select {
  min-height: 40px; min-width: 0; padding: 0 8px;
  font: inherit; font-size: .85rem; font-weight: 700; text-align: center;
  color: var(--texto2); background: var(--fundo2);
  border: 1px solid var(--borda); border-radius: 10px;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.filtros-hist select {
  -webkit-appearance: none; appearance: none; text-align-last: center;
  padding-right: 18px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23a3acc2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center;
}
@media (pointer: coarse) { .filtros-hist select { font-size: 16px; } } /* iPhone não dá zoom em campo com 16px */
.filtros-hist .ativa { color: #fff; background: var(--alerta); border-color: var(--alerta); }
.filtros-hist button:active { transform: scale(.96); }
