/* Ailuros — uma coluna, letra mínima de 16 px, alvos de toque de 48 px. */
:root {
  --fundo: #fbf7f2;
  --cartao: #ffffff;
  --texto: #2a2320;
  --suave: #665a53;
  --linha: #e7dcd2;
  --acento: #a9471f;
  --acento-texto: #ffffff;
  --acento-claro: #f6e6da;
  --foco: #1f5fa8;
  --ok: #276140; --ok-fundo: #e2f1e7;
  --azul: #22598a; --azul-fundo: #e1ecf6;
  --roxo: #644590; --roxo-fundo: #eee7f7;
  --cinza: #45413f; --cinza-fundo: #ebe8e6;
  --ambar: #7c5200; --ambar-fundo: #faedd2;
  --ardosia: #38535f; --ardosia-fundo: #e2eaee;
  --erro: #a3241b; --erro-fundo: #fbe4e1;
  --raio: 14px;
  --sombra: 0 1px 2px rgba(60, 35, 20, .08), 0 2px 10px rgba(60, 35, 20, .05);
  --nav: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #1b1614; --cartao: #261f1b; --texto: #f3ece6; --suave: #bcaea4; --linha: #3b302a;
    --acento: #e98a5f; --acento-texto: #1b1614; --acento-claro: #3c2a20; --foco: #8fc0ff;
    --ok: #8fd3a6; --ok-fundo: #1f3427; --azul: #9cc6ef; --azul-fundo: #1d2c3b;
    --roxo: #c9b2ee; --roxo-fundo: #2c2339; --cinza: #d6d1ce; --cinza-fundo: #34302e;
    --ambar: #f0c66e; --ambar-fundo: #3a2e15; --ardosia: #a9c4d1; --ardosia-fundo: #23313a;
    --erro: #ff9f95; --erro-fundo: #3d1f1c;
    --sombra: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  padding-bottom: calc(var(--nav) + env(safe-area-inset-bottom));
}
img { max-width: 100%; }
a { color: var(--acento); }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; margin-top: 1.4em; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
.pular { position: absolute; left: -999px; top: 0; }
.pular:focus { left: 8px; top: 8px; background: var(--cartao); padding: 8px 12px; z-index: 50; }

/* Topo e navegação */
.topo {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px; padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--fundo); border-bottom: 1px solid var(--linha);
}
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--texto); font-weight: 700; font-size: 1.15rem; min-height: 44px; }
.marca img { border-radius: 8px; }
.topo-usuario { font-size: 16px; color: var(--suave); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.abas {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--cartao); border-top: 1px solid var(--linha);
  padding-bottom: env(safe-area-inset-bottom);
}
.abas a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--nav); text-decoration: none; color: var(--suave); font-size: 16px;
}
.abas svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.abas a[aria-current="page"] { color: var(--acento); font-weight: 700; }
main { max-width: 680px; margin: 0 auto; padding: 16px 16px 24px; outline: none; }
main:focus, main:focus-visible { outline: none; }
.faixa { max-width: 680px; margin: 8px auto 0; padding: 10px 16px; border-radius: var(--raio); background: var(--ambar-fundo); color: var(--ambar); font-size: 16px; }
.faixa.erro { background: var(--erro-fundo); color: var(--erro); }
.faixa a { color: inherit; font-weight: 700; }
@media (min-width: 720px) { .faixa { margin-left: auto; margin-right: auto; } }

/* Painel */
.destaque { text-align: center; padding: 20px 8px 8px; }
.destaque .numero { font-size: clamp(64px, 22vw, 104px); font-weight: 800; line-height: 1; color: var(--acento); letter-spacing: -2px; }
.destaque .legenda { font-size: 1.2rem; font-weight: 600; margin-top: 6px; }
.cartoes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0 12px; }
.cartao-num { background: var(--cartao); border-radius: var(--raio); padding: 14px; box-shadow: var(--sombra); }
.cartao-num b { display: block; font-size: 2rem; line-height: 1.1; }
.cartao-num span { font-size: 16px; color: var(--suave); }
.cartao-num .meta-cartao { display: block; margin-top: 4px; color: var(--acento); font-weight: 600; }
.linha-info { text-align: center; color: var(--suave); font-size: 16px; margin: 4px 0; }
.linha-info strong { color: var(--texto); }

