* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #222;
  -webkit-tap-highlight-color: transparent;
}
.oculto { display: none !important; }
button, select, input, textarea { font: inherit; }

/* Login */
#login-screen {
  position: fixed; inset: 0; background: #1a1a1a;
  display: flex; align-items: center; justify-content: center; z-index: 2000;
}
.login-box { background: #fff; border-radius: 10px; padding: 32px; width: 300px; max-width: calc(100% - 32px); text-align: center; }
.login-box h1 { color: #1a1a1a; margin: 0 0 4px; font-size: 22px; }
.login-box .subtitulo { color: #f4c400; background: #1a1a1a; display: inline-block; padding: 2px 10px; border-radius: 4px; font-size: 12px; margin-bottom: 20px; }
.login-box input { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 16px; }
.login-box input:focus { border-color: #1a1a1a; outline: none; }
.btn-entrar { width: 100%; padding: 10px; background: #1a1a1a; color: #f4c400; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; }
#login-erro { color: #c62828; font-size: 13px; min-height: 18px; margin-top: 8px; }

/* Shell */
#app { max-width: 900px; margin: 0 auto; padding-bottom: 90px; }
header.topo { background: #1a1a1a; color: #fff; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
header.topo h1 { font-size: 18px; margin: 0; }
header.topo .marca { color: #f4c400; }
.logo-topo { height: 26px; }

.barra-busca { display: flex; gap: 8px; padding: 12px 16px 6px; background: #fff; }
.barra-busca input { flex: 1; min-width: 0; padding: 11px; border: 1px solid #ccc; border-radius: 8px; font-size: 16px; }
.info-busca { background: #fff; padding: 0 16px 10px; font-size: 13px; color: #555; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.cidades-buscadas { background: #fff; padding: 0 16px 10px; display: flex; gap: 6px; overflow-x: auto; }
.cidades-buscadas:empty { display: none; }
.chip-cidade { flex: none; border: 1px solid #ddd; background: #fafafa; border-radius: 16px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.chip-cidade.ativa { background: #1a1a1a; color: #f4c400; border-color: #1a1a1a; }
.chip-cidade small { opacity: .7; }

.btn { background: #1a1a1a; color: #f4c400; border: none; border-radius: 8px; padding: 10px 16px; font-weight: bold; cursor: pointer; }
.btn:disabled { opacity: .5; }
.btn.secundario { background: #e8e8e8; color: #1a1a1a; }
.btn.grande { display: block; width: 100%; padding: 13px; margin-top: 10px; text-align: center; text-decoration: none; font-size: 15px; }
.btn.maps { background: #1a73e8; color: #fff; }
.link-btn { background: none; border: none; color: #1a73e8; padding: 4px 0; cursor: pointer; font-size: 13px; }

.abas { display: flex; background: #fff; border-bottom: 2px solid #eee; position: sticky; top: 0; z-index: 500; }
.aba-botao { flex: 1; padding: 13px 6px; border: none; background: none; font-size: 15px; color: #555; cursor: pointer; }
.aba-botao.ativa { color: #1a1a1a; border-bottom: 3px solid #f4c400; font-weight: bold; }
.contador { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #f4c400; color: #1a1a1a; font-size: 12px; font-weight: bold; }

.aba-conteudo { padding: 14px 16px; }
.aba-conteudo.sem-padding { padding: 0; }

/* Filtros */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { border: 1px solid #ccc; background: #fff; color: #888; border-radius: 16px; padding: 5px 11px; font-size: 13px; cursor: pointer; }
.chip.ativo { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.chip small { opacity: .7; }
.filtros { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.filtros input { flex: 1 1 200px; padding: 9px; border: 1px solid #ccc; border-radius: 8px; font-size: 16px; }
.filtros select { flex: 0 1 180px; padding: 9px; border: 1px solid #ccc; border-radius: 8px; background: #fff; font-size: 15px; }
.acoes-lista { display: flex; gap: 14px; align-items: center; font-size: 13px; color: #666; margin-bottom: 8px; }
.acoes-lista span { margin-right: auto; }

.vazio { text-align: center; color: #888; padding: 40px 10px; }

/* Cards */
.card { background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.card.selecionado { box-shadow: 0 0 0 2px #f4c400, 0 1px 2px rgba(0,0,0,.06); }
.item-topo { display: flex; gap: 10px; }
.check { flex: none; position: relative; width: 26px; height: 26px; margin-top: 2px; cursor: pointer; }
.check input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.check span { display: block; width: 26px; height: 26px; border: 2px solid #bbb; border-radius: 6px; }
.check input:checked + span { background: #f4c400; border-color: #1a1a1a; }
.check input:checked + span::after { content: '✓'; display: block; text-align: center; font-weight: bold; line-height: 22px; }
.item-info { flex: 1; min-width: 0; }
.item-nome { font-weight: 600; font-size: 15px; }
.item-meta { display: flex; gap: 8px; align-items: center; margin: 3px 0; flex-wrap: wrap; }
.tag { font-size: 11px; background: #f1f1f1; border-radius: 4px; padding: 2px 6px; color: #444; }
.nota { font-size: 12px; color: #b07800; }
.item-end { font-size: 13px; color: #666; overflow-wrap: anywhere; }
.item-visita { font-size: 12px; color: #1565c0; margin-top: 2px; }
.item-acoes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.item-acoes select.status {
  padding: 6px 8px; border-radius: 6px; border: 2px solid var(--cor); color: var(--cor); background: #fff; font-weight: 600; font-size: 13px;
}
.acao { font-size: 13px; padding: 6px 10px; border-radius: 6px; background: #f1f1f1; color: #1a1a1a; text-decoration: none; }
.anotacao { margin-top: 8px; font-size: 13px; }
.anotacao summary { color: #666; cursor: pointer; }
.anotacao textarea { width: 100%; margin-top: 6px; padding: 8px; border: 1px solid #ccc; border-radius: 6px; font-size: 15px; resize: vertical; }

/* Mapa */
.mapa { width: 100%; height: calc(100vh - 230px); min-height: 360px; }
.mapa-rota { height: 320px; min-height: 0; border-radius: 10px; margin: 12px 0; }
.legenda { display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 16px; font-size: 12px; background: #fff; }
.legenda i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.leaflet-popup-content .btn { margin-top: 8px; padding: 7px 12px; }

/* Rota */
.bloco h3 { margin: 0 0 8px; font-size: 15px; }
.opcao { display: flex; gap: 8px; align-items: center; padding: 6px 0; font-size: 15px; }
.linha { display: flex; gap: 8px; margin: 4px 0; }
.linha input { flex: 1; min-width: 0; padding: 9px; border: 1px solid #ccc; border-radius: 8px; font-size: 16px; }
.detalhe { font-size: 13px; color: #666; margin-top: 6px; }
.resumo-rota { display: flex; flex-wrap: wrap; gap: 6px 16px; background: #1a1a1a; color: #fff; border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.resumo-rota b { color: #f4c400; font-size: 17px; }
.resumo-rota .fonte { width: 100%; font-size: 12px; color: #bbb; }
.paradas { list-style: none; padding: 0; margin: 0; }
.parada { display: flex; flex-wrap: wrap; gap: 8px 10px; background: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; align-items: center; }
.parada.feita { opacity: .6; }
.parada .num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #f4c400; color: #1a1a1a; font-weight: bold; display: flex; align-items: center; justify-content: center; }
.parada-info { flex: 1; min-width: 0; }
.parada-acoes { display: flex; gap: 6px; width: 100%; justify-content: flex-end; }
.mini { border: 1px solid #ddd; background: #fafafa; border-radius: 6px; padding: 5px 10px; cursor: pointer; font-size: 13px; }
.mini:disabled { opacity: .35; }
.mini.visitado { background: #e3f0fc; border-color: #b8d6f5; color: #1565c0; font-weight: 600; }
.pino-num { background: #f4c400; color: #1a1a1a; border: 2px solid #1a1a1a; border-radius: 50%; font-weight: bold; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.pino-num.inicio { background: #1a1a1a; color: #f4c400; }

.btn-flutuante {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom));
  background: #1a1a1a; color: #f4c400; border: none; border-radius: 28px; padding: 14px 26px; font-weight: bold; font-size: 15px;
  box-shadow: 0 4px 14px rgba(0,0,0,.3); z-index: 1000; cursor: pointer;
}
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom));
  background: #333; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 1500; max-width: calc(100% - 32px);
}
