.stats-report {
  --stats-border: var(--theme-border, #dce5d9);
  --stats-surface: var(--theme-soft, #f3f7f2);
  --stats-muted: var(--theme-muted, #53665a);
  --stats-accent: var(--theme-accent, #14703d);
  min-width: 0;
}

.stats-report h4 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.stats-explainer {
  margin-top: 8px;
  font-size: .875rem;
}

.stats-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin: 20px 0;
}

.stats-filters .field {
  flex: 1 1 125px;
  min-width: 0;
  margin: 0;
}

.stats-filters .field[hidden] {
  display: none;
}

.stats-filters .btn {
  min-height: 44px;
}

.stats-status:empty {
  display: none;
}

.stats-empty,
.stats-status:not(:empty) {
  margin-top: 16px;
}

.stats-dates {
  font-size: .875rem;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 135px), 1fr));
  gap: 10px;
  margin: 10px 0 18px;
}

.stats-summary-card,
.stats-chart {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--stats-border);
  border-radius: 8px;
  background: var(--stats-surface);
}

.stats-summary-card dt {
  color: var(--stats-muted);
  font-size: .8125rem;
}

.stats-summary-card dd {
  margin: 3px 0 0;
  color: var(--stats-accent);
  font-size: clamp(1.125rem, 3vw, 1.5rem);
  font-weight: 700;
  line-height: 1.2;
}

.stats-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 12px;
}

.stats-chart-plot {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  margin-top: 10px;
  height: 110px;
}

.stats-chart-scale {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: end;
  line-height: 1;
}

.stats-chart-scale,
.stats-chart-dates {
  color: var(--stats-muted);
  font-size: .6875rem;
}

.stats-chart-bars {
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  border-block: 1px solid var(--stats-border);
}

.stats-chart-bars.stats-chart-dense {
  gap: 0;
}

.stats-chart-bar {
  display: flex;
  align-items: end;
  justify-content: center;
  flex: 1 1 0;
  min-width: 0;
}

.stats-chart-bar > span {
  width: min(100%, 70px);
  height: var(--stats-height);
  background: var(--stats-accent);
  border-radius: 2px 2px 0 0;
}

.stats-chart-dates {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
}

.stats-details {
  margin: 12px 0 22px;
}

.stats-details > summary {
  width: fit-content;
  min-height: 32px;
  color: var(--stats-accent);
  cursor: pointer;
}

.stats-table-wrap {
  overflow-x: auto;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8125rem;
}

.stats-table :is(th, td) {
  padding: 6px;
  border-bottom: 1px solid var(--stats-border);
  text-align: right;
}

.stats-table :is(th, td):first-child {
  text-align: left;
}

.stats-table th[scope="row"] {
  font-weight: 400;
}

.stats-sections ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.stats-sections li {
  display: grid;
  grid-template-columns: minmax(0, 140px) minmax(36px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding-block: 5px;
  font-size: .875rem;
}

.stats-section-meter {
  display: block;
  height: 7px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--stats-surface);
}

.stats-section-meter > span {
  display: block;
  width: var(--stats-width);
  height: 100%;
  background: var(--stats-accent);
}
