.reports {
  --report-surface: var(--surface, #fff);
  --report-subtle: var(--surface-alt, #f4f8f6);
  --report-line: var(--line, #dbe5e0);
  --report-ink: var(--text, #122b29);
  --report-muted: var(--muted, #5a6d69);
  --report-accent: var(--accent, #076951);
  --report-accent-subtle: var(--accent-soft, #e9f5ee);
  --report-radius: var(--radius, 14px);
  display: grid;
  gap: 20px;
  min-width: 0;
  color: var(--report-ink);
}

.reports h1,
.reports h2,
.reports p {
  margin: 0;
}

.reports :focus-visible {
  outline: 2px solid var(--report-accent);
  outline-offset: 2px;
}

.reports-heading,
.reports-toolbar,
.reports-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
}

.reports-heading h1 {
  font-size: clamp(1.55rem, 2.5vw, 2rem);
  line-height: 1.3;
  letter-spacing: -.035em;
}

.reports-heading p {
  margin-top: 5px;
  color: var(--report-muted);
  font-size: .875rem;
}

.reports-toolbar {
  justify-content: flex-start;
  align-items: end;
}

.reports-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--report-line);
  border-radius: 10px;
  background: var(--report-subtle);
}

.reports-tab {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 4px 12px;
  border-radius: 7px;
  color: var(--report-muted);
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
}

.reports-tab:hover,
.reports-tab[aria-current="page"] {
  background: var(--report-surface);
  color: var(--report-accent);
}

.reports-tab[aria-current="page"] {
  box-shadow: 0 1px 3px #142d1e1c;
}

.reports-filter {
  display: grid;
  gap: 5px;
  color: var(--report-muted);
  font-size: .8rem;
  font-weight: 600;
}

.reports-filter select,
.reports-filter input {
  min-width: 96px;
  max-width: 100%;
  min-height: 36px;
  padding: 5px 10px;
  border: 1px solid var(--report-line);
  border-radius: 8px;
  background: var(--report-surface);
  color: var(--report-ink);
  font: inherit;
  font-size: .875rem;
}

.reports-body {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.reports-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 14px;
  margin: 0;
}

.reports-card,
.reports-panel {
  min-width: 0;
  border: 1px solid var(--report-line);
  border-radius: var(--report-radius);
  background: var(--report-surface);
  box-shadow: var(--shadow);
}

.reports-card {
  padding: 17px 18px;
}

.reports-card dt {
  color: var(--report-muted);
  font-size: .875rem;
  font-weight: 600;
}

.reports-card dd {
  margin: 7px 0 0;
  color: var(--report-ink);
  font-size: clamp(1.3rem, 2vw, 1.65rem);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.reports-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 18px;
}

.reports-panel-header {
  padding: 17px 18px;
}

.reports-panel-header h2 {
  font-size: 1rem;
  font-weight: 700;
}

.reports-chart {
  margin: 0;
  padding: 4px 18px 18px;
  list-style: none;
  display: grid;
  grid-template-columns: minmax(4.1rem, min(28%, 8rem)) minmax(12px, 1fr) max-content;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.reports-chart-item {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: span 3;
  align-items: center;
  gap: 10px;
  color: var(--report-muted);
  font-size: .8rem;
}

.reports-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 0 18px 10px;
  color: var(--report-muted);
  font-size: .8rem;
  list-style: none;
}

.reports-legend li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.reports-legend li::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--report-accent);
  content: '';
}

.reports-chart-label {
  overflow-wrap: anywhere;
}

.reports-chart-track {
  height: 8px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--report-accent-subtle);
}

.reports-chart-bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--report-accent);
}

.reports-chart-bar[data-series="1"],
.reports-legend [data-series="1"]::before {
  background: #a85a34;
}

.reports-chart-value,
.reports-number {
  color: var(--report-ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reports-chart-value {
  text-align: right;
}

.reports-scroll {
  max-width: 100%;
  overflow: auto;
  border-radius: 0 0 var(--report-radius) var(--report-radius);
}

.reports-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  text-align: left;
}

.reports-table th,
.reports-table td {
  padding: 10px 14px;
  border-top: 1px solid var(--report-line);
  vertical-align: middle;
}

.reports-table :is(th, td):first-child {
  padding-left: 18px;
}

.reports-table :is(th, td):last-child {
  padding-right: 18px;
}

.reports-table thead th {
  background: var(--report-subtle);
  color: var(--report-muted);
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
}

.reports-table tbody tr:hover {
  background: var(--report-subtle);
}

.reports-table .reports-number {
  text-align: right;
}

.reports-status {
  display: grid;
  justify-items: start;
  gap: 12px;
  padding: 20px 18px;
  color: var(--report-muted);
  font-size: .875rem;
  line-height: 1.5;
}

.reports-status[role="alert"] {
  color: var(--danger, #a72c39);
}

.reports-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 4px 11px;
  border: 1px solid var(--report-line);
  border-radius: 8px;
  background: var(--report-surface);
  color: var(--report-accent);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.reports-button:hover:not(:disabled) {
  border-color: var(--report-accent);
  background: var(--report-accent-subtle);
}

.reports-primary {
  background: var(--report-accent);
  border-color: var(--report-accent);
  color: #fff;
}

.reports-primary:hover:not(:disabled) {
  background: var(--accent-hover, #005554);
}

.reports-button:disabled {
  opacity: .65;
  cursor: default;
}

.reports-pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--report-line);
  color: var(--report-muted);
  font-size: .875rem;
}

.reports-pagination span {
  margin-right: auto;
}

.reports-dialog {
  width: min(560px, calc(100% - 24px));
  max-height: calc(100% - 32px);
  padding: 20px;
  border: 1px solid var(--report-line);
  border-radius: var(--report-radius);
  background: var(--report-surface);
  color: var(--report-ink);
}

.reports-dialog::backdrop {
  background: #142a346e;
}

.reports-editor {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 198px), 1fr));
  gap: 12px;
  margin-top: 16px;
}

.reports-editor-actions,
.reports-form-error,
.reports-editor-group {
  grid-column: 1 / -1;
}

.reports-editor-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 198px), 1fr));
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 8px 12px 12px;
  border: 1px solid var(--report-line);
  border-radius: var(--report-radius);
}

.reports-editor-group legend {
  padding: 0 5px;
  font-weight: 600;
}

.reports-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.reports-form-error {
  color: var(--danger, #a72c39);
  white-space: pre-wrap;
}

.reports-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.reports-table .reports-actions {
  min-width: max-content;
}

.reports-dialog-wide {
  width: min(780px, calc(100% - 24px));
}

.reports-audit-detail {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.reports-audit-detail .reports-columns {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 12px;
}

.reports-audit-detail .reports-actions {
  justify-content: flex-end;
}

.reports-snapshot {
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--report-line);
  color: var(--report-muted);
  font-size: .875rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.reports-import {
  display: grid;
  justify-items: start;
  gap: 12px;
  margin-top: 14px;
}

.reports-import :is(.reports-import-mapping, .reports-import-preview, .reports-filter) {
  min-width: 0;
  width: 100%;
}

.reports-import-mapping > summary {
  color: var(--report-accent);
  cursor: pointer;
}

.reports-import-errors {
  color: var(--danger, #a72c39);
}

@media (max-width: 820px) {
  .reports-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}
