html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Barra azul do topo */
#header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: auto;
  background-color: #003b73;
  color: #ffffff;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  z-index: 1000;
  font-size: 14px;
}

.header-side {
  min-width: 0;
}

.header-side--right {
  justify-self: end;
  display: flex;
  justify-content: flex-end;
}

.header-center {
  display: flex;
  justify-content: center;
}

.title_logo {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

#header-subtitle {
  margin-left: 12px;
  font-size: 12px;
  opacity: 0.9;
}

#map {
  position: absolute;
  top: 0px;
  left: 0;
  right: 0;
  bottom: 0;
}

/* Toolbar compacta (overlay no topo esquerdo do mapa)
   Reaproveita o mesmo padrao visual da .toolbar antiga. */
.compact-map-toolbar {
  position: fixed;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #999;
  border-radius: 0;
  box-shadow: none;
  cursor: grab;
  user-select: none;
  inset: 80px auto auto 12px;
  touch-action: none;
}

.compact-map-toolbar.is-dragging {
  cursor: grabbing;
}

/* Docking horizontal (na borda inferior ou superior):
   a toolbar vira uma linha; separadores ficam verticais. */
.compact-map-toolbar.docked-bottom,
.compact-map-toolbar.docked-top {
  flex-direction: row;
  align-items: center;
  inset: auto auto auto auto;     /* zera o inset original (esquerda) */
  max-width: calc(100vw - 24px);
  overflow-x: auto;
  overflow-y: hidden;
}

/* Quando horizontal, os <hr> separadores ficam verticais finos */
.compact-map-toolbar.docked-bottom .compact-toolbar-sep,
.compact-map-toolbar.docked-top    .compact-toolbar-sep {
  border-top: none;
  border-left: 1px solid #ccc;
  width: 0;
  height: 22px;
  margin: 0 2px;
}

.compact-toolbar-sep {
  border: none;
  border-top: 1px solid #ccc;
  margin: 2px 0;
}

.compact-toolbar-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  margin-top: 0 !important;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  text-align: center;
  cursor: pointer;
}

.compact-toolbar-btn:hover {
  background: #dcdcdc;
}

.compact-toolbar-btn:focus-visible {
  outline: 2px solid #2f75bd;
  outline-offset: 1px;
}

.compact-toolbar-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Barra de edição contextual (modo edição) — mesmo visual da toolbar compacta,
   porém horizontal e centralizada no topo. Os botões reutilizam .compact-toolbar-btn. */
.edit-toolbar {
  position: fixed;
  z-index: 1150;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #999;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  user-select: none;
  max-width: calc(100vw - 24px);
}
.edit-toolbar.hidden { display: none; }

/* Cabeçalho da barra: alça de arraste (esquerda) + botão fechar (direita).
   Fica acima das ferramentas para destacar o fechamento. */
.edit-toolbar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: move;
  padding: 0 2px 2px;
  border-bottom: 1px solid #e3e3e3;
  position: relative;      /* âncora do grupo central absoluto */
  min-height: 34px;        /* acomoda os botões (34px) do grupo central */
}
/* Grupo de ferramentas de vértice/verificação centralizado no topo da barra */
.edit-toolbar-header-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 4px;
}
.edit-toolbar-grip {
  font-size: 13px;
  font-weight: 600;
  color: #777;
  letter-spacing: 1px;
  cursor: move;
  white-space: nowrap;
}
.edit-toolbar-close {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border: none;
  border-radius: 50%;
  background: #e74c3c;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  transition: background 0.15s ease;
}
.edit-toolbar-close:hover { background: #c0392b; }

/* Fileira de ferramentas (rola na horizontal quando faltar espaço) */
.edit-toolbar-tools {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

/* Separadores verticais finos entre grupos de ferramentas */
.edit-toolbar-sep {
  border: none;
  border-left: 1px solid #ccc;
  width: 0;
  height: 22px;
  margin: 0 3px;
  align-self: center;
  flex: 0 0 auto;
}

/* Seletor de camada embutido na barra */
.edit-toolbar-select {
  height: 32px;
  max-width: 150px;
  padding: 0 6px;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  flex: 0 0 auto;
}

/* ===== Swipe (comparacao de camadas) ===== */
#swipeDivider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  z-index: 600;
  cursor: ew-resize;
  pointer-events: auto;
}
.swipe-divider-handle {
  position: absolute;
  top: 50%;
  left: -15px;
  width: 30px;
  height: 30px;
  margin-top: -15px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #2f75bd;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  cursor: ew-resize;
}
.swipe-divider-handle::before {
  content: "\21D4"; /* setas esquerda-direita */
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #2f75bd;
}

.swipe-panel {
  position: absolute;
  top: 56px;
  left: 50%;
  margin-left: -160px;
  width: 320px;
  max-width: 90vw;
  background: #ffffff;
  border: 1px solid #c7c7c7;
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  z-index: 1200;
  font-size: 13px;
  overflow: hidden;
}
.swipe-panel.hidden { display: none; }
.swipe-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #003b73;
  color: #fff;
  font-weight: 600;
}
.swipe-panel-header button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
}
.swipe-panel-hint {
  padding: 8px 12px;
  color: #555;
  font-size: 12px;
  line-height: 1.4;
  border-bottom: 1px solid #eee;
}
.swipe-layer-list {
  max-height: 320px;
  overflow-y: auto;
}
.swipe-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid #f0f0f0;
}
.swipe-row-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.swipe-row-btns { display: flex; gap: 2px; }
.swipe-side-btn {
  width: 28px;
  height: 26px;
  border: 1px solid #c7c7c7;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.swipe-side-btn:hover { background: #e2e2e2; }
.swipe-side-btn.active {
  background: #2f75bd;
  color: #fff;
  border-color: #2f75bd;
}
.swipe-panel-footer {
  padding: 8px 12px;
  border-top: 1px solid #eee;
}
.swipe-suggest-btn {
  width: 100%;
  padding: 6px;
  border: 1px solid #2f75bd;
  background: #eef5fc;
  color: #2f75bd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.swipe-suggest-btn:hover { background: #ddeaf8; }

/* ===== Modulo de Irregularidades ===== */
#irregPanel {
  position: absolute;
  top: 80px;
  left: 50%;
  margin-left: -210px;
  width: 420px;
  min-width: 320px;
  max-width: 92vw;
  max-height: 70vh;
  background: #fff;
  border: 1px solid #c7c7c7;
  border-radius: 8px;
  box-shadow: 0 4px 22px rgba(0,0,0,0.30);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 13px;
}
#irregPanel.hidden { display: none; }

.irreg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #003b73;
  color: #fff;
  font-weight: 600;
  user-select: none;
}
.irreg-header button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
}
.irreg-counter-wrap { font-weight: 400; opacity: 0.85; margin-left: 4px; }

