/* Sistema de Ocorrências — Junta de Freguesia do Bom Sucesso
   Desenvolvido por MLDEV (https://mldev.pt). Mobile-first. */

:root {
  --cor: #2F4A5E; --cor-texto: #fff; --cor2: #5C6F7E; --cor2-texto: #fff; --ligacao: #2F4A5E;
  --fundo: #F3F5F7; --superficie: #FFFFFF; --texto: #1B2228; --texto-2: #4F5B66; --linha: #D9DFE4;
  --erro: #B3261E; --erro-fundo: #FDECEA; --sucesso: #1E6B34; --sucesso-fundo: #E6F4EA;
  --aviso: #7A4F01; --aviso-fundo: #FFF4D6; --info: #164C7E; --info-fundo: #E5F0FA;
  --raio: 10px; --sombra: 0 1px 2px rgba(16, 24, 32, .08), 0 2px 8px rgba(16, 24, 32, .05);
  --toque: 48px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 16px; line-height: 1.5; color: var(--texto); background: var(--fundo); }
img { max-width: 100%; }
a { color: var(--ligacao); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
code { font-size: .78em; color: var(--texto-2); background: #EEF1F3; padding: 0 .3em; border-radius: 4px; }
hr { border: 0; border-top: 1px solid rgba(255, 255, 255, .2); margin: .5rem 0; }
:focus-visible { outline: 3px solid #1A73E8; outline-offset: 2px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.saltar { position: absolute; left: -999px; top: 0; background: #000; color: #fff; padding: .5rem 1rem; z-index: 2000; }
.saltar:focus { left: 0; }
.centro { text-align: center; }
.nota { color: var(--texto-2); font-size: .9rem; }
small.nota, .nota small { font-size: .82rem; }
.placeholder { background: var(--aviso-fundo); color: var(--aviso); padding: 0 .3em; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---------- Botões ---------- */
.botao { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .55rem 1rem; border: 2px solid var(--cor); border-radius: 8px; background: var(--cor); color: var(--cor-texto); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; text-align: center; }
.botao:hover { filter: brightness(1.08); text-decoration: none; }
.botao:disabled, .botao.a-enviar { opacity: .6; cursor: progress; }
.botao-sec { background: var(--superficie); color: var(--ligacao); border-color: var(--linha); }
.botao-sec:hover { border-color: var(--ligacao); filter: none; }
.botao-grande { min-height: var(--toque); font-size: 1.05rem; padding: .7rem 1.2rem; }
.botao-bloco { display: flex; width: 100%; }
.botao-perigo { background: var(--erro); border-color: var(--erro); color: #fff; }
.botao-perigo-sec { background: var(--superficie); color: var(--erro); border-color: #E7B4B0; }
.botao-resolvida { background: #1E6B34; border-color: #1E6B34; color: #fff; }
.botao-fechada { background: #37474F; border-color: #37474F; color: #fff; }
.botao-mini { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--linha); background: #fff; color: var(--erro); cursor: pointer; font-size: .9rem; }
button.ligacao { background: none; border: 0; padding: .6rem .9rem; font: inherit; color: var(--ligacao); cursor: pointer; text-align: left; width: 100%; }
.botao-ficheiro { position: relative; overflow: hidden; }
.botao-ficheiro input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.botao-ficheiro:focus-within { outline: 3px solid #1A73E8; outline-offset: 2px; }

/* ---------- Formulários ---------- */
.formulario { display: flex; flex-direction: column; gap: .35rem; margin: 0 0 1rem; }
.formulario label, .rotulo { font-weight: 600; margin-top: .55rem; }
.formulario > .botao { margin-top: 1rem; align-self: flex-start; }
.formulario > .botao-grande, .formulario > .botao-bloco { align-self: stretch; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="url"], input[type="tel"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; min-height: var(--toque); padding: .6rem .75rem; font: inherit; font-size: 16px; color: var(--texto); background: #fff; border: 1.5px solid #9AA6B1; border-radius: 8px;
}
textarea { min-height: 6rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #1A73E8; outline: 2px solid rgba(26, 115, 232, .35); outline-offset: 0; }
input[type="color"] { width: 100%; height: var(--toque); padding: 4px; border: 1.5px solid #9AA6B1; border-radius: 8px; background: #fff; }
input[readonly] { background: #F1F3F4; }
.ajuda { margin: 0; color: var(--texto-2); font-size: .88rem; }
.erro-campo { margin: .25rem 0 0; color: var(--erro); font-weight: 600; font-size: .92rem; }
.obrig { font-weight: 400; color: var(--texto-2); font-size: .85rem; }
.opc { font-weight: 400; color: var(--texto-2); font-size: .85rem; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: .5rem; }
.caixas { margin-top: .75rem; display: flex; flex-direction: column; gap: .15rem; }
.caixas legend { font-size: 1rem; }
.caixas.colunas { display: grid; grid-template-columns: 1fr; }
label.caixa { display: flex; align-items: flex-start; gap: .55rem; font-weight: 400; margin: 0; padding: .45rem 0; min-height: 40px; }
label.caixa input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--cor); }
.grelha-2, .grelha-3 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.grelha-2.compacta, .grelha-3.compacta { gap: .5rem 1rem; }
.grelha-2.compacta label, .grelha-3.compacta label { display: block; }

/* ---------- Alertas ---------- */
.alerta { padding: .75rem 1rem; border-radius: 8px; margin: 0 0 1rem; border-left: 5px solid; word-break: break-word; }
.alerta-sucesso { background: var(--sucesso-fundo); border-color: var(--sucesso); color: var(--sucesso); }
.alerta-erro { background: var(--erro-fundo); border-color: var(--erro); color: var(--erro); }
.alerta-aviso { background: var(--aviso-fundo); border-color: #C58A00; color: var(--aviso); }
.alerta-info { background: var(--info-fundo); border-color: var(--info); color: var(--info); }
.alerta-acoes { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.alerta-acoes form { margin: 0; }

/* ---------- Etiquetas ---------- */
.etiqueta { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 700; color: #fff; white-space: nowrap; vertical-align: middle; }
.etiqueta-aberta { background: #C62828; }
.etiqueta-atribuida { background: #B34700; }
.etiqueta-em_curso { background: #1565C0; }
.etiqueta-resolvida { background: #1E6B34; }
.etiqueta-fechada { background: #455A64; }
.etiqueta-cancelada { background: #6B6B6B; }
.prio { display: inline-block; padding: .05rem .5rem; border-radius: 6px; font-size: .8rem; font-weight: 700; border: 1.5px solid; white-space: nowrap; vertical-align: middle; }
.prio-baixa { color: #4F5B66; border-color: #9AA6B1; }
.prio-media { color: #164C7E; border-color: #7BA7D1; }
.prio-alta { color: #8A3B00; border-color: #E59A5B; background: #FFF3E8; }
.prio-urgente { color: #fff; border-color: #B3261E; background: #B3261E; }
.etiqueta-cat { display: inline-block; padding: .05rem .5rem; border-radius: 6px; font-size: .8rem; background: #EEF1F3; color: var(--texto-2); vertical-align: middle; }
.contador { display: inline-block; min-width: 1.6em; padding: 0 .4em; border-radius: 999px; background: #E3E7EB; color: var(--texto); font-size: .8rem; text-align: center; font-weight: 700; }

/* ---------- Página pública ---------- */
.pagina-publica { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.publico-caixa { width: 100%; max-width: 440px; margin: 1.5rem auto; padding: 1.5rem 1.25rem; background: var(--superficie); border-radius: var(--raio); box-shadow: var(--sombra); flex: 1 0 auto; align-self: center; }
.publico-caixa:has(.texto-legal) { max-width: 760px; }
.publico-marca { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--linha); }
.publico-marca div { display: flex; flex-direction: column; line-height: 1.25; }
.publico-marca span { color: var(--texto-2); font-size: .9rem; }
.logo { height: 44px; width: auto; max-width: 140px; object-fit: contain; border-radius: 6px; background: #fff; }
.logo-texto { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; background: var(--cor); color: var(--cor-texto); font-weight: 800; font-size: 1.3rem; }
.texto-legal h2 { margin-top: 1.5rem; }
.texto-legal li { margin-bottom: .4rem; }
.pagina-erro { text-align: center; padding: 2rem 0; }

/* ---------- Topo (funcionário) ---------- */
.topo { position: sticky; top: 0; z-index: 900; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .5rem .9rem; padding-top: max(.5rem, env(safe-area-inset-top)); background: var(--cor); color: var(--cor-texto); box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.topo-marca { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; min-width: 0; }
.topo-marca .logo { height: 38px; }
.topo-marca .logo-texto { width: 38px; height: 38px; background: rgba(255, 255, 255, .2); color: inherit; }
.topo-nome { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.topo-nome small { opacity: .85; font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-utilizador { position: relative; }
.menu-utilizador summary { list-style: none; cursor: pointer; display: flex; align-items: center; min-width: 44px; min-height: 44px; justify-content: center; }
.menu-utilizador summary::-webkit-details-marker { display: none; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 255, 255, .22); color: inherit; font-weight: 700; border: 2px solid rgba(255, 255, 255, .5); }
.menu-caixa { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: #fff; color: var(--texto); border-radius: 10px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); padding: .4rem 0; z-index: 1000; }
.menu-caixa a { display: block; padding: .6rem .9rem; text-decoration: none; }
.menu-caixa a:hover, .menu-caixa button:hover { background: #F1F3F4; }
.menu-caixa form { margin: 0; }
.menu-nome { margin: 0; padding: .4rem .9rem .6rem; border-bottom: 1px solid var(--linha); font-weight: 700; display: flex; flex-direction: column; }
.menu-nome small { font-weight: 400; color: var(--texto-2); }

.conteudo { width: 100%; max-width: 1100px; margin: 0 auto; padding: 1rem .9rem 6.5rem; }
.cabecalho-pagina { margin-bottom: 1rem; }
.cabecalho-pagina p { margin: .25rem 0 0; }

/* Botão flutuante "Nova ocorrência" */
.botao-nova { position: fixed; z-index: 950; left: 50%; transform: translateX(-50%); bottom: max(1rem, env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: .5rem; padding: .9rem 1.5rem; min-height: 56px; border-radius: 999px; background: var(--cor); color: var(--cor-texto); font-weight: 700; font-size: 1.05rem; text-decoration: none; box-shadow: 0 6px 18px rgba(0, 0, 0, .28); white-space: nowrap; }
.botao-nova span { font-size: 1.3rem; line-height: 1; }

/* ---------- Separadores ---------- */
.separadores { display: flex; gap: .4rem; overflow-x: auto; margin: 1rem 0; padding-bottom: .25rem; }
.separadores a { flex: none; display: inline-flex; align-items: center; gap: .4rem; padding: .55rem .9rem; min-height: 44px; border-radius: 999px; background: var(--superficie); border: 1.5px solid var(--linha); color: var(--texto); text-decoration: none; font-weight: 600; }
.separadores a.ativo { background: var(--cor); border-color: var(--cor); color: var(--cor-texto); }
.separadores a.ativo .contador { background: rgba(255, 255, 255, .25); color: inherit; }

/* ---------- Cartões de ocorrências ---------- */
.lista-cartoes { display: flex; flex-direction: column; gap: .6rem; }
.cartao-oc { display: flex; gap: .75rem; padding: .7rem; background: var(--superficie); border-radius: var(--raio); box-shadow: var(--sombra); color: inherit; text-decoration: none; border-left: 5px solid var(--linha); }
.cartao-oc:hover { box-shadow: 0 2px 12px rgba(0, 0, 0, .12); }
.prio-borda-urgente { border-left-color: #B3261E; }
.prio-borda-alta { border-left-color: #E07A1F; }
.prio-borda-media { border-left-color: #7BA7D1; }
.cartao-foto { flex: none; width: 76px; height: 76px; border-radius: 8px; overflow: hidden; background: #EEF1F3; display: flex; align-items: center; justify-content: center; }
.cartao-foto img { width: 100%; height: 100%; object-fit: cover; }
.cartao-icone { font-size: 2rem; }
.cartao-corpo { display: flex; flex-direction: column; min-width: 0; gap: .1rem; }
.cartao-topo { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.cartao-cat { font-weight: 600; font-size: .92rem; }
.cartao-desc { color: var(--texto-2); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cartao-meta { color: var(--texto-2); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vazio { text-align: center; padding: 2rem 1rem; background: var(--superficie); border-radius: var(--raio); color: var(--texto-2); }

/* ---------- Nova ocorrência ---------- */
.formulario-nova { gap: 1rem; }
.passo { background: var(--superficie); border-radius: var(--raio); box-shadow: var(--sombra); padding: 1rem; }
.passo legend { float: left; width: 100%; font-size: 1.1rem; margin-bottom: .75rem; }
.passo legend + * { clear: both; }
.passo-n { display: inline-flex; align-items: center; justify-content: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--cor); color: var(--cor-texto); font-size: .95rem; margin-right: .35rem; }
.grelha-categorias { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; clear: both; }
.categoria-opcao { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; min-height: 86px; padding: .6rem .4rem; border: 2px solid var(--linha); border-radius: 10px; background: #fff; cursor: pointer; text-align: center; font-weight: 600; margin: 0 !important; }
.categoria-opcao input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.categoria-opcao:has(input:checked) { border-color: var(--cat, var(--cor)); background: color-mix(in srgb, var(--cat, var(--cor)) 12%, #fff); box-shadow: 0 0 0 2px var(--cat, var(--cor)); }
.categoria-opcao:has(input:focus-visible) { outline: 3px solid #1A73E8; outline-offset: 2px; }
.categoria-icone { font-size: 1.8rem; line-height: 1; }
.categoria-nome { font-size: .92rem; line-height: 1.2; }
.aviso-fotos { margin: 0 0 .75rem; padding: .4rem .7rem; background: var(--info-fundo); color: var(--info); border-radius: 6px; font-size: .9rem; clear: both; }
.fotos-botoes { display: grid; grid-template-columns: 1fr; gap: .5rem; }
.pre-visualizacao { list-style: none; padding: 0; margin: .75rem 0 .25rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.pre-visualizacao li { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #EEF1F3; }
.pre-visualizacao img { width: 100%; height: 100%; object-fit: cover; }
.pre-visualizacao .botao-mini { position: absolute; top: 4px; right: 4px; }
.estado-gps { margin: .5rem 0; font-size: .92rem; color: var(--texto-2); min-height: 1.2em; }
.mapa { width: 100%; border-radius: 10px; overflow: hidden; border: 1px solid var(--linha); background: #E8ECEF; z-index: 1; }
.mapa-nova { height: 300px; margin: .25rem 0 .35rem; }
.mapa-ficha { height: 240px; margin-top: 1rem; }
.mapa-bo { height: calc(100vh - 290px); min-height: 380px; }
.segmentado { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; margin-top: .35rem; }
.segmentado label { margin: 0 !important; position: relative; }
.segmentado input { position: absolute; opacity: 0; inset: 0; }
.segmentado span { display: flex; align-items: center; justify-content: center; min-height: var(--toque); border: 2px solid var(--linha); border-radius: 8px; background: #fff; font-weight: 600; font-size: .92rem; cursor: pointer; }
.segmentado input:checked + span { border-color: var(--cor); background: var(--cor); color: var(--cor-texto); }
.segmentado .seg-urgente input:checked + span { border-color: #B3261E; background: #B3261E; color: #fff; }
.segmentado input:focus-visible + span { outline: 3px solid #1A73E8; outline-offset: 2px; }
.barra-enviar { position: sticky; bottom: 0; padding: .75rem 0 max(.75rem, env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--fundo) 30%); z-index: 5; }

/* ---------- Painéis ---------- */
.painel { background: var(--superficie); border-radius: var(--raio); box-shadow: var(--sombra); padding: 1rem; margin-bottom: 1rem; }
.painel > h2 { padding-bottom: .5rem; border-bottom: 1px solid var(--linha); }
.dados { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0 0 .5rem; }
.dados dt { font-weight: 600; color: var(--texto-2); }
.dados dd { margin: 0; word-break: break-word; }
.lista-simples { list-style: none; padding: 0; margin: 0; }
.lista-simples li { padding: .55rem 0; border-bottom: 1px solid var(--linha); }
.lista-simples li:last-child { border-bottom: 0; }

/* ---------- Ficha ---------- */
.ficha-cabecalho h1 { display: flex; align-items: center; gap: .4rem; margin-bottom: .35rem; }
.ficha-icone { font-size: 1.6rem; }
.ficha-voltar { margin: 0 0 .5rem; }
.ficha-etiquetas { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 1rem; }
.ficha-acoes { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; margin-bottom: 1rem; }
.ficha-acoes form { margin: 0; }
.ficha-acoes .botao { min-height: var(--toque); }
.ficha-descricao { font-size: 1.05rem; white-space: normal; margin: 0 0 1rem; }
.acao-detalhe { margin-top: .75rem; }
.acao-detalhe > summary { list-style: none; display: inline-flex; }
.acao-detalhe > summary::-webkit-details-marker { display: none; }
.ficha-acoes .acao-detalhe { margin-top: 0; }
.caixa-acao { margin-top: .6rem; padding: .9rem; border: 1px solid var(--linha); border-radius: 10px; background: #FAFBFC; min-width: min(100%, 320px); }
.antes-depois { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.coluna-fotos h3 { display: flex; align-items: center; gap: .4rem; }
.galeria { list-style: none; padding: 0; margin: 0 0 .5rem; display: grid; grid-template-columns: 1fr; gap: .5rem; }
.galeria li { position: relative; }
.galeria img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: #EEF1F3; }
.galeria form { position: absolute; top: 6px; right: 6px; margin: 0; }
.form-fotos { margin: 0; }
.form-fotos .botao { width: 100%; font-size: .9rem; }
.notas { list-style: none; padding: 0; margin: 0 0 .5rem; }
.notas li { padding: .6rem .75rem; background: #FAFBFC; border: 1px solid var(--linha); border-radius: 8px; margin-bottom: .5rem; }
.notas p { margin: 0 0 .25rem; }
.historico { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--linha); }
.historico li { position: relative; padding: 0 0 .8rem .4rem; display: flex; flex-direction: column; }
.historico li::before { content: ""; position: absolute; left: -1.38rem; top: .4rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--cor2); border: 2px solid #fff; }
.historico small { color: var(--texto-2); font-size: .8rem; }
.hist-texto { word-break: break-word; }

/* ---------- Tabelas ---------- */
.tabela-rolar { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--superficie); border-radius: var(--raio); }
.tabela { width: 100%; border-collapse: collapse; font-size: .93rem; background: var(--superficie); }
.tabela th, .tabela td { padding: .6rem .7rem; border-bottom: 1px solid var(--linha); text-align: left; vertical-align: top; }
.tabela thead th { background: #EEF1F3; font-size: .82rem; text-transform: none; color: var(--texto-2); white-space: nowrap; position: sticky; top: 0; }
.tabela thead th a { color: inherit; text-decoration: none; }
.tabela thead th a:hover { text-decoration: underline; }
.tabela tbody tr:hover { background: #FAFBFC; }
.tabela tfoot th, .tabela tfoot td { font-weight: 700; background: #FAFBFC; }
.tabela .num { text-align: right; white-space: nowrap; }
.tabela .centro { text-align: center; }
.linha-alerta td { background: #FFF8F7; }
.linha-grupo th { background: #F5F7F8; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--texto-2); }
.matriz th[scope="row"] { font-weight: 400; min-width: 260px; }
.sim { color: var(--sucesso); font-weight: 700; }
.nao { color: #A9B2BA; }
.ligacao-discreta { color: inherit; text-decoration: none; }
.amostra-cor { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; }
.paginacao { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; flex-wrap: wrap; }
.paginacao a { padding: .5rem .9rem; border: 1px solid var(--linha); border-radius: 8px; background: #fff; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }

/* ---------- Filtros ---------- */
.filtros { background: var(--superficie); border-radius: var(--raio); box-shadow: var(--sombra); padding: .75rem; margin-bottom: 1rem; }
.filtros-campos { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.filtros-campos label { display: flex; flex-direction: column; gap: .15rem; font-size: .82rem; font-weight: 600; color: var(--texto-2); margin: 0; }
.filtros-campos .f-q { grid-column: 1 / -1; }
.filtros-campos input, .filtros-campos select { min-height: 42px; padding: .4rem .55rem; font-size: 15px; }
.filtros-acoes { display: flex; gap: .5rem; margin-top: .6rem; }
.filtros-linha { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filtros-linha input, .filtros-linha select { width: auto; min-width: 180px; flex: 1; }
.barra-resultados { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.barra-resultados p { margin: 0; }
.barra-resultados-acoes { display: flex; gap: .5rem; flex-wrap: wrap; }
.legenda-mapa { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-bottom: .6rem; font-size: .88rem; align-items: center; }
.legenda-mapa i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: .3rem; vertical-align: -1px; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3); }

/* ---------- Painel (indicadores) ---------- */
.indicadores { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-bottom: 1rem; }
.indicador { display: flex; flex-direction: column; gap: .2rem; padding: .9rem; background: var(--superficie); border-radius: var(--raio); box-shadow: var(--sombra); color: inherit; text-decoration: none; border-top: 4px solid var(--cor2); }
a.indicador:hover { box-shadow: 0 2px 12px rgba(0, 0, 0, .12); }
.ind-valor { font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.ind-valor.ind-texto { font-size: 1.3rem; }
.ind-nome { color: var(--texto-2); font-size: .88rem; font-weight: 600; display: flex; flex-direction: column; }
.ind-nome small { font-weight: 400; }
.ind-aberta { border-top-color: #C62828; }
.ind-atribuida { border-top-color: #B34700; }
.ind-em_curso { border-top-color: #1565C0; }
.ind-resolvida { border-top-color: #1E6B34; }
.ind-urgente { border-top-color: #B3261E; background: #FFF8F7; }
.barras { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.barras li { display: grid; grid-template-columns: 1fr; gap: .2rem; }
.barra-trilho { display: block; height: 10px; background: #EEF1F3; border-radius: 999px; overflow: hidden; }
.barra { display: block; height: 100%; border-radius: 999px; min-width: 4px; }
.barra-valor { font-size: .88rem; font-weight: 700; }
.barra-valor small { font-weight: 400; color: var(--texto-2); }
.lista-cartoes-grelha { display: grid; grid-template-columns: 1fr; }

/* Categorias (ícones) */
.grelha-icones { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: .35rem; }
.icone-opcao { position: relative; margin: 0 !important; }
.icone-opcao input { position: absolute; opacity: 0; inset: 0; }
.icone-opcao span { display: flex; align-items: center; justify-content: center; height: 48px; border: 2px solid var(--linha); border-radius: 8px; font-size: 1.5rem; background: #fff; cursor: pointer; }
.icone-opcao input:checked + span { border-color: var(--cor); box-shadow: 0 0 0 2px var(--cor); }
.icone-opcao input:focus-visible + span { outline: 3px solid #1A73E8; }
.logo-previa { max-height: 80px; background: #fff; border: 1px solid var(--linha); border-radius: 8px; padding: 6px; }

/* ---------- Mapa ---------- */
.marcador span { display: block; width: 24px; height: 24px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.popup-oc { display: flex; flex-direction: column; gap: .2rem; font-size: .88rem; min-width: 180px; }
.popup-numero { font-weight: 800; font-size: 1rem; }
.popup-desc { color: #333; }
.popup-meta { color: #666; font-size: .8rem; }
.leaflet-container { font: inherit; }
.leaflet-container a.leaflet-popup-close-button { width: 32px; height: 32px; font-size: 22px; }

/* ---------- Rodapé ---------- */
.rodape { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem .6rem; padding: 1rem .9rem 1.25rem; color: var(--texto-2); font-size: .85rem; text-align: center; }
.pagina-app .rodape { padding-bottom: 6rem; }
.mapa-atrib { flex-basis: 100%; font-size: .78rem; }

/* ---------- Backoffice ---------- */
.bo { display: block; min-height: 100vh; }
.bo-lateral { position: fixed; z-index: 1100; inset: 0 auto 0 0; width: 270px; max-width: 85vw; background: var(--cor); color: var(--cor-texto); overflow-y: auto; transform: translateX(-100%); transition: transform .2s ease; padding: .75rem 0 2rem; }
.menu-aberto .bo-lateral { transform: none; box-shadow: 4px 0 24px rgba(0, 0, 0, .3); }
.menu-aberto::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 1050; }
.bo-marca { display: flex; align-items: center; gap: .6rem; padding: .4rem 1rem 1rem; color: inherit; text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, .2); margin-bottom: .5rem; }
.bo-marca span { display: flex; flex-direction: column; line-height: 1.2; }
.bo-marca small { opacity: .85; font-size: .78rem; }
.bo-marca .logo-texto { background: rgba(255, 255, 255, .2); color: inherit; }
.bo-lateral nav a { display: flex; align-items: center; gap: .6rem; padding: .65rem 1rem; color: inherit; text-decoration: none; min-height: 44px; border-left: 4px solid transparent; }
.bo-lateral nav a:hover { background: rgba(255, 255, 255, .1); }
.bo-lateral nav a.ativo { background: rgba(255, 255, 255, .16); border-left-color: var(--cor-texto); font-weight: 700; }
.bo-lateral .ico { width: 1.3rem; text-align: center; opacity: .9; }
.bo-principal { min-width: 0; }
.bo-topo { position: sticky; top: 0; z-index: 900; display: flex; align-items: center; gap: .6rem; padding: .5rem .9rem; background: var(--superficie); border-bottom: 1px solid var(--linha); }
.bo-menu-botao { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--linha); border-radius: 8px; background: #fff; font-size: 1.3rem; cursor: pointer; color: var(--texto); }
.bo-titulo { flex: 1; font-size: 1.15rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bo-topo .avatar { background: var(--cor); color: var(--cor-texto); border-color: transparent; }
.botao-nova-topo { display: none; }
.pagina-bo .conteudo { padding-bottom: 2rem; }
.pagina-bo .botao-nova { display: none; }

/* ---------- Ecrãs maiores ---------- */
@media (min-width: 560px) {
  .grelha-categorias { grid-template-columns: repeat(3, 1fr); }
  .fotos-botoes { grid-template-columns: 1fr 1fr; }
  .pre-visualizacao { grid-template-columns: repeat(5, 1fr); }
  .grelha-2.compacta { grid-template-columns: 1fr 1fr; }
  .grelha-3.compacta { grid-template-columns: 1fr 1fr 1fr; }
  .filtros-campos { grid-template-columns: repeat(3, 1fr); }
  .indicadores { grid-template-columns: repeat(3, 1fr); }
  .caixas.colunas { grid-template-columns: 1fr 1fr; }
  .galeria { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  h1 { font-size: 1.6rem; }
  .conteudo { padding: 1.5rem 1.5rem 3rem; }
  .grelha-2 { grid-template-columns: 1fr 1fr; }
  .grelha-3 { grid-template-columns: repeat(3, 1fr); }
  .grelha-categorias { grid-template-columns: repeat(4, 1fr); }
  .indicadores { grid-template-columns: repeat(4, 1fr); }
  .filtros-campos { grid-template-columns: 2fr repeat(4, 1fr); }
  .filtros-campos .f-q { grid-column: auto; }
  .filtros { display: flex; gap: .75rem; align-items: flex-end; }
  .filtros-campos { flex: 1; }
  .filtros-acoes { margin-top: 0; }
  .filtros-fixos { position: sticky; top: 61px; z-index: 800; background: var(--fundo); padding-top: .25rem; }
  .barras li { grid-template-columns: 220px 1fr 140px; align-items: center; }
  .lista-cartoes-grelha { grid-template-columns: 1fr 1fr; }
  .ficha-grelha { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
  .mapa-nova { height: 380px; }
  .mapa-ficha { height: 280px; }
  .bo { display: grid; grid-template-columns: 260px minmax(0, 1fr); }
  .bo-lateral { position: sticky; top: 0; height: 100vh; transform: none; width: auto; max-width: none; }
  .menu-aberto::after { display: none; }
  .bo-menu-botao { display: none; }
  .botao-nova-topo { display: inline-flex; }
  .conteudo-bo { max-width: none; }
  .pagina-app .rodape { padding-bottom: 1.25rem; }
  .pagina-app .conteudo { padding-bottom: 6rem; }
  .botao-nova { left: auto; right: 1.5rem; transform: none; }
}
@media (min-width: 1200px) {
  .filtros-campos { grid-template-columns: 2fr repeat(7, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .topo, .bo-lateral, .bo-topo, .botao-nova, .ficha-acoes, .rodape, form, .acao-detalhe { display: none !important; }
  .bo { display: block; }
  body { background: #fff; }
  .painel { box-shadow: none; border: 1px solid #ccc; }
}

/* Os cartões nunca ultrapassam a largura do painel (texto longo encolhe com reticências) */
.lista-cartoes-grelha { grid-template-columns: minmax(0, 1fr); }
.cartao-oc { min-width: 0; }
@media (min-width: 900px) { .lista-cartoes-grelha { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
