:root {
  --rompoda-chart-font: "DM Sans", "Inter", system-ui, sans-serif;
  --rompoda-chart-revenue: #3f95f7;
  --rompoda-chart-revenue-strong: #2377d5;
  --rompoda-chart-revenue-light: #65a9f8;
  --rompoda-chart-revenue-previous: #a8cffb;
  --rompoda-chart-commission: #2f7257;
  --rompoda-chart-commission-previous: #9abdab;
  --rompoda-chart-positive: #2f7257;
  --rompoda-chart-warning: #946518;
  --rompoda-chart-negative: #a54f4f;
  --rompoda-chart-axis: #777e78;
  --rompoda-chart-label: #626963;
  --rompoda-chart-grid: #dedfd9;
  --rompoda-chart-pointer: #aeb4ad;
  --rompoda-chart-surface: #fff;
  --rompoda-chart-text: #262a27;
  --rompoda-chart-tooltip-surface: #fff;
  --rompoda-chart-tooltip-border: #dedfd9;
}

[data-theme="dark"] {
  --rompoda-chart-revenue: #6ba0e0;
  --rompoda-chart-revenue-strong: #8bb5e7;
  --rompoda-chart-revenue-light: #8bb5e7;
  --rompoda-chart-revenue-previous: #557391;
  --rompoda-chart-commission: #72b995;
  --rompoda-chart-commission-previous: #4f7863;
  --rompoda-chart-positive: #72b995;
  --rompoda-chart-warning: #d5aa61;
  --rompoda-chart-negative: #df8b8b;
  --rompoda-chart-axis: #939c94;
  --rompoda-chart-label: #bcc4bd;
  --rompoda-chart-grid: #363d38;
  --rompoda-chart-pointer: #5b665e;
  --rompoda-chart-surface: #202522;
  --rompoda-chart-text: #eef1ed;
  --rompoda-chart-tooltip-surface: #252b27;
  --rompoda-chart-tooltip-border: #424a44;
}

.rcs-chart {
  width: 100%;
  min-width: 0;
  min-height: var(--rcs-chart-height, 272px);
  font-family: var(--rompoda-chart-font);
}

.rcs-chart--state {
  display: grid;
  place-items: center;
}

.rcs-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 8px;
}

.rcs-legend button {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--rompoda-chart-label);
  font: 500 11px/1.25 var(--rompoda-chart-font);
  cursor: pointer;
}

.rcs-legend button:hover,
.rcs-legend button:focus-visible {
  color: var(--rompoda-chart-text);
}

.rcs-legend button:focus-visible {
  border-radius: 3px;
  outline: 2px solid color-mix(in srgb, var(--rompoda-chart-revenue) 42%, transparent);
  outline-offset: 2px;
}

.rcs-legend button[aria-pressed="false"] {
  opacity: 0.42;
  text-decoration: line-through;
}

.rcs-legend__marker {
  display: inline-block;
  width: 12px;
  height: 2px;
  border-radius: 1px;
  background: var(--rcs-legend-color);
}

.rcs-legend__marker.is-previous {
  height: 1px;
  background:
    repeating-linear-gradient(
      90deg,
      var(--rcs-legend-color) 0 3px,
      transparent 3px 5px
    );
}

.rcs-tooltip {
  min-width: 176px;
  padding: 10px 12px;
  color: var(--rompoda-chart-text);
  font-family: var(--rompoda-chart-font);
  font-size: 12px;
}

.rcs-tooltip__title {
  padding-bottom: 7px;
  border-bottom: 1px solid var(--rompoda-chart-tooltip-border);
  margin-bottom: 6px;
  color: var(--rompoda-chart-label);
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

.rcs-tooltip__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 3px 0;
}

.rcs-tooltip__name {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  color: var(--rompoda-chart-label);
}

.rcs-tooltip__marker {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 2px;
  background: var(--rcs-tooltip-color);
}

.rcs-tooltip__value {
  color: var(--rompoda-chart-text);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.rcs-state {
  display: grid;
  max-width: 280px;
  place-items: center;
  gap: 8px;
  padding: 24px;
  color: var(--rompoda-chart-label);
  text-align: center;
}

.rcs-state__mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--rompoda-chart-grid);
  border-radius: 6px;
  background: var(--rompoda-chart-surface);
  color: var(--rompoda-chart-axis);
  font: 600 12px/1 var(--rompoda-chart-font);
}

.rcs-state--error .rcs-state__mark {
  border-color: color-mix(in srgb, var(--rompoda-chart-negative) 35%, transparent);
  color: var(--rompoda-chart-negative);
}

.rcs-state__mark--loading {
  border-color: var(--rompoda-chart-revenue-previous);
  border-top-color: var(--rompoda-chart-revenue);
  border-radius: 50%;
  animation: rcs-spin 720ms linear infinite;
}

.rcs-state__text {
  font: 500 12px/1.45 var(--rompoda-chart-font);
}

.rcs-data-table {
  margin: 4px 8px 0;
  color: var(--rompoda-chart-label);
  font: 500 11px/1.4 var(--rompoda-chart-font);
}

.rcs-data-table summary {
  width: max-content;
  padding: 4px 0;
  cursor: pointer;
}

.rcs-data-table table {
  width: 100%;
  margin-top: 6px;
  border-collapse: collapse;
  color: var(--rompoda-chart-text);
  font-variant-numeric: tabular-nums;
}

.rcs-data-table th,
.rcs-data-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--rompoda-chart-grid);
  text-align: right;
}

.rcs-data-table th:first-child,
.rcs-data-table td:first-child {
  text-align: left;
}

@keyframes rcs-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 560px) {
  .rcs-legend {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rcs-state__mark--loading {
    animation: none;
    border-style: dashed;
  }
}
