/* Home v2 - Balneabilidade SC. Usa apenas os tokens do IMA Design System (ima-ds.css).
   Cabecalho azul institucional; todo o resto em branco. */

:root {
  --v2-bg: var(--white);
  --v2-surface: var(--white);
  --v2-text: var(--gray-900);
  --v2-muted: var(--gray-600);
  --v2-line: var(--gray-200);
  --v2-heading: var(--ima-blue);
  /* situacao: azul (proprio) / vermelho (improprio) - seguro para daltonismo */
  --st-proprio-bg: var(--ima-accent-050);
  --st-proprio-fg: var(--ima-blue);
  --st-improprio-bg: var(--ima-red-050);
  --st-improprio-fg: var(--ima-red-700);
  --st-indet-bg: var(--gray-100);
  --st-indet-fg: var(--gray-700);
  --top-h: 64px;
}

html, body.ima { height: 100%; }
body.ima { background: var(--white); color: var(--gray-900); overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.v2-body { flex: 1; min-height: 0; display: flex; }

/* ---------- cabecalho ---------- */
.v2-top {
  flex: none; height: var(--top-h); background: var(--ima-blue); color: var(--white);
  display: flex; align-items: center; gap: var(--sp-4); padding: 0 var(--sp-5);
  box-shadow: var(--shadow-sm); position: relative; z-index: 1200;
}
.v2-top__brand { display: flex; align-items: center; flex: none; }
.v2-top__brand img { height: 36px; width: auto; display: block; }
.v2-top__title { display: flex; flex-direction: column; line-height: 1.2; padding-left: var(--sp-4); border-left: 1px solid rgba(255,255,255,.3); min-width: 0; }
.v2-top__title strong { font-size: var(--text-lg); font-weight: var(--fw-semibold); }
.v2-top__title span { font-size: var(--text-xs); }
.v2-top__nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.v2-top__link {
  display: inline-flex; align-items: center; gap: var(--sp-2); height: 40px; padding: 0 var(--sp-3);
  border: 0; border-radius: var(--radius); background: none; color: var(--white);
  font: inherit; font-weight: var(--fw-medium); cursor: pointer; text-decoration: none;
}
.ima a.v2-top__link, .ima a.v2-top__link:hover { color: var(--white); text-decoration: none; }
.v2-top__link:hover { background: rgba(255,255,255,.10); }
.v2-top__link:focus-visible, .v2-top__btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.v2-top__link.is-active { background: var(--ima-accent); font-weight: var(--fw-semibold); box-shadow: 0 2px 8px rgba(0,159,227,.35); }
.v2-top__loc { margin-left: var(--sp-3); flex: none; }
.v2-top__btn { display: none; width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.5); border-radius: var(--radius); background: none; color: var(--white); cursor: pointer; align-items: center; justify-content: center; }

/* ---------- filtros (esquerda) ---------- */
.v2-filtros {
  flex: none; width: 340px; background: var(--white); border-right: 1px solid var(--gray-200);
  overflow-y: auto; padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-4);
}
.v2-search-row { display: flex; gap: var(--sp-2); }
.v2-search { position: relative; flex: 1; }
.v2-search .ico { position: absolute; left: 12px; top: 12px; color: var(--gray-500); pointer-events: none; }
.v2-search .input { padding-left: 38px; }
.v2-results { list-style: none; margin: 4px 0 0; padding: 0; position: absolute; left: 0; right: 0; z-index: 20; background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-md); max-height: 260px; overflow-y: auto; }
.v2-results li button { width: 100%; text-align: left; border: 0; background: none; font: inherit; padding: 8px var(--sp-3); cursor: pointer; color: var(--gray-900); display: block; }
.v2-results li button:hover, .v2-results li button:focus-visible { background: var(--ima-accent-050); outline: none; }
.v2-results small { display: block; color: var(--gray-600); }
.btn--icon-only { width: 40px; padding: 0; flex: none; }
.btn--sm.btn--icon-only { width: 32px; }

.v2-loc-card {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%; text-align: left; font: inherit;
  background: var(--ima-accent-050); color: var(--ima-blue); border: 1px solid transparent; border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4); cursor: pointer;
}
.v2-loc-card:hover { border-color: var(--ima-accent); }
.v2-loc-card:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.v2-loc-card small { display: block; color: var(--gray-700); font-size: var(--text-xs); }