.irreg-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.irreg-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
}
.irreg-scan-btn {
  padding: 6px 14px;
  border: 1px solid #2f75bd;
  background: #2f75bd;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.irreg-scan-btn:hover { background: #245a92; }
.irreg-scan-btn:disabled {
  background: #aaa;
  border-color: #aaa;
  cursor: wait;
}
.irreg-hint {
  color: #666;
  font-size: 11px;
  flex: 1;
  line-height: 1.3;
}

.irreg-list {
  overflow-y: auto;
  flex: 1;
}
.irreg-empty {
  padding: 16px;
  text-align: center;
  color: #777;
  font-style: italic;
}
.irreg-empty.irreg-error { color: #c0392b; font-style: normal; }

.irreg-row {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
}
.irreg-row:hover { background: #fafbfc; }

.irreg-row-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.irreg-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.irreg-row-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.irreg-row-meta {
  margin-top: 3px;
  color: #555;
  font-size: 12px;
}

.irreg-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.irreg-badge-notif { background: #d6e4ff; color: #1d3a8a; }
.irreg-badge-ign   { background: #e7e7e7; color: #555; }

/* Popup do marcador "?" */
.irreg-popup {
  position: relative;
  min-width: 240px;
  max-width: 320px;
  background: #fff;
  border: 1px solid #c7c7c7;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  padding: 10px 12px 12px;
  font-size: 12px;
  color: #222;
  pointer-events: auto;
}
.irreg-popup.hidden { display: none; }
.irreg-popup::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  margin-left: -8px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #fff;
  filter: drop-shadow(0 1px 0 #c7c7c7);
}
.irreg-popup-close {
  position: absolute;
  top: 4px;
  right: 6px;
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #888;
  line-height: 1;
}
.irreg-popup-close:hover { color: #222; }
.irreg-popup-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding-right: 14px;
}
.irreg-popup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin: 4px 0;
}
.irreg-popup-table td {
  padding: 2px 4px;
}
.irreg-popup-table td:first-child { color: #666; }
.irreg-popup-table td:last-child  { text-align: right; font-weight: 600; }
.irreg-popup-meta {
  font-size: 11px;
  color: #444;
  margin: 4px 0;
}
.irreg-popup-footer {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}
.irreg-popup-pdf {
  padding: 5px 12px;
  background: #003b73;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}
.irreg-popup-pdf:hover { background: #002550; }

/* Acoes por linha (Etapa 3): Editar / Localizar / Excluir */
.irreg-row-actions {
  margin-top: 6px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.irreg-act {
  padding: 3px 8px;
  border: 1px solid #c7c7c7;
  background: #f5f5f5;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  color: #333;
}
.irreg-act:hover { background: #e2e2e2; }
.irreg-btn-edit:hover   { background: #fff7d6; border-color: #b39600; }
.irreg-btn-locate:hover { background: #e7f1ff; border-color: #2f75bd; }
.irreg-btn-del:hover    { background: #fde2e2; border-color: #c0392b; }

/* Mini-form de edicao inline */
.irreg-edit-form {
  margin-top: 8px;
  padding: 8px;
  background: #fafbfc;
  border: 1px solid #d8dde3;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.irreg-edit-label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  color: #555;
  font-weight: 600;
  gap: 3px;
}
.irreg-edit-label input,
.irreg-edit-label textarea {
  font: inherit;
  font-weight: normal;
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid #c7c7c7;
  border-radius: 3px;
  background: #fff;
}
.irreg-edit-label textarea { resize: vertical; min-height: 38px; }
.irreg-edit-hint { font-weight: normal; color: #888; font-size: 10px; }
.irreg-edit-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #333;
  padding: 4px 0;
  cursor: pointer;
  user-select: none;
}
.irreg-edit-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #003b73;
}
.irreg-edit-check b { color: #003b73; }

/* ===== Processos Digitais (lado cidadao no toolbar) ===== */
.toolbar-pd-wrap {
  border: 1px solid #d8dde3;
  border-radius: 4px;
  background: #fbfcfd;
  margin: 4px 0 8px;
  overflow: hidden;
}
.toolbar-pd-wrap.hidden { display: none; }

/* Painel flutuante de Processos Digitais */
.pd-float-panel {
  position: fixed;
  top: 90px;
  left: 280px;
  width: 360px;
  max-height: 560px;
  background: #fff;
  border: 1px solid #003b73;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .25), 0 0 0 1px rgba(0, 59, 115, .1);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  resize: both;
  overflow: hidden;
  min-width: 280px;
  min-height: 240px;
}
.pd-float-panel.hidden { display: none; }
.pd-float-head {
  background: #003b73;
  color: #fff;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  user-select: none;
  border-radius: 7px 7px 0 0;
}
.pd-float-close {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  padding: 0 4px;
  line-height: 1;
  opacity: .85;
}
.pd-float-close:hover { opacity: 1; }
.pd-float-panel .toolbar-pd-list {
  flex: 1;
  max-height: none;
}
.toolbar-pd-tabs {
  display: flex;
  border-bottom: 1px solid #d8dde3;
  background: #eef2f7;
}
.toolbar-pd-tabs button {
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: #555;
  border-bottom: 2px solid transparent;
}
.toolbar-pd-tabs button.active {
  color: #003b73;
  background: #fff;
  border-bottom-color: #003b73;
}
.toolbar-pd-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
  font-size: 12px;
}
.toolbar-pd-list.hidden { display: none; }
.pd-li-empty {
  color: #999;
  font-style: italic;
  padding: 12px 8px;
  text-align: center;
  font-size: 11px;
}
.pd-li-err { color: #c0392b; font-style: normal; }
.pd-li-group { margin-bottom: 4px; }
.pd-li-cat {
  font-size: 10px;
  text-transform: uppercase;
  color: #003b73;
  font-weight: 700;
  padding: 4px 6px 2px;
  letter-spacing: .4px;
}
.pd-li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 3px;
  cursor: pointer;
  margin-bottom: 1px;
}
.pd-li:hover { background: #e7f1ff; }
.pd-li-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pd-li-nome {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pd-li-min {
  padding: 6px 8px;
  border-bottom: 1px solid #f0f0f0;
}
.pd-li-min:hover { background: #f5f7fa; }
.pd-li-min-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.pd-li-min-tit {
  font-size: 11px;
  color: #444;
  margin: 2px 0 0 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pd-li-min-meta {
  display: flex;
  gap: 8px;
  font-size: 10px;
  color: #666;
  margin-top: 3px;
}

/* Assunto editavel no detalhe (apenas rascunho + solicitante) */
.pd-det-assunto { margin-bottom: 10px; }
.pd-det-assunto label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #333;
  margin-bottom: 3px;
}
.pd-det-assunto input {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 13px;
  padding: 7px 8px;
  border: 1px solid #c7c7c7;
  border-radius: 3px;
}
.pd-pill {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.pd-status-rascunho     { background: #eee;       color: #555; }
.pd-status-em_andamento { background: #d6e4ff;    color: #1d3a8a; }
.pd-status-deferido     { background: #d6f5d6;    color: #195a19; }
.pd-status-indeferido   { background: #fde2e2;    color: #851515; }
.pd-status-arquivado    { background: #e7e7e7;    color: #555; }
.pd-status-cancelado    { background: #f0d6ff;    color: #5a195a; }

/* Modal de solicitacao */
.pd-sol-modal { max-width: 520px; }
.pd-sol-modal input, .pd-sol-modal textarea {
  font: inherit;
  font-size: 13px;
  font-weight: normal;
  padding: 7px 8px;
  border: 1px solid #c7c7c7;
  border-radius: 3px;
  width: 100%;
  box-sizing: border-box;
}
.pd-sol-modal input[type="file"] {
  padding: 5px;
}
.pd-sol-modal textarea { resize: vertical; min-height: 60px; }
.pd-sol-modal label {
  font-size: 12px;
  font-weight: 600;
  color: #333;
}
.pd-sol-modal .btn-primary {
  background: #003b73;
  color: #fff;
  border: 1px solid #003b73;
  padding: 8px 14px;
  border-radius: 3px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}
.pd-sol-modal .btn-primary:hover { background: #002b54; }

/* ===== PdFormRenderer (renderizador dinamico de formularios) ===== */
.pdfr-form { font-size: 13px; }
.pdfr-titulo {
  font-size: 14px; font-weight: 700; color: #003b73;
  margin-bottom: 4px;
}
.pdfr-descricao {
  font-size: 12px; color: #666; margin-bottom: 10px;
}
.pdfr-campos {
  display: flex; flex-direction: column; gap: 10px;
}
.pdfr-campo { display: flex; flex-direction: column; gap: 3px; }
.pdfr-campo.pdfr-ro input,
.pdfr-campo.pdfr-ro textarea,
.pdfr-campo.pdfr-ro select {
  background: #f5f5f5; color: #555; cursor: not-allowed;
}
.pdfr-label { font-weight: 600; color: #003b73; font-size: 12px; }
.pdfr-req { color: #c0392b; }
.pdfr-hint { font-size: 10px; color: #888; }
.pdfr-campo input,
.pdfr-campo textarea,
.pdfr-campo select {
  font: inherit; padding: 6px 8px;
  border: 1px solid #c7c7c7; border-radius: 3px; background: #fff;
}
.pdfr-campo textarea { resize: vertical; min-height: 50px; }
.pdfr-opt-radio, .pdfr-opt-check {
  display: block; font-size: 12px; color: #333; padding: 2px 0;
  font-weight: 400;
}
.pdfr-divisor { border: none; border-top: 1px solid #d0d8e2; margin: 6px 0; }
.pdfr-html {
  font-size: 12px; color: #444; background: #fffbe6;
  border-left: 3px solid #f5a623; padding: 6px 10px; border-radius: 0 3px 3px 0;
}
.pdfr-empty {
  font-style: italic; color: #888; text-align: center;
  padding: 16px 8px; font-size: 12px;
}

/* ===== Modal de DETALHE da solicitacao (cidadao + analista) ===== */
.pd-det-modal .modal-box {
  width: 720px; max-width: 96vw; max-height: 92vh;
  display: flex; flex-direction: column;
}
.pd-det-head-meta {
  display: flex; flex-wrap: wrap; gap: 10px;
  background: #eef2f7; padding: 8px 14px;
  border-bottom: 1px solid #d8dde3;
  font-size: 12px;
}
.pd-det-head-meta b { color: #003b73; }
.pd-det-tabs {
  display: flex; gap: 0; padding: 0 14px;
  border-bottom: 1px solid #d8dde3; background: #fafbfc;
}
.pd-det-tabs button {
  background: transparent; border: none; padding: 8px 14px;
  font-size: 12px; cursor: pointer; color: #555;
  border-bottom: 2px solid transparent; font-weight: 600;
}
.pd-det-tabs button.active {
  color: #003b73; border-bottom-color: #003b73;
}
.pd-det-body {
  padding: 14px 16px; overflow-y: auto; flex: 1;
}
.pd-det-body.hidden { display: none; }

.pd-det-hist-item {
  border-left: 3px solid #003b73; padding: 6px 10px;
  background: #fbfcfd; margin-bottom: 6px; border-radius: 0 3px 3px 0;
}
.pd-det-hist-acao { font-weight: 700; color: #003b73; font-size: 12px; }
.pd-det-hist-meta { font-size: 11px; color: #888; }
.pd-det-hist-parecer { font-size: 12px; color: #333; margin-top: 4px; padding: 5px; background: #fff; border: 1px solid #eee; border-radius: 3px; }

.pd-det-foot {
  display: flex; gap: 8px; justify-content: space-between;
  align-items: center; padding: 10px 14px; border-top: 1px solid #eee;
  background: #fafbfc;
}
.pd-det-foot-actions { display: flex; gap: 6px; }
.pd-det-foot button {
  padding: 5px 12px; font-size: 12px; border-radius: 3px;
  cursor: pointer; font-weight: 600;
}
.pd-det-foot .btn-primary {
  background: #003b73; color: #fff; border: 1px solid #003b73;
}
.pd-det-foot .btn-primary:hover { background: #002550; }
.pd-det-foot .btn-tramitar { background: #2c8a4d; color: #fff; border: 1px solid #2c8a4d; }
.pd-det-foot .btn-tramitar:hover { background: #1f6537; }
.pd-det-foot .btn-secondary { background: #eee; border: 1px solid #c7c7c7; color: #333; }
.pd-det-foot .btn-danger { background: #c0392b; color: #fff; border: 1px solid #c0392b; }

.pd-det-parecer-box {
  margin-top: 10px; padding: 8px;
  background: #fbfcfd; border: 1px solid #d8dde3; border-radius: 3px;
}
.pd-det-parecer-box textarea {
  width: 100%; font: inherit; padding: 5px 8px;
  border: 1px solid #c7c7c7; border-radius: 3px; min-height: 50px; resize: vertical;
}

/* Badge nas tabs */
.pd-tab-badge {
  display: inline-block; margin-left: 4px;
  background: #c0392b; color: #fff;
  font-size: 9px; padding: 1px 6px; border-radius: 10px; font-weight: 700;
}
.pd-tab-badge.hidden { display: none; }

/* Mensagens (chat) */
.pd-msg-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 320px; overflow-y: auto; padding-bottom: 8px;
}
.pd-msg-item {
  padding: 6px 10px; border-radius: 8px; max-width: 80%;
  font-size: 12px; line-height: 1.4;
}
.pd-msg-item.mine { background: #d6e4ff; align-self: flex-end; }
.pd-msg-item.other { background: #f0f0f0; align-self: flex-start; }
.pd-msg-item.privada { border: 1px dashed #f5a623; background: #fffbe6; }
.pd-msg-meta { font-size: 10px; color: #666; margin-bottom: 2px; }
.pd-msg-privada-tag {
  background: #f5a623; color: #fff; font-size: 9px; padding: 1px 5px;
  border-radius: 6px; margin-left: 4px; font-weight: 700; text-transform: uppercase;
}
.pd-msg-form {
  display: grid; grid-template-columns: 1fr auto; gap: 6px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid #eee;
  grid-template-areas: "priv priv" "txt btn";
}
.pd-msg-privada { grid-area: priv; font-size: 11px; display: flex; align-items: center; gap: 4px; }
.pd-msg-privada.hidden { display: none; }
.pd-msg-privada input[type="checkbox"] { accent-color: #003b73; }
.pd-msg-form textarea {
  grid-area: txt; font: inherit; padding: 5px 8px;
  border: 1px solid #c7c7c7; border-radius: 3px; resize: vertical; min-height: 38px;
}
.pd-msg-form button { grid-area: btn; padding: 5px 14px; }

/* Anexos */
.pd-anx-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 280px; overflow-y: auto;
}
.pd-anx-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; background: #fafbfc; border: 1px solid #d8dde3;
  border-radius: 3px; font-size: 12px;
}
.pd-anx-info { flex: 1; }
.pd-anx-nome { font-weight: 600; color: #003b73; }
.pd-anx-meta { font-size: 10px; color: #666; }
.pd-anx-actions { display: flex; gap: 4px; }
.pd-anx-actions a, .pd-anx-actions button {
  text-decoration: none; padding: 3px 8px;
  font-size: 11px; border-radius: 3px; cursor: pointer; font-weight: 600;
  border: 1px solid #c7c7c7; background: #fff; color: #333;
}
.pd-anx-actions a.dl { background: #003b73; color: #fff; border-color: #003b73; }
.pd-anx-actions button.del { color: #c0392b; }
.pd-anx-form {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid #eee;
}
.pd-anx-form input, .pd-anx-form button {
  font: inherit; font-size: 12px; padding: 6px 8px;
  border: 1px solid #c7c7c7; border-radius: 3px;
}
.pd-anx-form input[type="file"] {
  padding: 4px;
}
.pdfr-filelist {
  display: flex; flex-direction: column; gap: 4px; margin-top: 4px;
}
.pdfr-campo input[type="file"] {
  font-size: 12px; padding: 5px 6px;
}
.pdfr-map-pick {
  padding: 6px 12px; background: #003b73; color: #fff; border: 1px solid #003b73;
  border-radius: 3px; cursor: pointer; font-size: 11px; font-weight: 600;
}
.pdfr-map-pick:hover { background: #002550; border-color: #002550; }
.pdfr-map-pick:disabled { background: #ccc; border-color: #ccc; cursor: not-allowed; }

/* Inbox modal */
.pd-inbox-modal { width: 980px; max-width: 96vw; max-height: 90vh; display: flex; flex-direction: column; }
.pd-inbox-filters {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid #d8dde3; background: #fbfcfd;
  flex-wrap: wrap;
}
.pd-inbox-filters select, .pd-inbox-filters input {
  font: inherit; padding: 5px 8px;
  border: 1px solid #c7c7c7; border-radius: 3px;
}
.pd-inbox-filters input { flex: 1; min-width: 200px; }
.pd-inbox-list {
  overflow-y: auto; flex: 1; padding: 8px;
}
.pd-inbox-row {
  padding: 8px 12px; border-bottom: 1px solid #eee; cursor: pointer;
  display: grid; grid-template-columns: 110px 1fr 100px 90px;
  gap: 8px; align-items: center; font-size: 12px;
}
.pd-inbox-row:hover { background: #e7f1ff; }
.pd-inbox-row b { color: #003b73; }
.pd-inbox-prot { font-weight: 700; font-family: monospace; font-size: 11px; }
.pd-inbox-prazo { font-size: 10px; color: #666; }
.pd-inbox-prazo.overdue { color: #c0392b; font-weight: 700; }
.pd-inbox-empty {
  text-align: center; padding: 30px; color: #888; font-style: italic;
}

/* Transferir: lista de usuarios */
#pdTrfList .pd-user-row {
  padding: 6px 10px; border: 1px solid #d8dde3; border-radius: 3px;
  margin-bottom: 4px; cursor: pointer; font-size: 12px;
}
#pdTrfList .pd-user-row:hover { background: #e7f1ff; }
#pdTrfList .pd-user-row b { color: #003b73; }

/* Dashboard */
.pd-dash-modal {
  width: 1000px; max-width: 96vw; max-height: 90vh;
  display: flex; flex-direction: column;
}
.pd-dash-body { overflow-y: auto; padding: 16px; flex: 1; }
.pd-dash-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.pd-dash-card {
  background: #fff; border: 1px solid #d8dde3; border-radius: 5px;
  padding: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.pd-dash-card h4 { margin: 0 0 6px; color: #003b73; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.pd-dash-num { font-size: 28px; font-weight: 700; color: #003b73; }
.pd-dash-card.kpi-em      { border-top: 4px solid #2f75bd; }
.pd-dash-card.kpi-def     { border-top: 4px solid #2c8a4d; }
.pd-dash-card.kpi-indef   { border-top: 4px solid #c0392b; }
.pd-dash-card.kpi-rasc    { border-top: 4px solid #999; }

.pd-dash-section { margin-bottom: 20px; }
.pd-dash-section h3 {
  font-size: 13px; color: #003b73;
  border-bottom: 1px solid #d8dde3; padding-bottom: 4px; margin-bottom: 10px;
}
.pd-dash-bars { display: flex; flex-direction: column; gap: 4px; }
.pd-dash-bar-row {
  display: grid; grid-template-columns: 180px 1fr 40px;
  gap: 8px; align-items: center; font-size: 12px;
}
.pd-dash-bar {
  background: #eef2f7; border-radius: 3px; height: 18px; position: relative; overflow: hidden;
}
.pd-dash-bar-fill {
  height: 100%; background: #003b73;
  transition: width .3s;
}
.pd-dash-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.pd-dash-table th, .pd-dash-table td {
  padding: 6px 10px; border-bottom: 1px solid #eee; text-align: left;
}
.pd-dash-table th { background: #eef2f7; color: #003b73; }

/* Bell de notificacao no header */
#btnPDNotifs {
  font-size: 16px;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
}
#btnPDNotifs:hover { background: rgba(255,255,255,0.15); }
.pd-notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: #c0392b; color: #fff;
  font-size: 9px; font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  min-width: 14px;
  text-align: center;
  border: 1px solid #fff;
}
.pd-notif-badge.hidden { display: none; }

/* Lista de notificacoes */
.pd-notif-item {
  display: block; padding: 8px 10px;
  border-bottom: 1px solid #f0f0f0; cursor: pointer;
}
.pd-notif-item:hover { background: #f5f7fa; }
.pd-notif-item.naolida { background: #fff8e1; border-left: 3px solid #f5a623; }
.pd-notif-titulo { font-weight: 600; color: #003b73; font-size: 12px; }
.pd-notif-msg { font-size: 11px; color: #555; margin-top: 2px; }
.pd-notif-meta { font-size: 10px; color: #888; margin-top: 3px; }
.irreg-edit-buttons {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.irreg-edit-save, .irreg-edit-cancel {
  padding: 4px 12px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}
.irreg-edit-save {
  background: #2f75bd;
  border: 1px solid #2f75bd;
  color: #fff;
}
.irreg-edit-save:hover { background: #245a92; }
.irreg-edit-save:disabled { background: #aaa; border-color: #aaa; cursor: wait; }
.irreg-edit-cancel {
  background: #eee;
  border: 1px solid #c7c7c7;
  color: #444;
}
.irreg-edit-cancel:hover { background: #e2e2e2; }

/* Minimapa / OverviewMap (checklist item 23) */
.ol-overviewmap {
  left: 8px;
  bottom: 68px;
  cursor: grab;
}
.ol-overviewmap:active { cursor: grabbing; }
.ol-overviewmap .ol-overviewmap-map {
  width: 160px !important;
  height: 120px !important;
  border: 2px solid #1e40af;
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.ol-overviewmap .ol-overviewmap-box {
  border: 2px solid #ef4444;
  background: rgba(239,68,68,.12);
}
.ol-overviewmap button {
  font-size: 11px;
  width: 20px;
  height: 20px;
  line-height: 1;
  cursor: pointer;
  background: rgba(255,255,255,.92);
  border: 1px solid #aaa;
  border-radius: 2px;
}
.ol-overviewmap button:hover { background: #e5e7eb; }
@media (max-width: 600px) {
  .ol-overviewmap { display: none; }
}

/* Botões do topo (camadas / login) */
#layersButtonContainer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

#layersButtonContainer button {
  white-space: nowrap;
}


/* Botões do topo */
#btnModulo,
#btnBaixarAppHeader,
#layersButtonContainer button,
#loginButtonContainer button {
  padding: 4px 10px;
  background: #e6e6e6;
  border: 1px solid #9a9a9a;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
}

#btnModulo:hover,
#btnBaixarAppHeader:hover,
#layersButtonContainer button:hover,
#loginButtonContainer button:hover {
  background: #dcdcdc;
}

#btnBaixarAppHeader.hidden { display: none; }

.header-menu-group {
  position: relative;
  display: flex;
}

/* Estrela ao lado do nome do usuario: toggle das estrelas verdes (imoveis
   verificados em campo, com coordenadas dos limites verificadas e ART) */
#starsToggle {
  color: #ffc107;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  margin-left: 8px;
  user-select: none;
  vertical-align: middle;
}
#starsToggle:hover { filter: brightness(1.25); }
#starsToggle.stars-off { color: #9aa3af; opacity: 0.7; }

#btnModulo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-weight: 400;
}

#btnModulo.hidden {
  display: none;
}

.header-dropdown-arrow {
  font-size: 11px;
  line-height: 1;
}

.header-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 190px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid #b8c7d9;
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(0, 27, 53, 0.18);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 1300;
}

.header-dropdown-menu.hidden {
  display: none;
}

.header-dropdown-menu button {
  width: 100%;
  text-align: left;
  background: #f4f7fb !important;
  border: 1px solid #c7d5e4 !important;
  color: #003b73;
  padding: 7px 10px !important;
  font-size: 13px !important;
  font-weight: 500;
}

.header-dropdown-menu button:hover {
  background: #e7f0f8 !important;
}

/* Botão de Ferramentas (ícone engrenagem) */

#btnToggleToolbar:hover {
  background: #cfcfcf;
}


#btnToggleToolbar.toolButton--active {
  background: #cfe3f7;
  border-color: #3c80c8;
}
/* Painéis genéricos */
.panel {
  position: absolute;
  top: 40px;
  right: 20px;
  z-index: 1100;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #999;
  padding: 6px 8px;
  min-width: 150px;
  font-size: 12px;
}

.panel-title {
  font-weight: bold;
  margin-bottom: 4px;
}

/* Painel de camadas — usa o padrão modal-box */
#layersPanel {
  position: absolute;
  top: 80px;
  right: 20px;
  /* Default width aumentado para evitar quebra de linha nos itens
     (nome + contador + botao tabela + expansor de legenda + slider + %
     numa linha so). A linha "Pontos de Levantamento" tem o expansor ▾ EXTRA
     da legenda, por isso precisa de mais largura que as demais. */
  width: 480px;
  min-height: 100px;
  min-width: 360px;
  z-index: 1100;
}

.layers-body {
  overflow-y: auto;
  padding: 6px 8px;
  max-height: calc(100dvh - 180px);
  scrollbar-width: none;
}
.layers-body::-webkit-scrollbar { display: none; }

.hidden {
  display: none !important;
}

/* Login */
#loginDialog {
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  padding: 0;
  border: 1px solid #b8c7d9;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(0, 27, 53, 0.18);
}

#loginDialog .panel-title {
  margin: 0;
  padding: 6px 14px;
  background: #003b73;
  color: #fff;
  font-size: 14px;
}

#loginDialog label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 12px 14px 0;
  font-size: 12px;
  color: #29435c;
}

#loginDialog input {
  width: 100%;
  padding: 4px 10px;
  border: 1px solid #b9c6d3;
  border-radius: 4px;
  font-size: 13px;
}

#loginDialog input:focus {
  outline: none;
  border-color: #2f75bd;
  box-shadow: 0 0 0 3px rgba(47, 117, 189, 0.14);
}

#loginDialog .login-error {
  margin: 12px 14px 0;
  padding: 9px 10px;
  border: 1px solid #efb0b0;
  border-radius: 4px;
  background: #fff3f3;
  color: #9f1f1f;
  font-size: 12px;
}

#loginDialog .login-actions {
  display: flex;
  gap: 8px;
  padding: 14px;
}

#loginDialog .login-actions button {
  flex: 1;
  margin: 0;
  padding: 9px 12px;
  border-radius: 4px;
}

.area-btn {
  display: flex;
  justify-content: right;
  align-items: center;
  gap: 5px;
  margin: 12px 14px 10px;
}

#btnDoLogin {
  width: 80px;
  padding: 2px;
  background: #003b73;
  color: #fff;
  border: 1px solid #003b73;
  border-radius: 4px;

}

#btnDoLogin:hover {
  cursor: pointer;
  background: #002b53;
}

#btnCancelLogin {
  width: 80px;
  padding: 2px;
  background: #f3f5f7;
  border: 1px solid #c7d0d9;
  color: #27435d;
  border-radius: 4px;
}

#btnCancelLogin:hover {
  cursor: pointer;
  background-color: #bcc4cc;
}

/* Toolbar */
.toolbar {
  position: absolute;
  top: 80px;
  left: 60px;
  width: 210px;
  height: calc(100dvh - 130px);
  min-height: 100px;
  min-width: 160px;
  z-index: 1100;
  font-size: 12px;
}

.toolbar-body {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
  scrollbar-width: none;
}
.toolbar-body::-webkit-scrollbar { display: none; }

.toolbar button,
.toolbar input,
.toolbar select {
  width: 100%;
  margin-top: 4px;
  box-sizing: border-box;
}

/* Botão × não deve herdar width:100% do .toolbar button */
.toolbar .modal-close-btn,
#layersPanel .modal-close-btn {
  width: 28px;
  margin-top: 0;
}

.toolbar-section {
  margin-top: 6px;
}

.toolbar .toolbar-section-title {
  margin-top: 6px;
  font-weight: bold;
  font-size: 11px;
  text-align: center;
}

/* sub-caixa da busca */
.toolbar-search-box {
  border: 1px solid #c9c9c9;
  background: rgba(245, 245, 245, 0.95);
  padding: 6px;
  margin-top: 4px;
}

/* ============================================================
   Grupo de filtros/pesquisa (Tributos + Busca por lote/endereço)
   - deixa visualmente separado do resto da barra de ferramentas
============================================================ */
.toolbar-filter-container {
  border: 1px solid #c9c9c9;
  background: rgba(250, 250, 250, 0.92);
  padding: 6px;
  margin-top: 6px;
}

/* sub-caixa dos tributos */
.toolbar-pay-box {
  border: 1px solid #c9c9c9;
  background: rgba(245, 245, 245, 0.95);
  padding: 6px;
  margin-top: 4px;
}
.toolbar-pay-box label {
  display: block;
  width: 100%;
  text-align: center;
}

/* linha de botões lado-a-lado (Buscar/Limpar, Aplicar/Limpar) */
.toolbar-actions-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.toolbar-actions-row button {
  width: 50% !important;
  margin-top: 0 !important;
}


/* botão ativo (azul) */
button.btn-active {
  background-color: #003b73;
  color: #fff;
}

/* exceção: Consulta Social e Monitor CS ficam verdes quando ativos */
#btnConsultaSocial.btn-active,
#btnCadastroSocialMonitor.btn-active {
  background-color: #1a6b3a;
  color: #fff;
}

/* Painel de nova feição */
#addFeaturePanel {
  top: 80px;
  left: 260px;
  min-width: 190px;
}

#addFeaturePanel button {
  width: 100%;
  margin-top: 4px;
}

/* Status */
.status-box {
  position: absolute;
  left: 8px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  padding: 4px 6px;
  border: 1px solid #999;
  z-index: 1200;
}

#loginStatus {
  bottom: 40px;
}

#infoStatus {
  bottom: 8px;
}

/* Popup de atributos */
.popup {
  position: absolute;
  bottom: 80px;
  right: 20px;
  z-index: 1300;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #666;
  padding: 8px;
  min-width: 340px;
  max-width: 520px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.popup table {
  width: 100%;
  border-collapse: collapse;
}

.popup table td {
  border-bottom: 1px solid #ddd;
  padding: 2px 4px;
  font-size: 11px;
}

.popup input {
  width: 100%;
  box-sizing: border-box;
}

/* botão X universal nos painéis */
.popup-close-x {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: #888;
  z-index: 10;
  padding: 0 4px;
}
.popup-close-x:hover { color: #c0392b; }

/* Popup de Identificar/Editar: layout responsivo e contido */
#identifyPopup:not(.popup-new) {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  margin: 0;
  width: min(520px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: 80vh;
  padding: 10px;
  overflow: hidden;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

#identifyContent {
  width: 100%;
  max-width: 100%;
  max-height: calc(80vh - 120px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

#identifyContent table,
#identifyContent .attr-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

#identifyContent tr > td:first-child {
  width: 160px;
  vertical-align: top;
}

#identifyContent td {
  word-break: break-word;
}

#identifyContent input,
#identifyContent select,
#identifyContent textarea {
  display: block;
  width: 100%;
  max-width: 100%;
}

/* Lista de feicoes sobrepostas: sempre vertical (1 item por linha) */
#identifyContent .identify-feature-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  width: 100%;
}

#identifyContent .identify-feature-item {
  width: 100%;
  display: block;
  box-sizing: border-box;
  text-align: left;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

#identifyContent .identify-feature-item:hover {
  background: #e8f0ff;
}

/* Botões de ação gerados no rodapé do conteúdo */
#identifyContent > div[style*="display:flex"] {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px !important;
}

#identifyContent > div[style*="display:flex"] > button {
  flex: 1 1 180px;
  min-width: 0;
  max-width: 100%;
}

#btnCloseIdentify {
  width: 100%;
  margin-top: 10px;
}

/* Resultados de busca */
#searchResultsPanel {
  position: absolute;
  top: 50px;
  right: 20px;
  width: 360px;
  max-height: 380px;
  overflow-y: auto;
  z-index: 1400;
  cursor: move;
}

.results-scroll {
  max-height: 310px;
  overflow-y: auto;
  padding: 4px;
}

.search-result-item {
  padding: 6px;
  border-bottom: 1px solid #ccc;
  font-size: 12px;
  cursor: pointer;
}

.search-result-item:hover {
  background-color: #e8f0ff;
}

#btnCloseSearchResults {
  font-size: 12px;
  padding: 2px 6px;
  margin-top: -2px;
}

/* Tooltips de medida */
.ol-tooltip {
  position: relative;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 4px 8px;
  border-radius: 3px;
  white-space: nowrap;
  font-size: 11px;
}

.ol-tooltip-static {
  background: rgba(0, 0, 0, 0.7);
}

/* ============================================================
   LISTA DE CAMADAS (drag & drop)
============================================================ */
.layer-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 0 0;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  border-bottom: 1px solid #e5e5e5;
  user-select: none;
  /* Nunca quebra linha - mantem tudo (checkbox + nome + count + expansor +
     slider + %) na MESMA linha. Se nao couber, scroll horizontal sutil. */
  flex-wrap: nowrap;
  white-space: nowrap;
  min-width: 0;
}

.layer-item label {
  /* Label cresce flex pra ocupar o espaco, mas nao quebra texto */
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}

.layer-item .layer-count {
  flex: 0 0 auto; /* badge nao encolhe */
}

.layer-item .layer-cat-expander {
  flex: 0 0 auto; /* expansor de estilo nao encolhe */
}

.layer-item:last-child { border-bottom: none; }

/* Contador de feicoes (estilo QGIS) - aparece ao lado do nome */
.layer-count {
  display: inline-block;
  background: #eef2f7;
  color: #34495e;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 6px;
  min-width: 16px;
  text-align: center;
  vertical-align: middle;
  line-height: 14px;
  transition: background .2s, color .2s;
}
.layer-count.empty { background: #f2f2f2; color: #aaa; }
.layer-count.loading { background: #fff3cd; color: #856404; font-style: italic; }
.layer-count.error { background: #fdecea; color: #c0392b; }

/* Radio buttons de base — sem handle de drag, com destaque ao ativo */
.base-radio-item { padding: 5px 6px; }
.base-radio-item label { cursor: pointer; display: flex; align-items: center; gap: 6px; width: 100%; }
.base-radio-item input[type="radio"] { accent-color: #1e40af; width: 14px; height: 14px; }
.base-radio-item:has(input:checked) { background: #eff6ff; border-radius: 4px; }

/* Street View — visual separator above item */
.layer-item--streetview { border-top: 1px solid #e5e7eb; margin-top: 4px; padding-top: 4px; }

/* Slider de opacidade por camada */
.layer-item > label { flex: 1; min-width: 0; }
.layer-item--chamados > label { flex: 1 1 auto; }
.opacity-slider {
  width: 54px;
  height: 3px;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: #1e40af;
  margin-left: 2px;
}
.opacity-val {
  font-size: 10px;
  color: #9ca3af;
  min-width: 28px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* Pegman — bonequinho arrastável do Street View */
#svPegman {
  display: none;
  position: absolute;
  bottom: 90px;
  right: 10px;
  z-index: 500;
  cursor: grab;
  user-select: none;
  touch-action: none;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.55));
  transition: transform 0.15s, filter 0.15s;
}
#svPegman img { width: 30px; pointer-events: none; }
#svPegman:hover { transform: scale(1.18); filter: drop-shadow(0 3px 8px rgba(0,0,0,0.7)); }
#svPegman.sv-dragging { cursor: grabbing; opacity: 0.4; }

/* Clone do pegman durante o arraste */
#svPegmanClone {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  transform: translate(-50%, -100%);
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.7));
}
#svPegmanClone img { width: 36px; }

/* Painel Street View embutido */
#svPanel {
  display: none;
  position: fixed;
  bottom: 0;
  right: 0;
  width: 480px;
  height: 320px;
  min-width: 260px;
  min-height: 180px;
  z-index: 2000;
  flex-direction: column;
  border-top-left-radius: 8px;
  overflow: hidden;
  box-shadow: -3px -3px 20px rgba(0,0,0,0.55);
}
#svPanel.sv-panel-open { display: flex; }
#svPanelBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px 5px 10px;
  background: #1a73e8;
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  touch-action: none;
  gap: 6px;
}
#svPanelBar:hover { background: #1765cc; }
#svPanelBar:active { cursor: grabbing; background: #1558b0; }
#svPanelBar .sv-drag-dots {
  display: flex;
  flex-direction: column;
  gap: 3px;
  opacity: 0.6;
  flex-shrink: 0;
}
#svPanelBar .sv-drag-dots span {
  display: flex;
  gap: 3px;
}
#svPanelBar .sv-drag-dots span::before,
#svPanelBar .sv-drag-dots span::after {
  content: '';
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
  display: block;
}
#svPanelClose {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 8px;
  border-radius: 4px;
}
#svPanelClose:hover { background: rgba(255,255,255,0.25); }
#svResizeTop {
  position: absolute;
  top: 0; left: 8px; right: 8px;
  height: 5px;
  cursor: n-resize;
  z-index: 10;
  background: transparent;
}
#svResizeLeft {
  position: absolute;
  top: 8px; left: 0; bottom: 8px;
  width: 5px;
  cursor: w-resize;
  z-index: 10;
  background: transparent;
}
#svResizeRight {
  position: absolute;
  top: 8px; right: 0; bottom: 8px;
  width: 5px;
  cursor: e-resize;
  z-index: 10;
  background: transparent;
}
#svResizeBottom {
  position: absolute;
  left: 8px; right: 8px; bottom: 0;
  height: 5px;
  cursor: s-resize;
  z-index: 10;
  background: transparent;
}
#svResizeTL, #svResizeTR, #svResizeBL, #svResizeBR {
  position: absolute;
  width: 10px;
  height: 10px;
  z-index: 11;
  background: transparent;
}
#svResizeTL { top: 0; left: 0;  cursor: nwse-resize; }
#svResizeTR { top: 0; right: 0; cursor: nesw-resize; }
#svResizeBL { bottom: 0; left: 0;  cursor: nesw-resize; }
#svResizeBR { bottom: 0; right: 0; cursor: nwse-resize; }
#svFrame {
  flex: 1;
  width: 100%;
  min-height: 0;
  background: #222;
  overflow: hidden;
}
#svFrame iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ── Controles de Navegação (Bússola + D-pad + Zoom) ───────────────────────── */
#bgCmpWrap {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  cursor: grab;
}
#bgCmpWrap:active { cursor: grabbing; }
#bgCmpFixed, #bgCmpNeedle { display: block; }
#bgCmpNeedle { transition: transform 0.08s linear; }

/* ── D-pad de panorâmica ───────────────────────────────────────────────────── */
#bgDpad {
  position: relative;
  width: 82px;
  height: 82px;
  background: rgba(255,255,255,0.92);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.bgDpBtn {
  position: absolute;
  width: 26px;
  height: 26px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
}
.bgDpBtn:hover  { background: rgba(0,0,0,0.08); }
.bgDpBtn:active { background: rgba(0,0,0,0.18); }
#bgDpN    { top: 4px;    left: 50%; transform: translateX(-50%); }
#bgDpS    { bottom: 4px; left: 50%; transform: translateX(-50%); }
#bgDpW    { left: 4px;   top: 50%;  transform: translateY(-50%); }
#bgDpE    { right: 4px;  top: 50%;  transform: translateY(-50%); }
#bgDpCenter {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  border: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* ── Controle de Zoom ──────────────────────────────────────────────────────── */
#bgZoomCtrl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
#bgZoomIn, #bgZoomOut {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  border: none;
  box-shadow: 0 1px 5px rgba(0,0,0,0.28);
  cursor: pointer;
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
}
#bgZoomIn:hover, #bgZoomOut:hover {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.38);
}
#bgZoomTrack {
  width: 6px;
  height: 80px;
  background: #d0d0d0;
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}
#bgZoomTrack::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0; bottom: 0;
  transform: translateX(-50%);
  width: 2px;
  background: #bbb;
  border-radius: 1px;
}
#bgZoomThumb {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid #1a73e8;
  border-radius: 50%;
  left: -4px;
  cursor: grab;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  transition: box-shadow 0.1s;
}
#bgZoomThumb:active { cursor: grabbing; box-shadow: 0 2px 8px rgba(0,0,0,0.35); }

.drag-handle {
  cursor: grab;
  font-size: 14px;
  line-height: 1;
  opacity: 0.8;
}

.layer-item.dragging { opacity: 0.5; }

.layer-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
  border-bottom: 2px solid #ccc;
  cursor: pointer;
  user-select: none;
  margin-top: 6px;
}

.layer-group-title:first-child { margin-top: 0; }

.group-toggle-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
  display: inline-block;
}

.layer-group-title.collapsed .group-toggle-arrow {
  transform: rotate(-90deg);
}

.layer-item.group-hidden {
  display: none;
}

.layer-item--chamados {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.layer-item--chamados .drag-handle {
  flex: 0 0 auto;
}

.layer-item--chamados label {
  min-width: 0;
}

.layer-item--chamados .layer-cat-expander {
  flex: 0 0 auto;
  margin-left: 6px;
}

.layer-cat-expander {
  margin-left: auto;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid #cfd6de;
  border-radius: 6px;
  background: #f5f7fa;
  color: #425466;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.layer-cat-expander:hover {
  background: #eaf0f6;
  border-color: #b8c4cf;
  color: #213547;
}

.layer-cat-expander--below {
  margin-top: 0;
  margin-right: 0;
}

.layer-cat-panel {
  flex-basis: 100%;
  width: 100%;
  margin-top: 6px;
  margin-left: 22px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  box-sizing: border-box;
}

.layer-cat-panel--below {
  flex: 0 0 100%;
  width: 100%;
  margin: 0;
  margin-left: 22px;
}

.ticket-layer-filter-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.ticket-layer-filter-actions button {
  padding: 4px 8px;
  border: 1px solid #cfd6de;
  border-radius: 6px;
  background: #fff;
  color: #34495e;
  font-size: 11px;
  cursor: pointer;
}

.ticket-layer-filter-actions button:hover {
  background: #eef4f8;
}

.ticket-layer-filter-title {
  margin: 8px 0 4px;
  font-size: 11px;
  font-weight: 700;
  color: #52606d;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ticket-layer-filter-row {
  margin: 3px 0;
  font-size: 12px;
  color: #243b53;
}

.ticket-layer-filter-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.ticket-layer-filter-empty {
  font-size: 12px;
  color: #7b8794;
}

/* Legenda dos rostos (idade do chamado) no painel da camada Chamados */
.ticket-age-legend {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e4e9ef;
}
.ticket-age-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0;
  font-size: 12px;
  color: #243b53;
}
.ticket-age-legend-face {
  flex: 0 0 auto;
  width: 20px;
  text-align: center;
  font-size: 16px;
  line-height: 1;
}


/* --- MODO COMPACTO: popup de atributos para NOVA FEIÇÃO (flutuante e menor) --- */
.popup.popup-new {
  position: fixed;
  right: 20px;
  bottom: 20px;
  min-width: 340px;
  max-width: 440px;
  width: 380px;
}
.popup.popup-new .popup-title {
  font-size: 13px;
}
.popup.popup-new .attr-table td {
  padding: 3px 6px;
}
.popup.popup-new table td:first-child {
  width: 96px;
  white-space: nowrap;
}
.popup.popup-new input,
.popup.popup-new select,
.popup.popup-new textarea {
  width: 100%;
  box-sizing: border-box;
}


/* --- PAINEL NOVA FEIÇÃO: menor e flutuante --- */
#addFeaturePanel {
  position: fixed;
  width: 170px;
  min-width: 170px;
  max-width: 200px;
}
#addFeaturePanel .panel-content {
  padding: 8px;
}
#addFeaturePanel .tool-btn {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
}
#addFeaturePanel .panel-title {
  font-size: 13px;
}
/* Popup de tributos (PagamentosTributos) */
#tributosPopup {
  position: fixed;
  right: 20px;
  top: 72px;
  left: auto;
  width: 62vw;
  height: 58vh;
  min-width: 520px;
  min-height: 280px;
  max-width: 96vw;
  max-height: 92vh;
  border-radius: 10px;
  box-shadow: 0 6px 28px rgba(0,0,0,.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Header azul — mesmo tom da navbar */
#tributosPopup .popup-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: #003b73;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  border-radius: 10px 10px 0 0;
}
#tributosPopup .popup-title:active { cursor: grabbing; }

#tributosPopup .popup-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: .8;
  flex-shrink: 0;
}
#tributosPopup .popup-close:hover { opacity: 1; }

#tributosContent {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
}

#tributosContent table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

#tributosContent th,
#tributosContent td {
  border: 1px solid #d0d0d0;
  padding: 4px 6px;
  text-align: left;
}


/* Bloqueio de ferramentas que exigem login (mantém visível, mas travado) */
.auth-only.locked {
  opacity: 0.55;
  cursor: not-allowed;
}
.auth-only.locked * {
  pointer-events: none;
}
.auth-only.locked {
  pointer-events: auto;
}

/* Toast simples (mensagens rápidas) */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.78);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 6px;
  z-index: 5000;
  font-size: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.boletos-modal {
  position: fixed;
  inset: 0;
  z-index: 4100;
}

