/* v52: expanded statistics */
.stats-modal-v52 {
  width: min(960px, 100%);
  max-height: min(900px, calc(100dvh - 40px));
}

.stats-tabs {
  position: sticky;
  z-index: 3;
  top: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 10px 27px;
  border-bottom: 1px solid var(--line);
  background: rgba(27, 29, 36, 0.96);
  backdrop-filter: blur(12px);
}

.stats-tabs button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #969aa4;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: color 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.stats-tabs button:hover,
.stats-tabs button:focus-visible {
  color: #eceef2;
  border-color: rgba(255, 255, 255, 0.1);
  outline: 0;
}

.stats-tabs button.selected {
  color: #fff;
  border-color: rgba(232, 59, 63, 0.28);
  background: rgba(232, 59, 63, 0.1);
}

.stats-summary-grid-v52 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stats-summary-grid-v52 .stats-summary-card {
  min-height: 112px;
}

.stats-card-detail {
  display: block;
  margin-top: 7px;
  color: #7f838e;
  font-size: 9px;
  line-height: 1.35;
}

.stats-overview-grid {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}

.stats-distribution-content {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
}

.stats-ring-multi {
  --stats-waiting-end: 0deg;
  --stats-current-end: 0deg;
  --stats-playing-end: 0deg;
  --stats-paused-end: 0deg;
  --stats-completed-end: 0deg;
  width: 124px;
  height: 124px;
  flex-basis: 124px;
  background: conic-gradient(
    #d8a34d 0 var(--stats-waiting-end),
    #ef5559 var(--stats-waiting-end) var(--stats-current-end),
    #5fa8ef var(--stats-current-end) var(--stats-playing-end),
    #a583e8 var(--stats-playing-end) var(--stats-paused-end),
    #55b985 var(--stats-paused-end) var(--stats-completed-end),
    rgba(255, 255, 255, 0.08) var(--stats-completed-end) 360deg
  );
}

