/* Identidade visual alinhada ao programas.santahelena.pr.gov.br */
:root {
  --page: #f6f7f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --ink: #1c1f24;
  --ink-2: #4f4f50;
  --muted: #6f737a;
  --line: #e1e5ea;
  --brand: #0e6a9c;
  --brand-2: #0b5a86;
  --brand-escuro: #0a4f78;
  --accent: #1ba2e8;
  --accent-soft: #a9dcf7;
  --link: #0c6496;
  --warn-bg: #fff6dc;
  --warn-ink: #6b4e00;
  --azul: #2a78d6;
  --verde: #1baf7a;
  --laranja: #eb6834;
  --cinza: #8b8f96;
  --vermelho: #c0392b;
  --raio: 10px;
  --sombra: 0 1px 2px rgba(28, 31, 36, .06), 0 8px 24px rgba(28, 31, 36, .06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body { font-family: Rubik, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--page); color: var(--ink); font-size: 15px; line-height: 1.5; }
h1, h2, h3, p, figure { margin: 0; }
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { text-align: right; }
/* ---------- topo compacto (brasão, fontes e cores do programas.santahelena.pr.gov.br) ---------- */
/* O conteúdo da barra alinha com as bordas do bloco principal da página (--largura: 1560px no mapa, 1200px no painel). */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px max(32px, calc((100% - var(--largura, 1560px)) / 2 + 32px)); background: #f5f5f5; border-bottom: 4px solid var(--accent); }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; text-decoration: none; color: inherit; }
.brasao { height: 44px; width: auto; flex: none; }
.brandTexto { border-left: 1px solid #d4d7db; padding-left: 14px; min-width: 0; }
.brandTexto strong { display: block; font-size: 16px; font-weight: 600; line-height: 1.2; color: var(--brand-2); }
.brandTexto span { display: block; font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topNav { display: flex; align-items: center; gap: 2px; flex: none; }
.topNav a, .topNav button { padding: 8px 12px; border: 0; border-radius: 6px; background: transparent; font-size: 14px; font-weight: 500; color: var(--ink-2); text-decoration: none; cursor: pointer; white-space: nowrap; }
.topNav a:hover, .topNav button:hover { background: rgba(27, 162, 232, .1); color: var(--brand-2); }
.restrictedLink { padding: 8px 14px; border: 1px solid #c9d1db; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none; background: #fff; }
.topNav .restrictedLink { margin-left: 6px; background: #fff; color: var(--ink); }
.topNav .restrictedLink:hover { border-color: var(--brand); color: var(--brand-2); background: #fff; }
.quemSou { font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dashboard { max-width: 1560px; margin: 0 auto; padding: 20px 32px 40px; }
.visuallyHidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.shell { background: var(--surface); border: 1px solid var(--line); border-radius: var(--raio); box-shadow: var(--sombra); overflow: hidden; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border: 1px solid var(--brand); border-radius: 8px; background: var(--brand); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn.ghost { background: #fff; border-color: #c9d1db; color: var(--ink); }
.listHeader { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; padding: 16px 16px 8px; border-top: 1px solid var(--line); }
.listHeader h2 { font-size: 17px; font-weight: 600; }
.galeriaWrap { padding: 4px 16px 16px; }

/* ---------- filtros ---------- */
.filters { display: grid; grid-template-columns: minmax(200px, 1.6fr) repeat(6, minmax(105px, 1fr)) auto; gap: 12px; align-items: end; padding: 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.filters label > span { display: block; margin-bottom: 5px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.filters input[type=search], .filters select { width: 100%; height: 42px; padding: 0 12px; border: 1px solid #c9d1db; border-radius: 8px; background: #fff; font-weight: 500; }
.filters input:focus-visible, .filters select:focus-visible, .resetButton:focus-visible, .filtersToggle:focus-visible, .btn:focus-visible { outline: 3px solid rgba(27, 162, 232, .45); outline-offset: 1px; }
.searchRow { display: flex; gap: 8px; align-items: flex-end; min-width: 0; }
.searchRow .searchBox { flex: 1; min-width: 0; }
.filtersToggle { display: none; height: 42px; padding: 0 14px; border: 1px solid #c9d1db; border-radius: 8px; background: #fff; color: var(--ink); font-weight: 600; white-space: nowrap; cursor: pointer; }
.filtersToggle.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.filterActions { display: flex; flex-direction: column; gap: 6px; }
.clusterToggle { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.filters .clusterToggle > span { margin: 0; text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.resetButton { height: 42px; padding: 0 18px; border: 1px solid var(--brand); border-radius: 8px; background: var(--brand); color: #fff; font-weight: 600; cursor: pointer; white-space: nowrap; }
.resetButton:hover { filter: brightness(1.06); }

.summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.legendDot { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 50%; background: var(--azul); }
.legendSep { width: 1px; height: 14px; background: var(--line); }
.legendSym { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 2px; border-radius: 50%; color: #fff; background: var(--brand-2); vertical-align: middle; }
.legendSym svg { width: 11px; height: 11px; }
.metrics { display: flex; flex-wrap: wrap; gap: 8px; }
.metrics span { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: #fff; }
.metrics strong { margin-right: 6px; font-size: 15px; letter-spacing: 0; color: var(--ink); }
.metrics .metricEmpresa strong { font-size: 13px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }

/* ---------- mapa ---------- */
.mapWrap { padding: 10px; }
.mapCanvas { height: 66vh; min-height: 420px; border: 1px solid var(--line); border-radius: 8px; background: #e8eef5; z-index: 0; }
.andamento, .legendDot.andamento { --cor: var(--azul); }
.finalizada, .legendDot.finalizada { --cor: var(--verde); }
.naoiniciada, .legendDot.naoiniciada { --cor: var(--cinza); }
.paralisada, .legendDot.paralisada { --cor: var(--laranja); }
.cancelada, .legendDot.cancelada { --cor: var(--vermelho); }
.legendDot { background: var(--cor, var(--azul)); }
.mapMarker { display: grid; place-items: center; border-radius: 50%; border: 2px solid #fff; background: var(--cor, var(--azul)); color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--cor, var(--azul)) 30%, transparent), 0 2px 6px rgba(0, 0, 0, .35); }
.mapMarker svg { display: block; }
.mapMarker:focus-visible { outline: 3px solid #111; }
path.trajeto { stroke: var(--cor, var(--azul)); }
.marker-cluster { border-radius: 50%; background: rgba(14, 106, 156, .25); }
.marker-cluster div { width: 30px; height: 30px; margin: 5px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; font-size: 12px; }

.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: var(--sombra); }
.leaflet-popup-content { margin: 14px; font-family: inherit; line-height: 1.4; }
.mapPopup { display: grid; gap: 8px; color: var(--ink); }
.popupTitle strong { display: block; font-size: 15px; line-height: 1.3; font-weight: 600; }
.popupTitle small { font-weight: 500; color: var(--muted); }
.popupLine { display: flex; gap: 10px; align-items: baseline; padding: 7px 10px; border-left: 3px solid var(--brand); border-radius: 4px; background: var(--surface-2); }
.mapPopup small { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.popupTitle small { font-size: 12px; letter-spacing: 0; text-transform: none; }
.popupStatus { justify-self: start; display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; color: var(--cor, var(--azul)); background: color-mix(in srgb, var(--cor, var(--azul)) 13%, #fff); }
.popupGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.popupGrid span { padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; }
.popupGrid small, .popupGrid strong { display: block; }
.popupGrid strong { font-size: 13px; font-weight: 600; }
.popupNote { margin: 0 !important; font-size: 12.5px; color: var(--muted); }
.popupProgress { display: flex; align-items: center; gap: 8px; }
.popupProgress small, .progressCell small { font-size: 12px; letter-spacing: 0; text-transform: none; font-weight: 600; color: var(--ink); white-space: nowrap; }
.popupAditivos { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 10px; border-radius: 6px; background: var(--warn-bg); border: 1px solid #f1e3b4; }
.popupAditivos > small { width: 100%; color: var(--warn-ink); }
.popupAditivos span { display: flex; gap: 6px; align-items: baseline; padding: 3px 8px; border-radius: 5px; background: #fff; }
.popupAditivos span small { color: var(--muted); }
.popupAditivos strong { font-size: 12.5px; font-weight: 600; }
.popupButton { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; text-align: left; }
.popupButton img { width: 56px; height: 42px; object-fit: cover; border-radius: 5px; }
.popupButton span { font-weight: 600; color: var(--link); }
.popupButton:hover { border-color: var(--accent); }
.progress { flex: 1; height: 8px; min-width: 70px; border-radius: 99px; background: #e3e9f2; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 99px; background: var(--cor, var(--azul)); }
.progressCell { min-width: 150px; }
.progressCell .progress { display: inline-block; width: 80px; vertical-align: middle; margin-right: 8px; }

/* ---------- galeria (página inicial) ---------- */
.galeriaGrade { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.galeriaCartao { display: flex; flex-direction: column; padding: 0; border: 1px solid var(--line); border-radius: var(--raio); background: var(--surface); box-shadow: var(--sombra); overflow: hidden; cursor: pointer; text-align: left; transition: transform .15s, box-shadow .15s; }
.galeriaCartao:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(28, 31, 36, .12); }
.galeriaCartao img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); }
.galeriaCartaoTexto { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; }
.galeriaCartaoTag { display: flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.galeriaCartaoTexto strong { font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.galeriaCartaoTexto small { color: var(--muted); }

/* visualizador de fotos (tela cheia) */
.galeria { position: fixed; inset: 0; z-index: 4000; display: flex; flex-direction: column; background: rgba(10, 20, 30, .96); color: #fff; }
.galeriaTopo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.galeriaTitulo { min-width: 0; }
.galeriaTitulo strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.galeriaTitulo small { color: rgba(255, 255, 255, .7); }
.galeriaAcoes { display: flex; align-items: center; gap: 12px; flex: none; font-weight: 600; }
.galeriaFechar { width: 40px; height: 40px; border: 1px solid rgba(255, 255, 255, .3); border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
.galeriaPalco { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 56px; }
.galeriaPalco figure { max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.galeriaPalco img { max-width: 100%; max-height: calc(100vh - 230px); object-fit: contain; border-radius: 6px; background: #000; }
.galeriaPalco figcaption { font-size: 14px; text-align: center; color: rgba(255, 255, 255, .85); }
.galeriaPalco figcaption span { color: rgba(255, 255, 255, .55); }
.galeriaSeta { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
.galeriaSeta:hover { background: rgba(255, 255, 255, .25); }
.galeriaSeta.anterior { left: 10px; }
.galeriaSeta.proxima { right: 10px; }
.galeriaMiniaturas { display: flex; gap: 6px; padding: 10px 16px 14px; overflow-x: auto; }
.galeriaMiniaturas button { flex: none; width: 72px; height: 54px; padding: 0; border: 2px solid transparent; border-radius: 6px; background: #000; opacity: .6; cursor: pointer; overflow: hidden; }
.galeriaMiniaturas button img { width: 100%; height: 100%; object-fit: cover; }
.galeriaMiniaturas button.ativa { border-color: var(--accent); opacity: 1; }
body.galeriaAberta { overflow: hidden; }

/* ---------- lista ---------- */
.tableWrap { overflow-x: auto; padding: 0 16px 16px; }
.obrasTable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.obrasTable th { padding: 12px 10px 9px; text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid var(--line); white-space: nowrap; }
.obrasTable th.num { text-align: right; }
.obrasTable td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.obrasTable tbody tr:hover { background: #f6f9fd; }
.linkButton { padding: 0; border: 0; background: none; font-weight: 600; color: var(--link); cursor: pointer; white-space: nowrap; }
.linkButton:hover { text-decoration: underline; }
.linkButton.danger { color: var(--vermelho); }
.empty { padding: 24px; text-align: center; color: var(--muted); }
.aditivosCell { font-size: 12.5px; font-weight: 600; color: var(--warn-ink); line-height: 1.35; }
.aditivosCell .supressao { color: var(--vermelho); }


/* ---------- ficha de detalhes (celular) ---------- */
.ficha { position: fixed; inset: 0; z-index: 3000; }
.fichaBackdrop { position: absolute; inset: 0; background: rgba(10, 20, 40, .45); }
.fichaPainel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 80vh; overflow-y: auto; -webkit-overflow-scrolling: touch; background: #fff; border-radius: 16px 16px 0 0; padding: 0 16px 28px; box-shadow: 0 -8px 30px rgba(0, 0, 0, .25); }
.fichaTopo { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 8px 0 6px; background: #fff; }
.fichaAlca { width: 40px; height: 4px; border-radius: 4px; background: #cfd8e3; }
.fichaFechar { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: #f4f6fa; font-size: 24px; line-height: 1; color: var(--ink); cursor: pointer; }
.fichaPainel .mapPopup { gap: 10px; }
.fichaPainel .popupTitle strong { font-size: 16px; }
body.fichaAberta { overflow: hidden; }

/* ---------- painel ---------- */
.panel { max-width: 1200px; margin: 0 auto; padding: 20px 24px 48px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.panel > *, .aba { min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--raio); box-shadow: var(--sombra); padding: 18px; }
.card h2 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.card > p { color: var(--ink-2); margin-bottom: 12px; }
.loginCard { max-width: 400px; margin: 8vh auto 0; }
.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid #c9d1db; border-radius: 8px; background: #fff; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .inputInline:focus-visible { outline: 3px solid rgba(27, 162, 232, .45); border-color: var(--accent); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.notice { padding: 10px 12px; border-radius: 8px; font-weight: 500; margin: 10px 0; }
.notice.error { background: #fdecea; color: #8f1d12; }
.notice.ok { background: #e6f5ee; color: #0b5a39; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice ul { margin: 6px 0 0; padding-left: 18px; font-weight: 400; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.stats span { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-weight: 500; color: var(--muted); }
.stats strong { color: var(--ink); margin-right: 5px; font-size: 16px; }
.previewWrap { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin: 10px 0; }
.previewWrap .obrasTable th { position: sticky; top: 0; background: #fff; }
.radio { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.radio small { display: block; color: var(--muted); }
.inputInline { padding: 9px 12px; border: 1px solid #c9d1db; border-radius: 8px; background: #fff; font: inherit; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.tab { padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-weight: 600; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.tab:hover { color: var(--brand-2); border-color: var(--accent-soft); }
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }

dialog { width: min(920px, 94vw); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); color: var(--ink); }
dialog::backdrop { background: rgba(10, 20, 40, .55); }
dialog.dialogPequeno { width: min(440px, 94vw); }
.dialogHead { padding: 16px 18px 0; }
.dialogHead h3 { font-size: 17px; font-weight: 600; }
.dialogHead p { color: var(--muted); margin-top: 3px; font-size: 14px; }
.dialogBody { padding: 12px 18px 18px; }
#mapaEdicao { height: 44vh; min-height: 300px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; cursor: crosshair; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.previaItem { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.previaItem:last-child { border-bottom: 0; }
.previaItem.igual { opacity: .7; }
.previaCab { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; line-height: 1.35; }
.previaTag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.previaTag.nova { background: #e6f5ee; color: #0b5a39; }
.previaTag.alterada { background: var(--warn-bg); color: var(--warn-ink); }
.previaTag.igual { background: var(--surface-2); color: var(--muted); }
.previaTag.removida { background: #fdecea; color: #8f1d12; }
.previaMudancas { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.previaMudancas li { margin: 2px 0; }
.previaMudancas i { font-style: normal; color: var(--muted); padding: 0 4px; }
.previaNova { margin-top: 4px; font-size: 13px; color: var(--muted); }
.previewWrap .empty { margin: 0; }
.histTable td { font-size: 13px; vertical-align: top; }
.histTag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.histTag.importacao { background: #e4effc; color: #1d4f9a; }
.histTag.edicao, .histTag.localizacao { background: var(--warn-bg); color: var(--warn-ink); }
.histTag.exclusao { background: #fdecea; color: #8f1d12; }
.histTag.usuario { background: #ede9fe; color: #4c2a9a; }
.histTag.foto { background: #e6f5ee; color: #0b5a39; }
tr.inativo td { color: var(--muted); }
.histObra { margin: 4px 0 10px; }
.histObra summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--link); }
.histObraLista { max-height: 180px; overflow: auto; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.histObraLista ul { margin: 0; padding-left: 16px; }
.histObraLista li { margin: 4px 0; }
.histObraLista i { font-style: normal; color: var(--muted); padding: 0 4px; }

/* fotos no editor */
.fotosBloco { margin: 4px 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; }
.btnArquivo { cursor: pointer; }
.fotosGrade { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.fotoItem { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.fotoItem.capa { border-color: var(--accent); }
.fotoAbrir { padding: 0; border: 0; background: var(--surface-2); border-radius: 6px; overflow: hidden; cursor: zoom-in; }
.fotoAbrir img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.fotoCapa { position: absolute; top: 10px; left: 10px; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 600; text-transform: uppercase; }
.fotoLegenda { width: 100%; padding: 5px 7px; border: 1px solid transparent; border-radius: 6px; background: transparent; font-size: 12.5px; }
.fotoLegenda:hover, .fotoLegenda:focus { border-color: #c9d1db; background: #fff; }
.fotoItem small { font-size: 11px; padding: 0 7px; }
.fotoAcoes { display: flex; justify-content: space-between; gap: 8px; padding: 0 7px 2px; font-size: 12.5px; }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(3, 1fr); }
  .searchRow { grid-column: 1 / -1; }
  .filterActions { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
  .galeriaGrade { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .brasao { height: 34px; }
  .brandTexto { padding-left: 10px; }
  .brandTexto strong { font-size: 14px; }
  .brandTexto span { display: none; }
  .topNav a:not(.restrictedLink) { display: none; }
  .restrictedLink { padding: 6px 10px; font-size: 12px; }
  .dashboard, .panel { padding: 10px 10px 24px; }
  .listHeader { padding: 12px 10px 6px; }
  .listHeader h2 { font-size: 15px; }
  .galeriaWrap { padding: 4px 10px 10px; }

  /* filtros: busca + botão; seletores recolhidos */
  .filters { grid-template-columns: 1fr; gap: 8px; padding: 10px; }
  .searchRow { grid-column: 1; }
  .filters label > span { display: none; }
  .filters input[type=search], .filters select, .resetButton, .filtersToggle { height: 40px; }
  .filtersToggle { display: inline-flex; align-items: center; }
  .filters.collapsed .selectBox, .filters.collapsed .filterActions { display: none; }
  .filterActions { flex-direction: row; align-items: center; justify-content: space-between; }

  .summary { padding: 10px; gap: 8px; }
  .legend { gap: 10px; font-size: 12px; }
  .metrics { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 6px; }
  .metrics span { display: flex; flex-direction: column; gap: 1px; padding: 6px 9px; font-size: 9.5px; }
  .metrics strong { margin: 0; font-size: 14px; }
  .metrics span:nth-child(3), .metrics .metricEmpresa { grid-column: 1 / -1; }
  .metrics .metricEmpresa strong { font-size: 12.5px; max-width: 100%; }
  .mapWrap { padding: 6px; }
  .mapCanvas { height: 56vh; min-height: 320px; border-radius: 8px; }
  .leaflet-popup-content { margin: 12px; }
  .popupTitle strong { font-size: 14px; }
  .popupGrid { gap: 4px; }
  .popupGrid span { padding: 4px 7px; }
  .popupGrid strong { font-size: 12px; }

  .galeriaGrade { grid-template-columns: 1fr 1fr; gap: 8px; }
  .galeriaCartaoTexto { padding: 8px 10px 10px; }
  .galeriaCartaoTexto strong { font-size: 13px; }
  .galeriaPalco { padding: 0 8px; }
  .galeriaSeta { width: 36px; height: 36px; font-size: 24px; background: rgba(0, 0, 0, .35); }
  .galeriaPalco img { max-height: calc(100vh - 200px); }

  /* tabela vira cartões */
  .tableWrap { padding: 0 10px 10px; overflow-x: visible; }
  .obrasTable thead { display: none; }
  .obrasTable, .obrasTable tbody, .obrasTable tr, .obrasTable td { display: block; width: 100%; }
  .obrasTable tr { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
  .obrasTable tbody tr:hover { background: #fff; }
  .obrasTable td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; border: 0; font-size: 13px; white-space: normal; text-align: right; }
  .obrasTable td::before { content: attr(data-label); flex: none; font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: left; }
  .obrasTable td.descricaoCell { display: block; text-align: left; font-weight: 600; line-height: 1.3; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
  .obrasTable td.descricaoCell::before { display: none; }
  .obrasTable td.acaoCell { justify-content: flex-end; padding-top: 8px; }
  .obrasTable td.acaoCell::before { display: none; }
  .progressCell { min-width: 0; }
  .progressCell .progress { width: 90px; margin-right: 6px; }

  .panel { padding: 12px 10px 24px; }
  .card { padding: 14px; }
  .grid2 { grid-template-columns: 1fr; }
  .previewWrap { max-height: 50vh; }
  .previewWrap .obrasTable td { font-size: 12px; }
  #mapaEdicao { height: 40vh; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .tab { white-space: nowrap; padding: 8px 12px; }
  .fotosGrade { grid-template-columns: 1fr 1fr; }
}

/* ---------- links de galeria no popup ---------- */
.popupLinks { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.popupButton.semFotos { text-decoration: none; color: inherit; }
.popupButton.semFotos span { color: var(--ink-2); }
.popupButton.semFotos small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.popupPagina { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.galeriaLink { color: #fff; font-size: 13px; font-weight: 500; opacity: .85; text-decoration: none; }
.galeriaLink:hover { opacity: 1; text-decoration: underline; }
/* página própria da galeria */
.galeriaPagina { padding: 16px; }
.galeriaPaginaCab { margin-bottom: 12px; }
.galeriaPaginaCab h2 { font-size: 20px; font-weight: 600; }
.galeriaPaginaCab p { color: var(--muted); }
.fotosPublicas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.fotosPublicas button { padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; cursor: zoom-in; text-align: left; }
.fotosPublicas img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.fotosPublicas figcaption { padding: 6px 8px; font-size: 12.5px; color: var(--ink-2); }
@media (max-width: 640px) { .fotosPublicas { grid-template-columns: 1fr 1fr; gap: 8px; } .popupLinks { flex-wrap: wrap; } }
a.galeriaCartao { text-decoration: none; color: inherit; }
.linkButton.semFotos { color: var(--muted); text-decoration: none; }
.linkButton.semFotos:hover { color: var(--link); text-decoration: underline; }

/* ---------- lista de obras do painel: cabe sem rolagem lateral ---------- */
.listaObras { table-layout: fixed; }
.listaObras th:nth-child(2), .listaObras td:nth-child(2) { width: 150px; }
.listaObras th:nth-child(3), .listaObras td:nth-child(3) { width: 125px; }
.listaObras th:nth-child(4), .listaObras td:nth-child(4) { width: 130px; }
.listaObras th:nth-child(5), .listaObras td:nth-child(5) { width: 105px; }
.listaObras th:nth-child(6), .listaObras td:nth-child(6) { width: 185px; text-align: right; }
.listaObras td { padding: 11px 10px; }
.listaObras .progressCell { min-width: 0; }
.listaObras .progressCell .progress { width: 78px; }
.obraCell { padding-right: 16px; }
.obraMeta { margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.obraMeta b { color: var(--ink-2); font-weight: 600; }
.btnMini { padding: 6px 12px; font-size: 13px; }
.listaObras td.acaoCell .btn { margin-right: 10px; }
.linkDescricao { padding: 0; border: 0; background: none; text-align: left; font: inherit; font-weight: 500; color: var(--link); cursor: pointer; line-height: 1.4; }
.linkDescricao:hover { text-decoration: underline; }
.localTag { display: inline-block; padding: 3px 9px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 600; white-space: nowrap; }
.localTag.falta { background: var(--warn-bg); color: var(--warn-ink); }
.fotosTag { background: #e4effc; color: #1d4f9a; cursor: pointer; }
.fotosTag:hover { background: #d3e5fa; }
@media (max-width: 900px) {
  .listaObras th:nth-child(4), .listaObras td:nth-child(4) { display: none; }
  .listaObras th:nth-child(6), .listaObras td:nth-child(6) { width: 110px; }
  .listaObras td.acaoCell .btn { margin-right: 0; }
  .listaObras td.acaoCell .linkButton { display: block; margin-top: 6px; }
}
@media (max-width: 640px) {
  .listaObras th, .listaObras td { width: auto !important; display: block; }
  .listaObras td:nth-child(4) { display: flex; }
  .listaObras td.acaoCell { display: flex; justify-content: flex-end; gap: 10px; }
  .listaObras td.acaoCell .linkButton { margin-top: 0; }
}

/* ---------- prazo atualizado ---------- */
.popupGrid .prazoAtualizado { border-color: #f1e3b4; background: #fffaf0; }
.popupGrid strong i { font-style: normal; font-weight: 500; font-size: 11.5px; color: var(--warn-ink); }
.prazoVencido { display: block; margin-top: 2px; font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--vermelho); }
