/* Visual no estilo do PosteMap: topo verde-escuro, destaques verde-menta,
   cards arredondados. Conteúdo claro para ler bem sob o sol. */
:root {
  --escuro: #10292a;
  --escuro-2: #17393a;
  --escuro-3: #1f4746;
  --hero-1: #0f5c4d;
  --hero-2: #0b3b36;
  --teal: #13a27e;
  --teal-esc: #0e8467;
  --menta: #2fd6a3;
  --menta-clara: #d9f6ec;
  --laranja: #E67E00;
  --vermelho: #D62828;
  --azul: #2196F3;
  --fundo: #edf1f0;
  --card: #ffffff;
  --texto: #142423;
  --cinza: #667573;
  --borda: #dde5e3;
  --sombra: 0 1px 2px rgba(16, 41, 42, .06), 0 4px 14px rgba(16, 41, 42, .07);
  --raio: 18px;
  --aviso-h: 30px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--fundo); color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 16px;
  -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea { font: inherit; }
.oculto { display: none !important; }
svg { width: 1.25em; height: 1.25em; flex: none; display: block; }
[data-ic] { display: inline-flex; align-items: center; justify-content: center; }

/* ---------- aviso fixo ---------- */
.aviso { position: fixed; top: 0; left: 0; right: 0; z-index: 2000;
  padding: 6px 14px; padding-top: calc(6px + env(safe-area-inset-top));
  background: var(--escuro); color: #9fe9cf; font-size: 12.5px; line-height: 1.35;
  border-bottom: 1px solid rgba(255,255,255,.06); }
