:root {
  --ink: #14202b;
  --muted: #667481;
  --line: #d9e2ea;
  --panel: #ffffff;
  --page: #eef3f7;
  --teal: #0f8f8b;
  --green: #38a169;
  --amber: #c2872a;
  --blue: #3f6fb5;
  --red: #c5534b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.status-panel span,
.eyebrow {
  margin: 0;
  font-size: 12px;
}

.status-panel {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.status-panel strong,
.status-panel span {
  display: block;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
}

.status-dot.ready {
  background: var(--green);
}

.workspace {
  min-width: 0;
  max-width: 1560px;
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.topbar h2,
.panel h3 {
  margin: 3px 0 0;
}

.topbar h2 {
  font-size: 26px;
}

.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.primary-action,
.artifact-list button,
.segmented button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.icon-button {
  width: 38px;
  height: 38px;
  font-size: 19px;
}

.primary-action {
  min-height: 38px;
  padding: 0 16px;
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
  font-weight: 700;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1.05fr) minmax(300px, 0.95fr);
  gap: 14px;
}

.panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 36px rgba(31, 50, 67, 0.08);
}

.wide {
  grid-column: 1 / -1;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.pill,
.confidence {
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--teal);
  background: #e7f5f4;
  font-size: 12px;
  font-weight: 700;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 7px;
  min-height: 112px;
  margin-bottom: 10px;
  border: 1px dashed #9eb1c1;
  border-radius: 8px;
  background: #f8fbfd;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: var(--teal);
  background: #edf8f7;
}

.dropzone input {
  display: none;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  font-size: 26px;
  line-height: 1;
}

.dropzone strong {
  font-size: 15px;
}

.dropzone span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.video-frame {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #071014;
  aspect-ratio: 16 / 9;
}

.video-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-frame video.processed-video {
  object-fit: contain;
}

.video-overlay {
  position: absolute;
  inset: 12%;
  pointer-events: none;
}

.video-overlay[hidden] {
  display: none;
}

.video-overlay span {
  position: absolute;
  padding: 3px 7px;
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.video-overlay span:nth-child(1) {
  top: 10%;
  left: 20%;
  border: 2px solid var(--green);
}

.video-overlay span:nth-child(2) {
  top: 14%;
  right: 18%;
  border: 2px solid var(--amber);
}

.video-overlay span:nth-child(3) {
  bottom: 17%;
  left: 24%;
  border: 2px solid var(--red);
}

.video-overlay span:nth-child(4) {
  right: 24%;
  bottom: 14%;
  border: 2px solid var(--blue);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.metric-strip article {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.metric-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-strip strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.results-table th,
.results-table td {
  padding: 8px 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.results-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.badge-normal,
.badge-review {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-normal {
  color: #176b42;
  background: #e8f6ee;
}

.badge-review {
  color: #805315;
  background: #fff2d8;
}

.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f8fb;
}

.segmented button {
  padding: 7px 10px;
  border: 0;
  background: transparent;
  font-size: 13px;
}

.segmented .selected {
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 32, 43, 0.12);
}

.charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

canvas {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

canvas.empty {
  opacity: 0.42;
}

.artifact-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.artifact-list button {
  padding: 10px;
  text-align: left;
}

.artifact-list a {
  display: block;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
}

.artifact-list button:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.graph-output {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.graph-output img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.check-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #314351;
}

.check-list span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
}

.check-list .pending span {
  background: var(--amber);
}

.check-list .failed span {
  background: var(--red);
}

@media (max-width: 1180px) {
  .content-grid,
  .charts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .panel-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions,
  .metric-strip,
  .artifact-list {
    grid-template-columns: 1fr;
  }

  .metric-strip {
    display: grid;
  }
}
