.tsi-root {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: 0.9375rem;
}

.tsi-panel {
  border: 1px solid #dce5e6;
  border-radius: 10px;
  background: #fff;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tsi-panel h3 {
  margin: 0;
  font-size: 1rem;
  text-wrap: balance;
}

.tsi-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem 1rem;
  align-items: end;
}

.tsi-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-inline-size: 0;
}

.tsi-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
}

.tsi-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.tsi-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.625rem;
}

.tsi-metric {
  border: 1px solid #dce5e6;
  border-radius: 8px;
  background: #f8fbfb;
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.tsi-metric strong {
  font-size: 1.15rem;
}

.tsi-metric span {
  font-size: 0.8125rem;
  color: var(--muted, #52666b);
}

.tsi-table-wrap {
  overflow: auto;
  max-inline-size: 100%;
  border: 1px solid #dce5e6;
  border-radius: 8px;
  container-type: inline-size;
  background: #fff;
}

.tsi-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

.tsi-table th,
.tsi-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid #edf1f2;
  text-align: left;
  vertical-align: top;
}

.tsi-table thead th {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  background: #f2f7f8;
  font-weight: 650;
}

.tsi-table select {
  max-inline-size: 100%;
  min-inline-size: 180px;
}

.tsi-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.tsi-badge-ok {
  background: #e7f6f1;
  color: #0e624d;
  border-color: #b7e3d4;
}

.tsi-badge-warn {
  background: #fff7e6;
  color: #8a5300;
  border-color: #f3d092;
}

.tsi-badge-err {
  background: #fdecec;
  color: #9e1c1c;
  border-color: #f4b7b7;
}

.tsi-badge-muted {
  background: #eef3f4;
  color: #46585d;
  border-color: #d3dde0;
}

.tsi-details summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.25rem 0;
}

.tsi-anomaly-list {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8125rem;
}

.tsi-check-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.tsi-check-inline input[type='checkbox'] {
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
  accent-color: var(--brand, #168977);
}

.tsi-actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tsi-confirm-dialog {
  max-width: min(460px, 94vw);
  border: 1px solid #d0dcde;
  border-radius: 12px;
  padding: 1.15rem;
  overscroll-behavior: contain;
}

.tsi-confirm-dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
}

.wfgrid-table tbody td.wfgrid-cell-review {
  background: #fff9e8;
  box-shadow: inset 0 0 0 1px #e5b74e;
}

.wfgrid-cell-review .wfgrid-cell-hint {
  color: #8a5300;
  font-weight: 600;
}

@container (width < 600px) {
  .tsi-table,
  .tsi-table thead,
  .tsi-table tbody,
  .tsi-table tr,
  .tsi-table th,
  .tsi-table td {
    display: block;
  }

  .tsi-table thead {
    display: none;
  }

  .tsi-table tr {
    border-bottom: 2px solid #dce5e6;
    padding: 0.5rem;
  }

  .tsi-table td {
    border-bottom: 1px solid #edf1f2;
    padding: 0.4rem 0.25rem;
  }

  .tsi-table td::before {
    content: attr(data-label) ': ';
    font-weight: 650;
    color: var(--muted, #52666b);
    display: inline-block;
    margin-right: 0.35rem;
  }
}

@media (pointer: coarse) {
  .tsi-root button,
  .tsi-root select,
  .tsi-root input[type='file'],
  .tsi-check-inline {
    min-block-size: 44px;
  }
}
