.confidence-matrix-panel .panel-head {
  gap: 18px;
}

.confidence-matrix-panel .panel-head > div {
  min-width: 0;
}

.confidence-matrix-panel .panel-head button {
  background: #1f604f;
  color: #fff;
  white-space: nowrap;
}

.confidence-matrix-panel .panel-head button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.matrix-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 15px;
}

.matrix-summary span {
  padding: 7px 10px;
  border-radius: 999px;
  background: #edf4ef;
  color: #315348;
  font-size: 11px;
  font-weight: 750;
}

.controls {
  grid-template-columns: repeat(3, minmax(0, 1fr)) 2fr;
}

.topic-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 9px;
  margin: 0 0 16px;
}

.topic-card {
  padding: 12px;
  border: 1px solid #dce6df;
  border-radius: 11px;
  background: #f8fbf9;
  color: #244f42;
  text-align: left;
}

.topic-card:hover,
.topic-card[aria-pressed="true"] {
  border-color: #6f9f8f;
  background: #eaf4ee;
}

.topic-card b,
.topic-card span,
.topic-card small {
  display: block;
}

.topic-card span {
  margin-top: 5px;
  color: #17352c;
  font-size: 16px;
}

.topic-card small {
  margin-top: 3px;
  color: #6a7b75;
  font-size: 10px;
}

.matrix-placeholder {
  padding: 24px;
  border: 1px dashed #cddbd3;
  border-radius: 12px;
  color: #6a7b75;
  text-align: center;
}

.matrix-wrap {
  max-height: 68vh;
  overflow: auto;
  border: 1px solid #dce6df;
  border-radius: 12px;
}

.matrix-table {
  min-width: max-content;
}

.matrix-table th,
.matrix-table td {
  min-width: 70px;
  text-align: center;
}

.matrix-table th:nth-child(1),
.matrix-table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 90px;
  background: #fff;
  text-align: left;
}

.matrix-table th:nth-child(2),
.matrix-table td:nth-child(2) {
  position: sticky;
  left: 90px;
  z-index: 2;
  min-width: 340px;
  max-width: 440px;
  background: #fff;
  text-align: left;
  white-space: normal;
}

.matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f7faf8;
}

.matrix-table thead th:nth-child(1),
.matrix-table thead th:nth-child(2) {
  z-index: 4;
  background: #f0f6f2;
}

.matrix-table tfoot th,
.matrix-table tfoot td {
  position: sticky;
  bottom: 0;
  background: #edf4ef;
  font-weight: 800;
}

.matrix-score {
  border-radius: 7px;
  font-weight: 800;
}

.matrix-score[data-score="1"],
.matrix-score[data-score="2"] {
  background: #fff1f1;
  color: #963638;
}

.matrix-score[data-score="3"] {
  background: #fff8d6;
  color: #836917;
}

.matrix-score[data-score="4"],
.matrix-score[data-score="5"] {
  background: #edf7f1;
  color: #1f604f;
}

.matrix-empty {
  color: #a3aea9;
}

@media (max-width: 800px) {
  .controls {
    grid-template-columns: 1fr;
  }
  .confidence-matrix-panel .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .matrix-table th:nth-child(2),
  .matrix-table td:nth-child(2) {
    min-width: 240px;
    max-width: 280px;
  }
}
