*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:Arial, Helvetica, sans-serif;
}

body{
    background:#f4f6f9;
}

.container{
    width:95%;
    margin:auto;
    margin-top:20px;
}

.topo{
    background:#1f2937;
    color:white;
    padding:15px;
    display:flex;
    justify-content:space-between;
    align-items:center;
}

.logo{
    font-size:24px;
    font-weight:bold;
}

.menu{
    background:#111827;
    width:250px;
    min-height:100vh;
    position:fixed;
    left:0;
    top:0;
    padding-top:20px;
}

.menu h2{
    width:210px;
    height:125px;
    margin:0 auto 12px;
    overflow:hidden;
    color:transparent;
    font-size:0;
    background:
        white
        url("../assets/logo-anthony.png")
        center / 118px 118px
        no-repeat;
    border-radius:10px;
}

.menu a{
    display:block;
    color:white;
    text-decoration:none;
    padding:12px 20px;
    border-bottom:1px solid #1f2937;
}

.menu a:hover{
    background:#2563eb;
}

.menu a.ativo,
.menu a[aria-current="page"]{
    background:#2563eb;
    color:#fff;
    font-weight:700;
}

.conteudo{
    position:relative;
    isolation:isolate;
    margin-left:260px;
    padding:20px;
    min-height:100vh;
    overflow:hidden;
}

.conteudo::before{
    content:"";
    position:fixed;
    z-index:0;
    top:0;
    right:0;
    bottom:0;
    left:260px;
    background:
        url("../assets/logo-anthony.png")
        center / min(58vw, 680px)
        no-repeat;
    opacity:.10;
    mix-blend-mode:multiply;
    pointer-events:none;
}

.conteudo > *{
    position:relative;
    z-index:1;
}

.card{
    background:white;
    padding:20px;
    border-radius:10px;
    box-shadow:0px 2px 8px rgba(0,0,0,0.1);
    margin-bottom:20px;
}

.card h3{
    margin-bottom:10px;
}

.grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(250px,1fr));
    gap:15px;
}

.kpi{
    background:white;
    padding:20px;
    border-radius:10px;
    text-align:center;
    box-shadow:0px 2px 8px rgba(0,0,0,0.1);
}

.kpi h2{
    color:#2563eb;
    margin-top:10px;
}

table{
    width:100%;
    border-collapse:collapse;
    background:white;
}

table th{
    background:#1f2937;
    color:white;
    padding:10px;
    text-align:left;
    vertical-align:middle;
}

table td{
    padding:10px;
    border-bottom:1px solid #ddd;
    text-align:left;
    vertical-align:middle;
}

.tabela-compacta{
    width:auto;
    min-width:min(520px, 100%);
    max-width:760px;
}

table:has(thead th:nth-child(2):last-child),
table:has(thead th:nth-child(3):last-child){
    width:auto;
    min-width:min(520px, 100%);
    max-width:900px;
}

.tabela-compacta th,
.tabela-compacta td,
table:has(thead th:nth-child(2):last-child) th,
table:has(thead th:nth-child(2):last-child) td,
table:has(thead th:nth-child(3):last-child) th,
table:has(thead th:nth-child(3):last-child) td{
    white-space:nowrap;
}

.tabela-compacta td:first-child,
table:has(thead th:nth-child(2):last-child) td:first-child,
table:has(thead th:nth-child(3):last-child) td:first-child{
    min-width:220px;
    font-weight:600;
}

.tabela-compacta td:last-child,
table:has(thead th:nth-child(2):last-child) td:last-child,
table:has(thead th:nth-child(3):last-child) td:last-child{
    min-width:150px;
}

input,
select,
textarea{
    width:100%;
    padding:10px;
    border:1px solid #ccc;
    border-radius:5px;
    margin-top:5px;
    margin-bottom:10px;
}

.campo-com-busca{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:6px;
    align-items:end;
}

.campo-com-busca input,
.campo-com-busca select{
    margin-bottom:0;
}

.campo-com-busca button{
    min-height:38px;
    margin-top:5px;
    white-space:nowrap;
}

.detalhe-motorista-pesquisa{
    min-height:18px;
    margin-top:6px;
    color:#475569;
    font-size:12px;
    line-height:1.35;
}

