/* Тестирование — layout по макету */
.testing-page__header {
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem 1rem;
}

.testing-page__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.testing-page__actions .ghost-btn {
  min-height: 2.1rem;
}

.testing-stages-bar {
  margin: 0 0 0.9rem;
  padding: 0.4rem 0.45rem;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, rgba(255, 255, 255, 0.7) 100%);
}

.testing-stage-chips {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 0.1rem;
}

.testing-stage-chip {
  flex: 0 0 auto;
  border: 1px solid #d5dcec;
  background: #f7f9ff;
  color: #344154;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
  cursor: pointer;
}

.testing-stage-chip.is-active {
  border-color: #6ea2ff;
  background: #2f6feb;
  color: #fff;
}

.testing-stage-chip:hover {
  background: #eef3ff;
}

.testing-stage-chip.is-active:hover {
  background: #295fca;
}

.testing-stage-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(56, 132, 255, 0.24);
}

.testing-detail-view {
  margin-top: 0.25rem;
}

.testing-back-btn {
  margin-bottom: 0.75rem;
}

.testing-status {
  min-height: 1.25rem;
  margin-bottom: 0.35rem;
}

.testing-grid-top {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(250px, 0.7fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.testing-grid-bottom {
  display: grid;
  grid-template-columns: minmax(260px, 0.78fr) minmax(0, 1.22fr);
  gap: 1rem;
  align-items: start;
}

.testing-grid-top > .dashboard-block,
.testing-grid-bottom > .dashboard-block {
  height: 100%;
}

.testing-page .block-head {
  min-height: 62px;
  align-items: center;
}

.testing-page .block-head h3 {
  line-height: 1.25;
  font-size: 1.03rem;
  letter-spacing: -0.012em;
}

.testing-page .dashboard-block {
  border-color: #dbe3f1;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.testing-team-tests .table-wrap {
  overflow-x: auto;
}

.testing-team-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.testing-team-table col.testing-col-test {
  width: 22%;
}

.testing-team-table col.testing-col-type {
  width: 14%;
}

.testing-team-table col.testing-col-unit {
  width: 8%;
}

.testing-team-table col.testing-col-avg {
  width: 12%;
}

.testing-team-table col.testing-col-best {
  width: 30%;
}

.testing-team-table col.testing-col-change {
  width: 14%;
}

/* Перебиваем глобальные .status-table th:nth-child(2..5) { text-align: center } */
.testing-team-table th,
.testing-team-table td {
  text-align: left;
  vertical-align: middle;
  padding: 0.6rem 0.65rem;
  line-height: 1.35;
}

.testing-team-table th:nth-child(2),
.testing-team-table td:nth-child(2),
.testing-team-table th:nth-child(3),
.testing-team-table td:nth-child(3),
.testing-team-table th:nth-child(4),
.testing-team-table td:nth-child(4),
.testing-team-table th:nth-child(5),
.testing-team-table td:nth-child(5),
.testing-team-table th:nth-child(6),
.testing-team-table td:nth-child(6) {
  text-align: left;
  vertical-align: middle;
}

.testing-team-table th.testing-col-unit,
.testing-team-table td.testing-col-unit {
  text-align: center;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

.testing-team-table th.testing-col-avg,
.testing-team-table td.testing-col-avg {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.testing-team-table th.testing-col-change,
.testing-team-table td.testing-col-change {
  text-align: right;
  white-space: nowrap;
  padding-right: 0.5rem;
}

.testing-team-table td.testing-col-change .testing-change {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
}

.testing-team-table td.testing-col-change .testing-spark-slot {
  display: inline-flex;
  align-items: center;
  margin-left: 0.2rem;
}

.testing-team-table th.testing-col-test,
.testing-team-table td.testing-col-test {
  padding-left: 0.5rem;
}

.testing-team-table .testing-best-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-width: 0;
}

.testing-team-table .testing-best-cell__value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.testing-team-table .testing-best-cell__player {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.testing-test-meta {
  display: block;
  min-width: 0;
}

.testing-test-meta__name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}


.testing-team-table tbody tr {
  cursor: pointer;
}

.testing-team-table tbody tr.is-selected {
  background: rgba(37, 99, 235, 0.12);
}

.testing-team-table tbody tr:hover {
  background: rgba(59, 130, 246, 0.06);
}

.testing-stages-bar__empty {
  margin-left: 0.35rem;
  font-size: 0.82rem;
}

.testing-type-badge {
  display: inline-block;
  padding: 0.16rem 0.56rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
  border: 1px solid #b6c8ff;
  background: #eef3ff;
  color: #27438f;
  line-height: 1.2;
}

.testing-change {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.testing-change.is-up {
  color: #4ade80;
}

.testing-change.is-down {
  color: #f87171;
}

.testing-spark {
  display: inline-block;
  width: 48px;
  height: 18px;
  vertical-align: middle;
}

.testing-ai-stub__text {
  margin: 0;
  font-size: 0.88rem;
  color: rgba(226, 232, 240, 0.72);
  line-height: 1.45;
}

.testing-player-select-wrap {
  margin-bottom: 0.75rem;
}

.testing-ring-wrap {
  text-align: center;
  border: 1px solid #e2e8f4;
  border-radius: 14px;
  padding: 0.75rem 0.65rem 0.65rem;
  background: linear-gradient(180deg, #fcfdff 0%, #f7faff 100%);
}

.testing-ring {
  --pct: 0;
  --ring-color: #3b82f6;
  width: 120px;
  height: 120px;
  margin: 0 auto 0.5rem;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 1%), #dbe5f3 0);
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: inset 0 0 0 1px #d2ddeb;
}

.testing-ring.is-up {
  --ring-color: #22c55e;
}

.testing-ring.is-down {
  --ring-color: #ef4444;
}

.testing-ring.is-neutral {
  --ring-color: #94a3b8;
}

.testing-ring::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #e3eaf5;
}

.testing-ring__value {
  position: relative;
  z-index: 1;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f274e;
  letter-spacing: -0.02em;
}

.testing-ring-caption {
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  color: #5f718d;
  font-weight: 500;
}

.testing-dev-index {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  line-height: 1.3;
  color: #64748b;
  font-weight: 600;
}

.testing-dev-index.is-up {
  color: #15803d;
}

.testing-dev-index.is-down {
  color: #b91c1c;
}

.testing-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.testing-kpi {
  background: linear-gradient(180deg, #f8fbff 0%, #f4f8ff 100%);
  border: 1px solid #dde6f5;
  border-radius: 10px;
  padding: 0.5rem 0.55rem;
}

.testing-kpi__label {
  display: block;
  font-size: 0.7rem;
  color: #6d7f99;
  margin-bottom: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.testing-kpi__val {
  font-size: 1rem;
  font-weight: 700;
  color: #122645;
}

.testing-subhead {
  margin: 0 0 0.45rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #53647c;
}

.testing-stage-chart {
  min-height: 180px;
}

.testing-trend-wrap {
  width: 100%;
  height: 180px;
  border: 1px solid #e4ebf6;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #f6f9ff 100%);
  padding: 0.35rem 0.45rem 0.2rem;
}

.testing-trend-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.testing-trend-grid-line {
  stroke: #d2deef;
  stroke-width: 1;
  shape-rendering: geometricPrecision;
}

.testing-trend-y-tick,
.testing-trend-x-tick {
  font-size: 12px;
  fill: #627896;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.testing-trend-area {
  fill: rgba(37, 99, 235, 0.12);
}

.testing-trend-line {
  fill: none;
  stroke: #1d4ed8;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  shape-rendering: geometricPrecision;
}

.testing-trend-dot {
  fill: #1d4ed8;
  stroke: #ffffff;
  stroke-width: 2;
}

.testing-conduct-panel {
  max-width: min(920px, 96vw);
}

/* Модалки «Новый тест» / «Провести тестирование» — контраст на тёмной панели */
#testingNewTestModal .add-player-modal__title,
#testingConductModal .add-player-modal__title,
#testingManageModal .add-player-modal__title {
  color: #f8fafc;
}

#testingNewTestModal .form-label,
#testingNewTestModal .form-label > span,
#testingConductModal .form-label,
#testingConductModal .form-label > span,
#testingManageModal .form-label,
#testingManageModal .form-label > span,
#testingConductModal .add-player-modal__hint,
#testingConductModal .settings-note {
  color: #e2e8f0;
}

#testingNewTestModal .form-input,
#testingConductModal .form-input,
#testingConductModal select.form-input,
#testingManageModal .form-input {
  color: #0f172a;
  background: #f8fafc;
  border: 1px solid #94a3b8;
}

#testingNewTestModal .form-input::placeholder,
#testingConductModal .form-input::placeholder,
#testingManageModal .form-input::placeholder {
  color: #64748b;
}

#testingNewTestModal .form-input:focus,
#testingConductModal .form-input:focus,
#testingConductModal select.form-input:focus,
#testingManageModal .form-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

#testingNewTestModal .testing-checkbox-row,
#testingNewTestModal .testing-checkbox-row span,
#testingManageModal .testing-checkbox-row,
#testingManageModal .testing-checkbox-row span {
  color: #e2e8f0;
}