.stats-status-list {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.stats-status-list > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 27px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.stats-status-list > div:last-child {
  border-bottom: 0;
}

.stats-status-list i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.stats-status-list span {
  min-width: 0;
  color: #aeb2bc;
  font-size: 10px;
}

.stats-status-list strong {
  color: #eceef2;
  font-size: 10px;
  white-space: nowrap;
}

.stats-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.stats-metric-card,
.stats-volume-card {
  min-width: 0;
  display: grid;
  align-content: space-between;
  gap: 10px;
  min-height: 112px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(145deg, #24262f, #1e2028);
}

.stats-metric-card > span,
.stats-volume-card > span {
  color: #aeb1ba;
  font-size: 10px;
  line-height: 1.4;
}

.stats-metric-card > strong,
.stats-volume-card > strong {
  min-width: 0;
  color: #f7f7f8;
  font-size: 25px;
  line-height: 1.08;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.stats-metric-card > small,
.stats-volume-card > small {
  color: #80848e;
  font-size: 9px;
  line-height: 1.4;
}

.stats-chart-panel {
  overflow: hidden;
  padding-bottom: 14px;
}

.stats-month-chart {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(12, minmax(42px, 1fr));
  gap: 7px;
  overflow-x: auto;
  padding: 7px 2px 5px;
  scrollbar-width: thin;
}

.stats-month-column {
  min-width: 42px;
  display: grid;
  grid-template-rows: 18px 142px 18px;
  justify-items: center;
  gap: 5px;
}

.stats-month-column > strong {
  color: #bfc2ca;
  font-size: 10px;
}

.stats-month-column > span {
  width: 100%;
  height: 142px;
  display: flex;
  align-items: flex-end;
  padding: 0 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(to top, rgba(255, 255, 255, 0.025), transparent);
}

.stats-month-column i {
  width: 100%;
  min-height: 3px;
  display: block;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #ef5559, #b92f34);
  box-shadow: 0 0 12px rgba(232, 59, 63, 0.18);
}

.stats-month-column > small {
  color: #858993;
  font-size: 9px;
  text-transform: lowercase;
}

.stats-volume-note {
  padding: 14px 16px;
  border: 1px solid rgba(165, 131, 232, 0.24);
  border-radius: 12px;
  color: #cbbbed;
  background: rgba(165, 131, 232, 0.07);
}

.stats-volume-note > div {
  display: grid;
  gap: 4px;
}

.stats-volume-note strong {
  font-size: 12px;
}

.stats-volume-note span {
  color: #9892a5;
  font-size: 10px;
  line-height: 1.45;
}

.stats-volume-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stats-volume-card {
  min-height: 138px;
  background: #171920;
}

.stats-volume-card > strong {
  font-size: 24px;
}

html[data-theme="light"] .stats-tabs {
  background: rgba(255, 255, 255, 0.96);
}

html[data-theme="light"] .stats-tabs button {
  color: #747985;
}

html[data-theme="light"] .stats-tabs button:hover,
html[data-theme="light"] .stats-tabs button:focus-visible {
  color: #292d36;
  border-color: rgba(31, 35, 45, 0.12);
}

html[data-theme="light"] .stats-tabs button.selected {
  color: #a52e32;
  border-color: rgba(185, 47, 52, 0.2);
  background: rgba(232, 59, 63, 0.08);
}

html[data-theme="light"] .stats-card-detail,
html[data-theme="light"] .stats-metric-card > small,
html[data-theme="light"] .stats-volume-card > small {
  color: #7b808b;
}

html[data-theme="light"] .stats-status-list > div {
  border-bottom-color: rgba(31, 35, 45, 0.07);
}

html[data-theme="light"] .stats-status-list span,
html[data-theme="light"] .stats-metric-card > span,
html[data-theme="light"] .stats-volume-card > span {
  color: #646a75;
}

html[data-theme="light"] .stats-status-list strong,
html[data-theme="light"] .stats-metric-card > strong,
html[data-theme="light"] .stats-volume-card > strong {
  color: #292d36;
}

html[data-theme="light"] .stats-metric-card,
html[data-theme="light"] .stats-volume-card {
  background: #f7f8fa;
}

html[data-theme="light"] .stats-month-column > span {
  border-bottom-color: rgba(31, 35, 45, 0.1);
  background: linear-gradient(to top, rgba(31, 35, 45, 0.035), transparent);
}

html[data-theme="light"] .stats-volume-note {
  color: #5f3e9f;
  border-color: rgba(95, 62, 159, 0.18);
  background: rgba(115, 82, 178, 0.06);
}

@media (max-width: 900px) {
  .stats-summary-grid-v52,
  .stats-metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats-overview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .stats-modal-v52 {
    max-height: calc(100dvh - 20px);
  }

  .stats-tabs {
    padding: 8px 16px;
  }

  .stats-tabs button {
    min-height: 37px;
    padding: 0 6px;
    font-size: 10px;
  }

  .stats-summary-grid-v52,
  .stats-metric-grid,
  .stats-volume-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-summary-grid-v52 .stats-summary-card:last-child,
  .stats-metric-grid .stats-metric-card:last-child {
    grid-column: 1 / -1;
  }

  .stats-distribution-content {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 14px;
  }

  .stats-ring-multi {
    width: 106px;
    height: 106px;
    flex-basis: 106px;
  }

  .stats-month-chart {
    grid-template-columns: repeat(12, 44px);
  }
}

@media (max-width: 420px) {
  .stats-head {
    padding: 18px 16px;
  }

  .stats-tabs {
    padding-inline: 10px;
  }

  .stats-tabs button {
    font-size: 9px;
  }

  .stats-distribution-content {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .stats-status-list {
    width: 100%;
  }

  .stats-volume-grid {
    grid-template-columns: 1fr;
  }

  .stats-volume-card {
    min-height: 112px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stats-tabs button,
  .stats-month-column i {
    transition: none;
  }
}