.v2-block { display: flex; flex-direction: column; }
.v2-block__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.v2-h { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--text-md); font-weight: var(--fw-semibold); color: var(--ima-blue); }
.v2-linkbtn { border: 0; background: none; font: inherit; font-size: var(--text-sm); color: var(--ima-accent-600); text-decoration: underline; cursor: pointer; padding: 0; }
.v2-fieldset { border: 0; padding: 0; margin: 0 0 var(--sp-2); }
.v2-checks { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-2); }
.v2-count { margin: var(--sp-2) 0 0; font-size: var(--text-sm); color: var(--gray-600); }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex: none; border: 2px solid var(--white); box-shadow: 0 0 0 1px var(--gray-300); }
.dot--proprio { background: var(--ima-accent); }
.dot--improprio { background: var(--ima-red); }
.dot--indet { background: var(--gray-400); }

.v2-near { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.v2-near button { width: 100%; text-align: left; border: 1px solid var(--gray-200); background: var(--white); color: var(--gray-900); font: inherit; padding: 8px var(--sp-3); border-radius: var(--radius); cursor: pointer; }
.v2-near button:hover { background: var(--ima-accent-050); }
.v2-near small { display: block; color: var(--gray-600); }

.v2-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.v2-stat--wide, .v2-stat--split { grid-column: 1 / -1; }
.v2-stat { display: flex; align-items: center; gap: var(--sp-2); border: 1px solid var(--gray-200); border-radius: var(--radius-md); padding: var(--sp-3); min-width: 0; }
.v2-stat__ico { width: 36px; height: 36px; border-radius: 50%; background: var(--ima-accent-050); color: var(--ima-blue); display: grid; place-items: center; flex: none; }
.v2-stat small { display: block; font-size: var(--text-xs); color: var(--gray-600); }
.v2-stat b { font-size: var(--text-lg); color: var(--ima-blue); }
.v2-stat--split { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.v2-stat--split small { display: flex; align-items: center; justify-content: center; gap: 4px; }

/* ---------- mapa ---------- */
.stage { position: relative; flex: 1; min-width: 0; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--gray-200); }
.leaflet-container { font-family: inherit; }

.v2-basemaps { position: absolute; top: 12px; left: 56px; z-index: 1000; display: flex; background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-md); box-shadow: var(--shadow-md); overflow: hidden; }
.v2-basemaps button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; font: inherit; font-weight: var(--fw-medium); padding: 8px var(--sp-4); cursor: pointer; color: var(--gray-900); }
.v2-basemaps button[aria-pressed="true"] { background: var(--ima-accent); color: var(--white); }
.v2-basemaps button:focus-visible { outline: none; box-shadow: inset var(--focus-ring); }

.v2-legend { position: absolute; left: 12px; bottom: 28px; z-index: 1000; background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: var(--sp-3) var(--sp-4); font-size: var(--text-sm); }
.v2-legend h2 { font-size: var(--text-sm); margin-bottom: var(--sp-2); }
.v2-legend div { display: flex; align-items: center; gap: var(--sp-2); }

.v2-loading { position: absolute; inset: 0; z-index: 1050; display: grid; place-items: center; background: rgba(0,46,80,.35); color: var(--white); font-weight: var(--fw-semibold); }
.v2-loading[hidden] { display: none; }

/* bolinhas no mapa */
.v2-pin-wrap { background: none; border: 0; }
.v2-pin { display: block; width: 18px; height: 18px; margin: 2px; border-radius: 50%; border: 2px solid var(--white); box-shadow: 0 1px 4px rgba(0,0,0,.55); transition: transform .12s; }
.v2-pin--proprio { background: var(--ima-accent); }
.v2-pin--improprio { background: var(--ima-red); }
.v2-pin--indet { background: var(--gray-400); }
.v2-pin-wrap:hover .v2-pin, .v2-pin-wrap:focus-visible .v2-pin { transform: scale(1.25); }
.v2-pin-wrap:focus-visible { outline: none; }
.v2-pin-wrap.is-selected .v2-pin { transform: scale(1.45); box-shadow: 0 0 0 3px var(--ima-blue), 0 1px 6px rgba(0,0,0,.6); }
.v2-me { display: block; width: 18px; height: 18px; margin: 2px; border-radius: 50%; background: var(--ima-blue); border: 3px solid var(--white); box-shadow: 0 0 0 6px rgba(0,159,227,.35); }

