.dashboard-heading,
.reports-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.report-period-card,
.report-filter-card {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.report-period-card {
  grid-template-columns: minmax(10rem, auto) auto minmax(20rem, 1fr);
  align-items: end;
}

.report-period-card h2,
.report-section-heading h2,
.dashboard-panel h2,
.report-list-card h2 {
  margin: .2rem 0 0;
}

.report-period-tabs,
.report-quick-periods,
.report-tabs {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
}

.report-period-tabs a,
.report-quick-periods a,
.report-custom-radio,
.report-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  padding: .65rem .9rem;
  border-radius: .75rem;
  background: #e8f3f1;
  color: #075e57;
  text-decoration: none;
  font-weight: 800;
}

.report-period-tabs a.is-active,
.report-quick-periods a.is-active,
.report-tabs a.is-active,
.report-custom-radio:has(input:checked) {
  background: #0f8278;
  color: #fff;
}

.report-custom-radio {
  cursor: pointer;
}

.report-custom-radio input {
  width: 1px;
  height: 1px;
  opacity: 0;
  position: absolute;
}

.report-custom-period,
.report-filter-grid {
  display: grid;
  gap: .65rem;
}

.report-custom-period {
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: end;
}

.report-custom-period label,
.report-filter-grid label,
.report-more-filters label {
  display: grid;
  gap: .3rem;
  color: #405553;
  font-size: .82rem;
  font-weight: 750;
}

.dashboard-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
  margin-bottom: 1rem;
}

.dashboard-metric-card {
  min-width: 0;
  display: grid;
  gap: .35rem;
}

.dashboard-metric-card span {
  color: #61716f;
  font-size: .82rem;
}

.dashboard-metric-card strong {
  color: #102826;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  overflow-wrap: anywhere;
}

.dashboard-metric-card small {
  color: #687977;
}

.metric-primary {
  border-color: #8bcfc7;
  background: #edf9f7;
}

.metric-profit {
  border-color: #a8d9b8;
  background: #f0faf3;
}

.metric-warning {
  border-color: #e6c16d;
  background: #fffaf0;
}

.dashboard-content-grid,
.report-two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.dashboard-panel-wide {
  grid-column: 1 / -1;
}

.dashboard-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .8rem;
}

.dashboard-panel-heading a {
  color: #075e57;
  font-weight: 800;
  text-decoration: none;
}

.dashboard-row-list,
.report-ranked-list {
  display: grid;
  gap: .55rem;
}

.dashboard-row,
.report-ranked-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  min-width: 0;
  padding: .78rem;
  border: 1px solid #dbe7e5;
  border-radius: .75rem;
  color: inherit;
  text-decoration: none;
}

.dashboard-row > span:first-child,
.report-ranked-row > div:first-child {
  min-width: 0;
}

.dashboard-row strong,
.dashboard-row small,
.report-ranked-row strong,
.report-ranked-row small,
.report-ranked-values span {
  display: block;
}

.dashboard-row small,
.report-ranked-row small,
.report-ranked-values span {
  margin-top: .15rem;
  color: #687977;
  font-size: .8rem;
}

.dashboard-row-amount,
.report-ranked-values {
  flex: 0 0 auto;
  text-align: right;
}

.report-filter-card {
  position: sticky;
  top: .6rem;
  z-index: 5;
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(8px);
}

.report-filter-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.report-more-filters {
  border: 1px solid #d6e2e0;
  border-radius: .75rem;
  padding: .75rem;
}

.report-more-filters summary {
  cursor: pointer;
  color: #075e57;
  font-weight: 800;
}

.report-more-filters[open] summary {
  margin-bottom: .65rem;
}

.report-more-filters label {
  max-width: 24rem;
}

.report-filter-actions {
  display: flex;
  gap: .65rem;
}

.report-tabs {
  margin: 1rem 0;
}

.report-tabs a {
  flex: 1 1 11rem;
}

.report-section-heading {
  margin-bottom: .8rem;
}

.report-section-heading > p:last-child {
  margin: .25rem 0 0;
  color: #687977;
}

.report-current-state {
  margin-top: 1.2rem;
}

.report-list-card {
  min-width: 0;
}

.report-ranked-values {
  min-width: 7.5rem;
}

@media (max-width: 1050px) {
  .dashboard-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-period-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .report-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dashboard-heading,
  .reports-heading,
  .dashboard-panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-heading .button,
  .reports-heading .button {
    width: 100%;
  }

  .dashboard-metric-grid,
  .dashboard-content-grid,
  .report-two-column,
  .report-filter-grid,
  .report-custom-period {
    grid-template-columns: 1fr;
  }

  .dashboard-panel-wide {
    grid-column: auto;
  }

  .report-filter-card {
    position: static;
  }

  .report-filter-actions,
  .report-tabs,
  .report-period-tabs,
  .report-quick-periods {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .report-filter-actions .button,
  .report-tabs a,
  .report-period-tabs a,
  .report-quick-periods a,
  .report-custom-radio {
    width: 100%;
  }

  .dashboard-row,
  .report-ranked-row {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-row-amount,
  .report-ranked-values {
    text-align: left;
  }
}

@media (max-width: 440px) {
  .dashboard-metric-grid,
  .report-filter-actions,
  .report-tabs,
  .report-period-tabs,
  .report-quick-periods {
    grid-template-columns: 1fr;
  }
}
