/* DRE — comparativo gerencial */

#analyticsDreView {
  --dg-brand: var(--tf-brand, #d32027);
  --dg-brand-dark: var(--tf-brand-dark, #b91c22);
  --dg-ink: var(--tf-text, #111827);
  --dg-muted: var(--tf-text-muted, #6b7280);
  --dg-line: var(--tf-border, #e5e7eb);
  --dg-field: #dfe3ea;
  --dg-surface: #fff;
  --dg-soft: var(--tf-surface-2, #f9fafb);
  --dg-brand-soft: var(--tf-brand-light, rgba(211, 32, 39, 0.06));
  --dg-up: var(--tf-success, #16a34a);
  --dg-down: var(--tf-danger, #dc2626);
  padding: 0.35rem 0 1.2rem;
  color: var(--dg-ink);
}

#analyticsDreView .dg-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  padding: 1rem 1.15rem 0.95rem;
  border: 1px solid var(--dg-line);
  border-top: 3px solid var(--dg-brand);
  border-radius: 14px;
  background: var(--dg-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

#analyticsDreView .dg-page-head h2 {
  margin: 0.15rem 0 0;
  color: var(--dg-ink);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

#analyticsDreView .dg-eyebrow {
  display: block;
  color: var(--dg-brand);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#analyticsDreView .dg-lead {
  margin: 0.25rem 0 0;
  color: var(--dg-muted);
  font-size: 0.84rem;
}

#analyticsDreView .dg-head-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

#analyticsDreView .dg-periodo {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  background: var(--dg-soft);
}

#analyticsDreView .dg-periodo span {
  color: var(--dg-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#analyticsDreView .dg-periodo strong {
  color: var(--dg-ink);
  font-size: 0.95rem;
  font-weight: 700;
}

#analyticsDreView .dg-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

#analyticsDreView .dg-sub {
  border: 1px solid var(--dg-line);
  background: var(--dg-surface);
  color: var(--dg-muted);
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

#analyticsDreView .dg-sub:hover { border-color: #cbd5e1; color: var(--dg-ink); }

#analyticsDreView .dg-sub.is-on {
  background: var(--dg-brand);
  border-color: var(--dg-brand);
  color: #fff;
}

#analyticsDreView .dg-filters-card {
  margin: 0 0 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(18, 33, 68, 0.06);
}

#analyticsDreView .dg-filters-head {
  display: flex;
  align-items: center;
}

#analyticsDreView .dg-filters-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0f172a;
}

#analyticsDreView .dg-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  align-items: flex-end;
  margin-top: 0.75rem;
}

#analyticsDreView .dg-filter {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 110px;
  flex: 1 1 140px;
}

#analyticsDreView .dg-filter--sm { flex: 0 1 130px; }
#analyticsDreView .dg-mes-filter { flex: 0 1 220px; min-width: 180px; }
#analyticsDreView .dg-filter--lg { flex: 1.4 1 220px; }
#analyticsDreView .dg-filter--xl { flex: 2 1 280px; }

#analyticsDreView .dg-filter label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  white-space: nowrap;
}

#analyticsDreView .dg-filter select {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  padding: 0 0.6rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  background: #fff;
  color: #0f172a;
  -webkit-text-fill-color: #0f172a;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#analyticsDreView .dg-filter select:focus {
  outline: none;
  border-color: #d32027;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(211, 32, 39, 0.12);
}

#analyticsDreView .dg-mes-multi { position: relative; }

#analyticsDreView .dg-mes-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  width: 100%;
  height: 36px;
  margin: 0;
  padding: 0 0.55rem 0 0.7rem;
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  box-shadow: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  transform: none;
}

#analyticsDreView .dg-mes-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#analyticsDreView .dg-mes-btn svg { flex: 0 0 auto; color: #64748b; }

#analyticsDreView .dg-mes-btn:hover,
#analyticsDreView .dg-mes-btn:active,
#analyticsDreView .dg-mes-btn[aria-expanded="true"] {
  background: #fff;
  color: #0f172a;
  border-color: #d32027;
  box-shadow: 0 0 0 3px rgba(211, 32, 39, 0.12);
  transform: none;
}

#analyticsDreView .dg-mes-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-height: 440px;
  overflow: auto;
  padding: 0.35rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

#analyticsDreView .dg-mes-panel.hidden { display: none; }