/* ---------- painel do ponto ---------- */
.v2-panel { position: absolute; top: 12px; right: 12px; bottom: 12px; width: 420px; z-index: 1000; background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.v2-panel[hidden] { display: none; }
.v2-panel__nav { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--gray-200); }
.v2-panel__nav .grow { flex: 1; text-align: center; font-size: var(--text-sm); color: var(--gray-600); }
.v2-panel__body { padding: var(--sp-4); overflow-y: auto; }
.v2-panel h2 { font-size: var(--text-xl); }
.v2-panel__where { color: var(--gray-600); font-size: var(--text-sm); margin: var(--sp-1) 0 var(--sp-4); }
.v2-situacao { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); border: 1px solid var(--gray-200); border-radius: var(--radius-md); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-3); }
.v2-situacao small { display: block; color: var(--gray-600); font-size: var(--text-xs); }
.v2-situacao strong { font-size: var(--text-lg); }
.v2-kpis { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.v2-kpi { border: 1px solid var(--gray-200); border-radius: var(--radius-md); padding: var(--sp-3); }
.v2-kpi small { display: block; color: var(--gray-600); font-size: var(--text-xs); }
.v2-kpi b { font-size: var(--text-md); }
.v2-panel .table-wrap { overflow-x: auto; }
.v2-panel .table thead th { padding: var(--sp-2); font-size: 10px; letter-spacing: 0; }
.v2-panel .table tbody td { padding: var(--sp-2); white-space: nowrap; font-size: var(--text-sm); }
.v2-panel .table .st { font-size: 11px; padding: 2px 8px; }
.v2-note { font-size: 11px; color: var(--gray-600); text-align: justify; margin: var(--sp-3) 0 0; }
.v2-actions { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-4); }
.v2-actions .row { display: flex; gap: var(--sp-2); }
.v2-actions .row > * { flex: 1; }
.ima a.btn, .ima a.btn:hover { color: var(--btn-fg); text-decoration: none; }
.ima a.btn.btn--outline { color: var(--ima-blue); }

.st { display: inline-flex; align-items: center; gap: 6px; font-weight: var(--fw-semibold); padding: 3px 10px; border-radius: var(--radius-pill); font-size: var(--text-sm); white-space: nowrap; }
.st--proprio { background: var(--st-proprio-bg); color: var(--st-proprio-fg); }
.st--improprio { background: var(--st-improprio-bg); color: var(--st-improprio-fg); }
.st--indet { background: var(--st-indet-bg); color: var(--st-indet-fg); }

.v2-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ima-blue-900); color: var(--white); padding: var(--sp-3) var(--sp-5); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 3000; }
.v2-toast[hidden] { display: none; }

/* ---------- dialogos (historico / relatorios) ---------- */
dialog.modal { padding: 0; border: 0; margin: auto; max-width: 460px; width: calc(100% - 32px); }
dialog.modal::backdrop { background: rgba(16,30,46,.55); }
dialog.modal .table-wrap { max-height: 50vh; overflow: auto; }

/* ---------- pagina de ponto ---------- */
.ponto-page { max-width: 860px; margin: 0 auto; padding: var(--sp-6) var(--sp-4); }
.ponto-page .card { margin-bottom: var(--sp-4); }
body.ima.ponto { overflow: auto; }