.boletos-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.boletos-modal-panel {
  position: relative;
  margin: 72px auto 24px auto;
  width: min(760px, calc(100vw - 20px));
  max-height: calc(100vh - 96px);
  background: #fff;
  border: 1px solid #999;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}

.boletos-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid #ddd;
  background: #f4f7fb;
  font-weight: bold;
}

.boletos-modal-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid #eee;
  justify-items: center;
  text-align: center;
}

.boletos-modal-form label {
  font-size: 12px;
  font-weight: bold;
  width: min(360px, 100%);
  text-align: center;
}

.boletos-modal-form select,
.boletos-modal-form input,
.boletos-modal-form button {
  width: min(360px, 100%);
  box-sizing: border-box;
}

.boletos-modal-actions {
  grid-column: 1 / -1;
  margin-top: 6px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.boletos-modal-actions button {
  margin-top: 0 !important;
  width: auto;
  flex: 0 1 260px;
}

#btnBoletosConsultar {
  grid-column: auto;
  margin-top: 0;
}

.boletos-resultados {
  padding: 10px;
  overflow: auto;
}

.certidao-card {
  border: 1px solid #d7d7d7;
  margin-bottom: 8px;
  padding: 8px;
  background: #f7fbff;
}

.certidao-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.certidao-actions {
  margin-top: 8px;
}

