:root {
  --cor: #0f6e5c;
  --fundo: #ffffff;
  --fundo2: #f4f6f8;
  --texto: #1c2430;
  --texto2: #5b6676;
  --borda: #dde2e8;
  --sombra: 0 6px 24px rgba(16, 24, 40, .14);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fundo: #151a21; --fundo2: #1d242d; --texto: #e7ebf0; --texto2: #9aa6b5; --borda: #2c3541;
    --sombra: 0 6px 24px rgba(0, 0, 0, .45);
  }
}
:root[data-theme="dark"] {
  --fundo: #151a21; --fundo2: #1d242d; --texto: #e7ebf0; --texto2: #9aa6b5; --borda: #2c3541;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: Inter, system-ui, sans-serif; color: var(--texto); background: var(--fundo); }
body { display: grid; grid-template-rows: 60px 1fr; grid-template-columns: 300px 1fr; overflow: hidden; }

.topo { grid-column: 1 / 3; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--cor); color: #fff; z-index: 5; }
.marca { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brasao { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.18); border: 2px solid rgba(255,255,255,.6);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.brasao img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; background: #fff; }
.municipio { margin-left: auto; height: 34px; border-radius: 8px; border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.15);
  color: #fff; font: inherit; font-size: 13px; padding: 0 8px; }
.municipio option { color: #1c2430; }
.municipio + .busca { margin-left: 0; }
.orgao { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.produto { font-size: 12px; opacity: .85; }
.busca { position: relative; margin-left: auto; width: min(420px, 45vw); }
.busca input { width: 100%; height: 38px; border-radius: 8px; border: none; padding: 0 12px; font: inherit; font-size: 14px; }
.sugestoes { position: absolute; top: 42px; left: 0; right: 0; margin: 0; padding: 4px; list-style: none; background: var(--fundo);
  color: var(--texto); border-radius: 8px; box-shadow: var(--sombra); max-height: 320px; overflow: auto; }
.sugestoes li { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.sugestoes li small { color: var(--texto2); margin-left: 6px; }
.sugestoes li:hover, .sugestoes li.sel { background: var(--fundo2); }
.btn-menu { display: none; background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; }

.painel { grid-row: 2; background: var(--fundo); border-right: 1px solid var(--borda); overflow-y: auto; padding: 8px 16px 24px; z-index: 4; }
.painel section { padding: 12px 0; border-bottom: 1px solid var(--borda); }
.painel h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--texto2); display: flex; align-items: center; gap: 8px; }
.tag { background: var(--cor); color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 10px; letter-spacing: 0; text-transform: none; }
.tag.cinza { background: var(--fundo2); color: var(--texto2); }
.camada { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; cursor: pointer; }
.camada small { color: var(--texto2); margin-left: auto; }
.camada input { accent-color: var(--cor); width: 16px; height: 16px; }
.opacidade { display: flex; align-items: center; gap: 10px; padding: 2px 0 6px 24px; font-size: 12px; color: var(--texto2); }
.opacidade input { flex: 1; accent-color: var(--cor); }
.segmentado { display: flex; border: 1px solid var(--borda); border-radius: 8px; overflow: hidden; }
.segmentado button { flex: 1; border: none; background: var(--fundo); color: var(--texto); padding: 7px 0; font: inherit; font-size: 13px; cursor: pointer; }
.segmentado button.ativo { background: var(--cor); color: #fff; }
.legenda-relevo { padding: 2px 0 8px 24px; }
.rampa { height: 10px; border-radius: 5px; background: linear-gradient(90deg, #2e7d32, #8bc34a, #ffeb82, #d68c3c, #965032); }
.cotas { display: flex; justify-content: space-between; font-size: 11px; color: var(--texto2); margin-top: 3px; }
.vazio { font-size: 12px; color: var(--texto2); margin-bottom: 8px; }
.importada { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; }
.importada i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.importada button { margin-left: auto; border: none; background: none; color: var(--texto2); cursor: pointer; }
.btn-arquivo { display: inline-block; border: 1px dashed var(--borda); border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--cor); }
.ficha { font-size: 12px; color: var(--texto2); line-height: 1.6; border-bottom: none !important; }
.ficha strong { color: var(--texto); }

#mapa { grid-row: 2; grid-column: 2; position: relative; }

.ferramentas { position: fixed; top: 76px; right: 56px; display: flex; gap: 6px; z-index: 3; }
.ferramentas button { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 58px; padding: 6px 8px; border: none; border-radius: 8px;
  background: var(--fundo); color: var(--texto); box-shadow: var(--sombra); cursor: pointer; font-size: 16px; }
.ferramentas button span { font-size: 11px; color: var(--texto2); }
.ferramentas button.ativo { background: var(--cor); color: #fff; }
.ferramentas button.ativo span { color: #fff; }

.medida { position: fixed; right: 16px; bottom: 40px; width: 340px; background: var(--fundo); border-radius: 10px; box-shadow: var(--sombra); padding: 12px; z-index: 3; }
.medida-topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.medida-topo button { border: none; background: none; color: var(--texto2); cursor: pointer; font-size: 14px; }
.med-valor { font-size: 14px; }
.med-valor b { font-size: 18px; color: var(--cor); }
.perfil { width: 100%; height: 120px; margin-top: 8px; background: var(--fundo2); border-radius: 6px; }
.perfil-info { font-size: 11px; color: var(--texto2); margin-top: 4px; }

.rodape-coord { position: fixed; left: 316px; bottom: 8px; background: var(--fundo); color: var(--texto2); font-size: 11px; padding: 4px 8px;
  border-radius: 6px; box-shadow: var(--sombra); z-index: 3; font-variant-numeric: tabular-nums; }
.soltar { position: fixed; inset: 60px 0 0 300px; background: rgba(15, 110, 92, .25); border: 3px dashed var(--cor); display: grid; place-items: center;
  font-size: 20px; font-weight: 600; color: #fff; text-shadow: 0 1px 3px #000; z-index: 10; pointer-events: none; }
[hidden] { display: none !important; }

.camada.bloqueada { opacity: .45; pointer-events: none; }
.aviso-restrito { font-size: 11px; color: var(--texto2); margin: -4px 0 6px; }
.areas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.areas button { border: 1px solid var(--borda); background: var(--fundo2); color: var(--texto); border-radius: 8px; padding: 6px 4px; font: inherit;
  font-size: 12px; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.areas button small { font-weight: 400; font-size: 10px; color: var(--texto2); }
.areas button:hover { border-color: var(--cor); }

/* cadastro imobiliário */
.linha-tema { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--texto2); margin: 6px 0; }
.linha-tema select, .ficha-lote select, .ficha-lote input, .ficha-lote textarea { font: inherit; font-size: 13px; padding: 5px 6px; border: 1px solid var(--borda);
  border-radius: 6px; background: var(--fundo); color: var(--texto); width: 100%; }
.linha-tema select { width: auto; flex: 1; }
.cad-legenda { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; color: var(--texto2); margin: 4px 0 8px; }
.cad-legenda span { display: inline-flex; align-items: center; gap: 4px; }
.cad-legenda i { width: 10px; height: 10px; border-radius: 2px; }
.cad-resumo { font-size: 12px; color: var(--texto2); line-height: 1.8; }
.pill { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 10px; background: color-mix(in srgb, var(--c) 18%, transparent);
  color: var(--texto); border: 1px solid var(--c); white-space: nowrap; }
.cad-botoes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cad-botoes button, .ficha-lote button { font: inherit; font-size: 12px; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--borda);
  background: var(--fundo); color: var(--texto); cursor: pointer; }
button.primario { background: var(--cor) !important; color: #fff !important; border-color: var(--cor) !important; }
button.perigo { color: #c62828 !important; border-color: #ef9a9a !important; }

.ficha-lote { position: fixed; top: 140px; right: 16px; bottom: 40px; width: 360px; overflow-y: auto; background: var(--fundo); border-radius: 12px;
  box-shadow: var(--sombra); padding: 14px 16px; z-index: 4; font-size: 13px; }
.fl-topo { display: flex; justify-content: space-between; align-items: flex-start; }
.fl-topo small { color: var(--texto2); font-size: 11px; }
.fl-topo h3 { margin: 2px 0 6px; font-size: 18px; font-variant-numeric: tabular-nums; }
.fl-topo button { border: none !important; font-size: 15px !important; color: var(--texto2) !important; }
.ficha-lote h4 { margin: 14px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--texto2); }
.grade { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.campo label { display: block; font-size: 11px; color: var(--texto2); margin-bottom: 2px; }
.campo .nd { color: var(--texto2); opacity: .7; font-style: italic; }
.obs { font-size: 12px; color: var(--texto2); background: var(--fundo2); padding: 6px 8px; border-radius: 6px; }
.acoes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.geo { width: 100%; border-collapse: collapse; font-size: 12px; }
.geo td { padding: 3px 0; } .geo td:first-child { color: var(--texto2); }
.ficha-lote details { margin-top: 12px; font-size: 12px; color: var(--texto2); }
.ficha-lote details div div { padding: 2px 0; }
.instrucao, .aviso { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); background: #263238; color: #fff; padding: 8px 14px; border-radius: 8px;
  font-size: 13px; z-index: 6; box-shadow: var(--sombra); display: flex; gap: 10px; align-items: center; max-width: 90vw; }
.aviso { top: auto; bottom: 48px; background: #2e7d32; }
.instrucao button { border: 1px solid #fff6; background: none; color: #fff; border-radius: 6px; padding: 3px 8px; cursor: pointer; font: inherit; font-size: 12px; }
@media (max-width: 760px) {
  .ficha-lote { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 62vh; border-radius: 12px 12px 0 0; }
}

.maplibregl-popup-content { background: var(--fundo); color: var(--texto); border-radius: 10px; padding: 12px 14px; font-family: Inter, sans-serif; box-shadow: var(--sombra); min-width: 220px; }
.maplibregl-popup-tip { border-top-color: var(--fundo) !important; border-bottom-color: var(--fundo) !important; }
.pop h4 { margin: 0 0 6px; font-size: 14px; }
.pop table { border-collapse: collapse; font-size: 12px; width: 100%; }
.pop td { padding: 2px 0; vertical-align: top; }
.pop td:first-child { color: var(--texto2); padding-right: 10px; white-space: nowrap; }
.pop .sep { border-top: 1px solid var(--borda); margin: 6px 0; }

@media (max-width: 760px) {
  body { grid-template-columns: 1fr; }
  .painel { position: fixed; top: 60px; bottom: 0; left: 0; width: 86vw; max-width: 320px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--sombra); }
  .painel.aberto { transform: none; }
  #mapa { grid-column: 1; }
  .btn-menu { display: block; }
  .produto { display: none; }
  .busca { width: auto; flex: 1; }
  .ferramentas { top: auto; bottom: 40px; left: 16px; right: auto; }
  .ferramentas button span { display: none; }
  .ferramentas button { min-width: 44px; }
  .medida { left: 16px; right: 16px; width: auto; bottom: 96px; }
  .rodape-coord { left: auto; right: 16px; bottom: 8px; }
  .soltar { inset: 60px 0 0 0; }
}

/* página de entrada (domínio principal) */
body.modo-vitrine { display: block; overflow: auto; background: var(--fundo2); }
body.modo-vitrine > :not(.vitrine):not(script) { display: none !important; }
.vitrine { max-width: 1040px; margin: 0 auto; padding: 56px 16px 32px; }
.vt-cabeca h1 { margin: 0 0 8px; font-size: 34px; letter-spacing: -.02em; }
.vt-cabeca p { margin: 0 0 32px; color: var(--texto2); font-size: 16px; max-width: 640px; line-height: 1.5; }
.vt-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.cartao { display: flex; flex-direction: column; gap: 6px; background: var(--fundo); border-radius: 14px; padding: 20px; text-decoration: none;
  color: var(--texto); border-top: 5px solid var(--c); box-shadow: var(--sombra); transition: transform .15s; }
.cartao:hover { transform: translateY(-3px); }
.cartao-topo { width: 56px; height: 56px; border-radius: 50%; background: var(--c); display: grid; place-items: center; overflow: hidden; margin-bottom: 6px; }
.cartao-topo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.cartao-topo span { color: #fff; font-weight: 700; }
.cartao h2 { margin: 0; font-size: 20px; } .cartao h2 small { color: var(--texto2); font-weight: 500; }
.cartao p { margin: 0; color: var(--texto2); font-size: 13px; }
.cartao ul { margin: 6px 0; padding-left: 18px; font-size: 13px; line-height: 1.7; }
.cartao .entrar { margin-top: auto; color: var(--c); font-weight: 600; font-size: 14px; }
.vt-rodape { margin-top: 40px; color: var(--texto2); font-size: 12px; text-align: center; }

/* login e usuários */
.cad-usuario { font-size: 12px; color: var(--texto2); margin-top: 8px; }
.cad-usuario b { color: var(--texto); }
.cad-usuario .nd { color: #c62828; }
.modal { position: fixed; inset: 0; background: rgba(10, 16, 24, .55); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal-caixa { background: var(--fundo); color: var(--texto); border-radius: 14px; box-shadow: var(--sombra); padding: 20px; width: min(380px, 100%);
  display: flex; flex-direction: column; gap: 10px; max-height: 90vh; overflow: auto; }
.modal-caixa.largo { width: min(760px, 100%); }
.modal-topo { display: flex; justify-content: space-between; align-items: center; }
.modal-topo h3 { margin: 0; font-size: 18px; }
.modal-topo button { border: none; background: none; color: var(--texto2); font-size: 16px; cursor: pointer; }
.modal-caixa label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--texto2); }
.modal-caixa input, .modal-caixa select { font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--borda); border-radius: 8px;
  background: var(--fundo); color: var(--texto); }
.modal-caixa button { font: inherit; font-size: 13px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--borda); background: var(--fundo);
  color: var(--texto); cursor: pointer; }
.modal-caixa > button[type=submit], #btnNovoUsuario { align-self: flex-start; }
.modal-dica { font-size: 12px; color: var(--texto2); margin: 0; }
.modal-erro { color: #c62828; font-size: 13px; min-height: 1em; }
.tab-usuarios { width: 100%; border-collapse: collapse; font-size: 13px; }
.tab-usuarios th { text-align: left; font-size: 11px; color: var(--texto2); text-transform: uppercase; letter-spacing: .04em; padding: 6px 4px; border-bottom: 1px solid var(--borda); }
.tab-usuarios td { padding: 8px 4px; border-bottom: 1px solid var(--borda); vertical-align: top; }
.tab-usuarios tr.inativo td { opacity: .5; }
.tab-usuarios small { color: var(--texto2); }
.form-usuario { border-top: 1px solid var(--borda); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.form-usuario h4 { margin: 0; }
.form-usuario .camada { flex-direction: row; color: var(--texto); font-size: 13px; }
.linha-senha { display: flex; gap: 6px; } .linha-senha input { flex: 1; min-width: 0; }
.mun-lista { font-size: 12px; color: var(--texto2); }
.mun-lista #munUsuario { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 4px; }
.mun-lista label { flex-direction: row; align-items: center; color: var(--texto); font-size: 13px; }
@media (max-width: 760px) { .tab-usuarios th:nth-child(4), .tab-usuarios td:nth-child(4) { display: none; } }
