/* ===== Copa T&F — Financeiro · tema vermelho & preto ===== */
:root {
  --verm: #d71920;
  --verm-esc: #a50f15;
  --verm-claro: #fdeaea;
  --preto: #0f0f10;
  --preto-2: #1a1a1c;
  --cinza: #6b6b70;
  --borda: #ececee;
  --fundo: #f6f6f7;
  --sidebar-w: 228px;
  --sidebar-mini: 68px;
  --bs-primary: #d71920;
  --bs-primary-rgb: 215, 25, 32;
  --bs-link-color: #d71920;
  --bs-link-color-rgb: 215, 25, 32;
  --bs-link-hover-color: #a50f15;
  --bs-link-hover-color-rgb: 165, 15, 21;
}
body { background: var(--fundo); font-size: .94rem; color: #1d1d1f; -webkit-font-smoothing: antialiased; }
a { text-decoration-thickness: 1px; text-underline-offset: 2px; }

.btn-primary { --bs-btn-bg: var(--verm); --bs-btn-border-color: var(--verm); --bs-btn-hover-bg: var(--verm-esc); --bs-btn-hover-border-color: var(--verm-esc); --bs-btn-active-bg: var(--verm-esc); --bs-btn-active-border-color: var(--verm-esc); --bs-btn-disabled-bg: var(--verm); --bs-btn-disabled-border-color: var(--verm); }
.btn-outline-primary { --bs-btn-color: var(--verm); --bs-btn-border-color: var(--verm); --bs-btn-hover-bg: var(--verm); --bs-btn-hover-border-color: var(--verm); --bs-btn-active-bg: var(--verm); --bs-btn-active-border-color: var(--verm); }
.btn-dark, .btn-success { --bs-btn-bg: var(--preto); --bs-btn-border-color: var(--preto); --bs-btn-hover-bg: #2a2a2d; --bs-btn-hover-border-color: #2a2a2d; --bs-btn-active-bg: #000; }
.btn-danger { --bs-btn-bg: var(--verm); --bs-btn-border-color: var(--verm); --bs-btn-hover-bg: var(--verm-esc); --bs-btn-hover-border-color: var(--verm-esc); }
.btn-outline-success { --bs-btn-color: var(--preto); --bs-btn-border-color: #bdbdc2; --bs-btn-hover-bg: var(--preto); --bs-btn-hover-border-color: var(--preto); --bs-btn-hover-color: #fff; }
.btn-outline-danger { --bs-btn-color: var(--verm); --bs-btn-border-color: #f0b3b5; --bs-btn-hover-bg: var(--verm); --bs-btn-hover-border-color: var(--verm); }
.page-item.active .page-link { background: var(--verm); border-color: var(--verm); }
.page-link { color: var(--preto); }
.bg-primary, .text-bg-primary { background-color: var(--verm) !important; color: #fff !important; }
.text-bg-dark { background-color: var(--preto) !important; }
.form-control:focus, .form-select:focus { border-color: #ef8a8e; box-shadow: 0 0 0 .2rem rgba(215,25,32,.14); }
.form-check-input:checked { background-color: var(--verm); border-color: var(--verm); }
.progress-bar.bg-primary { background: var(--preto) !important; }

/* Login / instalação */
.bg-login { background: radial-gradient(circle at 20% 0%, #3a0a0c 0%, var(--preto) 55%) fixed; }
.brand-logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: .8rem; letter-spacing: -.02em; color: #fff; background: var(--verm); flex-shrink: 0; }

/* ===== Layout ===== */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--preto); color: #b9b9be; position: fixed; top: 0; bottom: 0; left: 0; display: flex; flex-direction: column; z-index: 1045; overflow: hidden; transition: transform .22s ease; }
.sidebar .brand { display: flex; gap: .65rem; align-items: center; padding: 1.1rem 1rem 1rem; flex-shrink: 0; }
.brand-title { color: #fff; font-weight: 700; font-size: .95rem; line-height: 1.1; }
.brand-sub { font-size: .72rem; color: #7c7c82; }
.brand-txt { flex: 1; min-width: 0; white-space: nowrap; }
.btn-fechar { background: transparent; border: 0; color: #8d8d93; width: 32px; height: 32px; border-radius: 8px; }
.btn-fechar:hover { background: #222225; color: #fff; }

/* Menu: lista vertical simples, um item abaixo do outro */
.menu { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: .25rem .75rem 1rem; }
.menu ul { list-style: none; margin: 0; padding: 0; display: block; }
.menu li { display: block; margin: 0 0 2px; }
.menu-link { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .46rem .7rem; border-radius: 8px; color: #a8a8ae; font-size: .88rem; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-link i { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; opacity: .85; }
.menu-link span { overflow: hidden; text-overflow: ellipsis; }
.menu-link:hover { background: #1c1c1f; color: #fff; }
.menu-link.active { background: #1f1f22; color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--verm); }
.menu-link.active i { color: var(--verm); opacity: 1; }
.menu-titulo { font-size: .66rem; text-transform: uppercase; letter-spacing: .09em; color: #5f5f65; padding: 1.1rem .7rem .4rem; margin-top: .4rem; border-top: 1px solid #1f1f22; }

.sidebar-foot { padding: .75rem .9rem; border-top: 1px solid #1f1f22; display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.sidebar-foot a { color: #b9b9be; text-decoration: none; }
.perfil { display: flex; align-items: center; gap: .55rem; flex: 1; min-width: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #262629; color: #fff; display: grid; place-items: center; font-size: .8rem; font-weight: 700; flex-shrink: 0; }
.perfil-txt { font-size: .82rem; color: #e6e6e8; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perfil-txt small { display: block; color: #7c7c82; font-size: .7rem; }
.sidebar-foot a.sair { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: #ff6b70; flex-shrink: 0; }
.sidebar-foot a.sair:hover { background: #2a1113; color: #fff; }
.sidebar-backdrop { display: none; }

.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--borda); padding: .65rem 1.4rem; display: flex; gap: .75rem; align-items: center; min-height: 56px; }
.sel-edicao { width: auto; min-width: 92px; font-weight: 600; border-color: #dedee2; }
.page-title { font-size: 1.12rem; font-weight: 700; margin: 0; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { padding: 1.4rem; flex: 1; }
.foot { padding: .8rem 1.4rem; font-size: .72rem; color: #a0a0a6; }

/* Navegação inferior (celular) */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040; background: var(--preto); display: flex; justify-content: space-around; align-items: center; padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); box-shadow: 0 -4px 18px rgba(0,0,0,.18); }
.bottom-nav > a, .bottom-nav > button { flex: 1; background: none; border: 0; color: #8d8d93; text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .66rem; padding: .25rem 0; }
.bottom-nav > a i, .bottom-nav > button i { font-size: 1.2rem; }
.bottom-nav > .active { color: #fff; }
.bottom-nav > .active i { color: var(--verm); }
.bn-mais .dropdown-item { padding: .6rem 1rem; font-size: .92rem; }
.bn-mais { flex: 0 0 auto; margin: 0 .3rem; }
.btn-mais { width: 50px; height: 50px; border-radius: 50%; border: 3px solid var(--fundo); background: var(--verm); color: #fff; font-size: 1.45rem; display: grid; place-items: center; margin-top: -26px; box-shadow: 0 6px 16px rgba(215,25,32,.45); }
.bn-mais .dropdown-menu { margin-bottom: .6rem !important; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); width: 260px; }
  .sidebar.aberta { transform: none; }
  .sidebar.aberta + .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1041; }
  .main { margin-left: 0; }
  .topbar { padding: .55rem .9rem; min-height: 52px; }
  .page-title { font-size: 1.02rem; }
  .content { padding: .9rem .8rem calc(84px + env(safe-area-inset-bottom)); }
  .foot { display: none; }
}

/* ===== Componentes ===== */
.card { border: 1px solid var(--borda); border-radius: 14px; box-shadow: none; }
.card-header { background: #fff; font-weight: 600; font-size: .9rem; border-bottom: 1px solid #f1f1f3; border-radius: 14px 14px 0 0 !important; padding: .75rem 1rem; }
.card-header a { font-weight: 500; }
.card-footer { background: #fafafa; border-top: 1px solid #f1f1f3; }
.table { --bs-table-hover-bg: #fafafa; }
.table > :not(caption) > * > * { padding: .55rem .75rem; border-color: #f0f0f2; }
.table thead th { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: #8a8a90; font-weight: 600; white-space: nowrap; }
.table td.text-end, .table th.text-end { white-space: nowrap; }
.alert { border-radius: 12px; }

.kpi { border-radius: 14px; padding: 1rem 1.1rem; background: #fff; border: 1px solid var(--borda); height: 100%; }
.kpi-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: #8a8a90; font-weight: 600; display: flex; align-items: center; gap: .4rem; }
.kpi-label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #c7c7cc; flex-shrink: 0; }
.kpi-green .kpi-label::before { background: #1f9d55; }
.kpi-red .kpi-label::before { background: var(--verm); }
.kpi-purple .kpi-label::before, .kpi-dark .kpi-label::before { background: var(--preto); }
.kpi-dark { background: var(--preto); border-color: var(--preto); color: #fff; }
.kpi-dark .kpi-label, .kpi-dark .kpi-sub { color: #9d9da3; }
.kpi-dark .kpi-label::before { background: var(--verm); }
.kpi-valor { font-size: 1.45rem; font-weight: 800; margin: .2rem 0 .1rem; white-space: nowrap; letter-spacing: -.02em; }
.kpi-sub { font-size: .78rem; color: #8a8a90; }
.kpi-dark .kpi-valor.text-danger { color: #ff6b70 !important; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .45rem; vertical-align: middle; flex-shrink: 0; }
.pill { display: inline-block; padding: .35rem .75rem; border-radius: 999px; background: #fff; border: 1px solid var(--borda); font-size: .83rem; white-space: nowrap; }
.pill-success { background: #eef8f2; border-color: #cdebd9; }
.pill-danger { background: var(--verm-claro); border-color: #f6c5c7; }
.pill-warning { background: #fff7e3; border-color: #f1dfaa; }

.chart-box { position: relative; height: 280px; }
.chart-tall { height: 320px; }
.chart-small { height: 200px; }

.dre td, .dre th { white-space: nowrap; }
.dre .dre-grupo td { background: #f4f4f5; font-weight: 700; color: var(--preto); }
.dre .dre-resultado td { background: var(--preto); color: #fff; font-weight: 800; font-size: 1rem; }
.dre td:first-child, .dre th:first-child { position: sticky; left: 0; background: #fff; z-index: 1; }
.dre thead th:first-child { background: #f8f9fa; }
.dre .dre-grupo td:first-child { background: #f4f4f5; }
.dre .dre-resultado td:first-child { background: var(--preto); }

/* Lista de lançamentos em cartões (celular) */
.lanc-lista { display: flex; flex-direction: column; gap: .5rem; }
.lanc-item { background: #fff; border: 1px solid var(--borda); border-radius: 12px; padding: .75rem .85rem; }
.lanc-topo { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; }
.lanc-desc { font-weight: 600; line-height: 1.25; }
.lanc-valor { font-weight: 800; white-space: nowrap; }
.lanc-meta { font-size: .78rem; color: #8a8a90; margin-top: .25rem; display: flex; flex-wrap: wrap; gap: .15rem .7rem; align-items: center; }
.lanc-acoes { display: flex; gap: .35rem; justify-content: flex-end; margin-top: .55rem; flex-wrap: wrap; }
.lanc-acoes .btn { padding: .25rem .6rem; font-size: .8rem; }
.venc { color: var(--verm); font-weight: 600; }

@media (max-width: 575.98px) {
  .kpi { padding: .8rem .85rem; }
  .kpi-valor { font-size: 1.08rem; }
  .kpi-label { font-size: .64rem; }
  .kpi-sub { font-size: .7rem; }
  .chart-box { height: 240px; }
  .chart-tall { height: 300px; }
  .card-header { padding: .65rem .85rem; }
  .table > :not(caption) > * > * { padding: .45rem .55rem; }
  .form-control, .form-select { font-size: 16px; } /* evita zoom no iPhone */
  .form-control-sm, .form-select-sm { font-size: 15px; }
  h1, .h4 { font-size: 1.1rem; }
}

@media print {
  .sidebar, .topbar, .foot, .bottom-nav, .d-print-none, .btn, .alert-dismissible .btn-close, form.filtros { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; }
  body { background: #fff; font-size: 11px; }
  .card { break-inside: avoid; border-color: #ccc; }
  .kpi-dark { background: #fff; color: #000; }
  .dre .dre-resultado td { background: #ddd !important; color: #000 !important; }
  .chart-box { height: 220px; }
}
@media (max-width: 575.98px) { .chart-rosca { height: 380px; } }

/* Tons neutros no lugar do azul-claro padrão */
.text-bg-info { background-color: #2b2b2e !important; color: #fff !important; }
.bg-info-subtle { background-color: #f4f4f5 !important; }
.border-info { border-color: #dcdce0 !important; }
.text-info { color: var(--verm) !important; }
td:has(> .dot:first-child) { white-space: nowrap; }
