#painel-orcamento {
    max-height: 85vh;
    overflow-y: auto;
    padding-bottom: 20px;
    position: fixed !important; /* Muda para fixed para flutuar solto na tela */
    top: 70px !important;
    left: 20px !important; /* Força para o lado esquerdo */
    right: auto !important; /* Cancela qualquer regra que puxe pra direita */
    width: 400px;
    z-index: 5000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    border-radius: 8px;
}

/* --- TELA DE MÓDULOS --- */
#tela-modulos {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: #002147; 
    z-index: 9500; 
    display: none; 
    flex-direction: column;
    align-items: center; 
    justify-content: flex-start; /* Mudado de center para flex-start */
    font-family: 'Segoe UI', sans-serif;
    overflow-y: auto; /* Adiciona rolagem vertical se necessário */
    padding: 40px 0; /* Espaço para não colar no topo e no fundo */
}
.modulos-grid {
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px; 
    width: 90%; 
    max-width: 1000px; 
    margin: 20px auto; /* Centraliza a grid */
    padding-bottom: 50px; /* Margem extra no final para o respiro */
}
.card-modulo {
    background: white; 
    border-radius: 12px; 
    padding: 20px; /* Reduzido de 30px para 20px */
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5); 
    cursor: pointer; 
    transition: all 0.3s ease;
    border: 3px solid transparent; 
    display: flex; 
    flex-direction: column; 
    align-items: center;
}
.card-modulo:hover { transform: translateY(-5px); border-color: #64b5f6; }
.card-modulo h3 { color: #002147; margin: 10px 0; font-size: 18px; }
.card-modulo.disabled { opacity: 0.5; cursor: not-allowed; background: #f0f0f0; }
        body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; display: flex; flex-direction: column; height: 100vh; background: #f4f6f9; overflow: hidden; }
        
        #topbar { background: #002147; display: flex; align-items: center; justify-content: flex-start; padding: 0 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.3); z-index: 1000; position: relative; height: 60px; flex-shrink: 0; }        
     header { display: flex; flex-direction: column; color: white; margin-right: 30px; flex-shrink: 0; }
     header span { font-weight: bold; font-size: 1.2em; line-height: 1; white-space: nowrap; }
     header span.sub { font-size: 0.75em; color: #a0c4ff; margin-top: 2px; white-space: nowrap; }

        .nav-menu { display: flex; height: 100%; align-items: center; flex: 1; }
        .nav-item { position: relative; height: 100%; display: flex; align-items: center; }
        
        .tab-btn { background: transparent; border: none; color: white; font-weight: bold; font-size: 13px; text-transform: uppercase; padding: 0 20px; height: 100%; cursor: pointer; transition: 0.2s; border-bottom: 4px solid transparent; display: flex; align-items: center; gap: 8px;}
        .tab-btn:hover { background: rgba(255, 255, 255, 0.1); }
        .tab-btn.active { background: rgba(255, 255, 255, 0.15); border-bottom: 4px solid #64b5f6; }

        .dropdown-panel { position: absolute; top: 60px; left: 0; background: white; border-radius: 0 0 8px 8px; box-shadow: 0 8px 16px rgba(0,0,0,0.2); padding: 15px; display: none; z-index: 2000; max-height: calc(100vh - 80px); overflow-y: auto; color: #333; cursor: default; }
        .dropdown-panel.active { display: flex; flex-direction: column; gap: 15px; }
        .nav-item.right-align .dropdown-panel { left: auto; right: 0; }

        .panel-slim { width: 340px; }
        .panel-wide { width: 700px; grid-template-columns: 1fr 1fr; align-items: start; }
        .dropdown-panel.active.panel-wide { display: grid; gap: 15px; }

        .search-container { position: relative; width: 320px; display: flex; align-items: center; margin-left: 20px;}
        .search-container input { width: 100%; padding: 10px 35px 10px 15px; border-radius: 20px; border: none; outline: none; font-size: 13px; background: rgba(255,255,255,0.9); transition: 0.3s;}
        .search-container input:focus { background: white; box-shadow: 0 0 5px rgba(100, 181, 246, 0.5); }
        .search-container .btn-limpar-input { position: absolute; right: 12px; color: #666; font-weight: bold; font-size: 14px; cursor: pointer; display: none; }

        .bloco { border: 1px solid #e0e0e0; padding: 15px; border-radius: 6px; background: #fafafa; display: flex; flex-direction: column; gap: 8px; height: fit-content; }
        .bloco-titulo { font-size: 11px; font-weight: bold; color: #002147; text-transform: uppercase; border-bottom: 1px solid #ddd; padding-bottom: 5px; margin-bottom: 5px; }
        
        input[type="text"], select, input[type="file"] { padding: 8px; border-radius: 4px; border: 1px solid #bbb; width: 100%; box-sizing: border-box; font-size: 12px; }
        
        .input-com-limpar { position: relative; display: flex; align-items: center; width: 100%; }
        .input-com-limpar input { width: 100%; padding-right: 35px; }
        .btn-limpar-input { position: absolute; right: 8px; cursor: pointer; color: #888; font-weight: bold; font-size: 14px; padding: 4px; border-radius: 50%; display: none; line-height: 1; }
        .btn-limpar-input:hover { color: #d32f2f; background: #ffebee; }

        button { border: none; padding: 8px; border-radius: 4px; cursor: pointer; font-weight: bold; transition: 0.3s; font-size: 12px; color: white; }
        .btn-acao { background: #004080; } .btn-acao:hover { background: #002147; }
        .btn-busca { background: #2e7d32; font-size: 13px; padding: 12px; } .btn-busca:hover { background: #1b5e20; }
        .btn-limpar { background: #d32f2f; }
        .btn-excluir { background: #e65100; }
        
        .grid-botoes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
        .btn-export-kml { background: #0288d1; } .btn-export-kml:hover { background: #01579b; }
        .btn-export-gpx { background: #00796b; } .btn-export-gpx:hover { background: #004d40; }
        .btn-export-excel { background: #2e7d32; grid-column: span 2;} .btn-export-excel:hover { background: #1b5e20; }
        .btn-backup { background: #607d8b; } .btn-backup:hover { background: #455a64; }
        .btn-restore { background: #5c6bc0; } .btn-restore:hover { background: #3949ab; }

#map-container {
    position: absolute;
    top: 60px; /* Começa exatamente abaixo da barra azul superior */
    left: 0;
    right: 0;
    bottom: 0; /* Estica obrigatoriamente até o final da tela */
    display: flex;
    flex-direction: column;
    background: #e5e3df; 
    z-index: 1;
}

#map {
    width: 100%;
    height: 100% !important; /* A trava principal que impede a tela branca */
    flex: 1;
}

        .pac-container { z-index: 9999 !important; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

        .bilhete { font-family: 'Segoe UI', sans-serif; min-width: 250px; }
        .bilhete-titulo { background: #002147; color: white; padding: 5px; text-align: center; font-weight: bold; border-radius: 4px 4px 0 0; font-size: 13px; margin: -14px -14px 10px -14px; }
        .info-linha { color: #2e7d32; font-weight: bold; font-size: 16px; text-transform: uppercase; border-bottom: 1px solid #ddd; padding-bottom: 5px; margin-bottom: 5px; }
        .info-endereco { font-size: 12px; color: #444; margin-bottom: 10px; line-height: 1.3; font-weight: bold;}
        .box-horario { display: flex; justify-content: space-between; background: #f1f8e9; border: 1px solid #c5e1a5; padding: 8px; border-radius: 4px; margin-bottom: 5px; }
        .horario-real { font-size: 11px; color: #555; }
        .horario-real span { font-size: 14px; font-weight: bold; color: #333; display: block; }
        .horario-chegada { font-size: 11px; color: #d32f2f; font-weight: bold; text-align: right; }
        .horario-chegada span { font-size: 16px; color: #d32f2f; display: block; }
        .info-caminhada { background: #e3f2fd; padding: 5px; border-radius: 4px; text-align: center; font-size: 11px; color: #0277bd; font-weight: bold; border: 1px solid #b3e5fc; }
        
footer { 
    background: #002147; 
    color: rgba(255,255,255,0.6); 
    text-align: center; 
    padding: 6px; 
    font-size: 10px; 
    border-top: 1px solid #003366; 
    width: 100%; 
    z-index: 500;
    /* Removemos o position: absolute daqui para não bugar */
}
        .sugestoes-container { position: relative; width: 100%; }
        .lista-sugestoes { position: absolute; top: 100%; left: 0; right: 0; background: white; border: 1px solid #ddd; border-top: none; z-index: 2000; max-height: 150px; overflow-y: auto; box-shadow: 0 4px 6px rgba(0,0,0,0.1); display: none; }
        .sugestao-item { padding: 8px; cursor: pointer; font-size: 12px; border-bottom: 1px solid #f0f0f0; }
        .sugestao-item:hover { background-color: #e3f2fd; }

        @media (max-width: 900px) {
            .panel-wide { grid-template-columns: 1fr; width: 340px; }
            .search-container { width: 200px; }
            header span { font-size: 1em; }
        }

         .ag-box { max-width: 800px; margin: 0 auto; background: #002147; padding: 20px; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.4); color: white; font-family: 'Segoe UI', sans-serif; }
        .ag-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #004080; padding-bottom: 15px; margin-bottom: 20px; }
        .ag-header h2 { margin: 0; color: #fbbc04; font-size: 24px; }
        .ag-controle { display: flex; flex-direction: column; background-color: #003366; padding: 15px; border-radius: 6px; margin-bottom: 15px; }
        .ag-nav { display: flex; justify-content: space-between; align-items: center; }
        .ag-btn-sem { background-color: #0288d1; color: white; border: none; padding: 8px 15px; border-radius: 4px; cursor: pointer; font-weight: bold; transition: 0.2s;}
        .ag-btn-sem:hover { background-color: #01579b; }
        .ag-pulo { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #004080; }
        .ag-pulo label { font-size: 12px; color: #90caf9; font-weight: bold;}
        .ag-input-data { background-color: #fff; color: #002147; border: 1px solid #ccc; padding: 6px 10px; border-radius: 4px; cursor: pointer; font-weight: bold; }
        
        .ag-tabs { display: flex; gap: 5px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 5px; }
        .ag-tab { flex: 1; background-color: #003366; color: white; border: 1px solid #004080; border-radius: 6px; padding: 10px 5px; cursor: pointer; text-align: center; font-size: 13px; min-width: 80px; transition: 0.2s; }
        .ag-tab.ativo { background-color: #fbbc04; color: #002147; border-color: #fbc02d; font-weight: bold; transform: scale(1.02); }
        
        /* Formulário e Filtros */
        .ag-form { display: flex; gap: 10px; margin-bottom: 25px; align-items: center; }
        .ag-input-txt { padding: 12px; border: none; border-radius: 4px; background-color: #fff; color: #333; font-size: 14px; box-sizing: border-box; }
        .ag-input-hora { width: 130px; font-weight: bold; color: #002147; }
        .ag-input-prioridade { width: 130px; font-weight: bold; cursor: pointer; }
        .ag-input-tarefa { flex-grow: 1; }
        .ag-btn-inc { background-color: #2e7d32; color: white; font-weight: bold; cursor: pointer; border: none; padding: 12px 20px; border-radius: 4px; transition: 0.2s; min-width: 100px;}
        .ag-btn-inc:hover { background-color: #1b5e20; }
        
        .ag-barra-filtros { display: flex; justify-content: space-between; align-items: center; background: #003366; padding: 10px 15px; border-radius: 6px; margin-bottom: 15px; border: 1px solid #004080; }
        .ag-filtro-grupo { display: flex; gap: 10px; align-items: center; }
        .ag-filtro-grupo label { font-size: 12px; color: #90caf9; font-weight: bold; }
        .ag-filtro-select { padding: 6px; border-radius: 4px; background: #fff; border: none; font-size: 12px; font-weight: bold; color: #002147; cursor: pointer; }

        .ag-titulo { border-bottom: 1px solid #004080; padding-bottom: 10px; margin-top: 0; font-size: 18px; color: #fbbc04; }
        .ag-ul { list-style: none; padding: 0; margin: 0; }
        .ag-li { display: flex; align-items: center; padding: 12px; background: #f4f6f9; margin-bottom: 8px; border-radius: 4px; border-left: 5px solid #2e7d32; transition: 0.2s;}
        .ag-li.concluida { border-left-color: #757575; opacity: 0.6; background: #e0e0e0; }
        .ag-li.concluida span.ag-txt { text-decoration: line-through; color: #757575; }
        .ag-chk { margin-right: 15px; transform: scale(1.3); cursor: pointer; }
        .ag-txt { flex-grow: 1; font-size: 14px; color: #002147; font-weight: bold; }
        
        .ag-btn-editar { background-color: #f57c00; color: white; border: none; padding: 6px 10px; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: bold; margin-left: 10px; transition: 0.2s;}
        .ag-btn-editar:hover { background-color: #e65100; }
        .ag-btn-exc { background-color: #d32f2f; color: white; border: none; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: bold; margin-left: 5px; transition: 0.2s;}
        .ag-btn-exc:hover { background-color: #b71c1c; }
        .ag-vazio { text-align: center; color: #90caf9; font-style: italic; margin-top: 20px; display: none; }