/* ---------- responsivo ---------- */
@media (max-width: 1180px) {
  .v2-top__link span { display: none; }
  .v2-top__link { padding: 0 var(--sp-3); }
}
@media (max-width: 900px) {
  .v2-top { padding: 0 var(--sp-3); gap: var(--sp-3); }
  .v2-top__btn { display: inline-flex; }
  .v2-top__title span, .v2-top__loc span { display: none; }
  .v2-top__title { padding-left: var(--sp-3); }
  .v2-top__title strong { font-size: var(--text-md); white-space: nowrap; }
  .v2-top__brand img { height: 28px; }
  .v2-top__loc { padding: 0; width: 40px; margin-left: 0; }
  .v2-top__nav { margin-left: auto; }
  .v2-filtros { position: fixed; top: var(--top-h); bottom: 0; left: 0; width: min(340px, 92vw); transform: translateX(-100%); transition: transform .2s; z-index: 1150; box-shadow: var(--shadow-lg); }
  .v2-filtros.is-open { transform: none; }
  .v2-panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 62%; }
  .v2-basemaps { left: 56px; right: 8px; }
  .v2-basemaps button { flex: 1; justify-content: center; padding: 8px var(--sp-2); }
  .v2-legend { display: none; }
  .v2-kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .v2-top__title { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.v2-block[hidden], .v2-results[hidden] { display: none; }

/* tamanho das bolinhas conforme o zoom */
.leaflet-container[data-pins="p"] .v2-pin { width: 10px; height: 10px; margin: 6px; border-width: 1.5px; }
.leaflet-container[data-pins="m"] .v2-pin { width: 14px; height: 14px; margin: 4px; }

@media (max-width: 520px) {
  .v2-top { gap: var(--sp-2); padding: 0 var(--sp-2); }
  .v2-top__link.is-active { display: none; }
  .v2-top__link { padding: 0 8px; height: 36px; }
  .v2-top__nav { gap: 0; }
  .v2-top__loc { width: 36px; height: 36px; }
  .v2-top__btn { width: 36px; height: 36px; }
  .v2-top__brand img { height: 24px; }
}

/* destaque temporario do bloco de filtros (menu Praias) */
@keyframes v2-flash { from { box-shadow: 0 0 0 3px var(--ima-accent); } to { box-shadow: 0 0 0 3px transparent; } }
.v2-block.is-flash { animation: v2-flash 1.6s ease-out; border-radius: var(--radius-md); }

/* resumo do recorte (abaixo dos filtros) */
.v2-resumo { margin-top: var(--sp-2); border: 1px solid var(--gray-200); border-radius: var(--radius-md); padding: var(--sp-3); background: var(--gray-050); }
.v2-resumo__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); font-weight: var(--fw-semibold); color: var(--ima-blue); }
.v2-resumo__pct { font-size: var(--text-md); }
.v2-resumo__split { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); margin-top: var(--sp-2); font-size: var(--text-sm); }
.v2-resumo__split span { display: inline-flex; align-items: center; gap: 4px; }
.v2-resumo small { display: block; margin-top: var(--sp-2); color: var(--gray-600); font-size: var(--text-xs); }

/* chip sobre o mapa quando ha filtro ativo (so desktop) */
.v2-chip { position: absolute; top: 12px; left: 50%; z-index: 1000; transform: translateX(-50%); display: flex; align-items: center; gap: var(--sp-2); background: var(--ima-blue); color: var(--white); border-radius: var(--radius-pill); box-shadow: var(--shadow-md); padding: 6px 6px 6px var(--sp-4); font-size: var(--text-sm); font-weight: var(--fw-medium); white-space: nowrap; }
.v2-chip[hidden] { display: none; }
.v2-chip button { width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(255,255,255,.18); color: var(--white); cursor: pointer; display: grid; place-items: center; }
.v2-chip button:hover { background: rgba(255,255,255,.3); }
.v2-chip button:focus-visible { outline: none; box-shadow: var(--focus-ring); }


/* banner: a foto e sempre reenquadrada (cover) em altura fixa */
.v2-banner { display: block; width: 100%; height: 150px; object-fit: cover; object-position: center 60%; border-radius: var(--radius-md); background: var(--gray-200); margin-bottom: var(--sp-3); }
.v2-banner--page { height: 240px; border-radius: var(--radius-md) var(--radius-md) 0 0; margin-bottom: 0; }

@media (max-width: 900px) {
  .v2-banner { height: 110px; }
  .v2-banner--page { height: 160px; }
  /* chip no celular: abaixo do seletor de camadas, largura total */
  .v2-chip { top: 58px; left: 8px; right: 8px; transform: none; justify-content: space-between; white-space: normal; border-radius: var(--radius-lg); }
}

