{"id":8,"date":"2026-08-18T01:19:28","date_gmt":"2026-08-18T01:19:28","guid":{"rendered":"http:\/\/187.127.52.129\/?page_id=8"},"modified":"2026-08-29T17:38:58","modified_gmt":"2026-08-29T17:38:58","slug":"painel-de-busca","status":"publish","type":"page","link":"https:\/\/cotafacil.zapto.org\/","title":{"rendered":"Painel de Busca"},"content":{"rendered":"<div class=\"painel-pesquisa-container\">\n\n    <div class=\"cotafacil-topo\">\n\n        <div class=\"cotafacil-marca\">\n            <div class=\"cotafacil-logo-texto\">\n                COTA F\u00c1CIL\n            <\/div>\n\n            <div class=\"cotafacil-subtitulo\">\n                Compare e classifique pre\u00e7os antes de comprar\n            <\/div>\n\n            <div id=\"cotafacilUsuariosOnline\" class=\"cotafacil-usuarios-online\" style=\"display:none;\">\n                <span class=\"cotafacil-online-ponto\">\u25cf<\/span>\n                <span id=\"cotafacilUsuariosOnlineTexto\"><\/span>\n            <\/div>\n\n            <div class=\"cotafacil-descricao-seo\">\n                O COTA F\u00c1CIL pesquisa e classifica ofertas no Mercado Livre, Magazine Luiza e Shopee e compara pre\u00e7os por unidade, pe\u00e7a, metro, m\u00b2, kg e litro.\n            <\/div>\n        <\/div>\n\n        <div class=\"cotafacil-acoes-topo\">\n\n            <a\n                href=\"https:\/\/x.com\/CotaFacilMlshop\"\n                target=\"_blank\"\n                rel=\"noopener noreferrer\"\n                class=\"cotafacil-x-topo\"\n                aria-label=\"Siga o COTA F\u00c1CIL no X\"\n            >\n                <span class=\"cotafacil-x-topo-icone\">\ud835\udd4f<\/span>\n                <span>Siga-nos no X<\/span>\n            <\/a>\n\n            <div class=\"cotafacil-conta-topo\">\n\n                <button\n                    type=\"button\"\n                    class=\"cotafacil-botao-topo\"\n                    id=\"btnContaCotafacil\"\n                >\n                    \ud83d\udc64\n                <\/button>\n\n                <div\n                    id=\"nomeContaTopoCotafacil\"\n                    class=\"cotafacil-nome-conta-topo\"\n                ><\/div>\n\n            <\/div>\n\n            <button\n                type=\"button\"\n                class=\"cotafacil-botao-topo\"\n                id=\"btnCreditosCotafacil\"\n            >\n                Cr\u00e9ditos\n            <\/button>\n\n\n\n        <\/div>\n\n    <\/div>\n\n    \n\n<style id=\"cotafacil-estilo-contadores\">\n.cotafacil-painel-contadores {\n    display: grid;\n    grid-template-columns: repeat(3, minmax(0, 1fr));\n    gap: 8px;\n    margin: 10px 0 12px;\n}\n.cotafacil-contador-card {\n    min-width: 0;\n    background: linear-gradient(145deg, #091523, #142b43);\n    border: 1px solid #2475a5;\n    border-radius: 10px;\n    padding: 10px 8px;\n    text-align: center;\n    box-shadow: 0 0 10px rgba(0, 174, 255, .12);\n}\n.cotafacil-contador-titulo {\n    color: #b8d9ed;\n    font-size: 10px;\n    font-weight: 700;\n    letter-spacing: .7px;\n}\n.cotafacil-contador-numero {\n    color: #5cddff;\n    font-family: \"Courier New\", monospace;\n    font-size: clamp(18px, 3vw, 27px);\n    font-weight: bold;\n    font-variant-numeric: tabular-nums;\n    text-shadow: 0 0 7px rgba(0,191,255,.65);\n    margin: 5px 0;\n}\n#cotafacilPesquisasLegenda,\n#cotafacilPlanoLegenda {\n    color: #a8c4d8;\n    font-size: 10px;\n}\n#cotafacilVencimentoBrasilia {\n    font-size: 10px;\n    overflow-wrap: anywhere;\n    margin-top: 3px;\n}\n@media (max-width: 600px) {\n    .cotafacil-painel-contadores {\n        grid-template-columns: repeat(3, minmax(0, 1fr));\n        gap: 4px;\n        margin: 8px 0 10px;\n    }\n    .cotafacil-contador-card {\n        padding: 8px 4px;\n    }\n    .cotafacil-contador-titulo {\n        font-size: 9px;\n        letter-spacing: 0;\n    }\n    .cotafacil-contador-numero {\n        font-size: clamp(14px, 3.8vw, 20px);\n    }\n    #cotafacilVencimentoBrasilia {\n        font-size: 9px;\n    }\n}\n.cotafacil-orcamento-card {\n    min-width: 0;\n    display: flex;\n    align-items: stretch;\n}\n.cotafacil-orcamento-card #btnTopoOrcamentoCotafacil {\n    width: 100%;\n    min-width: 0;\n    min-height: 100%;\n    padding: 8px 4px;\n    background: linear-gradient(145deg, #091523, #142b43);\n    border: 1px solid #2475a5;\n    border-radius: 10px;\n    color: #5cddff;\n    font-size: 12px;\n    font-weight: 700;\n    white-space: normal;\n    grid-column: auto;\n}\n@media (max-width: 600px) {\n    .cotafacil-orcamento-card #btnTopoOrcamentoCotafacil {\n        font-size: 10px;\n        padding: 6px 2px;\n    }\n    .cotafacil-painel-contadores .cotafacil-contador-numero {\n        font-size: clamp(11px, 3vw, 18px);\n        overflow-wrap: anywhere;\n    }\n}\n<\/style>\n<!-- CONTADORES COTA FACIL -->\n<div id=\"cotafacilPainelContadores\" class=\"cotafacil-painel-contadores\">\n  <div class=\"cotafacil-orcamento-card\">\n    <button\n      type=\"button\"\n      class=\"cotafacil-botao-topo cotafacil-carrinho-topo\"\n      id=\"btnTopoOrcamentoCotafacil\"\n    >\n      Meu Or\u00e7amento\n      <span id=\"contadorTopoCotafacil\">0<\/span>\n    <\/button>\n  <\/div>\n  <div class=\"cotafacil-contador-card\">\n    <div class=\"cotafacil-contador-titulo\">PESQUISAS GRATUITAS<\/div>\n    <div id=\"cotafacilPesquisasRestantes\" class=\"cotafacil-contador-numero\">--<\/div>\n    <div id=\"cotafacilPesquisasLegenda\">Consultando saldo...<\/div>\n  <\/div>\n  <div class=\"cotafacil-contador-card\">\n    <div class=\"cotafacil-contador-titulo\">VALIDADE DO PLANO<\/div>\n    <div id=\"cotafacilRelogioPlano\" class=\"cotafacil-contador-numero\">00:00:00<\/div>\n    <div id=\"cotafacilPlanoLegenda\">Consultando plano...<\/div>\n    <div id=\"cotafacilVencimentoBrasilia\">Vencimento: consultando...<\/div>\n  <\/div>\n<\/div>\n<div class=\"cotafacil-busca-principal\">\n        <button type=\"button\" id=\"btnAtualizarCotafacil\" onclick=\"window.location.reload();\" title=\"Atualizar p\u00e1gina\">\u21bb<\/button>\n\n        <input\n            type=\"text\"\n            id=\"inputBuscaMl\"\n            placeholder=\"Ex.: Trator New Holland T6\"\n            autocomplete=\"off\"\n        >\n\n        <button\n            type=\"button\"\n            id=\"btnDispararBusca\"\n            onclick=\"dispararPesquisaComercial()\"\n        >\n            <span class=\"texto-pesquisar-desktop\">PESQUISAR<\/span><span class=\"texto-pesquisar-mobile\">IR<\/span>\n        <\/button>\n\n    <\/div>\n\n    \n<style>\n#cotafacil-ferramentas-busca {\n    margin: -4px 0 14px;\n    display: flex;\n    flex-direction: column;\n    align-items: flex-start;\n    gap: 8px;\n}\n\n#btnHistoricoCotafacil {\n    padding: 7px 12px;\n    border: 1px solid #cfd4dc;\n    border-radius: 8px;\n    background: #f8fafc;\n    color: #374151;\n    font-size: 13px;\n    cursor: pointer;\n}\n\n#btnHistoricoCotafacil:hover {\n    background: #e5e7eb;\n}\n\n#listaHistoricoCotafacil {\n    width: 100%;\n    box-sizing: border-box;\n    border: 1px solid #cfd4dc;\n    border-radius: 8px;\n    padding: 10px;\n    background: #ffffff;\n}\n\n\n#cotafacil-ferramentas-busca {\n    flex-direction: row;\n    flex-wrap: wrap;\n    align-items: center;\n}\n\n#cotafacil-cep-container {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    font-size: 13px;\n    color: #374151;\n}\n\n#inputCepCotafacil {\n    width: 112px;\n    min-height: 34px;\n    padding: 5px 8px;\n    box-sizing: border-box;\n    border: 1px solid #cfd4dc;\n    border-radius: 8px;\n    background: #ffffff;\n    color: #1f2937;\n    font-size: 14px;\n}\n\n#listaHistoricoCotafacil {\n    flex-basis: 100%;\n    order: 3;\n}\n\n@media (max-width: 480px) {\n    #cotafacil-ferramentas-busca {\n        gap: 8px;\n    }\n\n    #inputCepCotafacil {\n        width: 105px;\n    }\n}\n\n\n#btnAtualizarCotafacil {\n    width: 48px;\n    min-width: 48px;\n    height: 48px;\n    min-height: 48px;\n    padding: 0;\n    border: 1px solid #cfd4dc;\n    border-radius: 50%;\n    background: #ffffff;\n    color: #374151;\n    font-size: 25px;\n    line-height: 1;\n    cursor: pointer;\n    transition: background 0.2s, color 0.2s;\n}\n\n#btnAtualizarCotafacil:hover {\n    background: #374151;\n    color: #ffffff;\n    filter: none;\n}\n\n\n.cotafacil-busca-principal #btnAtualizarCotafacil {\n    box-sizing: border-box;\n    max-width: 48px;\n    max-height: 48px;\n    width: 48px;\n    min-width: 48px;\n    height: 48px;\n    min-height: 48px;\n    padding: 0;\n    border: 1px solid #cfd4dc;\n    border-radius: 50%;\n    background: #ffffff;\n    color: #374151;\n    font-size: 25px;\n    font-weight: 700;\n    letter-spacing: normal;\n}\n\n.cotafacil-busca-principal #btnAtualizarCotafacil:hover {\n    background: #374151;\n    border-color: #374151;\n    color: #ffffff;\n    filter: none;\n}\n\n#listaHistoricoCotafacil[hidden] {\n    display: none;\n}\n<\/style>\n\n<div id=\"cotafacil-ferramentas-busca\">\n        <button type=\"button\" id=\"btnHistoricoCotafacil\">\n            Hist\u00f3rico de pesquisas\n        <\/button>\n        <div id=\"listaHistoricoCotafacil\" hidden><\/div>\n        <div id=\"cotafacil-cep-container\">\n            <label for=\"inputCepCotafacil\">CEP de entrega:<\/label>\n            <input\n                type=\"text\"\n                id=\"inputCepCotafacil\"\n                placeholder=\"00000-000\"\n                maxlength=\"9\"\n                inputmode=\"numeric\"\n                autocomplete=\"postal-code\"\n            >\n        <\/div>\n    <\/div>\n\n    <div\n        id=\"statusCarregamento\"\n        class=\"status-mensagem\"\n    ><\/div>\n\n    <div\n        id=\"progressoMlBox\"\n        class=\"progresso-box\"\n        style=\"display:none;\"\n    >\n        <div class=\"progresso-topo\">\n            <span id=\"progressoTexto\">\n                Preparando pesquisa...\n            <\/span>\n\n            <span id=\"progressoPercentual\">\n                0%\n            <\/span>\n        <\/div>\n\n        <div class=\"progresso-trilho\">\n            <div\n                id=\"progressoBarra\"\n                class=\"progresso-barra\"\n            ><\/div>\n        <\/div>\n    <\/div>\n\n    <div id=\"areaResultadosCotacao\" style=\"display:none; margin-top:25px;\">\n\n        <div id=\"resumoOrcamento\" style=\"\n            padding:12px 15px;\n            border:1px solid #dddddd;\n            border-radius:8px;\n            margin-bottom:15px;\n            background:#f8f9fa;\n            display:flex;\n            align-items:center;\n            gap:12px;\n            flex-wrap:wrap;\n        \">\n            <strong>\n                ORDENAR OFERTAS:\n            <\/strong>\n\n            <button\n                type=\"button\"\n                class=\"cotafacil-ordem-rapida\"\n                data-ordem=\"comparavel_asc\"\n            >\n                Pre\u00e7o compar\u00e1vel \u2191\n            <\/button>\n\n            <button\n                type=\"button\"\n                class=\"cotafacil-ordem-rapida\"\n                data-ordem=\"comparavel_desc\"\n            >\n                Pre\u00e7o compar\u00e1vel \u2193\n            <\/button>\n\n            <button\n                type=\"button\"\n                class=\"cotafacil-ordem-rapida\"\n                data-ordem=\"preco_asc\"\n            >\n                Pre\u00e7o total \u2191\n            <\/button>\n\n            <button\n                type=\"button\"\n                class=\"cotafacil-ordem-rapida\"\n                data-ordem=\"preco_desc\"\n            >\n                Pre\u00e7o total \u2193\n            <\/button>\n\n            <button\n                type=\"button\"\n                class=\"cotafacil-ordem-rapida\"\n                data-ordem=\"nome_asc\"\n            >\n                Nome A\u2013Z \u2191\n            <\/button>\n        <\/div>\n\n        <div\n            id=\"controlesOrdenacao\"\n            class=\"controles-ordenacao\"\n            style=\"\n                display:none;\n                margin-bottom:15px;\n                gap:12px;\n                flex-wrap:wrap;\n                align-items:flex-end;\n            \"\n        >\n\n            <div\n                style=\"\n                    width:100%;\n                    display:flex;\n                    justify-content:flex-end;\n                \"\n            >\n                <button\n                    type=\"button\"\n                    id=\"btnRestaurarResultadosCotafacil\"\n                    onclick=\"restaurarResultadosCotafacil()\"\n                    style=\"\n                        min-height:40px;\n                        padding:0 16px;\n                        border:1px solid #e10600;\n                        border-radius:7px;\n                        background:#171c24;\n                        color:#ffffff;\n                        font-size:13px;\n                        font-weight:800;\n                        cursor:pointer;\n                    \"\n                >\n                    \u21bb Restaurar resultados\n                <\/button>\n            <\/div>\n\n            <div style=\"min-width:240px;\">\n                <label for=\"filtroTituloIncluiCotafacil\">\n                    T\u00edtulo cont\u00e9m obrigat\u00f3rio:\n                <\/label>\n\n                <input\n                    type=\"text\"\n                    id=\"filtroTituloIncluiCotafacil\"\n                    placeholder=\"Ex.: gol\"\n                    style=\"width:100%; box-sizing:border-box;\"\n                >\n\n                <label\n                    for=\"filtroTituloComecaCotafacil\"\n                    style=\"display:block; margin-top:8px;\"\n                >\n                    T\u00edtulo come\u00e7a com:\n                <\/label>\n\n                <div\n                    style=\"\n                        position:relative;\n                        width:100%;\n                    \"\n                >\n                    <input\n                        type=\"text\"\n                        id=\"filtroTituloComecaCotafacil\"\n                        autocomplete=\"off\"\n                        placeholder=\"Ex.: porcelanato\"\n                        style=\"width:100%; box-sizing:border-box;\"\n                    >\n\n                    <div\n                        id=\"listaTituloComecaCotafacil\"\n                        style=\"\n                            display:none;\n                            position:absolute;\n                            top:100%;\n                            left:0;\n                            right:0;\n                            z-index:9999;\n                            margin-top:3px;\n                            max-height:170px;\n                            overflow-y:auto;\n                            background:#090909;\n                            border:1px solid #d71920;\n                            border-radius:5px;\n                            box-shadow:0 6px 18px rgba(0,0,0,.45);\n                            font-size:12px;\n                            line-height:1.2;\n                        \"\n                    ><\/div>\n                <\/div>\n\n\n                <div\n                    id=\"filtroPalavrasTituloCotafacil\"\n                    style=\"\n                        margin-top:8px;\n                        border:1px solid #ccc;\n                        border-radius:6px;\n                        padding:8px;\n                        background:#fff;\n                    \"\n                >\n                    <div\n                        style=\"\n                            display:flex;\n                            justify-content:space-between;\n                            align-items:center;\n                            gap:8px;\n                            margin-bottom:6px;\n                        \"\n                    >\n                        <strong>Palavras do t\u00edtulo<\/strong>\n\n                        <button\n                            type=\"button\"\n                            id=\"limparPalavrasTituloCotafacil\"\n                            style=\"\n                                border:0;\n                                background:transparent;\n                                cursor:pointer;\n                                text-decoration:underline;\n                                padding:0;\n                            \"\n                        >\n                            Limpar\n                        <\/button>\n                    <\/div>\n\n                    <input\n                        type=\"text\"\n                        id=\"buscaPalavrasTituloCotafacil\"\n                        placeholder=\"Buscar palavra...\"\n                        style=\"\n                            width:100%;\n                            box-sizing:border-box;\n                            margin-bottom:6px;\n                        \"\n                    >\n\n                    <div\n                        id=\"listaPalavrasTituloCotafacil\"\n                        style=\"\n                            max-height:180px;\n                            overflow:auto;\n                            border-top:1px solid #eee;\n                            padding-top:6px;\n                        \"\n                    >\n                        <span style=\"color:#777;\">\n                            As palavras aparecer\u00e3o ap\u00f3s a pesquisa.\n                        <\/span>\n                    <\/div>\n                <\/div>\n            <\/div>\n\n            <div style=\"min-width:240px;\">\n                <label for=\"filtroTituloExcluiCotafacil\">\n                    T\u00edtulo n\u00e3o cont\u00e9m:\n                <\/label>\n\n                <input\n                    type=\"text\"\n                    id=\"filtroTituloExcluiCotafacil\"\n                    placeholder=\"Ex.: cabo\"\n                    style=\"width:100%; box-sizing:border-box;\"\n                >\n\n                <div\n                    id=\"filtroPalavrasExcluiTituloCotafacil\"\n                    style=\"\n                        margin-top:8px;\n                        border:1px solid #ccc;\n                        border-radius:6px;\n                        padding:8px;\n                        background:#fff;\n                    \"\n                >\n                    <div\n                        style=\"\n                            display:flex;\n                            justify-content:space-between;\n                            align-items:center;\n                            gap:8px;\n                            margin-bottom:6px;\n                        \"\n                    >\n                        <strong>Palavras a excluir<\/strong>\n\n                        <button\n                            type=\"button\"\n                            id=\"limparPalavrasExcluiTituloCotafacil\"\n                            style=\"\n                                border:0;\n                                background:transparent;\n                                cursor:pointer;\n                                text-decoration:underline;\n                                padding:0;\n                            \"\n                        >\n                            Limpar\n                        <\/button>\n                    <\/div>\n\n                    <input\n                        type=\"text\"\n                        id=\"buscaPalavrasExcluiTituloCotafacil\"\n                        placeholder=\"Buscar palavra...\"\n                        style=\"\n                            width:100%;\n                            box-sizing:border-box;\n                            margin-bottom:6px;\n                        \"\n                    >\n\n                    <div\n                        id=\"listaPalavrasExcluiTituloCotafacil\"\n                        style=\"\n                            max-height:180px;\n                            overflow:auto;\n                            border-top:1px solid #eee;\n                            padding-top:6px;\n                        \"\n                    >\n                        <span style=\"color:#777;\">\n                            As palavras aparecer\u00e3o ap\u00f3s a pesquisa.\n                        <\/span>\n                    <\/div>\n                <\/div>\n            <\/div>\n\n            <div>\n                <label>\n                    Pre\u00e7o total:\n                <\/label>\n\n                <div style=\"display:flex; gap:6px;\">\n                    <input\n                        type=\"text\"\n                        inputmode=\"decimal\"\n                        id=\"filtroPrecoTotalMinCotafacil\"\n                        placeholder=\"M\u00edn.\"\n                        style=\"width:82px;\"\n                    >\n\n                    <input\n                        type=\"text\"\n                        inputmode=\"decimal\"\n                        id=\"filtroPrecoTotalMaxCotafacil\"\n                        placeholder=\"M\u00e1x.\"\n                        style=\"width:82px;\"\n                    >\n                <\/div>\n            <\/div>\n\n            <div>\n                <label>\n                    Pre\u00e7o compar\u00e1vel:\n                <\/label>\n\n                <div style=\"display:flex; gap:6px;\">\n                    <input\n                        type=\"text\"\n                        inputmode=\"decimal\"\n                        id=\"filtroPrecoComparavelMinCotafacil\"\n                        placeholder=\"M\u00edn.\"\n                        style=\"width:82px;\"\n                    >\n\n                    <input\n                        type=\"text\"\n                        inputmode=\"decimal\"\n                        id=\"filtroPrecoComparavelMaxCotafacil\"\n                        placeholder=\"M\u00e1x.\"\n                        style=\"width:82px;\"\n                    >\n                <\/div>\n            <\/div>\n\n            <div>\n                <label for=\"filtroFonteCotafacil\">\n                    Fonte:\n                <\/label>\n\n                <select id=\"filtroFonteCotafacil\">\n                    <option value=\"TODAS\">\n                        Todas\n                    <\/option>\n\n                    <option value=\"MERCADO_LIVRE\">\n                        Mercado Livre\n                    <\/option>\n\n                    <option value=\"SHOPEE\">\n                        Shopee\n                    <\/option>\n\n                    <option value=\"MAGALU\">\n                        Magalu\n                    <\/option>\n                <\/select>\n            <\/div>\n\n            <div\n                id=\"grupoUnidadeComparacaoCotafacil\"\n                style=\"background:#ffe600; color:#000; padding:6px 8px; border-radius:6px;\"\n            >\n                <label\n                    for=\"filtroUnidadeComparacaoCotafacil\"\n                    style=\"color:#000 !important; font-weight:700;\"\n                >\n                    Unidade de compara\u00e7\u00e3o:\n                <\/label>\n\n                <select\n                    id=\"filtroUnidadeComparacaoCotafacil\"\n                    style=\"background:#fffbe0; color:#000;\"\n                >\n                    <option value=\"TODAS\">Todas<\/option>\n                    <option value=\"M2\">M\u00b2<\/option>\n                    <option value=\"METRO\">Metro<\/option>\n                    <option value=\"KG\">Kg<\/option>\n                    <option value=\"LITRO\">Litro<\/option>\n                    <option value=\"UNIDADE\">Unidade<\/option>\n                    <option value=\"PECA\">Pe\u00e7a<\/option>\n                    <option value=\"KIT\">Kit<\/option>\n                <\/select>\n            <\/div>\n\n            <div>\n                <label for=\"filtroMarcaCotafacil\">\n                    Marca:\n                <\/label>\n\n                <select id=\"filtroMarcaCotafacil\">\n                    <option value=\"TODAS\">\n                        Todas\n                    <\/option>\n                <\/select>\n            <\/div>\n\n            <div\n                id=\"grupoConectividadeCotafacil\"\n                style=\"display:none;\"\n            >\n                <label for=\"filtroConectividadeCotafacil\">\n                    Conectividade:\n                <\/label>\n\n                <select id=\"filtroConectividadeCotafacil\">\n                    <option value=\"TODAS\">Todas<\/option>\n                    <option value=\"COM_FIO\">Com fio<\/option>\n                    <option value=\"SEM_FIO\">Sem fio<\/option>\n                    <option value=\"A_CONFIRMAR\">A confirmar<\/option>\n                <\/select>\n            <\/div>\n\n            <div\n                id=\"grupoLeituraCotafacil\"\n                style=\"display:none;\"\n            >\n                <label for=\"filtroLeituraCotafacil\">\n                    Leitura:\n                <\/label>\n\n                <select id=\"filtroLeituraCotafacil\">\n                    <option value=\"TODAS\">Todas<\/option>\n                    <option value=\"1D\">1D<\/option>\n                    <option value=\"2D\">2D<\/option>\n                    <option value=\"1D_2D\">1D + 2D<\/option>\n                    <option value=\"A_CONFIRMAR\">A confirmar<\/option>\n                <\/select>\n            <\/div>\n\n            <div>\n                <label for=\"filtroStatusCotafacil\">\n                    Status:\n                <\/label>\n\n                <select id=\"filtroStatusCotafacil\">\n                    <option value=\"TODOS\">\n                        Todos\n                    <\/option>\n\n                    <option value=\"RANKING\">\n                        Participa do ranking\n                    <\/option>\n\n                    <option value=\"QUANTIDADE_A_CONFIRMAR\">\n                        Quantidade a confirmar\n                    <\/option>\n\n                    <option value=\"VARIACAO_A_CONFIRMAR\">\n                        Varia\u00e7\u00e3o a confirmar\n                    <\/option>\n\n                    <option value=\"PRODUTO_DIFERENTE\">\n                        Produto diferente\n                    <\/option>\n\n                    <option value=\"FORA_RANKING\">\n                        Outros fora do ranking\n                    <\/option>\n                <\/select>\n            <\/div>\n\n        <\/div>\n\n        <div\n            id=\"areaOrdenacaoCotafacil\"\n            style=\"\n                display:none;\n                align-items:center;\n                justify-content:flex-end;\n                gap:8px;\n                margin:0 0 10px 0;\n                flex-wrap:wrap;\n            \"\n        >\n            <label\n                for=\"ordenacaoCotafacil\"\n                style=\"font-weight:700;\"\n            >\n                Ordenar ofertas:\n            <\/label>\n\n            <select id=\"ordenacaoCotafacil\">\n                <option value=\"comparavel_asc\">\n                    Menor pre\u00e7o compar\u00e1vel\n                <\/option>\n\n                <option value=\"comparavel_desc\">\n                    Maior pre\u00e7o compar\u00e1vel\n                <\/option>\n\n                <option value=\"preco_asc\">\n                    Menor pre\u00e7o total\n                <\/option>\n\n                <option value=\"preco_desc\">\n                    Maior pre\u00e7o total\n                <\/option>\n\n                <option value=\"nome_asc\">\n                    Nome A\u2013Z\n                <\/option>\n\n            <\/select>\n        <\/div>\n\n        <div id=\"listaResultadosCotacao\"><\/div>\n\n        <div style=\"\n            display:flex;\n            gap:10px;\n            margin-top:15px;\n            flex-wrap:wrap;\n        \">\n            <button\n                type=\"button\"\n                id=\"btnAdicionarOrcamento\"\n                disabled\n            >\n                Adicionar ao Or\u00e7amento\n            <\/button>\n\n            <button\n                type=\"button\"\n                id=\"btnVerOrcamento\"\n                disabled\n            >\n                Ver Or\u00e7amento\n            <\/button>\n        <\/div>\n\n    <\/div>\n\n<\/div>\n\n\n<div\n    id=\"modalOrcamentoCotafacil\"\n    style=\"\n        display:none;\n        position:fixed;\n        inset:0;\n        z-index:999999;\n        background:rgba(0,0,0,.82);\n        backdrop-filter:blur(3px);\n        padding:22px;\n        box-sizing:border-box;\n        overflow:auto;\n    \"\n>\n    <div\n        id=\"caixaOrcamentoCotafacil\"\n        style=\"\n            width:min(980px, 96vw);\n            margin:30px auto;\n            background:linear-gradient(145deg,#11151c,#080a0d);\n            border:1px solid #343a44;\n            border-top:4px solid #e10600;\n            border-radius:12px;\n            box-shadow:0 25px 70px rgba(0,0,0,.65);\n            color:#ffffff;\n            overflow:hidden;\n        \"\n    >\n        <div\n            style=\"\n                display:flex;\n                align-items:center;\n                justify-content:space-between;\n                gap:15px;\n                padding:18px 20px;\n                border-bottom:1px solid #2c323c;\n            \"\n        >\n            <div>\n                <div\n                    style=\"\n                        font-size:22px;\n                        font-weight:800;\n                    \"\n                >\n                    Meu Or\u00e7amento\n                <\/div>\n\n                <div\n                    id=\"resumoTelaOrcamentoCotafacil\"\n                    style=\"\n                        margin-top:3px;\n                        font-size:13px;\n                        color:#aeb5c0;\n                    \"\n                >\n                    0 itens\n                <\/div>\n            <\/div>\n\n            <div\n                style=\"\n                    display:flex;\n                    align-items:center;\n                    gap:8px;\n                    flex-shrink:0;\n                \"\n            >\n                <button\n                    type=\"button\"\n                    id=\"btnGerarPdfOrcamentoCotafacil\"\n                    style=\"\n                        min-height:40px;\n                        padding:0 14px;\n                        border-radius:7px;\n                        border:1px solid #e10600;\n                        background:#171c24;\n                        color:#ffffff;\n                        font-size:12px;\n                        font-weight:800;\n                        cursor:pointer;\n                        white-space:nowrap;\n                    \"\n                >\n                    \ud83d\udcc4 Gerar PDF\n                <\/button>\n\n                <button\n                    type=\"button\"\n                    id=\"btnSairOrcamentoCotafacil\"\n                    style=\"\n                        min-height:40px;\n                        padding:0 14px;\n                        border-radius:7px;\n                        border:1px solid #e10600;\n                        background:#e10600;\n                        color:#ffffff;\n                        font-size:12px;\n                        font-weight:800;\n                        cursor:pointer;\n                        white-space:nowrap;\n                    \"\n                >\n                    \u2190 Sair do Or\u00e7amento\n                <\/button>\n\n            <\/div>\n        <\/div>\n\n        <div\n            id=\"ordenacaoOrcamentoCotafacil\"\n            style=\"\n                display:flex;\n                align-items:center;\n                gap:8px;\n                padding:10px 20px;\n                border-bottom:1px solid #2c323c;\n                flex-wrap:wrap;\n            \"\n        >\n            <strong style=\"font-size:12px;\">\n                ORDENAR:\n            <\/strong>\n\n            <button\n                type=\"button\"\n                class=\"cotafacil-ordem-orcamento\"\n                data-ordem=\"preco_asc\"\n            >\n                Pre\u00e7o total \u2191\n            <\/button>\n\n            <button\n                type=\"button\"\n                class=\"cotafacil-ordem-orcamento\"\n                data-ordem=\"preco_desc\"\n            >\n                Pre\u00e7o total \u2193\n            <\/button>\n\n            <button\n                type=\"button\"\n                class=\"cotafacil-ordem-orcamento\"\n                data-ordem=\"nome_asc\"\n            >\n                Nome A\u2013Z \u2191\n            <\/button>\n        <\/div>\n\n        <div\n            id=\"listaOrcamentoCotafacil\"\n            style=\"\n                padding:18px 20px 22px;\n                max-height:60vh;\n                overflow-y:auto;\n                overscroll-behavior:contain;\n            \"\n        ><\/div>\n    <\/div>\n<\/div>\n\n\n<div\n    id=\"modalContaCotafacil\"\n    class=\"cotafacil-modal-conta\"\n    style=\"display:none;\"\n>\n    <div class=\"cotafacil-modal-caixa\">\n\n        <button\n            type=\"button\"\n            id=\"fecharModalContaCotafacil\"\n            class=\"cotafacil-modal-fechar\"\n        >\n            \u00d7\n        <\/button>\n\n        <h2 id=\"tituloModalContaCotafacil\">\n            Entrar\n        <\/h2>\n\n        <div\n            id=\"areaLoginCotafacil\"\n        >\n            <input\n                type=\"email\"\n                id=\"loginEmailCotafacil\"\n                placeholder=\"E-mail\"\n                autocomplete=\"username\"\n            >\n\n            <input\n                type=\"password\"\n                id=\"loginSenhaCotafacil\"\n                placeholder=\"Senha\"\n                autocomplete=\"current-password\"\n            >\n\n            <label\n                for=\"lembrarMeCotafacil\"\n                style=\"\n                    display:flex;\n                    align-items:center;\n                    justify-content:flex-start;\n                    gap:6px;\n                    width:fit-content;\n                    margin:8px 0 14px;\n                    cursor:pointer;\n                    font-size:13px;\n                \"\n            >\n                <input\n                    type=\"checkbox\"\n                    id=\"lembrarMeCotafacil\"\n                    style=\"\n                        width:auto;\n                        min-width:0;\n                        margin:0;\n                        flex:0 0 auto;\n                    \"\n                >\n                Lembrar-me\n            <\/label>\n\n            <button\n                type=\"button\"\n                id=\"btnEntrarCotafacil\"\n            >\n                Entrar\n            <\/button>\n\n            <p style=\"margin:10px 0 0;\">\n                <button\n                    type=\"button\"\n                    id=\"abrirRecuperarSenhaCotafacil\"\n                >\n                    Esqueci minha senha\n                <\/button>\n            <\/p>\n\n            <p>\n                Ainda n\u00e3o tem conta?\n                <button\n                    type=\"button\"\n                    id=\"abrirCadastroCotafacil\"\n                >\n                    Cadastrar\n                <\/button>\n            <\/p>\n        <\/div>\n\n        <div\n            id=\"areaRecuperarSenhaCotafacil\"\n            style=\"display:none;\"\n        >\n            <input\n                type=\"email\"\n                id=\"recuperarEmailCotafacil\"\n                placeholder=\"E-mail\"\n                autocomplete=\"email\"\n            >\n\n            <button\n                type=\"button\"\n                id=\"btnRecuperarSenhaCotafacil\"\n            >\n                Enviar instru\u00e7\u00f5es\n            <\/button>\n\n            <p>\n                <button\n                    type=\"button\"\n                    id=\"voltarLoginCotafacil\"\n                >\n                    Voltar para entrar\n                <\/button>\n            <\/p>\n        <\/div>\n\n        <div\n            id=\"areaCadastroCotafacil\"\n            style=\"display:none;\"\n        >\n            <input\n                type=\"text\"\n                id=\"cadastroNomeCotafacil\"\n                placeholder=\"Nome\"\n            >\n\n            <input\n                type=\"tel\"\n                id=\"cadastroTelefoneCotafacil\"\n                placeholder=\"Celular com DDD\"\n                inputmode=\"tel\"\n                autocomplete=\"tel\"\n            >\n\n            <input\n                type=\"email\"\n                id=\"cadastroEmailCotafacil\"\n                placeholder=\"E-mail\"\n            >\n\n            <input\n                type=\"password\"\n                id=\"cadastroSenhaCotafacil\"\n                placeholder=\"Senha\"\n            >\n\n            <button\n                type=\"button\"\n                id=\"btnCadastrarCotafacil\"\n            >\n                Criar conta\n            <\/button>\n\n            <p>\n                J\u00e1 tem conta?\n                <button\n                    type=\"button\"\n                    id=\"abrirLoginCotafacil\"\n                >\n                    Entrar\n                <\/button>\n            <\/p>\n        <\/div>\n\n        <div\n            id=\"areaConfirmacaoCotafacil\"\n            style=\"display:none; text-align:center;\"\n        >\n            <div\n                id=\"confirmacaoEmailCotafacil\"\n                style=\"\n                    font-size:18px;\n                    font-weight:700;\n                    margin-bottom:14px;\n                \"\n            >\n                E-mail confirmado com sucesso.\n            <\/div>\n\n            <div\n                id=\"confirmacaoWhatsappCotafacil\"\n                style=\"display:none;\"\n            >\n                <p style=\"margin:0 0 14px;\">\n                    Agora confirme seu celular pelo WhatsApp\n                    para concluir seu cadastro.\n                <\/p>\n\n                <button\n                    type=\"button\"\n                    id=\"btnAbrirWhatsappConfirmacaoCotafacil\"\n                >\n                    Confirmar celular pelo WhatsApp\n                <\/button>\n\n                <div\n                    id=\"statusConfirmacaoWhatsappCotafacil\"\n                    style=\"\n                        font-size:12px;\n                        margin-top:12px;\n                    \"\n                >\n                    Ap\u00f3s enviar a mensagem pelo WhatsApp,\n                    aguarde a confirma\u00e7\u00e3o.\n                <\/div>\n            <\/div>\n\n            <div\n                id=\"confirmacaoConcluidaCotafacil\"\n                style=\"display:none;\"\n            >\n                <p style=\"margin:0;\">\n                    Cadastro confirmado. Voc\u00ea j\u00e1 pode usar o COTA F\u00c1CIL.\n                <\/p>\n            <\/div>\n        <\/div>\n\n        <div\n            id=\"areaMinhaContaCotafacil\"\n            style=\"display:none; text-align:center;\"\n        >\n            <div\n                id=\"nomeMinhaContaCotafacil\"\n                style=\"\n                    font-weight:700;\n                    margin-bottom:18px;\n                \"\n            ><\/div>\n\n            <button\n                type=\"button\"\n                id=\"btnSairContaCotafacil\"\n            >\n                Sair\n            <\/button>\n\n            <button\n                type=\"button\"\n                id=\"btnExcluirContaCotafacil\"\n                style=\"\n                    margin-top:14px;\n                    background:#ffffff;\n                    color:#e10600;\n                    border:1px solid #e10600;\n                \"\n            >\n                Excluir conta\n            <\/button>\n        <\/div>\n\n        <div\n            id=\"mensagemContaCotafacil\"\n        ><\/div>\n\n    <\/div>\n<\/div>\n\n\n<div\n    id=\"modalPixCotafacil\"\n    style=\"\n        display:none;\n        position:fixed;\n        inset:0;\n        background:rgba(0,0,0,.55);\n        z-index:999999;\n        align-items:center;\n        justify-content:center;\n        padding:20px;\n    \"\n>\n    <div\n        style=\"\n            background:#fff;\n            width:100%;\n            max-width:430px;\n            border-radius:16px;\n            padding:24px;\n            position:relative;\n            text-align:center;\n            box-shadow:0 20px 60px rgba(0,0,0,.25);\n        \"\n    >\n        <button\n            type=\"button\"\n            id=\"fecharModalPixCotafacil\"\n            style=\"\n                position:absolute;\n                right:14px;\n                top:10px;\n                border:0;\n                background:transparent;\n                font-size:28px;\n                cursor:pointer;\n            \"\n        >\u00d7<\/button>\n\n        <h2 style=\"margin:0 0 8px;\">\n            Escolha seu plano COTA F\u00c1CIL\n        <\/h2>\n\n        <div\n            style=\"\n                text-align:left;\n                margin:0 0 18px;\n            \"\n        >\n            <label\n                style=\"\n                    display:block;\n                    margin-bottom:8px;\n                    cursor:pointer;\n                \"\n            >\n                <input\n                    type=\"radio\"\n                    name=\"pacotePixCotafacil\"\n                    value=\"semanal\"\n                    checked\n                >\n                Plano semanal \u2014 7 dias \u2014 <strong>R$ 4,99<\/strong>\n            <\/label>\n\n            <label\n                style=\"\n                    display:block;\n                    margin-bottom:8px;\n                    cursor:pointer;\n                \"\n            >\n                <input\n                    type=\"radio\"\n                    name=\"pacotePixCotafacil\"\n                    value=\"mensal\"\n                >\n                Plano mensal \u2014 30 dias \u2014 <strong>R$ 14,99<\/strong>\n            <\/label>\n\n            <label\n                style=\"\n                    display:block;\n                    cursor:pointer;\n                \"\n            >\n                <input\n                    type=\"radio\"\n                    name=\"pacotePixCotafacil\"\n                    value=\"anual\"\n                >\n                Plano anual \u2014 365 dias \u2014 <strong>R$ 99,99<\/strong>\n            <\/label>\n        <\/div>\n\n        <button\n            type=\"button\"\n            id=\"btnGerarPixCotafacil\"\n            class=\"cotafacil-botao-topo\"\n            style=\"margin-bottom:16px;\"\n        >\n            Gerar Pix\n        <\/button>\n\n        <div\n            id=\"statusPixCotafacil\"\n            style=\"margin:10px 0;\"\n        ><\/div>\n\n        <img\n            id=\"qrPixCotafacil\"\n            alt=\"QR Code Pix\"\n            style=\"\n                display:none;\n                width:230px;\n                max-width:100%;\n                margin:15px auto;\n            \"\n        >\n\n        <textarea\n            id=\"codigoPixCotafacil\"\n            readonly\n            style=\"\n                display:none;\n                width:100%;\n                min-height:100px;\n                padding:10px;\n                box-sizing:border-box;\n                resize:none;\n            \"\n        ><\/textarea>\n\n        <button\n            type=\"button\"\n            id=\"btnCopiarPixCotafacil\"\n            style=\"\n                display:none;\n                margin:12px auto 0;\n                padding:10px 18px;\n                cursor:pointer;\n            \"\n        >\n            Copiar c\u00f3digo Pix\n        <\/button>\n    <\/div>\n<\/div>\n\n<style>\n\n.cotafacil-modal-conta {\n    position: fixed;\n    inset: 0;\n    background: rgba(0,0,0,0.55);\n    z-index: 999999;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    padding: 20px;\n}\n\n.cotafacil-modal-caixa {\n    position: relative;\n    width: 100%;\n    max-width: 420px;\n    background: #ffffff;\n    border-radius: 14px;\n    padding: 28px;\n    box-shadow: 0 18px 50px rgba(0,0,0,0.25);\n}\n\n.cotafacil-modal-caixa h2 {\n    margin: 0 0 20px;\n    text-align: center;\n}\n\n.cotafacil-modal-caixa input {\n    width: 100%;\n    box-sizing: border-box;\n    margin-bottom: 12px;\n    padding: 12px 14px;\n    border: 1px solid #cccccc;\n    border-radius: 8px;\n}\n\n.cotafacil-modal-caixa button {\n    cursor: pointer;\n}\n\n.cotafacil-modal-caixa > div > button {\n    width: 100%;\n    padding: 12px 16px;\n    border: 0;\n    border-radius: 8px;\n    font-weight: 700;\n}\n\n.cotafacil-modal-caixa p {\n    text-align: center;\n    margin: 16px 0 0;\n}\n\n.cotafacil-modal-caixa p button {\n    border: 0;\n    background: transparent;\n    text-decoration: underline;\n    padding: 0;\n}\n\n.cotafacil-modal-fechar {\n    position: absolute;\n    top: 10px;\n    right: 12px;\n    width: auto !important;\n    background: transparent;\n    border: 0;\n    font-size: 28px;\n    line-height: 1;\n}\n\n#mensagemContaCotafacil {\n    margin-top: 14px;\n    text-align: center;\n    font-size: 14px;\n}\n\n.cotafacil-topo {\n    display:flex;\n    justify-content:space-between;\n    align-items:center;\n    gap:20px;\n    margin-bottom:24px;\n}\n\n.cotafacil-marca {\n    min-width:0;\n}\n\n.cotafacil-logo-texto {\n    font-size:28px;\n    font-weight:800;\n    letter-spacing:-0.8px;\n    color:#1f2937;\n}\n\n.cotafacil-subtitulo {\n    margin-top:3px;\n    font-size:15px;\n    color:#6b7280;\n}\n\n.cotafacil-acoes-topo {\n    display:flex;\n    gap:8px;\n    flex-wrap:wrap;\n    justify-content:flex-end;\n}\n\n.cotafacil-x-topo {\n    display:inline-flex;\n    align-items:center;\n    justify-content:center;\n    gap:6px;\n    background:#000000;\n    color:#ffffff !important;\n    border:1px solid #000000;\n    border-radius:7px;\n    padding:9px 12px;\n    font-size:13px;\n    font-weight:700;\n    line-height:1;\n    text-decoration:none !important;\n    white-space:nowrap;\n}\n\n.cotafacil-x-topo:hover {\n    background:#222222;\n    color:#ffffff !important;\n    text-decoration:none !important;\n}\n\n.cotafacil-x-topo-icone {\n    font-size:15px;\n    line-height:1;\n}\n\n.cotafacil-botao-topo {\n    background:#ffffff;\n    color:#374151;\n    border:1px solid #d1d5db;\n    border-radius:7px;\n    padding:9px 12px;\n    font-size:13px;\n    cursor:pointer;\n}\n\n.cotafacil-botao-topo:hover {\n    background:#f9fafb;\n}\n\n.cotafacil-carrinho-topo span {\n    display:inline-flex;\n    align-items:center;\n    justify-content:center;\n    min-width:20px;\n    height:20px;\n    margin-left:5px;\n    padding:0 5px;\n    border-radius:10px;\n    background:#3483fa;\n    color:#ffffff;\n    font-size:11px;\n    font-weight:700;\n}\n\n.cotafacil-busca-principal {\n    display:grid;\n    grid-template-columns:48px minmax(0, 1fr) auto;\n    gap:10px;\n    margin-bottom:14px;\n}\n\n.cotafacil-busca-principal input {\n    width:100%;\n    min-height:48px;\n    padding:0 15px;\n    border:1px solid #cfd4dc;\n    border-radius:8px;\n    background:#ffffff;\n    color:#1f2937;\n    font-size:16px;\n    box-sizing:border-box;\n}\n\n.cotafacil-busca-principal input:focus {\n    border-color:#3483fa;\n    outline:none;\n    box-shadow:0 0 0 2px rgba(52,131,250,0.10);\n}\n\n.cotafacil-busca-principal button {\n    min-height:48px;\n    padding:0 25px;\n    border:0;\n    border-radius:8px;\n    background:#3483fa;\n    color:#ffffff;\n    font-size:14px;\n    font-weight:700;\n    cursor:pointer;\n}\n#btnAtualizarCotafacil { width:48px; min-width:48px; height:48px; padding:0; background:#ffffff; color:#111111; border:1px solid #cfd4dc; font-size:22px; }\n.texto-pesquisar-mobile { display:none; }\n\n.cotafacil-busca-principal button:hover {\n    filter:brightness(0.96);\n}\n\n@media (max-width:700px) {\n\n    .cotafacil-topo {\n        align-items:flex-start;\n        flex-direction:column;\n        gap:14px;\n    }\n\n    .cotafacil-acoes-topo {\n        width:100%;\n        justify-content:flex-start;\n    }\n\n    .cotafacil-logo-texto {\n        font-size:24px;\n    }\n\n    .cotafacil-busca-principal {\n        grid-template-columns:48px minmax(0, 1fr) auto;\n    }\n\n    .cotafacil-busca-principal button {\n        width:100%;\n    }\n\n    #btnAtualizarCotafacil {\n        width:48px;\n        min-width:48px;\n    }\n}\n\n\n.painel-pesquisa-container {\n    background: #ffffff;\n    padding: 30px;\n    border-radius: 10px;\n    box-shadow: 0 4px 20px rgba(0,0,0,0.10);\n    max-width: 800px;\n    margin: 40px auto;\n    font-family: Arial, sans-serif;\n}\n\n.painel-pesquisa-container h2 {\n    color: #333333;\n    margin-top: 0;\n    margin-bottom: 10px;\n    font-size: 26px;\n}\n\n.painel-pesquisa-container p {\n    color: #666666;\n    font-size: 15px;\n    line-height: 1.5;\n}\n\n.campo-busca-group {\n    display: flex;\n    gap: 10px;\n    margin-top: 25px;\n}\n\n#inputBuscaMl {\n    flex: 1;\n    padding: 14px;\n    border: 1px solid #cccccc;\n    border-radius: 6px;\n    font-size: 16px;\n    box-sizing: border-box;\n}\n\n#inputBuscaMl:focus {\n    border-color: #3483fa;\n    outline: none;\n    box-shadow: 0 0 0 2px rgba(52,131,250,0.15);\n}\n\n#btnDispararBusca {\n    background-color: #3483fa;\n    color: white;\n    border: none;\n    padding: 14px 22px;\n    font-size: 15px;\n    font-weight: bold;\n    border-radius: 6px;\n    cursor: pointer;\n}\n\n#btnDispararBusca:hover {\n    background-color: #1e62c9;\n}\n\n#btnDispararBusca:disabled {\n    background-color: #aaaaaa;\n    cursor: not-allowed;\n}\n\n.status-mensagem {\n    margin-top: 20px;\n    min-height: 25px;\n    font-size: 15px;\n    font-weight: bold;\n}\n\n.status-processando {\n    color: #1e62c9;\n}\n\n.status-sucesso {\n    color: #2e7d32;\n}\n\n.status-erro {\n    color: #c62828;\n}\n\n.progresso-box {\n    margin-top: 18px;\n}\n\n.progresso-topo {\n    display: flex;\n    justify-content: space-between;\n    margin-bottom: 8px;\n    font-size: 14px;\n    color: #444;\n}\n\n.progresso-trilho {\n    width: 100%;\n    height: 18px;\n    background: #e9ecef;\n    border-radius: 999px;\n    overflow: hidden;\n    position: relative;\n}\n\n.progresso-trilho::after {\n    content: \"\";\n    position: absolute;\n    inset: 0;\n    pointer-events: none;\n    background:\n        repeating-linear-gradient(\n            to right,\n            transparent 0,\n            transparent calc(10% - 2px),\n            rgba(255,255,255,0.90) calc(10% - 2px),\n            rgba(255,255,255,0.90) 10%\n        );\n}\n\n.progresso-barra {\n    width: 0%;\n    height: 100%;\n    background: #3483fa;\n    border-radius: 999px;\n    transition: width 0.4s ease;\n}\n\n@media (max-width: 700px) {\n\n    .campo-busca-group {\n        flex-direction: column;\n    }\n\n    #btnDispararBusca {\n        width: 100%;\n    }\n\n}\n\n\n.cotafacil-imagem-box {\n    width:82px;\n    height:82px;\n    min-width:82px;\n    display:flex;\n    align-items:center;\n    justify-content:center;\n    overflow:hidden;\n    border:1px solid #e5e7eb;\n    border-radius:8px;\n    background:#ffffff;\n    box-sizing:border-box;\n}\n\n.cotafacil-imagem-produto {\n    width:100%;\n    height:100%;\n    object-fit:contain;\n    display:block;\n}\n\n.cotafacil-sem-imagem {\n    padding:6px;\n    background:#f8fafc;\n    color:#9ca3af;\n    font-size:11px;\n    line-height:1.2;\n    text-align:center;\n}\n\n@media (max-width:700px) {\n\n    .cotafacil-imagem-box {\n        width:72px;\n        height:72px;\n        min-width:72px;\n    }\n}\n\n\n\n\/* ============================================================\n   COTA FACIL - TEMA DARK VERMELHO 2026\n   ETAPA 1 - IDENTIDADE VISUAL\n   ============================================================ *\/\n\n.painel-pesquisa-container {\n    width: calc(100% - 24px);\n    max-width: 1500px;\n    margin: 18px auto;\n    padding: 24px 26px 32px;\n    box-sizing: border-box;\n    background:\n        linear-gradient(\n            145deg,\n            #090b0f 0%,\n            #0d1117 52%,\n            #080a0d 100%\n        );\n    color: #f4f4f5;\n    border: 1px solid #232832;\n    border-radius: 14px;\n    box-shadow:\n        0 18px 55px rgba(0,0,0,0.32);\n    font-family:\n        Arial,\n        Helvetica,\n        sans-serif;\n}\n\n\n\/* TOPO *\/\n\n.cotafacil-topo {\n    margin-bottom: 22px;\n    padding-bottom: 17px;\n    border-bottom: 2px solid #e10600;\n}\n\n.cotafacil-marca {\n    display: flex;\n    flex-direction: column;\n    justify-content: center;\n    position: relative;\n    min-height: 62px;\n    padding-left: 84px;\n}\n\n.cotafacil-marca::before {\n    content: \"C\";\n    position: absolute;\n    left: 0;\n    top: 50%;\n    transform: translateY(-52%) skewX(-10deg);\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    width: 67px;\n    height: 52px;\n    color: #f10d17;\n    font-size: 58px;\n    line-height: 1;\n    font-weight: 950;\n    font-style: italic;\n    letter-spacing: -7px;\n    text-shadow:\n        -8px 0 18px rgba(241,13,23,0.25);\n}\n\n.cotafacil-logo-texto {\n    color: #f5f5f5;\n    font-size: 30px;\n    line-height: 1;\n    font-weight: 900;\n    font-style: italic;\n    letter-spacing: -1px;\n}\n\n.cotafacil-logo-texto::first-letter {\n    color: #ffffff;\n}\n\n.cotafacil-logo-texto {\n    text-shadow: 0 2px 6px rgba(0,0,0,0.5);\n}\n\n.cotafacil-subtitulo {\n    margin-top: 7px;\n    color: #9ca3af;\n    font-size: 11px;\n    font-weight: 700;\n    letter-spacing: 2.4px;\n    text-transform: uppercase;\n}\n\n.cotafacil-descricao-seo {\n    margin-top: 8px;\n    max-width: 520px;\n    color: #c7cbd1;\n    font-size: 12px;\n    line-height: 1.45;\n    font-weight: 400;\n    letter-spacing: 0;\n    text-transform: none;\n}\n\n\n\/* BOTOES DO TOPO *\/\n\n.cotafacil-acoes-topo {\n    gap: 10px;\n}\n\n.cotafacil-botao-topo {\n    min-height: 43px;\n    padding: 0 17px;\n    background: #11151c;\n    color: #f9fafb;\n    border: 1px solid #4b5563;\n    border-radius: 8px;\n    font-size: 13px;\n    font-weight: 700;\n    transition:\n        background .18s ease,\n        border-color .18s ease,\n        transform .18s ease;\n}\n\n.cotafacil-botao-topo:hover {\n    background: #1a1f29;\n    border-color: #e10600;\n}\n\n#btnContaCotafacil {\n    border-color: #8b929d;\n}\n\n#btnCreditosCotafacil {\n    background: #e10600;\n    border-color: #e10600;\n    color: #ffffff;\n}\n\n#btnCreditosCotafacil:hover {\n    background: #ff1717;\n}\n\n.cotafacil-carrinho-topo span {\n    background: #e10600;\n    color: #ffffff;\n}\n\n\n\/* PESQUISA PRINCIPAL *\/\n\n.cotafacil-busca-principal {\n    gap: 0;\n    margin: 7px 0 16px;\n}\n\n.cotafacil-busca-principal input,\n#inputBuscaMl {\n    min-height: 54px;\n    padding: 0 18px;\n    background: #11151c;\n    color: #ffffff;\n    border: 1px solid #3b414c;\n    border-radius: 9px 0 0 9px;\n    font-size: 16px;\n    box-shadow: inset 0 1px 3px rgba(0,0,0,.35);\n}\n\n.cotafacil-busca-principal input::placeholder,\n#inputBuscaMl::placeholder {\n    color: #777f8b;\n}\n\n.cotafacil-busca-principal input:focus,\n#inputBuscaMl:focus {\n    border-color: #e10600;\n    outline: none;\n    box-shadow:\n        0 0 0 2px rgba(225,6,0,.14);\n}\n\n.cotafacil-busca-principal button,\n#btnDispararBusca {\n    min-width: 170px;\n    min-height: 54px;\n    padding: 0 28px;\n    background: #e10600;\n    color: #ffffff;\n    border: 1px solid #e10600;\n    border-radius: 0 9px 9px 0;\n    font-size: 14px;\n    font-weight: 800;\n    letter-spacing: .3px;\n}\n\n.cotafacil-busca-principal button:hover,\n#btnDispararBusca:hover {\n    background: #ff1717;\n    border-color: #ff1717;\n}\n\n#btnDispararBusca:disabled {\n    background: #383d46;\n    border-color: #383d46;\n    color: #8b929d;\n}\n\n\n\/* STATUS E PROGRESSO *\/\n\n.status-mensagem {\n    color: #d1d5db;\n}\n\n.status-processando {\n    color: #ff4b4b;\n}\n\n.status-sucesso {\n    color: #48c774;\n}\n\n.status-erro {\n    color: #ff5252;\n}\n\n.progresso-box {\n    padding: 14px 16px;\n    background: #10141a;\n    border: 1px solid #272c35;\n    border-radius: 9px;\n}\n\n.progresso-topo {\n    color: #c9cdd4;\n}\n\n.progresso-trilho {\n    height: 14px;\n    background: #252a33;\n}\n\n.progresso-barra {\n    background:\n        linear-gradient(\n            90deg,\n            #b90000,\n            #f10d17,\n            #ff3434\n        );\n}\n\n\n\/* AREA DE RESULTADOS *\/\n\n#areaResultadosCotacao {\n    color: #e5e7eb;\n}\n\n#resumoOrcamento {\n    background: #10141a !important;\n    color: #f5f5f5 !important;\n    border: 1px solid #2a3039 !important;\n    border-left: 3px solid #e10600 !important;\n}\n\n\n\/* FILTROS *\/\n\n#controlesOrdenacao {\n    padding: 16px;\n    background: #0e1218;\n    border: 1px solid #252b34;\n    border-radius: 10px;\n}\n\n#controlesOrdenacao label {\n    display: block;\n    margin-bottom: 6px;\n    color: #c9cdd4;\n    font-size: 12px;\n    font-weight: 700;\n}\n\n#controlesOrdenacao input,\n#controlesOrdenacao select {\n    min-height: 39px;\n    box-sizing: border-box;\n    background: #151a22;\n    color: #f3f4f6;\n    border: 1px solid #343b47;\n    border-radius: 7px;\n    padding: 7px 9px;\n}\n\n#controlesOrdenacao input::placeholder {\n    color: #727985;\n}\n\n#controlesOrdenacao input:focus,\n#controlesOrdenacao select:focus {\n    border-color: #e10600;\n    outline: none;\n    box-shadow:\n        0 0 0 2px rgba(225,6,0,.12);\n}\n\n#filtroPalavrasTituloCotafacil,\n#filtroPalavrasExcluiTituloCotafacil {\n    background: #11161d !important;\n    border-color: #303641 !important;\n    color: #e5e7eb !important;\n}\n\n#listaPalavrasTituloCotafacil,\n#listaPalavrasExcluiTituloCotafacil {\n    border-top-color: #303641 !important;\n    color: #d1d5db;\n}\n\n#limparPalavrasTituloCotafacil,\n#limparPalavrasExcluiTituloCotafacil {\n    color: #ff3d3d !important;\n}\n\n\n\/* BOTOES DE ORCAMENTO *\/\n\n#btnAdicionarOrcamento,\n#btnVerOrcamento {\n    min-height: 42px;\n    padding: 0 18px;\n    border-radius: 7px;\n    border: 1px solid #e10600;\n    font-weight: 700;\n    cursor: pointer;\n}\n\n#btnAdicionarOrcamento {\n    background: #e10600;\n    color: #ffffff;\n}\n\n#btnVerOrcamento {\n    background: #151a22;\n    color: #ffffff;\n}\n\n#btnAdicionarOrcamento:disabled,\n#btnVerOrcamento:disabled {\n    opacity: .45;\n    cursor: not-allowed;\n}\n\n\n\/* IMAGENS DOS PRODUTOS *\/\n\n.cotafacil-imagem-box {\n    background: #f5f5f5;\n    border-color: #343a44;\n}\n\n\n\/* LOGIN \/ CADASTRO *\/\n\n.cotafacil-modal-conta {\n    background: rgba(0,0,0,.78);\n    backdrop-filter: blur(3px);\n}\n\n.cotafacil-modal-caixa {\n    background:\n        linear-gradient(\n            145deg,\n            #11151c,\n            #0b0e13\n        );\n    color: #ffffff;\n    border: 1px solid #343a44;\n    border-top: 3px solid #e10600;\n    box-shadow:\n        0 25px 70px rgba(0,0,0,.6);\n}\n\n.cotafacil-modal-caixa h2 {\n    color: #ffffff;\n}\n\n.cotafacil-modal-caixa input {\n    background: #171c24;\n    color: #ffffff;\n    border: 1px solid #363d48;\n}\n\n.cotafacil-modal-caixa input:focus {\n    border-color: #e10600;\n    outline: none;\n}\n\n.cotafacil-modal-caixa > div > button {\n    background: #e10600;\n    color: #ffffff;\n}\n\n.cotafacil-modal-caixa p {\n    color: #aeb4bd;\n}\n\n.cotafacil-modal-caixa p button {\n    color: #ff4040;\n}\n\n.cotafacil-modal-fechar {\n    color: #ffffff;\n}\n\n\n\/* RESPONSIVO *\/\n\n@media (max-width: 700px) {\n\n    .painel-pesquisa-container {\n        width: 100%;\n        margin: 0;\n        padding: 16px 12px 24px;\n        border-radius: 0;\n    }\n\n    .cotafacil-topo {\n        align-items: stretch;\n    }\n\n    .cotafacil-marca {\n        padding-left: 67px;\n        min-height: 52px;\n    }\n\n    .cotafacil-marca::before {\n        width: 54px;\n        height: 44px;\n        font-size: 47px;\n    }\n\n    .cotafacil-logo-texto {\n        font-size: 25px;\n    }\n\n    .cotafacil-subtitulo {\n        font-size: 9px;\n        letter-spacing: 1.6px;\n    }\n\n    .cotafacil-acoes-topo {\n        display: grid;\n        grid-template-columns: 1fr 1fr;\n        width: 100%;\n    }\n\n    .cotafacil-botao-topo {\n        min-height: 44px;\n    }\n\n    .cotafacil-carrinho-topo {\n        grid-column: 1 \/ -1;\n    }\n\n    .cotafacil-busca-principal {\n        display: grid;\n        grid-template-columns: 48px minmax(0, 1fr) 48px;\n        gap: 8px;\n    }\n\n    .cotafacil-busca-principal input,\n    #inputBuscaMl {\n        border-radius: 8px;\n    }\n\n    .cotafacil-busca-principal button,\n    #btnDispararBusca {\n        width: 100%;\n        border-radius: 8px;\n    }\n    .texto-pesquisar-desktop { display:none; }\n    .texto-pesquisar-mobile { display:inline; }\n    #btnDispararBusca { width:48px; min-width:48px; padding:0; }\n\n\n    #controlesOrdenacao {\n        padding: 12px;\n    }\n\n    #controlesOrdenacao > div {\n        width: 100%;\n        min-width: 0 !important;\n    }\n\n    #controlesOrdenacao input,\n    #controlesOrdenacao select {\n        width: 100%;\n        min-height: 44px;\n        font-size: 16px;\n    }\n}\n\n\n\n\n\/* ============================================================\n   LIBERA LARGURA DA PAGINA DO WORDPRESS PARA O COTA FACIL\n   ============================================================ *\/\n\n.entry-content.wp-block-post-content.has-global-padding.is-layout-constrained {\n    max-width: none !important;\n    width: 100% !important;\n    padding-left: 0 !important;\n    padding-right: 0 !important;\n    margin-left: 0 !important;\n    margin-right: 0 !important;\n}\n\n.entry-content.wp-block-post-content.has-global-padding.is-layout-constrained > .painel-pesquisa-container {\n    width: calc(100% - 36px) !important;\n    max-width: 1500px !important;\n    margin-left: auto !important;\n    margin-right: auto !important;\n}\n\n.wp-site-blocks {\n    overflow-x: hidden;\n}\n\n@media (max-width: 700px) {\n    .entry-content.wp-block-post-content.has-global-padding.is-layout-constrained > .painel-pesquisa-container {\n        width: 100% !important;\n        margin-left: 0 !important;\n        margin-right: 0 !important;\n    }\n}\n\n\n\n\n\/* ============================================================\n   LAYOUT SIDEBAR FILTROS DESKTOP\n   ============================================================ *\/\n\n@media (min-width: 901px) {\n\n    #areaResultadosCotacao {\n        display: grid;\n        grid-template-columns: 300px minmax(0, 1fr);\n        grid-template-rows: auto auto auto;\n        column-gap: 18px;\n        row-gap: 14px;\n        align-items: start;\n    }\n\n    #resumoOrcamento {\n        grid-column: 1 \/ -1;\n        grid-row: 1;\n        margin-bottom: 0 !important;\n    }\n\n    #controlesOrdenacao {\n        grid-column: 1;\n        grid-row: 2 \/ span 2;\n\n        position: sticky;\n        top: 18px;\n\n        display: flex;\n        flex-direction: column;\n        align-items: stretch !important;\n        flex-wrap: nowrap !important;\n\n        gap: 11px !important;\n        margin-bottom: 0 !important;\n        padding: 15px !important;\n\n        max-height: calc(100vh - 36px);\n        overflow-y: auto;\n        overflow-x: hidden;\n    }\n\n    #controlesOrdenacao > div {\n        width: 100% !important;\n        min-width: 0 !important;\n        box-sizing: border-box;\n    }\n\n    #controlesOrdenacao input,\n    #controlesOrdenacao select {\n        width: 100%;\n        max-width: 100%;\n        box-sizing: border-box;\n    }\n\n    #controlesOrdenacao > div > div[style*=\"display:flex\"] {\n        width: 100%;\n    }\n\n    #filtroPrecoTotalMinCotafacil,\n    #filtroPrecoTotalMaxCotafacil,\n    #filtroPrecoComparavelMinCotafacil,\n    #filtroPrecoComparavelMaxCotafacil {\n        width: calc(50% - 3px) !important;\n        min-width: 0;\n    }\n\n    #filtroPalavrasTituloCotafacil,\n    #filtroPalavrasExcluiTituloCotafacil {\n        width: 100%;\n        box-sizing: border-box;\n    }\n\n    #listaPalavrasTituloCotafacil,\n    #listaPalavrasExcluiTituloCotafacil {\n        max-height: 145px !important;\n    }\n\n    #listaResultadosCotacao {\n        grid-column: 2;\n        grid-row: 2;\n        min-width: 0;\n        width: 100%;\n    }\n\n    #listaResultadosCotacao + div {\n        grid-column: 2;\n        grid-row: 3;\n\n        display: flex !important;\n        justify-content: flex-end;\n        align-items: center;\n\n        margin-top: 0 !important;\n        padding-top: 4px;\n    }\n\n    #btnAdicionarOrcamento,\n    #btnVerOrcamento {\n        min-width: 190px;\n    }\n}\n\n\n\/* TABLET \/ CELULAR - FILTROS VOLTAM PARA CIMA *\/\n\n@media (max-width: 900px) {\n\n    #areaResultadosCotacao {\n        display: block;\n    }\n\n    #controlesOrdenacao {\n        position: static;\n        max-height: none;\n        overflow: visible;\n    }\n\n    \/* PALAVRAS DO TITULO - COMPACTO NO CELULAR *\/\n    #listaPalavrasTituloCotafacil label,\n    #listaPalavrasExcluiTituloCotafacil label {\n        display: flex !important;\n        align-items: center !important;\n        justify-content: flex-start !important;\n        gap: 6px !important;\n\n        min-height: 26px !important;\n        padding: 2px 4px !important;\n        margin: 0 !important;\n\n        font-size: 14px !important;\n        line-height: 1.25 !important;\n    }\n\n    #listaPalavrasTituloCotafacil input[type=\"checkbox\"],\n    #listaPalavrasExcluiTituloCotafacil input[type=\"checkbox\"] {\n        appearance: auto !important;\n        -webkit-appearance: auto !important;\n\n        width: 16px !important;\n        height: 16px !important;\n        min-width: 16px !important;\n        min-height: 16px !important;\n        max-width: 16px !important;\n        max-height: 16px !important;\n\n        padding: 0 !important;\n        margin: 0 !important;\n        transform: none !important;\n        flex: 0 0 16px !important;\n\n        accent-color: #e10600;\n    }\n\n    #listaPalavrasTituloCotafacil,\n    #listaPalavrasExcluiTituloCotafacil {\n        max-height: 145px !important;\n        overflow-y: auto !important;\n    }\n\n    #listaResultadosCotacao {\n        width: 100%;\n    }\n}\n\n\n\n\n\/* ============================================================\n   CORRECAO GRID RESULTADOS VISIVEIS\n   O JS troca display:none por display:block ap\u00f3s a pesquisa.\n   No desktop, convertemos somente o estado vis\u00edvel para GRID.\n   ============================================================ *\/\n\n@media (min-width: 901px) {\n\n    #areaResultadosCotacao[style*=\"display: block\"],\n    #areaResultadosCotacao[style*=\"display:block\"] {\n        display: grid !important;\n        grid-template-columns: 300px minmax(0, 1fr);\n        column-gap: 18px;\n        row-gap: 14px;\n        align-items: start;\n    }\n}\n\n\n\n\n\/* ============================================================\n   VISUAL CARDS DARK STATUS 2026\n   ============================================================ *\/\n\n.cotafacil-resultado-card {\n    background: #10141a !important;\n    border-color: #2b323d !important;\n    color: #f5f7fa;\n    padding: 18px !important;\n}\n\n.cotafacil-resultado-card:hover {\n    border-color: #4a5360 !important;\n    box-shadow: 0 8px 24px rgba(0,0,0,.35) !important;\n}\n\n.cotafacil-item-checkbox {\n    width: 18px !important;\n    height: 18px !important;\n    min-width: 18px;\n    accent-color: #e10600;\n    cursor: pointer;\n}\n\n.cotafacil-imagem-box {\n    width: 118px !important;\n    height: 118px !important;\n    min-width: 118px !important;\n    background: #1a1f27 !important;\n    border: 1px solid #343c48 !important;\n    border-radius: 10px !important;\n    padding: 7px;\n}\n\n.cotafacil-imagem-produto {\n    border-radius: 7px;\n}\n\n.cotafacil-marketplace {\n    color: #111 !important;\n    border: 1px solid transparent;\n}\n\n.cotafacil-marketplace-ml {\n    background: #ffe600 !important;\n    border-color: #d7c200 !important;\n}\n\n.cotafacil-marketplace-shopee {\n    background: #ff5a3c !important;\n    color: #fff !important;\n    border-color: #e44b31 !important;\n}\n\n.cotafacil-status-ranking {\n    color: #32d583 !important;\n}\n\n.cotafacil-status-alerta {\n    color: #f5c542 !important;\n}\n\n.cotafacil-status-erro {\n    color: #ff5252 !important;\n}\n\n.cotafacil-link-oferta {\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n    margin-top: 12px;\n    padding: 9px 14px;\n    min-height: 38px;\n    border-radius: 7px;\n    background: #20262f;\n    border: 1px solid #424b58;\n    color: #fff !important;\n    font-weight: 700;\n    text-decoration: none !important;\n}\n\n.cotafacil-link-oferta:hover {\n    background: #2a323d;\n    border-color: #e10600;\n}\n\n#listaResultadosCotacao {\n    font-size: 15px;\n}\n\n@media (max-width: 700px) {\n\n    .cotafacil-resultado-card {\n        padding: 13px !important;\n    }\n\n    .cotafacil-imagem-box {\n        width: 88px !important;\n        height: 88px !important;\n        min-width: 88px !important;\n    }\n}\n\n\n\n\n\/* ============================================================\n   ICONE CONTA E SCROLLBAR DESTACADA 2026\n   ============================================================ *\/\n\n#btnContaCotafacil {\n    order: 99;\n    min-width: 46px;\n    width: 46px;\n    padding: 0;\n    font-size: 22px;\n    line-height: 1;\n    display: inline-flex;\n    align-items: center;\n    justify-content: center;\n}\n\n.cotafacil-acoes-topo {\n    margin-left: auto;\n}\n\n.cotafacil-conta-topo {\n    order: 99;\n    display: flex;\n    flex-direction: column;\n    align-items: center;\n    justify-content: center;\n    gap: 3px;\n    min-width: 58px;\n}\n\n.cotafacil-nome-conta-topo {\n    max-width: 100px;\n    min-height: 14px;\n    color: #d1d5db;\n    font-size: 10px;\n    font-weight: 700;\n    line-height: 1.15;\n    text-align: center;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n\/* Scrollbar principal *\/\nhtml {\n    scrollbar-color: #f5f5f5 #20242b;\n    scrollbar-width: auto;\n}\n\nhtml::-webkit-scrollbar {\n    width: 15px;\n}\n\nhtml::-webkit-scrollbar-track {\n    background: #20242b;\n}\n\nhtml::-webkit-scrollbar-thumb {\n    background: #f5f5f5;\n    border-radius: 10px;\n    border: 3px solid #20242b;\n}\n\nhtml::-webkit-scrollbar-thumb:hover {\n    background: #ffffff;\n}\n\n\/* Scrollbar dos filtros *\/\n#controlesOrdenacao {\n    scrollbar-color: #f5f5f5 #171b21;\n    scrollbar-width: auto;\n}\n\n#controlesOrdenacao::-webkit-scrollbar {\n    width: 11px;\n}\n\n#controlesOrdenacao::-webkit-scrollbar-track {\n    background: #171b21;\n}\n\n#controlesOrdenacao::-webkit-scrollbar-thumb {\n    background: #f5f5f5;\n    border-radius: 10px;\n    border: 2px solid #171b21;\n}\n\n#listaPalavrasTituloCotafacil,\n#listaPalavrasExcluiTituloCotafacil {\n    scrollbar-color: #f5f5f5 #171b21;\n}\n\n#listaPalavrasTituloCotafacil::-webkit-scrollbar,\n#listaPalavrasExcluiTituloCotafacil::-webkit-scrollbar {\n    width: 9px;\n}\n\n#listaPalavrasTituloCotafacil::-webkit-scrollbar-track,\n#listaPalavrasExcluiTituloCotafacil::-webkit-scrollbar-track {\n    background: #171b21;\n}\n\n#listaPalavrasTituloCotafacil::-webkit-scrollbar-thumb,\n#listaPalavrasExcluiTituloCotafacil::-webkit-scrollbar-thumb {\n    background: #ffffff;\n    border-radius: 8px;\n    border: 2px solid #171b21;\n}\n\n\n\n\n\/* ============================================================\n   CARDS 3 COLUNAS COMPACTOS 2026\n   ============================================================ *\/\n\n\/* ---------- FILTROS MAIS LARGOS E LEGIVEIS ---------- *\/\n\n@media (min-width: 901px) {\n\n    #areaResultadosCotacao[style*=\"display: block\"],\n    #areaResultadosCotacao[style*=\"display:block\"] {\n        grid-template-columns:\n            350px minmax(0, 1fr) !important;\n        column-gap: 16px !important;\n    }\n\n    #controlesOrdenacao {\n        padding: 16px !important;\n        font-size: 14px !important;\n\n        \/* evita segunda barra branca vertical *\/\n        max-height: none !important;\n        overflow-y: visible !important;\n        overflow-x: visible !important;\n    }\n\n    #controlesOrdenacao label {\n        font-size: 14px !important;\n        line-height: 1.35 !important;\n        color: #e3e7ec !important;\n    }\n\n    \/* CHECKBOX N\u00c3O HERDA MAIS width:100% *\/\n    #controlesOrdenacao input[type=\"checkbox\"],\n    #controlesOrdenacao input[type=\"radio\"] {\n        appearance: auto !important;\n        -webkit-appearance: auto !important;\n\n        width: 16px !important;\n        height: 16px !important;\n        min-width: 16px !important;\n        min-height: 16px !important;\n        max-width: 16px !important;\n        max-height: 16px !important;\n\n        padding: 0 !important;\n        margin: 0 7px 0 0 !important;\n\n        transform: none !important;\n        flex: 0 0 16px !important;\n\n        accent-color: #e10600;\n    }\n\n    #listaPalavrasTituloCotafacil label,\n    #listaPalavrasExcluiTituloCotafacil label {\n        display: flex !important;\n        align-items: center !important;\n        gap: 5px !important;\n\n        min-height: 27px !important;\n        padding: 2px 4px !important;\n\n        font-size: 13px !important;\n        color: #edf0f4 !important;\n        white-space: normal !important;\n    }\n\n    #listaPalavrasTituloCotafacil,\n    #listaPalavrasExcluiTituloCotafacil {\n        max-height: 175px !important;\n        overflow-y: auto !important;\n    }\n\n\n    \/* ---------- CARD COMPACTO ---------- *\/\n\n    .cotafacil-resultado-card {\n        padding: 11px 13px !important;\n        margin-bottom: 8px !important;\n        min-height: 0 !important;\n    }\n\n    .cotafacil-resultado-card > div:first-child {\n        display: grid !important;\n\n        grid-template-columns:\n            18px\n            122px\n            minmax(250px, 1fr)\n            minmax(210px, 270px) !important;\n\n        column-gap: 12px !important;\n        align-items: start !important;\n\n        width: 100% !important;\n    }\n\n\n    \/* CHECKBOX DO CARD *\/\n\n    .cotafacil-item-checkbox {\n        appearance: auto !important;\n        -webkit-appearance: auto !important;\n\n        width: 16px !important;\n        height: 16px !important;\n        min-width: 16px !important;\n        min-height: 16px !important;\n\n        margin: 4px 0 0 0 !important;\n        padding: 0 !important;\n        transform: none !important;\n\n        accent-color: #e10600;\n    }\n\n\n    \/* IMAGEM *\/\n\n    .cotafacil-imagem-box {\n        width: 122px !important;\n        height: 110px !important;\n        min-width: 122px !important;\n\n        padding: 5px !important;\n        margin: 0 !important;\n    }\n\n\n    \/* \u00c1REA PRINCIPAL *\/\n\n    .cotafacil-resultado-card .cotafacil-marketplace {\n        margin-bottom: 4px !important;\n        padding: 3px 7px !important;\n        font-size: 11px !important;\n    }\n\n\n    \/* ---------- COLUNA DIREITA ---------- *\/\n\n    .cotafacil-card-lateral {\n        min-width: 0;\n        padding-left: 13px;\n\n        border-left:\n            1px solid #303743;\n\n        display: flex;\n        flex-direction: column;\n        align-items: stretch;\n\n        gap: 5px;\n\n        font-size: 12px;\n        line-height: 1.25;\n    }\n\n    .cotafacil-card-lateral > div {\n        margin-top: 0 !important;\n        font-size: 12px !important;\n        line-height: 1.25 !important;\n    }\n\n    .cotafacil-card-lateral\n    .cotafacil-status-ranking {\n        color: #32d583 !important;\n        font-weight: 700 !important;\n    }\n\n    .cotafacil-card-lateral\n    .cotafacil-status-alerta {\n        color: #f5c542 !important;\n        font-weight: 700 !important;\n    }\n\n    .cotafacil-card-lateral\n    .cotafacil-status-erro {\n        color: #ff5252 !important;\n        font-weight: 700 !important;\n    }\n\n\n    \/* BOT\u00c3O DE OFERTA NA COLUNA DIREITA *\/\n\n    .cotafacil-card-lateral\n    .cotafacil-link-oferta {\n        display: flex !important;\n        align-items: center;\n        justify-content: center;\n\n        width: 100% !important;\n        box-sizing: border-box;\n\n        min-height: 34px !important;\n\n        margin:\n            auto 0 0 0 !important;\n\n        padding:\n            7px 10px !important;\n\n        font-size: 12px !important;\n        line-height: 1.15 !important;\n        text-align: center;\n\n        border-radius: 7px !important;\n    }\n}\n\n\n\/* ============================================================\n   MOBILE - VOLTA PARA FORMATO EMPILHADO\n   ============================================================ *\/\n\n@media (max-width: 900px) {\n\n    .cotafacil-resultado-card > div:first-child {\n        display: grid !important;\n\n        grid-template-columns:\n            18px\n            88px\n            minmax(0, 1fr) !important;\n\n        gap: 9px !important;\n    }\n\n    .cotafacil-card-lateral {\n        grid-column:\n            2 \/ -1;\n\n        border-left: 0;\n        border-top:\n            1px solid #303743;\n\n        padding:\n            9px 0 0 0;\n\n        margin-top:\n            3px;\n    }\n\n    .cotafacil-item-checkbox {\n        width: 16px !important;\n        height: 16px !important;\n        min-width: 16px !important;\n        min-height: 16px !important;\n        transform: none !important;\n    }\n}\n\n\n\/* ============================================================\n   ORCAMENTO RESPONSIVO - 2026\n   ============================================================ *\/\n\n#modalOrcamentoCotafacil #caixaOrcamentoCotafacil {\n    max-width: 980px;\n}\n\n@media (max-width: 700px) {\n\n    #modalOrcamentoCotafacil {\n        padding: 10px !important;\n    }\n\n    #modalOrcamentoCotafacil #caixaOrcamentoCotafacil {\n        width: 100% !important;\n        margin: 8px auto !important;\n    }\n\n    #modalOrcamentoCotafacil #caixaOrcamentoCotafacil > div:first-child {\n        padding: 14px !important;\n    }\n\n    #modalOrcamentoCotafacil #listaOrcamentoCotafacil {\n        padding: 10px 14px 18px !important;\n    }\n\n    #modalOrcamentoCotafacil #listaOrcamentoCotafacil > div {\n        grid-template-columns: 1fr auto !important;\n        gap: 8px !important;\n    }\n\n    #modalOrcamentoCotafacil #listaOrcamentoCotafacil > div > div:nth-child(1) {\n        grid-column: 1;\n        grid-row: 1;\n    }\n\n    #modalOrcamentoCotafacil #listaOrcamentoCotafacil > div > div:nth-child(2) {\n        grid-column: 1;\n        grid-row: 2;\n    }\n\n    #modalOrcamentoCotafacil #listaOrcamentoCotafacil > div > div:nth-child(3) {\n        grid-column: 1;\n        grid-row: 3;\n        text-align: left !important;\n    }\n\n    #modalOrcamentoCotafacil #listaOrcamentoCotafacil > div > div:nth-child(4) {\n        grid-column: 1 \/ span 2;\n        grid-row: 4;\n        align-items: flex-start !important;\n        text-align: left !important;\n        padding-top: 4px;\n    }\n\n    #modalOrcamentoCotafacil #listaOrcamentoCotafacil > div > button {\n        grid-column: 2;\n        grid-row: 1 \/ span 3;\n        align-self: center;\n    }\n\n    #modalOrcamentoCotafacil #totalGeralOrcamentoCotafacil {\n        display: flex !important;\n        justify-content: flex-end !important;\n        text-align: right !important;\n    }\n}\n\n@media (max-width: 430px) {\n\n    #btnSairOrcamentoCotafacil {\n        padding: 0 9px !important;\n        font-size: 11px !important;\n    }\n\n    #modalOrcamentoCotafacil #caixaOrcamentoCotafacil > div:first-child > div:first-child > div:first-child {\n        font-size: 18px !important;\n    }\n}\n\n\n\/* CORRECAO LOGIN\/CADASTRO - TELAS PEQUENAS - 22\/09\/2026 *\/\n@media (max-width: 700px) {\n    .cotafacil-modal-conta {\n        padding: 8px;\n    }\n\n    .cotafacil-modal-caixa {\n        max-height: calc(100vh - 16px);\n        overflow-y: auto;\n        box-sizing: border-box;\n        -webkit-overflow-scrolling: touch;\n    }\n}\n\n<\/style>\n\n<script>\n\ndocument.addEventListener(\n    'DOMContentLoaded',\n    function() {\n\n        const modal =\n            document.getElementById(\n                'modalContaCotafacil'\n            );\n\n        const fechar =\n            document.getElementById(\n                'fecharModalContaCotafacil'\n            );\n\n        const areaLogin =\n            document.getElementById(\n                'areaLoginCotafacil'\n            );\n\n        const areaCadastro =\n            document.getElementById(\n                'areaCadastroCotafacil'\n            );\n\n        const areaRecuperarSenha =\n            document.getElementById(\n                'areaRecuperarSenhaCotafacil'\n            );\n\n        const areaConfirmacao =\n            document.getElementById(\n                'areaConfirmacaoCotafacil'\n            );\n\n        const areaMinhaConta =\n            document.getElementById(\n                'areaMinhaContaCotafacil'\n            );\n\n        const titulo =\n            document.getElementById(\n                'tituloModalContaCotafacil'\n            );\n\n        const mensagem =\n            document.getElementById(\n                'mensagemContaCotafacil'\n            );\n\n        function mostrarLogin() {\n\n            const emailLembradoCotafacil =\n                localStorage.getItem(\n                    'cotafacil_login_email'\n                );\n\n            const campoEmailCotafacil =\n                document.getElementById(\n                    'loginEmailCotafacil'\n                );\n\n            const lembrarMeCotafacil =\n                document.getElementById(\n                    'lembrarMeCotafacil'\n                );\n\n            if (campoEmailCotafacil) {\n                campoEmailCotafacil.value =\n                    emailLembradoCotafacil\n                        ? emailLembradoCotafacil\n                        : '';\n            }\n\n            if (lembrarMeCotafacil) {\n                lembrarMeCotafacil.checked =\n                    emailLembradoCotafacil\n                        ? true\n                        : false;\n            }\n\n            areaLogin.style.display =\n                'block';\n\n            areaCadastro.style.display =\n                'none';\n\n            areaRecuperarSenha.style.display =\n                'none';\n\n            areaConfirmacao.style.display =\n                'none';\n\n            areaMinhaConta.style.display =\n                'none';\n\n            titulo.textContent =\n                'Entrar';\n\n            mensagem.textContent =\n                '';\n        }\n\n        function mostrarCadastro() {\n\n            areaLogin.style.display =\n                'none';\n\n            areaCadastro.style.display =\n                'block';\n\n            areaRecuperarSenha.style.display =\n                'none';\n\n            areaConfirmacao.style.display =\n                'none';\n\n            areaMinhaConta.style.display =\n                'none';\n\n            titulo.textContent =\n                'Cadastrar';\n\n            mensagem.textContent =\n                '';\n        }\n\n        function mostrarRecuperarSenha() {\n\n            areaLogin.style.display =\n                'none';\n\n            areaCadastro.style.display =\n                'none';\n\n            areaRecuperarSenha.style.display =\n                'block';\n\n            areaConfirmacao.style.display =\n                'none';\n\n            areaMinhaConta.style.display =\n                'none';\n\n            titulo.textContent =\n                'Recuperar senha';\n\n            mensagem.textContent =\n                '';\n\n            const emailLogin =\n                document.getElementById(\n                    'loginEmailCotafacil'\n                ).value.trim();\n\n            const emailRecuperar =\n                document.getElementById(\n                    'recuperarEmailCotafacil'\n                );\n\n            if (emailLogin) {\n                emailRecuperar.value =\n                    emailLogin;\n            }\n\n            emailRecuperar.focus();\n        }\n\n        let pollingWhatsappCotafacil = null;\n        let nonceExcluirContaCotafacil = '';\n\n        async function consultarConfirmacaoWhatsappCotafacil() {\n\n            try {\n\n                const resposta =\n                    await fetch(\n                        '\/wp-admin\/admin-ajax.php?action=cotafacil_usuario',\n                        {\n                            method: 'GET',\n                            credentials: 'include'\n                        }\n                    );\n\n                if (!resposta.ok) {\n                    return false;\n                }\n\n                const dados =\n                    await resposta.json();\n\n                return (\n                    dados.logado === true &&\n                    dados.telefone_verificado === true\n                );\n\n            } catch (erro) {\n\n                console.error(\n                    '[COTA FACIL] Erro ao verificar WhatsApp:',\n                    erro\n                );\n\n                return false;\n            }\n        }\n\n        function mostrarConfirmacaoCotafacil(\n            telefoneVerificado\n        ) {\n\n            areaLogin.style.display =\n                'none';\n\n            areaCadastro.style.display =\n                'none';\n\n            areaRecuperarSenha.style.display =\n                'none';\n\n            areaConfirmacao.style.display =\n                'block';\n\n            areaMinhaConta.style.display =\n                'none';\n\n            titulo.textContent =\n                'Confirma\u00e7\u00e3o do cadastro';\n\n            mensagem.textContent =\n                '';\n\n            const areaWhatsapp =\n                document.getElementById(\n                    'confirmacaoWhatsappCotafacil'\n                );\n\n            const areaConcluida =\n                document.getElementById(\n                    'confirmacaoConcluidaCotafacil'\n                );\n\n            if (telefoneVerificado) {\n\n                if (pollingWhatsappCotafacil) {\n                    clearInterval(\n                        pollingWhatsappCotafacil\n                    );\n\n                    pollingWhatsappCotafacil =\n                        null;\n                }\n\n                areaWhatsapp.style.display =\n                    'none';\n\n                areaConcluida.style.display =\n                    'block';\n\n            } else {\n\n                areaWhatsapp.style.display =\n                    'block';\n\n                areaConcluida.style.display =\n                    'none';\n\n                if (pollingWhatsappCotafacil) {\n                    clearInterval(\n                        pollingWhatsappCotafacil\n                    );\n                }\n\n                pollingWhatsappCotafacil =\n                    setInterval(\n                        async function() {\n\n                            const confirmado =\n                                await consultarConfirmacaoWhatsappCotafacil();\n\n                            if (confirmado) {\n\n                                clearInterval(\n                                    pollingWhatsappCotafacil\n                                );\n\n                                pollingWhatsappCotafacil =\n                                    null;\n\n                                mostrarConfirmacaoCotafacil(\n                                    true\n                                );\n                            }\n                        },\n                        3000\n                    );\n            }\n\n            modal.style.display =\n                'flex';\n        }\n\n        window.mostrarConfirmacaoCotafacil =\n            mostrarConfirmacaoCotafacil;\n\n        window.abrirModalContaCotafacil =\n            function() {\n\n                mostrarLogin();\n\n                modal.style.display =\n                    'flex';\n            };\n\n        window.abrirMinhaContaCotafacil =\n            function(\n                nomeUsuario,\n                administrador,\n                nonceExcluirConta\n            ) {\n\n                areaLogin.style.display =\n                    'none';\n\n                areaCadastro.style.display =\n                    'none';\n\n                areaRecuperarSenha.style.display =\n                    'none';\n\n                areaConfirmacao.style.display =\n                    'none';\n\n                areaMinhaConta.style.display =\n                    'block';\n\n                titulo.textContent =\n                    'Minha conta';\n\n                mensagem.textContent =\n                    '';\n\n                nonceExcluirContaCotafacil =\n                    nonceExcluirConta\n                        ? nonceExcluirConta\n                        : '';\n\n                const nomeMinhaConta =\n                    document.getElementById(\n                        'nomeMinhaContaCotafacil'\n                    );\n\n                if (nomeMinhaConta) {\n                    nomeMinhaConta.textContent =\n                        nomeUsuario || '';\n                }\n\n                const btnExcluirConta =\n                    document.getElementById(\n                        'btnExcluirContaCotafacil'\n                    );\n\n                if (btnExcluirConta) {\n                    btnExcluirConta.style.display =\n                        administrador\n                            ? 'none'\n                            : 'block';\n                }\n\n                modal.style.display =\n                    'flex';\n            };\n\n        const btnSairConta =\n            document.getElementById(\n                'btnSairContaCotafacil'\n            );\n\n        if (btnSairConta) {\n            btnSairConta.onclick =\n                async function() {\n\n                    try {\n\n                        const respostaLogout =\n                            await fetch(\n                                '\/wp-admin\/admin-ajax.php?action=cotafacil_logout',\n                                {\n                                    method: 'POST',\n                                    credentials: 'include'\n                                }\n                            );\n\n                        const dadosLogout =\n                            await respostaLogout.json();\n\n                        if (dadosLogout) {\n                            if (dadosLogout.ok) {\n                                window.location.href =\n                                    '\/';\n                            }\n                        }\n\n                    } catch (erro) {\n\n                        console.error(\n                            '[COTA FACIL] Erro ao sair:',\n                            erro\n                        );\n                    }\n                };\n        }\n\n        const btnExcluirConta =\n            document.getElementById(\n                'btnExcluirContaCotafacil'\n            );\n\n        if (btnExcluirConta) {\n            btnExcluirConta.onclick =\n                async function() {\n\n                    if (!nonceExcluirContaCotafacil) {\n                        mensagem.textContent =\n                            'N\u00e3o foi poss\u00edvel validar sua sess\u00e3o. Atualize a p\u00e1gina e tente novamente.';\n                        return;\n                    }\n\n                    const confirmado =\n                        window.confirm(\n                            'Tem certeza que deseja excluir sua conta? Esta a\u00e7\u00e3o \u00e9 permanente. Seus cr\u00e9ditos, or\u00e7amento e dados da conta ser\u00e3o apagados.'\n                        );\n\n                    if (!confirmado) {\n                        return;\n                    }\n\n                    btnExcluirConta.disabled =\n                        true;\n\n                    btnExcluirConta.textContent =\n                        'Excluindo...';\n\n                    mensagem.textContent =\n                        '';\n\n                    try {\n\n                        const dadosEnvio =\n                            new URLSearchParams();\n\n                        dadosEnvio.append(\n                            'action',\n                            'cotafacil_excluir_conta'\n                        );\n\n                        dadosEnvio.append(\n                            'nonce',\n                            nonceExcluirContaCotafacil\n                        );\n\n                        const resposta =\n                            await fetch(\n                                '\/wp-admin\/admin-ajax.php',\n                                {\n                                    method: 'POST',\n                                    credentials: 'include',\n                                    headers: {\n                                        'Content-Type':\n                                            'application\/x-www-form-urlencoded; charset=UTF-8'\n                                    },\n                                    body: dadosEnvio.toString()\n                                }\n                            );\n\n                        const dadosExclusao =\n                            await resposta.json();\n\n                        if (dadosExclusao.success === true) {\n                            window.location.href =\n                                '\/';\n                            return;\n                        }\n\n                        mensagem.textContent =\n                            'N\u00e3o foi poss\u00edvel excluir a conta. Tente novamente.';\n\n                    } catch (erro) {\n\n                        console.error(\n                            '[COTA FACIL] Erro ao excluir conta:',\n                            erro\n                        );\n\n                        mensagem.textContent =\n                            'N\u00e3o foi poss\u00edvel excluir a conta. Tente novamente.';\n\n                    } finally {\n\n                        btnExcluirConta.disabled =\n                            false;\n\n                        btnExcluirConta.textContent =\n                            'Excluir conta';\n                    }\n                };\n        }\n\n        fechar.onclick =\n            function() {\n\n                if (pollingWhatsappCotafacil) {\n                    clearInterval(\n                        pollingWhatsappCotafacil\n                    );\n\n                    pollingWhatsappCotafacil =\n                        null;\n                }\n\n                modal.style.display =\n                    'none';\n            };\n\n        document.getElementById(\n            'abrirCadastroCotafacil'\n        ).onclick =\n            mostrarCadastro;\n\n        document.getElementById(\n            'abrirLoginCotafacil'\n        ).onclick =\n            mostrarLogin;\n\n        document.getElementById(\n            'abrirRecuperarSenhaCotafacil'\n        ).onclick =\n            mostrarRecuperarSenha;\n\n        document.getElementById(\n            'voltarLoginCotafacil'\n        ).onclick =\n            mostrarLogin;\n\n        document.getElementById(\n            'btnRecuperarSenhaCotafacil'\n        ).onclick =\n            async function() {\n\n                const email =\n                    document.getElementById(\n                        'recuperarEmailCotafacil'\n                    ).value.trim();\n\n                if (!email) {\n                    mensagem.textContent =\n                        'Informe seu e-mail.';\n                    return;\n                }\n\n                mensagem.textContent =\n                    'Enviando instru\u00e7\u00f5es...';\n\n                const dados =\n                    new URLSearchParams();\n\n                dados.append(\n                    'action',\n                    'cotafacil_recuperar_senha'\n                );\n\n                dados.append(\n                    'email',\n                    email\n                );\n\n                try {\n\n                    const resposta =\n                        await fetch(\n                            '\/wp-admin\/admin-ajax.php',\n                            {\n                                method:\n                                    'POST',\n                                credentials:\n                                    'include',\n                                body:\n                                    dados\n                            }\n                        );\n\n                    const retorno =\n                        await resposta.json();\n\n                    if (!retorno.success) {\n\n                        mensagem.textContent =\n                            'N\u00e3o foi poss\u00edvel enviar as instru\u00e7\u00f5es. Verifique o e-mail e tente novamente.';\n\n                        return;\n                    }\n\n                    mensagem.textContent =\n                        'Se o e-mail estiver cadastrado, voc\u00ea receber\u00e1 as instru\u00e7\u00f5es para redefinir sua senha.';\n\n                } catch (erro) {\n\n                    console.error(\n                        '[COTA FACIL RECUPERAR SENHA]',\n                        erro\n                    );\n\n                    mensagem.textContent =\n                        'N\u00e3o foi poss\u00edvel enviar as instru\u00e7\u00f5es. Tente novamente.';\n                }\n            };\n\n        document.getElementById(\n            'btnEntrarCotafacil'\n        ).onclick =\n            async function() {\n\n                mensagem.textContent =\n                    'Entrando...';\n\n                const dados =\n                    new URLSearchParams();\n\n                dados.append(\n                    'action',\n                    'cotafacil_login'\n                );\n\n                dados.append(\n                    'email',\n                    document.getElementById(\n                        'loginEmailCotafacil'\n                    ).value\n                );\n\n                dados.append(\n                    'senha',\n                    document.getElementById(\n                        'loginSenhaCotafacil'\n                    ).value\n                );\n\n                try {\n\n                    const resposta =\n                        await fetch(\n                            '\/wp-admin\/admin-ajax.php',\n                            {\n                                method:\n                                    'POST',\n                                credentials:\n                                    'include',\n                                body: dados\n                            }\n                        );\n\n                    const retorno =\n                        await resposta.json();\n\n                    if (\n                        !retorno.success\n                    ) {\n                        mensagem.textContent =\n                            'E-mail ou senha inv\u00e1lidos.';\n                        return;\n                    }\n\n                    const campoEmailCotafacil =\n                        document.getElementById(\n                            'loginEmailCotafacil'\n                        );\n\n                    const lembrarMeCotafacil =\n                        document.getElementById(\n                            'lembrarMeCotafacil'\n                        );\n\n                    if (lembrarMeCotafacil) {\n\n                        if (lembrarMeCotafacil.checked) {\n\n                            localStorage.setItem(\n                                'cotafacil_login_email',\n                                campoEmailCotafacil\n                                    ? campoEmailCotafacil.value\n                                    : ''\n                            );\n\n                        } else {\n\n                            localStorage.removeItem(\n                                'cotafacil_login_email'\n                            );\n                        }\n                    }\n\n                    mensagem.textContent =\n                        'Login realizado.';\n\n                    window.location.reload();\n\n                } catch (erro) {\n\n                    mensagem.textContent =\n                        'N\u00e3o foi poss\u00edvel entrar.';\n                }\n            };\n\n        document.getElementById(\n            'btnCadastrarCotafacil'\n        ).onclick =\n            async function() {\n\n                mensagem.textContent =\n                    'Criando conta...';\n\n                const dados =\n                    new URLSearchParams();\n\n                dados.append(\n                    'action',\n                    'cotafacil_cadastrar'\n                );\n\n                dados.append(\n                    'nome',\n                    document.getElementById(\n                        'cadastroNomeCotafacil'\n                    ).value\n                );\n\n                dados.append(\n                    'telefone',\n                    document.getElementById(\n                        'cadastroTelefoneCotafacil'\n                    ).value\n                );\n\n                dados.append(\n                    'email',\n                    document.getElementById(\n                        'cadastroEmailCotafacil'\n                    ).value\n                );\n\n                dados.append(\n                    'senha',\n                    document.getElementById(\n                        'cadastroSenhaCotafacil'\n                    ).value\n                );\n\n                try {\n\n                    const resposta =\n                        await fetch(\n                            '\/wp-admin\/admin-ajax.php',\n                            {\n                                method:\n                                    'POST',\n                                credentials:\n                                    'include',\n                                body: dados\n                            }\n                        );\n\n                    const retorno =\n                        await resposta.json();\n\n                    if (\n                        !retorno.success\n                    ) {\n\n                        const erro =\n                            retorno?.data?.erro || '';\n\n                        if (\n                            erro ===\n                            'TELEFONE_INVALIDO'\n                        ) {\n                            mensagem.textContent =\n                                'Informe um celular v\u00e1lido com DDD.';\n                        } else if (\n                            erro ===\n                            'TELEFONE_JA_CADASTRADO'\n                        ) {\n                            mensagem.textContent =\n                                'Este celular j\u00e1 est\u00e1 cadastrado.';\n                        } else if (\n                            erro ===\n                            'EMAIL_INVALIDO'\n                        ) {\n                            mensagem.textContent =\n                                'Informe um e-mail v\u00e1lido.';\n                        } else if (\n                            erro ===\n                            'EMAIL_JA_CADASTRADO'\n                        ) {\n                            mensagem.textContent =\n                                'Este e-mail j\u00e1 est\u00e1 cadastrado.';\n                        } else if (\n                            erro ===\n                            'SENHA_MINIMO_6'\n                        ) {\n                            mensagem.textContent =\n                                'A senha deve ter pelo menos 6 caracteres.';\n                        } else if (\n                            erro ===\n                            'PREENCHA_TODOS_OS_CAMPOS'\n                        ) {\n                            mensagem.textContent =\n                                'Preencha todos os campos.';\n                        } else {\n                            mensagem.textContent =\n                                'N\u00e3o foi poss\u00edvel criar a conta.';\n                        }\n\n                        return;\n                    }\n\n                    mensagem.textContent =\n                        'Cadastro realizado! Enviamos um link para o e-mail informado. Confirme seu e-mail para liberar sua primeira consulta gr\u00e1tis. Verifique tamb\u00e9m a caixa de spam.';\n\n                    setTimeout(\n                        function() {\n                            window.location.reload();\n                        },\n                        6000\n                    );\n\n                } catch (erro) {\n\n                    mensagem.textContent =\n                        'N\u00e3o foi poss\u00edvel criar a conta.';\n                }\n            };\n    }\n);\n\n\n\ndocument.addEventListener(\n    'DOMContentLoaded',\n    function() {\n\n        const botao =\n            document.getElementById(\n                'btnAbrirWhatsappConfirmacaoCotafacil'\n            );\n\n        if (!botao) {\n            return;\n        }\n\n        botao.onclick =\n            function() {\n\n                const numero =\n                    '553598544887';\n\n                const mensagem =\n                    encodeURIComponent(\n                        'Confirmar cota f\u00e1cil'\n                    );\n\n                window.open(\n                    'https:\/\/wa.me\/' +\n                    numero +\n                    '?text=' +\n                    mensagem,\n                    '_blank'\n                );\n            };\n    }\n);\n\n\nwindow.abrirModalPixCotafacil = function() {\n\n    const modal =\n        document.getElementById(\n            'modalPixCotafacil'\n        );\n\n    if (modal) {\n        modal.style.display = 'flex';\n    }\n};\n\n\/\/ Abre a contratacao Pix ao acessar o painel com ?contratar=1.\ndocument.addEventListener('DOMContentLoaded', function() {\n    const parametros = new URLSearchParams(window.location.search);\n\n    if (parametros.get('contratar') === '1') {\n        window.abrirModalPixCotafacil();\n    }\n});\n\n\ndocument.addEventListener(\n    'DOMContentLoaded',\n    function() {\n\n        const modal =\n            document.getElementById(\n                'modalPixCotafacil'\n            );\n\n        const fechar =\n            document.getElementById(\n                'fecharModalPixCotafacil'\n            );\n\n        const gerar =\n            document.getElementById(\n                'btnGerarPixCotafacil'\n            );\n\n        const copiar =\n            document.getElementById(\n                'btnCopiarPixCotafacil'\n            );\n\n        const status =\n            document.getElementById(\n                'statusPixCotafacil'\n            );\n\n        const qr =\n            document.getElementById(\n                'qrPixCotafacil'\n            );\n\n        const codigo =\n            document.getElementById(\n                'codigoPixCotafacil'\n            );\n\n        if ([fechar, modal].every(Boolean)) {\n            fechar.onclick = function() {\n                modal.style.display = 'none';\n            };\n        }\n\n        if (modal) {\n            modal.addEventListener(\n                'click',\n                function(evento) {\n                    if (evento.target === modal) {\n                        modal.style.display = 'none';\n                    }\n                }\n            );\n        }\n\n        if ([copiar, codigo].every(Boolean)) {\n            copiar.onclick = async function() {\n                try {\n                    await navigator.clipboard.writeText(\n                        codigo.value\n                    );\n                    copiar.textContent =\n                        'C\u00f3digo copiado!';\n                } catch (erro) {\n                    codigo.select();\n                    document.execCommand('copy');\n                    copiar.textContent =\n                        'C\u00f3digo copiado!';\n                }\n            };\n        }\n\n        if (gerar) {\n            gerar.onclick = async function() {\n\n                gerar.disabled = true;\n\n                if (status) {\n                    status.textContent =\n                        'Gerando Pix...';\n                }\n\n                try {\n\n                    const pacoteSelecionado =\n                        document.querySelector(\n                            'input[name=\"pacotePixCotafacil\"]:checked'\n                        );\n\n                    if (!pacoteSelecionado) {\n                        throw new Error('Selecione um plano.');\n                    }\n\n                    const planoSelecionado =\n                        pacoteSelecionado.value;\n\n                    const nonceRest =\n                        window.cotafacilNonceRest || '';\n\n                    if (!nonceRest) {\n                        throw new Error(\n                            'Sua sess\u00e3o expirou. Atualize a p\u00e1gina.'\n                        );\n                    }\n\n                    const resposta =\n                        await fetch(\n                            '\/index.php\/wp-json\/cotafacil\/v1\/criar-pix-plano',\n                            {\n                                method: 'POST',\n                                credentials: 'include',\n                                headers: {\n                                    'Content-Type': 'application\/json',\n                                    'X-WP-Nonce': nonceRest\n                                },\n                                body: JSON.stringify({\n                                    plano: planoSelecionado\n                                })\n                            }\n                        );\n\n                    const dados =\n                        await resposta.json();\n\n                    if (\n                        !resposta.ok ||\n                        !dados ||\n                        !dados.ok\n                    ) {\n                        throw new Error(\n                            dados\n                                ? (\n                                    dados.erro\n                                        ? dados.erro\n                                        : 'N\u00e3o foi poss\u00edvel gerar o Pix.'\n                                  )\n                                : 'N\u00e3o foi poss\u00edvel gerar o Pix.'\n                        );\n                    }\n\n                    if (!dados.order_id) {\n                        throw new Error(\n                            'Pagamento criado sem identificador do pedido.'\n                        );\n                    }\n\n                    const orderIdPix = String(dados.order_id);\n\n                    if (status) {\n                        status.textContent =\n                            'Pix gerado. Escaneie o QR Code ou copie o c\u00f3digo.';\n                    }\n\n                    if (\n                        [qr, dados.qr_code_base64]\n                            .every(Boolean)\n                    ) {\n                        qr.src =\n                            'data:image\/png;base64,' +\n                            dados.qr_code_base64;\n\n                        qr.style.display =\n                            'block';\n                    }\n\n                    if (\n                        [codigo, dados.qr_code]\n                            .every(Boolean)\n                    ) {\n                        codigo.value =\n                            dados.qr_code;\n\n                        codigo.style.display =\n                            'block';\n                    }\n\n                    if (copiar) {\n                        copiar.style.display =\n                            'block';\n                    }\n\n                    let tentativasPix = 0;\n\n                    const verificarPagamentoPix = async function() {\n                        tentativasPix++;\n\n                        try {\n                            const r = await fetch(\n                                '\/index.php\/wp-json\/cotafacil\/v1\/status-pix-plano?order_id=' +\n                                    encodeURIComponent(orderIdPix),\n                                {\n                                    credentials: 'include',\n                                    headers: {\n                                        'X-WP-Nonce': nonceRest\n                                    }\n                                }\n                            );\n\n                            if (r.ok) {\n                                const pagamento = await r.json();\n\n                                if (\n                                    pagamento.ok &&\n                                    pagamento.pagamento_confirmado\n                                ) {\n                                    if (status) {\n                                        status.textContent =\n                                            'Pagamento confirmado \u2014 plano ativado!';\n                                    }\n\n                                    await carregarUsuarioCotafacil();\n                                    return;\n                                }\n                            }\n                        } catch (erroConsultaPix) {\n                        }\n\n                        if (tentativasPix < 120) {\n                            setTimeout(verificarPagamentoPix, 3000);\n                        }\n                    };\n\n                    setTimeout(verificarPagamentoPix, 3000);\n\n                } catch (erro) {\n\n                    if (status) {\n                        status.textContent =\n                            'Erro ao gerar Pix: ' +\n                            erro.message;\n                    }\n\n                } finally {\n                    gerar.disabled = false;\n                }\n            };\n        }\n    }\n);\n\nasync function carregarUsuarioCotafacil() {\n\n    const btnConta =\n        document.getElementById(\n            'btnContaCotafacil'\n        );\n\n    const btnCreditos =\n        document.getElementById(\n            'btnCreditosCotafacil'\n        );\n\n    const nomeContaTopo =\n        document.getElementById(\n            'nomeContaTopoCotafacil'\n        );\n\n    if (!btnConta || !btnCreditos) {\n        return;\n    }\n\n    \/\/ LOGIN: permitir abrir a janela mesmo se\n    \/\/ a consulta ao servidor falhar.\n    btnConta.onclick = function() {\n        if (\n            typeof window.abrirModalContaCotafacil\n            === 'function'\n        ) {\n            window.abrirModalContaCotafacil();\n        }\n    };\n\n    try {\n\n        const resposta =\n            await fetch(\n                '\/wp-admin\/admin-ajax.php?action=cotafacil_usuario',\n                {\n                    method: 'GET',\n                    credentials: 'include'\n                }\n            );\n\n        if (!resposta.ok) {\n            throw new Error(\n                'Falha ao consultar usu\u00e1rio.'\n            );\n        }\n\n        const dados =\n            await resposta.json();\n\n        window.cotafacilNonceRest =\n            dados.nonce_rest\n                ? dados.nonce_rest\n                : '';\n\n        if (!dados.logado) {\n\n            usuarioOrcamentoCotafacil =\n                null;\n\n            atualizarContadorOrcamento();\n\n            btnConta.textContent =\n                'Entrar \/ Cadastrar';\n\n            if (nomeContaTopo) {\n                nomeContaTopo.textContent =\n                    '';\n            }\n\n            btnConta.style.width =\n                'auto';\n\n            btnConta.style.minWidth =\n                '145px';\n\n            btnConta.style.padding =\n                '0 17px';\n\n            btnConta.style.fontSize =\n                '13px';\n\n            btnCreditos.textContent =\n                'Cr\u00e9ditos';\n\n            btnConta.onclick =\n                function() {\n                    if (\n                        typeof window.abrirModalContaCotafacil\n                        === 'function'\n                    ) {\n                        window.abrirModalContaCotafacil();\n                    }\n                };\n\n            btnCreditos.onclick =\n                function() {\n                    alert(\n                        'Entre na sua conta para consultar seus cr\u00e9ditos.'\n                    );\n                };\n\n            return;\n        }\n\n        const parametrosCotafacil =\n            new URLSearchParams(\n                window.location.search\n            );\n\n        const emailConfirmadoCotafacil =\n            parametrosCotafacil.get(\n                'email_confirmado'\n            );\n\n        const acessoPeloAppCotafacil =\n            navigator.userAgent.includes(\n                'CotaFacilAndroid'\n            );\n\n        if (\n            emailConfirmadoCotafacil === 'sim'\n        ) {\n            if (\n                dados.email_verificado === true\n            ) {\n                if (\n                    !acessoPeloAppCotafacil\n                ) {\n                    if (\n                        typeof window.mostrarConfirmacaoCotafacil\n                            === 'function'\n                    ) {\n                        window.mostrarConfirmacaoCotafacil(\n                            dados.telefone_verificado === true\n                        );\n                    }\n                }\n            }\n        }\n\n        if (\n            emailConfirmadoCotafacil === 'sim'\n        ) {\n            if (\n                dados.email_verificado === true\n            ) {\n                parametrosCotafacil.delete(\n                    'email_confirmado'\n                );\n\n            const novaBuscaCotafacil =\n                parametrosCotafacil.toString();\n\n            window.history.replaceState(\n                {},\n                document.title,\n                window.location.pathname +\n                    (\n                        novaBuscaCotafacil\n                            ? '?' + novaBuscaCotafacil\n                            : ''\n                    ) +\n                    window.location.hash\n            );\n            }\n        }\n\n        usuarioOrcamentoCotafacil =\n            dados.id\n                ? dados.id\n                : null;\n\n        await sincronizarOrcamentoServidorCotafacil();\n\n        atualizarContadorOrcamento();\n\n        btnConta.textContent =\n            '\ud83d\udc64';\n\n        btnConta.style.width =\n            '46px';\n\n        btnConta.style.minWidth =\n            '46px';\n\n        btnConta.style.padding =\n            '0';\n\n        btnConta.style.fontSize =\n            '22px';\n\n        const nomeContaCotafacil =\n            dados.nome\n                ? dados.nome\n                : (\n                    dados.login\n                        ? dados.login\n                        : ''\n                );\n\n        btnConta.title =\n            nomeContaCotafacil\n                ? 'Minha conta - ' + nomeContaCotafacil\n                : 'Minha conta';\n\n        if (nomeContaTopo) {\n            nomeContaTopo.textContent =\n                nomeContaCotafacil;\n        }\n\n        if (dados.administrador) {\n\n            btnCreditos.textContent =\n                'Acesso livre';\n\n        } else {\n\n            if (Number(dados.creditos) <= 0) {\n\n                btnCreditos.textContent =\n                    '+ Cr\u00e9ditos';\n\n            } else {\n\n                btnCreditos.textContent =\n                    String(dados.creditos) +\n                    (\n                        Number(dados.creditos) === 1\n                            ? ' cr\u00e9dito'\n                            : ' cr\u00e9ditos'\n                    );\n            }\n        }\n\n        btnConta.onclick =\n            function() {\n\n                if (\n                    typeof window.abrirMinhaContaCotafacil\n                    === 'function'\n                ) {\n                    window.abrirMinhaContaCotafacil(\n                        nomeContaCotafacil,\n                        dados.administrador === true,\n                        dados.nonce_excluir_conta\n                    );\n                }\n            };\n\n        btnCreditos.onclick =\n            function() {\n\n                if (dados.administrador) {\n\n                    alert(\n                        'Administrador: pesquisas sem consumo de cr\u00e9ditos.'\n                    );\n\n                } else {\n\n                    if (\n                        typeof window.abrirModalPixCotafacil\n                        === 'function'\n                    ) {\n                        window.abrirModalPixCotafacil();\n                    }\n                }\n            };\n\n    } catch (erro) {\n\n        console.error(\n            '[COTA FACIL] Erro ao carregar usu\u00e1rio:',\n            erro\n        );\n    }\n}\n\ndocument.addEventListener(\n    'DOMContentLoaded',\n    function() {\n        carregarUsuarioCotafacil();\n    }\n);\n\nfunction salvarHistoricoPesquisaCotafacil(termo) {\n    try {\n        const chave = 'cotafacil_historico_pesquisas';\n        const pesquisa = String(termo || '').trim();\n        if (!pesquisa) return;\n\n        const dados = JSON.parse(localStorage.getItem(chave) || '[]');\n        const historico = Array.isArray(dados) ? dados : [];\n\n        const atualizado = [\n            pesquisa,\n            ...historico.filter(item =>\n                typeof item === 'string' &&\n                item.toLowerCase() !== pesquisa.toLowerCase()\n            )\n        ].slice(0, 20);\n\n        localStorage.setItem(chave, JSON.stringify(atualizado));\n    } catch (erro) {\n        console.warn('[COTA FACIL] Hist\u00f3rico indispon\u00edvel:', erro);\n    }\n}\n\n\nfunction iniciarInterfaceHistoricoCotafacil() {\n    const botao = document.getElementById('btnHistoricoCotafacil');\n    const lista = document.getElementById('listaHistoricoCotafacil');\n\n    if (!botao || !lista) return;\n\n    botao.setAttribute('aria-expanded', 'false');\n    botao.setAttribute('aria-controls', 'listaHistoricoCotafacil');\n\n    botao.addEventListener('click', function () {\n        if (lista.hidden) {\n            mostrarHistoricoCotafacil();\n        }\n        lista.hidden = !lista.hidden;\n        botao.setAttribute('aria-expanded', String(!lista.hidden));\n    });\n}\n\ndocument.addEventListener(\n    'DOMContentLoaded',\n    iniciarInterfaceHistoricoCotafacil\n);\n\n\nfunction mostrarHistoricoCotafacil() {\n    const lista = document.getElementById('listaHistoricoCotafacil');\n    if (!lista) return;\n\n    lista.replaceChildren();\n\n    let historico = [];\n\n    try {\n        const dados = JSON.parse(\n            localStorage.getItem('cotafacil_historico_pesquisas') || '[]'\n        );\n        if (Array.isArray(dados)) {\n            historico = dados.filter(x => typeof x === 'string').slice(0, 20);\n        }\n    } catch (erro) {\n        console.warn('[COTA FACIL] Erro ao ler hist\u00f3rico:', erro);\n    }\n\n    if (!historico.length) {\n        lista.textContent = 'Nenhuma pesquisa anterior.';\n        return;\n    }\n\n    historico.forEach(function(termo, indice) {\n        const linha = document.createElement('div');\n        linha.style.cssText =\n            'display:flex;align-items:center;gap:8px;margin-bottom:6px;';\n\n        const pesquisar = document.createElement('button');\n        pesquisar.type = 'button';\n        pesquisar.textContent = termo;\n        pesquisar.style.cssText =\n            'flex:1;min-width:0;text-align:left;overflow-wrap:anywhere;';\n\n        pesquisar.addEventListener('click', function() {\n            const campo = document.getElementById('inputBuscaMl');\n            if (!campo || campo.disabled) return;\n            campo.value = termo;\n            lista.hidden = true;\n\n            const botao = document.getElementById('btnHistoricoCotafacil');\n            if (botao) botao.setAttribute('aria-expanded', 'false');\n\n            dispararPesquisaComercial();\n        });\n\n        const excluir = document.createElement('button');\n        excluir.type = 'button';\n        excluir.textContent = '\u00d7';\n        excluir.setAttribute('aria-label', 'Excluir pesquisa: ' + termo);\n\n        excluir.addEventListener('click', function() {\n            try {\n                const atual = JSON.parse(\n                    localStorage.getItem('cotafacil_historico_pesquisas') || '[]'\n                );\n                if (!Array.isArray(atual)) return;\n                atual.splice(indice, 1);\n                localStorage.setItem(\n                    'cotafacil_historico_pesquisas',\n                    JSON.stringify(atual)\n                );\n                mostrarHistoricoCotafacil();\n            } catch (erro) {\n                console.warn('[COTA FACIL] Erro ao excluir pesquisa:', erro);\n            }\n        });\n\n        linha.append(pesquisar, excluir);\n        lista.appendChild(linha);\n    });\n}\n\n\nfunction iniciarCepCotafacil() {\n    const campo = document.getElementById('inputCepCotafacil');\n    if (!campo) return;\n\n    const chave = 'cotafacil_cep_entrega';\n\n    function formatarCep(valor) {\n        const numeros = String(valor || '')\n            .replace(\/\\D\/g, '')\n            .slice(0, 8);\n\n        return numeros.length > 5\n            ? numeros.slice(0, 5) + '-' + numeros.slice(5)\n            : numeros;\n    }\n\n    try {\n        campo.value = formatarCep(localStorage.getItem(chave));\n    } catch (erro) {\n        console.warn('[COTA FACIL] CEP n\u00e3o recuperado:', erro);\n    }\n\n    campo.addEventListener('input', function () {\n        campo.value = formatarCep(campo.value);\n\n        try {\n            const numeros = campo.value.replace(\/\\D\/g, '');\n\n            if (numeros.length === 8) {\n                localStorage.setItem(chave, campo.value);\n            } else {\n                localStorage.removeItem(chave);\n            }\n        } catch (erro) {\n            console.warn('[COTA FACIL] CEP n\u00e3o armazenado:', erro);\n        }\n    });\n}\n\ndocument.addEventListener('DOMContentLoaded', iniciarCepCotafacil);\n\n\n\/\/ Planilha Excel tempor\u00e1ria da pesquisa atual.\nlet urlDownload = null;\n\nlet pesquisaComercialEmAndamento = false;\n\nasync function dispararPesquisaComercial() {\n    if (pesquisaComercialEmAndamento) return;\n    pesquisaComercialEmAndamento = true;\n\n    const inputProduto = document.getElementById('inputBuscaMl');\n    const btnBusca = document.getElementById('btnDispararBusca');\n    const divStatus = document.getElementById('statusCarregamento');\n    const progressoBox = document.getElementById('progressoMlBox');\n    const progressoBarra = document.getElementById('progressoBarra');\n    const progressoTexto = document.getElementById('progressoTexto');\n    const progressoPercentual = document.getElementById('progressoPercentual');\n\n    \/\/ Verifica\u00e7\u00e3o dos elementos\n    if (!inputProduto || !btnBusca || !divStatus) {\n        console.error('[ML] Elementos do painel n\u00e3o encontrados.');\n        pesquisaComercialEmAndamento = false;\n        return;\n    }\n\n    const termoPesquisa = inputProduto.value.trim();\n\n    \/\/ ==========================================================\n    \/\/ CONFIGURA\u00c7\u00c3O\n    \/\/ ==========================================================\n\n        const URL_BASE =\n    'https:\/\/cotafacil.zapto.org\/ml\/pesquisa-completa';\n\n\n      \n    \/\/ Libera a planilha tempor\u00e1ria da pesquisa anterior.\n    if (urlDownload) {\n        window.URL.revokeObjectURL(\n            urlDownload\n        );\n        urlDownload = null;\n    }\n\n    \/\/ ==========================================================\n    \/\/ VALIDA\u00c7\u00c3O\n    \/\/ ==========================================================\n\n    if (!termoPesquisa) {\n\n        divStatus.className =\n            'status-mensagem status-erro';\n\n        divStatus.innerText =\n            '\u26a0\ufe0f Digite o nome do produto.';\n\n        inputProduto.focus();\n\n        pesquisaComercialEmAndamento = false;\n        return;\n    }\n\n    \/\/ ==========================================================\n    \/\/ AUTORIZA\u00c7\u00c3O COTA F\u00c1CIL\n    \/\/ ==========================================================\n\n    btnBusca.disabled = true;\n    inputProduto.disabled = true;\n\n    divStatus.className =\n        'status-mensagem status-processando';\n\n    divStatus.innerText =\n        '\ud83d\udd10 Verificando acesso \u00e0 pesquisa...';\n\n    try {\n\n        const respostaUsuarioCredito =\n            await fetch(\n                '\/wp-admin\/admin-ajax.php?action=cotafacil_usuario',\n                {\n                    method: 'GET',\n                    credentials: 'include'\n                }\n            );\n\n        if (!respostaUsuarioCredito.ok) {\n            throw new Error(\n                'N\u00e3o foi poss\u00edvel verificar sua conta.'\n            );\n        }\n\n        const dadosUsuarioCredito =\n            await respostaUsuarioCredito.json();\n\n        if (!dadosUsuarioCredito.logado) {\n\n            divStatus.className =\n                'status-mensagem status-erro';\n\n            divStatus.innerText =\n                '\u26a0\ufe0f Entre na sua conta para realizar uma pesquisa.';\n\n            btnBusca.disabled = false;\n            inputProduto.disabled = false;\n\n            pesquisaComercialEmAndamento = false;\n            return;\n        }\n\n        const noncePesquisa =\n            dadosUsuarioCredito.nonce_pesquisa;\n\n        if (!noncePesquisa) {\n\n            divStatus.className =\n                'status-mensagem status-erro';\n\n            divStatus.innerText =\n                '\u26a0\ufe0f Sua sess\u00e3o expirou. Atualize a p\u00e1gina e tente novamente.';\n\n            btnBusca.disabled = false;\n            inputProduto.disabled = false;\n\n            pesquisaComercialEmAndamento = false;\n            return;\n        }\n\n        const respostaAutorizacao =\n            await fetch(\n                '\/wp-admin\/admin-ajax.php',\n                {\n                    method: 'POST',\n                    credentials: 'include',\n                    headers: {\n                        'Content-Type':\n                            'application\/x-www-form-urlencoded'\n                    },\n                    body:\n                        new URLSearchParams({\n                            action:\n                                'cotafacil_autorizar_pesquisa',\n                            nonce:\n                                noncePesquisa\n                        }).toString()\n                }\n            );\n\n        let dadosAutorizacao = null;\n\n        try {\n            dadosAutorizacao =\n                await respostaAutorizacao.json();\n        } catch (erroJsonAutorizacao) {\n            dadosAutorizacao = null;\n        }\n\n        if (\n            !respostaAutorizacao.ok ||\n            !dadosAutorizacao ||\n            !dadosAutorizacao.success\n        ) {\n\n            let mensagemAutorizacao =\n                'N\u00e3o foi poss\u00edvel autorizar a pesquisa.';\n\n            if (dadosAutorizacao) {\n                if (dadosAutorizacao.data) {\n                    if (dadosAutorizacao.data.mensagem) {\n                        mensagemAutorizacao =\n                            dadosAutorizacao.data.mensagem;\n                    }\n                }\n            }\n\n            divStatus.className =\n                'status-mensagem status-erro';\n\n            divStatus.innerText =\n                '\u26a0\ufe0f ' + mensagemAutorizacao;\n\n            btnBusca.disabled = false;\n            inputProduto.disabled = false;\n\n            const textoErroCredito =\n                String(\n                    mensagemAutorizacao || ''\n                ).toLowerCase();\n\n            const codigoErroPesquisa =\n                dadosAutorizacao &&\n                dadosAutorizacao.data\n                    ? dadosAutorizacao.data.codigo\n                    : '';\n\n            if (\n                codigoErroPesquisa === 'SEM_PESQUISAS_GRATUITAS' ||\n                textoErroCredito.includes('cr\u00e9dito') ||\n                textoErroCredito.includes('credito') ||\n                textoErroCredito.includes('saldo') ||\n                textoErroCredito.includes('pesquisas gratuitas terminaram')\n            ) {\n                if (\n                    typeof window.abrirModalPixCotafacil\n                    === 'function'\n                ) {\n                    window.abrirModalPixCotafacil();\n                }\n            }\n\n            pesquisaComercialEmAndamento = false;\n            return;\n        }\n\n        const dadosCreditoNovo =\n            dadosAutorizacao.data;\n\n        const btnCreditosAtual =\n            document.getElementById(\n                'btnCreditosCotafacil'\n            );\n\n        if (btnCreditosAtual) {\n\n            if (dadosCreditoNovo.administrador) {\n\n                btnCreditosAtual.textContent =\n                    'Acesso livre';\n\n            } else {\n\n                btnCreditosAtual.textContent =\n                    dadosCreditoNovo.plano_ativo\n                        ? 'Plano ilimitado'\n                        : String(\n                            dadosCreditoNovo.pesquisas_gratis_restantes\n                        ) + ' pesquisas gr\u00e1tis';\n            }\n        }\n\n        if (\n            dadosCreditoNovo &&\n            dadosCreditoNovo.pesquisas_gratis_restantes !== undefined\n        ) {\n            const contadorGratis = document.getElementById(\n                'cotafacilPesquisasRestantes'\n            );\n\n            if (contadorGratis) {\n                contadorGratis.textContent = String(\n                    dadosCreditoNovo.pesquisas_gratis_restantes\n                );\n            }\n        }\n\n        console.log(\n            '[COTA FACIL] Pesquisa autorizada:',\n            dadosCreditoNovo\n        );\n\n    } catch (erroAutorizacao) {\n\n        console.error(\n            '[COTA FACIL] Erro de autoriza\u00e7\u00e3o:',\n            erroAutorizacao\n        );\n\n        divStatus.className =\n            'status-mensagem status-erro';\n\n        divStatus.innerText =\n            '\u26a0\ufe0f N\u00e3o foi poss\u00edvel verificar seus cr\u00e9ditos. Tente novamente.';\n\n        btnBusca.disabled = false;\n        inputProduto.disabled = false;\n\n        pesquisaComercialEmAndamento = false;\n        return;\n    }\n\n    \/\/ ==========================================================\n    salvarHistoricoPesquisaCotafacil(termoPesquisa);\n\n    \/\/ NOVA PESQUISA: LIMPA FILTROS DA PESQUISA ANTERIOR\n    \/\/ ==========================================================\n\n    resetarFiltrosCotafacil();\n\n    \/\/ ==========================================================\n    \/\/ BLOQUEIA INTERFACE\n    \/\/ ==========================================================\n\n    btnBusca.disabled = true;\n    inputProduto.disabled = true;\n\n    divStatus.className =\n        'status-mensagem status-processando';\n\n    divStatus.innerText =\n        '\u23f3 Conectando ao sistema...';\n\n    console.log(\n        '[ML] Iniciando pesquisa:',\n        termoPesquisa\n    );\n\n    let progressoAtual = 0;\n    let timerProgresso = null;\n\n    function atualizarProgresso(valor, texto) {\n\n        progressoAtual = Math.max(\n            progressoAtual,\n            Math.min(valor, 100)\n        );\n\n        progressoBox.style.display = 'block';\n        progressoBarra.style.width = progressoAtual + '%';\n        progressoPercentual.innerText =\n            Math.round(progressoAtual) + '%';\n\n        if (texto) {\n            progressoTexto.innerText = texto;\n        }\n    }\n\n    atualizarProgresso(\n        5,\n        'Conectando ao servidor...'\n    );\n\n    timerProgresso = setInterval(function () {\n\n        if (progressoAtual < 97) {\n\n            let incremento = 0.15;\n\n            if (progressoAtual < 25) {\n                incremento = 2.5;\n            } else if (progressoAtual < 50) {\n                incremento = 1.5;\n            } else if (progressoAtual < 70) {\n                incremento = 0.8;\n            } else if (progressoAtual < 85) {\n                incremento = 0.4;\n            } else if (progressoAtual < 93) {\n                incremento = 0.2;\n            }\n\n            let mensagem =\n                'Finalizando pesquisa...';\n\n            if (progressoAtual < 25) {\n                mensagem =\n                    'Buscando pre\u00e7os no Mercado Livre...';\n            } else if (progressoAtual < 45) {\n                mensagem =\n                    'Buscando pre\u00e7os na Shopee...';\n            } else if (progressoAtual < 65) {\n                mensagem =\n                    'Buscando pre\u00e7os na Magazine Luiza...';\n            } else if (progressoAtual < 70) {\n                mensagem =\n                    'Analisando os produtos encontrados...';\n            } else if (progressoAtual < 85) {\n                mensagem =\n                    'Comparando as melhores ofertas...';\n            } else if (progressoAtual < 93) {\n                mensagem =\n                    'Organizando os resultados...';\n            } else {\n                mensagem =\n                    'Finalizando planilha e resultados...';\n            }\n\n            atualizarProgresso(\n                progressoAtual + incremento,\n                mensagem\n            );\n        }\n\n    }, 800);\n\n    try {\n\n        \/\/ ======================================================\n        \/\/ REQUISI\u00c7\u00c3O\n        \/\/ ======================================================\n\n        divStatus.innerText =\n            '\u23f3 Pesquisando produtos no Mercado Livre...';\n\n        \/\/ ======================================================\n        \/\/ 1. BUSCA JSON PARA MOSTRAR OFERTAS NA PAGINA\n        \/\/ ======================================================\n\n        const URL_JSON =\n            URL_BASE +\n            '?q=' +\n            encodeURIComponent(termoPesquisa);\n\n        divStatus.innerText =\n            '\u23f3 Pesquisando ofertas no Mercado Livre e Shopee...';\n\n        let respostaJson =\n            await fetch(URL_JSON, {\n                method: 'GET',\n                credentials: 'include'\n            });\n\n        let tentativasColetor = 0;\n        const maxTentativasColetor = 40;\n\n        while (\n            respostaJson.status === 202\n        ) {\n\n            tentativasColetor += 1;\n\n            console.log(\n                '[COTA FACIL] Pesquisa em andamento. Tentativa:',\n                tentativasColetor\n            );\n\n            divStatus.innerText =\n                '\u23f3 Pesquisando...';\n\n            atualizarProgresso(\n                Math.min(\n                    85,\n                    20 + tentativasColetor\n                ),\n                'Coletando an\u00fancios do Mercado Livre...'\n            );\n\n            if (\n                tentativasColetor >=\n                maxTentativasColetor\n            ) {\n                throw new Error(\n                    'A pesquisa no Mercado Livre demorou mais que o esperado. Tente novamente.'\n                );\n            }\n\n            await new Promise(function(resolve) {\n                setTimeout(resolve, 3000);\n            });\n\n            respostaJson =\n                await fetch(URL_JSON, {\n                    method: 'GET',\n                    credentials: 'include'\n                });\n        }\n\n        if (!respostaJson.ok) {\n\n            const textoErroJson =\n                await respostaJson.text();\n\n            console.error(\n                '[COTA FACIL] Erro JSON:',\n                textoErroJson\n            );\n\n            throw new Error(\n                'N\u00e3o foi poss\u00edvel carregar as ofertas.'\n            );\n        }\n\n        const dadosPesquisa =\n            await respostaJson.json();\n\n        const anuncios =\n            Array.isArray(\n                dadosPesquisa.anuncios_comparativo\n            )\n                ? dadosPesquisa.anuncios_comparativo\n                : Array.isArray(\n                    dadosPesquisa.comparativo\n                )\n                    ? dadosPesquisa.comparativo\n                    : Array.isArray(\n                        dadosPesquisa.anuncios\n                    )\n                        ? dadosPesquisa.anuncios\n                        : [];\n\n        const anunciosBrutosDiagnostico =\n            Array.isArray(\n                dadosPesquisa.anuncios\n            )\n                ? dadosPesquisa.anuncios\n                : [];\n\n        const comparativoDiagnostico =\n            Array.isArray(\n                dadosPesquisa.anuncios_comparativo\n            )\n                ? dadosPesquisa.anuncios_comparativo\n                : (\n                    Array.isArray(\n                        dadosPesquisa.comparativo\n                    )\n                        ? dadosPesquisa.comparativo\n                        : []\n                );\n\n        function contarFontesCotafacil(lista) {\n\n            const resultado = {\n                total: lista.length,\n                mercadoLivre: 0,\n                shopee: 0,\n                magalu: 0,\n                outras: 0\n            };\n\n            lista.forEach(function(item) {\n\n                const fonteItem =\n                    String(\n                        item.fonte ||\n                        'MERCADO_LIVRE'\n                    ).toUpperCase();\n\n                if (\n                    fonteItem ===\n                    'MERCADO_LIVRE'\n                ) {\n                    resultado.mercadoLivre += 1;\n\n                } else if (\n                    fonteItem ===\n                    'SHOPEE'\n                ) {\n                    resultado.shopee += 1;\n\n                } else if (\n                    fonteItem ===\n                    'MAGALU'\n                ) {\n                    resultado.magalu += 1;\n\n                } else {\n                    resultado.outras += 1;\n                }\n            });\n\n            return resultado;\n        }\n\n        console.log(\n            '[COTA FACIL FONTES BRUTOS]',\n            JSON.stringify(\n                contarFontesCotafacil(\n                    anunciosBrutosDiagnostico\n                )\n            )\n        );\n\n        console.log(\n            '[COTA FACIL FONTES COMPARATIVO]',\n            JSON.stringify(\n                contarFontesCotafacil(\n                    comparativoDiagnostico\n                )\n            )\n        );\n\n        console.log(\n            '[COTA FACIL FONTES EXIBIDOS]',\n            JSON.stringify(\n                contarFontesCotafacil(\n                    anuncios\n                )\n            )\n        );\n\n        preencherFiltroMarcasCotafacil(\n            anuncios\n        );\n\n        preencherPalavrasTituloCotafacil(\n            anuncios\n        );\n\n        preencherPalavrasExcluiTituloCotafacil();\n\n        configurarFiltrosLeitorCotafacil(\n            anuncios\n        );\n\n        const areaResultados =\n            document.getElementById(\n                'areaResultadosCotacao'\n            );\n\n        const listaResultados =\n            document.getElementById(\n                'listaResultadosCotacao'\n            );\n\n        const controlesOrdenacao =\n            document.getElementById(\n                'controlesOrdenacao'\n            );\n\n        if (\n            areaResultados ? listaResultados : false\n        ) {\n\n            listaResultados.innerHTML = '';\n\n            if (!anuncios.length) {\n\n                if (controlesOrdenacao) {\n                    controlesOrdenacao.style.display =\n                        'none';\n                }\n\n                const aviso =\n                    document.createElement('div');\n\n                aviso.style.padding = '15px';\n                aviso.style.border =\n                    '1px solid #dddddd';\n                aviso.style.borderRadius =\n                    '8px';\n\n                aviso.innerText =\n                    'Nenhuma oferta dispon\u00edvel para sele\u00e7\u00e3o.';\n\n                listaResultados.appendChild(\n                    aviso\n                );\n\n            } else {\n\n                if (controlesOrdenacao) {\n                    controlesOrdenacao.style.display =\n                        'flex';\n                }\n\n                const temShopeeCotafacil =\n                    anuncios.some(function(item) {\n                        return String(\n                            item.fonte || ''\n                        ).toUpperCase() === 'SHOPEE';\n                    });\n\n                if (temShopeeCotafacil) {\n                    const avisoShopeeCotafacil =\n                        document.createElement('div');\n\n                    avisoShopeeCotafacil.style.padding =\n                        '10px 12px';\n\n                    avisoShopeeCotafacil.style.marginBottom =\n                        '12px';\n\n                    avisoShopeeCotafacil.style.border =\n                        '1px solid #e5e5e5';\n\n                    avisoShopeeCotafacil.style.borderRadius =\n                        '8px';\n\n                    avisoShopeeCotafacil.style.fontSize =\n                        '13px';\n\n                    avisoShopeeCotafacil.innerText =\n                        'Shopee: Frete e descontos Pix\/cupom podem variar. Confira o valor final na Shopee.';\n\n                    listaResultados.appendChild(\n                        avisoShopeeCotafacil\n                    );\n                }\n\n                anuncios.forEach(function (\n                    item\n                ) {\n\n                    const fonte =\n                        item.fonte ||\n                        'MERCADO_LIVRE';\n\n                    const titulo =\n                        item.produto ||\n                        item.title ||\n                        'Produto';\n\n                    const preco =\n                        Number(\n                            item.preco || 0\n                        );\n\n                    const unidade =\n                        item.unidade_comparacao ||\n                        'PECA';\n\n                    const comparavel =\n                        item.preco_comparavel;\n\n                    const participaRanking =\n                        item.participa_ranking !==\n                        false;\n\n                    const card =\n                        document.createElement(\n                            'div'\n                        );\n\n                    card.style.border =\n                        participaRanking\n                            ? '1px solid #dfe6e9'\n                            : '1px solid #f0c36d';\n\n                    card.style.borderRadius =\n                        '12px';\n\n                    card.style.padding =\n                        '16px';\n\n                    card.style.marginBottom =\n                        '12px';\n\n                    card.style.background =\n                        '#10141a';\n\n                    card.style.boxShadow =\n                        '0 4px 18px rgba(0,0,0,0.28)';\n\n                    card.className =\n                        'cotafacil-resultado-card';\n\n                    card.dataset.precoTotal =\n                        Number.isFinite(preco)\n                            ? String(preco)\n                            : '';\n\n                    card.dataset.precoComparavel =\n                        (\n                            comparavel !== null\n                                ? (\n                                    comparavel !== undefined\n                                        ? Number.isFinite(\n                                            Number(comparavel)\n                                        )\n                                        : false\n                                )\n                                : false\n                        )\n                            ? String(Number(comparavel))\n                            : '';\n\n                    card.dataset.fonteFiltro =\n                        String(\n                            fonte ||\n                            'MERCADO_LIVRE'\n                        ).toUpperCase();\n\n                    card.dataset.unidadeFiltro =\n                        String(\n                            unidade ||\n                            'PECA'\n                        ).toUpperCase();\n\n                    card.dataset.statusFiltro =\n                        participaRanking\n                            ? 'RANKING'\n                            : String(\n                                item.compatibilidade ||\n                                'FORA_RANKING'\n                            ).toUpperCase();\n\n                    card.dataset.nomeOrdenacao =\n                        titulo.toLocaleLowerCase(\n                            'pt-BR'\n                        );\n\n                    card.dataset.marcaFiltro =\n                        String(\n                            item.marca ||\n                            item.marca_identificada ||\n                            'A_CONFIRMAR'\n                        ).toUpperCase();\n\n                    const topo =\n                        document.createElement(\n                            'div'\n                        );\n\n                    topo.style.display =\n                        'flex';\n\n                    topo.style.gap =\n                        '12px';\n\n                    topo.style.alignItems =\n                        'flex-start';\n\n                    const checkbox =\n                        document.createElement(\n                            'input'\n                        );\n\n                    checkbox.type =\n                        'checkbox';\n\n                    checkbox.className =\n                        'cotafacil-item-checkbox';\n\n                    checkbox.style.marginTop =\n                        '5px';\n\n                    checkbox.style.transform =\n                        'scale(0.95)';\n\n                    checkbox.dataset.itemId =\n                        item.item_id ||\n                        item.product_id ||\n                        '';\n\n                    checkbox.dataset.produto =\n                        titulo;\n\n                    checkbox.dataset.fonte =\n                        fonte;\n\n                    checkbox.dataset.preco =\n                        String(preco);\n\n                    const linkCompraCotafacil =\n                        [\n                            fonte === 'SHOPEE',\n                            item.link_origem\n                        ].every(Boolean)\n                            ? '\/ml\/shopee-shortlink?url=' +\n                              encodeURIComponent(\n                                  item.link_origem\n                              ) +\n                              '&fallback=' +\n                              encodeURIComponent(\n                                  item.link || ''\n                              )\n                            : (\n                                item.link || ''\n                            );\n\n                    checkbox.dataset.link =\n                        linkCompraCotafacil;\n\n                    checkbox.dataset.imagem =\n                        String(\n                            item.imagem || ''\n                        ).trim();\n\n                    const imagemBox =\n                        document.createElement(\n                            'div'\n                        );\n\n                    imagemBox.className =\n                        'cotafacil-imagem-box';\n\n                    const imagemUrl =\n                        String(\n                            item.imagem || ''\n                        ).trim();\n\n                    if (imagemUrl) {\n\n                        const imagemProduto =\n                            document.createElement(\n                                'img'\n                            );\n\n                        imagemProduto.className =\n                            'cotafacil-imagem-produto';\n\n                        imagemProduto.src =\n                            imagemUrl;\n\n                        imagemProduto.alt =\n                            titulo;\n\n                        imagemProduto.loading =\n                            'lazy';\n\n                        imagemProduto.decoding =\n                            'async';\n\n                        imagemProduto.referrerPolicy =\n                            'no-referrer';\n\n                        imagemProduto.addEventListener(\n                            'error',\n                            function () {\n                                imagemProduto.style.display =\n                                    'none';\n\n                                imagemBox.classList.add(\n                                    'cotafacil-sem-imagem'\n                                );\n\n                                imagemBox.innerText =\n                                    'Sem foto';\n                            }\n                        );\n\n                        imagemBox.appendChild(\n                            imagemProduto\n                        );\n\n                    } else {\n\n                        imagemBox.classList.add(\n                            'cotafacil-sem-imagem'\n                        );\n\n                        imagemBox.innerText =\n                            'Sem foto';\n                    }\n\n                    const info =\n                        document.createElement(\n                            'div'\n                        );\n\n                    info.style.flex =\n                        '1';\n\n                    info.style.minWidth =\n                        '0';\n\n                    const lateral =\n                        document.createElement(\n                            'div'\n                        );\n\n                    lateral.className =\n                        'cotafacil-card-lateral';\n\n                    const marketplace =\n                        document.createElement(\n                            'div'\n                        );\n\n                    marketplace.style.display =\n                        'inline-block';\n\n                    marketplace.style.padding =\n                        '4px 8px';\n\n                    marketplace.style.borderRadius =\n                        '999px';\n\n                    marketplace.style.fontSize =\n                        '12px';\n\n                    marketplace.style.fontWeight =\n                        '700';\n\n                    marketplace.style.marginBottom =\n                        '8px';\n\n                    marketplace.style.background =\n                        fonte === 'SHOPEE'\n                            ? '#fff0eb'\n                            : (fonte === 'MAGALU' ? '#ffd6e7' : '#fff8d6');\n\n                    marketplace.className =\n                        fonte === 'SHOPEE'\n                            ? 'cotafacil-marketplace cotafacil-marketplace-shopee'\n                            : (fonte === 'MAGALU' ? 'cotafacil-marketplace cotafacil-marketplace-magalu' : 'cotafacil-marketplace cotafacil-marketplace-ml');\n\n                    marketplace.innerText =\n                        fonte === 'SHOPEE'\n                            ? 'SHOPEE'\n                            : (\n                                fonte === 'MAGALU'\n                                    ? 'MAGALU'\n                                    : 'MERCADO LIVRE'\n                            );\n\n                    const nome =\n                        document.createElement(\n                            'div'\n                        );\n\n                    nome.style.fontWeight =\n                        '700';\n\n                    nome.style.fontSize =\n                        '18px';\n\n                    nome.style.color =\n                        '#f5f7fa';\n\n                    nome.style.lineHeight =\n                        '1.35';\n\n                    nome.innerText =\n                        titulo;\n\n                    const precoPrincipal =\n                        document.createElement(\n                            'div'\n                        );\n\n                    precoPrincipal.style.marginTop =\n                        '10px';\n\n                    precoPrincipal.style.fontSize =\n                        '25px';\n\n                    precoPrincipal.style.color =\n                        '#ffffff';\n\n                    precoPrincipal.style.fontWeight =\n                        '700';\n\n                    precoPrincipal.innerText =\n                        preco.toLocaleString(\n                            'pt-BR',\n                            {\n                                style:\n                                    'currency',\n                                currency:\n                                    'BRL'\n                            }\n                        );\n\n                    info.appendChild(\n                        marketplace\n                    );\n\n                    info.appendChild(\n                        nome\n                    );\n\n                    info.appendChild(\n                        precoPrincipal\n                    );\n\n                    if (\n                        [\n                            comparavel !== null,\n                            comparavel !== undefined,\n                            Number.isFinite(Number(comparavel))\n                        ].every(Boolean)\n                    ) {\n\n                        const linhaComparavel =\n                            document.createElement(\n                                'div'\n                            );\n\n                        linhaComparavel.className =\n                            'cotafacil-preco-comparavel';\n\n                        linhaComparavel.style.marginTop =\n                            '5px';\n\n                        linhaComparavel.style.fontSize =\n                            '13px';\n\n                        linhaComparavel.style.color =\n                            '#b9c0ca';\n\n                        const valorComparavelExibicao =\n                            Number(\n                                comparavel\n                            );\n\n                        const casasComparavel =\n                            valorComparavelExibicao < 0.10\n                                ? 3\n                                : 2;\n\n                        linhaComparavel.innerText =\n                            'Pre\u00e7o compar\u00e1vel: ' +\n                            valorComparavelExibicao.toLocaleString(\n                                'pt-BR',\n                                {\n                                    style:\n                                        'currency',\n                                    currency:\n                                        'BRL',\n                                    minimumFractionDigits:\n                                        casasComparavel,\n                                    maximumFractionDigits:\n                                        casasComparavel\n                                }\n                            ) +\n                            ' \/ ' +\n                            unidade;\n\n                        info.appendChild(\n                            linhaComparavel\n                        );\n                    }\n\n                    const marcaBruta =\n                        String(\n                            item.marca ||\n                            item.marca_identificada ||\n                            ''\n                        );\n\n                    const marcaExibicao =\n                        marcaBruta\n                            ? marcaBruta\n                                .replace(\n                                    \/_\/g,\n                                    ' '\n                                )\n                                .toLowerCase()\n                                .replace(\n                                    \/\\b\\w\/g,\n                                    function(letra) {\n                                        return letra.toUpperCase();\n                                    }\n                                )\n                            : 'A confirmar';\n\n                    const marca =\n                        document.createElement(\n                            'div'\n                        );\n\n                    marca.style.marginTop =\n                        '5px';\n\n                    marca.style.fontSize =\n                        '13px';\n\n                    marca.style.color =\n                        '#b9c0ca';\n\n                    marca.innerText =\n                        'Marca: ' +\n                        marcaExibicao;\n\n                    info.appendChild(\n                        marca\n                    );\n\n                    const conectividadeBruta =\n                        String(\n                            item.conectividade_leitor ||\n                            'A_CONFIRMAR'\n                        ).toUpperCase();\n\n                    const leituraBruta =\n                        String(\n                            item.tipo_leitura_leitor ||\n                            'A_CONFIRMAR'\n                        ).toUpperCase();\n\n                    card.dataset.conectividadeFiltro =\n                        conectividadeBruta;\n\n                    card.dataset.leituraFiltro =\n                        leituraBruta;\n\n                    const textoLeitorCard =\n                        String(\n                            item.produto ||\n                            item.titulo ||\n                            item.title ||\n                            ''\n                        );\n\n                    const ehLeitorCard =\n                        [\n                            \/\\b(leitor|scanner|codigo\\s+de\\s+barras|codigo\\s+barras|qr\\s*code|qrcode|1d|2d)\\b\/i\n                                .test(textoLeitorCard),\n\n                            conectividadeBruta !==\n                                'A_CONFIRMAR',\n\n                            leituraBruta !==\n                                'A_CONFIRMAR'\n                        ].some(Boolean);\n\n                    if (ehLeitorCard) {\n\n                        let conectividadeExibicao =\n                            'A confirmar';\n\n                        if (conectividadeBruta === 'COM_FIO') {\n                            conectividadeExibicao = 'Com fio';\n                        } else if (conectividadeBruta === 'SEM_FIO') {\n                            conectividadeExibicao = 'Sem fio';\n                        }\n\n                        const conectividade =\n                            document.createElement(\n                                'div'\n                            );\n\n                        conectividade.style.marginTop =\n                            '5px';\n\n                        conectividade.style.fontSize =\n                            '13px';\n\n                        conectividade.style.color =\n                            '#b9c0ca';\n\n                        conectividade.innerText =\n                            'Conectividade: ' +\n                            conectividadeExibicao;\n\n                        info.appendChild(\n                            conectividade\n                        );\n\n                        let leituraExibicao =\n                            'A confirmar';\n\n                        if (leituraBruta === '1D') {\n                            leituraExibicao = '1D';\n                        } else if (leituraBruta === '2D') {\n                            leituraExibicao = '2D';\n                        } else if (leituraBruta === '1D_2D') {\n                            leituraExibicao = '1D + 2D';\n                        }\n\n                        const leitura =\n                            document.createElement(\n                                'div'\n                            );\n\n                        leitura.style.marginTop =\n                            '5px';\n\n                        leitura.style.fontSize =\n                            '13px';\n\n                        leitura.style.color =\n                            '#b9c0ca';\n\n                        leitura.innerText =\n                            'Leitura: ' +\n                            leituraExibicao;\n\n                        info.appendChild(\n                            leitura\n                        );\n                    }\n\n                    if (item.vendedor) {\n\n                        const vendedor =\n                            document.createElement(\n                                'div'\n                            );\n\n                        vendedor.style.marginTop =\n                            '5px';\n\n                        vendedor.style.fontSize =\n                            '13px';\n\n                        vendedor.style.color =\n                            '#b9c0ca';\n\n                        vendedor.innerText =\n                            'Vendedor: ' +\n                            item.vendedor;\n\n                        lateral.appendChild(\n                            vendedor\n                        );\n                    }\n\n                    if (item.frete_gratis === true) {\n                        const freteGratis =\n                            document.createElement('div');\n\n                        freteGratis.style.marginTop = '5px';\n                        freteGratis.style.fontSize = '13px';\n                        freteGratis.style.fontWeight = '600';\n                        freteGratis.style.color = '#16803c';\n\n                        freteGratis.innerText = 'Frete gr\u00e1tis';\n\n                        lateral.appendChild(freteGratis);\n                    }\n                    if (participaRanking) {\n\n                        const ranking =\n                            document.createElement(\n                                'div'\n                            );\n\n                        ranking.style.marginTop =\n                            '7px';\n\n                        ranking.style.fontSize =\n                            '13px';\n\n                        ranking.style.fontWeight =\n                            '600';\n\n                        ranking.className =\n                            'cotafacil-status-ranking';\n\n                        ranking.innerText =\n                            '\u2713 Participa do ranking autom\u00e1tico';\n\n                        lateral.appendChild(\n                            ranking\n                        );\n\n                    } else {\n\n                        const alerta =\n                            document.createElement(\n                                'div'\n                            );\n\n                        alerta.style.marginTop =\n                            '7px';\n\n                        alerta.style.fontSize =\n                            '13px';\n\n                        alerta.style.fontWeight =\n                            '600';\n\n                        const compatibilidade =\n                            String(\n                                item.compatibilidade ||\n                                ''\n                            );\n\n                        const motivo =\n                            String(\n                                item.motivo_compatibilidade ||\n                                ''\n                            );\n\n                        let tituloStatus =\n                            '\u26a0 N\u00e3o participa do ranking';\n\n                        if (\n                            compatibilidade ===\n                            'VARIACAO_A_CONFIRMAR'\n                        ) {\n                            tituloStatus =\n                                '\u26a0 Varia\u00e7\u00e3o a confirmar';\n\n                        } else if (\n                            compatibilidade ===\n                            'QUANTIDADE_A_CONFIRMAR'\n                        ) {\n                            tituloStatus =\n                                '\u26a0 Quantidade a confirmar';\n\n                        } else if (\n                            compatibilidade ===\n                            'PRODUTO_DIFERENTE'\n                        ) {\n                            tituloStatus =\n                                '\u26a0 Produto diferente';\n                        }\n\n                        alerta.className =\n                            compatibilidade === 'PRODUTO_DIFERENTE'\n                                ? 'cotafacil-status-erro'\n                                : 'cotafacil-status-alerta';\n\n                        alerta.innerText =\n                            motivo\n                                ? tituloStatus +\n                                  ' \u2014 ' +\n                                  motivo\n                                : tituloStatus;\n\n                        lateral.appendChild(\n                            alerta\n                        );\n                    }\n\n                    topo.appendChild(\n                        checkbox\n                    );\n\n                    topo.appendChild(\n                        imagemBox\n                    );\n\n                    topo.appendChild(\n                        info\n                    );\n\n                    topo.appendChild(\n                        lateral\n                    );\n\n                    card.appendChild(\n                        topo\n                    );\n\n                    if (item.link) {\n\n                        const linkCompra =\n                            document.createElement(\n                                'a'\n                            );\n\n                        linkCompra.href =\n                            linkCompraCotafacil;\n\n                        linkCompra.target =\n                            '_blank';\n\n                        linkCompra.rel =\n                            'noopener noreferrer';\n\n                        linkCompra.className =\n                            'cotafacil-link-oferta';\n\n                        linkCompra.innerText = fonte === 'SHOPEE' ? 'Ver oferta na Shopee' : (fonte === 'MAGALU' ? 'Ver oferta no Magalu' : 'Ver oferta no Mercado Livre');\n\n                        linkCompra.style.display =\n                            'inline-block';\n\n                        linkCompra.style.marginTop =\n                            '12px';\n\n                        linkCompra.style.padding =\n                            '8px 12px';\n\n                        linkCompra.style.borderRadius =\n                            '6px';\n\n                        linkCompra.style.textDecoration =\n                            'none';\n\n                        linkCompra.style.fontWeight =\n                            '600';\n\n                        linkCompra.style.border =\n                            '1px solid #cccccc';\n\n                        lateral.appendChild(\n                            linkCompra\n                        );\n                    }\n\n                    listaResultados.appendChild(\n                        card\n                    );\n                });\n\n                ordenarResultadosCotafacil();\n                preencherAutocompleteTituloComecaCotafacil();\n                atualizarContagensSelectsCotafacil();\n            }\n\n            areaResultados.style.display =\n                'block';\n\n            areaResultados.scrollIntoView({\n                behavior: 'smooth',\n                block: 'start'\n            });\n\n            atualizarContadorOrcamento();\n            atualizarBotaoAdicionarOrcamento();\n        }\n\n        atualizarProgresso(\n            90,\n            'Ofertas exibidas. Gerando planilha Excel...'\n        );\n\n        \/\/ ======================================================\n        \/\/ 2. GERA O EXCEL COMO JA FUNCIONAVA\n        \/\/ ======================================================\n\n        const URL_API =\n            URL_BASE +\n            '?q=' +\n            encodeURIComponent(termoPesquisa) +\n            String.fromCharCode(38) + 'excel=1';\n\n        const resposta =\n            await fetch(URL_API, {\n                method: 'GET',\n                credentials: 'include'\n            });\n\n        atualizarProgresso(\n            98,\n            'Pesquisa conclu\u00edda. Recebendo planilha...'\n        );\n\n        console.log(\n            '[ML] Status HTTP:',\n            resposta.status\n        );\n\n        console.log(\n            '[ML] Content-Type:',\n            resposta.headers.get('content-type')\n        );\n\n        \/\/ ======================================================\n        \/\/ ERRO DO SERVIDOR\n        \/\/ ======================================================\n\n        if (!resposta.ok) {\n\n            const textoErro =\n                await resposta.text();\n\n            console.error(\n                '[ML] Resposta de erro:',\n                textoErro\n            );\n\n            let mensagemAmigavel =\n                `Erro ${resposta.status} no servidor.`;\n\n            try {\n\n                const jsonErro =\n                    JSON.parse(textoErro);\n\n                if (jsonErro.erro) {\n                    mensagemAmigavel =\n                        jsonErro.erro;\n                }\n\n            } catch (_) {\n                \/\/ Resposta n\u00e3o era JSON.\n            }\n\n            throw new Error(\n                mensagemAmigavel\n            );\n        }\n\n        \/\/ ======================================================\n        \/\/ VERIFICA CONTENT-TYPE\n        \/\/ ======================================================\n\n        const contentType =\n            resposta.headers.get('content-type') || '';\n\n        if (\n            !contentType.includes(\n                'application\/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n            )\n        ) {\n\n            console.warn(\n                '[ML] Content-Type inesperado:',\n                contentType\n            );\n        }\n\n        \/\/ ======================================================\n        \/\/ RECEBE EXCEL\n        \/\/ ======================================================\n\n        divStatus.innerText =\n            '\u23f3 Recebendo planilha...';\n\n        const blobPlanilha =\n            await resposta.blob();\n\n        console.log(\n            '[ML] Tamanho do arquivo:',\n            blobPlanilha.size,\n            'bytes'\n        );\n\n        if (\n            !blobPlanilha ||\n            blobPlanilha.size === 0\n        ) {\n\n            throw new Error(\n                'O servidor retornou um arquivo vazio.'\n            );\n        }\n\n        \/\/ ======================================================\n        \/\/ CRIA URL TEMPOR\u00c1RIA\n        \/\/ ======================================================\n\n        urlDownload =\n            window.URL.createObjectURL(\n                blobPlanilha\n            );\n\n        \/\/ ======================================================\n        \/\/ NOME DO ARQUIVO\n        \/\/ ======================================================\n\n        const nomeArquivo =\n            termoPesquisa\n                .toLowerCase()\n                .normalize('NFD')\n                .replace(\/[\\u0300-\\u036f]\/g, '')\n                .replace(\/[^a-z0-9]+\/g, '_')\n                .replace(\/^_+|_+$\/g, '')\n                .substring(0, 80)\n                + '_analise.xlsx';\n\n        \/\/ ======================================================\n        \/\/ PLANILHA PRONTA - NAO BAIXA AUTOMATICAMENTE\n        \/\/ ======================================================\n\n        divStatus.className =\n            'status-mensagem status-sucesso';\n\n        atualizarProgresso(\n            100,\n            'Conclu\u00eddo'\n        );\n\n        divStatus.innerText =\n            '\u2705 Pesquisa conclu\u00edda! Planilha Excel pronta.';\n\n        const areaAcoesExcel =\n            document.createElement('div');\n\n        areaAcoesExcel.style.display =\n            'flex';\n\n        areaAcoesExcel.style.flexWrap =\n            'wrap';\n\n        areaAcoesExcel.style.gap =\n            '10px';\n\n        areaAcoesExcel.style.marginTop =\n            '12px';\n\n        const btnAbrirExcel =\n            document.createElement('button');\n\n        btnAbrirExcel.type =\n            'button';\n\n        btnAbrirExcel.innerText =\n            '\ud83d\udcca Abrir Excel';\n\n        btnAbrirExcel.style.padding =\n            '10px 16px';\n\n        btnAbrirExcel.style.borderRadius =\n            '7px';\n\n        btnAbrirExcel.style.border =\n            '1px solid #555';\n\n        btnAbrirExcel.style.fontWeight =\n            '700';\n\n        btnAbrirExcel.style.cursor =\n            'pointer';\n\n        btnAbrirExcel.onclick =\n            async function() {\n\n                if (\n                    window.AndroidExcel\n                        ? typeof window.AndroidExcel.receberExcelBase64 === 'function'\n                        : false\n                ) {\n\n                    try {\n\n                        const respostaExcel =\n                            await fetch(\n                                urlDownload\n                            );\n\n                        const blobExcel =\n                            await respostaExcel.blob();\n\n                        const leitor =\n                            new FileReader();\n\n                        leitor.onloadend =\n                            function() {\n\n                                const resultado =\n                                    String(\n                                        leitor.result || ''\n                                    );\n\n                                const base64 =\n                                    resultado.includes(',')\n                                        ? resultado.split(',')[1]\n                                        : resultado;\n\n                                window.AndroidExcel\n                                    .receberExcelBase64(\n                                        base64,\n                                        nomeArquivo\n                                    );\n                            };\n\n                        leitor.readAsDataURL(\n                            blobExcel\n                        );\n\n                    } catch (erroAbrirAndroid) {\n\n                        console.error(\n                            '[COTA FACIL] Erro ao enviar Excel ao Android:',\n                            erroAbrirAndroid\n                        );\n                    }\n\n                    return;\n                }\n\n                const novaJanela =\n                    window.open(\n                        urlDownload,\n                        '_blank'\n                    );\n\n                if (!novaJanela) {\n                    window.location.href =\n                        urlDownload;\n                }\n            };\n\n        const btnSalvarExcel =\n            document.createElement('button');\n\n        btnSalvarExcel.type =\n            'button';\n\n        btnSalvarExcel.innerText =\n            '\ud83d\udcbe Salvar Excel';\n\n        btnSalvarExcel.style.padding =\n            '10px 16px';\n\n        btnSalvarExcel.style.borderRadius =\n            '7px';\n\n        btnSalvarExcel.style.border =\n            'none';\n\n        btnSalvarExcel.style.fontWeight =\n            '700';\n\n        btnSalvarExcel.style.cursor =\n            'pointer';\n\n        btnSalvarExcel.onclick =\n            function() {\n\n                const linkSalvar =\n                    document.createElement('a');\n\n                linkSalvar.href =\n                    urlDownload;\n\n                linkSalvar.download =\n                    nomeArquivo;\n\n                linkSalvar.style.display =\n                    'none';\n\n                document.body.appendChild(\n                    linkSalvar\n                );\n\n                linkSalvar.click();\n                linkSalvar.remove();\n            };\n\n        const btnGerarPdf =\n            document.createElement('button');\n\n        btnGerarPdf.type =\n            'button';\n\n        btnGerarPdf.innerText =\n            '\ud83d\udcc4 Gerar PDF';\n\n        btnGerarPdf.style.padding =\n            '10px 16px';\n\n        btnGerarPdf.style.borderRadius =\n            '7px';\n\n        btnGerarPdf.style.border =\n            '1px solid #c60000';\n\n        btnGerarPdf.style.fontWeight =\n            '700';\n\n        btnGerarPdf.style.cursor =\n            'pointer';\n\n        btnGerarPdf.onclick =\n            async function() {\n\n                const listaResultadosPdf =\n                    document.getElementById(\n                        'listaResultadosCotacao'\n                    );\n\n                if (!listaResultadosPdf) {\n\n                    alert(\n                        'Nenhum resultado dispon\u00edvel para gerar o PDF.'\n                    );\n\n                    return;\n                }\n\n                const cardsPdf =\n                    Array.from(\n                        listaResultadosPdf.querySelectorAll(\n                            '.cotafacil-resultado-card'\n                        )\n                    );\n\n                const cardsVisiveisPdf =\n                    cardsPdf.filter(\n                        function(card) {\n\n                            return (\n                                window\n                                    .getComputedStyle(card)\n                                    .display !== 'none'\n                            );\n                        }\n                    );\n\n                if (!cardsVisiveisPdf.length) {\n\n                    alert(\n                        'Nenhum produto est\u00e1 vis\u00edvel com os filtros atuais.'\n                    );\n\n                    return;\n                }\n\n                const itensPdf =\n                    cardsVisiveisPdf\n                        .map(\n                            function(card) {\n\n                                const checkbox =\n                                    card.querySelector(\n                                        '.cotafacil-item-checkbox'\n                                    );\n\n                                return {\n                                    produto:\n                                        checkbox\n                                            ? (\n                                                checkbox.dataset.produto ||\n                                                ''\n                                            )\n                                            : '',\n                                    fonte:\n                                        checkbox\n                                            ? (\n                                                checkbox.dataset.fonte ||\n                                                card.dataset.fonteFiltro ||\n                                                ''\n                                            )\n                                            : (\n                                                card.dataset.fonteFiltro ||\n                                                ''\n                                            ),\n                                    marca:\n                                        card.dataset.marcaFiltro ||\n                                        'A_CONFIRMAR',\n                                    preco:\n                                        checkbox\n                                            ? (\n                                                checkbox.dataset.preco ||\n                                                card.dataset.precoTotal ||\n                                                ''\n                                            )\n                                            : (\n                                                card.dataset.precoTotal ||\n                                                ''\n                                            ),\n                                    preco_comparavel:\n                                        card.dataset.precoComparavel ||\n                                        '',\n                                    link:\n                                        checkbox\n                                            ? (\n                                                checkbox.dataset.link ||\n                                                ''\n                                            )\n                                            : ''\n                                };\n                            }\n                        );\n\n                const inputBuscaPdf =\n                    document.getElementById(\n                        'inputBuscaMl'\n                    );\n\n                const buscaPdf =\n                    inputBuscaPdf\n                        ? inputBuscaPdf.value\n                        : '';\n\n                const textoOriginalPdf =\n                    btnGerarPdf.innerText;\n\n                btnGerarPdf.disabled =\n                    true;\n\n                btnGerarPdf.innerText =\n                    '\u23f3 Gerando PDF...';\n\n                try {\n\n                    const respostaPdf =\n                        await fetch(\n                            '\/ml\/pdf-cotacao',\n                            {\n                                method:\n                                    'POST',\n                                headers: {\n                                    'Content-Type':\n                                        'application\/json'\n                                },\n                                body:\n                                    JSON.stringify({\n                                        busca:\n                                            buscaPdf,\n                                        itens:\n                                            itensPdf\n                                    })\n                            }\n                        );\n\n                    if (!respostaPdf.ok) {\n\n                        throw new Error(\n                            'HTTP ' +\n                            respostaPdf.status\n                        );\n                    }\n\n                    const dadosPdf =\n                        await respostaPdf.json();\n\n                    if (\n                        !dadosPdf ||\n                        !dadosPdf.url\n                    ) {\n                        throw new Error(\n                            'Servidor n\u00e3o retornou a URL do PDF.'\n                        );\n                    }\n\n                    const urlPdf =\n                        new URL(\n                            dadosPdf.url,\n                            window.location.origin\n                        ).href;\n\n                    const novaJanelaPdf =\n                        window.open(\n                            urlPdf,\n                            '_blank'\n                        );\n\n                    if (!novaJanelaPdf) {\n                        window.location.href =\n                            urlPdf;\n                    }\n\n                } catch (erroPdf) {\n\n                    console.error(\n                        '[COTA FACIL] Erro ao gerar PDF:',\n                        erroPdf\n                    );\n\n                    alert(\n                        'N\u00e3o foi poss\u00edvel gerar o PDF.'\n                    );\n\n                } finally {\n\n                    btnGerarPdf.disabled =\n                        false;\n\n                    btnGerarPdf.innerText =\n                        textoOriginalPdf;\n                }\n            };\n\n        areaAcoesExcel.appendChild(\n            btnAbrirExcel\n        );\n\n        areaAcoesExcel.appendChild(\n            btnSalvarExcel\n        );\n\n        areaAcoesExcel.appendChild(\n            btnGerarPdf\n        );\n\n        divStatus.appendChild(\n            areaAcoesExcel\n        );\n\n        console.log(\n            '[COTA FACIL] Excel tempor\u00e1rio pronto:',\n            nomeArquivo\n        );\n\n    } catch (erro) {\n\n        console.error(\n            '[ML] \u274c Erro:',\n            erro\n        );\n\n        divStatus.className =\n            'status-mensagem status-erro';\n\n        \/*\n         * Erros de CORS normalmente chegam ao JavaScript\n         * apenas como erro de rede. Nesse caso mostramos\n         * uma mensagem mais \u00fatil.\n         *\/\n        if (\n            [\n                erro instanceof TypeError,\n                erro.message.toLowerCase().includes('fetch')\n            ].every(Boolean)\n        ) {\n\n            divStatus.innerText =\n    '\u274c N\u00e3o foi poss\u00edvel concluir a pesquisa. Tente novamente em alguns instantes.'       ;\n        } else {\n\n            divStatus.innerText =\n                `\u274c Falha: ${erro.message}`;\n        }\n\n    } finally {\n\n        if (timerProgresso) {\n            clearInterval(timerProgresso);\n        }\n\n        \/\/ ======================================================\n        \/\/ LIBERA INTERFACE\n        \/\/ ======================================================\n\n        btnBusca.disabled = false;\n        inputProduto.disabled = false;\n        pesquisaComercialEmAndamento = false;\n\n        \/\/ Mant\u00e9m a planilha tempor\u00e1ria dispon\u00edvel\n        \/\/ enquanto o cliente permanecer nesta p\u00e1gina.\n        \/\/ A URL ser\u00e1 liberada em uma pr\u00f3xima pesquisa\n        \/\/ ou quando a p\u00e1gina for recarregada.\n    }\n}\n\n\n\/\/ ============================================================\n\/\/ ORDENA\u00c7\u00c3O DOS RESULTADOS COTA F\u00c1CIL\n\/\/ ============================================================\n\nfunction ordenarResultadosCotafacil() {\n\n    const lista =\n        document.getElementById(\n            'listaResultadosCotacao'\n        );\n\n    const seletor =\n        document.getElementById(\n            'ordenacaoCotafacil'\n        );\n\n    if (!lista || !seletor) {\n        return;\n    }\n\n    const cards =\n        Array.from(\n            lista.querySelectorAll(\n                '.cotafacil-resultado-card'\n            )\n        );\n\n    if (!cards.length) {\n        return;\n    }\n\n    const modo =\n        seletor.value ||\n        'comparavel_asc';\n\n    function numeroCard(card, campo) {\n\n        const bruto =\n            card.dataset[campo];\n\n        if (\n            bruto === undefined ||\n            bruto === null ||\n            bruto === ''\n        ) {\n            return null;\n        }\n\n        const valor =\n            Number(bruto);\n\n        return Number.isFinite(valor)\n            ? valor\n            : null;\n    }\n\n    cards.sort(function (a, b) {\n\n        if (\n            modo === 'nome_asc' ||\n            modo === 'nome_desc'\n        ) {\n\n            const nomeA =\n                a.dataset.nomeOrdenacao || '';\n\n            const nomeB =\n                b.dataset.nomeOrdenacao || '';\n\n            const comparacao =\n                nomeA.localeCompare(\n                    nomeB,\n                    'pt-BR'\n                );\n\n            return modo === 'nome_desc'\n                ? -comparacao\n                : comparacao;\n        }\n\n        const campo =\n            modo.startsWith('preco_')\n                ? 'precoTotal'\n                : 'precoComparavel';\n\n        const valorA =\n            numeroCard(a, campo);\n\n        const valorB =\n            numeroCard(b, campo);\n\n        if (\n            [\n                valorA === null,\n                valorB === null\n            ].every(Boolean)\n        ) {\n            return 0;\n        }\n\n        if (valorA === null) {\n            return 1;\n        }\n\n        if (valorB === null) {\n            return -1;\n        }\n\n        const descendente =\n            modo.endsWith('_desc');\n\n        return descendente\n            ? valorB - valorA\n            : valorA - valorB;\n    });\n\n    cards.forEach(function (card) {\n        lista.appendChild(card);\n    });\n}\n\n\n\/\/ ============================================================\n\/\/ FILTROS DOS RESULTADOS COTA FACIL\n\/\/ ============================================================\n\nfunction configurarFiltrosLeitorCotafacil(anuncios) {\n\n    const grupoConectividade =\n        document.getElementById(\n            'grupoConectividadeCotafacil'\n        );\n\n    const grupoLeitura =\n        document.getElementById(\n            'grupoLeituraCotafacil'\n        );\n\n    const filtroConectividade =\n        document.getElementById(\n            'filtroConectividadeCotafacil'\n        );\n\n    const filtroLeitura =\n        document.getElementById(\n            'filtroLeituraCotafacil'\n        );\n\n    const inputBusca =\n        document.getElementById(\n            'inputBuscaMl'\n        );\n\n    const pesquisa =\n        String(\n            inputBusca\n                ? inputBusca.value\n                : ''\n        ).toLowerCase();\n\n    const pesquisaPareceLeitor =\n        \/\\b(leitor|scanner|codigo\\s+de\\s+barras|codigo\\s+barras|qr\\s*code|qrcode|1d|2d)\\b\/i\n            .test(pesquisa);\n\n    const anuncioPareceLeitor =\n        anuncios.some(function(item) {\n\n            const titulo =\n                String(\n                    item.produto ||\n                    item.titulo ||\n                    item.title ||\n                    ''\n                );\n\n            const conectividade =\n                String(\n                    item.conectividade_leitor ||\n                    'A_CONFIRMAR'\n                ).toUpperCase();\n\n            const leitura =\n                String(\n                    item.tipo_leitura_leitor ||\n                    'A_CONFIRMAR'\n                ).toUpperCase();\n\n            return [\n                \/\\b(leitor|scanner|codigo\\s+de\\s+barras|codigo\\s+barras|qr\\s*code|qrcode|1d|2d)\\b\/i\n                    .test(titulo),\n\n                conectividade !== 'A_CONFIRMAR',\n\n                leitura !== 'A_CONFIRMAR'\n            ].some(Boolean);\n        });\n\n    const mostrarFiltros =\n        pesquisaPareceLeitor ||\n        anuncioPareceLeitor;\n\n    if (grupoConectividade) {\n        grupoConectividade.style.display =\n            mostrarFiltros ? '' : 'none';\n    }\n\n    if (grupoLeitura) {\n        grupoLeitura.style.display =\n            mostrarFiltros ? '' : 'none';\n    }\n\n    if (!mostrarFiltros) {\n\n        if (filtroConectividade) {\n            filtroConectividade.value = 'TODAS';\n        }\n\n        if (filtroLeitura) {\n            filtroLeitura.value = 'TODAS';\n        }\n    }\n}\n\n\nfunction resetarFiltrosCotafacil() {\n\n    const idsTexto = [\n        'filtroTituloIncluiCotafacil',\n        'filtroTituloComecaCotafacil',\n        'filtroTituloExcluiCotafacil',\n        'filtroPrecoTotalMinCotafacil',\n        'filtroPrecoTotalMaxCotafacil',\n        'filtroPrecoComparavelMinCotafacil',\n        'filtroPrecoComparavelMaxCotafacil',\n        'buscaPalavrasTituloCotafacil',\n        'buscaPalavrasExcluiTituloCotafacil'\n    ];\n\n    idsTexto.forEach(function(id) {\n\n        const elemento =\n            document.getElementById(id);\n\n        if (elemento) {\n            elemento.value = '';\n        }\n    });\n\n    const valoresSelect = {\n        filtroFonteCotafacil:\n            'TODAS',\n        filtroUnidadeComparacaoCotafacil:\n            'TODAS',\n        filtroMarcaCotafacil:\n            'TODAS',\n        filtroConectividadeCotafacil:\n            'TODAS',\n        filtroLeituraCotafacil:\n            'TODAS',\n        filtroStatusCotafacil:\n            'TODOS',\n        ordenacaoCotafacil:\n            'comparavel_asc'\n    };\n\n    Object.keys(\n        valoresSelect\n    ).forEach(function(id) {\n\n        const elemento =\n            document.getElementById(id);\n\n        if (elemento) {\n            elemento.value =\n                valoresSelect[id];\n        }\n    });\n\n    document\n        .querySelectorAll(\n            '.cotafacil-palavra-titulo:checked'\n        )\n        .forEach(function(checkbox) {\n            checkbox.checked = false;\n        });\n\n    document\n        .querySelectorAll(\n            '#listaPalavrasTituloCotafacil [data-palavra-filtro]'\n        )\n        .forEach(function(linha) {\n            linha.style.display = 'flex';\n        });\n\n    document\n        .querySelectorAll(\n            '.cotafacil-palavra-exclui-titulo:checked'\n        )\n        .forEach(function(checkbox) {\n            checkbox.checked = false;\n        });\n\n    document\n        .querySelectorAll(\n            '#listaPalavrasExcluiTituloCotafacil [data-palavra-filtro]'\n        )\n        .forEach(function(linha) {\n            linha.style.display = 'flex';\n        });\n\n    const filtroMarca =\n        document.getElementById(\n            'filtroMarcaCotafacil'\n        );\n\n    if (filtroMarca) {\n        filtroMarca.innerHTML =\n            '<option value=\"TODAS\">Todas<\/option>';\n    }\n\n    const grupoConectividade =\n        document.getElementById(\n            'grupoConectividadeCotafacil'\n        );\n\n    const grupoLeitura =\n        document.getElementById(\n            'grupoLeituraCotafacil'\n        );\n\n    if (grupoConectividade) {\n        grupoConectividade.style.display =\n            'none';\n    }\n\n    if (grupoLeitura) {\n        grupoLeitura.style.display =\n            'none';\n    }\n}\n\n\nfunction preencherFiltroMarcasCotafacil(anuncios) {\n\n    const seletor =\n        document.getElementById(\n            'filtroMarcaCotafacil'\n        );\n\n    if (!seletor) {\n        return;\n    }\n\n    const marcaAtual =\n        seletor.value || 'TODAS';\n\n    const marcas =\n        Array.from(\n            new Set(\n                anuncios\n                    .map(function(item) {\n                        return String(\n                            item.marca ||\n                            item.marca_identificada ||\n                            ''\n                        ).trim();\n                    })\n                    .filter(function(marca) {\n                        return Boolean(marca);\n                    })\n            )\n        ).sort(function(a, b) {\n            return a.localeCompare(\n                b,\n                'pt-BR'\n            );\n        });\n\n    seletor.innerHTML = '';\n\n    const opcaoTodas =\n        document.createElement(\n            'option'\n        );\n\n    opcaoTodas.value =\n        'TODAS';\n\n    opcaoTodas.innerText =\n        'Todas';\n\n    seletor.appendChild(\n        opcaoTodas\n    );\n\n    marcas.forEach(function(marca) {\n\n        const opcao =\n            document.createElement(\n                'option'\n            );\n\n        opcao.value =\n            marca.toUpperCase();\n\n        opcao.innerText =\n            marca\n                .replace(\/_\/g, ' ')\n                .toLowerCase()\n                .replace(\n                    \/\\b\\w\/g,\n                    function(letra) {\n                        return letra.toUpperCase();\n                    }\n                );\n\n        seletor.appendChild(\n            opcao\n        );\n    });\n\n    const aindaExiste =\n        Array.from(\n            seletor.options\n        ).some(function(opcao) {\n            return opcao.value ===\n                marcaAtual;\n        });\n\n    seletor.value =\n        aindaExiste\n            ? marcaAtual\n            : 'TODAS';\n}\n\n\nfunction preencherPalavrasTituloCotafacil(anuncios) {\n\n    const lista =\n        document.getElementById(\n            'listaPalavrasTituloCotafacil'\n        );\n\n    if (!lista) {\n        return;\n    }\n\n    const contagem =\n        new Map();\n\n    const palavrasIgnoradas =\n        new Set([\n            'a',\n            'as',\n            'o',\n            'os',\n            'e',\n            'de',\n            'da',\n            'das',\n            'do',\n            'dos',\n            'em',\n            'no',\n            'nos',\n            'na',\n            'nas',\n            'para',\n            'por',\n            'com',\n            'sem',\n            'um',\n            'uma'\n        ]);\n\n    anuncios.forEach(function(item) {\n\n        const titulo =\n            String(\n                item.nome ||\n                item.produto ||\n                item.titulo ||\n                item.title ||\n                ''\n            )\n            .toLocaleLowerCase(\n                'pt-BR'\n            )\n            .normalize('NFD')\n            .replace(\n                \/[\\u0300-\\u036f]\/g,\n                ''\n            );\n\n        const palavrasDoTitulo =\n            new Set(\n                titulo\n                    .replace(\n                        \/[^a-z0-9]+\/g,\n                        ' '\n                    )\n                    .trim()\n                    .split(\/\\s+\/)\n                    .filter(function(palavra) {\n\n                        if (!palavra) {\n                            return false;\n                        }\n\n                        const ehAno =\n                            \/^(?:19|20)\\d{2}$\/.test(\n                                palavra\n                            );\n\n                        if (\n                            palavra.length < 4\n                        ) {\n                            if (!ehAno) {\n                                return false;\n                            }\n                        }\n\n                        if (\n                            \/^\\d+$\/.test(\n                                palavra\n                            )\n                        ) {\n                            if (\n                                !\/^(?:19|20)\\d{2}$\/.test(\n                                    palavra\n                                )\n                            ) {\n                                return false;\n                            }\n                        }\n\n                        if (\n                            palavrasIgnoradas.has(\n                                palavra\n                            )\n                        ) {\n                            return false;\n                        }\n\n                        return true;\n                    })\n            );\n\n        palavrasDoTitulo.forEach(\n            function(palavra) {\n\n                contagem.set(\n                    palavra,\n                    (\n                        contagem.get(\n                            palavra\n                        ) || 0\n                    ) + 1\n                );\n            }\n        );\n    });\n\n    const palavras =\n        Array.from(\n            contagem.entries()\n        )\n        .sort(function(a, b) {\n\n            return a[0].localeCompare(\n                b[0],\n                'pt-BR'\n            );\n        });\n\n    lista.innerHTML = '';\n\n    if (palavras.length === 0) {\n\n        const vazio =\n            document.createElement(\n                'span'\n            );\n\n        vazio.style.color =\n            '#777';\n\n        vazio.innerText =\n            'Nenhuma palavra dispon\u00edvel.';\n\n        lista.appendChild(\n            vazio\n        );\n\n        return;\n    }\n\n    palavras.forEach(function(item) {\n\n        const palavra =\n            item[0];\n\n        const quantidade =\n            item[1];\n\n        const linha =\n            document.createElement(\n                'label'\n            );\n\n        linha.style.display =\n            'flex';\n\n        linha.style.alignItems =\n            'center';\n\n        linha.style.gap =\n            '6px';\n\n        linha.style.cursor =\n            'pointer';\n\n        linha.style.padding =\n            '3px 0';\n\n        linha.dataset.palavraFiltro =\n            palavra;\n\n        const checkbox =\n            document.createElement(\n                'input'\n            );\n\n        checkbox.type =\n            'checkbox';\n\n        checkbox.className =\n            'cotafacil-palavra-titulo';\n\n        checkbox.value =\n            palavra;\n\n        checkbox.addEventListener(\n            'click',\n            function(evento) {\n                evento.stopPropagation();\n            }\n        );\n\n        const texto =\n            document.createElement(\n                'span'\n            );\n\n        texto.innerText =\n            palavra +\n            ' (' +\n            quantidade +\n            ')';\n\n        linha.appendChild(\n            checkbox\n        );\n\n        linha.appendChild(\n            texto\n        );\n\n        lista.appendChild(\n            linha\n        );\n    });\n}\n\n\nfunction atualizarContagensPalavrasCotafacil() {\n\n    const listaResultados =\n        document.getElementById(\n            'listaResultadosCotacao'\n        );\n\n    if (!listaResultados) {\n        return;\n    }\n\n    const cards =\n        Array.from(\n            listaResultados.querySelectorAll(\n                '.cotafacil-resultado-card'\n            )\n        );\n\n    const tituloNormalizadoPorCard =\n        new Map();\n\n    cards.forEach(function(card) {\n\n        const tituloNormalizado =\n            String(\n                card.dataset.nomeOrdenacao || ''\n            )\n            .toLocaleLowerCase('pt-BR')\n            .normalize('NFD')\n            .replace(\n                \/[\\u0300-\\u036f]\/g,\n                ''\n            );\n\n        tituloNormalizadoPorCard.set(\n            card,\n            tituloNormalizado\n        );\n    });\n\n    const palavrasSelecionadas =\n        Array.from(\n            document.querySelectorAll(\n                '.cotafacil-palavra-titulo:checked'\n            )\n        )\n        .map(function(checkbox) {\n            return String(\n                checkbox.value || ''\n            )\n            .trim()\n            .toLocaleLowerCase('pt-BR')\n            .normalize('NFD')\n            .replace(\n                \/[\\u0300-\\u036f]\/g,\n                ''\n            );\n        })\n        .filter(function(valor) {\n            return Boolean(valor);\n        });\n\n    const linhas =\n        document.querySelectorAll(\n            '#listaPalavrasTituloCotafacil [data-palavra-filtro]'\n        );\n\n    linhas.forEach(function(linha) {\n\n        const palavra =\n            String(\n                linha.dataset.palavraFiltro || ''\n            )\n            .trim()\n            .toLocaleLowerCase('pt-BR')\n            .normalize('NFD')\n            .replace(\n                \/[\\u0300-\\u036f]\/g,\n                ''\n            );\n\n        if (!palavra) {\n            return;\n        }\n\n        let quantidade = 0;\n\n        cards.forEach(function(card) {\n\n            const tituloCard =\n                tituloNormalizadoPorCard.get(\n                    card\n                ) || '';\n\n            const outrasPalavrasSelecionadas =\n                palavrasSelecionadas.filter(\n                    function(palavraSelecionada) {\n                        return palavraSelecionada !== palavra;\n                    }\n                );\n\n            const passaOutrasPalavras =\n                outrasPalavrasSelecionadas.length === 0\n                    ? true\n                    : outrasPalavrasSelecionadas.every(\n                        function(palavraSelecionada) {\n                            return tituloCard.includes(\n                                palavraSelecionada\n                            );\n                        }\n                    );\n\n            if (!passaOutrasPalavras) {\n                return;\n            }\n\n            if (\n                tituloCard.includes(\n                    palavra\n                )\n            ) {\n                quantidade += 1;\n            }\n        });\n\n        const span =\n            linha.querySelector(\n                'span'\n            );\n\n        if (span) {\n            span.innerText =\n                palavra +\n                ' (' +\n                quantidade +\n                ')';\n        }\n    });\n\n    const linhasExcluir =\n        document.querySelectorAll(\n            '#listaPalavrasExcluiTituloCotafacil [data-palavra-filtro]'\n        );\n\n    linhasExcluir.forEach(function(linha) {\n\n        const palavra =\n            String(\n                linha.dataset.palavraFiltro || ''\n            )\n            .trim();\n\n        const origem =\n            document.querySelector(\n                '#listaPalavrasTituloCotafacil [data-palavra-filtro=\"' +\n                CSS.escape(palavra) +\n                '\"] span'\n            );\n\n        const destino =\n            linha.querySelector(\n                'span'\n            );\n\n        if (origem) {\n            if (destino) {\n                destino.innerText =\n                    origem.innerText;\n            }\n        }\n    });\n}\n\n\nfunction preencherPalavrasExcluiTituloCotafacil() {\n\n    const origem =\n        document.getElementById(\n            'listaPalavrasTituloCotafacil'\n        );\n\n    const destino =\n        document.getElementById(\n            'listaPalavrasExcluiTituloCotafacil'\n        );\n\n    if (!origem) {\n        return;\n    }\n\n    if (!destino) {\n        return;\n    }\n\n    destino.innerHTML = '';\n\n    const linhas =\n        origem.querySelectorAll(\n            '[data-palavra-filtro]'\n        );\n\n    if (linhas.length === 0) {\n\n        const vazio =\n            document.createElement(\n                'span'\n            );\n\n        vazio.style.color =\n            '#777';\n\n        vazio.innerText =\n            'Nenhuma palavra dispon\u00edvel.';\n\n        destino.appendChild(\n            vazio\n        );\n\n        return;\n    }\n\n    linhas.forEach(function(linhaOrigem) {\n\n        const linha =\n            linhaOrigem.cloneNode(\n                true\n            );\n\n        const checkbox =\n            linha.querySelector(\n                'input'\n            );\n\n        if (checkbox) {\n\n            checkbox.checked =\n                false;\n\n            checkbox.className =\n                'cotafacil-palavra-exclui-titulo';\n        }\n\n        destino.appendChild(\n            linha\n        );\n    });\n}\n\n\n\/\/ ============================================================\n\/\/ FILTROS DOS RESULTADOS COTA FACIL\n\/\/ ============================================================\n\n\nfunction atualizarContagensSelectsCotafacil() {\n\n    const lista =\n        document.getElementById(\n            'listaResultadosCotacao'\n        );\n\n    if (!lista) {\n        return;\n    }\n\n    const filtroFonte =\n        document.getElementById(\n            'filtroFonteCotafacil'\n        );\n\n    const filtroStatus =\n        document.getElementById(\n            'filtroStatusCotafacil'\n        );\n\n    const filtroUnidade =\n        document.getElementById(\n            'filtroUnidadeComparacaoCotafacil'\n        );\n\n    const filtroMarca =\n        document.getElementById(\n            'filtroMarcaCotafacil'\n        );\n\n    const filtroConectividade =\n        document.getElementById(\n            'filtroConectividadeCotafacil'\n        );\n\n    const filtroLeitura =\n        document.getElementById(\n            'filtroLeituraCotafacil'\n        );\n\n    const filtroTituloInclui =\n        document.getElementById(\n            'filtroTituloIncluiCotafacil'\n        );\n\n    const filtroTituloComeca =\n        document.getElementById(\n            'filtroTituloComecaCotafacil'\n        );\n\n    const filtroTituloExclui =\n        document.getElementById(\n            'filtroTituloExcluiCotafacil'\n        );\n\n    const filtroPrecoTotalMin =\n        document.getElementById(\n            'filtroPrecoTotalMinCotafacil'\n        );\n\n    const filtroPrecoTotalMax =\n        document.getElementById(\n            'filtroPrecoTotalMaxCotafacil'\n        );\n\n    const filtroPrecoComparavelMin =\n        document.getElementById(\n            'filtroPrecoComparavelMinCotafacil'\n        );\n\n    const filtroPrecoComparavelMax =\n        document.getElementById(\n            'filtroPrecoComparavelMaxCotafacil'\n        );\n\n    const fonteSelecionada =\n        filtroFonte\n            ? filtroFonte.value\n            : 'TODAS';\n\n    const statusSelecionado =\n        filtroStatus\n            ? filtroStatus.value\n            : 'TODOS';\n\n    const unidadeSelecionada =\n        filtroUnidade\n            ? filtroUnidade.value\n            : 'TODAS';\n\n    const marcaSelecionada =\n        filtroMarca\n            ? filtroMarca.value\n            : 'TODAS';\n\n    const conectividadeSelecionada =\n        filtroConectividade\n            ? filtroConectividade.value\n            : 'TODAS';\n\n    const leituraSelecionada =\n        filtroLeitura\n            ? filtroLeitura.value\n            : 'TODAS';\n\n    function normalizarTexto(valor) {\n\n        return String(\n            valor || ''\n        )\n        .trim()\n        .toLocaleLowerCase('pt-BR')\n        .normalize('NFD')\n        .replace(\n            \/[\\u0300-\\u036f]\/g,\n            ''\n        );\n    }\n\n    const tituloObrigatorio =\n        normalizarTexto(\n            filtroTituloInclui\n                ? filtroTituloInclui.value\n                : ''\n        );\n\n    const tituloComeca =\n        normalizarTexto(\n            filtroTituloComeca\n                ? filtroTituloComeca.value\n                : ''\n        );\n\n    const tituloExclui =\n        normalizarTexto(\n            filtroTituloExclui\n                ? filtroTituloExclui.value\n                : ''\n        );\n\n    const palavrasSelecionadas =\n        Array.from(\n            document.querySelectorAll(\n                '.cotafacil-palavra-titulo:checked'\n            )\n        )\n        .map(function(checkbox) {\n            return normalizarTexto(\n                checkbox.value\n            );\n        })\n        .filter(function(valor) {\n            return Boolean(valor);\n        });\n\n    const palavrasExcluidas =\n        Array.from(\n            document.querySelectorAll(\n                '.cotafacil-palavra-exclui-titulo:checked'\n            )\n        )\n        .map(function(checkbox) {\n            return normalizarTexto(\n                checkbox.value\n            );\n        })\n        .filter(function(valor) {\n            return Boolean(valor);\n        });\n\n    function numeroFiltro(elemento) {\n\n        if (!elemento) {\n            return null;\n        }\n\n        const valor =\n            String(\n                elemento.value || ''\n            )\n            .trim()\n            .replace(\/\\.\/g, '')\n            .replace(',', '.');\n\n        if (!valor) {\n            return null;\n        }\n\n        const numero =\n            Number(valor);\n\n        return Number.isFinite(numero)\n            ? numero\n            : null;\n    }\n\n    const precoTotalMin =\n        numeroFiltro(\n            filtroPrecoTotalMin\n        );\n\n    const precoTotalMax =\n        numeroFiltro(\n            filtroPrecoTotalMax\n        );\n\n    const precoComparavelMin =\n        numeroFiltro(\n            filtroPrecoComparavelMin\n        );\n\n    const precoComparavelMax =\n        numeroFiltro(\n            filtroPrecoComparavelMax\n        );\n\n    const cards =\n        Array.from(\n            lista.querySelectorAll(\n                '.cotafacil-resultado-card'\n            )\n        );\n\n    function statusCombina(\n        statusCard,\n        statusDesejado\n    ) {\n\n        if (statusDesejado === 'TODOS') {\n            return true;\n        }\n\n        if (\n            statusDesejado ===\n            'FORA_RANKING'\n        ) {\n\n            return [\n                statusCard !== 'RANKING',\n                statusCard !== 'QUANTIDADE_A_CONFIRMAR',\n                statusCard !== 'VARIACAO_A_CONFIRMAR',\n                statusCard !== 'PRODUTO_DIFERENTE'\n            ].every(Boolean);\n        }\n\n        return statusCard ===\n            statusDesejado;\n    }\n\n    function cardPassa(\n        card,\n        campoIgnorado,\n        valorTeste\n    ) {\n\n        const fonteCard =\n            String(\n                card.dataset.fonteFiltro ||\n                ''\n            );\n\n        const statusCard =\n            String(\n                card.dataset.statusFiltro ||\n                'FORA_RANKING'\n            );\n\n        const unidadeCard =\n            String(\n                card.dataset.unidadeFiltro ||\n                'PECA'\n            );\n\n        const marcaCard =\n            String(\n                card.dataset.marcaFiltro ||\n                'A_CONFIRMAR'\n            );\n\n        const conectividadeCard =\n            String(\n                card.dataset.conectividadeFiltro ||\n                'A_CONFIRMAR'\n            );\n\n        const leituraCard =\n            String(\n                card.dataset.leituraFiltro ||\n                'A_CONFIRMAR'\n            );\n\n        const tituloCard =\n            normalizarTexto(\n                card.dataset.nomeOrdenacao ||\n                ''\n            );\n\n        const precoTotalCard =\n            Number(\n                card.dataset.precoTotal\n            );\n\n        const precoComparavelCard =\n            Number(\n                card.dataset.precoComparavel\n            );\n\n        const fonteDesejada =\n            campoIgnorado === 'fonte'\n                ? valorTeste\n                : fonteSelecionada;\n\n        const statusDesejado =\n            campoIgnorado === 'status'\n                ? valorTeste\n                : statusSelecionado;\n\n        const unidadeDesejada =\n            campoIgnorado === 'unidade'\n                ? valorTeste\n                : unidadeSelecionada;\n\n        const marcaDesejada =\n            campoIgnorado === 'marca'\n                ? valorTeste\n                : marcaSelecionada;\n\n        const conectividadeDesejada =\n            campoIgnorado === 'conectividade'\n                ? valorTeste\n                : conectividadeSelecionada;\n\n        const leituraDesejada =\n            campoIgnorado === 'leitura'\n                ? valorTeste\n                : leituraSelecionada;\n\n        let mostraFonte = true;\n        let mostraStatus = true;\n        let mostraUnidade = true;\n        let mostraMarca = true;\n        let mostraConectividade = true;\n        let mostraLeitura = true;\n        let mostraTituloInclui = true;\n        let mostraTituloExclui = true;\n        let mostraPrecoTotal = true;\n        let mostraPrecoComparavel = true;\n\n        if (fonteDesejada !== 'TODAS') {\n            mostraFonte =\n                fonteCard ===\n                fonteDesejada;\n        }\n\n        mostraStatus =\n            statusCombina(\n                statusCard,\n                statusDesejado\n            );\n\n        if (unidadeDesejada !== 'TODAS') {\n            mostraUnidade =\n                unidadeCard ===\n                unidadeDesejada;\n        }\n\n        if (marcaDesejada !== 'TODAS') {\n            mostraMarca =\n                marcaCard ===\n                marcaDesejada;\n        }\n\n        if (\n            conectividadeDesejada !==\n            'TODAS'\n        ) {\n            mostraConectividade =\n                conectividadeCard ===\n                conectividadeDesejada;\n        }\n\n        if (\n            leituraDesejada !==\n            'TODAS'\n        ) {\n            mostraLeitura =\n                leituraCard ===\n                leituraDesejada;\n        }\n\n        if (tituloObrigatorio) {\n            mostraTituloInclui =\n                tituloCard.includes(\n                    tituloObrigatorio\n                );\n        }\n\n        if (\n            [\n                mostraTituloInclui,\n                tituloComeca\n            ].every(Boolean)\n        ) {\n            mostraTituloInclui =\n                tituloCard.startsWith(\n                    tituloComeca\n                );\n        }\n\n        if (mostraTituloInclui) {\n\n            if (\n                palavrasSelecionadas.length > 0\n            ) {\n                mostraTituloInclui =\n                    palavrasSelecionadas.every(\n                        function(palavra) {\n                            return tituloCard.includes(\n                                palavra\n                            );\n                        }\n                    );\n            }\n        }\n\n        if (tituloExclui) {\n            mostraTituloExclui =\n                !tituloCard.includes(\n                    tituloExclui\n                );\n        }\n\n        if (mostraTituloExclui) {\n\n            if (\n                palavrasExcluidas.length > 0\n            ) {\n                mostraTituloExclui =\n                    !palavrasExcluidas.some(\n                        function(palavra) {\n                            return tituloCard.includes(\n                                palavra\n                            );\n                        }\n                    );\n            }\n        }\n\n        if (precoTotalMin !== null) {\n            mostraPrecoTotal =\n                [\n                    mostraPrecoTotal,\n                    Number.isFinite(\n                        precoTotalCard\n                    ),\n                    precoTotalCard >=\n                        precoTotalMin\n                ].every(Boolean);\n        }\n\n        if (precoTotalMax !== null) {\n            mostraPrecoTotal =\n                [\n                    mostraPrecoTotal,\n                    Number.isFinite(\n                        precoTotalCard\n                    ),\n                    precoTotalCard <=\n                        precoTotalMax\n                ].every(Boolean);\n        }\n\n        if (\n            precoComparavelMin !== null\n        ) {\n            mostraPrecoComparavel =\n                [\n                    mostraPrecoComparavel,\n                    Number.isFinite(\n                        precoComparavelCard\n                    ),\n                    precoComparavelCard >=\n                        precoComparavelMin\n                ].every(Boolean);\n        }\n\n        if (\n            precoComparavelMax !== null\n        ) {\n            mostraPrecoComparavel =\n                [\n                    mostraPrecoComparavel,\n                    Number.isFinite(\n                        precoComparavelCard\n                    ),\n                    precoComparavelCard <=\n                        precoComparavelMax\n                ].every(Boolean);\n        }\n\n        return [\n            mostraFonte,\n            mostraStatus,\n            mostraUnidade,\n            mostraMarca,\n            mostraConectividade,\n            mostraLeitura,\n            mostraTituloInclui,\n            mostraTituloExclui,\n            mostraPrecoTotal,\n            mostraPrecoComparavel\n        ].every(Boolean);\n    }\n\n    function atualizarSelect(\n        id,\n        campo,\n        valorTodos\n    ) {\n\n        const seletor =\n            document.getElementById(id);\n\n        if (!seletor) {\n            return;\n        }\n\n        Array.from(\n            seletor.options\n        ).forEach(function(opcao) {\n\n            if (!opcao.dataset.textoOriginal) {\n                opcao.dataset.textoOriginal =\n                    opcao.innerText.replace(\n                        \/\\s+\\(\\d+\\)$\/,\n                        ''\n                    );\n            }\n\n            const valor =\n                String(\n                    opcao.value || ''\n                );\n\n            let quantidade = 0;\n\n            cards.forEach(function(card) {\n\n                if (\n                    cardPassa(\n                        card,\n                        campo,\n                        valor\n                    )\n                ) {\n                    quantidade += 1;\n                }\n            });\n\n            opcao.innerText =\n                opcao.dataset.textoOriginal +\n                ' (' +\n                quantidade +\n                ')';\n        });\n    }\n\n    atualizarSelect(\n        'filtroFonteCotafacil',\n        'fonte',\n        'TODAS'\n    );\n\n    atualizarSelect(\n        'filtroUnidadeComparacaoCotafacil',\n        'unidade',\n        'TODAS'\n    );\n\n    atualizarSelect(\n        'filtroMarcaCotafacil',\n        'marca',\n        'TODAS'\n    );\n\n    atualizarSelect(\n        'filtroConectividadeCotafacil',\n        'conectividade',\n        'TODAS'\n    );\n\n    atualizarSelect(\n        'filtroLeituraCotafacil',\n        'leitura',\n        'TODAS'\n    );\n\n    atualizarSelect(\n        'filtroStatusCotafacil',\n        'status',\n        'TODOS'\n    );\n}\n\n\nfunction filtrarResultadosCotafacil() {\n\n    const lista =\n        document.getElementById(\n            'listaResultadosCotacao'\n        );\n\n    const filtroFonte =\n        document.getElementById(\n            'filtroFonteCotafacil'\n        );\n\n    const filtroStatus =\n        document.getElementById(\n            'filtroStatusCotafacil'\n        );\n\n    const filtroUnidade =\n        document.getElementById(\n            'filtroUnidadeComparacaoCotafacil'\n        );\n\n    const filtroMarca =\n        document.getElementById(\n            'filtroMarcaCotafacil'\n        );\n\n    const filtroConectividade =\n        document.getElementById(\n            'filtroConectividadeCotafacil'\n        );\n\n    const filtroLeitura =\n        document.getElementById(\n            'filtroLeituraCotafacil'\n        );\n\n    const filtroTituloInclui =\n        document.getElementById(\n            'filtroTituloIncluiCotafacil'\n        );\n\n    const filtroTituloComeca =\n        document.getElementById(\n            'filtroTituloComecaCotafacil'\n        );\n\n    const filtroTituloExclui =\n        document.getElementById(\n            'filtroTituloExcluiCotafacil'\n        );\n\n    const filtroPrecoTotalMin =\n        document.getElementById(\n            'filtroPrecoTotalMinCotafacil'\n        );\n\n    const filtroPrecoTotalMax =\n        document.getElementById(\n            'filtroPrecoTotalMaxCotafacil'\n        );\n\n    const filtroPrecoComparavelMin =\n        document.getElementById(\n            'filtroPrecoComparavelMinCotafacil'\n        );\n\n    const filtroPrecoComparavelMax =\n        document.getElementById(\n            'filtroPrecoComparavelMaxCotafacil'\n        );\n\n    if (!lista) {\n        return;\n    }\n\n    const fonteSelecionada =\n        filtroFonte ? filtroFonte.value : 'TODAS';\n\n    const statusSelecionado =\n        filtroStatus ? filtroStatus.value : 'TODOS';\n\n    const unidadeSelecionada =\n        filtroUnidade ? filtroUnidade.value : 'TODAS';\n\n    const marcaSelecionada =\n        filtroMarca ? filtroMarca.value : 'TODAS';\n\n    const conectividadeSelecionada =\n        filtroConectividade\n            ? filtroConectividade.value\n            : 'TODAS';\n\n    const leituraSelecionada =\n        filtroLeitura\n            ? filtroLeitura.value\n            : 'TODAS';\n\n    const tituloObrigatorio =\n        String(\n            filtroTituloInclui\n                ? filtroTituloInclui.value\n                : ''\n        )\n        .trim()\n        .toLocaleLowerCase('pt-BR')\n        .normalize('NFD')\n        .replace(\n            \/[\\u0300-\\u036f]\/g,\n            ''\n        );\n\n    const tituloComeca =\n        String(\n            filtroTituloComeca\n                ? filtroTituloComeca.value\n                : ''\n        )\n        .trim()\n        .toLocaleLowerCase('pt-BR')\n        .normalize('NFD')\n        .replace(\n            \/[\\u0300-\\u036f]\/g,\n            ''\n        );\n\n    const palavrasSelecionadas =\n        Array.from(\n            document.querySelectorAll(\n                '.cotafacil-palavra-titulo:checked'\n            )\n        )\n        .map(function(checkbox) {\n            return String(\n                checkbox.value || ''\n            )\n            .trim()\n            .toLocaleLowerCase('pt-BR');\n        })\n        .filter(function(valor) {\n            return Boolean(valor);\n        });\n\n    const tituloExclui =\n        String(\n            filtroTituloExclui\n                ? filtroTituloExclui.value\n                : ''\n        )\n        .trim()\n        .toLocaleLowerCase('pt-BR')\n        .normalize('NFD')\n        .replace(\n            \/[\\u0300-\\u036f]\/g,\n            ''\n        );\n\n    const palavrasExcluidas =\n        Array.from(\n            document.querySelectorAll(\n                '.cotafacil-palavra-exclui-titulo:checked'\n            )\n        )\n        .map(function(checkbox) {\n            return String(\n                checkbox.value || ''\n            )\n            .trim()\n            .toLocaleLowerCase('pt-BR')\n            .normalize('NFD')\n            .replace(\n                \/[\\u0300-\\u036f]\/g,\n                ''\n            );\n        })\n        .filter(function(valor) {\n            return Boolean(valor);\n        });\n\n    function numeroFiltro(elemento) {\n\n        if (!elemento) {\n            return null;\n        }\n\n        const valor =\n            String(elemento.value || '')\n                .trim()\n                .replace(\/\\.\/g, '')\n                .replace(',', '.');\n\n        if (!valor) {\n            return null;\n        }\n\n        const numero =\n            Number(valor);\n\n        return Number.isFinite(numero)\n            ? numero\n            : null;\n    }\n\n    const precoTotalMin =\n        numeroFiltro(\n            filtroPrecoTotalMin\n        );\n\n    const precoTotalMax =\n        numeroFiltro(\n            filtroPrecoTotalMax\n        );\n\n    const precoComparavelMin =\n        numeroFiltro(\n            filtroPrecoComparavelMin\n        );\n\n    const precoComparavelMax =\n        numeroFiltro(\n            filtroPrecoComparavelMax\n        );\n\n    const cards =\n        Array.from(\n            lista.querySelectorAll(\n                '.cotafacil-resultado-card'\n            )\n        );\n\n    cards.forEach(function(card) {\n\n        const fonteCard =\n            card.dataset.fonteFiltro || '';\n\n        const statusCard =\n            card.dataset.statusFiltro ||\n            'FORA_RANKING';\n\n        const unidadeCard =\n            card.dataset.unidadeFiltro ||\n            'PECA';\n\n        const marcaCard =\n            card.dataset.marcaFiltro ||\n            'A_CONFIRMAR';\n\n        const conectividadeCard =\n            card.dataset.conectividadeFiltro ||\n            'A_CONFIRMAR';\n\n        const leituraCard =\n            card.dataset.leituraFiltro ||\n            'A_CONFIRMAR';\n\n        const tituloCard =\n            String(\n                card.dataset.nomeOrdenacao ||\n                ''\n            )\n            .toLocaleLowerCase(\n                'pt-BR'\n            )\n            .normalize('NFD')\n            .replace(\n                \/[\\u0300-\\u036f]\/g,\n                ''\n            );\n\n        const precoTotalCard =\n            Number(\n                card.dataset.precoTotal\n            );\n\n        const precoComparavelCard =\n            Number(\n                card.dataset.precoComparavel\n            );\n\n        let mostraFonte = true;\n        let mostraStatus = true;\n        let mostraUnidade = true;\n        let mostraMarca = true;\n        let mostraConectividade = true;\n        let mostraLeitura = true;\n        let mostraTituloInclui = true;\n        let mostraTituloExclui = true;\n        let mostraPrecoTotal = true;\n        let mostraPrecoComparavel = true;\n\n        if (fonteSelecionada !== 'TODAS') {\n            mostraFonte =\n                fonteCard ===\n                fonteSelecionada;\n        }\n\n        if (statusSelecionado !== 'TODOS') {\n\n            if (\n                statusSelecionado ===\n                'FORA_RANKING'\n            ) {\n\n                mostraStatus =\n                    [\n                        statusCard !== 'RANKING',\n                        statusCard !== 'QUANTIDADE_A_CONFIRMAR',\n                        statusCard !== 'VARIACAO_A_CONFIRMAR',\n                        statusCard !== 'PRODUTO_DIFERENTE'\n                    ].every(Boolean);\n\n            } else {\n\n                mostraStatus =\n                    statusCard ===\n                    statusSelecionado;\n            }\n        }\n\n        if (unidadeSelecionada !== 'TODAS') {\n\n            mostraUnidade =\n                unidadeCard ===\n                unidadeSelecionada;\n        }\n\n        if (marcaSelecionada !== 'TODAS') {\n\n            mostraMarca =\n                marcaCard ===\n                marcaSelecionada;\n        }\n\n        if (\n            conectividadeSelecionada !==\n            'TODAS'\n        ) {\n\n            mostraConectividade =\n                conectividadeCard ===\n                conectividadeSelecionada;\n        }\n\n        if (\n            leituraSelecionada !==\n            'TODAS'\n        ) {\n\n            mostraLeitura =\n                leituraCard ===\n                leituraSelecionada;\n        }\n\n        if (tituloObrigatorio) {\n\n            mostraTituloInclui =\n                tituloCard.includes(\n                    tituloObrigatorio\n                );\n        }\n\n        if (\n            [\n                mostraTituloInclui,\n                tituloComeca\n            ].every(Boolean)\n        ) {\n\n            mostraTituloInclui =\n                tituloCard.startsWith(\n                    tituloComeca\n                );\n        }\n\n        if (mostraTituloInclui) {\n\n            if (\n                palavrasSelecionadas.length > 0\n            ) {\n\n                mostraTituloInclui =\n                    palavrasSelecionadas.every(\n                        function(palavra) {\n                            return tituloCard.includes(\n                                palavra\n                            );\n                        }\n                    );\n            }\n        }\n\n        if (tituloExclui) {\n\n            mostraTituloExclui =\n                !tituloCard.includes(\n                    tituloExclui\n                );\n        }\n\n        if (mostraTituloExclui) {\n\n            if (\n                palavrasExcluidas.length > 0\n            ) {\n\n                mostraTituloExclui =\n                    !palavrasExcluidas.some(\n                        function(palavra) {\n                            return tituloCard.includes(\n                                palavra\n                            );\n                        }\n                    );\n            }\n        }\n\n        if (precoTotalMin !== null) {\n\n            mostraPrecoTotal =\n                [\n                    mostraPrecoTotal,\n                    Number.isFinite(\n                        precoTotalCard\n                    ),\n                    precoTotalCard >=\n                        precoTotalMin\n                ].every(Boolean);\n        }\n\n        if (precoTotalMax !== null) {\n\n            mostraPrecoTotal =\n                [\n                    mostraPrecoTotal,\n                    Number.isFinite(\n                        precoTotalCard\n                    ),\n                    precoTotalCard <=\n                        precoTotalMax\n                ].every(Boolean);\n        }\n\n        if (\n            precoComparavelMin !== null\n        ) {\n\n            mostraPrecoComparavel =\n                [\n                    mostraPrecoComparavel,\n                    Number.isFinite(\n                        precoComparavelCard\n                    ),\n                    precoComparavelCard >=\n                        precoComparavelMin\n                ].every(Boolean);\n        }\n\n        if (\n            precoComparavelMax !== null\n        ) {\n\n            mostraPrecoComparavel =\n                [\n                    mostraPrecoComparavel,\n                    Number.isFinite(\n                        precoComparavelCard\n                    ),\n                    precoComparavelCard <=\n                        precoComparavelMax\n                ].every(Boolean);\n        }\n\n        card.style.display =\n            [\n                mostraFonte,\n                mostraStatus,\n                mostraUnidade,\n                mostraMarca,\n                mostraConectividade,\n                mostraLeitura,\n                mostraTituloInclui,\n                mostraTituloExclui,\n                mostraPrecoTotal,\n                mostraPrecoComparavel\n            ].every(Boolean)\n                ? ''\n                : 'none';\n    });\n}\n\n\nfunction restaurarResultadosCotafacil() {\n\n    const botaoRestaurar =\n        document.getElementById(\n            'btnRestaurarResultadosCotafacil'\n        );\n\n    if (botaoRestaurar) {\n        if (botaoRestaurar.disabled) {\n            return;\n        }\n    }\n\n    if (botaoRestaurar) {\n        botaoRestaurar.disabled = true;\n        botaoRestaurar.innerText =\n            '\u23f3 Restaurando...';\n        botaoRestaurar.style.cursor =\n            'wait';\n        botaoRestaurar.style.opacity =\n            '0.8';\n    }\n\n    window.setTimeout(\n        function() {\n\n    const valoresSelects = {\n        filtroFonteCotafacil: 'TODAS',\n        filtroStatusCotafacil: 'TODOS',\n        filtroMarcaCotafacil: 'TODAS',\n        filtroConectividadeCotafacil: 'TODAS',\n        filtroLeituraCotafacil: 'TODAS'\n    };\n\n    Object.keys(\n        valoresSelects\n    ).forEach(function(id) {\n\n        const campo =\n            document.getElementById(id);\n\n        if (campo) {\n            campo.value =\n                valoresSelects[id];\n        }\n    });\n\n    [\n        'filtroTituloIncluiCotafacil',\n        'filtroTituloComecaCotafacil',\n        'filtroTituloExcluiCotafacil',\n        'filtroPrecoTotalMinCotafacil',\n        'filtroPrecoTotalMaxCotafacil',\n        'filtroPrecoComparavelMinCotafacil',\n        'filtroPrecoComparavelMaxCotafacil',\n        'buscaPalavrasTituloCotafacil',\n        'buscaPalavrasExcluiTituloCotafacil'\n    ].forEach(function(id) {\n\n        const campo =\n            document.getElementById(id);\n\n        if (campo) {\n            campo.value = '';\n        }\n    });\n\n    document\n        .querySelectorAll(\n            '.cotafacil-palavra-titulo, .cotafacil-palavra-exclui-titulo'\n        )\n        .forEach(function(checkbox) {\n            checkbox.checked = false;\n        });\n\n    document\n        .querySelectorAll(\n            '#listaPalavrasTituloCotafacil [data-palavra-filtro], #listaPalavrasExcluiTituloCotafacil [data-palavra-filtro]'\n        )\n        .forEach(function(linha) {\n            linha.style.display = 'flex';\n        });\n\n    filtrarResultadosCotafacil();\n    atualizarContagensPalavrasCotafacil();\n    atualizarContagensSelectsCotafacil();\n\n    if (botaoRestaurar) {\n        botaoRestaurar.innerText =\n            '\u21bb Restaurar resultados';\n        botaoRestaurar.disabled = false;\n        botaoRestaurar.style.cursor =\n            'pointer';\n        botaoRestaurar.style.opacity =\n            '1';\n    }\n\n        },\n        30\n    );\n}\n\n\n\n\/\/ ============================================================\n\/\/ AUTOCOMPLETE - TITULO COMECA COM\n\/\/ ============================================================\n\nfunction preencherAutocompleteTituloComecaCotafacil() {\n\n    const lista =\n        document.getElementById(\n            'listaTituloComecaCotafacil'\n        );\n\n    const campo =\n        document.getElementById(\n            'filtroTituloComecaCotafacil'\n        );\n\n    const listaResultados =\n        document.getElementById(\n            'listaResultadosCotacao'\n        );\n\n    if (!lista || !listaResultados) {\n        return;\n    }\n\n    \/*\n     * O autocomplete usa exatamente os mesmos cards\n     * utilizados pelo filtro dos resultados.\n     *\n     * Cada titulo gera somente UMA sugestao:\n     * as primeiras 4 palavras.\n     *\/\n    const cards =\n        Array.from(\n            listaResultados.querySelectorAll(\n                '.cotafacil-resultado-card'\n            )\n        );\n\n    const sugestoes = new Map();\n\n    cards.forEach(function(card) {\n\n        const titulo =\n            String(\n                card.dataset.nomeOrdenacao || ''\n            )\n            .trim();\n\n        if (!titulo) {\n            return;\n        }\n\n        const primeiraParte =\n            titulo\n                .split(\/\\s+\/)\n                .slice(0, 4)\n                .join(' ')\n                .trim();\n\n        if (!primeiraParte) {\n            return;\n        }\n\n        const chave =\n            primeiraParte\n                .toLocaleLowerCase('pt-BR')\n                .normalize('NFD')\n                .replace(\n                    \/[\\u0300-\\u036f]\/g,\n                    ''\n                );\n\n        if (!sugestoes.has(chave)) {\n            sugestoes.set(\n                chave,\n                {\n                    valor: primeiraParte,\n                    quantidade: 0\n                }\n            );\n        }\n\n        sugestoes.get(chave).quantidade++;\n    });\n\n    const valores =\n        Array.from(\n            sugestoes.values()\n        )\n        .sort(function(a, b) {\n            return a.valor.localeCompare(\n                b.valor,\n                'pt-BR'\n            );\n        });\n\n    function mostrarSugestoes() {\n\n        if (!campo) {\n            return;\n        }\n\n        const termo =\n            String(\n                campo.value || ''\n            )\n            .toLocaleLowerCase('pt-BR')\n            .normalize('NFD')\n            .replace(\n                \/[\\u0300-\\u036f]\/g,\n                ''\n            )\n            .trim();\n\n        lista.innerHTML = '';\n\n        const filtradas =\n            valores\n                .filter(function(registro) {\n\n                    if (!termo) {\n                        return true;\n                    }\n\n                    const normalizado =\n                        registro.valor\n                            .toLocaleLowerCase('pt-BR')\n                            .normalize('NFD')\n                            .replace(\n                                \/[\\u0300-\\u036f]\/g,\n                                ''\n                            );\n\n                    return normalizado.startsWith(\n                        termo\n                    );\n                });\n\n        filtradas.forEach(function(registro) {\n\n            const item =\n                document.createElement(\n                    'div'\n                );\n\n            item.textContent =\n                registro.valor.toLocaleUpperCase('pt-BR') +\n                ' (' +\n                registro.quantidade +\n                ')';\n\n            item.style.padding =\n                '6px 8px';\n\n            item.style.cursor =\n                'pointer';\n\n            item.style.background =\n                '#ffe600';\n\n            item.style.color =\n                '#000';\n\n            item.style.fontWeight =\n                '600';\n\n            item.style.borderBottom =\n                '1px solid #c7b400';\n\n            item.addEventListener(\n                'mouseenter',\n                function() {\n                    item.style.background =\n                        '#fff';\n                    item.style.color =\n                        '#000';\n                }\n            );\n\n            item.addEventListener(\n                'mouseleave',\n                function() {\n                    item.style.background =\n                        '#ffe600';\n                    item.style.color =\n                        '#000';\n                }\n            );\n\n            item.addEventListener(\n                'mousedown',\n                function(evento) {\n\n                    evento.preventDefault();\n\n                    \/*\n                     * O campo recebe somente o prefixo.\n                     * A quantidade e apenas informativa.\n                     *\/\n                    campo.value =\n                        registro.valor.toLocaleUpperCase('pt-BR');\n\n                    lista.style.display =\n                        'none';\n\n                    campo.dispatchEvent(\n                        new Event(\n                            'input',\n                            {\n                                bubbles: true\n                            }\n                        )\n                    );\n                }\n            );\n\n            lista.appendChild(\n                item\n            );\n        });\n\n        lista.style.display =\n            filtradas.length\n                ? 'block'\n                : 'none';\n    }\n\n    lista.innerHTML = '';\n\n    if (campo) {\n\n        if (\n            !campo.dataset\n                .autocompletePersonalizadoLigado\n        ) {\n\n            campo.dataset\n                .autocompletePersonalizadoLigado =\n                '1';\n\n            campo.addEventListener(\n                'focus',\n                mostrarSugestoes\n            );\n\n            campo.addEventListener(\n                'input',\n                mostrarSugestoes\n            );\n\n            campo.addEventListener(\n                'blur',\n                function() {\n                    window.setTimeout(\n                        function() {\n                            lista.style.display =\n                                'none';\n                        },\n                        120\n                    );\n                }\n            );\n        }\n    }\n}\n\n\/\/ ============================================================\n\/\/ EVENTOS DOS FILTROS AVANCADOS\n\/\/ ============================================================\n\ndocument.addEventListener(\n    'DOMContentLoaded',\n    function () {\n\n\n        [\n            'filtroTituloIncluiCotafacil',\n            'filtroTituloComecaCotafacil',\n            'filtroTituloExcluiCotafacil',\n            'filtroPrecoTotalMinCotafacil',\n            'filtroPrecoTotalMaxCotafacil',\n            'filtroPrecoComparavelMinCotafacil',\n            'filtroPrecoComparavelMaxCotafacil'\n        ].forEach(function(id) {\n\n            const campo =\n                document.getElementById(\n                    id\n                );\n\n            if (campo) {\n\n                campo.addEventListener(\n                    'input',\n                    function () {\n                        filtrarResultadosCotafacil();\n                    }\n                );\n            }\n        });\n\n        const listaPalavras =\n            document.getElementById(\n                'listaPalavrasTituloCotafacil'\n            );\n\n        if (listaPalavras) {\n\n            listaPalavras.addEventListener(\n                'change',\n                function(evento) {\n\n                    if (evento.target) {\n\n                        if (\n                            evento.target.classList.contains(\n                                'cotafacil-palavra-titulo'\n                            )\n                        ) {\n                            filtrarResultadosCotafacil();\n                            atualizarContagensPalavrasCotafacil();\n                            atualizarContagensSelectsCotafacil();\n                        }\n                    }\n                }\n            );\n        }\n\n        const buscaPalavras =\n            document.getElementById(\n                'buscaPalavrasTituloCotafacil'\n            );\n\n        if (buscaPalavras) {\n\n            buscaPalavras.addEventListener(\n                'input',\n                function() {\n\n                    const termo =\n                        String(\n                            buscaPalavras.value || ''\n                        )\n                        .trim()\n                        .toLocaleLowerCase(\n                            'pt-BR'\n                        )\n                        .normalize('NFD')\n                        .replace(\n                            \/[\\u0300-\\u036f]\/g,\n                            ''\n                        );\n\n                    document\n                        .querySelectorAll(\n                            '#listaPalavrasTituloCotafacil [data-palavra-filtro]'\n                        )\n                        .forEach(function(linha) {\n\n                            const palavra =\n                                String(\n                                    linha.dataset.palavraFiltro ||\n                                    ''\n                                );\n\n                            linha.style.display =\n                                !termo ||\n                                palavra.includes(\n                                    termo\n                                )\n                                    ? 'flex'\n                                    : 'none';\n                        });\n                }\n            );\n        }\n\n        const limparPalavras =\n            document.getElementById(\n                'limparPalavrasTituloCotafacil'\n            );\n\n        if (limparPalavras) {\n\n            limparPalavras.addEventListener(\n                'click',\n                function() {\n\n                    document\n                        .querySelectorAll(\n                            '.cotafacil-palavra-titulo:checked'\n                        )\n                        .forEach(function(checkbox) {\n                            checkbox.checked = false;\n                        });\n\n                    if (buscaPalavras) {\n                        buscaPalavras.value = '';\n                        buscaPalavras.dispatchEvent(\n                            new Event('input')\n                        );\n                    }\n\n                    filtrarResultadosCotafacil();\n                    atualizarContagensPalavrasCotafacil();\n                    atualizarContagensSelectsCotafacil();\n                }\n            );\n        }\n\n        const listaPalavrasExclui =\n            document.getElementById(\n                'listaPalavrasExcluiTituloCotafacil'\n            );\n\n        if (listaPalavrasExclui) {\n\n            listaPalavrasExclui.addEventListener(\n                'change',\n                function(evento) {\n\n                    if (evento.target) {\n\n                        if (\n                            evento.target.classList.contains(\n                                'cotafacil-palavra-exclui-titulo'\n                            )\n                        ) {\n                            filtrarResultadosCotafacil();\n                            atualizarContagensPalavrasCotafacil();\n                            atualizarContagensSelectsCotafacil();\n                        }\n                    }\n                }\n            );\n        }\n\n        const buscaPalavrasExclui =\n            document.getElementById(\n                'buscaPalavrasExcluiTituloCotafacil'\n            );\n\n        if (buscaPalavrasExclui) {\n\n            buscaPalavrasExclui.addEventListener(\n                'input',\n                function() {\n\n                    const termo =\n                        String(\n                            buscaPalavrasExclui.value || ''\n                        )\n                        .trim()\n                        .toLocaleLowerCase(\n                            'pt-BR'\n                        )\n                        .normalize('NFD')\n                        .replace(\n                            \/[\\u0300-\\u036f]\/g,\n                            ''\n                        );\n\n                    document\n                        .querySelectorAll(\n                            '#listaPalavrasExcluiTituloCotafacil [data-palavra-filtro]'\n                        )\n                        .forEach(function(linha) {\n\n                            const palavra =\n                                String(\n                                    linha.dataset.palavraFiltro ||\n                                    ''\n                                );\n\n                            linha.style.display =\n                                !termo ||\n                                palavra.includes(\n                                    termo\n                                )\n                                    ? 'flex'\n                                    : 'none';\n                        });\n                }\n            );\n        }\n\n        const limparPalavrasExclui =\n            document.getElementById(\n                'limparPalavrasExcluiTituloCotafacil'\n            );\n\n        if (limparPalavrasExclui) {\n\n            limparPalavrasExclui.addEventListener(\n                'click',\n                function() {\n\n                    document\n                        .querySelectorAll(\n                            '.cotafacil-palavra-exclui-titulo:checked'\n                        )\n                        .forEach(function(checkbox) {\n                            checkbox.checked = false;\n                        });\n\n                    if (buscaPalavrasExclui) {\n                        buscaPalavrasExclui.value = '';\n                        buscaPalavrasExclui.dispatchEvent(\n                            new Event('input')\n                        );\n                    }\n\n                    filtrarResultadosCotafacil();\n                    atualizarContagensPalavrasCotafacil();\n                    atualizarContagensSelectsCotafacil();\n                }\n            );\n        }\n    }\n);\n\n\n\/\/ ============================================================\n\/\/ ENTER NO CAMPO DE PESQUISA\n\/\/ ============================================================\n\ndocument.addEventListener(\n    'DOMContentLoaded',\n    function () {\n\n        const seletorOrdenacao =\n            document.getElementById(\n                'ordenacaoCotafacil'\n            );\n\n        if (seletorOrdenacao) {\n            seletorOrdenacao.addEventListener(\n                'change',\n                function () {\n                    ordenarResultadosCotafacil();\n                }\n            );\n\n            const botoesOrdem =\n                document.querySelectorAll(\n                    '.cotafacil-ordem-rapida'\n                );\n\n            function destacarOrdemCotafacil() {\n                botoesOrdem.forEach(\n                    function (botao) {\n                        const ativo =\n                            botao.dataset.ordem ===\n                            seletorOrdenacao.value;\n\n                        botao.style.background =\n                            ativo ? '#ffe600' : '#ffffff';\n\n                        botao.style.color =\n                            '#000000';\n\n                        botao.style.border =\n                            ativo\n                                ? '2px solid #000000'\n                                : '1px solid #999999';\n\n                        botao.style.fontWeight =\n                            ativo ? '800' : '600';\n                    }\n                );\n            }\n\n            botoesOrdem.forEach(\n                function (botao) {\n                    botao.addEventListener(\n                        'click',\n                        function () {\n                            seletorOrdenacao.value =\n                                botao.dataset.ordem;\n\n                            ordenarResultadosCotafacil();\n                            destacarOrdemCotafacil();\n                        }\n                    );\n                }\n            );\n\n            destacarOrdemCotafacil();\n        }\n\n        const filtroFonte =\n            document.getElementById(\n                'filtroFonteCotafacil'\n            );\n\n        if (filtroFonte) {\n            filtroFonte.addEventListener(\n                'change',\n                function () {\n                    filtrarResultadosCotafacil();\n                    atualizarContagensSelectsCotafacil();\n                    atualizarContagensPalavrasCotafacil();\n                }\n            );\n        }\n\n        const filtroUnidade =\n            document.getElementById(\n                'filtroUnidadeComparacaoCotafacil'\n            );\n\n        if (filtroUnidade) {\n            filtroUnidade.addEventListener(\n                'change',\n                function () {\n                    filtrarResultadosCotafacil();\n                    atualizarContagensSelectsCotafacil();\n                    atualizarContagensPalavrasCotafacil();\n                }\n            );\n        }\n\n        const filtroMarca =\n            document.getElementById(\n                'filtroMarcaCotafacil'\n            );\n\n        if (filtroMarca) {\n            filtroMarca.addEventListener(\n                'change',\n                function () {\n                    filtrarResultadosCotafacil();\n                    atualizarContagensSelectsCotafacil();\n                    atualizarContagensPalavrasCotafacil();\n                }\n            );\n        }\n\n        const filtroConectividade =\n            document.getElementById(\n                'filtroConectividadeCotafacil'\n            );\n\n        if (filtroConectividade) {\n            filtroConectividade.addEventListener(\n                'change',\n                function () {\n                    filtrarResultadosCotafacil();\n                    atualizarContagensSelectsCotafacil();\n                    atualizarContagensPalavrasCotafacil();\n                }\n            );\n        }\n\n        const filtroLeitura =\n            document.getElementById(\n                'filtroLeituraCotafacil'\n            );\n\n        if (filtroLeitura) {\n            filtroLeitura.addEventListener(\n                'change',\n                function () {\n                    filtrarResultadosCotafacil();\n                    atualizarContagensSelectsCotafacil();\n                    atualizarContagensPalavrasCotafacil();\n                }\n            );\n        }\n\n        const filtroStatus =\n            document.getElementById(\n                'filtroStatusCotafacil'\n            );\n\n        if (filtroStatus) {\n            filtroStatus.addEventListener(\n                'change',\n                function () {\n                    filtrarResultadosCotafacil();\n                    atualizarContagensSelectsCotafacil();\n                    atualizarContagensPalavrasCotafacil();\n                }\n            );\n        }\n\n        const input =\n            document.getElementById(\n                'inputBuscaMl'\n            );\n\n        if (!input) {\n            console.warn(\n                '[ML] Campo inputBuscaMl n\u00e3o encontrado.'\n            );\n            return;\n        }\n\n        input.addEventListener(\n            'keydown',\n            function (event) {\n\n                if (\n                    [\n                        event.key === 'Enter',\n                        !event.shiftKey\n                    ].every(Boolean)\n                ) {\n\n                    event.preventDefault();\n\n                    dispararPesquisaComercial();\n                }\n            }\n        );\n    }\n);\n\n\/\/ ============================================================\n\/\/ ORCAMENTO \/ CARRINHO COTA FACIL\n\/\/ ============================================================\n\nlet usuarioOrcamentoCotafacil = null;\n\nfunction obterChaveOrcamentoCotafacil() {\n\n    if (usuarioOrcamentoCotafacil) {\n        return (\n            'cotafacil_orcamento_v2_usuario_' +\n            String(usuarioOrcamentoCotafacil)\n        );\n    }\n\n    return 'cotafacil_orcamento_v2_visitante';\n}\n\nfunction carregarOrcamentoCotafacil() {\n    try {\n        const dados = localStorage.getItem(\n            obterChaveOrcamentoCotafacil()\n        );\n\n        if (!dados) {\n            return [];\n        }\n\n        const itens = JSON.parse(dados);\n\n        return Array.isArray(itens)\n            ? itens\n            : [];\n    } catch (erro) {\n        console.error(\n            '[COTA FACIL] Erro ao carregar or\u00e7amento:',\n            erro\n        );\n\n        return [];\n    }\n}\n\nasync function salvarOrcamentoServidorCotafacil(itens) {\n\n    if (!usuarioOrcamentoCotafacil) {\n        return;\n    }\n\n    try {\n\n        const resposta =\n            await fetch(\n                '\/index.php\/wp-json\/cotafacil\/v1\/orcamento',\n                {\n                    method: 'POST',\n                    credentials: 'include',\n                    headers: {\n                        'Content-Type':\n                            'application\/json',\n                        'X-WP-Nonce':\n                            window.cotafacilNonceRest || ''\n                    },\n                    body:\n                        JSON.stringify({\n                            itens: itens\n                        })\n                }\n            );\n\n        if (!resposta.ok) {\n            throw new Error(\n                'Falha ao salvar or\u00e7amento no servidor.'\n            );\n        }\n\n        const dados =\n            await resposta.json();\n\n        console.log(\n            '[COTA FACIL ORCAMENTO SALVO SERVIDOR]',\n            dados\n        );\n\n    } catch (erro) {\n        console.error(\n            '[COTA FACIL] Erro ao salvar or\u00e7amento no servidor:',\n            erro\n        );\n    }\n}\n\nfunction salvarOrcamentoCotafacil(itens) {\n\n    localStorage.setItem(\n        obterChaveOrcamentoCotafacil(),\n        JSON.stringify(itens)\n    );\n\n    salvarOrcamentoServidorCotafacil(\n        itens\n    );\n}\n\nasync function sincronizarOrcamentoServidorCotafacil() {\n\n    if (!usuarioOrcamentoCotafacil) {\n        return;\n    }\n\n    try {\n\n        const chaveLocal =\n            obterChaveOrcamentoCotafacil();\n\n        const itensLocais =\n            carregarOrcamentoCotafacil();\n\n        const resposta =\n            await fetch(\n                '\/index.php\/wp-json\/cotafacil\/v1\/orcamento',\n                {\n                    method: 'GET',\n                    credentials: 'include',\n                    headers: {\n                        'X-WP-Nonce':\n                            window.cotafacilNonceRest || ''\n                    }\n                }\n            );\n\n        if (!resposta.ok) {\n            throw new Error(\n                'Falha ao carregar or\u00e7amento do servidor.'\n            );\n        }\n\n        const dados =\n            await resposta.json();\n\n        const itensServidor =\n            dados\n                ? (\n                    Array.isArray(dados.itens)\n                        ? dados.itens\n                        : []\n                )\n                : [];\n\n        if (\n            itensServidor.length === 0\n                ? itensLocais.length > 0\n                : false\n        ) {\n\n            await salvarOrcamentoServidorCotafacil(\n                itensLocais\n            );\n\n            console.log(\n                '[COTA FACIL ORCAMENTO MIGRADO LOCAL -> SERVIDOR]',\n                itensLocais.length\n            );\n\n            return;\n        }\n\n        if (itensServidor.length > 0) {\n\n            localStorage.setItem(\n                chaveLocal,\n                JSON.stringify(\n                    itensServidor\n                )\n            );\n\n            console.log(\n                '[COTA FACIL ORCAMENTO CARREGADO SERVIDOR]',\n                itensServidor.length\n            );\n        }\n\n    } catch (erro) {\n        console.error(\n            '[COTA FACIL] Erro ao sincronizar or\u00e7amento:',\n            erro\n        );\n    }\n}\n\nfunction atualizarContadorOrcamento() {\n    const contador =\n        document.getElementById(\n            'contadorOrcamento'\n        );\n\n    const btnVer =\n        document.getElementById(\n            'btnVerOrcamento'\n        );\n\n    const contadorTopo =\n        document.getElementById(\n            'contadorTopoCotafacil'\n        );\n\n    const itens =\n        carregarOrcamentoCotafacil();\n\n    if (contador) {\n        contador.innerText =\n            itens.length === 1\n                ? '1 item selecionado'\n                : itens.length + ' itens selecionados';\n    }\n\n    if (contadorTopo) {\n        contadorTopo.innerText =\n            String(\n                itens.length\n            );\n    }\n\n    if (btnVer) {\n        btnVer.disabled =\n            itens.length === 0;\n\n        btnVer.innerText =\n            'Ver Or\u00e7amento (' +\n            itens.length +\n            ')';\n    }\n}\n\nfunction obterResultadosMarcados() {\n    return Array.from(\n        document.querySelectorAll(\n            '.cotafacil-item-checkbox:checked'\n        )\n    ).map(function (checkbox) {\n        return {\n            item_id:\n                checkbox.dataset.itemId || '',\n            produto:\n                checkbox.dataset.produto || '',\n            fonte:\n                checkbox.dataset.fonte || '',\n            preco:\n                Number(\n                    checkbox.dataset.preco || 0\n                ),\n            link:\n                checkbox.dataset.link || '',\n            imagem:\n                checkbox.dataset.imagem || '',\n            quantidade:\n                1\n        };\n    });\n}\n\nfunction atualizarBotaoAdicionarOrcamento() {\n    const btnAdicionar =\n        document.getElementById(\n            'btnAdicionarOrcamento'\n        );\n\n    if (!btnAdicionar) {\n        return;\n    }\n\n    btnAdicionar.disabled =\n        obterResultadosMarcados().length === 0;\n}\n\nfunction adicionarMarcadosAoOrcamento() {\n    const novos =\n        obterResultadosMarcados();\n\n    if (!novos.length) {\n        return;\n    }\n\n    const atuais =\n        carregarOrcamentoCotafacil();\n\n    const mapa =\n        new Map();\n\n    atuais.forEach(function (item) {\n        const chave =\n            (item.fonte || '') +\n            '|' +\n            (item.item_id || '');\n\n        mapa.set(chave, item);\n    });\n\n    novos.forEach(function (item) {\n        const chave =\n            (item.fonte || '') +\n            '|' +\n            (item.item_id || '');\n\n        const existente =\n            mapa.get(\n                chave\n            );\n\n        if (existente) {\n            item.quantidade =\n                obterQuantidadeOrcamentoCotafacil(\n                    existente\n                );\n        }\n\n        mapa.set(chave, item);\n    });\n\n    const resultado =\n        Array.from(mapa.values());\n\n    salvarOrcamentoCotafacil(\n        resultado\n    );\n\n    atualizarContadorOrcamento();\n\n    document\n        .querySelectorAll(\n            '.cotafacil-item-checkbox'\n        )\n        .forEach(function (checkbox) {\n            checkbox.checked = false;\n        });\n\n    atualizarBotaoAdicionarOrcamento();\n}\n\ndocument.addEventListener(\n    'change',\n    function (event) {\n        if (\n            event.target\n                ? event.target.classList.contains(\n                    'cotafacil-item-checkbox'\n                )\n                : false\n        ) {\n            atualizarBotaoAdicionarOrcamento();\n        }\n    }\n);\n\nfunction fecharTelaOrcamentoCotafacil() {\n\n    const modal =\n        document.getElementById(\n            'modalOrcamentoCotafacil'\n        );\n\n    if (modal) {\n        modal.style.display =\n            'none';\n    }\n}\n\nfunction removerItemOrcamentoCotafacil(\n    fonte,\n    itemId\n) {\n\n    const itens =\n        carregarOrcamentoCotafacil();\n\n    const restantes =\n        itens.filter(\n            function (item) {\n\n                const mesmaFonte =\n                    String(\n                        item.fonte || ''\n                    ) === String(\n                        fonte || ''\n                    );\n\n                const mesmoItem =\n                    String(\n                        item.item_id || ''\n                    ) === String(\n                        itemId || ''\n                    );\n\n                return !(\n                    mesmaFonte\n                        ? mesmoItem\n                        : false\n                );\n            }\n        );\n\n    salvarOrcamentoCotafacil(\n        restantes\n    );\n\n    atualizarContadorOrcamento();\n\n    renderizarTelaOrcamentoCotafacil();\n}\n\nfunction obterQuantidadeOrcamentoCotafacil(\n    item\n) {\n\n    const valor =\n        Number(\n            item\n                ? item.quantidade\n                : NaN\n        );\n\n    if (!Number.isFinite(valor)) {\n        return 1;\n    }\n\n    return Math.max(\n        0,\n        Math.floor(valor)\n    );\n}\n\nfunction calcularTotalOrcamentoCotafacil(\n    itens\n) {\n\n    return (\n        Array.isArray(itens)\n            ? itens\n            : []\n    ).reduce(\n        function (total, item) {\n\n            const preco =\n                Number(\n                    item.preco || 0\n                );\n\n            const quantidade =\n                obterQuantidadeOrcamentoCotafacil(\n                    item\n                );\n\n            return (\n                total +\n                (\n                    preco *\n                    quantidade\n                )\n            );\n        },\n        0\n    );\n}\n\nfunction salvarQuantidadeOrcamentoCotafacil(\n    fonte,\n    itemId,\n    quantidade\n) {\n\n    const itens =\n        carregarOrcamentoCotafacil();\n\n    let alterou =\n        false;\n\n    itens.forEach(\n        function (item) {\n\n            const mesmaFonte =\n                String(\n                    item.fonte || ''\n                ) === String(\n                    fonte || ''\n                );\n\n            const mesmoItem =\n                String(\n                    item.item_id || ''\n                ) === String(\n                    itemId || ''\n                );\n\n            if (\n                mesmaFonte\n                    ? mesmoItem\n                    : false\n            ) {\n                item.quantidade =\n                    quantidade;\n\n                alterou =\n                    true;\n            }\n        }\n    );\n\n    if (alterou) {\n        salvarOrcamentoCotafacil(\n            itens\n        );\n    }\n}\n\nfunction atualizarTotalGeralOrcamentoCotafacil() {\n\n    const totalElemento =\n        document.getElementById(\n            'totalGeralOrcamentoCotafacil'\n        );\n\n    if (!totalElemento) {\n        return;\n    }\n\n    const total =\n        calcularTotalOrcamentoCotafacil(\n            carregarOrcamentoCotafacil()\n        );\n\n    totalElemento.textContent =\n        'Total Geral: ' +\n        total.toLocaleString(\n            'pt-BR',\n            {\n                style: 'currency',\n                currency: 'BRL'\n            }\n        );\n}\n\nfunction criarLinhaOrcamentoCotafacil(\n    item\n) {\n\n    const linha =\n        document.createElement(\n            'div'\n        );\n\n    linha.style.cssText =\n        'display:grid;' +\n        'grid-template-columns:74px minmax(75px,95px) minmax(180px,1fr) minmax(150px,175px) auto;' +\n        'gap:10px;' +\n        'align-items:center;' +\n        'padding:14px 0;' +\n        'border-bottom:1px solid #292f38;';\n\n    const imagemBoxOrcamento =\n        document.createElement(\n            'div'\n        );\n\n    imagemBoxOrcamento.style.cssText =\n        'width:68px;' +\n        'height:68px;' +\n        'min-width:68px;' +\n        'display:flex;' +\n        'align-items:center;' +\n        'justify-content:center;' +\n        'overflow:hidden;' +\n        'border-radius:8px;' +\n        'border:1px solid #343c48;' +\n        'background:#1a1f27;';\n\n    const imagemUrlOrcamento =\n        String(\n            item.imagem || ''\n        ).trim();\n\n    if (imagemUrlOrcamento) {\n\n        const imagemOrcamento =\n            document.createElement(\n                'img'\n            );\n\n        imagemOrcamento.src =\n            imagemUrlOrcamento;\n\n        imagemOrcamento.alt =\n            item.produto\n                ? String(item.produto)\n                : 'Produto';\n\n        imagemOrcamento.loading =\n            'lazy';\n\n        imagemOrcamento.decoding =\n            'async';\n\n        imagemOrcamento.referrerPolicy =\n            'no-referrer';\n\n        imagemOrcamento.style.cssText =\n            'width:100%;' +\n            'height:100%;' +\n            'object-fit:contain;' +\n            'display:block;';\n\n        imagemOrcamento.addEventListener(\n            'error',\n            function () {\n                imagemOrcamento.style.display =\n                    'none';\n\n                imagemBoxOrcamento.textContent =\n                    'Sem foto';\n\n                imagemBoxOrcamento.style.fontSize =\n                    '10px';\n\n                imagemBoxOrcamento.style.color =\n                    '#9ca3af';\n            }\n        );\n\n        imagemBoxOrcamento.appendChild(\n            imagemOrcamento\n        );\n\n    } else {\n\n        imagemBoxOrcamento.textContent =\n            'Sem foto';\n\n        imagemBoxOrcamento.style.fontSize =\n            '10px';\n\n        imagemBoxOrcamento.style.color =\n            '#9ca3af';\n    }\n\n    const fonte =\n        document.createElement(\n            'div'\n        );\n\n    fonte.textContent =\n        item.fonte\n            ? String(item.fonte)\n            : '-';\n\n    fonte.style.cssText =\n        'font-size:12px;' +\n        'font-weight:800;' +\n        'color:#ffffff;' +\n        'background:#202630;' +\n        'border:1px solid #353c47;' +\n        'border-radius:6px;' +\n        'padding:7px 9px;' +\n        'text-align:center;';\n\n    const areaProduto =\n        document.createElement(\n            'div'\n        );\n\n    const produto =\n        document.createElement(\n            'div'\n        );\n\n    produto.textContent =\n        item.produto\n            ? String(item.produto)\n            : 'Produto';\n\n    produto.style.cssText =\n        'font-size:14px;' +\n        'font-weight:700;' +\n        'line-height:1.35;' +\n        'color:#f3f4f6;';\n\n    areaProduto.appendChild(\n        produto\n    );\n\n    if (item.link) {\n\n        const link =\n            document.createElement(\n                'a'\n            );\n\n        link.href =\n            String(item.link);\n\n        link.target =\n            '_blank';\n\n        link.rel =\n            'noopener noreferrer';\n\n        link.textContent =\n            'Abrir an\u00fancio';\n\n        link.style.cssText =\n            'display:inline-block;' +\n            'margin-top:5px;' +\n            'font-size:12px;' +\n            'color:#ff4b4b;' +\n            'text-decoration:none;';\n\n        areaProduto.appendChild(\n            link\n        );\n    }\n\n    const preco =\n        document.createElement(\n            'div'\n        );\n\n    const valorPreco =\n        Number(\n            item.preco || 0\n        );\n\n    let quantidadeAtual =\n        obterQuantidadeOrcamentoCotafacil(\n            item\n        );\n\n    preco.style.cssText =\n        'display:flex;' +\n        'flex-direction:column;' +\n        'gap:6px;' +\n        'align-items:flex-end;' +\n        'font-size:12px;' +\n        'color:#d8dde5;' +\n        'text-align:right;';\n\n    const precoUnitario =\n        document.createElement(\n            'div'\n        );\n\n    precoUnitario.textContent =\n        'Unit\u00e1rio: ' +\n        valorPreco.toLocaleString(\n            'pt-BR',\n            {\n                style: 'currency',\n                currency: 'BRL'\n            }\n        );\n\n    precoUnitario.style.cssText =\n        'font-size:13px;' +\n        'font-weight:700;' +\n        'color:#ffffff;';\n\n    const areaQuantidade =\n        document.createElement(\n            'div'\n        );\n\n    areaQuantidade.style.cssText =\n        'display:flex;' +\n        'align-items:center;' +\n        'gap:6px;';\n\n    const labelQuantidade =\n        document.createElement(\n            'span'\n        );\n\n    labelQuantidade.textContent =\n        'Qtd.';\n\n    labelQuantidade.style.cssText =\n        'font-size:12px;' +\n        'font-weight:700;' +\n        'color:#cbd1da;';\n\n    const campoQuantidade =\n        document.createElement(\n            'input'\n        );\n\n    campoQuantidade.type =\n        'number';\n\n    campoQuantidade.min =\n        '0';\n\n    campoQuantidade.step =\n        '1';\n\n    campoQuantidade.value =\n        String(\n            quantidadeAtual\n        );\n\n    campoQuantidade.setAttribute(\n        'aria-label',\n        'Quantidade a comprar'\n    );\n\n    campoQuantidade.style.cssText =\n        'width:64px;' +\n        'height:34px;' +\n        'padding:4px 6px;' +\n        'border:1px solid #4a5360;' +\n        'border-radius:6px;' +\n        'background:#171c23;' +\n        'color:#ffffff;' +\n        'font-size:14px;' +\n        'font-weight:800;' +\n        'text-align:center;';\n\n    const subtotal =\n        document.createElement(\n            'div'\n        );\n\n    function atualizarSubtotalLinha() {\n\n        subtotal.textContent =\n            'Subtotal: ' +\n            (\n                valorPreco *\n                quantidadeAtual\n            ).toLocaleString(\n                'pt-BR',\n                {\n                    style: 'currency',\n                    currency: 'BRL'\n                }\n            );\n    }\n\n    subtotal.style.cssText =\n        'font-size:14px;' +\n        'font-weight:900;' +\n        'color:#ffffff;';\n\n    atualizarSubtotalLinha();\n\n    function aplicarQuantidadeLinha(\n        novaQuantidade\n    ) {\n\n        novaQuantidade =\n            Number(\n                novaQuantidade\n            );\n\n        if (\n            !Number.isFinite(\n                novaQuantidade\n            )\n        ) {\n            novaQuantidade =\n                0;\n        }\n\n        novaQuantidade =\n            Math.max(\n                0,\n                Math.floor(\n                    novaQuantidade\n                )\n            );\n\n        quantidadeAtual =\n            novaQuantidade;\n\n        campoQuantidade.value =\n            String(\n                novaQuantidade\n            );\n\n        item.quantidade =\n            novaQuantidade;\n\n        salvarQuantidadeOrcamentoCotafacil(\n            item.fonte || '',\n            item.item_id || '',\n            novaQuantidade\n        );\n\n        atualizarSubtotalLinha();\n\n        atualizarTotalGeralOrcamentoCotafacil();\n    }\n\n    const botaoDiminuirQuantidade =\n        document.createElement(\n            'button'\n        );\n\n    botaoDiminuirQuantidade.type =\n        'button';\n\n    botaoDiminuirQuantidade.textContent =\n        '\u2212';\n\n    botaoDiminuirQuantidade.setAttribute(\n        'aria-label',\n        'Diminuir quantidade'\n    );\n\n    botaoDiminuirQuantidade.style.cssText =\n        'width:36px;' +\n        'height:36px;' +\n        'padding:0;' +\n        'border:1px solid #4a5360;' +\n        'border-radius:6px;' +\n        'background:#252b34;' +\n        'color:#ffffff;' +\n        'font-size:22px;' +\n        'font-weight:900;' +\n        'line-height:1;' +\n        'cursor:pointer;' +\n        'touch-action:manipulation;';\n\n    const botaoAumentarQuantidade =\n        document.createElement(\n            'button'\n        );\n\n    botaoAumentarQuantidade.type =\n        'button';\n\n    botaoAumentarQuantidade.textContent =\n        '+';\n\n    botaoAumentarQuantidade.setAttribute(\n        'aria-label',\n        'Aumentar quantidade'\n    );\n\n    botaoAumentarQuantidade.style.cssText =\n        'width:36px;' +\n        'height:36px;' +\n        'padding:0;' +\n        'border:1px solid #4a5360;' +\n        'border-radius:6px;' +\n        'background:#252b34;' +\n        'color:#ffffff;' +\n        'font-size:20px;' +\n        'font-weight:900;' +\n        'line-height:1;' +\n        'cursor:pointer;' +\n        'touch-action:manipulation;';\n\n    campoQuantidade.addEventListener(\n        'change',\n        function () {\n            aplicarQuantidadeLinha(\n                campoQuantidade.value\n            );\n        }\n    );\n\n    botaoDiminuirQuantidade.addEventListener(\n        'click',\n        function () {\n            aplicarQuantidadeLinha(\n                quantidadeAtual - 1\n            );\n        }\n    );\n\n    botaoAumentarQuantidade.addEventListener(\n        'click',\n        function () {\n            aplicarQuantidadeLinha(\n                quantidadeAtual + 1\n            );\n        }\n    );\n\n    areaQuantidade.appendChild(\n        labelQuantidade\n    );\n\n    areaQuantidade.appendChild(\n        botaoDiminuirQuantidade\n    );\n\n    areaQuantidade.appendChild(\n        campoQuantidade\n    );\n\n    areaQuantidade.appendChild(\n        botaoAumentarQuantidade\n    );\n\n    preco.appendChild(\n        precoUnitario\n    );\n\n    preco.appendChild(\n        areaQuantidade\n    );\n\n    preco.appendChild(\n        subtotal\n    );\n\n    const remover =\n        document.createElement(\n            'button'\n        );\n\n    remover.type =\n        'button';\n\n    remover.textContent =\n        'Remover';\n\n    remover.style.cssText =\n        'height:38px;' +\n        'min-width:88px;' +\n        'padding:0 12px;' +\n        'border-radius:7px;' +\n        'border:1px solid #ff3838;' +\n        'background:#e10600;' +\n        'color:#ffffff;' +\n        'font-size:12px;' +\n        'font-weight:800;' +\n        'cursor:pointer;' +\n        'white-space:nowrap;' +\n        'box-shadow:0 3px 10px rgba(225,6,0,.25);';\n\n    remover.addEventListener(\n        'click',\n        function () {\n            removerItemOrcamentoCotafacil(\n                item.fonte || '',\n                item.item_id || ''\n            );\n        }\n    );\n\n    linha.appendChild(\n        imagemBoxOrcamento\n    );\n\n    linha.appendChild(\n        fonte\n    );\n\n    linha.appendChild(\n        areaProduto\n    );\n\n    linha.appendChild(\n        preco\n    );\n\n    linha.appendChild(\n        remover\n    );\n\n    return linha;\n}\n\nfunction renderizarTelaOrcamentoCotafacil() {\n\n    const lista =\n        document.getElementById(\n            'listaOrcamentoCotafacil'\n        );\n\n    const resumo =\n        document.getElementById(\n            'resumoTelaOrcamentoCotafacil'\n        );\n\n    if (!lista) {\n        return;\n    }\n\n    const itens =\n        carregarOrcamentoCotafacil();\n\n    const itensOrdenados =\n        Array.from(itens);\n\n    const ordemOrcamento =\n        window.ordemOrcamentoCotafacil ||\n        'preco_asc';\n\n    itensOrdenados.sort(\n        function (a, b) {\n\n            if (ordemOrcamento === 'nome_asc') {\n                return String(\n                    a.produto || ''\n                ).localeCompare(\n                    String(\n                        b.produto || ''\n                    ),\n                    'pt-BR'\n                );\n            }\n\n            const precoA =\n                Number(a.preco || 0);\n\n            const precoB =\n                Number(b.preco || 0);\n\n            if (ordemOrcamento === 'preco_desc') {\n                return precoB - precoA;\n            }\n\n            return precoA - precoB;\n        }\n    );\n\n    lista.innerHTML =\n        '';\n\n    if (resumo) {\n        resumo.textContent =\n            itens.length === 1\n                ? '1 item salvo'\n                : itens.length + ' itens salvos';\n    }\n\n    if (!itens.length) {\n\n        const vazio =\n            document.createElement(\n                'div'\n            );\n\n        vazio.textContent =\n            'Seu or\u00e7amento est\u00e1 vazio.';\n\n        vazio.style.cssText =\n            'padding:35px 15px;' +\n            'text-align:center;' +\n            'color:#aeb5c0;' +\n            'font-size:15px;';\n\n        lista.appendChild(\n            vazio\n        );\n\n        return;\n    }\n\n    itensOrdenados.forEach(\n        function (item) {\n            lista.appendChild(\n                criarLinhaOrcamentoCotafacil(\n                    item\n                )\n            );\n        }\n    );\n\n    const totalGeral =\n        document.createElement(\n            'div'\n        );\n\n    totalGeral.id =\n        'totalGeralOrcamentoCotafacil';\n\n    totalGeral.textContent =\n        'Total Geral: ' +\n        calcularTotalOrcamentoCotafacil(\n            itens\n        ).toLocaleString(\n            'pt-BR',\n            {\n                style: 'currency',\n                currency: 'BRL'\n            }\n        );\n\n    totalGeral.style.cssText =\n        'display:flex;' +\n        'justify-content:flex-end;' +\n        'align-items:center;' +\n        'margin-top:16px;' +\n        'padding:16px;' +\n        'border:1px solid #3a424d;' +\n        'border-radius:8px;' +\n        'background:#171c23;' +\n        'color:#ffffff;' +\n        'font-size:20px;' +\n        'font-weight:900;' +\n        'text-align:right;';\n\n    lista.appendChild(\n        totalGeral\n    );\n}\n\nasync function gerarPdfOrcamentoCotafacil() {\n\n    const botao =\n        document.getElementById(\n            'btnGerarPdfOrcamentoCotafacil'\n        );\n\n    const itensSalvos =\n        carregarOrcamentoCotafacil();\n\n    const itensPdf =\n        itensSalvos\n            .map(\n                function (item) {\n\n                    const quantidade =\n                        obterQuantidadeOrcamentoCotafacil(\n                            item\n                        );\n\n                    return {\n                        produto:\n                            item.produto || '',\n                        fonte:\n                            item.fonte || '',\n                        preco:\n                            Number(\n                                item.preco || 0\n                            ),\n                        quantidade:\n                            quantidade,\n                        link:\n                            item.link || ''\n                    };\n                }\n            )\n            .filter(\n                function (item) {\n                    return item.quantidade > 0;\n                }\n            );\n\n    if (!itensPdf.length) {\n        alert(\n            'Defina quantidade maior que zero em pelo menos um produto.'\n        );\n        return;\n    }\n\n    const textoOriginal =\n        botao\n            ? botao.textContent\n            : '';\n\n    if (botao) {\n        botao.disabled =\n            true;\n\n        botao.textContent =\n            '\u23f3 Gerando PDF...';\n\n        botao.style.opacity =\n            '0.7';\n\n        botao.style.cursor =\n            'wait';\n    }\n\n    try {\n\n        const resposta =\n            await fetch(\n                '\/ml\/pdf-cotacao',\n                {\n                    method: 'POST',\n                    headers: {\n                        'Content-Type':\n                            'application\/json'\n                    },\n                    body:\n                        JSON.stringify({\n                            tipo_documento:\n                                'orcamento',\n                            busca:\n                                'Meu Or\u00e7amento',\n                            itens:\n                                itensPdf\n                        })\n                }\n            );\n\n        if (!resposta.ok) {\n            throw new Error(\n                'Falha ao gerar PDF.'\n            );\n        }\n\n        const dados =\n            await resposta.json();\n\n        if (\n            !dados ||\n            !dados.url\n        ) {\n            throw new Error(\n                'O servidor n\u00e3o retornou o endere\u00e7o do PDF.'\n            );\n        }\n\n        const urlPdf =\n            new URL(\n                dados.url,\n                window.location.origin\n            ).href;\n\n        const janelaPdf =\n            window.open(\n                urlPdf,\n                '_blank'\n            );\n\n        if (!janelaPdf) {\n            window.location.href =\n                urlPdf;\n        }\n\n    } catch (erro) {\n\n        console.error(\n            '[COTA FACIL PDF ORCAMENTO]',\n            erro\n        );\n\n        alert(\n            'N\u00e3o foi poss\u00edvel gerar o PDF do or\u00e7amento.'\n        );\n\n    } finally {\n\n        if (botao) {\n            botao.disabled =\n                false;\n\n            botao.textContent =\n                textoOriginal ||\n                '\ud83d\udcc4 Gerar PDF';\n\n            botao.style.opacity =\n                '';\n\n            botao.style.cursor =\n                'pointer';\n        }\n    }\n}\n\nfunction abrirTelaOrcamentoCotafacil() {\n\n    const modal =\n        document.getElementById(\n            'modalOrcamentoCotafacil'\n        );\n\n    if (!modal) {\n        return;\n    }\n\n    \/*\n     * O modal precisa ficar diretamente no BODY.\n     * Assim ele n\u00e3o fica limitado pela largura\n     * do container principal do WordPress\/Cota F\u00e1cil.\n     *\/\n    if (\n        modal.parentElement !==\n        document.body\n    ) {\n        document.body.appendChild(\n            modal\n        );\n    }\n\n    modal.style.position =\n        'fixed';\n\n    modal.style.left =\n        '0';\n\n    modal.style.top =\n        '0';\n\n    modal.style.width =\n        '100vw';\n\n    modal.style.height =\n        '100vh';\n\n    modal.style.maxWidth =\n        'none';\n\n    modal.style.boxSizing =\n        'border-box';\n\n    modal.style.zIndex =\n        '999999';\n\n    renderizarTelaOrcamentoCotafacil();\n\n    modal.style.display =\n        'block';\n}\n\ndocument.addEventListener(\n    'DOMContentLoaded',\n    function () {\n        atualizarContadorOrcamento();\n\n        const btnAdicionar =\n            document.getElementById(\n                'btnAdicionarOrcamento'\n            );\n\n        if (btnAdicionar) {\n            btnAdicionar.addEventListener(\n                'click',\n                adicionarMarcadosAoOrcamento\n            );\n        }\n\n        const btnVer =\n            document.getElementById(\n                'btnVerOrcamento'\n            );\n\n        if (btnVer) {\n            btnVer.addEventListener(\n                'click',\n                abrirTelaOrcamentoCotafacil\n            );\n        }\n\n        const btnTopo =\n            document.getElementById(\n                'btnTopoOrcamentoCotafacil'\n            );\n\n        if (btnTopo) {\n            btnTopo.addEventListener(\n                'click',\n                abrirTelaOrcamentoCotafacil\n            );\n        }\n\n        const btnFechar =\n            document.getElementById(\n                'fecharOrcamentoCotafacil'\n            );\n\n        if (btnFechar) {\n            btnFechar.addEventListener(\n                'click',\n                fecharTelaOrcamentoCotafacil\n            );\n        }\n\n        const btnGerarPdfOrcamento =\n            document.getElementById(\n                'btnGerarPdfOrcamentoCotafacil'\n            );\n\n        if (btnGerarPdfOrcamento) {\n            btnGerarPdfOrcamento.addEventListener(\n                'click',\n                gerarPdfOrcamentoCotafacil\n            );\n        }\n\n        const btnSairOrcamento =\n            document.getElementById(\n                'btnSairOrcamentoCotafacil'\n            );\n\n        if (btnSairOrcamento) {\n            btnSairOrcamento.addEventListener(\n                'click',\n                fecharTelaOrcamentoCotafacil\n            );\n        }\n\n        const botoesOrdemOrcamento =\n            document.querySelectorAll(\n                '.cotafacil-ordem-orcamento'\n            );\n\n        window.ordemOrcamentoCotafacil =\n            window.ordemOrcamentoCotafacil ||\n            'preco_asc';\n\n        function destacarOrdemOrcamentoCotafacil() {\n            botoesOrdemOrcamento.forEach(\n                function (botao) {\n                    const ativo =\n                        botao.dataset.ordem ===\n                        window.ordemOrcamentoCotafacil;\n\n                    botao.style.background =\n                        ativo ? '#ffe600' : '#171c24';\n\n                    botao.style.color =\n                        ativo ? '#000000' : '#ffffff';\n\n                    botao.style.border =\n                        ativo\n                            ? '2px solid #ffe600'\n                            : '1px solid #4a5360';\n\n                    botao.style.fontWeight =\n                        ativo ? '900' : '700';\n\n                    botao.style.padding =\n                        '7px 10px';\n\n                    botao.style.borderRadius =\n                        '6px';\n\n                    botao.style.cursor =\n                        'pointer';\n                }\n            );\n        }\n\n        botoesOrdemOrcamento.forEach(\n            function (botao) {\n                botao.addEventListener(\n                    'click',\n                    function () {\n                        window.ordemOrcamentoCotafacil =\n                            botao.dataset.ordem;\n\n                        destacarOrdemOrcamentoCotafacil();\n                        renderizarTelaOrcamentoCotafacil();\n                    }\n                );\n            }\n        );\n\n        destacarOrdemOrcamentoCotafacil();\n\n        const modalOrcamento =\n            document.getElementById(\n                'modalOrcamentoCotafacil'\n            );\n\n        if (modalOrcamento) {\n            modalOrcamento.addEventListener(\n                'click',\n                function (event) {\n                    if (\n                        event.target ===\n                        modalOrcamento\n                    ) {\n                        fecharTelaOrcamentoCotafacil();\n                    }\n                }\n            );\n        }\n    }\n);\n\n<\/script>\n\n\n\n<style>\n\n\/* ============================================================\n   AJUSTE STICKY PRECO COMPARAVEL ORCAMENTO 2026\n   ============================================================ *\/\n\n\n\/* ------------------------------------------------------------\n   FUNDO GERAL\n   Remove a faixa branca externa do WordPress\n   ------------------------------------------------------------ *\/\n\nhtml,\nbody,\n.wp-site-blocks,\n.entry-content,\n.wp-block-post-content {\n    background: #080a0d !important;\n}\n\nhtml,\nbody {\n    overflow-x: hidden !important;\n}\n\n\n\/* ------------------------------------------------------------\n   PRECO COMPARAVEL\n   Informa\u00e7\u00e3o principal da compara\u00e7\u00e3o\n   ------------------------------------------------------------ *\/\n\n.cotafacil-preco-comparavel {\n    display: inline-flex !important;\n    align-items: center !important;\n\n    width: fit-content !important;\n    max-width: 100% !important;\n\n    margin-top: 7px !important;\n    padding: 5px 9px !important;\n\n    background:\n        linear-gradient(\n            135deg,\n            #e10600,\n            #a90000\n        ) !important;\n\n    border:\n        1px solid #ff3838 !important;\n\n    border-radius:\n        6px !important;\n\n    color:\n        #ffffff !important;\n\n    font-size:\n        13px !important;\n\n    font-weight:\n        800 !important;\n\n    line-height:\n        1.2 !important;\n\n    box-shadow:\n        0 3px 10px\n        rgba(225, 6, 0, .22) !important;\n}\n\n\n\/* ------------------------------------------------------------\n   FILTRO DESKTOP\n   O painel acompanha a rolagem da p\u00e1gina.\n   Somente as listas de palavras mant\u00eam rolagem pr\u00f3pria.\n   ------------------------------------------------------------ *\/\n\n@media (min-width: 901px) {\n\n    #areaResultadosCotacao {\n        overflow:\n            visible !important;\n    }\n\n    #controlesOrdenacao {\n        position:\n            sticky !important;\n\n        top:\n            16px !important;\n\n        align-self:\n            start !important;\n\n        max-height:\n            none !important;\n\n        height:\n            auto !important;\n\n        overflow:\n            visible !important;\n\n        scrollbar-width:\n            none !important;\n    }\n\n    #controlesOrdenacao::-webkit-scrollbar {\n        display:\n            none !important;\n    }\n\n    #listaPalavrasTituloCotafacil,\n    #listaPalavrasExcluiTituloCotafacil {\n        max-height:\n            150px !important;\n\n        overflow-y:\n            auto !important;\n\n        overflow-x:\n            hidden !important;\n    }\n\n    #listaResultadosCotacao {\n        overflow:\n            visible !important;\n    }\n}\n\n\n\/* ------------------------------------------------------------\n   CONTADOR SUPERIOR DO ORCAMENTO\n   ------------------------------------------------------------ *\/\n\n#contadorTopoCotafacil {\n    display:\n        inline-flex;\n\n    align-items:\n        center;\n\n    justify-content:\n        center;\n\n    min-width:\n        20px;\n\n    height:\n        20px;\n\n    margin-left:\n        5px;\n\n    padding:\n        0 5px;\n\n    box-sizing:\n        border-box;\n\n    border-radius:\n        999px;\n\n    background:\n        #e10600;\n\n    color:\n        #ffffff;\n\n    font-size:\n        11px;\n\n    font-weight:\n        800;\n}\n\n\n\/* ------------------------------------------------------------\n   MOBILE\n   ------------------------------------------------------------ *\/\n\n@media (max-width: 900px) {\n\n    #controlesOrdenacao {\n        position:\n            static !important;\n\n        max-height:\n            none !important;\n\n        overflow:\n            visible !important;\n    }\n\n    .cotafacil-preco-comparavel {\n        font-size:\n            12px !important;\n    }\n}\n\n<\/style>\n\n\n\n\n\n\n\n\n<style>\n\n\/* ============================================================\n   AJUSTE FINAL STICKY FILTROS + REMOCAO FAIXA LATERAL\n   ============================================================ *\/\n\n@media (min-width: 901px) {\n\n    #controlesOrdenacao {\n        position: sticky !important;\n        top: 16px !important;\n\n        max-height: calc(100vh - 32px) !important;\n\n        overflow-y: auto !important;\n        overflow-x: hidden !important;\n\n        scrollbar-width: thin !important;\n        scrollbar-color: #ffffff transparent !important;\n\n        background-clip: padding-box;\n    }\n\n    #controlesOrdenacao::-webkit-scrollbar {\n        width: 7px !important;\n    }\n\n    #controlesOrdenacao::-webkit-scrollbar-track {\n        background: transparent !important;\n    }\n\n    #controlesOrdenacao::-webkit-scrollbar-thumb {\n        background: #ffffff !important;\n        border-radius: 8px !important;\n        border: 0 !important;\n    }\n\n    \/* Remove espa\u00e7o\/faixa extra no lado direito *\/\n    #areaResultadosCotacao {\n        overflow: visible !important;\n    }\n\n    #listaResultadosCotacao {\n        overflow: visible !important;\n        padding-right: 0 !important;\n        margin-right: 0 !important;\n    }\n\n    .painel-pesquisa-container {\n        overflow-x: hidden !important;\n    }\n\n    body,\n    html {\n        overflow-x: hidden !important;\n    }\n}\n\n<\/style>\n\n<style>\n\n\/* ============================================================\n   COTA FACIL - STICKY FILTROS DEFINITIVO 2026\n   Remove ancestrais que bloqueiam position:sticky\n   ============================================================ *\/\n\n@media (min-width: 901px) {\n\n    html,\n    body {\n        overflow-x: clip !important;\n        overflow-y: visible !important;\n    }\n\n    .wp-site-blocks {\n        overflow-x: clip !important;\n        overflow-y: visible !important;\n    }\n\n    .entry-content,\n    .wp-block-post-content,\n    .painel-pesquisa-container,\n    #areaResultadosCotacao {\n        overflow: visible !important;\n    }\n\n    #controlesOrdenacao {\n        position: sticky !important;\n        top: 16px !important;\n        align-self: start !important;\n\n        max-height: none !important;\n        height: auto !important;\n\n        overflow: visible !important;\n    }\n\n    body.admin-bar #controlesOrdenacao {\n        top: 48px !important;\n    }\n\n    #listaPalavrasTituloCotafacil,\n    #listaPalavrasExcluiTituloCotafacil {\n        max-height: 150px !important;\n        overflow-y: auto !important;\n        overflow-x: hidden !important;\n    }\n}\n\n<\/style>\n\n<style>\n\n\/* ============================================================\n   COTA FACIL - ORCAMENTO DENTRO DO FILTRO 2026\n   ============================================================ *\/\n\n@media (min-width: 901px) {\n\n    #controlesOrdenacao {\n        gap: 7px !important;\n        padding: 12px !important;\n    }\n\n    #controlesOrdenacao > div {\n        margin-top: 0 !important;\n        margin-bottom: 0 !important;\n    }\n\n    #controlesOrdenacao label {\n        margin-bottom: 3px !important;\n        font-size: 12px !important;\n        line-height: 1.2 !important;\n    }\n\n    #controlesOrdenacao input[type=\"text\"],\n    #controlesOrdenacao select {\n        min-height: 34px !important;\n        height: 34px !important;\n        padding-top: 4px !important;\n        padding-bottom: 4px !important;\n        font-size: 12px !important;\n    }\n\n    #listaPalavrasTituloCotafacil,\n    #listaPalavrasExcluiTituloCotafacil {\n        max-height: 105px !important;\n    }\n\n    #listaPalavrasTituloCotafacil label,\n    #listaPalavrasExcluiTituloCotafacil label {\n        min-height: 23px !important;\n        padding: 1px 3px !important;\n        font-size: 12px !important;\n    }\n\n    .cotafacil-acoes-orcamento-filtro {\n        display: grid !important;\n        grid-template-columns: 1fr !important;\n        gap: 7px !important;\n\n        width: 100% !important;\n        margin-top: 5px !important;\n        padding-top: 10px !important;\n\n        border-top:\n            1px solid #303743 !important;\n    }\n\n    .cotafacil-acoes-orcamento-filtro button {\n        width: 100% !important;\n        min-height: 38px !important;\n        margin: 0 !important;\n        padding: 7px 10px !important;\n\n        border-radius: 6px !important;\n\n        font-size: 12px !important;\n        font-weight: 800 !important;\n        line-height: 1.15 !important;\n    }\n\n    #btnAdicionarOrcamento {\n        background:\n            #e10600 !important;\n\n        color:\n            #ffffff !important;\n\n        border:\n            1px solid #e10600 !important;\n    }\n\n    #btnAdicionarOrcamento:disabled {\n        background:\n            #65100e !important;\n\n        border-color:\n            #65100e !important;\n\n        color:\n            #a9adb4 !important;\n\n        opacity:\n            .75 !important;\n    }\n\n    #btnVerOrcamento {\n        background:\n            #11161d !important;\n\n        color:\n            #ffffff !important;\n\n        border:\n            1px solid #e10600 !important;\n    }\n\n    #btnVerOrcamento:disabled {\n        color:\n            #777f89 !important;\n\n        border-color:\n            #5b2020 !important;\n\n        opacity:\n            .7 !important;\n    }\n}\n\n<\/style>\n\n<script>\n\n\/* ============================================================\n   COTA FACIL - MOVE ACOES DO ORCAMENTO PARA O FILTRO\n   ============================================================ *\/\n\ndocument.addEventListener(\n    'DOMContentLoaded',\n    function () {\n\n        const filtros =\n            document.getElementById(\n                'controlesOrdenacao'\n            );\n\n        const btnAdicionar =\n            document.getElementById(\n                'btnAdicionarOrcamento'\n            );\n\n        const btnVer =\n            document.getElementById(\n                'btnVerOrcamento'\n            );\n\n        if (!filtros) {\n            return;\n        }\n\n        if (!btnAdicionar) {\n            return;\n        }\n\n        if (!btnVer) {\n            return;\n        }\n\n        let caixa =\n            document.querySelector(\n                '.cotafacil-acoes-orcamento-filtro'\n            );\n\n        if (!caixa) {\n\n            caixa =\n                document.createElement(\n                    'div'\n                );\n\n            caixa.className =\n                'cotafacil-acoes-orcamento-filtro';\n\n            filtros.appendChild(\n                caixa\n            );\n        }\n\n        caixa.appendChild(\n            btnAdicionar\n        );\n\n        caixa.appendChild(\n            btnVer\n        );\n    }\n);\n\n<\/script>\n\n\n<style>\n\n\/* ============================================================\n   COTA FACIL - FILTRO COMPACTO FINAL 2026\n   Mantem sticky e libera espaco para o orcamento\n   ============================================================ *\/\n\n@media (min-width: 901px) {\n\n    #controlesOrdenacao {\n        padding: 9px 11px !important;\n        gap: 4px !important;\n        font-size: 12px !important;\n    }\n\n    #controlesOrdenacao > div {\n        margin-top: 0 !important;\n        margin-bottom: 0 !important;\n    }\n\n    #controlesOrdenacao label {\n        margin-top: 0 !important;\n        margin-bottom: 2px !important;\n        line-height: 1.1 !important;\n        font-size: 11px !important;\n    }\n\n    #controlesOrdenacao input[type=\"text\"],\n    #controlesOrdenacao input[type=\"number\"],\n    #controlesOrdenacao select {\n        min-height: 28px !important;\n        height: 28px !important;\n        padding: 2px 7px !important;\n        font-size: 11px !important;\n        line-height: 1 !important;\n    }\n\n    #listaPalavrasTituloCotafacil,\n    #listaPalavrasExcluiTituloCotafacil {\n        max-height: 72px !important;\n        overflow-y: auto !important;\n        overflow-x: hidden !important;\n    }\n\n    #listaPalavrasTituloCotafacil label,\n    #listaPalavrasExcluiTituloCotafacil label {\n        min-height: 19px !important;\n        padding: 0 2px !important;\n        margin: 0 !important;\n        font-size: 11px !important;\n        line-height: 1.05 !important;\n    }\n\n    #controlesOrdenacao input[type=\"checkbox\"] {\n        width: 14px !important;\n        height: 14px !important;\n        min-width: 14px !important;\n        min-height: 14px !important;\n        flex: 0 0 14px !important;\n        margin-right: 4px !important;\n    }\n\n    .cotafacil-acoes-orcamento-filtro {\n        gap: 5px !important;\n        margin-top: 3px !important;\n        padding-top: 6px !important;\n    }\n\n    .cotafacil-acoes-orcamento-filtro button {\n        min-height: 32px !important;\n        height: 32px !important;\n        padding: 4px 8px !important;\n        font-size: 11px !important;\n    }\n}\n\n<\/style>\n\n<style>\n\n\/* ============================================================\n   COTA FACIL - FILTROS COM SCROLL + ORCAMENTO FIXO 2026\n   ============================================================ *\/\n\n@media (min-width: 901px) {\n\n    #controlesOrdenacao {\n        display: flex !important;\n        flex-direction: column !important;\n\n        max-height: calc(100vh - 64px) !important;\n        height: auto !important;\n\n        overflow: hidden !important;\n    }\n\n    body.admin-bar #controlesOrdenacao {\n        max-height: calc(100vh - 96px) !important;\n    }\n\n    .cotafacil-filtros-scroll {\n        flex: 1 1 auto !important;\n        min-height: 0 !important;\n\n        overflow-y: auto !important;\n        overflow-x: hidden !important;\n\n        padding-right: 4px !important;\n\n        scrollbar-width: thin !important;\n        scrollbar-color: #ffffff #151a21 !important;\n    }\n\n    .cotafacil-filtros-scroll::-webkit-scrollbar {\n        width: 6px !important;\n    }\n\n    .cotafacil-filtros-scroll::-webkit-scrollbar-track {\n        background: #151a21 !important;\n    }\n\n    .cotafacil-filtros-scroll::-webkit-scrollbar-thumb {\n        background: #ffffff !important;\n        border-radius: 8px !important;\n    }\n\n    .cotafacil-acoes-orcamento-filtro {\n        flex: 0 0 auto !important;\n\n        width: 100% !important;\n\n        margin: 6px 0 0 !important;\n        padding: 7px 0 0 !important;\n\n        background: #10151c !important;\n        border-top: 1px solid #303743 !important;\n\n        z-index: 5 !important;\n    }\n}\n\n\n\/* ------------------------------------------------------------\n   MOBILE\n   ------------------------------------------------------------ *\/\n\n@media (max-width: 900px) {\n\n    .cotafacil-filtros-scroll {\n        overflow: visible !important;\n    }\n\n}\n\n<\/style>\n\n<script>\n\n\/* ============================================================\n   COTA FACIL - SEPARA FILTROS DAS ACOES DO ORCAMENTO\n   ============================================================ *\/\n\ndocument.addEventListener(\n    'DOMContentLoaded',\n    function () {\n\n        const filtros =\n            document.getElementById(\n                'controlesOrdenacao'\n            );\n\n        if (!filtros) {\n            return;\n        }\n\n        let areaScroll =\n            filtros.querySelector(\n                '.cotafacil-filtros-scroll'\n            );\n\n        if (areaScroll) {\n            return;\n        }\n\n        const caixaOrcamento =\n            filtros.querySelector(\n                '.cotafacil-acoes-orcamento-filtro'\n            );\n\n        if (!caixaOrcamento) {\n            return;\n        }\n\n        areaScroll =\n            document.createElement(\n                'div'\n            );\n\n        areaScroll.className =\n            'cotafacil-filtros-scroll';\n\n        const filhos =\n            Array.from(\n                filtros.children\n            );\n\n        filhos.forEach(\n            function (filho) {\n\n                if (\n                    filho !==\n                    caixaOrcamento\n                ) {\n                    areaScroll.appendChild(\n                        filho\n                    );\n                }\n            }\n        );\n\n        filtros.insertBefore(\n            areaScroll,\n            caixaOrcamento\n        );\n    }\n);\n\n<\/script>\n\n<script>\n\n\/* ============================================================\n   COTA FACIL - VISUAL DESKTOP AUTOMATICO NO CELULAR 2026\n   ============================================================ *\/\n\n(function () {\n\n    const larguraFisica =\n        Math.min(\n            window.screen.width,\n            window.screen.height\n        );\n\n    if (larguraFisica > 900) {\n        return;\n    }\n\n    let viewport =\n        document.querySelector(\n            'meta[name=\"viewport\"]'\n        );\n\n    if (!viewport) {\n\n        viewport =\n            document.createElement(\n                'meta'\n            );\n\n        viewport.setAttribute(\n            'name',\n            'viewport'\n        );\n\n        document.head.appendChild(\n            viewport\n        );\n    }\n\n    viewport.setAttribute(\n        'content',\n        'width=1180, user-scalable=yes'\n    );\n\n})();\n\n<\/script>\n\n\n<style>\n\/* COTA FACIL - USUARIOS ONLINE *\/\n.cotafacil-usuarios-online {\n    margin-top:5px;\n    font-size:12px;\n    font-weight:600;\n    color:#4b5563;\n    line-height:1.3;\n}\n\n.cotafacil-online-ponto {\n    color:#22c55e;\n    font-size:11px;\n    margin-right:3px;\n}\n<\/style>\n\n<script>\n\/* COTA FACIL - ATUALIZACAO USUARIOS ONLINE *\/\n(function () {\n    const caixa = document.getElementById('cotafacilUsuariosOnline');\n    const texto = document.getElementById('cotafacilUsuariosOnlineTexto');\n\n    if (!caixa || !texto) {\n        return;\n    }\n\n    async function atualizarUsuariosOnline() {\n        try {\n            const resposta = await fetch(\n                '\/wp-admin\/admin-ajax.php?action=cotafacil_usuarios_online',\n                {\n                    credentials: 'same-origin',\n                    cache: 'no-store'\n                }\n            );\n\n            const dados = await resposta.json();\n\n            if (!dados.success || !dados.data) {\n                return;\n            }\n\n            const online = Number(dados.data.online) || 0;\n\n            if (online < 1) {\n                caixa.style.display = 'none';\n                return;\n            }\n\n            texto.textContent =\n                online === 1\n                    ? '1 usu\u00e1rio online agora'\n                    : online + ' usu\u00e1rios online agora';\n\n            caixa.style.display = 'block';\n\n        } catch (erro) {\n            console.warn('COTA FACIL: contador online indisponivel');\n        }\n    }\n\n    atualizarUsuariosOnline();\n\n    setInterval(\n        atualizarUsuariosOnline,\n        60000\n    );\n})();\n<\/script>\n\n\n<script>\n\/* COTAFACIL_CONTADORES_AUTOMATICOS_V1 *\/\n(function () {\n    const saldo = document.getElementById('cotafacilPesquisasRestantes');\n    const saldoLegenda = document.getElementById('cotafacilPesquisasLegenda');\n    const relogio = document.getElementById('cotafacilRelogioPlano');\n    const planoLegenda = document.getElementById('cotafacilPlanoLegenda');\n\n    if (!saldo || !saldoLegenda || !relogio || !planoLegenda) return;\n\n    const vencimentoBrasilia = document.getElementById('cotafacilVencimentoBrasilia');\n\n    function formatarVencimentoBrasilia(timestamp) {\n        const data = new Date(timestamp * 1000);\n        const formatador = new Intl.DateTimeFormat('pt-BR', {\n            timeZone: 'Etc\/GMT+3',\n            day: '2-digit',\n            month: '2-digit',\n            year: 'numeric',\n            hour: '2-digit',\n            minute: '2-digit',\n            second: '2-digit',\n            hourCycle: 'h23'\n        });\n        return formatador.format(data).replace(',', ' \u00e0s') + ' (UTC\u22123)';\n    }\n\n    let vencimento = 0;\n    let diferencaServidor = 0;\n    let consultaConcluida = false;\n\n    function atualizarRelogio() {\n        if (!consultaConcluida) return;\n\n        const agora = Math.floor(Date.now() \/ 1000) + diferencaServidor;\n        const restante = Math.max(0, vencimento - agora);\n\n        if (restante <= 0) {\n            relogio.textContent = '00:00:00';\n            planoLegenda.textContent = 'SEM PLANO ATIVO';\n            return;\n        }\n\n        const dias = Math.floor(restante \/ 86400);\n        const horas = Math.floor((restante % 86400) \/ 3600);\n        const minutos = Math.floor((restante % 3600) \/ 60);\n        const segundos = restante % 60;\n        const dois = n => String(n).padStart(2, '0');\n\n        relogio.textContent =\n            dias + 'd ' + dois(horas) + ':' +\n            dois(minutos) + ':' + dois(segundos);\n\n        planoLegenda.textContent = 'PESQUISAS ILIMITADAS';\n    }\n\n    async function consultarContadores() {\n        try {\n            let nonceRest = window.cotafacilNonceRest || '';\n\n            if (!nonceRest) {\n                for (let tentativa = 0; tentativa < 20; tentativa++) {\n                    await new Promise(resolve => setTimeout(resolve, 500));\n                    nonceRest = window.cotafacilNonceRest || '';\n                    if (nonceRest) break;\n                }\n            }\n\n            if (!nonceRest) {\n                throw new Error('Nonce REST indisponivel');\n            }\n\n            const resposta = await fetch('\/wp-json\/cotafacil\/v1\/meu-plano', {\n                credentials: 'same-origin',\n                cache: 'no-store',\n                headers: {\n                    'X-WP-Nonce': nonceRest\n                }\n            });\n\n            if (!resposta.ok) throw new Error('HTTP ' + resposta.status);\n\n            const dados = await resposta.json();\n\n            if (!dados.ok ||\n                !Number.isFinite(Number(dados.pesquisas_gratis_restantes))) {\n                throw new Error('Saldo indisponivel');\n            }\n\n            saldo.textContent = String(dados.pesquisas_gratis_restantes);\n            saldoLegenda.textContent =\n                'de ' + dados.pesquisas_gratis_total + ' dispon\u00edveis';\n\n            diferencaServidor =\n                Number(dados.servidor_agora) - Math.floor(Date.now() \/ 1000);\n\n            vencimento = Number(dados.plano_vencimento) || 0;\n            consultaConcluida = true;\n\n            if (vencimentoBrasilia) {\n                vencimentoBrasilia.textContent = vencimento > 0\n                    ? 'Vencimento: ' + formatarVencimentoBrasilia(vencimento)\n                    : 'Nenhum plano contratado';\n            }\n\n            atualizarRelogio();\n\n        } catch (erro) {\n            saldoLegenda.textContent = 'Consulta indispon\u00edvel';\n            if (!consultaConcluida) {\n                planoLegenda.textContent = 'Consulta indispon\u00edvel';\n            }\n        }\n    }\n\n    consultarContadores();\n    setInterval(atualizarRelogio, 1000);\n    setInterval(consultarContadores, 60000);\n})();\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"blank","meta":{"footnotes":""},"class_list":["post-8","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/cotafacil.zapto.org\/index.php\/wp-json\/wp\/v2\/pages\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cotafacil.zapto.org\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/cotafacil.zapto.org\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/cotafacil.zapto.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cotafacil.zapto.org\/index.php\/wp-json\/wp\/v2\/comments?post=8"}],"version-history":[{"count":2,"href":"https:\/\/cotafacil.zapto.org\/index.php\/wp-json\/wp\/v2\/pages\/8\/revisions"}],"predecessor-version":[{"id":12,"href":"https:\/\/cotafacil.zapto.org\/index.php\/wp-json\/wp\/v2\/pages\/8\/revisions\/12"}],"wp:attachment":[{"href":"https:\/\/cotafacil.zapto.org\/index.php\/wp-json\/wp\/v2\/media?parent=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}