:root {
  --fundo: #f4f5f2; --painel: #ffffff; --texto: #1d2420; --suave: #5b6660; --linha: #dfe3dd;
  --acento: #0f5b4f; --acento-2: #e9f2ef; --alerta-bg: #fff6dc; --alerta-bd: #e4c36a; --alerta-tx: #5b4300;
  --setor: #d6453d; --viz: #0f5b4f; --sombra: 0 6px 24px rgba(16, 32, 26, .16);
  --r: 12px; font-size: 15px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--fundo); color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
#mapa { position: fixed; inset: 0; background: #e8ebe6; }

#painel { position: fixed; z-index: 1000; top: 14px; left: 14px; width: 400px; max-height: calc(100vh - 28px);
  display: flex; flex-direction: column; background: var(--painel); border-radius: var(--r); box-shadow: var(--sombra); overflow: hidden; }
.topo { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.marca { display: flex; gap: 10px; align-items: center; }
.logo { width: 30px; height: 30px; border-radius: 8px; background:
  radial-gradient(circle at 35% 35%, #fff 0 3px, transparent 4px), conic-gradient(from 200deg, #0f5b4f, #3a9a7f, #c9e3d5, #0f5b4f); }
h1 { font-size: 1.15rem; margin: 0; letter-spacing: -.01em; }
.sub { margin: 0; font-size: .8rem; color: var(--suave); }
.icone { border: 0; background: transparent; font-size: 1.3rem; color: var(--suave); cursor: pointer; padding: 4px 8px; border-radius: 8px; display: none; }

.abas { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--linha); }
.abas button { flex: 1; border: 0; background: none; padding: 10px 4px; font: inherit; font-size: .9rem; color: var(--suave);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.abas button.ativa { color: var(--acento); border-bottom-color: var(--acento); font-weight: 600; }
.aba { padding: 14px 16px; overflow-y: auto; }
.aba h2 { font-size: .95rem; margin: 14px 0 6px; }
.aba h2:first-child { margin-top: 0; }
.aba p, .aba li { font-size: .88rem; line-height: 1.5; color: #333d37; }
.aba ol { padding-left: 18px; margin: 4px 0; }
.oculto { display: none !important; }

label { font-size: .82rem; color: var(--suave); display: block; margin-bottom: 6px; }
.linha { display: flex; gap: 8px; }
input#coord { flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border: 1px solid #c9cfc8; border-radius: 9px; }
input#coord:focus { outline: 2px solid var(--acento); outline-offset: -1px; border-color: transparent; }
button.primario, button.secundario { font: inherit; font-weight: 600; border-radius: 9px; padding: 10px 16px; cursor: pointer; border: 0; }
button.primario { background: var(--acento); color: #fff; }
button.primario:disabled { opacity: .55; cursor: progress; }
button.secundario { background: var(--acento-2); color: var(--acento); }
.largo { width: 100%; margin-top: 10px; }
.dica { font-size: .8rem !important; color: var(--suave) !important; margin: 6px 0 0; }
.status { font-size: .85rem; color: var(--suave); margin-top: 8px; min-height: 1em; }
.status.erro { color: #a3241c; }

.resultado { margin-top: 10px; border: 1px solid var(--linha); border-radius: 10px; padding: 14px; position: relative; }
.resultado .fechar { position: absolute; top: 8px; right: 8px; border: 0; background: none; font-size: 1.2rem; color: var(--suave); cursor: pointer; }
.valor { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; color: var(--acento); line-height: 1.1; }
.rotulo { font-size: .85rem; font-weight: 600; margin-top: 4px; }
.nota { font-size: .78rem; color: var(--suave); margin-top: 2px; }
dl.dados { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 12px 0 0; font-size: .84rem; }
dl.dados dt { color: var(--suave); }
dl.dados dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; word-break: break-word; }
.alerta { background: var(--alerta-bg); border: 1px solid var(--alerta-bd); color: var(--alerta-tx); border-radius: 8px;
  padding: 7px 10px; font-size: .8rem; line-height: 1.4; margin-top: 10px; }
.acoes { display: flex; gap: 8px; margin-top: 12px; }
.acoes button { flex: 1; font: inherit; font-size: .82rem; font-weight: 600; padding: 8px; border-radius: 8px; border: 1px solid var(--linha);
  background: #fff; color: var(--acento); cursor: pointer; }
.versao-res { font-size: .72rem; color: var(--suave); margin-top: 10px; }

.arquivo { display: block; border: 1px dashed #b9c2ba; border-radius: 9px; padding: 12px; text-align: center; cursor: pointer;
  color: var(--acento); font-size: .88rem; margin-top: 8px; }
.arquivo input { display: none; }
.progresso { height: 6px; background: var(--acento-2); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.progresso div { height: 100%; width: 0; background: var(--acento); transition: width .15s; }

.rodape { border-top: 1px solid var(--linha); padding: 8px 16px; font-size: .72rem; color: var(--suave); }

.pino { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--acento);
  border: 2px solid #fff; box-shadow: -1px 2px 4px rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; }
.pino span { transform: rotate(45deg); color: #fff; font-size: 10px; font-weight: 700; line-height: 1; max-width: 22px; overflow: hidden; white-space: nowrap; }
.pino.erro { background: #a3241c; } .pino.aviso { background: #c08a00; }
.leaflet-div-icon { background: none; border: 0; }

@media (max-width: 640px) {
  #painel { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 58vh; border-radius: 14px 14px 0 0; }
  #painel.recolhido { max-height: 64px; }
  .icone { display: block; }
  #painel.recolhido .icone { transform: rotate(180deg); }
  .valor { font-size: 1.7rem; }
}
