* { box-sizing: border-box; }
body {
    margin: 0;
    background: #0f172a;
    color: #f1f5f9;
    font-family: Arial, sans-serif;
}
header {
    background: #1e293b;
    padding: 22px;
    font-size: 22px;
    font-weight: bold;
    border-bottom: 1px solid #334155;
}
main {
    max-width: 1000px;
    margin: auto;
    padding: 20px;
}
.login {
    max-width: 420px;
    margin: 40px auto;
    background: #1e293b;
    padding: 25px;
    border-radius: 15px;
}
input, button {
    width: 100%;
    padding: 14px;
    margin: 8px 0 18px;
    border-radius: 8px;
    font-size: 16px;
}
input {
    background: #0f172a;
    border: 1px solid #475569;
    color: white;
}
button {
    background: #16a34a;
    color: white;
    border: none;
    font-weight: bold;
    cursor: pointer;
}
.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.card {
    background: #1e293b;
    padding: 18px;
    border-radius: 12px;
    margin-bottom: 15px;
}
.card h2 { color: #4ade80; }
small, footer { color: #94a3b8; }
footer {
    text-align: center;
    padding: 20px;
    font-size: 12px;
}
.alert {
    background: #7f1d1d;
    padding: 12px;
    border-radius: 8px;
}

.btn {
    display: block;
    text-decoration: none;
    text-align: center;
    background: #16a34a;
    color: #ffffff;
    padding: 14px;
    border-radius: 8px;
    font-weight: bold;
    margin: 10px 0 18px;
}

.secundario {
    background: #334155;
    color: #ffffff;
}

.acoes {
    display: flex;
    gap: 10px;
    align-items: center;
}

.acoes > * {
    flex: 1;
    min-width: 0;
}

.positivo { color: #4ade80; }
.negativo { color: #f87171; }

.card p {
    overflow-wrap: anywhere;
}


select, textarea {
    width: 100%;
    padding: 14px;
    margin: 8px 0 18px;
    border-radius: 8px;
    background: #0f172a;
    color: #ffffff;
    border: 1px solid #475569;
    font-family: inherit;
    font-size: 16px;
}

.calculo {
    background: #0f172a;
    border: 1px solid #166534;
}

.linha {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.pendente { color: #fbbf24; }
.perigo { background: #b91c1c; }

input[type="date"],
input[type="datetime-local"] {
    color-scheme: dark;
    min-width: 0;
}

@media (max-width: 480px) {
    main { padding: 12px; }
    .card { padding: 12px; }
    .card h2 { font-size: 19px; }
    .grid { gap: 8px; }
}


.alert.success {
    background: #166534;
    color: #dcfce7;
    border: 1px solid #22c55e;
}

.alert.error {
    background: #7f1d1d;
    color: #fee2e2;
}


.checkline {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

.checkline input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin: 0;
    accent-color: #16a34a;
}


.negativo {
    color: #f87171;
}



/* RESUMO FINANCEIRO */

.financeiro-entrega .linha,
.calculo .linha {
    padding: 5px 0;
    gap: 12px;
}

.financeiro-entrega hr,
.calculo hr {
    border: 0;
    border-top: 1px solid #334155;
    margin: 12px 0;
}

.financeiro-entrega small {
    line-height: 1.6;
}



/* CORES DOS INDICADORES FINANCEIROS */

.card h2.positivo {
    color: #4ade80;
}

.card h2.negativo {
    color: #f87171;
}

.card h2.pendente {
    color: #fbbf24;
}



/* GRAFICOS FINANCEIROS */

.grafico-card {
    min-width: 0;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
}

.grafico-card h3 {
    margin: 0 0 18px;
    color: #e2e8f0;
    font-size: 16px;
}

.grafico-area {
    position: relative;
    width: 100%;
    height: 280px;
}

.graficos-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

@media (max-width: 700px) {
    .graficos-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .grafico-card {
        padding: 10px;
    }

    .grafico-area {
        height: 240px;
    }
}


/* COMPARATIVO FINANCEIRO MENSAL */

.tabela-mensal {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #334155;
    border-radius: 10px;
}

.tabela-mensal table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    white-space: nowrap;
}

.tabela-mensal th,
.tabela-mensal td {
    padding: 12px;
    border-bottom: 1px solid #334155;
    text-align: right;
}

.tabela-mensal th {
    background: #0f172a;
    color: #cbd5e1;
}

.tabela-mensal th:first-child,
.tabela-mensal td:first-child {
    text-align: left;
}

.tabela-mensal tbody tr:nth-child(even) {
    background: #172033;
}

.tabela-mensal tbody tr:hover {
    background: #334155;
}

/* Central de relatorios */
.relatorio-nota {
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.5;
}

[hidden] {
    display: none !important;
}

/* Historicos expansiveis dos relatorios */

.relatorio-detalhes {
    margin-top: 12px;
    margin-bottom: 12px;
}

.relatorio-detalhes > summary {
    cursor: pointer;
    font-weight: 600;
    color: #4ade80;
    padding: 8px 0;
    line-height: 1.5;
}

.relatorio-detalhes > summary:hover {
    color: #86efac;
}

.relatorio-detalhes[open] > summary {
    margin-bottom: 12px;
    border-bottom: 1px solid #334155;
}

.relatorio-detalhes .card {
    margin-top: 10px;
    border: 1px solid #334155;
}

.relatorio-registro {
    overflow-wrap: anywhere;
}

.relatorio-registro p {
    margin: 6px 0;
}

.relatorio-registro .positivo {
    color: #4ade80;
}

.relatorio-registro .negativo {
    color: #f87171;
}

.relatorio-registro .pendente {
    color: #fbbf24;
}

@media (max-width: 600px) {
    .relatorio-detalhes > summary {
        font-size: 0.95rem;
        padding: 12px 0;
    }
}


/* Exportacao PDF */

.btn-exportar-pdf {
    display: block;
    text-align: center;
    background: #15803d;
    color: #ffffff;
    font-weight: 600;
    margin: 10px 0;
    padding: 12px;
}

.btn-exportar-pdf:hover {
    background: #166534;
    color: #ffffff;
}

/* Compartilhamento WhatsApp */

.whatsapp-mensagem {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 320px;
    padding: 14px;
    border: 1px solid #475569;
    border-radius: 10px;
    background: #0f172a;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
}

.btn-whatsapp,
.whatsapp-enviar {
    background: #15803d !important;
    color: #ffffff !important;
}

.btn-whatsapp:hover,
.whatsapp-enviar:hover {
    background: #166534 !important;
}

#whatsapp-contador {
    color: #94a3b8;
    font-size: 13px;
}

#whatsapp-retorno {
    min-height: 24px;
}



/* Configuracoes de comissoes dos estabelecimentos */

.loja-localizacao {
    display: grid;
    grid-template-columns: minmax(90px, 1fr) minmax(0, 3fr);
    gap: 12px;
}

.loja-localizacao > div {
    min-width: 0;
}

.loja-regras {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 16px;
    margin: 10px 0 20px;
}

.loja-regras h2 {
    margin-top: 0;
}

.loja-regras h3 {
    font-size: 16px;
    margin: 12px 0;
}

.loja-regras .checkline {
    border-bottom: 1px solid #263449;
    cursor: pointer;
}

.loja-regras .checkline input {
    flex-shrink: 0;
}

.loja-isencoes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.loja-isencao {
    display: inline-flex;
    color: #86efac;
    background: #14532d55;
    border: 1px solid #166534;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13px;
}

@media (max-width: 480px) {
    .loja-localizacao {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .loja-regras {
        padding: 12px;
    }
}


/* Comissao inteligente nas entregas */

.entrega-comissao {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 16px;
    margin: 12px 0 18px;
}

.entrega-comissao h3 {
    margin: 0 0 16px;
    color: #4ade80;
}

.entrega-comissao input[readonly] {
    background: #172337;
    color: #86efac;
    font-size: 22px;
    font-weight: bold;
    cursor: default;
}

.entrega-comissao #comissao_motivo {
    margin: 0 0 8px;
    min-height: 22px;
    line-height: 1.5;
}

#salvar_entrega:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .entrega-comissao {
        padding: 12px;
    }
}


/* Central de comissoes */

.regra-comissao {
    border-left: 3px solid #22c55e;
}

.regra-comissao .acoes {
    flex-wrap: wrap;
}

#feriado_estado[hidden],
#feriado_cidade[hidden] {
    display: none !important;
}


/* Marca com retorno ao inicio */

header .marca-inicio {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease;
}

header .marca-inicio:hover {
    color: #4ade80;
}

header .marca-inicio:focus-visible {
    outline: 2px solid #4ade80;
    outline-offset: 5px;
    border-radius: 3px;
}
