* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #111418;
  color: #e6e9ef;
}

header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 20px;
  background: #1a1e24;
  border-bottom: 1px solid #2a2f37;
}

h1 { font-size: 18px; margin: 0; }

.tabs { display: flex; gap: 8px; }

.tab {
  background: transparent;
  border: 1px solid #3a4048;
  color: #cfd4dc;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.tab.active { background: #2c6be0; border-color: #2c6be0; color: white; }

#cameraSelect {
  margin-left: auto;
  background: #1a1e24;
  color: #cfd4dc;
  border: 1px solid #3a4048;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
}

main {
  display: flex;
  gap: 16px;
  padding: 16px;
  align-items: flex-start;
}

.stage {
  position: relative;
  width: min(960px, 70vw);
  background: black;
  border-radius: 8px;
  overflow: hidden;
}

#magnifier {
  position: absolute;
  width: 180px;
  height: 180px;
  border: 2px solid #ffd23f;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  background: black;
}

#magnifier.hidden { display: none; }

.stage video, .stage canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  display: block;
}

.stage video { position: relative; }

#sidebar {
  flex: 1;
  min-width: 280px;
}

.panel {
  background: #1a1e24;
  border: 1px solid #2a2f37;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.panel.hidden { display: none; }
.hidden { display: none; }

.panel h2 { margin-top: 0; font-size: 15px; }

.instructions {
  font-size: 13px;
  color: #9aa4b2;
  min-height: 32px;
}

.status { font-size: 13px; color: #7fd88f; }

button {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  background: #2c6be0;
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 13px;
  cursor: pointer;
}

button:disabled { background: #3a4048; cursor: not-allowed; }

#confirmRefBtn, #confirmInspectBtn { background: #ff9f1c; }

.slider-label {
  display: block;
  margin-top: 12px;
  font-size: 13px;
  color: #cfd4dc;
}

#thresholdSlider {
  width: 100%;
  margin-top: 6px;
}

.slider-hint {
  font-size: 11px;
  color: #7a8290;
  margin: 4px 0 0;
}

.summary {
  margin-top: 10px;
  font-size: 13px;
  color: #cfd4dc;
}

.defect-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 50vh;
  overflow-y: auto;
}

.defect-list li {
  padding: 6px 8px;
  border-bottom: 1px solid #2a2f37;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
}

.defect-list li.defect { color: #ff6b6b; }
