:root {
  --accent: #3498db;
  --accent-dark: #2383c4;
  --ink: #222222;
  --muted: #667389;
  --line: #dfe7f0;
  --panel: #ffffff;
  --soft: #f7fbfe;
  --traditional: #ffffff;
  --ai: #f8fbff;
  --pass: #138a53;
  --fail: #bd2f2f;
  --review: #b7791f;
  --shadow: 0 0 29px 0 rgba(68, 88, 144, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Open Sans", sans-serif;
  background: #fff;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  width: min(1140px, calc(100% - 32px));
  margin: 60px auto;
}

.vision-demo-section {
  padding: 60px 0;
  overflow: visible;
}

.vision-demo-section .app-shell {
  width: 100%;
  margin: 0 auto;
}

.widget {
  overflow: hidden;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.header {
  display: grid;
  place-items: center;
  gap: 18px;
  padding: 34px 24px 28px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  text-align: center;
}

.eyebrow,
.label,
h1,
h2,
p {
  margin: 0;
}

.eyebrow,
.label {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin-top: 4px;
  font-family: "Raleway", sans-serif;
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

h2 {
  margin-top: 3px;
  font-family: "Raleway", sans-serif;
  font-size: 1.02rem;
}

.header h1::before,
.header h1::after {
  content: "";
  display: inline-block;
  width: 50px;
  height: 2px;
  margin: 0 15px 10px;
  background: var(--accent);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 50px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--pass);
  box-shadow: 0 0 0 4px rgba(19, 138, 83, 0.14);
}

.status-dot.running {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(24, 95, 165, 0.16);
}

.demo-disclaimer {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: #f7fbfe;
}

.demo-disclaimer > div {
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 16px;
  border: 1px solid #d7ebf8;
  border-radius: 8px;
  background: #fff;
}

.demo-disclaimer p:last-child {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.teach-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  grid-template-areas:
    "setup tools"
    "viewer viewer"
    "tests tests"
    "process process";
  min-height: 600px;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.workflow-step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--soft);
  color: var(--muted);
}

.workflow-step span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #dfe7f0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.workflow-step b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-step.complete {
  border-color: #b7cce4;
  background: #f2f7fd;
  color: var(--ink);
}

.workflow-step.complete span {
  background: var(--accent);
  color: #fff;
}

.setup-panel,
.viewer-panel,
.tool-panel,
.test-panel,
.process-panel {
  min-width: 0;
  padding: 20px;
}

.setup-panel {
  grid-area: setup;
  display: grid;
  align-content: start;
  gap: 16px;
  border-right: 1px solid var(--line);
  background: #f7fbfe;
}

