.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.18);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.drawer-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.stats-drawer {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(50vw, 960px);
  min-width: 360px;
  background: #ffffff;
  border: 1px solid #e7ebf1;
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.14);
  display: flex;
  flex-direction: column;
  transform: translateX(28px);
  opacity: 0;
  transition: transform 0.26s ease, opacity 0.26s ease;
}

.drawer-overlay:not(.is-hidden) .stats-drawer {
  transform: translateX(0);
  opacity: 1;
}

.stats-drawer__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid #eef2f7;
}

.stats-drawer__eyebrow {
  font-size: 12px;
  line-height: 1;
  color: #8b95a7;
  margin-bottom: 8px;
}

.stats-drawer__title {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 500;
  color: #111827;
}

.stats-drawer__close {
  width: 38px;
  height: 38px;
  border: 1px solid #e5eaf1;
  border-radius: 12px;
  background: #fff;
  color: #344054;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.stats-drawer__close:hover {
  background: #f8fafc;
  border-color: #dbe3ee;
}

.stats-drawer__close:active {
  transform: scale(0.97);
}

.stats-drawer__body {
  flex: 1;
  overflow: auto;
  padding: 24px;
}

body.drawer-open {
  overflow: hidden;
}

.stats-toolbar__label {
  font-size: 12px;
  line-height: 1.2;
  color: #8b95a7;
}

.stats-period-caption {
  font-size: 13px;
  line-height: 1.4;
  color: #8b95a7;
  margin-bottom: 16px;
}

.stats-period-switcher,
.stats-chart-mode-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid #e7ebf1;
  border-radius: 14px;
  background: #f8fafc;
  flex-wrap: wrap;
}

.stats-period-switcher__btn {
  border: none;
  background: transparent;
  color: #667085;
  font-size: 14px;
  line-height: 1;
  font-weight: 400;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.stats-period-switcher__btn:hover {
  color: #111827;
}

.stats-period-switcher__btn.is-active {
  background: #ffffff;
  color: #111827;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.stats-toolbar-v2 {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
}

.stats-toolbar-v2__row {
  display: grid;
  grid-template-columns: minmax(320px, 1.4fr) minmax(280px, 420px);
  gap: 14px;
  align-items: start;
}

.stats-toolbar-v2__block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.stats-toolbar-v2__block--period,
.stats-toolbar-v2__block--filter {
  min-width: 0;
}

.stats-filter__select {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid #e7ebf1;
  border-radius: 12px;
  background: #fff;
  padding: 0 14px;
  font: inherit;
  font-size: 14px;
  color: #111827;
  outline: none;
}

.stats-filter__select:focus {
  border-color: #cfd8e3;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.04);
}

.stats-weeks-range {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
  min-height: 44px;
}

.stats-weeks-range.is-hidden-block {
  visibility: hidden;
  pointer-events: none;
}

.stats-weeks-range__presets {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stats-weeks-range__btn {
  appearance: none;
  border: 1px solid #d8dee8;
  background: #fff;
  color: #253047;
  height: 36px;
  min-width: 44px;
  padding: 0 14px;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.stats-weeks-range__btn:hover {
  border-color: #b8a4ff;
  background: #faf7ff;
  color: #5b35d5;
}

.stats-weeks-range__btn.is-active {
  border-color: #7c5cff;
  background: #f5f1ff;
  color: #5b35d5;
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.1);
}

.stats-weeks-range__btn:active {
  transform: translateY(1px);
}

.stats-weeks-range__custom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #e3e8ef;
  border-radius: 10px;
  background: #fff;
}

.stats-weeks-range__label {
  color: #6b7280;
  font-size: 13px;
  white-space: nowrap;
}

.stats-weeks-range__input {
  width: 72px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: #1f2937;
  font: inherit;
  font-size: 14px;
  text-align: center;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.stats-weeks-range__input:hover {
  border-color: #c9d2df;
}

.stats-weeks-range__input:focus {
  border-color: #7c5cff;
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.12);
}

.stats-weeks-range__suffix {
  color: #6b7280;
  font-size: 13px;
  white-space: nowrap;
}

.stats-multiselect {
  position: relative;
  width: 100%;
}

.stats-multiselect__toggle {
  width: 100%;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #d8dee8;
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font: inherit;
  color: #1f2937;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.stats-multiselect__toggle:hover,
.stats-multiselect__toggle.is-open {
  border-color: #b8a4ff;
}

.stats-multiselect__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-multiselect__arrow {
  flex: 0 0 auto;
  color: #6b7280;
}

.stats-multiselect__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  display: none;
  padding: 10px;
  border: 1px solid #e4e8f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.stats-multiselect__menu.is-open {
  display: block;
}

.stats-multiselect__actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.stats-multiselect__action {
  appearance: none;
  border: 1px solid #d8dee8;
  background: #fff;
  color: #334155;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.stats-multiselect__action:hover {
  border-color: #b8a4ff;
  background: #faf7ff;
  color: #5b35d5;
}

.stats-multiselect__list {
  max-height: 240px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats-multiselect__item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.stats-multiselect__item:hover {
  background: #f8fafc;
}

.stats-multiselect__item input {
  margin: 0;
}

.stats-multiselect__hint {
  margin-top: 10px;
  font-size: 12px;
  color: #6b7280;
}

.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.stats-summary-card {
  background: #fff;
  border: 1px solid #edf1f6;
  border-radius: 16px;
  padding: 18px;
}

.stats-summary-card__label {
  font-size: 13px;
  line-height: 1.3;
  color: #8b95a7;
  margin-bottom: 8px;
}

.stats-summary-card__value {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 500;
  color: #111827;
}

.stats-charts {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stats-chart-card {
  background: #fff;
  border: 1px solid #edf1f6;
  border-radius: 16px;
  padding: 14px 14px 10px;
}

.stats-chart-card__title {
  font-size: 13px;
  line-height: 1.3;
  color: #8b95a7;
  margin-bottom: 8px;
}

.stats-chart {
  min-height: 260px;
}

.stats-hours-table-wrap {
  overflow: auto;
}

.stats-hours-table {
  width: 100%;
  border-collapse: collapse;
}

.stats-hours-table th,
.stats-hours-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  font-size: 14px;
  color: #111827;
}

.stats-hours-table th {
  color: #8b95a7;
  font-weight: 500;
}

.stats-hours-table th:last-child,
.stats-hours-table td:last-child {
  text-align: right;
  white-space: nowrap;
}

.stats-hours-table__empty {
  text-align: center !important;
  color: #6b7280 !important;
}

@media (max-width: 1100px) {
  .stats-drawer {
    width: calc(100vw - 24px);
    min-width: 0;
    top: 12px;
    right: 12px;
    bottom: 12px;
  }
}

@media (max-width: 980px) {
  .stats-toolbar-v2__row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .stats-summary-grid {
    grid-template-columns: 1fr;
  }

  .stats-period-switcher,
  .stats-chart-mode-switcher {
    width: 100%;
    justify-content: space-between;
  }

  .stats-period-switcher__btn {
    flex: 1 1 auto;
    text-align: center;
  }

  .stats-weeks-range {
    align-items: stretch;
  }

  .stats-weeks-range__custom {
    width: 100%;
    justify-content: space-between;
  }
}

.stats-hours-table th:last-child,
.stats-hours-table td:last-child {
  text-align: right;
  white-space: nowrap;
}

.stats-hours-table th:nth-child(2),
.stats-hours-table td:nth-child(2) {
  text-align: right;
  white-space: nowrap;
}