.detalhe-motorista-pesquisa.detalhe-motorista-selecionado{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(145px,1fr));
    gap:7px 10px;
    padding:8px;
    border:1px solid #cbd5e1;
    border-radius:6px;
    background:#f8fafc;
    color:#0f172a;
}

.detalhe-motorista-pesquisa.detalhe-motorista-selecionado div{
    min-width:0;
}

.detalhe-motorista-pesquisa.detalhe-motorista-selecionado strong{
    display:block;
    color:#64748b;
    font-size:11px;
    font-weight:800;
    text-transform:uppercase;
}

.detalhe-motorista-pesquisa.detalhe-motorista-selecionado span{
    display:block;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.selecao-motorista-pesquisa{
    margin-top:6px;
    margin-bottom:0;
}

button{
    border:none;
    padding:10px 15px;
    border-radius:5px;
    cursor:pointer;
}

.lembrar-usuario{
    display:flex;
    align-items:center;
    gap:8px;
    margin:0 0 14px;
    cursor:pointer;
    user-select:none;
}

.lembrar-usuario input{
    width:auto;
    margin:0;
}

button:disabled{
    opacity:.65;
    cursor:not-allowed;
}

.login-page{
    min-height:100vh;
    overflow:hidden;
    background:#111827;
}

.login-fundo{
    position:relative;
    isolation:isolate;
    width:100%;
    min-height:100vh;
    display:flex;
    justify-content:center;
    align-items:center;
    padding:24px;
    background:
        radial-gradient(circle at center, #1d293d 0%, #111827 65%);
}

.login-card{
    position:relative;
    isolation:isolate;
    overflow:hidden;
    width:min(390px, 100%);
    padding:22px 20px 24px;
    border:1px solid rgba(255,255,255,.3);
    box-shadow:0 18px 55px rgba(0,0,0,.35);
}

.login-card::before{
    content:"";
    position:absolute;
    z-index:0;
    inset:90px 12px 12px;
    background:
        url("../assets/logo-anthony.png")
        center / 88%
        no-repeat;
    opacity:.055;
    filter:grayscale(1);
    pointer-events:none;
}

.login-card > *{
    position:relative;
    z-index:1;
}

.login-logo{
    display:block;
    width:175px;
    max-height:135px;
    object-fit:contain;
    margin:0 auto 16px;
}

@media(max-height:650px){
    .login-logo{
        width:105px;
        max-height:85px;
    }

    .login-card{
        padding-top:14px;
        padding-bottom:16px;
    }
}

.btn-primary{
    background:#2563eb;
    color:white;
}

.btn-success{
    background:#16a34a;
    color:white;
}

.btn-warning{
    background:#f59e0b;
    color:white;
}

.btn-danger{
    background:#dc2626;
    color:white;
}

.btn-secondary{
    background:#6b7280;
    color:white;
}

button:disabled{
    cursor:not-allowed;
    opacity:.65;
}

.modal-operacao{
    position:fixed;
    inset:0;
    z-index:30;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:20px;
    background:rgba(15, 23, 42, .42);
}

.modal-operacao[hidden]{
    display:none;
}

.modal-operacao-card{
    width:min(420px, 100%);
    background:white;
    padding:22px;
    border-radius:10px;
    box-shadow:0 18px 45px rgba(15, 23, 42, .24);
}

.modal-operacao-card h3{
    margin-bottom:14px;
    color:#1f2937;
}

.modal-operacao-acoes{
    display:flex;
    gap:10px;
    justify-content:flex-end;
    flex-wrap:wrap;
}

.form-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(250px,1fr));
    gap:15px;
}

/* Padrao unico para telas de historico (Compras e Vendas):
   - grid responsivo com 4 colunas na tela larga (Cliente | Data Inicial | Data Final | Status)
   - o botao Pesquisar entra na mesma celula do Status, alinhado a direita
   - alturas, margens e espacamentos identicos em ambas as telas */
