:root {
  color-scheme: light;
  --verde: #0f3d32;
  --verde-2: #146c43;
  --fundo: #f3f6f4;
  --card: #fff;
  --linha: #d7e0db;
  --texto: #14211c;
  --mudo: #5d6b64;
  --nav: 4.4rem;
  font-family: "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fundo); color: var(--texto); }
body {
  height: 100dvh; display: flex; flex-direction: column; overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select { font: inherit; color: inherit; }
button { min-height: 44px; border-radius: 10px; border: 1px solid var(--linha); background: #fff; padding: 0 12px; }
button.primario, menu button[value="ok"], #aplicar { background: var(--verde); color: #fff; border-color: var(--verde); }
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--verde); color: #fff;
}
header button { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
header span { display: flex; gap: 8px; }
body.sem-sessao .busca,
body.sem-sessao main,
body.sem-sessao nav,
body.sem-sessao #filtros-ativos,
body.sem-sessao #dica-busca { display: none !important; }
#login { width: min(420px, 100vw); }
#login-erro { margin: 0; }
#aviso { margin: 8px 12px 0; padding: 8px 10px; background: #fff4d6; border-radius: 10px; }
.busca { display: flex; gap: 8px; padding: 8px 12px; }
.busca input { flex: 1; min-width: 0; min-height: 44px; border: 1px solid var(--linha); border-radius: 10px; padding: 0 12px; background: #fff; }
main { padding: 0 12px 12px; }
#tela-lista, #tela-roteiro, #tela-painel { flex: 1; min-height: 0; overflow: auto; }
#tela-mapa { padding: 0; position: relative; flex: 1; min-height: 0; display: flex; }
#tela-mapa[hidden], #tela-lista[hidden], #tela-roteiro[hidden], #tela-painel[hidden] { display: none; }
#mapa { flex: 1; min-height: 0; background: #d9e2dc; }
.mapa-acoes {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 500;
  display: flex; flex-direction: column; gap: 6px; pointer-events: none;
}
.mapa-acoes button, #legenda { pointer-events: auto; }
#legenda {
  margin: 0; padding: 6px 8px; background: rgba(255,255,255,.92); border-radius: 10px;
  font-size: 12px; color: var(--mudo); display: flex; align-items: center; gap: 6px;
}
#legenda i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.eu { background: transparent; border: 0; }
.eu span {
  display: block; width: 16px; height: 16px; border-radius: 50%;
  background: #1d4ed8; border: 3px solid #fff; box-shadow: 0 0 0 2px #1d4ed8;
}
.leaflet-tooltip.eu-rotulo {
  background: #1d4ed8; color: #fff; border: 0; border-radius: 999px;
  padding: 2px 8px; font-weight: 700; box-shadow: none;
}
.leaflet-tooltip.eu-rotulo.leaflet-tooltip-top::before { border-top-color: #1d4ed8; }
#filtros-ativos { display: flex; gap: 6px; overflow: auto; padding: 0 12px 8px; flex: none; }
#filtros-ativos:empty { display: none; }
#filtros-ativos button { min-height: 32px; white-space: nowrap; }
#dica-busca { margin: 0 12px 8px; font-size: 13px; flex: none; }
nav {
  flex: none; z-index: 600;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--linha);
}
nav button { border: 0; background: transparent; color: var(--mudo); }
nav button.ativo { color: var(--verde); font-weight: 700; }
.card, .item {
  background: var(--card); border: 1px solid var(--linha); border-radius: 14px; padding: 12px; margin-bottom: 8px;
}
.item { width: 100%; text-align: left; }
.item strong, .card strong { display: block; }
.mudo { color: var(--mudo); font-size: 14px; }
.acoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.acoes a, .acoes button { flex: 1; min-width: 7rem; text-align: center; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.acoes a.ligar, button.primario { background: var(--verde); color: #fff; border-color: var(--verde); }
#tela-roteiro .acoes { display: grid; grid-template-columns: 1fr 1fr; }
#tela-roteiro .parada { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
#tela-roteiro .parada button { flex: 1; min-width: 5.5rem; }
.sem-mapa { color: #9a3412; font-size: 13px; margin-top: 4px; }
.sit { display: inline-block; padding: 2px 8px; border-radius: 999px; color: #fff; font-size: 12px; }
dialog { border: 0; padding: 0; width: min(520px, 100vw); max-height: 100dvh; }
dialog::backdrop { background: rgba(0,0,0,.35); }
#filtros form, #ficha, #visita-rapida form, #geo-trabalho form, #login form { padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); overflow: auto; max-height: 100dvh; }
#filtros header, #ficha header, #visita-rapida header, #geo-trabalho header { display: flex; justify-content: space-between; align-items: center; gap: 8px; position: sticky; top: 0; background: #fff; }
#filtros menu { position: sticky; bottom: 0; background: #fff; z-index: 2; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); }
details { margin-top: 12px; }
details summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; }
.popup-acoes { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; min-width: 180px; }
.popup-acoes a, .popup-acoes button { min-height: 44px; }
label { display: block; margin: 10px 0; font-size: 14px; }
input, select { width: 100%; min-height: 44px; margin-top: 4px; border: 1px solid var(--linha); border-radius: 10px; padding: 0 10px; background: #fff; }
label.check { display: flex; align-items: center; gap: 8px; }
label.check input { width: auto; min-height: 0; }
menu { display: flex; gap: 8px; padding: 8px 0 0; }
menu button { flex: 1; }
.grade { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.numero { font-size: 28px; font-weight: 700; }
#toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav) + 12px); z-index: 800;
  background: #14211c; color: #fff; padding: 12px; border-radius: 12px; text-align: center;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button[aria-pressed="true"] { background: var(--verde); color: #fff; border-color: var(--verde); }
.vazio { padding: 24px 8px; text-align: center; color: var(--mudo); }
textarea { width: 100%; min-height: 72px; border: 1px solid var(--linha); border-radius: 10px; padding: 8px; }
