* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f3f4f6;
    color: #1f2937;
}

/* ===== Menu superior ===== */
.topbar {
    background: #1c1c1c;
    color: #fff;
    padding: 18px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    border-bottom: 3px solid #2DB86C;
    position: relative;
}
.topbar-marca { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo-topbar { height: 52px; width: auto; display: block; flex-shrink: 0; }
.topbar-titulo {
    font-weight: 600;
    color: #d1d5db;
    font-size: 14px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
}

/* Links em linha (telas largas): texto puro, sem caixinha, com risco verde
   embaixo que anima ao passar o mouse — mesmo padrão do menu do site */
.topbar-links-desktop { display: flex; align-items: center; flex-wrap: wrap; gap: 30px; }
.topbar-usuario { color: #9ca3af; font-size: 13px; margin-right: 6px; }
.link-topbar {
    color: #d1d5db;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    white-space: nowrap;
    position: relative;
    padding: 4px 0;
    transition: color .2s;
}
.link-topbar::after {
    content: '';
    position: absolute;
    left: 0; bottom: 0;
    width: 0; height: 2px;
    background: #2DB86C;
    transition: width .25s cubic-bezier(.22,.61,.36,1);
}
.link-topbar:hover, .link-topbar:active { color: #fff; }
.link-topbar:hover::after, .link-topbar:active::after { width: 100%; }

/* Botão hambúrguer (3 linhas -> vira "X" quando aberto) — mesma animação do site */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 26px;
    height: 26px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 200;
}
.menu-toggle span {
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform .3s cubic-bezier(.22,.61,.36,1), opacity .3s cubic-bezier(.22,.61,.36,1);
}
.menu-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Fundo escurecido atrás do painel lateral */
.menu-backdrop {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
    z-index: 140;
}
.menu-backdrop.aberto { opacity: 1; pointer-events: auto; }

/* Painel lateral deslizando da direita — texto puro + risco verde animado
   embaixo ao passar o dedo/mouse, igual ao menu do site institucional */
.mobile-nav {
    position: fixed;
    top: 0;
    right: 0;
    width: min(78vw, 300px);
    height: 100vh;
    height: 100dvh;
    background: #1c1c1c;
    border-left: 1px solid rgba(255,255,255,0.08);
    transform: translateX(100%);
    transition: transform .35s cubic-bezier(.22,.61,.36,1);
    z-index: 150;
    padding: 90px 30px 30px;
    overflow-y: auto;
}
.mobile-nav.aberto { transform: translateX(0); }
.mobile-nav-usuario { color: #7381a3; font-size: 13px; margin: 0 0 22px; }
.mobile-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 24px; }
.mobile-nav a {
    display: inline-block;
    font-size: 17px;
    font-weight: 500;
    color: #d1d5db;
    text-decoration: none;
    position: relative;
    padding: 3px 0;
    transition: color .2s;
}
.mobile-nav a::after {
    content: '';
    position: absolute;
    left: 0; bottom: -2px;
    width: 0; height: 2px;
    background: #2DB86C;
    transition: width .25s cubic-bezier(.22,.61,.36,1);
}
.mobile-nav a:hover, .mobile-nav a:active { color: #fff; }
.mobile-nav a:hover::after, .mobile-nav a:active::after { width: 100%; }

@media (max-width: 700px) {
    .topbar-links-desktop { display: none; }
    .menu-toggle { display: flex; margin-top: 7px; }

    /* Logo e hambúrguer sempre na primeira linha; o texto ao lado da logo
       (ex.: número do RAT) sempre cai numa segunda linha, abaixo só da logo.
       Usamos flex-direction:column (comportamento fixo) em vez de flex-wrap
       (que depende do tamanho do texto e podia "confundir" o navegador na
       hora de decidir se o botão hambúrguer cabia na mesma linha). */
    .topbar { align-items: flex-start; }
    .logo-topbar { height: 40px; }
    .topbar-marca {
        flex: 1 1 0;
        min-width: 0;
        flex-direction: column;
        align-items: flex-start;
        row-gap: 4px;
    }
    .topbar-titulo {
        align-self: stretch;
        white-space: normal;
        font-size: 12.5px;
    }
}


.logo-login { height: 76px; width: auto; display: block; margin: 0 auto 14px; }

/* ===== Layout geral ===== */
.container {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 14px 60px;
}

h2 {
    margin-top: 24px;
    font-size: 19px;
    border-bottom: 2px solid #1f2937;
    padding-bottom: 6px;
}

form {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.folha-relatorio {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    padding: 0;
}

.info-interna {
    color: #6b7280;
    font-size: 13px;
    margin: 0 0 14px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 20px;
}
@media (max-width: 640px) {
    .grid-2 { grid-template-columns: 1fr; gap: 12px; }
    .container { padding: 0 10px 50px; }
    form { padding: 16px; }
    h2 { font-size: 17px; }
}

.campo { display: flex; flex-direction: column; margin-bottom: 10px; min-width: 0; }
.campo-full { grid-column: 1 / -1; }

label { font-weight: 600; margin-bottom: 4px; font-size: 14px; }

/* font-size 16px evita zoom automático em iPhone ao focar campos */
input, textarea, select {
    padding: 11px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px;
    width: 100%;
    font-family: inherit;
    background: #fff;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #2DB86C;
    box-shadow: 0 0 0 3px rgba(45, 184, 108, 0.15);
}

.ajuda { color: #6b7280; font-size: 14px; }

.link-voltar {
    display: inline-block;
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    margin: 18px 0 12px;
}
.link-voltar:hover { color: #1a7f43; text-decoration: underline; }

/* ===== Seletor de hora (hora + minuto em dois <select>, no lugar do <input type="time">
   nativo, que em vários celulares Android abre um seletor cortado/cuja opção "Definir"
   fica fora da tela) ===== */
.seletor-hora { display: flex; align-items: center; gap: 6px; }
.seletor-hora select { flex: 1 1 0; min-width: 0; text-align: center; }
.seletor-hora-dois-pontos { font-weight: 700; color: #6b7280; }

.assinatura-wrapper {
    border: 2px dashed #9ca3af;
    border-radius: 8px;
    background: #fff;
    margin-bottom: 10px;
    touch-action: none;
}
#canvasAssinatura {
    width: 100%;
    height: 200px;
    touch-action: none;
    display: block;
}
@media (max-width: 480px) {
    #canvasAssinatura { height: 160px; }
}

/* ===== Botões ===== */
.btn-primario, .btn-secundario, .btn-perigo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 15px;
    font-family: inherit;
    text-decoration: none;
    border: none;
    cursor: pointer;
    text-align: center;
    min-height: 44px;
    line-height: 20px;
}
.btn-primario { background: #2DB86C; color: #fff; }
.btn-primario:hover { background: #24a05b; }
.btn-secundario { background: #e5e7eb; color: #1f2937; margin-left: 8px; }
.btn-secundario:hover { background: #d1d5db; }
.btn-perigo { background: #fdeaea; color: #b3261e; margin-left: 8px; }
.btn-perigo:hover { background: #fbd5d5; }

/* Ícone SVG padrão (mesmo traço/peso) usado em todos os botões de ação:
   Ver, Editar, Excluir e Imprimir — substitui os emojis, que ficavam
   despadronizados entre aparelhos. */
.icone-acao { width: 17px; height: 17px; flex-shrink: 0; }

.acoes-form { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.acoes-form .btn-secundario, .acoes-form .btn-perigo { margin-left: 0; }

@media (max-width: 480px) {
    .acoes-form { flex-direction: column; }
    .acoes-form a, .acoes-form button { width: 100%; margin-left: 0 !important; }
}

.alerta {
    padding: 12px 16px;
    border-radius: 6px;
    margin: 14px 0;
    font-size: 14px;
}
.alerta-erro { background: #fee2e2; color: #991b1b; }
.alerta-sucesso { background: #dcfce7; color: #166534; }

/* ===== Login ===== */
.pagina-login {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    gap: 18px;
}
.login-copyright { color: #9ca3af; font-size: 12.5px; text-align: center; margin: 0; }
.caixa-login {
    background: #fff;
    padding: 36px 28px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 360px;
}
.caixa-login h1 { margin: 0 0 4px; font-size: 22px; }
.subtitulo { color: #6b7280; margin-top: 0; margin-bottom: 20px; text-align: center; font-size: 14px; }
.caixa-login label { margin-top: 10px; }
.caixa-login button { margin-top: 18px; width: 100%; }

/* ===== Busca ===== */
.busca-form { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.busca-form input { flex: 1 1 220px; }
.busca-form select { flex: 1 1 auto; width: auto; }
.busca-form button { flex: 0 0 auto; }
@media (max-width: 560px) {
    .busca-form { flex-direction: column; }
    .busca-form input, .busca-form select, .busca-form button { flex: 1 1 auto; width: 100%; }
}

/* ===== Tabela de relatórios / usuários ===== */
.tabela-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
.tabela-relatorios {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}
.tabela-relatorios th, .tabela-relatorios td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    font-size: 14px;
}
.tabela-relatorios th { background: #f9fafb; }
.tabela-relatorios tr:last-child td { border-bottom: none; }
.link-tabela { color: #1a7f43; font-weight: 600; text-decoration: none; }

.celula-acoes { white-space: nowrap; }
.form-acao-inline {
    display: inline-block;
    margin: 0;
    background: none;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}
.btn-acao {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    margin-right: 6px;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.btn-acao-ver { background: #e6f7ed; color: #1a7f43; }
.btn-acao-ver:hover { background: #cdf0dc; }
.btn-acao-editar { background: #eef2ff; color: #4338ca; }
.btn-acao-editar:hover { background: #e0e7ff; }
.btn-acao-excluir { background: #fdeaea; color: #b3261e; }
.btn-acao-excluir:hover { background: #fbd5d5; }

/* Menu de ações em cascata (3 pontinhos) usado na listagem de relatórios.
   O menu usa position:fixed (posicionado via JS) para não ser cortado pelo
   overflow:hidden das "linhas-card" no layout mobile. */
.acoes-dropdown { position: relative; display: inline-flex; }
.btn-acoes-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 34px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    cursor: pointer;
    padding: 0;
}
.btn-acoes-toggle span { width: 4px; height: 4px; border-radius: 50%; background: #4b5563; display: block; }
.btn-acoes-toggle:hover, .btn-acoes-toggle.active { background: #eef2ff; border-color: #c7d2fe; }
.btn-acoes-toggle:hover span, .btn-acoes-toggle.active span { background: #4338ca; }

.acoes-menu {
    position: fixed;
    top: 0;
    left: 0;
    min-width: 168px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity .15s ease, transform .15s ease;
    z-index: 300;
}
.acoes-menu.aberto { opacity: 1; pointer-events: auto; transform: translateY(0); }
.acoes-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
}
.acoes-menu-item-ver { color: #1a7f43; }
.acoes-menu-item-ver:hover { background: #e6f7ed; }
.acoes-menu-item-editar { color: #4338ca; }
.acoes-menu-item-editar:hover { background: #eef2ff; }
.acoes-menu-item-excluir { color: #b3261e; }
.acoes-menu-item-excluir:hover { background: #fdeaea; }

/* Abaixo de 760px, a tabela vira uma lista de cards (mais fácil de usar no celular) */
@media (max-width: 760px) {
    .tabela-wrapper { overflow-x: visible; }
    .tabela-relatorios { min-width: 0; }
    .tabela-relatorios thead { display: none; }
    .tabela-relatorios, .tabela-relatorios tbody, .tabela-relatorios tr, .tabela-relatorios td {
        display: block;
        width: 100%;
    }
    .tabela-relatorios tr {
        margin-bottom: 12px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        overflow: hidden;
    }
    .tabela-relatorios td {
        text-align: right;
        padding: 10px 14px;
        border-bottom: 1px solid #f3f4f6;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
    }
    .tabela-relatorios td:last-child { border-bottom: none; }
    .tabela-relatorios td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #6b7280;
        text-align: left;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }
    .celula-acoes { justify-content: flex-end !important; }
    .celula-acoes::before { display: none; }
}

/* ===== Badges ===== */
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.badge-admin { background: #e6f7ed; color: #1a7f43; }
.badge-tecnico { background: #eef2ff; color: #4338ca; }
.badge-ativo { background: #e6f7ed; color: #1a7f43; }
.badge-inativo { background: #f3f4f6; color: #6b7280; }
.badge-amber { background: #fff4e5; color: #a15c00; }

.caixa-sucesso {
    background: #fff;
    padding: 26px 20px;
    border-radius: 10px;
    text-align: center;
}

/* ===== Relatório (template) responsivo dentro do painel ===== */
@media (max-width: 560px) {
    .folha-relatorio table[width="100%"] td[width="50%"] {
        display: block !important;
        width: 100% !important;
        padding-right: 0 !important;
    }
}

/* ===== Radios (tipo de pessoa) ===== */
.opcoes-radio { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 4px; }
.opcao-radio { display: flex; align-items: center; gap: 6px; font-weight: 500; font-size: 15px; cursor: pointer; }
.opcao-radio input[type="radio"] { width: 18px; height: 18px; accent-color: #2DB86C; cursor: pointer; }

/* Linha com "Tipo de pessoa" à esquerda e o botão de buscar cliente à direita */
.linha-tipo-pessoa { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.btn-buscar-cliente { white-space: nowrap; }
@media (max-width: 560px) {
    .linha-tipo-pessoa { flex-direction: column; align-items: stretch; }
    .btn-buscar-cliente { width: 100%; }
}

/* ===== Caixa de opção de envio de email ===== */
.caixa-opcao-email {
    background: #f6faf7;
    border: 1px solid #cdeedd;
    border-radius: 8px;
    padding: 14px 16px;
    margin-top: 22px;
}
.opcao-checkbox { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; }
.opcao-checkbox input[type="checkbox"] { width: 20px; height: 20px; margin-top: 2px; accent-color: #2DB86C; cursor: pointer; flex-shrink: 0; }

/* ===== Modal de busca de cliente ===== */
.modal-fundo {
    display: none;
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-fundo.modal-aberto { display: flex; }
.modal-caixa {
    background: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 18px;
}
.modal-cabecalho { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-cabecalho h3 { margin: 0; font-size: 17px; }
.modal-fechar { background: none; border: none; font-size: 26px; line-height: 1; cursor: pointer; color: #6b7280; padding: 0 4px; }
.modal-resultados { overflow-y: auto; flex: 1; margin-top: 10px; }
.modal-item-cliente {
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 14px;
}
.modal-item-cliente:hover { background: #f6faf7; border-color: #2DB86C; }
.modal-rodape { margin-top: 12px; text-align: center; font-size: 14px; }

@media (max-width: 480px) {
    .modal-caixa { max-height: 92vh; padding: 14px; }
}

/* ===== Autocomplete de município ===== */
.campo-com-autocomplete { position: relative; }
.autocomplete-lista {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.autocomplete-item {
    padding: 9px 12px;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: #f6faf7; }

.campo-loading { font-size: 12px; color: #2DB86C; margin-top: 3px; display: none; }
.campo-loading.ativo { display: block; }
.campo-erro { font-size: 12px; color: #b45309; margin-top: 3px; display: none; }

/* ===== Anexos (fotos/arquivos) ===== */
.anexos-area { margin-top: 8px; margin-bottom: 18px; }
.anexos-botoes { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-anexo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #1f2937;
    padding: 9px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.btn-anexo:hover { background: #e5e7eb; }
.anexos-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.anexo-item {
    position: relative;
    width: 84px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 6px;
    text-align: center;
}
.anexo-thumb {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
    background: #f3f4f6;
}
.anexo-thumb-arquivo { display: flex; align-items: center; justify-content: center; font-size: 26px; }
.anexo-nome { font-size: 10px; color: #4b5563; margin-top: 4px; overflow-wrap: anywhere; }
.anexo-tamanho { font-size: 9px; color: #9ca3af; }
.anexo-remover {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #b3261e;
    color: #fff;
    border: 2px solid #fff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Miniaturas de anexos dentro do relatório já salvo (visualização) */
.rat-anexos-grid { margin-top: 8px; }
.rat-anexo-link { display: inline-block; vertical-align: top; width: 64px; margin: 0 8px 8px 0; }
.rat-anexo-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 5px; border: 1px solid #e5e7eb; display: block; }
.rat-anexo-arquivo { width: 64px; height: 64px; border-radius: 5px; border: 1px solid #e5e7eb; display: inline-block; text-align: center; line-height: 64px; font-size: 22px; background:#f9fafb; text-decoration:none; }

/* =====================================================================
   MÓDULO DE PROPOSTAS COMERCIAIS
   ===================================================================== */
.container-larga { max-width: 1100px; }

.linha-markup-padrao { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.linha-markup-padrao input { max-width: 140px; }

/* ----- Planilha de itens ----- */
.planilha-wrapper { overflow-x: auto; margin-top: 8px; border: 1px solid #e5e7eb; border-radius: 8px; }
.planilha { width: 100%; border-collapse: collapse; min-width: 880px; }
.planilha th {
    background: #1C1C1C; color: #fff; font-size: 12.5px; text-align: left;
    padding: 9px 8px; white-space: nowrap;
}
.planilha td { padding: 5px 5px; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
.planilha input, .planilha select { padding: 8px; font-size: 14.5px; }
.planilha .col-desc { width: 36%; }
.planilha .in-qtd, .planilha .in-custo, .planilha .in-markup { text-align: right; }
.planilha .col-calc { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding: 0 8px; }
.planilha .out-subtotal { font-weight: 700; }
.planilha .col-remover { width: 36px; text-align: center; }
.btn-remover-linha {
    background: none; border: none; color: #b3261e; font-size: 24px; line-height: 1;
    cursor: pointer; padding: 2px 8px; border-radius: 6px;
}
.btn-remover-linha:hover { background: #fdeaea; }

.planilha-desc-wrap { position: relative; }
.planilha-sugestoes {
    /* position:fixed (posicionada por proposta.js) para não ser cortada pela rolagem da planilha */
    display: none; position: fixed; top: 0; left: 0; width: 340px;
    background: #fff; border: 1px solid #1a7f43; border-radius: 8px;
    max-height: 320px; overflow-y: auto; z-index: 1000; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.planilha-sugestoes .autocomplete-item { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #f0f1f3; }
.planilha-sugestoes .autocomplete-item:hover { background: #eef7f1; }
.autocomplete-vazio { padding: 12px; color: #6b7280; font-size: 13.5px; }

/* ----- Resumo interno (custo/lucro) ----- */
.resumo-interno {
    background: #f6faf7; border: 1px solid #cfe8d9; border-radius: 10px;
    padding: 14px 16px; margin-top: 16px;
}
.resumo-titulo { font-weight: 700; margin-bottom: 10px; }
.resumo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 16px; }
.resumo-grid div { display: flex; flex-direction: column; }
.resumo-grid span { color: #6b7280; font-size: 12.5px; }
.resumo-grid b { font-size: 17px; font-variant-numeric: tabular-nums; }
.resumo-destaque b { color: #1a7f43; font-size: 20px; }

/* ----- Ficha da proposta (tela de visualização) ----- */
.ficha-proposta {
    background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.1);
    padding: 14px 18px;
}
.ficha-proposta p { margin: 4px 0; font-size: 15px; }
.form-status-proposta { background: none; padding: 0; box-shadow: none; border-radius: 0; margin-top: 8px; }
.form-status-proposta select { width: auto; padding: 9px 12px; font-size: 14.5px; }

/* ----- Celular: cada linha da planilha vira um cartão ----- */
@media (max-width: 760px) {
    .planilha-wrapper { overflow-x: visible; border: none; }
    .planilha { min-width: 0; }
    .planilha thead { display: none; }
    .planilha, .planilha tbody, .planilha tr, .planilha td { display: block; width: 100%; }
    .planilha tr {
        border: 1px solid #d9dde3; border-radius: 10px; margin-bottom: 12px;
        padding: 8px 10px; background: #fff; position: relative;
    }
    .planilha td { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: none; padding: 5px 0; }
    .planilha td::before { content: attr(data-label); font-weight: 700; color: #6b7280; font-size: 13px; flex: 0 0 38%; }
    .planilha td.col-desc { display: block; width: 100%; }
    .planilha td.col-desc::before { display: block; margin-bottom: 4px; }
    .planilha td input, .planilha td select { flex: 1 1 auto; }
    .planilha .col-calc { text-align: right; padding: 5px 0; }
    .planilha .col-remover { position: absolute; top: 2px; right: 4px; width: auto; padding: 0; }
    .planilha .col-remover::before { content: none; }
}

/* Menu superior com os links novos (Propostas/Produtos): um pouco mais compacto em telas médias */
@media (min-width: 701px) and (max-width: 1100px) {
    .topbar-links-desktop { gap: 16px; }
    .link-topbar { font-size: 14px; }
}

/* ===== Menu em cascata (grupos com submenu) ===== */
.menu-grupo { position: relative; }
.menu-grupo-btn { background: none; border: none; font-family: inherit; cursor: pointer; }
.menu-grupo-btn .seta { font-size: 10px; margin-left: 2px; opacity: .8; display: inline-block; transition: transform .2s; }
.menu-grupo.aberto .seta, .menu-grupo:hover .seta { transform: rotate(180deg); }
.link-topbar.ativo, .menu-grupo.ativo > .menu-grupo-btn { color: #fff; }
.link-topbar.ativo::after, .menu-grupo.ativo > .menu-grupo-btn::after { width: 100%; }
.submenu {
    display: none; position: absolute; top: 100%; left: -14px; min-width: 190px;
    background: #1c1c1c; border: 1px solid rgba(255,255,255,.1); border-top: 2px solid #2DB86C;
    border-radius: 0 0 8px 8px; padding: 6px 0; z-index: 300;
    box-shadow: 0 10px 24px rgba(0,0,0,.35);
}
/* ponte invisível para o cursor não "cair" no vão entre o botão e o submenu */
.menu-grupo::before { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 12px; }
.menu-grupo.aberto > .submenu { display: block; }
@media (hover: hover) { .menu-grupo:hover > .submenu { display: block; } }
.submenu a {
    display: block; padding: 9px 18px; color: #d1d5db; text-decoration: none;
    font-size: 14.5px; white-space: nowrap; transition: background .15s, color .15s;
}
.submenu a:hover { background: rgba(45,184,108,.14); color: #fff; }

/* Menu lateral (celular): grupos tipo sanfona */
.mobile-nav .mobile-grupo-btn {
    background: none; border: none; padding: 3px 0; font-family: inherit; font-size: 17px;
    font-weight: 500; color: #d1d5db; cursor: pointer; display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
}
.mobile-grupo-btn .seta { font-size: 14px; line-height: 1; margin-left: auto; transition: transform .25s; }
.mobile-grupo.aberto > .mobile-grupo-btn { color: #fff; }
.mobile-grupo.aberto > .mobile-grupo-btn .seta { transform: rotate(180deg); }
/* Specificity alta de propósito: a regra existente ".mobile-nav ul { display:flex }" deixava o submenu sempre aberto. */
.mobile-nav .mobile-sub { display: none !important; margin: 12px 0 0 4px; padding-left: 14px; border-left: 2px solid #2DB86C; gap: 16px; flex-direction: column; }
.mobile-nav .mobile-grupo.aberto > .mobile-sub { display: flex !important; }
.mobile-nav .mobile-sub a { font-size: 15.5px; }
.campo-erro.campo-info { color: #4b5563; }

/* ===== Código (Cód.) dos cadastros ===== */
.col-codigo { white-space: nowrap; font-weight: 700; color: #374151; letter-spacing: 0.3px; }
.input-codigo { text-transform: uppercase; }
.input-codigo::placeholder { text-transform: none; }

/* ===== Telas de lista: usam mais a largura da tela ===== */
.container-lista { max-width: 1280px; }
/* No computador, colunas curtas (data, telefone, valores) ficam numa linha só.
   No celular a tabela vira cartões e isso não se aplica. */
@media (min-width: 761px) {
    .tabela-relatorios td.nowrap { white-space: nowrap; }
}

/* ===== Modo "Ver" (campos travados) dos formulários de cadastro ===== */
.fieldset-form { border: 0; padding: 0; margin: 0; min-width: 0; }
.fieldset-form:disabled input,
.fieldset-form:disabled textarea,
.fieldset-form:disabled select {
    background: #f3f4f6; color: #1f2937; -webkit-text-fill-color: #1f2937; opacity: 1; cursor: default;
}
.fieldset-form:disabled ::placeholder { color: transparent; }

/* A coluna "Tipo" da planilha da proposta nunca corta "Mão de obra" */
.planilha select.in-tipo { min-width: 128px; }

/* ===== Paginação das listagens ===== */
.paginacao {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 20px;
    margin-top: 14px; padding: 12px 4px 14px; border-bottom: 3px solid #2DB86C;
}
.paginacao-grupo { display: flex; align-items: center; gap: 8px; }
.paginacao-grupo label { margin: 0; font-weight: 500; font-size: 14px; }
.paginacao select { width: auto; padding: 7px 10px; font-size: 14px; }
.paginacao-info { color: #6b7280; font-size: 13px; }
.paginacao-btn {
    display: inline-block; padding: 7px 12px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff;
    color: #1f2937; font-size: 14px; font-weight: 600; text-decoration: none;
}
a.paginacao-btn:hover { border-color: #1a7f43; color: #1a7f43; }
.paginacao-btn.desativado { color: #9ca3af; background: #f3f4f6; cursor: default; }
@media (max-width: 640px) {
    .paginacao { flex-direction: column; align-items: stretch; }
    .paginacao-grupo { justify-content: space-between; flex-wrap: wrap; }
}

/* ===== Etapas do atendimento (relatório) ===== */
.etapa-linha { border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; padding: 12px 14px 4px; margin-bottom: 10px; }
.etapa-linha.etapa-leitura { background: #f9fafb; padding: 10px 14px; }
.etapa-linha.etapa-removida { opacity: .55; background: #fef2f2; }
.etapa-grid { display: grid; grid-template-columns: 1.1fr 1.2fr 1.2fr 1fr .6fr auto; gap: 12px; align-items: end; }
.etapa-grid .campo { margin-bottom: 8px; }
.etapa-tempo-valor { font-weight: 700; color: #1a7f43; padding: 10px 0; }
.etapa-meta { font-size: 12px; color: #6b7280; margin: 2px 0 8px; }
.etapa-resumo { font-size: 14px; }
.etapa-acoes { justify-content: flex-end; }
.btn-remover-etapa { border: none; background: #fee2e2; color: #991b1b; width: 38px; height: 38px; border-radius: 6px; font-size: 22px; line-height: 1; cursor: pointer; }
.btn-remover-etapa:hover { background: #fecaca; }
.etapa-remover-existente { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #991b1b; font-weight: 600; white-space: nowrap; }
.etapa-remover-existente input { width: auto; }
.etapas-rodape { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin: 6px 0 18px; }
.etapas-total { font-size: 15px; }
.etapas-total b { color: #1a7f43; }
.relatorio-auditoria { margin-top: 24px; }
.relatorio-auditoria table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.relatorio-auditoria th, .relatorio-auditoria td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
.relatorio-auditoria th { background: #f9fafb; }
@media (max-width: 760px) {
    .etapa-grid { grid-template-columns: 1fr 1fr; }
    .etapa-acoes { grid-column: 1 / -1; justify-content: flex-start; }
}
