/* Statistics page: period picker, main-figure tiles and chart cards. */

#block-activity-stats {
  --stats-c0: #254a9f;
  --stats-c1: #5f86d6;
  --stats-c2: #d9a441;
  --stats-c3: #2a8c88;
  --stats-c4: #a9bbe3;
  --stats-c5: #6c7a8e;
  --stats-ink: #0f1e40;
  --stats-line: #e1e6ef;
  --stats-soft: #f4f6fb;
}

/* picker: years, then the periods of the chosen year */
#block-activity-stats .stats-picker {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  background: var(--stats-soft);
  border: 1px solid var(--stats-line);
}

#block-activity-stats .stats-picker-row { display: flex; align-items: center; gap: 1rem; }

#block-activity-stats .stats-picker-label {
  flex: none;
  width: 2rem;
  font-size: .85rem;
  font-weight: 600;
  color: #6c757d;
}

#block-activity-stats .stats-chips { display: flex; flex-wrap: wrap; gap: .5rem; }

#block-activity-stats .stats-chip {
  border: 1px solid var(--stats-line);
  background: #fff;
  color: var(--stats-ink);
  border-radius: 999px;
  padding: .4rem 1.05rem;
  font-weight: 600;
  line-height: 1.2;
  transition: background-color .15s, color .15s, border-color .15s;
}

#block-activity-stats .stats-chip-sm { font-size: .875rem; padding: .32rem .9rem; }

#block-activity-stats .stats-chip:hover { border-color: var(--stats-c0); color: var(--stats-c0); }

#block-activity-stats .stats-chip.active { background: var(--stats-c0); border-color: var(--stats-c0); color: #fff; }

/* period panel */
#block-activity-stats .stats-panel { display: flex; flex-direction: column; gap: 1.5rem; }

#block-activity-stats .stats-panel.d-none { display: none !important; }

#block-activity-stats .stats-panel-title {
  margin: 0;
  font-size: clamp(1.35rem, 1.15rem + .6vw, 1.75rem);
  font-weight: 700;
  color: var(--stats-ink);
}

/* main-figure tiles */
#block-activity-stats .stats-tile {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  padding: 1.15rem 1.25rem;
  border-radius: 1rem;
  background: #fff;
  border: 1px solid var(--stats-line);
  border-top: 3px solid var(--stats-c0);
  color: inherit;
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}

#block-activity-stats .stats-tile:hover { box-shadow: 0 6px 18px rgba(15, 30, 64, .08); }

#block-activity-stats .stats-tile-head { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: .35rem; }

#block-activity-stats .stats-tile-icon {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: .6rem;
  background: rgba(37, 74, 159, .08);
  color: var(--stats-c0);
}

#block-activity-stats .stats-tile-title { font-size: .875rem; font-weight: 600; line-height: 1.35; color: #495057; }

#block-activity-stats .stats-tile-value {
  margin-top: auto;
  font-size: clamp(1.5rem, 1.25rem + .8vw, 2rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--stats-c0);
  font-variant-numeric: tabular-nums;
}

#block-activity-stats .stats-tile-label { font-size: .8rem; line-height: 1.35; color: #6c757d; }

/* chart cards */
#block-activity-stats .stats-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: 1rem;
  background: #fff;
  border: 1px solid var(--stats-line);
  scroll-margin-top: 110px;
}

#block-activity-stats .stats-card-head { display: flex; align-items: flex-start; gap: .85rem; }

#block-activity-stats .stats-card-num {
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  border-radius: .55rem;
  background: var(--stats-soft);
  color: var(--stats-c0);
  font-weight: 700;
}

#block-activity-stats .stats-card-title { margin: 0; font-size: 1.05rem; font-weight: 700; line-height: 1.35; color: var(--stats-ink); }

#block-activity-stats .stats-card-sub { color: #6c757d; }

#block-activity-stats .stats-view {
  flex: none;
  display: inline-flex;
  padding: .2rem;
  border-radius: .6rem;
  background: var(--stats-soft);
}

#block-activity-stats .stats-view button {
  border: 0;
  background: transparent;
  color: #6c757d;
  width: 2.1rem;
  height: 1.9rem;
  border-radius: .45rem;
}

#block-activity-stats .stats-view button.active { background: #fff; color: var(--stats-c0); box-shadow: 0 1px 3px rgba(15, 30, 64, .12); }

#block-activity-stats .stats-chart { position: relative; height: 340px; }

#block-activity-stats .stats-table { font-size: .9rem; font-variant-numeric: tabular-nums; }

#block-activity-stats .stats-table th,
#block-activity-stats .stats-table td { border-color: var(--stats-line); }

#block-activity-stats .stats-table thead th { background: var(--stats-soft); color: var(--stats-ink); font-weight: 600; white-space: nowrap; }

#block-activity-stats .stats-table tbody th { font-weight: 400; min-width: 14rem; }

#block-activity-stats .stats-dot {
  display: inline-block;
  width: .65rem;
  height: .65rem;
  margin-right: .45rem;
  border-radius: .15rem;
  background: var(--dot);
}

#block-activity-stats .stats-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  margin-top: auto;
  padding-top: .85rem;
  border-top: 1px solid var(--stats-line);
}

#block-activity-stats .stats-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .8rem;
  color: #495057;
}

#block-activity-stats .stats-links { display: flex; gap: 1.25rem; }

#block-activity-stats .stats-link {
  padding: 0;
  border: 0;
  background: none;
  font-size: .85rem;
  font-weight: 600;
  color: var(--stats-c0);
  text-decoration: none;
  white-space: nowrap;
}

#block-activity-stats .stats-link:hover { text-decoration: underline; }

#block-activity-stats .stats-source { margin: 0; font-size: .85rem; color: #6c757d; }

@media (max-width: 575.98px) {
  #block-activity-stats .stats-picker-row { align-items: flex-start; flex-direction: column; gap: .5rem; }
  #block-activity-stats .stats-card { padding: 1rem; }
  #block-activity-stats .stats-chart { height: 280px; }
}

@media print {
  #block-activity-stats .stats-picker,
  #block-activity-stats .stats-view,
  #block-activity-stats .stats-links { display: none; }
}
