.view--statistics {
  gap: 12px;
}

.statistics-header {
  align-items: center;
}

.statistics-header p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.statistics-filters {
  display: grid;
  grid-template-columns: minmax(260px, auto) minmax(250px, 360px) minmax(220px, 300px);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.76);
  box-shadow: var(--shadow-soft);
}

.statistics-periods {
  align-self: stretch;
}

.statistics-periods button {
  min-width: 0;
}

.statistics-custom-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.statistics-custom-range label,
.statistics-scope-card {
  display: grid;
  gap: 5px;
}

.statistics-custom-range label span,
.statistics-scope-card span {
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
}

.statistics-custom-range:not(.is-active) {
  opacity: 0.72;
}

.statistics-scope-card {
  min-height: 58px;
  align-content: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.statistics-scope-card strong {
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-ui);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-user-filter {
  position: relative;
}

.statistics-user-filter summary {
  width: 100%;
  min-height: 58px;
  justify-content: flex-start;
  list-style: none;
}

.statistics-user-filter summary::-webkit-details-marker {
  display: none;
}

.statistics-user-filter__panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  width: min(360px, 80vw);
  max-height: 360px;
  display: grid;
  gap: 6px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.statistics-user-option {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.statistics-user-option:hover,
.statistics-user-option:has(input:checked) {
  border-color: rgba(14, 107, 87, 0.22);
  background: var(--good-bg);
}

.statistics-user-option input {
  width: auto;
}

.statistics-user-option span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.statistics-user-option strong,
.statistics-user-option small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-user-option strong {
  font-family: var(--font-ui);
  font-size: 13px;
}

.statistics-user-option small {
  color: var(--muted);
  font-size: 12px;
}

.statistics-alert,
.statistics-loading {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.statistics-alert {
  border-color: #efc5bd;
  background: var(--danger-bg);
  color: var(--danger);
  font-family: var(--font-ui);
  font-weight: 700;
}

.statistics-loading {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--primary);
  font-family: var(--font-ui);
  font-weight: 800;
}

.statistics-summary-strip.is-loading {
  opacity: 0.72;
}

.statistics-dashboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.statistics-panel {
  min-width: 0;
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

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

.statistics-panel__head {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.statistics-panel__head div {
  min-width: 0;
}

.statistics-panel__head h3 {
  overflow-wrap: anywhere;
}

.statistics-panel__head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.statistics-department-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.statistics-donut {
  width: min(280px, 100%);
  height: auto;
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.statistics-breakdown {
  min-width: 0;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.statistics-breakdown li {
  min-width: 0;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) minmax(70px, 24%);
  gap: 9px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.statistics-breakdown__swatch {
  width: 10px;
  height: 34px;
  border-radius: 999px;
}

.statistics-breakdown div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.statistics-breakdown strong,
.statistics-breakdown em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-breakdown strong {
  font-family: var(--font-ui);
}

.statistics-breakdown em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.statistics-breakdown b {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(216, 212, 200, 0.8);
}

.statistics-breakdown b i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.statistics-time-chart {
  width: 100%;
  min-height: 190px;
  display: block;
  overflow: visible;
}

.statistics-bars,
.statistics-type-bars {
  display: grid;
  gap: 9px;
}

.statistics-bar-row,
.statistics-type-row {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.statistics-bar-row__meta,
.statistics-type-row__label {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.statistics-bar-row__meta strong,
.statistics-type-row__label strong {
  min-width: 0;
  overflow: hidden;
  font-family: var(--font-ui);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-bar-row__meta span,
.statistics-type-row__label span {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
}

.statistics-bar-row__track,
.statistics-type-row__track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.statistics-bar-row__track i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.statistics-decision-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 8px;
}

.statistics-decision-card {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.statistics-decision-card span {
  width: 28px;
  height: 4px;
  border-radius: 999px;
}

.statistics-decision-card strong {
  font-family: var(--font-ui);
  font-size: 20px;
  line-height: 1;
}

.statistics-decision-card em {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-inline-chart {
  min-width: 0;
  padding-top: 4px;
}

.statistics-type-row__track {
  display: flex;
  min-width: 8%;
  max-width: 100%;
}

.statistics-type-row__track i {
  display: block;
  height: 100%;
}

.statistics-type-row__track .is-accepted {
  background: var(--good);
}

.statistics-type-row__track .is-rejected {
  background: var(--danger);
}

@media (max-width: 1100px) {
  .statistics-filters {
    grid-template-columns: 1fr 1fr;
  }

  .statistics-user-filter,
  .statistics-scope-card {
    grid-column: 1 / -1;
  }

  .statistics-dashboard {
    grid-template-columns: 1fr;
  }

  .statistics-department-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .statistics-user-filter__panel,
  .statistics-user-picker__panel {
    position: static;
    width: auto;
    max-height: 280px;
    margin-top: 6px;
    box-shadow: none;
  }
}

@media (max-width: 720px) {
  .statistics-filters,
  .statistics-custom-range,
  .statistics-dates,
  .statistics-department-layout,
  .statistics-breakdown li {
    grid-template-columns: 1fr;
  }

  .statistics-filters {
    gap: 8px;
    padding: 8px;
  }

  .statistics-user-filter__panel,
  .statistics-user-picker__panel {
    position: static;
    width: auto;
    max-height: 280px;
    margin-top: 6px;
    box-shadow: none;
  }

  .statistics-panel {
    padding: 10px;
  }

  .statistics-donut {
    width: min(260px, 100%);
  }

  .statistics-breakdown li {
    gap: 6px;
  }

  .statistics-breakdown__swatch {
    width: 100%;
    height: 5px;
  }

  .statistics-breakdown b {
    width: 100%;
  }
}

.view--statistics {
  display: grid;
}

.statistics-command {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.statistics-command h2 {
  margin: 0;
  font-size: 22px;
}

.statistics-command p {
  margin: 3px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.statistics-command__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

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

.statistics-dates label {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.statistics-dates span {
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
}

.statistics-user-picker {
  position: relative;
}

.statistics-user-picker summary {
  width: 100%;
  min-height: 58px;
  justify-content: flex-start;
  list-style: none;
}

.statistics-user-picker summary::-webkit-details-marker {
  display: none;
}

.statistics-user-picker__panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  width: min(360px, 80vw);
  max-height: 360px;
  display: grid;
  gap: 6px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.statistics-user-picker__panel label {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.statistics-user-picker__panel label:hover,
.statistics-user-picker__panel label:has(input:checked) {
  border-color: rgba(14, 107, 87, 0.22);
  background: var(--good-bg);
}

.statistics-user-picker__panel input {
  width: auto;
}

.statistics-user-picker__panel span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.statistics-total {
  flex: 0 0 auto;
  color: var(--primary);
  font-family: var(--font-ui);
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1;
}

.department-dashboard {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.department-chart {
  min-width: 0;
  display: grid;
  place-items: center;
}

.department-chart svg {
  width: min(280px, 100%);
  height: auto;
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.department-chart__total,
.department-chart__empty {
  fill: var(--ink);
  font-family: var(--font-ui);
  font-size: 30px;
  font-weight: 800;
}

.department-chart__caption {
  fill: var(--muted);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 800;
}

.department-list,
.statistics-ranked-list,
.activity-list,
.type-decision-list {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.department-row,
.statistics-ranked-list__row,
.activity-row,
.type-decision-row {
  min-width: 0;
  display: grid;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.department-row {
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
}

.department-row i {
  width: 10px;
  height: 30px;
  border-radius: 999px;
  background: var(--department-color);
}

.department-row span,
.statistics-ranked-list__row span,
.activity-row span,
.type-decision-row strong,
.type-decision-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.department-row strong,
.department-row em,
.statistics-ranked-list__row strong,
.activity-row strong {
  font-family: var(--font-ui);
}

.department-row em,
.activity-row em,
.type-decision-row span {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.statistics-bars {
  grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
  align-items: end;
  min-height: 184px;
  gap: 7px;
}

.statistics-bar {
  min-width: 0;
  min-height: 176px;
  display: grid;
  grid-template-rows: 28px minmax(82px, 1fr) 22px;
  gap: 6px;
  align-items: end;
  text-align: center;
}

.statistics-bar span,
.statistics-bar strong {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-bar strong {
  color: var(--ink);
}

.statistics-bar i {
  width: min(24px, 70%);
  height: var(--bar-size);
  min-height: 3px;
  justify-self: center;
  border-radius: 999px 999px 4px 4px;
  background: var(--primary);
}

.statistics-bar i.is-empty {
  min-height: 0;
}

.statistics-ranked-list__row {
  grid-template-columns: minmax(0, 1fr) minmax(80px, 34%) auto;
}

.statistics-ranked-list__row i {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--ai) var(--rank-size), rgba(216, 212, 200, 0.86) var(--rank-size));
}

.decision-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.decision-pill {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: inset 4px 0 0 var(--decision-color);
}

.decision-pill span,
.decision-pill em {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.decision-pill strong {
  font-family: var(--font-ui);
  font-size: 24px;
  line-height: 1;
}

.activity-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.type-decision-row {
  grid-template-columns: minmax(0, 1fr) minmax(120px, 42%);
}

.type-decision-row div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.type-decision-row b {
  width: var(--type-size);
  min-width: 44px;
  max-width: 100%;
  height: 12px;
  display: flex;
  overflow: hidden;
  justify-self: end;
  border-radius: 999px;
  background: var(--surface);
}

.type-decision-row i {
  min-width: 2px;
}

.type-decision-row .is-accepted {
  background: var(--good);
}

.type-decision-row .is-rejected {
  background: var(--danger);
}

.statistics-empty {
  margin: 0;
}

.collection-stat-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.collection-stat-block {
  min-width: 0;
  display: grid;
  gap: 8px;
  align-content: start;
}

.collection-stat-block--wide {
  grid-column: 1 / -1;
}

.collection-stat-block h3 {
  margin: 0;
  font-size: 14px;
}

.collection-decision-list,
.collection-technical-list,
.collection-tender-list {
  display: grid;
  gap: 7px;
}

.collection-decision-row,
.collection-technical-row,
.collection-tender-row {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.collection-decision-row,
.collection-technical-row {
  grid-template-columns: minmax(0, 1fr) auto minmax(100px, 36%);
  align-items: center;
}

.collection-decision-row strong,
.collection-decision-row span,
.collection-technical-row strong,
.collection-technical-row span,
.collection-tender-row strong,
.collection-tender-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-decision-row strong,
.collection-technical-row strong,
.collection-tender-row strong {
  font-family: var(--font-ui);
  font-size: 13px;
}

.collection-decision-row span,
.collection-technical-row span,
.collection-tender-row span {
  color: var(--muted);
  font-size: 12px;
}

.collection-decision-row b,
.collection-technical-row b {
  width: var(--decision-size, 100%);
  min-width: 48px;
  max-width: 100%;
  height: 10px;
  display: flex;
  overflow: hidden;
  justify-self: end;
  border-radius: 999px;
  background: var(--surface);
}

.collection-decision-row i,
.collection-technical-row i {
  display: block;
  height: 100%;
}

.collection-decision-row .is-work,
.collection-day-chart .is-work {
  background: var(--good);
}

.collection-decision-row .is-rejected,
.collection-day-chart .is-rejected {
  background: var(--warning);
}

.collection-technical-row .is-stored {
  background: var(--primary);
}

.collection-technical-row .is-filtered {
  background: var(--danger);
}

.collection-day-chart {
  min-height: 160px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
  gap: 7px;
  align-items: end;
}

.collection-day-chart div {
  min-width: 0;
  min-height: 150px;
  display: grid;
  grid-template-rows: 24px minmax(70px, 1fr) 20px;
  gap: 5px;
  align-items: end;
  text-align: center;
}

.collection-day-chart span,
.collection-day-chart strong {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-day-chart strong {
  color: var(--ink);
}

.collection-day-chart b {
  width: min(24px, 70%);
  min-height: 4px;
  display: flex;
  flex-direction: column-reverse;
  overflow: hidden;
  justify-self: center;
  border-radius: 999px 999px 4px 4px;
  background: var(--surface-2);
}

.collection-tender-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.collection-tender-list h4 {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
}

.collection-tender-row {
  width: 100%;
  text-align: left;
}

.collection-tender-row:not(:disabled) {
  cursor: pointer;
}

.collection-tender-row:not(:disabled):hover {
  border-color: rgba(14, 107, 87, 0.28);
  background: var(--good-bg);
}

@media (max-width: 960px) {
  .statistics-command,
  .statistics-grid,
  .department-dashboard,
  .type-decision-row,
  .collection-stat-layout,
  .collection-tender-columns,
  .collection-decision-row,
  .collection-technical-row {
    grid-template-columns: 1fr;
  }

  .statistics-command__actions {
    justify-content: stretch;
  }

  .statistics-command__actions .button {
    flex: 1 1 180px;
  }

  .type-decision-row b {
    justify-self: stretch;
    width: 100%;
  }

  .collection-decision-row b,
  .collection-technical-row b {
    justify-self: stretch;
    width: 100%;
  }
}