#analyticsDreView .dg-mes-panel .dg-mes-opcao {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.38rem 0.5rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: #0f172a;
  cursor: pointer;
}

#analyticsDreView .dg-mes-opcao:hover { background: #f8fafc; }

#analyticsDreView .dg-mes-opcao input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #d32027;
}

#analyticsDreView .dg-mes-off { color: #cbd5e1; }

#analyticsDreView.is-acomp .dg-mes-filter,
#analyticsDreView.is-extracao .dg-mes-filter,
#analyticsDreView.is-acomp .dg-conta-filter,
#analyticsDreView.is-extracao .dg-conta-filter { display: none; }

#analyticsDreView .dg-conta-filter { flex: 1.6 1 320px; min-width: 260px; }

#analyticsDreView .dg-conta-busca { position: relative; }

#analyticsDreView .dg-conta-busca input {
  width: 100%;
  height: 36px;
  margin: 0;
  padding: 0 2rem 0 0.7rem;
  border: 1px solid #dfe3ea;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

#analyticsDreView .dg-conta-busca input:focus {
  outline: none;
  border-color: #d32027;
  box-shadow: 0 0 0 3px rgba(211, 32, 39, 0.12);
}

#analyticsDreView .dg-conta-limpar {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  box-shadow: none;
  font-size: 1.1rem;
  line-height: 1;
  transform: none;
}

#analyticsDreView .dg-conta-limpar:hover,
#analyticsDreView .dg-conta-limpar:active {
  background: #f1f5f9;
  color: #0f172a;
  box-shadow: none;
  transform: none;
}

#analyticsDreView .dg-conta-lista {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 320px;
  margin: 0;
  padding: 0.3rem;
  overflow: auto;
  list-style: none;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

#analyticsDreView .dg-conta-lista.hidden { display: none; }

#analyticsDreView .dg-conta-opcao,
#analyticsDreView .dg-conta-vazio {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.42rem 0.5rem;
  border-radius: 6px;
  color: #0f172a;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

#analyticsDreView .dg-conta-opcao.is-active,
#analyticsDreView .dg-conta-opcao:hover { background: #f8fafc; }

#analyticsDreView .dg-conta-opcao .dg-conta-cod {
  flex: 0 0 auto;
  min-width: 0;
  margin: 0;
  color: #64748b;
}

#analyticsDreView .dg-conta-vazio {
  color: #94a3b8;
  font-weight: 500;
  cursor: default;
}

#analyticsDreView tr.dg-conta-ativa td {
  background: #fff7f7;
  box-shadow: inset 3px 0 0 #d32027;
}

#analyticsDreView tr.dg-conta-ativa td.dg-grupo { background: #fff7f7; }

#analyticsDreView .dg-sheets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}

#analyticsDreView .dg-sheet-tab {
  border: 1px solid var(--dg-line);
  background: var(--dg-surface);
  color: #475569;
  border-radius: 8px;
  padding: 0.42rem 0.85rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

#analyticsDreView .dg-sheet-tab:hover { border-color: #cbd5e1; color: var(--dg-ink); }

#analyticsDreView .dg-sheet-tab.is-on {
  background: var(--dg-brand-soft);
  border-color: var(--dg-brand);
  color: var(--dg-brand-dark);
}

#analyticsDreView .dg-error {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.82rem;
}

#analyticsDreView .dg-error.hidden { display: none; }

#analyticsDreView .dg-statement {
  background: var(--dg-surface);
  border: 1px solid var(--dg-line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  padding: 1rem 1rem 0.75rem;
}

#analyticsDreView .dg-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(145px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
  overflow-x: auto;
  padding-bottom: 0.1rem;
}

#analyticsDreView .dg-kpi {
  --dg-tom: var(--dg-brand);
  --dg-tom-soft: var(--dg-brand-soft);
  min-width: 145px;
  padding: 0.8rem 0.85rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  border-top: 3px solid var(--dg-tom);
}