/* celular: painel ocupa mais a tela (o mapa continua visivel acima) */
@media (max-width: 900px) {
  .v2-panel { max-height: 80%; top: auto; }
}

/* dialogo de relatorios: paginacao */
.v2-rel-tools { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-2); font-size: var(--text-sm); color: var(--gray-600); flex-wrap: wrap; }
.v2-seg { display: inline-flex; border: 1px solid var(--gray-300); border-radius: var(--radius); overflow: hidden; }
.v2-seg button { border: 0; background: var(--white); color: var(--gray-900); font: inherit; font-size: var(--text-xs); padding: 6px var(--sp-3); cursor: pointer; }
.v2-seg button[aria-pressed="true"] { background: var(--ima-accent); color: var(--white); font-weight: var(--fw-semibold); }
.v2-seg button:focus-visible { outline: none; box-shadow: inset var(--focus-ring); }
.v2-pager { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-top: var(--sp-3); font-size: var(--text-sm); }
.v2-pager[hidden] { display: none; }
dialog.modal .v2-rel-table { max-height: 46vh; }

/* barras de rolagem discretas (tokens do IMA) */
.v2-filtros, .v2-panel__body, .v2-results, .table-wrap, dialog.modal, .v2-panel .table-wrap {
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}
.v2-filtros::-webkit-scrollbar, .v2-panel__body::-webkit-scrollbar, .v2-results::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar, dialog.modal::-webkit-scrollbar { width: 8px; height: 8px; }
.v2-filtros::-webkit-scrollbar-track, .v2-panel__body::-webkit-scrollbar-track, .v2-results::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track, dialog.modal::-webkit-scrollbar-track { background: transparent; }
.v2-filtros::-webkit-scrollbar-thumb, .v2-panel__body::-webkit-scrollbar-thumb, .v2-results::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb, dialog.modal::-webkit-scrollbar-thumb {
  background: var(--gray-300); border-radius: var(--radius-pill); border: 2px solid transparent; background-clip: content-box;
}
.v2-filtros::-webkit-scrollbar-thumb:hover, .v2-panel__body::-webkit-scrollbar-thumb:hover, .v2-results::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover, dialog.modal::-webkit-scrollbar-thumb:hover { background: var(--gray-500); background-clip: content-box; }

/* ---------- faixa de indicadores (dashboard) ---------- */
.v2-kpibar {
  flex: none; display: grid; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4);
  grid-template-columns: minmax(150px, 1fr) minmax(300px, 2fr) minmax(130px, .8fr) minmax(190px, 1fr) minmax(210px, 1.2fr);
  background: var(--gray-050); border-bottom: 1px solid var(--gray-200);
}
.kpi {
  display: flex; align-items: center; gap: var(--sp-3); min-width: 0;
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-md);
  padding: var(--sp-2) var(--sp-4); text-align: left; font: inherit; color: var(--gray-900);
}
.kpi--btn { cursor: pointer; transition: border-color .14s, box-shadow .14s; }
.kpi--btn:hover { border-color: var(--ima-accent); box-shadow: var(--shadow-sm); }
.kpi--btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.kpi--wide { gap: var(--sp-4); }
.kpi__ico { width: 36px; height: 36px; border-radius: 50%; background: var(--ima-accent-050); color: var(--ima-blue); display: grid; place-items: center; flex: none; }
.kpi__txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.kpi__lbl { font-size: var(--text-xs); color: var(--gray-700); font-weight: var(--fw-medium); }
.kpi__val { font-size: var(--text-2xl); font-weight: var(--fw-bold); color: var(--ima-blue); line-height: 1.15; }
.kpi__val--improprio { color: var(--ima-red-700); }
.kpi__sub { font-size: var(--text-xs); color: var(--gray-600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi__bar { flex: 1; min-width: 0; }
.kbar { display: flex; height: 12px; border-radius: var(--radius-pill); overflow: hidden; background: var(--gray-200); }
.kbar__seg { display: block; height: 100%; transition: width .3s; }
.kbar__seg--proprio { background: var(--ima-accent); }
.kbar__seg--improprio { background: var(--ima-red); }
.kbar__seg--indet { background: var(--gray-400); }
.kbar__leg { display: flex; flex-wrap: wrap; gap: 2px var(--sp-3); margin-top: 6px; font-size: var(--text-xs); color: var(--gray-700); }
.kbar__leg .dot { width: 10px; height: 10px; border-width: 1px; margin-right: 2px; vertical-align: -1px; }

/* listas recolhiveis da lateral */
.v2-details { border: 1px solid var(--gray-200); border-radius: var(--radius-md); background: var(--white); }
.v2-details > summary { cursor: pointer; padding: var(--sp-3) var(--sp-4); font-weight: var(--fw-semibold); color: var(--ima-blue); list-style: none; display: flex; justify-content: space-between; gap: var(--sp-2); }
.v2-details > summary::-webkit-details-marker { display: none; }
.v2-details > summary::after { content: "+"; font-weight: var(--fw-regular); font-size: var(--text-lg); line-height: 1; }
.v2-details[open] > summary::after { content: "−"; }
.v2-details > summary:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-md); }
.v2-details__n { color: var(--gray-600); font-weight: var(--fw-regular); margin-left: auto; }
.v2-details__body { display: flex; flex-direction: column; gap: 2px; padding: 0 var(--sp-2) var(--sp-2); max-height: 280px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--gray-300) transparent; }
.v2-li { width: 100%; text-align: left; border: 0; background: none; font: inherit; font-size: var(--text-sm); padding: 6px var(--sp-2); border-radius: var(--radius); cursor: pointer; color: var(--gray-900); }
.v2-li:hover, .v2-li:focus-visible { background: var(--ima-accent-050); outline: none; }
.v2-li small { display: block; color: var(--gray-600); font-size: var(--text-xs); }
.v2-empty { margin: 0; padding: var(--sp-2); font-size: var(--text-sm); color: var(--gray-600); }