.certidao-actions button {
  padding: 6px 10px;
}

.boleto-item {
  border: 1px solid #d7d7d7;
  margin-bottom: 8px;
  padding: 8px;
  background: #fafafa;
}

.boleto-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 4px 10px;
  font-size: 12px;
}

.boleto-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.boleto-code {
  margin-top: 4px;
  font-size: 11px;
  word-break: break-all;
}

/* ============================================================
   TICKETS — Chamados Georeferenciados
============================================================ */

/* Overlay / modal base */
.ticket-modal {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.ticket-modal.hidden { display: none; }

.ticket-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}

.ticket-modal-panel {
  position: relative;
  z-index: 1;
  background: #fff;
  width: 420px;
  min-width: 360px;
  min-height: 320px;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 60px);
  margin-top: 50px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #aaa;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  font-size: 13px;
  /* Permite redimensionar pelo canto inferior direito (handle nativo do browser) */
  resize: both;
}

.ticket-modal-panel--create {
  align-self: flex-start;
  max-height: calc(100dvh - 92px);
  margin-top: 76px;
  margin-right: 24px;
  margin-left: auto;
}

.ticket-panel-wide { width: 640px; }

.ticket-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #003b73;
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  flex-shrink: 0;
}
.ticket-modal-header button {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.ticket-modal-body {
  padding: 14px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ticket-modal-body label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: normal;
}
.ticket-modal-body input,
.ticket-modal-body select,
.ticket-modal-body textarea {
  padding: 6px 8px;
  border: 1px solid #ccc;
  font-size: 13px;
  border-radius: 2px;
}
.ticket-modal-body textarea { resize: vertical; }

.ticket-pick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

#btnAutoLocate,
#btnManualAdjust {
  font-family: Arial, Helvetica, sans-serif;
  padding: 8px 16px;
  border: 1px solid #ccc;
  background: #003b73;
  color: white;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  font-size: 13px;
}

#btnManualAdjust {
  background: #f4f7fb;
  color: #003b73;
  border-color: #8aa6c4;
}

#btnAutoLocate:hover,
#btnManualAdjust:hover {
  background: #002b53;
}

#btnManualAdjust:hover {
  background: #e7f0f8;
}

.upload-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 320px;
}

.section-title {
  font-size: 13px;
  color: #444;
}

.upload-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.upload-box {
  min-width: 70px;
  height: 70px;
  border: 2px dashed #aaa;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: 0.2s;
}

.upload-box:hover {
  border-color: #666;
}

.upload-box input {
  display: none;
}

.plus {
  font-size: 28px;
  color: #aaa;
}

.preview {
  display: flex;
  gap: 8px;
  flex-direction: row;
}

.preview-item {
  position: relative;
}

.preview img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
}

.remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ff4d4d;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 12px;
  cursor: pointer;
}

.ticket-modal-footer {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #ddd;
  flex-shrink: 0;
  justify-content: flex-end;
}
.ticket-modal-footer button {
  padding: 6px 16px;
  border: 1px solid #aaa;
  cursor: pointer;
  font-size: 13px;
  background: #f5f5f5;
}
.ticket-modal-footer button:first-child {
  background: #003b73;
  color: #fff;
  border-color: #003b73;
}
.ticket-modal-footer button:first-child:disabled {
  background: #aaa;
  border-color: #aaa;
  cursor: not-allowed;
}