.testing-manage-panel {
  max-width: min(940px, 96vw);
}

.testing-manage-grid {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 0.9rem;
  margin-top: 0.35rem;
}

.testing-manage-list {
  max-height: 350px;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.2);
  padding: 0.35rem;
}

.testing-manage-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  border-radius: 8px;
  padding: 0.45rem 0.52rem;
  margin-bottom: 0.32rem;
  cursor: pointer;
}

.testing-manage-item.is-active {
  border-color: #60a5fa;
  background: rgba(59, 130, 246, 0.18);
}

.testing-manage-item__name {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
}

.testing-manage-item__meta {
  display: block;
  font-size: 0.75rem;
  color: #cbd5e1;
  margin-top: 0.1rem;
}

@media (max-width: 920px) {
  .testing-manage-grid {
    grid-template-columns: 1fr;
  }
  .testing-manage-list {
    max-height: 180px;
  }
}

#testingConductModal .testing-conduct-tests label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  color: #f1f5f9;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  cursor: pointer;
}

#testingConductModal .testing-conduct-tests label:hover {
  background: rgba(255, 255, 255, 0.06);
}

#testingConductModal .add-player-modal__close {
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.06);
}

#testingConductModal .status-table th,
#testingConductModal .status-table td {
  color: #e2e8f0;
}

#testingConductModal .status-table thead th {
  color: #cbd5e1;
  font-weight: 600;
}

.testing-conduct-tests {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 200px;
  overflow: auto;
  margin-bottom: 0.75rem;
  padding: 0.35rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.testing-conduct-table-wrap {
  max-height: 320px;
  overflow: auto;
}

.testing-conduct-results input {
  width: 5rem;
}

.testing-checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.testing-ctx-tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.testing-ctx-tag--fatigue {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}

.testing-ctx-tag--ready {
  background: rgba(16, 185, 129, 0.16);
  color: #047857;
}

.testing-ctx-empty {
  color: rgba(148, 163, 184, 0.8);
  font-size: 0.85rem;
}

.testing-ctx-tags {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
}

.testing-ctx-latest {
  display: inline-block;
  font-size: 0.68rem;
  color: var(--muted);
  margin-left: 0.15rem;
}

@media (max-width: 1100px) {
  .testing-grid-top,
  .testing-grid-bottom {
    grid-template-columns: 1fr;
  }

  .testing-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