/* Botões */
.botoes { display: grid; gap: 10px; margin: 18px 0; }
.botoes.dois { grid-template-columns: 1fr 1fr; }
.botao, button.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 18px; border-radius: 12px; border: 2px solid var(--acento);
  background: var(--cartao); color: var(--acento); font: inherit; font-weight: 700; text-decoration: none;
  cursor: pointer; text-align: center; width: 100%;
}
.botao.primario { background: var(--acento); color: var(--acento-texto); }
.botao.discreto { border-color: var(--linha); color: var(--texto); font-weight: 600; }
.botao.perigo { border-color: var(--erro); color: var(--erro); }
.botao[disabled], .botao[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.botao svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.link-botao { background: none; border: 0; color: var(--acento); font: inherit; text-decoration: underline; cursor: pointer; padding: 10px 0; min-height: 44px; }
.voltar { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; text-decoration: none; font-weight: 600; margin-bottom: 4px; }

/* Lista de gatos */
.filtros { display: grid; gap: 10px; margin-bottom: 12px; }
.filtros .duas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.contagem { color: var(--suave); font-size: 16px; margin: 8px 0; }
.lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item-gato a {
  display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center;
  background: var(--cartao); border-radius: var(--raio); padding: 10px; box-shadow: var(--sombra);
  text-decoration: none; color: var(--texto); min-height: 104px;
}
.miniatura { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; background: var(--acento-claro); display: block; }
.item-gato .titulo { font-weight: 700; font-size: 1.05rem; }
.item-gato .meta { font-size: 16px; color: var(--suave); }
.mais { margin-top: 12px; }

/* Selos de situação */
.selo { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: 16px; font-weight: 600; white-space: nowrap; }
.s-em_acolhimento { background: var(--ok-fundo); color: var(--ok); }
.s-adotado { background: var(--azul-fundo); color: var(--azul); }
.s-devolvido { background: var(--roxo-fundo); color: var(--roxo); }
.s-obito { background: var(--cinza-fundo); color: var(--cinza); }
.s-desaparecido { background: var(--ambar-fundo); color: var(--ambar); }
.s-transferido { background: var(--ardosia-fundo); color: var(--ardosia); }
.s-inativo { background: var(--erro-fundo); color: var(--erro); }

/* Ficha */
.galeria-principal { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--raio); background: var(--acento-claro); display: block; }
.miniaturas { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0; }
.miniaturas button { border: 3px solid transparent; padding: 0; border-radius: 10px; background: none; cursor: pointer; flex: 0 0 auto; }
.miniaturas button[aria-pressed="true"] { border-color: var(--acento); }
.miniaturas img { width: 72px; height: 72px; object-fit: cover; border-radius: 7px; display: block; }
.cabeca-ficha { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; margin: 12px 0 4px; }
.cabeca-ficha h1 { margin: 0; }
.dados { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 6px 12px; margin: 12px 0; background: var(--cartao); padding: 14px; border-radius: var(--raio); box-shadow: var(--sombra); }
.dados dt { color: var(--suave); }
.dados dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.linha-tempo { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 3px solid var(--linha); }
.linha-tempo li { position: relative; padding: 0 0 16px 12px; }
.linha-tempo li::before { content: ""; position: absolute; left: -27px; top: 6px; width: 15px; height: 15px; border-radius: 50%; background: var(--acento); border: 3px solid var(--fundo); }
.linha-tempo .quando { color: var(--suave); font-size: 16px; }
.linha-tempo .oque { font-weight: 700; }
.linha-tempo .anulado { text-decoration: line-through; opacity: .7; }
.qr { display: grid; grid-template-columns: 140px 1fr; gap: 14px; align-items: center; background: var(--cartao); padding: 14px; border-radius: var(--raio); box-shadow: var(--sombra); margin-top: 20px; }
.qr-codigo svg { width: 140px; height: 140px; display: block; background: #fff; border-radius: 6px; }
.qr p { margin: 0 0 6px; font-size: 16px; }
.endereco-ficha { font-size: 16px; overflow-wrap: anywhere; color: var(--suave); }

/* Tabelas simples (lares, relatório, admin) */
.tabela { width: 100%; border-collapse: collapse; background: var(--cartao); border-radius: var(--raio); overflow: hidden; box-shadow: var(--sombra); font-size: 16px; }
.tabela th, .tabela td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--linha); vertical-align: top; }
.tabela th { font-weight: 700; background: var(--acento-claro); }
.tabela td.num, .tabela th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela-rolagem { overflow-x: auto; margin: 10px 0; }
.lares-lista { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.lares-lista .lar-cartao { display: block; background: var(--cartao); border-radius: var(--raio); padding: 14px; box-shadow: var(--sombra); text-decoration: none; color: var(--texto); }
.lar-cartao .titulo { font-weight: 700; font-size: 1.1rem; }
.lar-cartao a[href^="tel:"] { display: inline-block; min-height: 44px; line-height: 44px; font-weight: 600; }
.lar-cartao .numeros { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; font-size: 16px; }
.lar-cartao .numeros b { font-size: 1.15rem; }
.nota { font-size: 16px; color: var(--suave); background: var(--cartao); border-left: 4px solid var(--acento); padding: 10px 12px; border-radius: 0 10px 10px 0; margin: 12px 0; }

/* Formulários */
form { display: grid; gap: 16px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend, label.rotulo, .rotulo { font-weight: 700; display: block; margin-bottom: 6px; }
.ajuda { font-size: 16px; color: var(--suave); margin-top: 4px; }
.obrig::after { content: " *"; color: var(--erro); }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 50px; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--linha);
  background: var(--cartao); color: var(--texto); font: inherit;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--foco); outline: none; }