#analyticsDreView .dg-kpi--receita { --dg-tom: #4f46e5; --dg-tom-soft: #eef2ff; }
#analyticsDreView .dg-kpi--liquida { --dg-tom: #7c3aed; --dg-tom-soft: #f5f3ff; }
#analyticsDreView .dg-kpi--bruto { --dg-tom: #0284c7; --dg-tom-soft: #eff6ff; }
#analyticsDreView .dg-kpi--margem { --dg-tom: #d97706; --dg-tom-soft: #fffbeb; }
#analyticsDreView .dg-kpi--ebitda { --dg-tom: #d32027; --dg-tom-soft: #fef2f2; }
#analyticsDreView .dg-kpi--resultado { --dg-tom: #0f172a; --dg-tom-soft: #f8fafc; }

#analyticsDreView .dg-kpi span {
  display: block;
  min-height: 2em;
  color: var(--dg-tom);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#analyticsDreView .dg-kpi strong {
  display: block;
  margin-top: 0.35rem;
  color: var(--dg-ink);
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

#analyticsDreView .dg-kpi small {
  display: block;
  margin-top: 0.25rem;
  color: var(--dg-muted);
  font-size: 0.68rem;
  font-weight: 650;
}

#analyticsDreView .dg-sheet {
  overflow: hidden;
  border: 1px solid var(--dg-line);
  border-radius: 14px;
  background: #fff;
}

#analyticsDreView .dg-sheet-title,
#analyticsDreView .dg-compare-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.9rem;
  background: var(--dg-soft);
  border-bottom: 1px solid var(--dg-line);
}

#analyticsDreView .dg-sheet-title span {
  color: var(--dg-brand);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#analyticsDreView .dg-sheet-title h3,
#analyticsDreView .dg-compare-card h3 {
  margin: 0.1rem 0 0;
  color: var(--dg-ink);
  font-size: 0.92rem;
}

#analyticsDreView .dg-sheet-title small { color: var(--dg-muted); }

#analyticsDreView .dg-sheet-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#analyticsDreView .dg-niveis {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--dg-field);
  border-radius: 8px;
  background: #fff;
}

#analyticsDreView .dg-nivel {
  border: 0;
  background: transparent;
  color: #475569;
  border-radius: 6px;
  padding: 0.28rem 0.65rem;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

#analyticsDreView .dg-nivel:hover { color: var(--dg-ink); background: #f8fafc; }

#analyticsDreView .dg-nivel.is-on {
  background: var(--dg-brand);
  color: #fff;
}

#analyticsDreView .dg-table td.dg-tree {
  white-space: nowrap;
}

#analyticsDreView .dg-tree-toggle,
#analyticsDreView .dg-tree-spacer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 0.45rem;
  vertical-align: middle;
  flex: 0 0 18px;
}

#analyticsDreView .dg-tree-toggle {
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #334155;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

#analyticsDreView .dg-tree-toggle:hover,
#analyticsDreView .dg-tree-toggle:active {
  border-color: var(--dg-brand);
  color: var(--dg-brand);
  transform: none;
  box-shadow: none;
}

#analyticsDreView .dg-tree-toggle[aria-expanded="true"] {
  border-color: var(--dg-brand);
  background: var(--dg-brand-soft);
  color: var(--dg-brand-dark);
}

#analyticsDreView .dg-tree-label { vertical-align: middle; }
#analyticsDreView td.dg-tree:has(.dg-tree-toggle) { cursor: pointer; }
#analyticsDreView td.dg-tree:has(.dg-tree-toggle) .dg-tree-label { cursor: pointer; }

#analyticsDreView .dg-tree-1 { padding-left: 1.75rem !important; }
#analyticsDreView .dg-tree-2 { padding-left: 3.3rem !important; }
#analyticsDreView .dg-tree-3 { padding-left: 5.1rem !important; }

#analyticsDreView tr.dg-nivel-sub td {
  background: #f8fafc;
  font-weight: 650;
  color: #1e293b;
}

#analyticsDreView tr.dg-nivel-sub td.dg-grupo { background: #f8fafc; }

#analyticsDreView tr.dg-nivel-conta td {
  font-size: 0.76rem;
  color: #475569;
}

#analyticsDreView tr.dg-nivel-lanc td {
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748b;
  background: #f8fafc;
}

#analyticsDreView tr.dg-nivel-lanc td.dg-grupo {
  background: #f8fafc;
}

#analyticsDreView tr.dg-lanc-info td {
  font-style: italic;
  color: #94a3b8;
}

#analyticsDreView .dg-conta-cod {
  display: inline-block;
  min-width: 7.2rem;
  margin-right: 0.5rem;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