.filtros-historico{
    display:grid;
    grid-template-columns:repeat(4,minmax(180px,1fr));
    gap:12px;
    align-items:end;
    margin:12px 0;
}
.filtros-historico > div{
    display:flex;
    flex-direction:column;
    gap:4px;
}
.filtros-historico > div.com-acao{
    flex-direction:row;
    align-items:end;
    gap:8px;
}
.filtros-historico > div.com-acao > .campo-com-label{
    flex:1;
    display:flex;
    flex-direction:column;
    gap:4px;
}
.filtros-historico label{
    font-size:12px;
    color:#374151;
}
.filtros-historico input,
.filtros-historico select{
    height:36px;
    padding:0 10px;
    box-sizing:border-box;
}
.filtros-historico .btn-primary,
.filtros-historico .btn-info,
.filtros-historico .btn-secondary{
    height:36px;
    padding:0 16px;
    white-space:nowrap;
}
@media (max-width: 900px){
    .filtros-historico{
        grid-template-columns:repeat(2,minmax(160px,1fr));
    }
}
@media (max-width: 560px){
    .filtros-historico{
        grid-template-columns:1fr;
    }
}

.status-pago{
    color:#16a34a;
    font-weight:bold;
}

.status-pendente{
    color:#dc2626;
    font-weight:bold;
}

.status-finalizado{
    color:#16a34a;
    font-weight:bold;
}

.status-aberto{
    color:#2563eb;
    font-weight:bold;
}

.status-bloqueado{
    color:#dc2626;
    font-weight:bold;
}

.status-ativo{
    color:#16a34a;
    font-weight:bold;
}

.status-inativo{
    color:#dc2626;
    font-weight:bold;
}

.card-financeiro{
    background:white;
    border-left:5px solid #2563eb;
    padding:20px;
    border-radius:10px;
}

.card-receita{
    border-left:5px solid #16a34a;
}

.card-despesa{
    border-left:5px solid #dc2626;
}

.card-alerta{
    border-left:5px solid #f59e0b;
}

.titulo-pagina{
    margin-bottom:20px;
}

.titulo-pagina h1{
    color:#1f2937;
}

.titulo-com-acoes{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
}

.botao-privacidade{
    width:46px;
    height:42px;
    padding:0;
    border:1px solid #cbd5e1;
    background:white;
    color:#111827;
    box-shadow:0 2px 8px rgba(0,0,0,.08);
    display:inline-flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    border-radius:6px;
    position:relative;
}

.botao-privacidade::before{
    content:"";
    width:24px;
    height:14px;
    border:2px solid currentColor;
    border-radius:50% / 65%;
    transform:rotate(-2deg);
}

.botao-privacidade::after{
    content:"";
    position:absolute;
    width:7px;
    height:7px;
    border-radius:50%;
    background:currentColor;
}

.botao-privacidade.privacidade-oculta{
    background:
        linear-gradient(
            135deg,
            transparent 45%,
            #ef4444 46%,
            #ef4444 54%,
            transparent 55%
        ),
        white;
}

.acoes-dashboard{
    display:flex;align-items:end;justify-content:flex-end;
    gap:8px;flex-wrap:wrap;
}
.acoes-dashboard label{min-width:205px;}
.acoes-dashboard label span{
    display:block;margin-bottom:4px;color:#475569;
    font-size:12px;font-weight:700;
}
.acoes-dashboard input{margin:0;min-height:42px;}
.acoes-dashboard .btn-primary{min-height:42px;margin:0;}

.dashboard-oculto .kpi h2,
.dashboard-oculto .card canvas{
    filter:blur(12px);
    user-select:none;
}

.dashboard-oculto .card canvas{
    opacity:.28;
}

@media(max-width:900px){
    .titulo-com-acoes{align-items:flex-start;flex-direction:column;}
    .acoes-dashboard{width:100%;justify-content:flex-start;}
}

.secao-cabecalho{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:15px;
    flex-wrap:wrap;
}

.secao-cabecalho p{
    color:#64748b;
    font-size:14px;
}

.lista-contatos{
    display:grid;
    gap:12px;
    margin-top:12px;
}

.opcao-envio{
    display:flex;
    align-items:center;
    gap:6px;
    min-height:42px;
    font-size:13px;
}

.opcao-envio input{
    width:auto;
    margin:0;
}

.tabela-responsiva{
    overflow-x:auto;
}

.seletor-carga{
    width:auto;
    margin:0;
}

.resultado-operacao{
    margin-top:14px;
    font-weight:bold;
    color:#1f2937;
}

canvas{
    background:white;
    padding:15px;
    border-radius:10px;
}