.segmentos { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.segmentos.estreito { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
.segmentos input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmentos label {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 52px; padding: 8px 10px;
  border: 2px solid var(--linha); border-radius: 12px; background: var(--cartao); cursor: pointer; font-weight: 600; line-height: 1.2;
  font-size: 16px; overflow-wrap: anywhere; hyphens: auto;
}
.segmentos input:checked + label { border-color: var(--acento); background: var(--acento-claro); color: var(--texto); box-shadow: inset 0 0 0 1px var(--acento); }
.segmentos input:focus-visible + label { outline: 3px solid var(--foco); outline-offset: 2px; }
.segmentos input:disabled + label { opacity: .45; cursor: not-allowed; }
.marcar { display: flex; gap: 12px; align-items: flex-start; min-height: 44px; cursor: pointer; }
.marcar input { width: 26px; height: 26px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--acento); }
.foto-campo { display: grid; gap: 10px; }
.foto-previa { width: 100%; max-height: 320px; object-fit: contain; border-radius: var(--raio); background: var(--acento-claro); }
.foto-vazia { display: flex; align-items: center; justify-content: center; min-height: 160px; border: 2px dashed var(--acento); border-radius: var(--raio); color: var(--suave); text-align: center; padding: 12px; }
.arquivo-oculto { position: absolute; opacity: 0; width: 1px; height: 1px; }
.termo { background: var(--cartao); border: 2px solid var(--linha); border-radius: 12px; padding: 12px; font-size: 16px; white-space: pre-line; }
.erro-form { background: var(--erro-fundo); color: var(--erro); padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.resultado-busca { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.resultado-busca button { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; width: 100%; text-align: left; background: var(--cartao); border: 2px solid var(--linha); border-radius: 12px; padding: 6px; font: inherit; color: var(--texto); cursor: pointer; min-height: 64px; }
.resultado-busca img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--acento-claro); }
.gato-escolhido { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; background: var(--cartao); border-radius: var(--raio); padding: 8px; box-shadow: var(--sombra); }
.gato-escolhido img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; }

/* Diversos */
.carregando { display: flex; gap: 10px; align-items: center; justify-content: center; color: var(--suave); padding: 40px 0; }
.giro { width: 22px; height: 22px; border: 3px solid var(--linha); border-top-color: var(--acento); border-radius: 50%; animation: giro .8s linear infinite; display: inline-block; }
@keyframes giro { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .giro { animation-duration: 3s; } }
.vazio { text-align: center; color: var(--suave); padding: 24px 8px; }
.aviso-toast {
  position: fixed; left: 50%; bottom: calc(var(--nav) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: min(92vw, 560px); background: var(--texto); color: var(--fundo); padding: 12px 18px; border-radius: 12px;
  font-weight: 600; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.aviso-toast.visivel { opacity: 1; pointer-events: auto; }
.aviso-toast.erro { background: var(--erro); color: #fff; }
.passos { padding-left: 1.3em; }
.passos li { margin-bottom: .6em; }
.caixa { background: var(--cartao); border-radius: var(--raio); padding: 14px 16px; box-shadow: var(--sombra); margin: 12px 0; }
.caixa > :last-child { margin-bottom: 0; }
.sobre-texto { white-space: pre-line; }
.rodape { color: var(--suave); font-size: 16px; text-align: center; margin-top: 28px; }
.noscript { padding: 24px; text-align: center; }
details.caixa summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.grade-acoes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.grade-acoes .botao { min-height: 88px; flex-direction: column; gap: 4px; }
.grade-acoes .botao svg { width: 28px; height: 28px; }
.pilha > * + * { margin-top: 8px; }
.tag-privado { font-size: 16px; color: var(--erro); font-weight: 600; }
.so-impressao { display: none; }
.so-leitor { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.meta { font-size: 16px; color: var(--suave); font-weight: 400; }
.sem-foto { background: var(--acento-claro) center / 40% no-repeat url("icons/icone.svg"); }
.botao-google { min-height: 64px; display: flex; align-items: center; justify-content: center; }
.foto-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.foto-lista figure { margin: 0; background: var(--cartao); border-radius: 12px; padding: 6px; box-shadow: var(--sombra); }
.foto-lista img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.foto-lista figcaption { font-size: 16px; padding: 4px 2px; }
.foto-lista .botao { min-height: 44px; padding: 6px 8px; margin-top: 6px; font-size: 16px; }
.resumo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.ok-texto { color: var(--ok); font-weight: 700; }
.erro-texto { color: var(--erro); font-weight: 700; }

@media print {
  body { background: #fff; color: #000; padding: 0; font-size: 12pt; }
  .topo, .abas, .faixa, .aviso-toast, .nao-imprimir, .miniaturas, .botoes, .voltar { display: none !important; }
  .so-impressao { display: block; }
  main { max-width: none; padding: 0; }
  .dados, .qr, .caixa, .tabela, .cartao-num { box-shadow: none; border: 1px solid #ccc; }
  .galeria-principal { max-height: 9cm; width: auto; }
  a { color: #000; text-decoration: none; }
}
