#test-debug-panel {
  position: fixed;
  top: 74px;
  left: 18px;
  z-index: 99990;
  width: min(430px, calc(100vw - 36px));
  max-height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #f8fafc;
  background: rgba(10, 14, 22, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.42);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  font: 12px/1.45 Arial, Helvetica, sans-serif;
  backdrop-filter: blur(10px);
}

#test-debug-panel[hidden] {
  display: none;
}

.test-debug-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: linear-gradient(90deg, #16324f, #5b2437);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.test-debug-title {
  min-width: 0;
}

.test-debug-title strong {
  display: block;
  font-size: 13px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.test-debug-title span {
  color: #cbd5e1;
  font-size: 11px;
}

.test-debug-close {
  width: 28px;
  height: 28px;
  border: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  cursor: pointer;
  font-size: 18px;
  line-height: 28px;
}

.test-debug-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

.test-debug-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100vh - 164px);
  flex-direction: column;
  overflow: hidden;
}

.test-debug-summary {
  flex: 0 0 auto;
  padding: 12px 12px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.test-debug-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.test-debug-kpi {
  padding: 9px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.24);
}

.test-debug-kpi span {
  display: block;
  color: #94a3b8;
  font-size: 10px;
  text-transform: uppercase;
}

.test-debug-kpi strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  color: #ffffff;
}

.test-debug-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 12px;
}

.test-debug-pill {
  padding: 7px 8px;
  background: rgba(30, 41, 59, 0.84);
  border-left: 3px solid #38bdf8;
}

.test-debug-pill[data-kind="image"] { border-color: #22c55e; }
.test-debug-pill[data-kind="js"] { border-color: #facc15; }
.test-debug-pill[data-kind="css"] { border-color: #38bdf8; }
.test-debug-pill[data-kind="other"] { border-color: #c084fc; }

.test-debug-pill span {
  display: block;
  color: #cbd5e1;
  font-size: 10px;
}

.test-debug-pill strong {
  color: #fff;
  font-size: 13px;
}

.test-debug-section-title {
  margin: 12px 0 7px;
  color: #e2e8f0;
  font-weight: bold;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.test-debug-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 7px;
}

.test-debug-toolbar .test-debug-section-title {
  margin: 0;
}

.test-debug-sort {
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #e0f2fe;
  background: rgba(14, 116, 144, 0.35);
  padding: 5px 8px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}

.test-debug-sort:hover,
.test-debug-sort[data-active="1"] {
  border-color: rgba(34, 197, 94, 0.7);
  color: #dcfce7;
  background: rgba(22, 101, 52, 0.45);
}

.test-debug-note {
  margin: 7px 0 10px;
  color: #a8b3c4;
  font-size: 11px;
}

.test-debug-list {
  display: grid;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 150px;
  overflow: auto;
  padding: 8px 12px 12px;
}

.test-debug-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 7px 8px;
  background: rgba(15, 23, 42, 0.74);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.test-debug-path {
  min-width: 0;
  color: #e5e7eb;
  overflow-wrap: anywhere;
}

.test-debug-meta {
  text-align: right;
  color: #f8fafc;
  white-space: nowrap;
}

.test-debug-status {
  display: inline-block;
  margin-top: 3px;
  padding: 1px 5px;
  color: #dbeafe;
  background: rgba(59, 130, 246, 0.22);
  font-size: 10px;
}

.test-debug-status.loaded {
  color: #dcfce7;
  background: rgba(34, 197, 94, 0.22);
}

.test-debug-status.missing,
.test-debug-status.error {
  color: #fee2e2;
  background: rgba(239, 68, 68, 0.24);
}

.test-debug-empty {
  padding: 10px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.74);
  border: 1px dashed rgba(148, 163, 184, 0.35);
}

@media (max-width: 640px) {
  #test-debug-panel {
    top: 58px;
    left: 10px;
    width: calc(100vw - 20px);
  }

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