/* Despesas x Lucro: painel do gráfico consumido pela aba Despesas (prefixo xchart-). */

.xchart-body { display: grid; gap: var(--s4); padding: var(--s5); }

.xchart-toggles { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: flex-end; }
.xchart-toggle-group { display: inline-flex; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-control); }
.xchart-toggle { min-height: 30px; padding: 0 12px; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.xchart-toggle + .xchart-toggle { border-left: 1px solid var(--line); }
.xchart-toggle:hover:not(:disabled):not(.is-active) { color: var(--text); }
.xchart-toggle:disabled { opacity: .45; cursor: not-allowed; }
.xchart-toggle.is-active { background: var(--overlay); color: var(--cyan); }
.xchart-toggle:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }

.xchart-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--s3); }
.xchart-total { display: grid; gap: 2px; padding: var(--s3); border: 1px solid var(--line-soft); border-radius: var(--radius-control); background: var(--raised); }
.xchart-total-label { color: var(--muted); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.xchart-total-value { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.xchart-total-value.is-negative { color: var(--red); }
.xchart-total--net { border-color: var(--line-strong); }
.xchart-total--net .xchart-total-value { color: var(--cyan); font-size: 17px; }
.xchart-total--net .xchart-total-value.is-negative { color: var(--red); }

.xchart-equation { margin: 0; color: var(--muted); font-size: 12px; }

.xchart-notice { padding: var(--s3); border: 1px solid rgba(232, 184, 90, .4); border-radius: var(--radius-control); color: var(--amber); font-size: 12px; }
.xchart-notice p { margin: 0; }
.xchart-notice ul { margin: 6px 0 0; padding-left: 18px; }

.xchart-chart { min-width: 0; }
.xchart-chart svg { display: block; width: 100%; height: auto; }

.xchart-bar-profit { fill: var(--green); }
.xchart-bar-profit.xchart-negative { fill: var(--red); }
.xchart-line-net { fill: none; stroke: var(--cyan); stroke-width: 2; }
.xchart-dot-net { fill: var(--cyan); }
.xchart-marker-fees { fill: var(--amber); }

.xchart-cat-operacao { --cat: #e0524f; fill: var(--cat); }
.xchart-cat-pessoal { --cat: #ec8b3f; fill: var(--cat); }
.xchart-cat-compras { --cat: #e6b53a; fill: var(--cat); }
.xchart-cat-manutencao { --cat: #c8a232; fill: var(--cat); }
.xchart-cat-frete { --cat: #b07a4a; fill: var(--cat); }
.xchart-cat-impostos { --cat: #8c5a3c; fill: var(--cat); }
.xchart-cat-outros { --cat: #9aa15f; fill: var(--cat); }

.legend-swatch.xchart-cat-operacao,
.legend-swatch.xchart-cat-pessoal,
.legend-swatch.xchart-cat-compras,
.legend-swatch.xchart-cat-manutencao,
.legend-swatch.xchart-cat-frete,
.legend-swatch.xchart-cat-impostos,
.legend-swatch.xchart-cat-outros { width: 10px; height: 10px; border-radius: 2px; background: var(--cat); }
.legend-swatch.xchart-net { width: 16px; height: 3px; background: var(--cyan); }
.legend-swatch.xchart-fees { width: 8px; height: 8px; background: var(--amber); transform: rotate(45deg); }

.xchart-pie { display: grid; gap: var(--s4); justify-items: center; }
.xchart-pie svg { width: min(220px, 100%); height: auto; }
.xchart-pie circle { fill: none; stroke: var(--cat, var(--red)); }
.xchart-pie-legend { display: grid; gap: 6px; width: 100%; max-width: 420px; }
.xchart-pie-row { display: flex; align-items: center; gap: 8px; color: var(--text-soft); font-size: 12px; }
.xchart-pie-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.xchart-pie-value, .xchart-pie-percent { color: var(--muted); font-variant-numeric: tabular-nums; }

.xchart-numbers { min-width: 0; }
.xchart-numbers summary { color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; }
.xchart-numbers summary:hover { color: var(--text); }
.xchart-numbers summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.xchart-numbers .table-scroll { margin-top: var(--s3); }

@media (max-width: 560px) {
  .xchart-body { padding: var(--s4); }
  .xchart-toggles { justify-content: flex-start; }
  .xchart-toggle { min-height: 34px; padding: 0 10px; }
}
.expense-chart-mount .chart-legend { flex-wrap: wrap; row-gap: 6px; }
.legend-swatch.xchart-bar-profit { width: 10px; height: 10px; border-radius: 2px; background: var(--green); }