.aviso.pendente { background: var(--escuro); color: #ffcf8a; font-weight: 600; }

/* ---------- telas ---------- */
.tela { position: fixed; inset: 0; top: var(--aviso-h); display: flex; flex-direction: column; }
.topo { display: flex; align-items: center; gap: 12px; flex: none; z-index: 500;
  padding: 12px 14px; background: var(--escuro); color: #fff; min-height: 64px;
  border-bottom: 1px solid rgba(255,255,255,.06); }
.topo .titulos { flex: 1; min-width: 0; }
.topo h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: .1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo small { display: block; font-size: 12.5px; color: #9db6b2; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 42px; height: 42px; border-radius: 13px; flex: none; color: #fff;
  background: linear-gradient(145deg, #1bb98f, #0e8467); font-size: 22px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.logo.pequeno { width: 38px; height: 38px; border-radius: 12px; font-size: 20px; }
.voltar { width: 38px; height: 38px; border-radius: 12px; background: var(--escuro-2);
  color: #fff; font-size: 20px; flex: none; }
.botao-topo { display: inline-flex; align-items: center; gap: 6px; flex: none;
  background: var(--teal); color: #fff; font-weight: 600; font-size: 14.5px;
  padding: 10px 14px; border-radius: 12px; }

.conteudo { flex: 1; overflow-y: auto; padding: 14px 14px 120px; }
.lista { display: flex; flex-direction: column; gap: 10px; }

/* ---------- cartão de destaque (hero) ---------- */
.hero { position: relative; overflow: hidden; border-radius: 22px; padding: 18px 18px 20px;
  margin-bottom: 14px; color: #fff;
  background: linear-gradient(150deg, var(--hero-1), var(--hero-2)); box-shadow: var(--sombra); }
.hero .rot { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.hero .rot .logo { width: 32px; height: 32px; border-radius: 10px; font-size: 17px;
  background: rgba(255,255,255,.12); }
.hero .num { font-size: 56px; font-weight: 800; line-height: 1; margin-top: 14px;
  letter-spacing: -1px; }
.hero .num small { font-size: 18px; font-weight: 700; letter-spacing: 0; margin-left: 8px; }
.hero .det { font-size: 13px; color: #b9ddd4; margin-top: 6px; }
.hero .marca { position: absolute; right: -6px; bottom: -10px; font-size: 140px;
  color: rgba(255,255,255,.07); pointer-events: none; }

/* ---------- itens (projetos e partes) ---------- */
.item { display: flex; align-items: center; gap: 12px; padding: 14px;
  background: var(--card); border-radius: var(--raio); box-shadow: var(--sombra); }
.item .ico-redondo { width: 44px; height: 44px; border-radius: 14px; flex: none;
  background: var(--menta-clara); color: var(--teal-esc); font-size: 21px;
  display: flex; align-items: center; justify-content: center; }
.item .ico-redondo.cheia { background: #ffe9cf; color: #b35c00; }
.item .info { flex: 1; min-width: 0; }
.item .nome { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { font-size: 13px; color: var(--cinza); margin-top: 2px; }
.item .sub.alerta { color: #b35c00; font-weight: 600; }
.item .sub.pend { color: #c62828; font-weight: 600; }
.item .menu { width: 38px; height: 38px; border-radius: 12px; color: var(--cinza); font-size: 20px; flex: none; }
.barra-prog { height: 6px; border-radius: 6px; background: #e6eeec; margin-top: 8px; overflow: hidden; }
.barra-prog i { display: block; height: 100%; border-radius: 6px; background: var(--teal); }
.barra-prog i.cheia { background: var(--laranja); }
.dica { background: #e5f2ff; box-shadow: none; }
.dica .ico-redondo { background: #cfe6ff; color: #1565c0; }
.vazio { text-align: center; color: var(--cinza); padding: 36px 24px; background: var(--card);
  border-radius: var(--raio); border: 2px dashed var(--borda); line-height: 1.5; }

/* ---------- botões ---------- */
.fab { position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 600;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--teal); color: #fff; padding: 15px 20px; border-radius: 16px;
  font-weight: 700; font-size: 15.5px; box-shadow: 0 6px 18px rgba(14, 132, 103, .38); }
.fab:active, .botao-teal:active, .botao-menta:active { transform: scale(.98); }
.botao-teal, .botao-contorno, .botao-menta, .botao-fantasma, .botao-perigo {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 16px; border-radius: 14px; font-weight: 700; font-size: 15px; }
.botao-teal { background: var(--teal); color: #fff; }
.botao-menta { background: var(--menta); color: #06352a; }
.botao-contorno { background: #fff; color: var(--teal-esc); border: 1.5px solid #b9e3d6; }
.botao-fantasma { background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.18); }
.botao-perigo { background: var(--vermelho); color: #fff; }
.largo { width: 100%; margin-top: 10px; }
.linha { display: flex; gap: 10px; align-items: stretch; }
.linha > * { flex: 1; min-width: 0; }

/* ---------- mapa ---------- */
#mapa { flex: 1; z-index: 1; background: #1b2a2b; }
.camadas-ctrl { position: absolute; top: 76px; left: 12px; z-index: 520; display: flex; gap: 4px;
  padding: 4px; border-radius: 14px; background: rgba(16, 41, 42, .88);
  box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.camadas-ctrl button { width: 38px; height: 34px; border-radius: 10px; color: #b7cfcb; font-size: 19px; }
.camadas-ctrl button.ativo { background: var(--teal); color: #fff; }

.gps { position: absolute; top: 76px; right: 12px; z-index: 520; max-width: calc(100% - 130px);
  display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 14px;
  background: rgba(16, 41, 42, .88); color: #fff; font-weight: 600; font-size: 13.5px;
  box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.gps span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gps i { width: 10px; height: 10px; border-radius: 50%; flex: none; background: #9e9e9e;
  box-shadow: 0 0 0 3px rgba(158,158,158,.25); }
.gps.verde i { background: #3ddc84; box-shadow: 0 0 0 3px rgba(61,220,132,.28); }
.gps.laranja i { background: #ffa726; box-shadow: 0 0 0 3px rgba(255,167,38,.28); }
.gps.vermelho i { background: #ff5252; box-shadow: 0 0 0 3px rgba(255,82,82,.28); }

.ctrl-mapa { position: fixed; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 600;
  width: 48px; height: 48px; border-radius: 15px; background: #fff; color: var(--escuro);
  font-size: 22px; box-shadow: 0 3px 12px rgba(0,0,0,.25); }
.ctrl-mapa.seguindo { background: var(--escuro); color: var(--menta); }

.legenda { position: fixed; left: 12px; bottom: calc(30px + env(safe-area-inset-bottom)); z-index: 590;
  display: grid; grid-template-columns: auto; gap: 5px 12px; padding: 10px 12px;
  border-radius: 14px; background: rgba(16, 41, 42, .88); color: #e6f2ef; font-size: 11.5px;
  font-weight: 600; box-shadow: 0 2px 10px rgba(0,0,0,.3); max-width: calc(100% - 200px); }
.legenda span { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.bola { width: 11px; height: 11px; border-radius: 50%; background: var(--laranja); border: 1.5px solid #fff; flex: none; }
.bola.dados { background: #0B8F4D; }
.bola.ruim { background: transparent; border: 2.5px solid #ff5252; }
.bola.outras { background: #8a8a8a; width: 9px; height: 9px; }

.marcador { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid #fff;
  color: #fff; font: 700 9px/17px system-ui, sans-serif; text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.55); background: var(--laranja); }
.marcador.dados { background: #0B8F4D; }
.marcador.ruim { border: 2.5px solid #ff5252; line-height: 15px; }
.eu { width: 18px; height: 18px; border-radius: 50%; background: var(--azul);
  border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(33,150,243,.25), 0 1px 4px rgba(0,0,0,.4); }

.mira { position: absolute; left: 50%; transform: translate(-50%, -50%); z-index: 550;
  color: #ff5252; font-size: 54px; pointer-events: none;
  filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 1px #fff); }
.painel-escuro { background: rgba(16, 41, 42, .95); color: #fff; border-radius: 18px; padding: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.35); }
.barra-mover { position: absolute; left: 12px; right: 12px; z-index: 600;
  bottom: calc(18px + env(safe-area-inset-bottom)); }
.barra-mover p { margin: 2px 2px 12px; font-size: 14.5px; line-height: 1.4; color: #d5ebe6; }

.leaflet-control-attribution { font-size: 9.5px; background: rgba(255,255,255,.65) !important; }
.leaflet-bottom.leaflet-right { margin-bottom: 0; }

/* ---------- fundo escurecido ---------- */
.fundo { position: fixed; inset: 0; background: rgba(8, 22, 22, .5); z-index: 1000; }

/* ---------- ficha (folha de baixo) ---------- */
.folha { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1001; max-height: 90%;
  overflow-y: auto; background: var(--fundo); border-radius: 24px 24px 0 0;
  padding: 6px 14px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0,0,0,.25); }
.alca { width: 42px; height: 5px; border-radius: 5px; background: #c6d1ce; margin: 6px auto 12px; }
.ficha-topo { display: flex; align-items: center; gap: 12px; }
.ficha-topo .titulos { flex: 1; min-width: 0; }
.ficha-topo h2 { margin: 0; font-size: 20px; font-weight: 800; }
.ficha-topo small { display: block; color: var(--cinza); font-size: 13px; margin-top: 2px; }
.icone-redondo { width: 40px; height: 40px; border-radius: 13px; background: #fff; color: #c62828;
  font-size: 19px; box-shadow: var(--sombra); flex: none; }
.icone-redondo.escuro { background: rgba(255,255,255,.12); color: #fff; box-shadow: none; }
.selo { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 6px 11px;
  border-radius: 999px; font-size: 12.5px; font-weight: 700; background: #fff; box-shadow: var(--sombra); }
.selo::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.fotos { display: flex; gap: 10px; overflow-x: auto; margin: 14px -14px 0; padding: 2px 14px 6px; }
.fotos img, .fotos .mais { flex: none; width: 96px; height: 96px; border-radius: 16px; object-fit: cover;
  box-shadow: var(--sombra); background: #dfe7e5; }
.fotos .mais { border: 2px dashed #9fd9c6; background: #fff; color: var(--teal-esc); box-shadow: none;
  font-weight: 700; font-size: 12.5px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; }
.fotos .mais [data-ic], .fotos .mais svg { font-size: 22px; }

.grupo { background: var(--card); border-radius: var(--raio); padding: 4px 14px 14px;
  margin-top: 12px; box-shadow: var(--sombra); }
.grupo label { display: block; font-size: 12.5px; font-weight: 600; color: var(--cinza); margin-top: 12px; }
.grupo input, .grupo textarea { display: block; width: 100%; margin-top: 6px; padding: 12px 13px;
  color: var(--texto); border: 1.5px solid var(--borda); border-radius: 13px; background: #f8faf9;
  font-size: 16px; outline: none; resize: vertical; }
.grupo input:focus, .grupo textarea:focus { border-color: var(--teal); background: #fff; }
.campo-un { display: flex; margin-top: 6px; }
.campo-un input { margin-top: 0; border-radius: 13px 0 0 13px; border-right: 0; min-width: 0; }
.campo-un em { font-style: normal; display: flex; align-items: center; padding: 0 12px;
  border: 1.5px solid var(--borda); border-radius: 0 13px 13px 0; background: #eef3f1;
  color: var(--cinza); font-size: 14px; font-weight: 600; }
.rotulo { margin: 16px 2px 8px; font-weight: 700; font-size: 13px; color: var(--cinza);
  text-transform: uppercase; letter-spacing: .6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 11px 15px; border-radius: 999px;
  background: #fff; border: 1.5px solid var(--borda); font-weight: 600; font-size: 15px;
  color: var(--texto); box-shadow: var(--sombra); user-select: none; }
.chip input { display: none; }
.chip > [data-ic] { display: none; font-size: 16px; }
.chip.ativo { background: var(--teal); border-color: var(--teal); color: #fff; }
.chip.ativo > [data-ic] { display: inline-flex; }
.botoes-ficha { margin-top: 16px; }

/* ---------- visor de foto ---------- */
.visor { position: fixed; inset: 0; z-index: 1500; background: #050c0c; display: flex; flex-direction: column; }
.visor-topo { display: flex; justify-content: space-between; align-items: center;
  padding: 12px; padding-top: calc(12px + env(safe-area-inset-top)); }
.botao-perigo-escuro { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px;
  border-radius: 13px; background: rgba(255,82,82,.16); color: #ff8a80; font-weight: 700; font-size: 14.5px; }
.visor img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }

/* ---------- diálogo ---------- */
.dialogo { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1101;
  width: min(92vw, 420px); background: var(--fundo); border-radius: 24px; padding: 20px;
  box-shadow: 0 16px 40px rgba(0,0,0,.35); max-height: 88vh; overflow-y: auto; }
#fundoDialogo { z-index: 1100; }
.dialogo h3 { margin: 0 0 12px; font-size: 19px; font-weight: 800; }
.dialogo p { margin: 0 0 16px; color: #3d4c4a; line-height: 1.45; }
.dialogo input { width: 100%; padding: 13px; font-size: 16px; border: 1.5px solid var(--borda);
  border-radius: 13px; margin-bottom: 16px; background: #fff; outline: none; }
.dialogo input:focus { border-color: var(--teal); }
.dialogo .acoes { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.dialogo .texto-btn { color: var(--teal-esc); font-weight: 700; padding: 12px 12px; }
.opcao { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  background: var(--card); border-radius: 16px; padding: 12px; margin-bottom: 10px;
  box-shadow: var(--sombra); }
.opcao b { display: block; font-size: 15.5px; }
.opcao small { color: var(--cinza); font-size: 13px; }
.opcao .ico { width: 42px; height: 42px; border-radius: 13px; flex: none; font-size: 20px;
  background: var(--menta-clara); color: var(--teal-esc); display: flex; align-items: center; justify-content: center; }
.opcao.perigo .ico { background: #fde3e1; color: #c62828; }
.opcao.perigo b { color: #c62828; }
.arquivo-pronto { display: flex; gap: 12px; align-items: center; background: var(--card);
  border-radius: 16px; padding: 12px; margin-bottom: 6px; box-shadow: var(--sombra); }
.arquivo-pronto .ico { width: 42px; height: 42px; border-radius: 13px; font-size: 20px; flex: none;
  background: var(--menta-clara); color: var(--teal-esc); display: flex; align-items: center; justify-content: center; }
.arquivo-pronto b { display: block; word-break: break-all; font-size: 14.5px; }
.arquivo-pronto small { color: var(--cinza); }

/* ---------- progresso / toast ---------- */
.progresso { position: fixed; inset: 0; z-index: 1900; background: rgba(8, 22, 22, .5);
  display: flex; align-items: center; justify-content: center; }
.progresso .painel-escuro { display: flex; gap: 16px; align-items: center; width: min(86vw, 360px); }
.progresso p { margin: 0; color: #e6f2ef; }
.girando { width: 30px; height: 30px; flex: none; border-radius: 50%;
  border: 4px solid rgba(47,214,163,.25); border-top-color: var(--menta); animation: gira .9s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: calc(160px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 1950; background: rgba(16, 41, 42, .95); color: #fff;
  padding: 12px 18px; border-radius: 14px; max-width: 90vw; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,.3); }

/* ---------- passo a passo (localização) ---------- */
.passos { list-style: none; counter-reset: passo; margin: 0 0 6px; padding: 0; }
.passos li { counter-increment: passo; position: relative; padding: 10px 12px 10px 48px;
  margin-bottom: 8px; background: var(--card); border-radius: 14px; box-shadow: var(--sombra);
  font-size: 14.5px; line-height: 1.4; }
.passos li::before { content: counter(passo); position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%;
  background: var(--teal); color: #fff; font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center; }
.gps { cursor: pointer; }
.rotulo-passos { margin: 14px 2px 8px !important; font-weight: 700; font-size: 12.5px;
  color: var(--cinza) !important; text-transform: uppercase; letter-spacing: .6px; }
.arquivo-pronto small { display: block; }

/* ---------- modos Campo / Mapa ---------- */
.etq-modo { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  background: var(--menta); color: #06352a; vertical-align: 1px; }
.etq-modo.mapa { background: #ffd166; color: #4a3500; }
.etq-modo:empty { display: none; }
.selo-modo { display: inline-block; margin-top: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px;
  font-weight: 700; background: var(--menta-clara); color: var(--teal-esc); }
.selo-modo.mapa { background: #fff1cc; color: #8a5a00; }
.marcador.semfoto { background: #fff; color: var(--escuro); border-color: var(--laranja); border-width: 2px; line-height: 16px; }
.bola.semfoto { background: #fff; border: 2px solid var(--laranja); }
.aviso-modo { background: #fff6dc; border-radius: 14px; padding: 10px 12px; font-size: 13.5px;
  color: #6b4a00; margin: 0 0 12px; line-height: 1.4; }

/* ---------- parte concluída / etiquetas de exportação ---------- */
.item .ico-redondo.concluida { background: var(--teal); color: #fff; }
.barra-prog i.concluida { background: var(--teal); }
.nome-linha { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nome-linha .nome { flex: none; }
.etq-exp { flex: none; display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap; }
.etq-exp svg { width: 12px; height: 12px; }
.etq-exp.pend { background: #fff0dc; color: #a65500; }
.etq-exp.ok { background: var(--menta-clara); color: var(--teal-esc); }
.concluida-ico { width: 56px; height: 56px; border-radius: 50%; margin: 4px auto 12px; background: var(--teal);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 30px; }
.dialogo .centro { text-align: center; justify-content: center; }