/* legenda do mapa com contagens */
.v2-legend b { margin-left: auto; padding-left: var(--sp-3); color: var(--ima-blue); }
.v2-legend div { min-width: 150px; }

/* ---------- bandeiras (zoom alto) e bolinhas (zoom baixo) ---------- */
.v2-pin-wrap { width: 26px; height: 28px; }
.v2-pin { position: absolute; left: calc(6px - 9px); top: calc(26px - 9px); margin: 0; }
.v2-flag { position: absolute; inset: 0; width: 26px; height: 28px; display: none; overflow: visible; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .55)); }
.v2-flag__pole { fill: none; stroke: var(--white); stroke-width: 3.2; stroke-linecap: round; }
.v2-flag__cloth { stroke: var(--white); stroke-width: 1.6; stroke-linejoin: round; }
.v2-flag--proprio .v2-flag__cloth { fill: var(--ima-accent); }
.v2-flag--improprio .v2-flag__cloth { fill: var(--ima-red); }
.v2-flag--indet .v2-flag__cloth { fill: var(--gray-400); }
.v2-flag--proprio .v2-flag__pole { stroke: var(--ima-blue); stroke-width: 1.8; }
.v2-flag--improprio .v2-flag__pole { stroke: var(--ima-red-700); stroke-width: 1.8; }
.v2-flag--indet .v2-flag__pole { stroke: var(--gray-700); stroke-width: 1.8; }
.leaflet-container[data-pins="f"] .v2-pin { display: none; }
.leaflet-container[data-pins="f"] .v2-flag { display: block; }
.leaflet-container[data-pins="p"] .v2-pin { left: calc(6px - 5px); top: calc(26px - 5px); margin: 0; }
.leaflet-container[data-pins="m"] .v2-pin { left: calc(6px - 7px); top: calc(26px - 7px); margin: 0; }
.v2-pin-wrap.is-selected .v2-flag { transform: scale(1.25); transform-origin: 6px 26px; filter: drop-shadow(0 0 3px var(--ima-blue)) drop-shadow(0 1px 3px rgba(0, 0, 0, .6)); }

/* indicadores em telas menores: carrossel horizontal */
@media (max-width: 1180px) {
  .v2-kpibar { display: flex; overflow-x: auto; scrollbar-width: thin; scroll-snap-type: x proximity; }
  .kpi { flex: none; min-width: 170px; scroll-snap-align: start; }
  .kpi--wide { min-width: 300px; }
}
@media (max-width: 900px) {
  .v2-kpibar { padding: var(--sp-2) var(--sp-3); gap: var(--sp-2); }
  .kpi__val { font-size: var(--text-xl); }
}