@media(max-width:768px){

    .menu{
        width:100%;
        position:relative;
        min-height:auto;
    }

    .conteudo{
        margin-left:0;
    }

    .grid{
        grid-template-columns:1fr;
    }

}
/* ===== MENU FIXO COM BOTAO SAIR ===== */

.menu{
    display:flex;
    flex-direction:column;
    height:100vh;
    min-height:0;
    overflow-x:hidden;
    overflow-y:hidden;
    overscroll-behavior:contain;
}

.menu h2{
    flex-shrink:0;
    order:0;
}

.menu-links{
    flex:1;
    min-height:0;
    overflow-y:auto;
    overflow-x:hidden;
    scrollbar-width:thin;
    scrollbar-color:#4b5563 #111827;
    order:1;
}

.menu-rodape{
    flex-shrink:0;
    padding:10px;
    border-top:1px solid #1f2937;
    background:#111827;
    order:2;
}

/* Seguranca para paginas antigas: links soltos nunca ficam apos o botao Sair. */
.menu > a{
    order:1;
}

.menu-rodape button{
    width:100%;
    margin:0;
}

#usuario-logado{
    color:white;
    text-align:center;
    font-size:13px;
    margin-bottom:10px;
}

.menu-links::-webkit-scrollbar{
    width:8px;
}

.menu-links::-webkit-scrollbar-track{
    background:#111827;
}

.menu-links::-webkit-scrollbar-thumb{
    background:#4b5563;
    border-radius:10px;
}

.menu-links::-webkit-scrollbar-thumb:hover{
    background:#6b7280;
}

@media(max-width:768px){
    .menu{
        height:auto;
        max-height:none;
        overflow:visible;
    }
}

body.modo-incorporado .menu{
    display:none !important;
}

body.modo-incorporado .conteudo{
    width:100%;
    max-width:none;
    min-height:100vh;
    margin-left:0 !important;
    padding:18px !important;
}

body.modo-incorporado .conteudo::before{
    left:0;
}

body.modo-incorporado .titulo-pagina,
body.modo-incorporado .pagina-cabecalho{
    display:none;
}

body.modo-incorporado .abas-modulo{
    top:0;
}

.menu a[href="faturamento.html"],
.menu a[href="contas_receber.html"],
.menu a[href="contas_pagar.html"],
.menu a[href="fluxo_caixa.html"],
.menu a[href="despesas.html"],
.menu a[href="inventario.html"],
.menu a[href="produtos.html"],
.menu a[href="clientes.html"],
.menu a[href="fornecedores.html"]{
    display:none !important;
}

.notificacoes-operacao{
    position:fixed;
    top:18px;
    right:18px;
    z-index:10000;
    display:grid;
    gap:10px;
    width:min(390px, calc(100vw - 36px));
    pointer-events:none;
}

.notificacao-operacao{
    padding:14px 16px;
    border-radius:10px;
    color:#fff;
    font-weight:700;
    box-shadow:0 12px 30px rgba(15,23,42,.24);
    opacity:0;
    transform:translateY(-10px);
    transition:opacity .2s ease, transform .2s ease;
}

.notificacao-operacao.visivel{
    opacity:1;
    transform:translateY(0);
}