#analyticsDreView .dg-table-wrap {
  overflow: auto;
  overflow-anchor: none;
  max-height: min(74vh, 860px);
}

#analyticsDreView .dg-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8rem;
}

#analyticsDreView .dg-table th,
#analyticsDreView .dg-table td {
  padding: 0.48rem 0.7rem;
  white-space: nowrap;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

#analyticsDreView .dg-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: right;
  color: #64748b;
  background: #f8fafc;
}

#analyticsDreView .dg-table thead th.dg-grupo,
#analyticsDreView .dg-table td.dg-grupo {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 320px;
  width: max-content;
  background: #fff;
  color: var(--dg-ink);
}

#analyticsDreView .dg-table thead th.dg-grupo {
  z-index: 4;
  background: #f8fafc;
}

#analyticsDreView .dg-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#analyticsDreView .dg-monthly-table { min-width: 1450px; }
#analyticsDreView .dg-monthly-table th:not(.dg-grupo),
#analyticsDreView .dg-monthly-table td:not(.dg-grupo) { min-width: 84px; }
#analyticsDreView .dg-monthly-table .dg-ytd {
  background: #fef2f2;
  color: var(--dg-brand-dark);
  font-weight: 700;
}

#analyticsDreView .dg-pct {
  display: inline-block;
  min-width: 4.2rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--dg-muted);
}

#analyticsDreView .dg-up { color: var(--dg-up); }
#analyticsDreView .dg-down { color: var(--dg-down); }
#analyticsDreView .dg-muted { color: #cbd5e1; font-weight: 500; }

#analyticsDreView tr.dg-result td { font-weight: 700; background: #f8fafc; }
#analyticsDreView tr.dg-result td.dg-grupo { background: #f8fafc; }
#analyticsDreView tr.dg-total td { border-top: 2px solid var(--dg-line); font-weight: 750; }

#analyticsDreView .dg-comparativos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}

#analyticsDreView .dg-compare-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--dg-line);
  border-radius: 14px;
  background: #fff;
}

#analyticsDreView .dg-compare-card > header p {
  margin: 0.15rem 0 0;
  color: var(--dg-muted);
  font-size: 0.7rem;
}

#analyticsDreView .dg-compare-orcado > header { background: #fffbeb; }
#analyticsDreView .dg-compare-orcado h3 { color: #92400e; }
#analyticsDreView .dg-compare-card .dg-table { min-width: 720px; }
#analyticsDreView .dg-compare-card .dg-table-wrap { max-height: 520px; }
#analyticsDreView .dg-compare-card .dg-table thead th.dg-grupo,
#analyticsDreView .dg-compare-card .dg-table td.dg-grupo {
  min-width: 360px;
  width: max-content;
}

#analyticsDreView .dg-acomp-head h2 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--dg-ink);
}

#analyticsDreView .dg-acomp-head p {
  margin: 0.25rem 0 0.9rem;
  color: var(--dg-muted);
  font-size: 0.82rem;
}

#analyticsDreView .dg-block-acomp { margin-bottom: 1.1rem; }

#analyticsDreView .dg-block-acomp h3 {
  margin: 0;
  padding: 0.5rem 0.8rem;
  background: #111827;
  color: #fff;
  font-size: 0.88rem;
  border-radius: 10px 10px 0 0;
  border-left: 3px solid var(--dg-brand);
}

#analyticsDreView .dg-acomp-scroll {
  overflow: auto;
  border: 1px solid var(--dg-line);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  background: #fff;
}

#analyticsDreView .dg-block-acomp table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

#analyticsDreView .dg-block-acomp th,
#analyticsDreView .dg-block-acomp td {
  padding: 0.32rem 0.55rem;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #334155;
}

#analyticsDreView .dg-block-acomp thead th {
  background: #1f2937;
  color: #fff;
  font-weight: 650;
  position: sticky;
  top: 0;
}

#analyticsDreView .dg-block-acomp tbody th {
  text-align: left;
  position: sticky;
  left: 0;
  background: #f8fafc;
  color: var(--dg-ink);
  font-weight: 650;
  min-width: 150px;
}

#analyticsDreView .dg-acomp-empty {
  color: var(--dg-muted);
  margin: 0.5rem 0;
}

#analyticsDreView .dg-ebitda {
  margin-top: 1.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--dg-line);
}