.viewer-panel {
  grid-area: viewer;
  display: grid;
  align-content: start;
  gap: 16px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.tool-panel {
  grid-area: tools;
  display: grid;
  align-content: start;
  gap: 18px;
  background: #fff;
}

.test-panel {
  grid-area: tests;
  border-top: 1px solid var(--line);
  background: #f7fbfe;
}

.process-panel {
  grid-area: process;
  border-top: 1px solid var(--line);
  background: #fff;
}

.panel-block {
  display: grid;
  gap: 14px;
}

.panel-block.compact {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.panel-block.disabled-block {
  opacity: 0.62;
}

.panel-heading,
.results-header,
.result-topline,
.confidence-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.ghost-button,
.thumb button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 50px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.ghost-button {
  padding: 0 11px;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 190px;
  padding: 20px;
  border: 2px dashed #9cadbf;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}

.drop-zone.active {
  border-color: var(--accent);
  background: #f0f6fc;
}

.drop-zone.disabled {
  cursor: not-allowed;
  background: #f5f7fa;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.drop-zone .icon {
  color: var(--accent);
}

.drop-zone strong {
  margin-top: 8px;
  color: var(--ink);
}

.drop-zone span {
  margin-top: 4px;
  font-size: 0.92rem;
}

.notice {
  color: var(--review);
  font-size: 0.9rem;
  font-weight: 700;
}

.thumb-grid {
  display: grid;
  gap: 10px;
}

.reference-chip {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  padding: 10px;
  border: 1px solid #b7cce4;
  border-radius: 8px;
  background: #f2f7fd;
}

.reference-chip img {
  width: 76px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: #e9eef5;
}

.reference-chip strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-chip small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.thumb {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.thumb.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.thumb-select {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.thumb img {
  width: 56px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 5px;
  object-fit: cover;
  background: #e9eef5;
}

.thumb strong,
.result-topline strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumb span,
.result-topline span,
.helper {
  color: var(--muted);
  font-size: 0.86rem;
}

.thumb small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.remove-thumb {
  justify-content: center;
  width: 34px;
  padding: 0;
}

.field-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.field-label input,
.field-label textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.field-label input {
  min-height: 42px;
  padding: 0 12px;
}

.field-label textarea {
  resize: vertical;
  min-height: 88px;
  padding: 10px 12px;
  line-height: 1.4;
}

.helper {
  line-height: 1.4;
}

.tool-sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.tool-sections.locked .tool-section {
  opacity: 1;
}

.tool-sections.locked::before {
  content: "Load a good image first";
  display: block;
  padding: 10px 12px;
  border: 1px solid #b7cce4;
  border-radius: 8px;
  background: #f2f7fd;
  color: var(--accent);
  font-weight: 900;
}

.tool-section {
  display: grid;
  gap: 13px;
  padding: 20px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(68, 88, 144, 0.08);
}

.tool-section.traditional {
  background: var(--traditional);
  border-top: 4px solid var(--accent);
}

.tool-section.ai {
  background: var(--ai);
  border-top: 4px solid #596579;
}

.section-label {
  display: grid;
  gap: 4px;
}

.section-label span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.section-label b {
  font-size: 1.02rem;
}

.section-copy {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.tool-card {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 112px;
  padding: 16px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.tool-card:disabled {
  opacity: 0.82;
}

.tool-card:hover:not(:disabled) {
  border-color: #d7ebf8;
  box-shadow: 0 2px 15px rgba(68, 88, 144, 0.12);
}

.viewer-card,
.operation-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(68, 88, 144, 0.08);
}

.viewer-card {
  overflow: hidden;
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.viewer-actions,
.train-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.measurement-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  background: #eaf2fb;
  color: var(--accent);
  font-weight: 900;
}

.image-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 430px;
  background: #f6f9fc;
  touch-action: none;
  user-select: none;
}

.image-stage.loaded {
  cursor: crosshair;
}

.image-stage.no-draw {
  cursor: default;
}

.image-stage > img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 620px;
  object-fit: contain;
  pointer-events: none;
}

.stage-empty {
  display: grid;
  place-items: center;
  gap: 10px;
  color: #8aa5bd;
}

.stage-label {
  position: absolute;
  left: 14px;
  top: 14px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  background: rgba(34, 34, 34, 0.78);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.roi-rect {
  position: absolute;
  border: 2px solid #42b7ff;
  background: rgba(24, 95, 165, 0.15);
  pointer-events: none;
}

.roi-rect span {
  position: absolute;
  left: -2px;
  top: -28px;
  padding: 4px 7px;
  border-radius: 5px 5px 0 0;
  background: var(--accent);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 900;
  white-space: nowrap;
}

.line-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.line-overlay line {
  stroke: #42b7ff;
  stroke-width: 0.7;
}

.line-overlay circle {
  fill: #fff;
  stroke: #42b7ff;
  stroke-width: 0.45;
}

.operation-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #f7fbfe;
}

.operation-copy {
  display: grid;
  gap: 5px;
}

.operation-copy p:last-child {
  color: var(--muted);
  line-height: 1.4;
}

.live-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.readiness-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

.readiness-item span {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dfe7f0;
  font-weight: 900;
}

.readiness-item b {
  font-size: 0.82rem;
}

.readiness-item.ready {
  border-color: #b7cce4;
  color: var(--accent);
}

.readiness-item.ready span {
  background: var(--accent);
  color: #fff;
}

.live-readout span,
.train-row span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.live-readout strong {
  color: var(--ink);
  text-align: right;
}

.train-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  font-weight: 900;
}

.read-text {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #b7cce4;
  border-radius: 8px;
  background: #f2f7fd;
}

.read-text span {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.read-text strong {
  font-size: 1.02rem;
}

.tool-card .icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}

.tool-card span {
  font-weight: 900;
  line-height: 1.2;
}

.tool-card small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.32;
}

.tool-card.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.criteria-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.run-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  border: 1px solid var(--accent);
  border-radius: 50px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.run-button:hover:not(:disabled) {
  background: var(--accent-dark);
}

.results-panel {
  padding: 20px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.totals {
  display: flex;
  gap: 10px;
}

.results-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.request-toggle-row {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-top: 22px;
}

.request-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 2px solid var(--accent);
  border-radius: 50px;
  background: #fff;
  color: var(--accent);
  font-weight: 800;
  white-space: nowrap;
  font-family: "Raleway", sans-serif;
}

.request-button:hover {
  background: var(--accent);
  color: #fff;
}

.total-box {
  display: grid;
  place-items: center;
  min-width: 78px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.total-box strong {
  font-size: 1.25rem;
}

.total-box span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.total-box.pass strong {
  color: var(--pass);
}

.total-box.fail strong {
  color: var(--fail);
}

.total-box.review strong {
  color: var(--review);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 160px;
  margin-top: 16px;
  border: 1px dashed #b7c3d2;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state .icon {
  color: var(--accent);
}

.result-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.result-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.result-card.running,
.result-card.queued {
  background: #f8fafc;
}

.result-image-wrap {
  position: relative;
  overflow: hidden;
  width: 180px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #e9eef5;
  color: inherit;
  cursor: zoom-in;
}

.result-image-wrap:hover {
  border-color: var(--accent);
}

.result-image-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.72);
}

.lightbox-panel {
  display: grid;
  gap: 14px;
  width: min(1100px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 0;
}

.lightbox-image-wrap {
  position: relative;
  overflow: hidden;
  margin: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e9eef5;
}

.lightbox-image-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

.lightbox-panel > .summary {
  padding: 0 18px 18px;
}

.result-content {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.verdict {
  min-width: 76px;
  padding: 6px 9px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
}

.result-topline .verdict {
  color: #fff;
}

.verdict.pass,
.confidence-fill.pass {
  background: #087443;
}

.verdict.fail,
.confidence-fill.fail {
  background: var(--fail);
}

.verdict.review,
.confidence-fill.review {
  background: var(--review);
}

.verdict.wait {
  background: #6b7280;
}

.confidence-row {
  justify-content: start;
}

.confidence-row span,
.confidence-row b {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.confidence-track {
  overflow: hidden;
  flex: 1;
  height: 9px;
  border-radius: 999px;
  background: #e4eaf2;
}

.confidence-fill {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--accent);
}

.summary {
  line-height: 1.42;
}

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

.findings li {
  display: grid;
  gap: 2px;
  padding-left: 11px;
  border-left: 3px solid var(--line);
}

.findings span {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 900;
}

.findings p {
  color: var(--muted);
  line-height: 1.35;
}

.icon {
  flex: 0 0 auto;
}

@media (max-width: 1040px) {
  .teach-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "setup"
      "tools"
      "viewer"
      "tests"
      "process";
  }

  .setup-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .tool-panel {
    border-top: 0;
  }

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

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

@media (max-width: 720px) {
  .app-shell {
    width: 100%;
    margin: 0;
  }

  .widget {
    border-radius: 0;
  }

  .header,
  .results-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .workflow-steps,
  .readiness-grid {
    grid-template-columns: 1fr;
  }

  .viewer-header,
  .viewer-actions,
  .train-row,
  .live-readout {
    align-items: flex-start;
    flex-direction: column;
  }

  .image-stage {
    min-height: 320px;
  }

  .totals {
    width: 100%;
  }

  .results-actions {
    align-items: stretch;
    width: 100%;
  }

  .request-toggle-row {
    width: 100%;
  }

  .request-button {
    width: 100%;
  }

  .total-box {
    flex: 1;
  }

  .result-card {
    grid-template-columns: 1fr;
  }

  .result-image-wrap {
    width: 100%;
  }

  .result-topline,
  .confidence-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .request-grid {
    grid-template-columns: 1fr;
  }

  .confidence-track {
    width: 100%;
  }
}