.notificacao-sucesso{background:#15803d;}
.notificacao-informacao{background:#1d4ed8;}
.notificacao-aviso{background:#b45309;}

.abas-modulo{
    position:sticky;
    top:0;
    z-index:50;
    display:flex;
    gap:4px;
    margin:0 0 18px;
    padding:7px;
    overflow-x:auto;
    border:1px solid #dbe3ec;
    border-radius:12px;
    background:rgba(255,255,255,.96);
    box-shadow:0 8px 22px rgba(15,23,42,.08);
    scrollbar-width:thin;
}

.aba-modulo{
    flex:0 0 auto;
    min-height:40px;
    padding:9px 16px;
    border:0;
    border-radius:8px;
    background:transparent;
    color:#475569;
    font-weight:700;
    cursor:pointer;
    transition:background .18s ease,color .18s ease,box-shadow .18s ease;
}

.aba-modulo:hover{
    background:#eff6ff;
    color:#1d4ed8;
}

.aba-modulo.ativa{
    background:#1d4ed8;
    color:#fff;
    box-shadow:0 5px 14px rgba(29,78,216,.25);
}

.aba-modulo:focus:not(:focus-visible),
.aba-ficha:focus:not(:focus-visible),
.aba-estoque:focus:not(:focus-visible),
.aba-compra:focus:not(:focus-visible),
.aba-carregamento:focus:not(:focus-visible),
.aba-financeira:focus:not(:focus-visible),
.aba-cadastro:focus:not(:focus-visible),
.aba-rotina-venda:focus:not(:focus-visible),
.subaba-compra:focus:not(:focus-visible),
.subaba-venda:focus:not(:focus-visible){
    outline:none;
}

.aba-modulo:focus-visible,
.aba-ficha:focus-visible,
.aba-estoque:focus-visible,
.aba-compra:focus-visible,
.aba-carregamento:focus-visible,
.aba-financeira:focus-visible,
.aba-cadastro:focus-visible,
.aba-rotina-venda:focus-visible,
.subaba-compra:focus-visible,
.subaba-venda:focus-visible{
    outline:2px solid #2563eb;
    outline-offset:2px;
}

.painel-modulo{
    display:none;
}

.painel-modulo.ativo{
    display:block;
}

.painel-modulo > .card,
.painel-modulo > section,
.painel-modulo > .venda-andamento{
    margin-bottom:18px;
}

.aba-mensagem{
    min-height:180px;
    display:grid;
    align-content:center;
    text-align:center;
}

.aba-mensagem p{
    max-width:680px;
    margin:8px auto 0;
    color:#64748b;
}

.modulo-incorporado-card{padding:14px;}
.modulo-incorporado-frame{
    width:100%;
    height:calc(100vh - 250px);
    min-height:520px;
    margin-top:12px;
    border:1px solid #dbe3ec;
    border-radius:9px;
    background:#fff;
}

.resultado-importacao{
    min-height:90px;
    max-height:320px;
    margin-top:14px;
    padding:14px;
    overflow:auto;
    border-radius:8px;
    background:#0f172a;
    color:#e2e8f0;
    white-space:pre-wrap;
}

@media(max-width:768px){
    .abas-modulo{
        position:relative;
        top:auto;
    }
    .aba-modulo{
        padding:9px 13px;
    }
}

.painel-baixa-selecionadas{
    margin:0 0 10px;
    padding:12px;
    border:1px solid #b7c8d7;
    border-radius:8px;
    background:#eef3f8;
}

.painel-baixa-selecionadas[hidden]{
    display:none!important;
}



/* Transmissao NF-e (fiscal.html): situacao por linha */
tr.tx-autorizada td:nth-child(14){color:#15803d;font-weight:700;}
tr.tx-pendente td:nth-child(14){color:#b45309;font-weight:700;}
tr.tx-erro td:nth-child(14){color:#b91c1c;font-weight:700;}
tr.tx-nao-emitida td:nth-child(14){color:#475569;}

/* Cadastro de produto: foto (mesma do app de pedidos). */
.foto-produto{
    margin:14px 0;
}

.foto-produto-conteudo{
    display:flex;
    gap:16px;
    align-items:flex-start;
    flex-wrap:wrap;
}

.foto-produto-quadro{
    width:180px;
    height:180px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px dashed #94a3b8;
    border-radius:6px;
    background:#f8fafc;
    overflow:hidden;
    color:#64748b;
    font-size:13px;
}

.foto-produto-quadro img{
    width:100%;
    height:100%;
    object-fit:contain;
    background:#fff;
}

.foto-produto-lado{
    flex:1 1 240px;
    display:flex;
    flex-direction:column;
    gap:8px;
}

.foto-produto-botoes{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
}

.foto-produto-aviso{
    margin:0;
    color:#b45309;
    font-size:13px;
}

.foto-produto-dica{
    margin:0;
    color:#64748b;
    font-size:12px;
}

/* Cabecalho clicavel (js/tabela_ordenavel.js): ordena pela coluna. */
th.coluna-ordenavel{
    cursor:pointer;
    user-select:none;
    white-space:nowrap;
}

th.coluna-ordenavel:hover{
    text-decoration:underline;
}

th.coluna-ordenavel::after{
    content:"\2195";
    margin-left:4px;
    font-size:11px;
    opacity:.35;
}

th.coluna-ordenavel.ordenada-asc::after{
    content:"\25B2";
    opacity:1;
}

th.coluna-ordenavel.ordenada-desc::after{
    content:"\25BC";
    opacity:1;
}