/* Hint de localização */
.ticket-hint {
  font-size: 12px;
  color: #555;
  background: #f0f4ff;
  padding: 6px 10px;
  border-left: 3px solid #003b73;
  cursor: pointer;
  margin: 0;
}
.ticket-coords {
  font-size: 12px;
  color: #1a5c1a;
  background: #efffef;
  padding: 5px 10px;
  border-left: 3px solid #3a3;
}
.required { color: #c00; }

/* Marcador de pick no mapa */
.tk-pick-marker {
  font-size: 24px;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

/* ---- Lista de chamados ---- */
.ticket-list-filters {
  display: flex;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid #ddd;
  flex-shrink: 0;
}
.ticket-list-filters select {
  flex: 1;
  padding: 5px 6px;
  font-size: 13px;
  border: 1px solid #ccc;
}
.ticket-list-filters button {
  padding: 5px 12px;
  border: 1px solid #aaa;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 13px;
}

.ticket-list-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tk-list-item {
  border: 1px solid #ddd;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 2px;
  transition: background .15s;
}
.tk-list-item:hover { background: #f0f4ff; }

/* Chamado resolvido/fechado (manual ou por conclusao de OS): card em tom verde */
.tk-list-item--done {
  background: #ecfdf3;
  border-color: #86e0a8;
}
.tk-list-item--done:hover { background: #d9f7e3; }

.tk-list-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}
.tk-list-id     { font-weight: bold; color: #003b73; }
.tk-list-layer  { color: #666; flex: 1; }
.tk-list-date   { color: #999; white-space: nowrap; }
.tk-list-clip   { color: #4e647c; font-weight: bold; white-space: nowrap; }

.tk-list-item-body {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  gap: 8px;
}
.tk-list-title  { font-size: 13px; flex: 1; }
.tk-list-author { font-size: 11px; color: #888; white-space: nowrap; }

.tk-list-item-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.tk-detail-map-action {
  display: flex;
  justify-content: flex-end;
  margin: 10px 0 2px;
}

.tk-list-map-btn {
  width: auto;
  padding: 5px 10px;
  border: 1px solid #003b73;
  border-radius: 3px;
  background: #003b73;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.tk-list-map-btn:hover {
  background: #002b53;
}

.tk-list-map-btn:focus-visible {
  outline: 2px solid rgba(0, 59, 115, 0.25);
  outline-offset: 2px;
}

.tk-ticket-focus-marker {
  position: relative;
  width: 30px;
  height: 30px;
  pointer-events: none;
}

.tk-ticket-focus-marker::before,
.tk-ticket-focus-marker::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.tk-ticket-focus-marker::before {
  border: 3px solid rgba(0, 59, 115, 0.95);
  background: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9);
}

.tk-ticket-focus-marker::after {
  border: 2px solid rgba(0, 59, 115, 0.45);
  animation: tk-ticket-pulse 1.4s ease-out infinite;
}

@keyframes tk-ticket-pulse {
  0% {
    transform: scale(1);
    opacity: 0.95;
  }
  100% {
    transform: scale(2.6);
    opacity: 0;
  }
}

.ticket-list-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid #ddd;
  font-size: 12px;
  flex-shrink: 0;
}
.ticket-list-pagination button {
  padding: 4px 10px;
  border: 1px solid #aaa;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 12px;
}
.ticket-list-pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ---- Detalhe do chamado ---- */
.ticket-detail-content {
  padding: 12px 14px;
  /* Esta é a região que ABSORVE a falta de espaço: rola sozinha em vez de
     esmagar o histórico de comentários abaixo. (Antes: flex-shrink:0 +
     overflow:visible faziam a tabela ocupar altura fixa e espremer o histórico.) */
  flex: 1 1 auto;
  min-height: 0;          /* permite encolher abaixo do conteúdo p/ acionar o scroll */
  overflow-y: auto;
  overflow-x: hidden;
}

.tk-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tk-detail-table th,
.tk-detail-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #eee;
  text-align: left;
  vertical-align: top;
}
.tk-detail-table th {
  width: 110px;
  color: #555;
  font-weight: bold;
}

/* ============================================================
   FASE D — Vinculo Chamado <-> OS no detalhe do chamado
   ============================================================ */
.ticket-os-area {
  padding: 10px 14px;
  border-top: 1px solid #e3e8ef;
  background: #f7f9fc;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.ticket-os-area.hidden { display: none; }
.ticket-os-area .tk-os-list-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #5a6a85;
}
.ticket-os-area .tk-os-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #d7deea;
  border-radius: 6px;
  font-size: 12px;
}
.ticket-os-area .tk-os-num { font-weight: 700; color: #003b73; }
.ticket-os-area .tk-os-assigned { color: #555; }
.ticket-os-area .tk-os-status {
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: #888;
}
.ticket-os-area .tk-os-status--aberta       { background: #2e7d32; }
.ticket-os-area .tk-os-status--atribuida    { background: #1565c0; }
.ticket-os-area .tk-os-status--em_execucao  { background: #e65100; }
.ticket-os-area .tk-os-status--pausada      { background: #6a4cae; }
.ticket-os-area .tk-os-status--concluida    { background: #9aa3af; }
.ticket-os-area .tk-os-status--cancelada    { background: #b42318; }
.ticket-os-area .tk-os-hist-btn {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
}
.ticket-os-area .tk-os-note {
  font-size: 12px;
  color: #5a6a85;
}
.ticket-os-area .tk-escalate-btn {
  align-self: flex-start;
  padding: 7px 14px;
  background: #003b73;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.ticket-os-area .tk-escalate-btn:hover { background: #00528f; }

.ticket-detail-actions {
  display: flex;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid #ddd;
  flex-shrink: 0;
}
.ticket-detail-actions.hidden { display: none; }
.ticket-detail-actions select {
  flex: 1;
  padding: 5px;
  font-size: 13px;
  border: 1px solid #ccc;
}
.ticket-detail-actions button {
  padding: 5px 14px;
  background: #003b73;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 13px;
}

.ticket-detail-actions .ticket-danger-button {
  background: #b42318;
}

.ticket-detail-actions .ticket-danger-button:hover {
  background: #8f1c13;
}

.ticket-detail-actions .ticket-archive-button {
  background: #6b7280;
}

.ticket-detail-actions .ticket-archive-button:hover {
  background: #4b5563;
}

.ticket-detail-actions .ticket-archive-button.hidden { display: none; }

/* ---- Comentários ---- */
.ticket-comments {
  /* flex-grow:0 para o handle de resize "segurar" a altura escolhida; */
  /* flex-shrink:1 só como último recurso (em telas muito baixas, p/ nao cortar
     os botoes) — quem absorve a falta de espaço é o .ticket-detail-content. */
  flex: 0 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid #ddd;
  min-height: 120px;
  height: 260px;          /* altura padrao maior (= basis do flex) */
  max-height: 70vh;       /* arraste o canto inferior p/ crescer bem mais */
  resize: vertical;       /* handle no canto p/ o usuario redimensionar a altura */
}

.tk-comment {
  background: #f7f7f7;
  border: 1px solid #e5e5e5;
  padding: 6px 10px;
  border-radius: 2px;
}
.tk-comment-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #777;
  margin-bottom: 4px;
}
.tk-comment-header strong { color: #333; }
.tk-comment-body { font-size: 13px; white-space: pre-wrap; }

.ticket-comment-form {
  display: flex;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid #ddd;
  flex-shrink: 0;
}
.ticket-comment-form textarea {
  flex: 1;
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid #ccc;
  resize: none;
}
.ticket-comment-form button {
  padding: 6px 14px;
  background: #003b73;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.tk-detail-images {
  margin-top: 14px;
}

.tk-detail-images-title {
  font-weight: bold;
  color: #29435c;
  margin-bottom: 8px;
}

.tk-detail-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.tk-image-thumb {
  border: 1px solid #c8d4df;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
}

.tk-image-thumb img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
}

.tk-image-viewer {
  position: fixed;
  inset: 0;
  z-index: 2600;
}

.tk-image-viewer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.tk-image-viewer__panel {
  position: relative;
  z-index: 1;
  width: min(92vw, 980px);
  max-height: 90vh;
  margin: 4vh auto 0;
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.35);
}

.tk-image-viewer__panel img {
  display: block;
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  background: #f4f7fb;
  border-radius: 8px;
}

.tk-image-viewer__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

.tk-image-viewer__caption {
  margin-top: 10px;
  color: #29435c;
  font-size: 13px;
}

/* ---- Badges de status ---- */
.tk-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
}
.tk-badge--open        { background: #dbeafe; color: #1d4ed8; }
.tk-badge--in_progress { background: #fef9c3; color: #92400e; }
.tk-badge--resolved    { background: #dcfce7; color: #15803d; }
.tk-badge--closed      { background: #f3f4f6; color: #6b7280; }

.tk-priority-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
  border: 1px solid transparent;
}

.tk-priority-badge--low {
  background: #eef7ee;
  color: #2f6b2f;
  border-color: #b8dbb8;
}

.tk-priority-badge--medium,
.tk-priority-badge--indefinida {
  background: #fff6e6;
  color: #8a6412;
  border-color: #edd39a;
}

.tk-priority-badge--high {
  background: #fdecec;
  color: #a12626;
  border-color: #efb2b2;
}

/* ---- Estados de carregamento / erro ---- */
.tk-loading { color: #555; text-align: center; padding: 16px; font-size: 13px; }
.tk-error   { color: #c00; text-align: center; padding: 16px; font-size: 13px; }
.tk-empty   { color: #888; text-align: center; padding: 16px; font-size: 13px; }


@media (max-width: 855px) {
  #compact-map-toolbar { max-height: 90vh; overflow-y: auto; }
}

@media (max-width: 770px) {
  #header {
    flex-direction: column;
    justify-content: center;
    padding: 8px 16px;
    font-size: 13px;
    gap: 5px;
  }
}

@media (max-width: 768px) {
  /* Painel de resultados da busca (mobile) */
  #searchResultsPanel {
    left: 10px;
    right: 10px;
    top: 50px;
    width: auto;
    max-width: none;
    max-height: 45vh;
  }

  #searchResultsPanel ul {
    max-height: calc(45vh - 60px);
    overflow: auto;
  }

  #identifyPopup:not(.popup-new) {
    top: 52px;
    left: 12px;
    transform: none;
    width: calc(100vw - 24px);
    max-height: calc(100vh - 64px);
  }

  #identifyContent {
    max-height: calc(100vh - 200px);
  }

  #identifyContent tr,
  #identifyContent td {
    display: block;
    width: 100% !important;
  }

  #identifyContent tr > td:first-child {
    margin-bottom: 4px;
  }
}

@media (max-width: 700px) {
  .boletos-modal-panel {
    margin-top: 54px;
    max-height: calc(100vh - 64px);
  }
  .boletos-modal-form,
  .boleto-grid {
    grid-template-columns: 1fr;
  }

  .ticket-modal-panel,
  .ticket-panel-wide {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 64px);
    margin-top: 48px;
  }

  .ticket-modal-panel--create {
    max-height: calc(100dvh - 64px);
    margin-right: 8px;
    margin-left: 8px;
  }

  .ticket-pick-actions {
    grid-template-columns: 1fr;
  }

  .upload-container {
    max-width: none;
  }

  .upload-row,
  .preview {
    flex-wrap: wrap;
  }
}

@media (max-height: 620px) {
  .ticket-modal-panel--create {
    max-height: calc(100dvh - 24px);
    margin-top: 12px;
  }

  .ticket-modal-body {
    padding: 10px 12px;
    gap: 8px;
  }

  .ticket-modal-footer {
    padding: 8px 12px;
  }
}

@media (max-width: 520px) {
  #header {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .header-side--left,
  .header-side--right,
  .header-center {
    width: 100%;
    justify-content: center;
  }

  .title_logo {
    justify-content: center;
    flex-wrap: wrap;
  }

  #layersButtonContainer {
    width: 100%;
    justify-content: center;
  }

  .panel,
  #searchResultsPanel {
    top: 96px;
  }

  .toast {
    top: 110px;
  }
}

@media (max-width: 457px) {
  .compact-map-toolbar {
    inset: 120px auto auto 12px;
  }
  .toolbar {
    inset: 120px auto auto 63px;
  }
}

@media (max-width: 327px) {
  .title_logo {
    flex-direction: column;
    justify-content: center;
  }

  #header-subtitle {
    margin-left: 0;
  }
}

@media (max-width: 278px) {
  .compact-map-toolbar {
    inset: 120px auto auto 3px;
  }
  .toolbar {
    width: 150px;
    inset: 120px auto auto 50px;
  }

}

@media (max-width: 261px) {
  .compact-map-toolbar {
    inset: 160px auto auto 3px;
  }
  .toolbar {
    inset: 160px auto auto 50px;
  }
}


.edit-mode-btn { display:block; width:100%; margin:4px 0; }
.edit-mode-btn.btn-active { background:#1e88e5; color:#fff; }

/* Seletor de camada dentro do painel "Editar camada" */
.edit-layer-target-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 8px;
}
.edit-layer-target-label {
  font-size: 12px;
  color: #555;
  min-width: 56px;
}
.edit-layer-target-select {
  flex: 1;
  padding: 4px 6px;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
}
/* Painel "Editar camada" arrastavel — garante que fique acima do mapa */
#editLayerPanel {
  z-index: 1500;
}
#editLayerPanel .panel-title {
  cursor: move;
  user-select: none;
}

/* =========================================================
   Estilos para os modais Importar/Exportar (BlueGeoIO)
   ========================================================= */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

/* Confirmação/erro são modais de SEGUNDO nível: precisam cobrir os modais de
   camada (#createLayerModal 10000 / #addExistingModal 10001), senão o "Sobrepor?"
   nasce ATRÁS do "Adicionar Camada" e o clique cai no backdrop errado. */
#confirmModal,
#errorModal {
  z-index: 10500;
}

.modal-content {
  background: #fff;
  width: min(500px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  font-family: inherit;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e0e0e0;
  background: #f7f7f7;
  border-radius: 8px 8px 0 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: inherit;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #666;
  padding: 0 4px;
}

.modal-close:hover { color: #000; }

.modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-body label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin-top: 6px;
}

.modal-body select,
.modal-body input[type="text"],
.modal-body input[type="file"] {
  padding: 6px 8px;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}

.modal-body select:focus,
.modal-body input:focus {
  outline: none;
  border-color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.15);
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0 2px 0;
}

.radio-group label {
  font-weight: normal;
  font-size: 13px;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.radio-group input[type="radio"] { margin: 0; }

.modal-hint {
  font-size: 11px;
  color: #888;
  font-style: italic;
  margin-top: 4px;
}

.modal-status {
  font-size: 12px;
  color: #555;
  min-height: 18px;
  margin-top: 6px;
  padding: 4px 6px;
  border-radius: 4px;
}

.modal-status.error {
  color: #b00020;
  background: #ffe5e9;
  border: 1px solid #ffb3bd;
}

.modal-status.success {
  color: #0a5c1b;
  background: #e3f7e7;
  border: 1px solid #a2d9ae;
}

.modal-footer {
  padding: 10px 16px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #fafafa;
  border-radius: 0 0 8px 8px;
}

.modal-footer button {
  padding: 6px 16px;
  border-radius: 4px;
  border: 1px solid #aaa;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.modal-footer .btn-primary {
  background: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
  font-weight: 500;
}

.modal-footer .btn-primary:hover { background: #0b5ed7; }

.modal-footer .btn-secondary {
  background: #f5f5f5;
  color: #333;
}

.modal-footer .btn-secondary:hover { background: #e9e9e9; }

/* Quando style.display=flex vira ativo, o flexbox alinha o conteudo */
#importModal[style*="flex"],
#exportModal[style*="flex"] {
  display: flex !important;
}

/* ─── Terrain Tools — painéis flutuantes (padrão drag+resize do projeto) ────── */

/* Handles de resize — idênticos ao .cs-rh do Monitor CS */
.t-rh {
  position: absolute;
  z-index: 30;
  background: transparent;
}
.t-rh-n  { top: 0;    left: 14px; right: 14px; height: 5px; cursor: n-resize; }
.t-rh-s  { bottom: 0; left: 14px; right: 14px; height: 5px; cursor: s-resize; }
.t-rh-e  { right: 0;  top: 14px;  bottom: 14px; width: 5px; cursor: e-resize; }
.t-rh-w  { left: 0;   top: 14px;  bottom: 14px; width: 5px; cursor: w-resize; }
.t-rh-ne { top: 0;    right: 0;   width: 14px; height: 14px; cursor: ne-resize; }
.t-rh-nw { top: 0;    left: 0;    width: 14px; height: 14px; cursor: nw-resize; }
.t-rh-se { bottom: 0; right: 0;   width: 14px; height: 14px; cursor: se-resize; }
.t-rh-sw { bottom: 0; left: 0;    width: 14px; height: 14px; cursor: sw-resize; }

/* Painel base */
.t-panel {
  position: fixed;
  z-index: 2100;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* posição padrão — drag vai sobrescrever left/top */
  bottom: 80px;
  left: 60px;
  min-width: 260px;
  min-height: 120px;
}
.t-panel.t-hidden { display: none !important; }
.t-panel-wide {
  width: min(660px, calc(100vw - 80px));
  bottom: 20px;
}

/* Header arrastável */
.t-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #1e3a5f;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: grab;
  user-select: none;
  border-radius: 7px 7px 0 0;
  flex-shrink: 0;
}
.t-panel-header:active { cursor: grabbing; }
.t-panel-header button {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  line-height: 1.4;
}
.t-panel-header button:hover { background: rgba(255,255,255,.32); }
.t-panel-header-btns {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Corpo scrollável */
.t-panel-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.t-prof-scrollable { overflow: auto; }

/* Loading / erro */
.t-panel-loading {
  text-align: center;
  padding: 20px;
  color: #64748b;
}
.t-panel-error {
  text-align: center;
  padding: 16px 20px;
  color: #dc2626;
  line-height: 1.5;
}

/* ── XYZ ── */
.t-xyz-table {
  width: 100%;
  border-collapse: collapse;
  padding: 4px 0;
  display: block;
}
.t-xyz-table tr td { padding: 5px 12px; }
.t-lbl { color: #64748b; white-space: nowrap; }
.t-xyz-z td { font-weight: 600; background: #f0fdf4; }
.t-xyz-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 10px;
  border-top: 1px solid #e2e8f0;
}
.t-xyz-footer small { color: #94a3b8; font-size: 11px; }
.t-copy-btn {
  font-size: 12px;
  padding: 3px 10px;
  border: 1px solid #2563eb;
  background: #eff6ff;
  color: #2563eb;
  border-radius: 4px;
  cursor: pointer;
}
.t-copy-btn:hover { background: #dbeafe; }

/* ── Perfil ── */
.t-prof-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  color: #374151;
}
.t-prof-stats span { white-space: nowrap; }
.t-prof-canvas {
  display: block;
  width: 100%;
  height: 200px;
  padding: 6px 8px 8px;
  box-sizing: border-box;
}

/* ── Trilha de Pontos ── */
.t-panel-trail {
  width: min(560px, calc(100vw - 80px));
  bottom: 20px;
}
.t-trail-count-label {
  font-size: 11px;
  font-weight: 400;
  opacity: .8;
  white-space: nowrap;
}
.t-trail-body {
  overflow-y: auto;
  max-height: 260px;
}
.t-trail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.t-trail-table thead th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.t-trail-table tbody tr:nth-child(even) { background: #f8fafc; }
.t-trail-table tbody tr:hover { background: #eff6ff; }
.t-trail-table tbody td {
  padding: 5px 10px;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
}
.t-trail-num {
  font-weight: 700;
  color: #2563eb;
  width: 32px;
  text-align: center;
}
.t-trail-del {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: 3px;
}
.t-trail-del:hover { background: #fee2e2; }

/* ─── PDF Preview Modal ─────────────────────────────────────── */
.pdf-preview-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.78);
  z-index: 9100;
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
}
.pdf-preview-overlay.hidden { display: none; }

.pdf-preview-wrapper {
  display: flex; flex-direction: column; gap: 10px;
  width: min(900px, 100%);
}

.pdf-preview-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  color: #fff;
}
.pdf-preview-hint { font-size: 13px; opacity: .82; }
.pdf-preview-actions { display: flex; gap: 8px; }
.pdf-preview-actions button {
  padding: 6px 20px; border: none; border-radius: 4px;
  cursor: pointer; font-size: 14px; font-weight: 600;
}
#btnPdfGenerate { background: #1e40af; color: #fff; }
#btnPdfGenerate:hover { background: #1e3a8a; }
#btnPdfCancel  { background: #4b5563; color: #fff; }
#btnPdfCancel:hover  { background: #374151; }

/* A4 landscape ratio: 297/210 */
.pdf-page {
  width: 100%;
  aspect-ratio: 297 / 210;
  background: #fff;
  border: 1px solid #374151;
  border-radius: 2px;
  display: flex; flex-direction: row;
  overflow: hidden;
}

/* ── Sidebar esquerda (~20% ≈ 60mm) ── */
.pdf-sidebar {
  width: 20%;
  border-right: 2.5px solid #1e40af;
  background: #fff;
  display: flex; flex-direction: column;
  overflow: hidden; flex-shrink: 0;
}
.pdf-sb-top {
  padding: 7px 6px 6px;
  border-bottom: 1px solid #e5e7eb;
  display: flex; flex-direction: column; gap: 2px;
}
.pdf-sb-mid {
  flex: 1;
  border-bottom: 1px solid #e5e7eb;
  padding: 5px 6px;
  overflow: hidden;
}
.pdf-field--mid {
  width: 100%; height: 100%;
  font-size: 8px; color: #374151;
  white-space: pre-wrap; word-break: break-word;
  min-height: 20px;
}
.pdf-sb-bot {
  padding: 5px 6px 4px;
  display: flex; flex-direction: column; gap: 2px;
}

/* ── Área do mapa (resto) ── */
.pdf-map-area {
  flex: 1; position: relative;
  background: #d1d5db; overflow: hidden;
}
.pdf-map-area img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}

/* ── Seta norte (canto sup-dir do mapa) ── */
.pdf-north-badge {
  position: absolute; top: 8px; right: 8px;
  width: 40px; height: 40px;
  background: rgba(255,255,255,.92);
  border: 1.5px solid #1e40af;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  box-shadow: 0 1px 5px rgba(0,0,0,.28);
  gap: 0;
}
.pdf-north-label {
  font-size: 9px; font-weight: 900;
  color: #1e40af; line-height: 1; margin-bottom: 1px;
}
.pdf-north-needle { display: flex; flex-direction: column; align-items: center; gap: 0; }
.pdf-north-up {
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 12px solid #1e40af;
}
.pdf-north-down {
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 10px solid #93c5fd;
}

/* ── Barra de escala (canto inf-esq do mapa) ── */
.pdf-scale-badge {
  position: absolute; bottom: 8px; left: 8px;
  background: rgba(255,255,255,.9);
  border-radius: 3px; padding: 3px 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.pdf-scale-bar-inner {
  height: 6px;
  border: 1.5px solid #1e40af; border-top: none;
  background: linear-gradient(to right, #1e40af 50%, #fff 50%);
  margin-bottom: 2px; min-width: 48px;
}
.pdf-scale-bar-text {
  font-size: 8px; color: #374151;
  text-align: center; font-weight: 600;
}

/* ── Campos editáveis ── */
.pdf-field {
  font-size: 9px; color: #111827;
  border-bottom: 1px dashed transparent;
  outline: none; cursor: text; line-height: 1.4;
  word-break: break-word; margin-bottom: 3px;
}
.pdf-field:focus { border-bottom-color: #1e40af; background: #eff6ff; border-radius: 2px 2px 0 0; }
.pdf-field:empty::before {
  content: attr(data-ph);
  color: #d1d5db; pointer-events: none; font-style: italic;
}
.pdf-field--title { font-size: 13px; font-weight: 700; line-height: 1.2; margin-bottom: 4px; }
.pdf-field--sub   { font-size: 8.5px; color: #374151; }
.pdf-field--date  { font-size: 9px; font-weight: 600; }
.pdf-field--crs   { font-size: 7.5px; color: #374151; }
.pdf-field--notes { font-size: 7.5px; color: #374151; min-height: 10px; }
.pdf-field--mid   { width: 100%; height: 100%; font-size: 8px; color: #374151; white-space: pre-wrap; }
.pdf-branding {
  font-size: 10px; font-weight: 700; color: #1e40af;
  text-align: center; margin-top: auto; padding-top: 5px;
  border-top: 1px solid #e5e7eb;
}

/* ── Painel de escolha Adicionar ── */
#addChoicePanel {
  position: fixed;   /* sobrescreve position:absolute do .panel genérico */
  top: auto;         /* posição definida por JS ao abrir */
  right: auto;
  min-width: 180px;
}

.cl-choice-btn {
  display: block;
  width: 100%;
  padding: 10px 8px;
  margin-bottom: 6px;
  background: #f0f4ff;
  border: 1px solid #93c5fd;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  color: #1e40af;
  cursor: pointer;
  text-align: left;
  transition: background .15s;
  line-height: 1.4;
}
.cl-choice-btn small {
  font-weight: 400;
  color: #64748b;
  display: block;
  font-size: 11px;
}
.cl-choice-btn:hover { background: #dbeafe; }

/* ============================================================
   CRIAR CAMADA — Modal
============================================================ */

/* Header azul */
.cl-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  background: #003b73;
  border-radius: 8px 8px 0 0;
  flex-shrink: 0;
}

/* Step indicator */
.cl-steps {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}
.cl-step {
  flex: 1;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  text-align: center;
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s;
}
.cl-step--active {
  color: #1e40af;
  border-bottom-color: #1e40af;
  background: #fff;
}
.cl-step--done {
  color: #16a34a;
  border-bottom-color: #86efac;
}

/* Body dos passos */
.cl-step-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 16px 8px;
}

/* Choice radios */
.cl-choice-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.cl-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
}

/* Field rows */
.cl-field-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cl-field-row label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}
.cl-field-row small {
  font-size: 11px;
  color: #94a3b8;
}
.cl-field-row input,
.cl-field-row select {
  padding: 7px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 13px;
  background: #fff;
  transition: border-color .15s;
}
.cl-field-row input:focus,
.cl-field-row select:focus {
  outline: none;
  border-color: #1e40af;
  box-shadow: 0 0 0 2px #bfdbfe;
}

/* Grid 2 colunas */
.cl-field-row--grid2 {
  flex-direction: row;
  gap: 12px;
}
.cl-field-row--grid2 > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cl-field-row--grid2 label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}
.cl-field-row--grid2 select {
  width: 100%;
}

/* Atributos */
.cl-attrs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}
.cl-add-attr-btn {
  padding: 4px 10px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 4px;
  color: #1e40af;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.cl-add-attr-btn:hover { background: #dbeafe; }

.cl-attrs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}
.cl-attr-row {
  display: grid;
  grid-template-columns: 1fr 120px 28px;
  gap: 6px;
  align-items: center;
}
.cl-attr-row input,
.cl-attr-row select {
  padding: 5px 7px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 12px;
}
.cl-attr-remove {
  width: 26px;
  height: 26px;
  border: 1px solid #fca5a5;
  background: #fff1f2;
  color: #ef4444;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .12s;
}
.cl-attr-remove:hover { background: #fee2e2; }

/* Hint */
.cl-hint {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
}

/* Status modifiers (BEM) */
.modal-status--error { color: #dc2626; }
.modal-status--info  { color: #1e40af; }

/* ─────────────────────────────────────────────────────────────────
   BCI — Boletim de Cadastro Imobiliário
   Namespace: .bci-* / #bciPanel
───────────────────────────────────────────────────────────────── */
.bci-panel {
  position: fixed;
  top: 70px;
  right: 14px;
  width: 440px;
  min-width: 320px;
  min-height: 200px;
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 80px);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 28px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  z-index: 9500;
  overflow: hidden;
}
.bci-panel.hidden { display: none; }

/* Alças de redimensionamento — todas as bordas e cantos */
.bci-rs { position: absolute; z-index: 9999; }
.bci-rs-n  { top: 0;    left: 8px;  right: 8px;  height: 5px; cursor: n-resize;  }
.bci-rs-s  { bottom: 0; left: 8px;  right: 8px;  height: 5px; cursor: s-resize;  }
.bci-rs-e  { top: 8px;  right: 0;   bottom: 8px; width:  5px; cursor: e-resize;  }
.bci-rs-w  { top: 8px;  left: 0;    bottom: 8px; width:  5px; cursor: w-resize;  }
.bci-rs-nw { top: 0;    left: 0;    width: 10px; height: 10px; cursor: nw-resize; }
.bci-rs-ne { top: 0;    right: 0;   width: 10px; height: 10px; cursor: ne-resize; }
.bci-rs-sw { bottom: 0; left: 0;    width: 10px; height: 10px; cursor: sw-resize; }
.bci-rs-se { bottom: 0; right: 0;   width: 10px; height: 10px; cursor: se-resize; }

/* Header */
.bci-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #1a5276;
  color: #fff;
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.bci-header:active { cursor: grabbing; }
.bci-icon  { font-size: 16px; }
.bci-title { font-size: 13px; font-weight: 700; flex: 1; }
.bci-subtitle {
  font-size: 11px;
  opacity: .75;
  white-space: nowrap;
}
.bci-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: .8;
}
.bci-close:hover { opacity: 1; }

/* Abas */
.bci-tab-bar {
  display: flex;
  background: #eef2f7;
  border-bottom: 1px solid #d1dce8;
  flex-shrink: 0;
}
.bci-tab-bar.hidden { display: none; }
.bci-tab {
  flex: 1;
  padding: 8px 4px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 12px;
  font-weight: 600;
  color: #5a7a99;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.bci-tab:hover { color: #1a5276; }
.bci-tab--active {
  color: #1a5276;
  border-bottom-color: #1a5276;
  background: #fff;
}

/* Corpo */
.bci-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 0;
  overflow-x: hidden;
}
.bci-body.hidden { display: none; }

/* Estados de carregamento e erro */
.bci-loading {
  padding: 24px;
  text-align: center;
  color: #666;
  font-size: 13px;
}
.bci-loading.hidden { display: none; }
.bci-error {
  padding: 14px;
  margin: 10px;
  background: #fff0f0;
  color: #b91c1c;
  border-radius: 6px;
  font-size: 12px;
}
.bci-error.hidden { display: none; }

/* Conteúdo de abas */
.bci-tab-content.hidden { display: none; }

/* Seções internas */
.bci-section {
  margin-bottom: 16px;
}
.bci-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #1a5276;
  border-bottom: 1px solid #d1dce8;
  padding-bottom: 4px;
  margin-bottom: 8px;
}

/* Grid de dois campos */
.bci-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}
.bci-grid2 > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bci-label {
  font-size: 10px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.bci-value {
  font-size: 13px;
  color: #1a2533;
  font-weight: 500;
}

/* Tabelas */
.bci-table-wrap {
  overflow-x: auto;
}
.bci-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.bci-table th {
  text-align: left;
  font-weight: 700;
  font-size: 10px;
  color: #5a7a99;
  text-transform: uppercase;
  padding: 4px 6px;
  border-bottom: 1px solid #d1dce8;
  background: #f5f8fb;
  white-space: nowrap;
}
.bci-table td {
  padding: 5px 6px;
  border-bottom: 1px solid #f0f4f8;
  color: #1a2533;
  vertical-align: top;
}
.bci-table tr:last-child td { border-bottom: none; }

/* Badges */
.bci-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
.bci-badge--green  { background: #dcfce7; color: #15803d; }
.bci-badge--yellow { background: #fef9c3; color: #92400e; }
.bci-badge--red    { background: #fee2e2; color: #b91c1c; }
.bci-badge--gray   { background: #f1f5f9; color: #475569; }

/* Empty state */
.bci-empty {
  padding: 20px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
  font-style: italic;
}

/* Barra de ação IPTU (modo + botões) */
.bci-iptu-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: #f4f6f8;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 4px;
}
.bci-iptu-modo { font-size: 12px; color: #555; flex: 1; }
.bci-btn { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; border: none; transition: opacity .15s; }
.bci-btn:disabled { opacity: .5; cursor: not-allowed; }
.bci-btn-primary { background: #1a5276; color: #fff; }
.bci-btn-primary:hover:not(:disabled) { background: #154360; }
.bci-btn-outline { background: #fff; color: #1a5276; border: 1.5px solid #1a5276; }
.bci-btn-outline:hover:not(:disabled) { background: #eaf0fb; }
.bci-btn-sm { padding: 4px 10px; font-size: 11px; }

/* Painel de gerenciamento de grupos IPTU */
.bci-grupo-desc { font-size: 12px; color: #666; margin: 0 0 12px; line-height: 1.5; }
.bci-grupo-list { display: flex; flex-direction: column; gap: 6px; }
.bci-grupo-row  {
  display: flex; align-items: center; gap: 8px;
  background: #f9f9f9; border: 1px solid #e0e0e0;
  border-radius: 7px; padding: 8px 10px;
}
.bci-grupo-dot  { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; transition: background .2s; }
.bci-grupo-edif { font-size: 13px; min-width: 80px; }
.bci-grupo-area { font-size: 12px; color: #555; min-width: 70px; }
.bci-grupo-pav  { font-size: 12px; color: #888; flex: 1; }
.bci-grupo-sel  {
  padding: 4px 8px; border-radius: 5px; border: 1.5px solid #bbb;
  font-size: 12px; background: #fff; cursor: pointer; min-width: 110px;
}
.bci-grupo-sel:focus { outline: none; border-color: #1a5276; }
.bci-grupo-footer { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; align-items: center; }

/* Mobile */
@media (max-width: 500px) {
  .bci-panel {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 14px 14px 0 0;
    max-height: 85vh;
  }
  .bci-grid2 { grid-template-columns: 1fr; }
}

/* BCI Histórico detalhado */
.bci-hist-entry {
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  margin: 0 0 8px 0;
  overflow: hidden;
}
.bci-hist-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 10px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
}
.bci-hist-date  { font-weight: 600; color: #334155; }
.bci-hist-layer { color: #64748b; }
.bci-hist-user  { color: #64748b; margin-left: auto; }

.bci-diff-list  { padding: 6px 10px; }
.bci-diff-row {
  display: grid;
  grid-template-columns: 140px 1fr 16px 1fr;
  align-items: baseline;
  gap: 4px;
  padding: 3px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 12px;
}
.bci-diff-row:last-child { border-bottom: none; }
.bci-diff-field { font-weight: 600; color: #1e40af; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bci-diff-old   { color: #b91c1c; text-decoration: line-through; word-break: break-all; }
.bci-diff-arrow { color: #94a3b8; text-align: center; }
.bci-diff-new   { color: #15803d; font-weight: 600; word-break: break-all; }
.bci-diff-empty { padding: 4px 10px 6px; font-size: 11px; color: #94a3b8; font-style: italic; }

/* ─────────────────────────────────────────────────────────────────
   AUDIT HISTORY — Histórico de Edições
   Namespace: .ah-* / #ahPanel
───────────────────────────────────────────────────────────────── */
.ah-panel {
  position: fixed;
  top: 70px;
  left: 230px;
  width: 560px;
  height: 480px;
  min-width: 320px;
  min-height: 200px;
  max-width: calc(100vw - 14px);
  max-height: calc(100vh - 14px);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 28px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  z-index: 9400;
  overflow: hidden;
}
.ah-panel.hidden { display: none; }

/* Botão da toolbar ativo quando painel aberto */
#btnAuditHistory.ah-btn-toolbar-active {
  background: #1a5276 !important;
  color: #fff !important;
}

.ah-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #1a5276;
  color: #fff;
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.ah-header:active { cursor: grabbing; }
.ah-icon  { font-size: 16px; }
.ah-title { font-size: 13px; font-weight: 700; flex: 1; }
.ah-btn-icon {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 16px;
  border-radius: 4px;
  padding: 2px 7px;
  cursor: pointer;
}
.ah-btn-icon:hover { background: rgba(255,255,255,.3); }
.ah-btn-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  opacity: .8;
}
.ah-btn-close:hover { opacity: 1; }

.ah-loading {
  padding: 20px;
  text-align: center;
  color: #666;
  font-size: 13px;
}
.ah-loading.hidden { display: none; }
.ah-error {
  padding: 12px;
  margin: 8px;
  background: #fff0f0;
  color: #b91c1c;
  border-radius: 6px;
  font-size: 12px;
}
.ah-error.hidden { display: none; }

.ah-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.ah-empty {
  padding: 24px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
  font-style: italic;
  line-height: 1.6;
}

/* Cada linha de histórico */
.ah-row {
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  padding: 9px 11px;
  margin-bottom: 7px;
  background: #fafafa;
  transition: background .12s;
}
.ah-row--clickable { cursor: pointer; }
.ah-row--clickable:hover { background: #f0f4ff; border-color: #93c5fd; }

.ah-row-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 5px;
}
.ah-lote  { font-size: 12px; font-weight: 700; color: #1e3a5f; }
.ah-date  { font-size: 11px; color: #6b7280; margin-left: auto; white-space: nowrap; }
.ah-user  { font-size: 11px; color: #6b7280; }

.ah-diff {
  font-size: 11px;
  color: #374151;
  line-height: 1.6;
  word-break: break-word;
}
.ah-field { font-weight: 700; color: #1e3a5f; }
.ah-old   { color: #b91c1c; text-decoration: line-through; }
.ah-new   { color: #15803d; font-weight: 600; }
.ah-nodiff { color: #9ca3af; font-style: italic; }

.ah-nav-btn {
  margin-top: 6px;
  background: #1e3a5f;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
}
.ah-nav-btn:hover { background: #1a5276; }

/* Badges */
.ah-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.ah-badge--green  { background: #dcfce7; color: #15803d; }
.ah-badge--yellow { background: #fef9c3; color: #92400e; }
.ah-badge--red    { background: #fee2e2; color: #b91c1c; }
.ah-badge--gray   { background: #f1f5f9; color: #475569; }

@media (max-width: 600px) {
  .ah-panel { left: 0; width: 100%; border-radius: 14px 14px 0 0; top: auto; bottom: 0; max-height: 80vh; }
}

/* ============================================================
   VALIDADOR TOPOLÓGICO (A13)
============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* deixa cliques passarem para o box posicionado */
}
.modal-overlay > .modal-box {
  pointer-events: all;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #003b73;
  color: #fff;
  font-size: 14px;
}

.modal-close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 4px;
}
.modal-close-btn:hover { background: rgba(255,255,255,0.18); }

/* Grip de resize — canto inferior direito */
.modal-resize-grip {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: se-resize;
  z-index: 2002;
  background: linear-gradient(135deg,
    transparent 33%, rgba(255,255,255,0.7) 33%, rgba(255,255,255,0.7) 44%, transparent 44%,
    transparent 55%, rgba(255,255,255,0.7) 55%, rgba(255,255,255,0.7) 66%, transparent 66%,
    transparent 77%, rgba(255,255,255,0.7) 77%, rgba(255,255,255,0.7) 88%, transparent 88%
  );
  background-color: rgba(0,59,115,0.55);
  border-radius: 0 0 6px 0;
}

/* Quando o modal está em modo resize, força cursor em todos os filhos */
.modal-box[data-resize-dir] *,
[data-drag-ready][data-resize-dir] * { cursor: inherit !important; }

#toolbar[data-resize-edge] *,
#layersPanel[data-resize-edge] * { cursor: inherit !important; }

/* overflow:hidden é necessário para que o resize visual funcione —
   sem ele o conteúdo transborda fora do box redimensionado.
   A faixa rStrip (position:absolute, right:0) fica dentro do box
   e não é cortada, então o resize pela borda direita continua ok. */
#toolbar,
#layersPanel {
  overflow: hidden;
}
/* A área de scroll fica contida no corpo do painel */
#toolbar .toolbar-body,
#layersPanel .layers-body {
  overflow-y: auto;
  border-radius: 0 0 8px 8px;
}


.topo-modal-box {
  width: 500px;
  max-width: 95vw;
  min-height: 200px;
}

#topoResults {
  flex: 1 1 0;
  overflow-y: auto;
  padding: 4px 16px 16px;
  min-height: 0;
}

.topo-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: #f0f4f8;
  color: #333;
}
.topo-badge-invalid   { background: #fee2e2; color: #b91c1c; }
.topo-badge-overlap   { background: #ffedd5; color: #c2410c; }
.topo-badge-sliver    { background: #fefce8; color: #854d0e; }
.topo-badge-duplicate { background: #f3e8ff; color: #7c3aed; }
.topo-badge-nav { cursor: pointer; user-select: none; }
.topo-badge-nav:hover { filter: brightness(0.92); outline: 2px solid currentColor; outline-offset: 1px; }

.topo-error-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 12px;
}
.topo-error-item:hover { background: #f9fafb; }
.topo-item-clickable { cursor: pointer; }
.topo-item-clickable:hover { background: #eff6ff; }

.topo-err-icon { font-size: 14px; flex-shrink: 0; }

.topo-err-msg {
  flex: 1;
  color: #333;
  word-break: break-word;
}

.topo-sel-group {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.topo-goto-btn,
.topo-sel-btn {
  flex-shrink: 0;
  padding: 3px 7px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
.topo-goto-btn:hover:not(:disabled) { background: #e8f4fd; border-color: #003b73; }
.topo-sel-btn:hover:not(:disabled)  { background: #dbeafe; border-color: #1565C0; color: #1565C0; }
.topo-goto-btn:disabled,
.topo-sel-btn:disabled { opacity: 0.4; cursor: default; }

/* ============================================================
   MAPA DE CALOR — HeatmapPanel (A38)
============================================================ */

.hm-panel {
  position: fixed;
  top: 70px;
  right: 10px;
  width: 310px;
  min-width: 260px;
  min-height: 200px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 28px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  z-index: 9300;
  overflow: hidden;
}
.hm-panel.hidden { display: none; }

/* Botão ativo na toolbar */
#btnHeatmap.hm-btn-active {
  background: #1a5276 !important;
  color: #fff !important;
}

/* Header */
.hm-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #1a5276;
  color: #fff;
  cursor: move;
  user-select: none;
  flex-shrink: 0;
}
.hm-icon  { font-size: 15px; }
.hm-title { flex: 1; font-weight: 700; font-size: 13px; }
.hm-btn-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  opacity: .8;
}
.hm-btn-close:hover { opacity: 1; }

/* Tabs */
.hm-tab-bar {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  flex-shrink: 0;
}
.hm-tab {
  flex: 1;
  padding: 7px 4px;
  background: transparent;
  border: none;
  font-size: 12px;
  color: #64748b;
  cursor: pointer;
  transition: background .15s;
}
.hm-tab:hover { background: #e0eaf8; }
.hm-tab--active {
  background: #fff;
  border-bottom: 3px solid #1a5276;
  color: #1a5276;
  font-weight: 700;
}

/* Corpo */
.hm-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Grupos de filtros */
.hm-group { display: flex; flex-direction: column; gap: 4px; }
.hm-label,
.hm-group-label {
  font-size: 11px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-top: 2px;
}
.hm-select, .hm-input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
  color: #1f2937;
}
.hm-select:focus, .hm-input:focus {
  outline: none;
  border-color: #1a5276;
}

/* Checkboxes de status */
.hm-checks,
.hm-check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.hm-check-row label,
.hm-check-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
}

/* Linha de datas */
.hm-date-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.hm-date {
  flex: 1;
  padding: 5px 6px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
  color: #1f2937;
}
.hm-date:focus { outline: none; border-color: #1a5276; }

/* Radios de peso */
.hm-radios { display: flex; gap: 12px; }
.hm-radio-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
}

/* Separador */
.hm-sep {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 2px 0;
}

/* Sliders */
.hm-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hm-slider-label { font-size: 11px; color: #64748b; width: 62px; flex-shrink: 0; }
.hm-slider {
  flex: 1;
  accent-color: #1a5276;
  cursor: pointer;
}
.hm-slider-val {
  font-size: 11px;
  color: #374151;
  width: 34px;
  text-align: right;
  flex-shrink: 0;
}

/* Legenda do gradiente */
.hm-legend {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hm-legend-bar {
  height: 10px;
  border-radius: 5px;
  background: linear-gradient(to right, #313695, #4575b4, #74add1, #abd9e9,
              #e0f3f8, #ffffbf, #fee090, #fdae61, #f46d43, #d73027, #a50026);
}
.hm-legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #9ca3af;
}

/* Status / total */
.hm-status {
  font-size: 11px;
  color: #64748b;
  text-align: center;
  padding: 2px 0;
}

/* Botões de ação */
.hm-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  padding: 8px 12px;
  border-top: 1px solid #e5e7eb;
  background: #f8fafc;
}
.hm-btn-apply {
  flex: 1;
  padding: 7px;
  background: #1a5276;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.hm-btn-apply:hover { background: #154360; }
.hm-btn-clear {
  padding: 7px 10px;
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.hm-btn-clear:hover { background: #f3f4f6; }

@media (max-width: 768px) {
  .hm-panel { right: 0; left: 0; top: auto; bottom: 0; width: 100%;
              border-radius: 14px 14px 0 0; max-height: 75vh; }
}

/* ============================================================
   PGV — Planta Genérica de Valor
   ============================================================ */
/* ── Legenda do mapa PGV ─────────────────────────────────────── */
/* Divisor arrastável entre corpo e legenda do PGV */
.pgv-splitter {
  height: 6px;
  background: #d0d7de;
  cursor: ns-resize;
  flex-shrink: 0;
  position: relative;
  user-select: none;
  transition: background 0.15s;
}
.pgv-splitter:hover,
.pgv-splitter--dragging {
  background: #90b8d8;
}
.pgv-splitter::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 2px;
  background: rgba(0,0,0,.25);
  border-radius: 1px;
}

.pgv-legend {
  padding: 8px 12px;
  background: #f8f9fa;
  border-top: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  font-size: 12px;
  line-height: 1.6;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: flex-start;
  flex-shrink: 0;
}
.pgv-legend > div {
  min-width: 120px;
}

/* Itens clicáveis da legenda PGV */
.pgv-lgnd-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.18s, background 0.12s;
}
.pgv-lgnd-header {
  padding-left: 0;
  gap: 6px;
}
.pgv-lgnd-subitem {
  padding-left: 18px;
}
.pgv-lgnd-item:hover {
  background: rgba(0, 0, 0, 0.06);
}
.pgv-lgnd-swatch {
  display: inline-block;
  flex-shrink: 0;
}
.pgv-lgnd-item--hidden {
  opacity: 0.28;
}
.pgv-lgnd-item--hidden span:last-child {
  text-decoration: line-through;
}

/* Popup de edição de zona por clique no lote */
.pgv-edit-popup {
  /* layout e aparência vêm de .modal-box; só precisamos de z-index e largura */
  z-index: 10500;
  min-width: 220px;
  display: none; /* JS seta "flex" ao abrir */
}
.pgv-edit-popup-body {
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pgv-edit-popup-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
}
.pgv-edit-popup-label {
  font-size: 11px;
  color: #666;
  font-weight: 500;
}
.pgv-edit-select {
  padding: 4px 7px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid #ccc;
  background: #f9fafb;
  cursor: pointer;
}
.pgv-edit-popup-btns {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  justify-content: flex-end;
}

.pgv-panel {
  position: absolute;           /* ModalDrag converte para fixed na 1ª interação */
  top: 80px;
  left: calc(50vw - 350px);    /* centralizado sem transform — 700/2 = 350 */
  width: 700px;
  min-height: 320px;
  max-width: 96vw;
  max-height: calc(100dvh - 100px);
  display: flex;
  flex-direction: column;
  z-index: 1200;
  overflow: hidden;
}
.pgv-panel.hidden { display: none !important; }

/* Ano no header */
.pgv-header-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  margin-right: 8px;
}
.pgv-ano-select {
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 4px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  cursor: pointer;
}
.pgv-ano-select option { background: #003b73; color: #fff; }

/* Corpo scrollável */
.pgv-body {
  flex: 1 1 0;
  min-height: 150px;
  overflow-y: auto;
  padding: 8px;
}

/* Tabela de zonas */
.pgv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
.pgv-table th {
  background: #003b73;
  color: #fff;
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pgv-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #e8e8e8;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Larguras fixas por coluna: Setor | Tipo de Uso | Terreno | Edificação | Status | Ações */
.pgv-table th:nth-child(1), .pgv-table td:nth-child(1) { width: 14%; }
.pgv-table th:nth-child(2), .pgv-table td:nth-child(2) { width: 18%; }
.pgv-table th:nth-child(3), .pgv-table td:nth-child(3) { width: 18%; text-align: right; }
.pgv-table th:nth-child(4), .pgv-table td:nth-child(4) { width: 19%; text-align: right; }
.pgv-table th:nth-child(5), .pgv-table td:nth-child(5) { width: 14%; text-align: center; }
.pgv-table th:nth-child(6), .pgv-table td:nth-child(6) { width: 17%; text-align: center; }
.pgv-row:hover td { background: #f5f8ff; }
.pgv-row--editing td { background: #fffbe6; }
.pgv-num { text-align: right; font-variant-numeric: tabular-nums; }
.pgv-empty { text-align: center; color: #888; padding: 16px !important; }

/* Inputs inline */
.pgv-input {
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid #b0bec5;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
}
.pgv-input:focus { outline: 2px solid #003b73; border-color: #003b73; }
.pgv-select {
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid #b0bec5;
  border-radius: 4px;
}

/* Botões de ação inline */
.pgv-actions { white-space: nowrap; }
.pgv-btn {
  font-size: 13px;
  padding: 3px 7px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 3px;
}
.pgv-btn--edit    { background: #e3eaf6; color: #003b73; }
.pgv-btn--del     { background: #fdecea; color: #c0392b; }
.pgv-btn--save    { background: #d4edda; color: #155724; }
.pgv-btn--cancel  { background: #f5f5f5; color: #555; }
.pgv-btn--outline { background: transparent; border: 1px solid #94a3b8; color: #334155; }
.pgv-btn--outline:hover { background: #f1f5f9; }
.pgv-btn--active  { background: #1d4ed8 !important; color: #fff !important; border-color: #1d4ed8 !important; }
.pgv-btn:hover    { filter: brightness(0.92); }

/* Painel flutuante — Redistribuir Bairros (multi-seleção de quadras) */
.pgv-mq-panel {
  position: fixed;
  z-index: 1200;
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  flex-direction: column;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  overflow: hidden;
}
.pgv-mq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #1e3a5f;
  color: #fff;
  border-radius: 10px 10px 0 0;
  font-size: 13px;
  font-weight: 600;
  gap: 8px;
}
.pgv-mq-header .modal-close-btn { color: #fff; opacity: .75; }
.pgv-mq-header .modal-close-btn:hover { opacity: 1; }
.pgv-mq-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 14px;
}
.pgv-mq-count {
  margin: 0;
  font-size: 12px;
  color: #475569;
  min-height: 16px;
}
.pgv-mq-label {
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  margin-bottom: -4px;
}
.pgv-mq-actions {
  display: flex;
  gap: 8px;
}
.pgv-mq-actions .pgv-btn { flex: 1; }

/* Badges */
.pgv-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}
.pgv-badge--green { background: #d4edda; color: #155724; }
.pgv-badge--gray  { background: #e2e3e5; color: #383d41; }

/* Formulário de nova zona */
.pgv-new-row {
  border-top: 1px solid #dde3ed;
  padding: 8px 12px;
  background: #f5f8ff;
}
.pgv-new-title {
  font-size: 11px;
  font-weight: 700;
  color: #003b73;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pgv-new-fields {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.pgv-new-fields .pgv-input { flex: 1; min-width: 100px; }
.pgv-btn--add {
  background: #003b73;
  color: #fff;
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Ícone de camada somente-leitura */
.layer-readonly-badge {
  font-size: 11px;
  margin-left: 4px;
  opacity: 0.6;
  cursor: default;
}

/* ── BCI: aba Valor Venal ──────────────────────────────────── */
.pgv-calc-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
  font-size: 13px;
}
.pgv-calc-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 8px;
  align-items: center;
}
.pgv-calc-label   { color: #555; font-size: 12px; }
.pgv-calc-formula { color: #666; font-size: 12px; }
.pgv-calc-result  { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; }
.pgv-calc-divider { height: 1px; background: #e0e0e0; margin: 4px 0; grid-column: 1 / -1; }
.pgv-calc-row--total .pgv-calc-label { font-weight: 700; color: #003b73; }
.pgv-valor-total  { font-weight: 700; font-size: 15px; color: #003b73; }
.pgv-sem-config   { background: #fff3cd; color: #856404; border-radius: 6px; padding: 10px 14px; font-size: 12px; }

/* ═══════════════════════════════════════════════════════════════════
   PAINEL VIABILIDADE POR CNAE
   ═══════════════════════════════════════════════════════════════════ */
.viab-panel {
  position: fixed;
  top: 90px;
  right: 20px;
  width: 420px;
  max-height: 86vh;
  min-width: 300px;
  min-height: 200px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.22);
  display: flex;
  flex-direction: column;
  z-index: 1200;
  font-family: inherit;
  overflow: hidden;
}

.viab-body {
  padding: 14px 16px 16px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Labels e campos */
.viab-label {
  font-size: 12px;
  font-weight: 600;
  color: #444;
  margin-top: 6px;
  display: block;
}
.viab-select,
.viab-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 13px;
  box-sizing: border-box;
  background: #fafafa;
  transition: border-color .15s;
}
.viab-select:focus,
.viab-input:focus {
  outline: none;
  border-color: #1a73e8;
  background: #fff;
}
.viab-hint {
  font-size: 11px;
  color: #888;
  margin: 1px 0 4px;
}

/* Busca + dropdown */
.viab-busca-wrap { position: relative; }
.viab-cnae-lista {
  position: absolute;
  top: calc(100% + 2px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  max-height: 220px;
  overflow-y: auto;
  z-index: 1300;
}
.viab-cnae-grupo {
  padding: 5px 10px 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #888;
  background: #f4f6fb;
  border-top: 1px solid #eee;
}
.viab-cnae-grupo:first-child { border-top: none; }
.viab-cnae-item {
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  gap: 8px;
  align-items: baseline;
  border-bottom: 1px solid #f0f0f0;
  transition: background .1s;
}
.viab-cnae-item:hover,
.viab-cnae-item--ativo { background: #e8f0fe; }
.viab-cnae-codigo { color: #1a73e8; font-weight: 700; white-space: nowrap; font-size: 11px; }
.viab-cnae-desc   { color: #333; flex: 1; }
.viab-cnae-empty  { padding: 10px 12px; font-size: 12px; color: #888; text-align: center; }

/* Botões de ação */
.viab-acoes {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.viab-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.viab-btn:disabled { opacity: .55; cursor: default; }
.viab-btn--primary { background: #1a73e8; color: #fff; flex: 1; }
.viab-btn--primary:hover:not(:disabled) { background: #1558b0; }
.viab-btn--ghost   { background: #f0f0f0; color: #555; }
.viab-btn--ghost:hover { background: #e0e0e0; }

/* Resultado */
.viab-resultado {
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
}
.viab-resultado.hidden { display: none; }

.viab-resultado--ok   { background: #e8f5e9; border: 1.5px solid #43a047; }
.viab-resultado--cond { background: #fffde7; border: 1.5px solid #f9a825; }
.viab-resultado--no   { background: #ffebee; border: 1.5px solid #e53935; }

.viab-resultado-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
}
.viab-resultado--ok   .viab-resultado-titulo { color: #2e7d32; }
.viab-resultado--cond .viab-resultado-titulo { color: #e65100; }
.viab-resultado--no   .viab-resultado-titulo { color: #c62828; }
.viab-resultado-ico   { font-size: 18px; line-height: 1; }

.viab-resultado-cnae  { margin: 0 0 3px; color: #222; }
.viab-resultado-zona  { margin: 0 0 6px; color: #555; font-size: 12px; }
.viab-resultado-obs   {
  margin: 6px 0 0;
  padding: 6px 10px;
  background: rgba(0,0,0,.05);
  border-radius: 4px;
  font-size: 12px;
  color: #444;
}
.viab-resultado-rodape {
  margin: 10px 0 0;
  font-size: 10px;
  color: #999;
  border-top: 1px solid rgba(0,0,0,.08);
  padding-top: 6px;
  line-height: 1.6;
}

/* ── Viabilidade v2 — Bairro/CNAE ──────────────────────────────────────── */
.viab-panel { width: 360px; min-width: 280px; max-width: 520px; }

.viab-tabs {
  display: flex;
  border-bottom: 2px solid #e0e0e0;
  padding: 0 10px;
  background: #fafafa;
}
.viab-tab {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: none;
  cursor: pointer;
  color: #777;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.viab-tab:hover { color: #1a73e8; }
.viab-tab--active { color: #1a73e8; border-bottom-color: #1a73e8; }

.viab-pane { padding: 10px 12px 12px; }
.viab-row-gap { margin-bottom: 8px; }

.viab-bairro-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.viab-bairro-row .viab-select { flex: 1; }
.viab-btn--icon {
  padding: 4px 8px;
  font-size: 14px;
  line-height: 1;
  background: #f0f0f0;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
}
.viab-btn--icon:hover { background: #e0e0e0; }
.viab-btn--active { background: #fde68a !important; border-color: #f59e0b !important; }

.viab-hint--action {
  color: #1a73e8;
  font-style: italic;
  animation: viab-blink .9s step-start infinite;
}
@keyframes viab-blink { 50% { opacity: .4; } }

.viab-result-box {
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid #e8e8e8;
  border-radius: 5px;
  margin-top: 6px;
  background: #fff;
}
.viab-result-bairro {
  padding: 7px 10px 4px;
  font-size: 12px;
  color: #333;
  border-bottom: 1px solid #f0f0f0;
  margin: 0;
}
.viab-result-count { color: #888; font-weight: normal; }
.viab-loading, .viab-empty, .viab-error {
  padding: 14px 12px;
  font-size: 12px;
  color: #888;
  text-align: center;
  margin: 0;
}
.viab-error { color: #c62828; }

/* ── Painel editor CNAEs ────────────────────────────────────────────────── */
.viab-editor-panel {
  position: fixed;
  z-index: 10200;
  width: 660px;
  min-width: 420px;
  max-width: 900px;
}
.viab-ed-body { padding: 8px 12px 6px; }
.viab-ed-cols {
  display: flex;
  gap: 0;
  align-items: stretch;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 6px;
}
.viab-ed-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.viab-ed-col-header {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  letter-spacing: .3px;
}
.viab-ed-col-header--ok { background: #e8f5e9; color: #2e7d32; }
.viab-ed-col-header--no { background: #ffebee; color: #c62828; }
.viab-ed-list {
  flex: 1;
  overflow-y: auto;
  max-height: 320px;
  background: #fff;
}
.viab-ed-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 6px;
  background: #f5f5f5;
  border-left: 1px solid #e0e0e0;
  border-right: 1px solid #e0e0e0;
}
.viab-ed-arrow {
  width: 30px;
  height: 30px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s;
}
.viab-ed-arrow:hover { background: #e8f0fe; border-color: #1a73e8; }

.viab-ed-item {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  user-select: none;
}
.viab-ed-item:hover { background: #f0f4ff; }
.viab-ed-item--sel  { background: #dbeafe; }
.viab-ed-item--sel:hover { background: #bfdbfe; }

.viab-ed-footer {
  display: flex;
  gap: 8px;
  padding: 8px 12px 10px;
  border-top: 1px solid #e8e8e8;
  background: #fafafa;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
}

/* ── Popup de clique no mapa (Viabilidade) ──────────────────────────────── */
.viab-click-popup {
  position: fixed;
  z-index: 10500;
  width: 300px;
  min-width: 220px;
  min-height: 180px;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 7px;
  box-shadow: 0 4px 18px rgba(0,0,0,.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 12px;
}
.viab-click-popup.hidden { display: none; }

.viab-click-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1a3a5c;
  color: #fff;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
}
.viab-click-popup-header .modal-close-btn {
  color: #fff;
  opacity: .8;
  font-size: 13px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
}
.viab-click-popup-header .modal-close-btn:hover { opacity: 1; }

.viab-click-popup-search {
  padding: 6px 8px;
  border-bottom: 1px solid #eee;
}
.viab-click-popup-search .viab-input {
  width: 100%;
  box-sizing: border-box;
  font-size: 11px;
  padding: 4px 8px;
}

.viab-click-popup-list {
  flex: 1 1 0;
  min-height: 60px;
  overflow-y: auto;
}

.pgv-obs          { color: #999; font-size: 11px; margin-top: 8px; }

/* ══════════════════════════════════════════════════════
   MÓDULO: Iluminação Pública
   ══════════════════════════════════════════════════════ */

/* overlay de fundo — apenas visual, não bloqueia interações do mapa */
.ip-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 1400;
  pointer-events: none;
}

/* overlay do painel de detalhe: sem fundo, sem bloquear mapa */
.ip-panel-overlay.modal-overlay {
  background: transparent !important;
  pointer-events: none !important;
  inset: auto !important;
  top: 0 !important;
  right: 0 !important;
  bottom: auto !important;
  left: auto !important;
  width: 0 !important;
  height: 0 !important;
  z-index: 1400 !important;
}

/* painel flutuante — drag+resize via ModalDrag */
.ip-panel.modal-box {
  pointer-events: auto;
  /* !important sobrepõe o cursor inline que o ModalDrag aplica ao box
     (move no header / *-resize nas bordas) — mantém sempre a seta.
     Botões/abas/selects definem o próprio cursor:pointer em si mesmos,
     então não são afetados por esta regra no elemento-pai. */
  cursor: default !important;
  position: fixed;
  top: 60px;
  right: 20px;
  width: 320px;
  min-width: 240px;
  min-height: 200px;
  max-height: calc(100vh - 80px);
  background: #fff;
  border-radius: 6px;
  z-index: 1401;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  font-size: 13px;
  overflow: hidden;
}

.ip-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #003b73;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.ip-close-btn {
  background: none;
  border: none;
  color: inherit;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}
.ip-close-btn:hover { opacity: .75; }

/* estado minimizado — esconde corpo, mantém só o header */
.ip-panel--minimized .ip-tabs,
.ip-panel--minimized .ip-tab-content {
  display: none !important;
}
.ip-panel--minimized {
  min-height: unset !important;
}

/* barra minimizada da lista de postes */
.ip-estoque-min-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 1501;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #003b73;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px 6px 0 0;
  box-shadow: 0 -2px 8px rgba(0,0,0,.25);
}
.ip-estoque-min-bar.hidden { display: none; }

/* abas */
.ip-tabs {
  display: flex;
  border-bottom: 2px solid #003b73;
  flex-shrink: 0;
}
.ip-tab-btn {
  flex: 1;
  border: none;
  background: #f0f4f8;
  padding: 8px 4px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
  color: #444;
  transition: background .15s;
}
.ip-tab-btn:hover { background: #dde7f0; }
.ip-tab-btn--active {
  background: #fff;
  color: #003b73;
  font-weight: 700;
  border-bottom: 2px solid #003b73;
  margin-bottom: -2px;
}

/* conteúdo das abas */
.ip-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
}

.ip-scroll {
  overflow-y: auto;
}

/* dados do poste */
.ip-dados-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.ip-etiqueta {
  font-size: 16px;
  font-weight: 700;
  color: #003b73;
}
.ip-situacao-badge {
  padding: 3px 10px;
  border-radius: 12px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}
.ip-dados-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 5px 8px;
  font-size: 12px;
}
.ip-label {
  color: #666;
  font-weight: 500;
}
.ip-dados-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* eventos de chamados */
.ip-event {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.ip-event--open  { border-left: 4px solid #e65100; }
.ip-event--closed { border-left: 4px solid #2e7d32; }
.ip-event-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #555;
  margin-bottom: 4px;
}
.ip-event-id { font-weight: 700; color: #003b73; }
.ip-event-status {
  padding: 1px 7px;
  border-radius: 10px;
  background: #e0e0e0;
  font-size: 10px;
}
.ip-event-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 3px;
}
.ip-event-meta {
  font-size: 11px;
  color: #777;
  display: flex;
  gap: 8px;
}
.ip-event-desc {
  margin-top: 5px;
  font-size: 12px;
  color: #444;
}

/* histórico de trocas */
.ip-troca {
  border: 1px solid #e0e0e0;
  border-left: 4px solid #003b73;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.ip-troca-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.ip-troca-tipo { font-weight: 600; font-size: 13px; }
.ip-troca-data { font-size: 11px; color: #777; }
.ip-troca-meta { font-size: 11px; color: #666; margin-top: 2px; }
.ip-troca-lampada { font-size: 11px; color: #555; margin-top: 3px; }
.ip-troca-desc { font-size: 12px; color: #444; margin-top: 4px; }

/* estoque */
.ip-estoque-item {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.ip-estoque-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}
.ip-estoque-nome { font-weight: 600; font-size: 13px; }
.ip-estoque-qty {
  font-size: 13px;
  font-weight: 700;
  color: #2e7d32;
}
.ip-estoque-qty--baixo { color: #c62828; }
.ip-estoque-meta { font-size: 11px; color: #777; margin-bottom: 6px; }
.ip-estoque-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ip-estoque-alerta { color: #e65100; font-size: 14px; margin-left: 4px; }

/* materiais na troca */
.ip-materiais-section {
  margin-top: 10px;
  border-top: 1px solid #e0e0e0;
  padding-top: 8px;
}
.ip-material-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.ip-material-row select { flex: 1; }
.ip-btn-remove-mat {
  background: none;
  border: none;
  color: #c62828;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

/* botões */
.ip-btn {
  padding: 7px 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: opacity .15s;
}
.ip-btn:hover { opacity: .85; }
.ip-btn--primary   { background: #003b73; color: #fff; }
.ip-btn--secondary { background: #e0e0e0; color: #333; }
.ip-btn--danger    { background: #c62828; color: #fff; }
.ip-btn--sm { padding: 4px 10px; font-size: 11px; }

/* modais internos */
.ip-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ip-modal-box {
  position: relative;
  background: #fff;
  border-radius: 8px;
  width: 420px;
  min-width: 320px;
  min-height: 200px;
  max-width: 96vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  overflow: visible;
}
.ip-modal-box--wide { width: 560px; }
.ip-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #003b73;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  border-radius: 8px 8px 0 0;
  flex-shrink: 0;
}
.ip-modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  font-size: 13px;
}
.ip-modal-body label {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
  color: #444;
  font-weight: 500;
}
.ip-modal-body input,
.ip-modal-body select,
.ip-modal-body textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 12px;
  margin-top: 3px;
  box-sizing: border-box;
}
.ip-modal-footer {
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid #e0e0e0;
  flex-shrink: 0;
}

/* estados genéricos */
.ip-loading { color: #777; font-style: italic; font-size: 13px; padding: 8px 0; }
.ip-error   { color: #c62828; font-size: 13px; padding: 8px 0; }
.ip-empty   { color: #999; font-size: 13px; padding: 8px 0; }

/* ── tabela de estoque ─────────────────────────────────────────────── */
.ip-estoque-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ip-estoque-table th {
  background: #003b73;
  color: #fff;
  padding: 9px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.ip-estoque-table tbody tr:nth-child(even) { background: #f5f8fc; }
.ip-estoque-table tbody tr:hover { background: #dde7f4; }
.ip-estoque-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #e8e8e8;
  vertical-align: middle;
}
.ip-tbl-code { color: #555; font-size: 11px; font-family: monospace; }
.ip-tbl-nome { font-weight: 500; }
.ip-tbl-cat  { color: #444; }
.ip-tbl-qty  { font-weight: 700; color: #1a6b3a; }
.ip-tbl-qty--baixo { color: #c62828; }
.ip-tbl-qty-min { color: #888; }
.ip-tbl-acoes { white-space: nowrap; }

.ip-tbl-btn {
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 3px;
  transition: opacity .15s;
  vertical-align: middle;
}
.ip-tbl-btn:hover { opacity: .75; }
.ip-tbl-btn--in  { background: #2e7d32; color: #fff; }
.ip-tbl-btn--out { background: #c62828; color: #fff; }
.ip-tbl-btn--adj { background: #e65100; color: #fff; font-size: 12px; }

.ip-status-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.ip-status-badge--ok     { background: #e8f5e9; color: #2e7d32; }
.ip-status-badge--alerta { background: #ffebee; color: #c62828; }

/* modal extra-largo para lista de postes */
.ip-modal-box--xl { width: 900px; max-width: 96vw; }

/* filtros da lista de postes */
.ip-postes-filtros {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: #f5f8fc;
  border-bottom: 1px solid #e0e0e0;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}
.ip-postes-filtros select,
.ip-postes-filtros input {
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 12px;
  height: 30px;
}
.ip-postes-filtros input { flex: 1; min-width: 160px; }

/* botões de ação na tabela de postes */
.ip-tbl-btn--view { background: #1565c0; color: #fff; font-size: 13px; }
.ip-tbl-btn--edit { background: #e65100; color: #fff; font-size: 13px; }
.ip-tbl-btn--del  { background: #b71c1c; color: #fff; font-size: 13px; }

/* linha da tabela selecionada (poste aberto no painel) */
.ip-tbl-row--selected {
  background: #e3f2fd !important;
  outline: 2px solid #1565c0;
  outline-offset: -2px;
}

/* formulário de poste: campos em grid de 2 colunas */
.ip-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.ip-form-row label {
  margin-bottom: 0 !important;
}

/* modal de estoque: mais largo para a tabela */
#ipEstoqueModal .ip-modal-box { width: 760px; max-width: 96vw; }

/* ── Chamados: ícone gota animado ─────────────────────────────── */
@keyframes chamado-bounce-high {
  0%, 100% { transform: translateY(0); }
  40%       { transform: translateY(-18px); }
  65%       { transform: translateY(-12px); }
}
@keyframes chamado-bounce-medium {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
@keyframes chamado-bounce-low {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-5px); }
}

.chamado-pin {
  position: relative;
  cursor: pointer;
  user-select: none;
  display: block;
  transform-origin: bottom center;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.35));
}
/* Rosto que indica a idade do chamado (sobre a "cabeça" da gota).
   Cor = categoria (gota); movimento = urgência (bounce); rosto = idade. */
.chamado-pin__face {
  position: absolute;
  top: 36%;
  left: 50%;
  transform: translate(-50%, -50%);
  line-height: 1;
  text-align: center;
  pointer-events: none;
}
.chamado-pin--high   { animation: chamado-bounce-high   0.35s ease-in-out infinite; }
.chamado-pin--medium { animation: chamado-bounce-medium  1.2s ease-in-out infinite; }
.chamado-pin--low    { animation: chamado-bounce-low     3.5s ease-in-out infinite; }

/* =====================================================================
   Perfil CADASTRADOR de campo: painel de Ferramentas mostra SOMENTE
   o botão "Cadastro Social". A classe é aplicada no <body> pelo app.js
   quando o usuário pertence ao grupo "cadastrador" (e não é admin).
   ===================================================================== */
body.cs-cadastrador-only #toolbar .toolbar-body > * {
  display: none !important;
}
body.cs-cadastrador-only #toolbar .toolbar-body > #btnCadastroSocial {
  display: block !important;
}
