:root {
  --brand: #1f6feb;
  --sidebar-bg: #101828;
  --page: #f4f6fa;
  --surface: #ffffff;
  --ink: #111827;
  --ink-2: #4b5563;
  --muted: #8a94a6;
  --line: #e5e8ef;
  --good: #0a7a2f;
  --bad: #c62828;
  --sidebar-w: 248px;
}
* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--page); font-size: .925rem; }
a { color: var(--brand); }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover, .btn-brand:focus { filter: brightness(.9); color: #fff; background: var(--brand); border-color: var(--brand); }
.btn-outline-brand { border-color: var(--brand); color: var(--brand); }
.btn-outline-brand:hover { background: var(--brand); color: #fff; }
.text-good { color: var(--good) !important; }
.text-bad { color: var(--bad) !important; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- layout ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); color: #cbd5e1; display: flex; flex-direction: column; flex-shrink: 0; }
@media (min-width: 992px) { .sidebar { position: sticky; top: 0; height: 100vh; } }
/* O Bootstrap força fundo transparente no offcanvas-lg em telas grandes; aqui o menu mantém a cor. */
.sidebar.offcanvas-lg { --bs-offcanvas-bg: var(--sidebar-bg); --bs-offcanvas-width: var(--sidebar-w); background-color: var(--sidebar-bg) !important; }
.sidebar-brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.1rem .9rem; color: #fff; }
.brand-logo { max-height: 40px; max-width: 180px; object-fit: contain; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; color: #fff; font-size: 1.05rem; flex-shrink: 0; }
.brand-name { font-weight: 650; font-size: 1rem; line-height: 1.15; }
.sidebar-nav { padding: .25rem .6rem 1rem; overflow-y: auto; flex: 1; }
.side-section { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: #7c8aa3; padding: 1rem .6rem .35rem; }
.side-link { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 8px; color: #cbd5e1; text-decoration: none; font-size: .9rem; margin-bottom: 2px; }
.side-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.side-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-link.active { background: var(--brand); color: #fff; }
.sidebar-foot { padding: .8rem 1.2rem; font-size: .75rem; color: #7c8aa3; border-top: 1px solid rgba(255,255,255,.08); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .75rem; background: var(--surface); border-bottom: 1px solid var(--line); padding: .6rem 1.25rem; position: sticky; top: 0; z-index: 1010; }
.page-title { font-size: 1.15rem; font-weight: 650; margin: 0; }
.btn-icon { font-size: 1.4rem; line-height: 1; padding: .1rem .4rem; border: 0; }
.btn-user { display: flex; align-items: center; gap: .5rem; border: 0; font-size: .9rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 600; }
.content { padding: 1.25rem; max-width: 1600px; width: 100%; }
@media (max-width: 575px) { .content { padding: .9rem .75rem; } .topbar { padding: .5rem .75rem; } }

/* ---------- cards / kpis ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.2rem; margin-bottom: 1.1rem; }
.panel-title { font-size: .98rem; font-weight: 650; margin: 0 0 .15rem; }
.panel-sub { color: var(--ink-2); font-size: .8rem; margin-bottom: .8rem; }
.panel-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: .6rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: .85rem; margin-bottom: 1.1rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .95rem 1rem; display: flex; gap: .8rem; align-items: flex-start; min-width: 0; }
.kpi-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.15rem; flex-shrink: 0; background: color-mix(in srgb, var(--brand) 12%, white); color: var(--brand); }
.kpi.good .kpi-icon { background: #e4f4e8; color: var(--good); }
.kpi.bad .kpi-icon { background: #fde9e9; color: var(--bad); }
.kpi.cost .kpi-icon { background: #fdf0e3; color: #b45309; }
.kpi-body { min-width: 0; }
.kpi-label { font-size: .78rem; color: var(--ink-2); }
.kpi-value { font-size: 1.35rem; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.kpi.bad .kpi-value { color: var(--bad); }
.kpi-badge { font-size: .72rem; color: #92400e; margin-top: .15rem; }
.kpi-value.na { color: var(--muted); font-size: 1rem; font-weight: 500; }

.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.chart-grid .panel { margin-bottom: 0; }
.chart-grid .wide { grid-column: 1 / -1; }
@media (max-width: 991px) { .chart-grid { grid-template-columns: minmax(0, 1fr); } }
.chart-box { position: relative; height: 290px; }
.chart-box.tall { height: 340px; }
.chart-empty { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: .88rem; text-align: center; }

/* ---------- filtros / tabelas ---------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; margin-bottom: 1.1rem; }
.filter-bar .form-label, .form-label { font-size: .76rem; color: var(--ink-2); margin-bottom: .2rem; font-weight: 500; }
.filter-range { align-self: center; }
.table { font-size: .86rem; margin-bottom: 0; --bs-table-bg: transparent; }
.table thead th { font-size: .73rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-2); font-weight: 600; background: #f8f9fc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td, .table th { padding: .55rem .7rem; vertical-align: middle; }
.table tfoot td { font-weight: 650; background: #f8f9fc; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.mk-badge { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.mk-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.empty-state { text-align: center; padding: 2.2rem 1rem; color: var(--ink-2); }
.empty-state i { font-size: 2.2rem; color: var(--muted); display: block; margin-bottom: .5rem; }
code.copy { background: #f1f3f8; padding: .25rem .45rem; border-radius: 6px; font-size: .8rem; word-break: break-all; color: var(--ink); display: inline-block; }

/* ---------- integrações ---------- */
.integ-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1.1rem; }
.integ-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; border-top: 4px solid var(--mk, var(--brand)); display: flex; flex-direction: column; gap: .6rem; }
.integ-card h3 { font-size: 1rem; font-weight: 650; margin: 0; }
.integ-account { border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; text-decoration: none; color: inherit; }
.integ-account:hover { border-color: var(--brand); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: .35rem; background: var(--muted); }
.status-dot.ok { background: #0ca30c; } .status-dot.err { background: #d03b3b; } .status-dot.warn { background: #f59e0b; }

/* ---------- auth ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--sidebar-bg) 0%, color-mix(in srgb, var(--sidebar-bg) 70%, var(--brand)) 100%); padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 2rem 1.9rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-card.wide { max-width: 520px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-bottom: 1.3rem; color: var(--ink); }
.auth-brand .brand-name { font-size: 1.2rem; }
.auth-brand .brand-logo { max-height: 56px; max-width: 240px; }
.auth-card h1 { font-size: 1.15rem; font-weight: 650; text-align: center; margin-bottom: .3rem; }
.auth-card .lead-sm { text-align: center; color: var(--ink-2); font-size: .86rem; margin-bottom: 1.2rem; }

.report-card { display: flex; gap: .8rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; text-decoration: none; color: inherit; height: 100%; }
.report-card:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.report-card i { font-size: 1.4rem; color: var(--brand); }
.swatch { width: 44px; height: 34px; padding: 2px; }
