/* ===== Tema ===== */
:root {
    --marca: #b66122;          /* laranja Webz */
    --marca-escura: #9a511b;
    --marca-mais-escura: #82441a;
    --marca-suave: #f8ece2;
    --lateral-fundo: #1f2124;
    --lateral-texto: #a7a9ae;
    --lateral-largura: 252px;
    --borda: #d9d9dc;
    --bs-body-font-family: 'Inter Variable', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --bs-body-color: #1f2328;
    --bs-body-bg: #e3e3e3;
    --bs-secondary-color: #555b65;
    --bs-border-color: var(--borda);
    --bs-primary: #b66122;
    --bs-primary-rgb: 182, 97, 34;
    --bs-link-color: #b66122;
    --bs-link-color-rgb: 182, 97, 34;
    --bs-link-hover-color: #9a511b;
    --bs-link-hover-color-rgb: 154, 81, 27;
    --bs-border-radius: .5rem;
    --bs-border-radius-lg: .75rem;
}
body { font-feature-settings: 'cv11', 'ss01'; -webkit-font-smoothing: antialiased; }
h1, .h1, h2, .h2, h3, .h3 { font-weight: 650; letter-spacing: -.015em; }
h4, .h4, h5, .h5, h6, .h6 { font-weight: 600; }
.text-muted { color: var(--bs-secondary-color) !important; }