/* bandeiras em todos os zooms (menores quando ha muitos pontos na tela) */
.leaflet-container .v2-pin { display: none !important; }
.leaflet-container .v2-flag { display: block !important; transform-origin: 6px 26px; }
.leaflet-container[data-pins="p"] .v2-flag { transform: scale(.55); }
.leaflet-container[data-pins="m"] .v2-flag { transform: scale(.8); }
.leaflet-container[data-pins="f"] .v2-flag { transform: scale(1); }
.v2-pin-wrap.is-selected .v2-flag { transform: scale(1.3) !important; }
.v2-flag-mini { vertical-align: -3px; overflow: visible; }
.v2-flag-mini .v2-flag__pole { stroke-width: 2.2; }
.v2-flag-mini .v2-flag__cloth { stroke-width: 1.2; }

/* banner do painel: mini-mapa de satelite (ou foto real) */
.v2-banner { position: relative; display: block; width: 100%; height: 150px; border-radius: var(--radius-md); overflow: hidden; background: var(--gray-200); margin-bottom: var(--sp-3); }
.v2-banner #p-minimapa, .v2-banner > img { position: absolute; inset: 0; width: 100%; height: 100%; }
.v2-banner > img { object-fit: cover; object-position: center 60%; }
.v2-banner [hidden] { display: none; }
.v2-banner__credito { position: absolute; right: 6px; bottom: 4px; z-index: 500; font-size: 10px; color: var(--white); text-shadow: 0 1px 2px rgba(0, 0, 0, .8); pointer-events: none; }
.v2-banner.has-foto .v2-banner__credito { display: none; }
.v2-banner .leaflet-container { background: var(--gray-200); }

/* ---------- indicadores no celular: faixa compacta (3 principais) + 'mais indicadores' ---------- */
.kpi-mais { display: none; }
@media (max-width: 900px) {
  .v2-kpibar { display: grid; grid-template-columns: .9fr 1.5fr .9fr; gap: var(--sp-2); overflow: visible; padding: var(--sp-2); }
  .kpi { min-width: 0; padding: var(--sp-2); gap: var(--sp-2); flex-direction: column; align-items: flex-start; justify-content: center; }
  .kpi__ico { display: none; }
  .kpi__lbl { font-size: 11px; }
  .kpi__val { font-size: var(--text-xl); }
  .kpi__sub { font-size: 11px; white-space: normal; }
  .kpi--wide { align-items: stretch; gap: 4px; }
  .kpi--wide .kpi__txt { flex-direction: row; align-items: baseline; flex-wrap: wrap; column-gap: var(--sp-2); }
  .kpi--wide .kpi__sub { display: none; }
  .kpi__bar { width: 100%; flex: none; }
  .kbar { height: 8px; }
  .kbar__leg { display: none; }
  .kpi--extra { display: none; }
  .v2-kpibar.is-open .kpi--extra { display: flex; grid-column: span 3; }
  .kpi-mais { display: block; grid-column: 1 / -1; border: 0; background: none; color: var(--ima-accent-600); font: inherit; font-size: var(--text-xs); font-weight: var(--fw-semibold); text-align: center; padding: 2px; cursor: pointer; }
  .kpi-mais:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius); }
}