#analyticsDreView .dg-chart-card {
  border: 1px solid var(--dg-line);
  border-radius: 12px;
  padding: 0.8rem 0.9rem 0.6rem;
  margin-bottom: 1rem;
  background: #fff;
}

#analyticsDreView .dg-chart-card h3 {
  margin: 0 0 0.4rem;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--dg-ink);
}

#analyticsDreView .dg-chart-box {
  position: relative;
  height: 220px;
}

#analyticsDreView .dg-chart-box.dg-chart-tall { height: 340px; }

#analyticsDreView .dg-x-card {
  border: 1px solid var(--dg-line);
  border-radius: 14px;
  background: #fff;
  margin-bottom: 1.1rem;
  overflow: hidden;
}

#analyticsDreView .dg-x-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: var(--dg-soft);
  border-bottom: 1px solid var(--dg-line);
}

#analyticsDreView .dg-x-real header { box-shadow: inset 3px 0 0 var(--dg-brand); }
#analyticsDreView .dg-x-orc header { box-shadow: inset 3px 0 0 #d97706; background: #fffbeb; }

#analyticsDreView .dg-x-card h3 {
  margin: 0;
  font-size: 0.98rem;
  color: var(--dg-ink);
}

#analyticsDreView .dg-x-csv {
  border: 1px solid var(--dg-field);
  background: #fff;
  color: #0f172a;
  border-radius: 8px;
  padding: 0.32rem 0.75rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

#analyticsDreView .dg-x-csv:hover { background: #f8fafc; border-color: #cbd5e1; }

#analyticsDreView .dg-x-scroll { overflow: auto; max-height: 70vh; }

#analyticsDreView .dg-x-card table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.78rem;
}

#analyticsDreView .dg-x-card th,
#analyticsDreView .dg-x-card td {
  padding: 0.38rem 0.6rem;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #334155;
}

#analyticsDreView .dg-x-card thead th {
  position: sticky;
  background: #f8fafc;
  color: #64748b;
  font-weight: 700;
  font-size: 0.72rem;
  z-index: 1;
}

#analyticsDreView .dg-x-card thead tr:first-child th { top: 0; }
#analyticsDreView .dg-x-card thead tr:nth-child(2) th { top: 1.85rem; }
#analyticsDreView .dg-x-real thead tr:nth-child(2) th { background: #fef2f2; color: var(--dg-brand-dark); }
#analyticsDreView .dg-x-orc thead tr:nth-child(2) th { background: #fffbeb; color: #92400e; }

#analyticsDreView .dg-x-card tbody th,
#analyticsDreView .dg-x-card thead .dg-x-grupo {
  text-align: left;
  position: sticky;
  left: 0;
  min-width: 280px;
  background: #fff;
  color: var(--dg-ink);
  font-weight: 600;
  z-index: 2;
}

#analyticsDreView .dg-x-card thead .dg-x-grupo { z-index: 3; background: #f8fafc; }
#analyticsDreView .dg-x-card tr.dg-result th,
#analyticsDreView .dg-x-card tr.dg-result td { font-weight: 700; background: #f8fafc; }
#analyticsDreView .dg-x-card tr.dg-result th { background: #f1f5f9; }
#analyticsDreView .dg-x-card .dg-neg { color: var(--dg-down); }

@media (max-width: 1180px) {
  #analyticsDreView .dg-comparativos { grid-template-columns: 1fr; }
  #analyticsDreView .dg-kpis { grid-template-columns: repeat(3, minmax(145px, 1fr)); }
}

@media (max-width: 900px) {
  #analyticsDreView .dg-table td.dg-grupo,
  #analyticsDreView .dg-table th.dg-grupo { min-width: 220px; }
}

@media (max-width: 720px) {
  #analyticsDreView .dg-page-head {
    align-items: flex-start;
    flex-direction: column;
  }
  #analyticsDreView .dg-head-meta { justify-content: flex-start; }
  #analyticsDreView .dg-periodo { align-items: flex-start; }
  #analyticsDreView .dg-filter,
  #analyticsDreView .dg-filter--sm,
  #analyticsDreView .dg-filter--lg { flex: 1 1 100%; }
  #analyticsDreView .dg-kpis { grid-template-columns: repeat(2, minmax(145px, 1fr)); }
}
