.home-panel {
  container-type: inline-size;
  min-width: 0;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.home-filters,
.home-heading,
.home-section,
.home-footer {
  padding: 11px 15px;
}

.home-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 170px));
  gap: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.home-filters label {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: var(--subtle);
  font-size: 13px;
}

.home-filter-control {
  position: relative;
  min-width: 0;
}

.home-filter-control::after {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: 13px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: '';
  pointer-events: none;
  transform: translateY(-70%) rotate(45deg);
}

.home-filter-control select {
  appearance: none;
  display: block;
  width: 100%;
  min-height: 36px;
  padding-inline: 10px 30px;
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  text-overflow: ellipsis;
}

.home-filter-control.selected {
  color: var(--accent-text);
}

.home-filter-control.selected select {
  border-color: #bed4e5;
  background: var(--accent-soft);
  color: inherit;
  font-weight: 550;
}

.home-filter-control select:hover {
  border-color: #b7cddc;
}

.home-heading,
.home-heading-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 12px;
}

.home-heading {
  justify-content: space-between;
}

.home-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
  font-weight: 650;
}

.home-total {
  color: var(--subtle);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.home-total strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
}

.home-period {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.home-period button,
.home-refresh button {
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--subtle);
  font-size: 13px;
  white-space: nowrap;
}

.home-period button.selected,
.home-period button.selected:hover,
.home-refresh button:hover {
  color: var(--accent-text);
  background: var(--accent-soft);
}

.home-period button.selected {
  font-weight: 650;
}

.home-section {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: start;
  border-top: 1px solid var(--line-soft);
}

.home-section h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.home-stat {
  min-width: 0;
  padding: 0 12px;
  border-inline-start: 1px solid var(--line-soft);
  overflow-wrap: anywhere;
}

.home-stat .label {
  color: var(--subtle);
  font-size: 13px;
}

.home-stat .value {
  margin: 3px 0 2px;
  color: var(--ink);
  font-size: clamp(19px, 2vw, 23px);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.home-stat .comparison,
.home-note,
.home-refresh {
  margin: 0;
  color: var(--subtle);
  font-size: 12px;
}

.home-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 3px 12px;
  border-top: 1px solid var(--line-soft);
}

.home-refresh {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
}

.home-refresh button {
  color: var(--accent-text);
}

.home-trend .home-note {
  padding: 0 15px 10px;
}

.home-chart {
  max-width: 100%;
  margin: 0 15px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.home-chart svg {
  display: block;
  width: 100%;
  min-width: 550px;
  height: auto;
}

.home-chart text {
  fill: var(--subtle);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.home-chart svg > line {
  stroke: var(--line-soft);
}

.home-chart .line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
}

.home-chart circle {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 1.5;
}

@container (max-width: 640px) {
  .home-section {
    display: block;
  }

  .home-section h3 {
    margin-bottom: 7px;
  }

  .home-stat:first-child {
    padding-inline-start: 0;
    border-inline-start: 0;
  }
}

@container (max-width: 400px) {
  .home-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 8px;
  }

  .home-stat {
    padding-inline: 9px;
  }

  .home-stat:nth-child(odd) {
    padding-inline-start: 0;
    border-inline-start: 0;
  }
}

@media (pointer: coarse) {
  .home-filter-control select {
    min-height: 44px;
  }

  .home-period button,
  .home-refresh button {
    min-height: 40px;
  }
}