@media (max-width: 900px) { #k-total-sub { display: none; } }

/* ---------- convite para instalar o aplicativo (PWA) ---------- */
.pwa-faixa { position: fixed; left: var(--sp-3); right: var(--sp-3); bottom: var(--sp-3); z-index: 2000; max-width: 520px; margin: 0 auto;
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; padding: var(--sp-3) var(--sp-4);
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.pwa-faixa__txt { flex: 1 1 220px; margin: 0; font-size: var(--text-sm); color: var(--ima-blue); }

/* ---------- aviso de cookies ---------- */
.cookie-faixa { position: fixed; left: var(--sp-3); right: var(--sp-3); bottom: var(--sp-3); z-index: 2100; max-width: 620px; margin: 0 auto;
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; padding: var(--sp-3) var(--sp-4);
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.cookie-faixa__txt { flex: 1 1 280px; margin: 0; font-size: var(--text-sm); color: var(--ima-blue); }

/* ---------- favoritos ---------- */
.btn.is-fav { color: var(--ima-accent-600); border-color: var(--ima-accent); }
.btn.is-fav svg { fill: currentColor; }
.fav-acoes { display: flex; gap: var(--sp-1); flex-wrap: wrap; justify-content: flex-end; }
#dlg-favoritos small { color: var(--gray-600); }
#dlg-favoritos { width: min(760px, 94vw); max-width: none; }
#dlg-favoritos td:nth-child(2), #dlg-favoritos td:nth-child(3) { white-space: nowrap; }
#dlg-favoritos .v2-rel-table { max-height: 52vh; }
@media (max-width: 600px) { .fav-acoes { flex-direction: column; align-items: stretch; } #dlg-favoritos th, #dlg-favoritos td { padding-left: var(--sp-2); padding-right: var(--sp-2); } }
@media (max-width: 600px) {
  #dlg-favoritos thead { display: none; }
  #dlg-favoritos table, #dlg-favoritos tbody { display: block; }
  #dlg-favoritos tr { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-2); border-bottom: 1px solid var(--gray-200); }
  #dlg-favoritos td { display: block; padding: 0; border: 0; }
  #dlg-favoritos td:nth-child(1) { grid-column: 1 / -1; }
  #dlg-favoritos td:nth-child(3) { text-align: right; }
  #dlg-favoritos td:nth-child(4) { grid-column: 1 / -1; }
  .fav-acoes { flex-direction: row; justify-content: flex-start; }
}

/* ---------- grafico de evolucao (pagina do ponto) ---------- */
.serie-filtros { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.serie-data { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--text-sm); color: var(--gray-600); }
.serie-data .input { width: auto; }
.serie-resumo { margin: 0 0 var(--sp-2); font-size: var(--text-sm); color: var(--gray-600); }
.serie-grupo { border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--white); overflow: hidden; }
.serie-g { position: relative; }
.serie-g + .serie-g { border-top: 1px solid var(--gray-200); }
.serie-g--ecoli { height: 230px; }
.serie-g--temp { height: 170px; }
.serie-g--mare { height: 120px; }
.serie-leg { display: flex; flex-direction: column; gap: var(--sp-1); margin-top: var(--sp-3); font-size: var(--text-sm); color: var(--gray-600); }
.serie-leg__grupo { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--sp-3); }
.serie-leg__grupo b { min-width: 86px; color: var(--ima-blue); }
.serie-leg__item { display: inline-flex; align-items: center; gap: 4px; margin-right: 6px; }
.serie-leg__m { display: inline-block; min-width: 12px; height: 12px; border-radius: 2px; font-style: normal; line-height: 12px; text-align: center; }
@media (max-width: 600px) { .serie-g--ecoli { height: 200px; } .serie-g--temp { height: 150px; } .serie-g--mare { height: 110px; } .serie-leg__grupo b { min-width: 100%; } .serie-data .input { width: 9.5em; } }
.ponto-page .card__foot { flex-wrap: wrap; }
.v2-mini-graf { position: relative; height: 180px; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: var(--sp-1); }

/* ---------- video de apresentacao ---------- */
#dlg-video { width: min(900px, 94vw); max-width: none; }
#dlg-video.is-vertical { width: min(400px, 92vw); }
.video-corpo { padding: 0; background: #fff; }
.video-corpo video { display: block; width: 100%; height: auto; max-height: 72vh; background: #fff; }
#dlg-video.is-vertical .video-corpo video { max-height: 68vh; margin: 0 auto; }
.video-rodape { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.video-check { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--text-sm); color: var(--gray-600); cursor: pointer; }
.video-check input { width: 18px; height: 18px; accent-color: var(--ima-blue); }
.video-corpo { position: relative; }
.video-som { position: absolute; top: var(--sp-2); right: var(--sp-2); box-shadow: var(--shadow-md); }
.video-som[hidden] { display: none; }
.v2-video-btn { width: 100%; margin-top: var(--sp-3); justify-content: center; }