/* Botões */
.btn { font-weight: 500; }
.btn .bi + span, .btn .bi { vertical-align: -.1em; }
.btn-primary {
    --bs-btn-bg: var(--marca); --bs-btn-border-color: var(--marca);
    --bs-btn-hover-bg: var(--marca-escura); --bs-btn-hover-border-color: var(--marca-escura);
    --bs-btn-active-bg: var(--marca-mais-escura); --bs-btn-active-border-color: var(--marca-mais-escura);
    --bs-btn-disabled-bg: var(--marca); --bs-btn-disabled-border-color: var(--marca);
    box-shadow: 0 1px 2px rgba(182, 97, 34, .3);
}
.btn-outline-primary {
    --bs-btn-color: var(--marca); --bs-btn-border-color: #e0bc9f; --bs-btn-bg: #fff;
    --bs-btn-hover-bg: var(--marca-suave); --bs-btn-hover-color: var(--marca-escura); --bs-btn-hover-border-color: #d6a57e;
    --bs-btn-active-bg: var(--marca); --bs-btn-active-color: #fff; --bs-btn-active-border-color: var(--marca);
}
.btn-outline-secondary {
    --bs-btn-color: #475569; --bs-btn-border-color: #d5dae3; --bs-btn-bg: #fff;
    --bs-btn-hover-bg: #f1f4f9; --bs-btn-hover-color: #1e293b; --bs-btn-hover-border-color: #c5ccd8;
    --bs-btn-active-bg: #e7ebf2; --bs-btn-active-color: #1e293b; --bs-btn-active-border-color: #c5ccd8;
}
/* Ação em linha de tabela: só ícone, com dica (title) */
.btn-icone {
    --bs-btn-color: #64748b; --bs-btn-bg: transparent; --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #1e293b; --bs-btn-hover-bg: #eef2f7; --bs-btn-hover-border-color: transparent;
    --bs-btn-active-bg: #e2e8f0; --bs-btn-active-border-color: transparent;
    --bs-btn-padding-x: .45rem; --bs-btn-padding-y: .2rem; font-size: 1rem; line-height: 1.4;
}
.btn-icone.icone-sucesso { --bs-btn-color: #15803d; --bs-btn-hover-color: #166534; --bs-btn-hover-bg: #e8f7ee; }
.btn-icone.icone-perigo { --bs-btn-color: #b91c1c; --bs-btn-hover-color: #991b1b; --bs-btn-hover-bg: #fdecec; }
.btn-icone.icone-marca { --bs-btn-color: var(--marca); --bs-btn-hover-color: var(--marca-escura); --bs-btn-hover-bg: var(--marca-suave); }
.acoes { display: inline-flex; gap: .15rem; align-items: center; justify-content: flex-end; }

/* Cartões, tabelas, formulários */
/* Cartões brancos em destaque sobre o fundo cinza */
.card { --bs-card-bg: #fff; --bs-card-border-color: #d4d4d7; --bs-card-border-radius: .8rem; --bs-card-inner-border-radius: calc(.8rem - 1px);
        --bs-card-cap-bg: #fafafa; --bs-card-spacer-y: 1.1rem; --bs-card-spacer-x: 1.25rem;
        box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 6px 18px -6px rgba(0, 0, 0, .12); }
.card > .table, .card > .table-responsive > .table { margin-bottom: 0; }
.table { --bs-table-bg: #fff; --bs-table-hover-bg: #fbf5f0; --bs-table-border-color: #ebebed; --bs-table-color: #1f2328; }
.table td, .table th { vertical-align: middle; }
.table > thead > tr > th, .table > thead th {
    font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .045em;
    color: #555b65; background: #f6f6f7; border-bottom-color: var(--borda); white-space: nowrap;
}
.card > .table > :first-child > tr:first-child > th:first-child,
.card > .table-responsive > .table > :first-child > tr:first-child > th:first-child { border-top-left-radius: calc(.75rem - 1px); }
.card > .table > :first-child > tr:first-child > th:last-child,
.card > .table-responsive > .table > :first-child > tr:first-child > th:last-child { border-top-right-radius: calc(.75rem - 1px); }
.form-control, .form-select { border-color: #cfd0d4; background-color: #fff; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: #d9a47b; box-shadow: 0 0 0 .2rem rgba(182, 97, 34, .18); }
.form-check-input:checked { background-color: var(--marca); border-color: var(--marca); }
.form-label { font-weight: 500; font-size: .9rem; }
.badge { font-weight: 600; letter-spacing: .01em; }
.alert { border-radius: .65rem; }
.dropdown-menu { --bs-dropdown-border-color: var(--borda); --bs-dropdown-link-active-bg: var(--marca); border-radius: .6rem;
                 box-shadow: 0 10px 30px rgba(15, 23, 42, .12); }
.dropdown-item .bi { margin-right: .45rem; color: #64748b; }
.nav-tabs .nav-link.active, .nav-pills .nav-link.active { font-weight: 600; }
.pagination { --bs-pagination-active-bg: var(--marca); --bs-pagination-active-border-color: var(--marca); }

/* ===== Menu lateral ===== */
.marca { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; letter-spacing: -.01em; color: inherit; text-decoration: none; }
.logo-webz { height: 26px; width: auto; display: block; }
.marca-sub { font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--marca);
             padding-left: .6rem; border-left: 1px solid currentColor; line-height: 1.1; }
.barra-lateral .marca-sub { color: #e7a874; border-left-color: rgba(255, 255, 255, .2); }
.barra-lateral { background: var(--lateral-fundo); }
#menuLateral { --bs-offcanvas-bg: var(--lateral-fundo); --bs-offcanvas-color: var(--lateral-texto); --bs-offcanvas-width: 272px; }
#menuLateral .offcanvas-header { color: #fff; }
.menu-interno { display: flex; flex-direction: column; width: 100%; min-height: 100%; padding: 0 .85rem 1rem; }
.menu-interno > .marca { color: #fff; padding: 1.25rem .5rem 1rem; font-size: 1.05rem; }
.barra-lateral .nav-link {
    display: flex; align-items: center; gap: .75rem; padding: .5rem .7rem; margin: 1px 0;
    color: var(--lateral-texto); border-radius: .5rem; font-size: .92rem; font-weight: 500; transition: background .15s, color .15s;
}
.barra-lateral .nav-link .bi { font-size: 1.05rem; opacity: .9; }
.barra-lateral .nav-link:hover { color: #e2e8f0; background: rgba(255, 255, 255, .06); }
.barra-lateral .nav-link.active { color: #fff; background: var(--marca); box-shadow: 0 2px 8px rgba(182, 97, 34, .4); }
.menu-secao { padding: 1.1rem .7rem .35rem; font-size: .68rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: #74777e; }
.menu-usuario { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, .08); }
.usuario-botao { display: flex; align-items: center; gap: .6rem; color: #e2e8f0; text-align: left; padding: .45rem .55rem; border: 0; }
.usuario-botao:hover, .usuario-botao.show { color: #fff; background: rgba(255, 255, 255, .06); }
.usuario-botao::after { margin-left: auto; }
.avatar { flex: 0 0 auto; display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
          background: #2c2f33; color: #f0c39d; font-weight: 600; font-size: .85rem; border: 1px solid rgba(255, 255, 255, .1); }
.topo-movel { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem;
              background: rgba(255, 255, 255, .95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--borda); }
.area-principal { padding: 1.25rem 1rem 2.5rem; max-width: 1440px; }
@media (min-width: 992px) {
    .barra-lateral { position: sticky; top: 0; height: 100vh; width: var(--lateral-largura); flex: 0 0 var(--lateral-largura); overflow-y: auto; }
    .barra-lateral .offcanvas-lg, .barra-lateral .offcanvas-body { height: 100%; }
    .conteudo { min-width: 0; }
    .area-principal { padding: 2rem 2.25rem 3rem; }
}

/* Páginas de acesso (login, 2FA) */
.pagina-acesso { background: radial-gradient(1200px 600px at 50% -10%, #f0dccb 0%, var(--bs-body-bg) 60%); min-height: 100vh; }
.pagina-acesso .card { border: 0; box-shadow: 0 12px 40px rgba(0, 0, 0, .12); }
.marca-acesso .logo-webz { height: 38px; }
.marca-acesso .marca-sub { font-size: .85rem; }
.alerta-acesso { max-width: 32rem; }

/* ===== Conteúdo ===== */
.texto-livre { white-space: pre-line; }
.valor { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Fluxo de caixa: altura fixa para o Chart.js */
.grafico { position: relative; height: 280px; }

/* Relatórios */
.dre-grupo td { font-weight: 600; }
.dre-sub td:first-child { padding-left: 2rem; }
.dre-total td { font-weight: 700; background: #eef1f5; }
.dre-resultado td { font-weight: 700; background: #dde3ec; }

/* Importações */
.col-arquivo { max-width: 16rem; }

/* QR code da ativação do 2FA */
.qr-2fa { width: 240px; max-width: 100%; height: auto; image-rendering: pixelated; }
.codigos-recuperacao { columns: 2; font-size: 1.1rem; }

/* Impressão / Salvar como PDF */
@page { size: A4; margin: 12mm; }
@media print {
    body { background: #fff; font-size: 9pt; }
    .area-principal, main.container { max-width: none; padding: 0 !important; }
    .card { border: 0; box-shadow: none; }
    .table-responsive { overflow: visible; }
    .table { font-size: 8.5pt; }
    .table > thead th { background: #fff; }
    a { color: inherit !important; text-decoration: none !important; }
    tr, .dre-grupo { break-inside: avoid; }
    thead { display: table-header-group; }
    .dre-total td, .dre-resultado td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Painel e links em tabelas */
.kpi-valor { font-size: clamp(1.1rem, 1.55vw, 1.55rem); font-weight: 650; letter-spacing: -.02em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table a:not(.btn), .list-group a.link-dark { text-decoration: none; color: inherit; font-weight: 500; }
.table a:not(.btn):hover, .list-group a.link-dark:hover { color: var(--marca); text-decoration: underline; }
/* Cabeçalho das telas (título + botões) quebra linha em telas estreitas */
.area-principal > .d-flex.justify-content-between:first-child { flex-wrap: wrap; gap: .75rem; }
@media (max-width: 575.98px) { .area-principal > .d-flex.justify-content-between:first-child .btn { --bs-btn-padding-x: .6rem; --bs-btn-font-size: .875rem; } }
/* Logo: "Financeiro" abaixo da marca no menu e nas telas de acesso */
.barra-lateral .marca, .marca-acesso { flex-direction: column; gap: .4rem; }
.barra-lateral .marca { align-items: flex-start; }
.barra-lateral .marca-sub, .marca-acesso .marca-sub { border-left: 0; padding-left: 0; }
.barra-lateral .logo-webz { height: 24px; }
.kpi-menor { font-size: clamp(1rem, 1.3vw, 1.3rem); }
/* Componentes do Bootstrap que herdam o fundo da página (cinza): forçar branco */
.list-group { --bs-list-group-bg: #fff; }
.dropdown-menu { --bs-dropdown-bg: #fff; }
.pagination { --bs-pagination-bg: #fff; --bs-pagination-disabled-bg: #f6f6f7; }
.nav-tabs { --bs-nav-tabs-link-active-bg: #fff; }
.input-group-text { background-color: #f6f6f7; }