:root {
  --page: #f3f5f8;
  --panel: #ffffff;
  --panel-border: #d9dee7;
  --text: #172033;
  --muted: #5e6b7c;
  --navy: #12345a;
  --blue: #1f5f9f;
  --blue-dark: #174a7d;
  --green: #198754;
  --green-dark: #146c43;
  --amber: #f0ad4e;
  --amber-dark: #d9912b;
  --grey: #eef1f5;
  --grey-dark: #c8ced8;
  --danger: #b42318;
  --shadow: 0 8px 24px rgba(18, 52, 90, 0.08);
  --radius: 14px;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--page);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
}

.appHeader {
  min-height: 84px;
  padding: 20px 34px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--panel-border);
  box-shadow: 0 2px 8px rgba(18, 52, 90, 0.04);
}

.appHeader h1 {
  margin: 0;
  color: var(--navy);
  font-size: 28px;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.appHeader p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.versionPill {
  padding: 6px 11px;
  border-radius: 999px;
  background: #edf3fb;
  color: var(--blue-dark);
  border: 1px solid #cbddef;
  font-weight: 700;
  font-size: 12px;
}

.appShell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 26px;
  display: grid;
  gap: 22px;
}

.sectionGrid {
  display: grid;
  gap: 22px;
}

.topGrid {
  grid-template-columns: minmax(360px, 1fr) minmax(420px, 1.05fr);
}

.imageGrid {
  grid-template-columns: minmax(420px, 1fr) minmax(480px, 1.2fr);
}

.cardPanel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.panelHeader {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 18px;
}

.panelHeader.compact {
  margin-bottom: 14px;
}

.pickerHeader {
  justify-content: space-between;
  align-items: flex-start;
}

.panelHeader h2 {
  margin: 0;
  color: var(--navy);
  font-size: 18px;
  font-weight: 700;
}

.panelHeader p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.stepBadge {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--blue);
  font-size: 14px;
  font-weight: 700;
  flex: 0 0 28px;
}

.fieldLabel {
  display: grid;
  gap: 7px;
  color: #253044;
  font-size: 13px;
  font-weight: 700;
}

select,
input[type=file] {
  font: inherit;
}

select {
  min-height: 40px;
  width: 100%;
  border: 1px solid #c7d0db;
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

select:focus,
input[type=range]:focus {
  outline: 3px solid rgba(31, 95, 159, 0.15);
  border-color: var(--blue);
}

.actionRow {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.btn,
.fileButton {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: transform 90ms ease, box-shadow 120ms ease, background 120ms ease;
}

.btn:hover,
.fileButton:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(18, 52, 90, 0.12);
}

.btn:active,
.fileButton:active {
  transform: translateY(0);
  box-shadow: none;
}

.btnAmber {
  background: var(--amber);
  border-color: var(--amber-dark);
  color: #231800;
}

.btnGreen {
  background: var(--green);
  border-color: var(--green-dark);
  color: #ffffff;
}

.btnBlue {
  background: var(--blue);
  border-color: var(--blue-dark);
  color: #ffffff;
}

.btnGrey,
.fileButton {
  background: var(--grey);
  border-color: var(--grey-dark);
  color: #283142;
}

.btnSmall {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 7px;
  white-space: nowrap;
}

.fileButton input {
  display: none;
}

.workflowHint {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f6f8fb;
  color: var(--muted);
  font-size: 13px;
  border: 1px solid #e1e6ee;
}

.referenceInfo {
  margin-top: 14px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid #e1e6ee;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.42;
}

.referenceInfo strong {
  display: inline-block;
  margin-bottom: 3px;
  color: var(--navy);
  font-size: 15px;
}

.referenceInfo em {
  color: #516176;
  font-style: normal;
}

.featurePanel {
  margin-top: 14px;
  background: #f8fafc;
  border: 1px solid #e1e6ee;
  border-radius: 10px;
  padding: 12px;
}

.featurePanel h3 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 14px;
}

.featurePanel ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}

#refPreview,
#testPick {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  background: #111827;
  border: 1px solid #ccd4df;
}

.pickerWrap {
  position: relative;
}

#testPick {
  cursor: crosshair;
}

#loupe {
  width: 207px;
  height: 207px;
  position: absolute;
  pointer-events: none;
  display: none;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  background: #111827;
}

.statusText,
.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #e1e6ee;
  border-radius: 12px;
}

.controls .fieldLabel {
  min-width: 180px;
}

.viewerWrap {
  overflow: auto;
  border: 1px solid #ccd4df;
  border-radius: 12px;
  background:
    linear-gradient(45deg, #e6ebf2 25%, transparent 25%),
    linear-gradient(-45deg, #e6ebf2 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e6ebf2 75%),
    linear-gradient(-45deg, transparent 75%, #e6ebf2 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.viewerWrap.result-flash {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(25,135,84,0.18), 0 0 24px rgba(25,135,84,0.18);
  transition: border-color 220ms ease, box-shadow 220ms ease;
}

#viewer {
  display: block;
  max-width: none;
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

input[type=range] {
  width: 100%;
  accent-color: var(--blue);
}

.nudge {
  margin-bottom: 40px;
}

@media (max-width: 980px) {
  .topGrid,
  .imageGrid {
    grid-template-columns: 1fr;
  }

  .appShell {
    padding: 16px;
  }

  .appHeader {
    padding: 16px 18px;
  }

  .appHeader h1 {
    font-size: 24px;
  }
}


/* v10 workflow layout */
.workflowGrid {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(560px, 1.25fr);
  gap: 22px;
  align-items: start;
}

.referencePanel {
  display: grid;
  gap: 12px;
}

.questionedPanel {
  display: grid;
  gap: 14px;
}

.headerWithStep {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.referencePreviewBlock {
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid #e1e6ee;
}

.referencePreviewBlock h3 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 14px;
}

.referencePreviewBlock #refPreview {
  width: 62%;
  max-width: 340px;
  min-width: 220px;
  border-radius: 8px;
}

.questionedPanel .pickerWrap {
  margin-top: 2px;
}

.questionedPanel #testPick {
  max-height: 520px;
  object-fit: contain;
}

.workflowHint.ready {
  border-color: rgba(25,135,84,0.28);
  background: #effaf4;
  color: #146c43;
  font-weight: 700;
}

/* Keep final comparison viewer unchanged from v9. */
.comparisonPanel .viewerWrap {
  max-width: none;
}

/* Make the small clear button feel like a utility action, not a workflow action. */
.pickerHeader .btnSmall {
  margin-top: 0;
}

@media (max-width: 1050px) {
  .workflowGrid {
    grid-template-columns: 1fr;
  }

  .referencePreviewBlock #refPreview {
    width: 100%;
    max-width: 420px;
  }
}


/* v10.1 compact reference and picker refinements */
.referenceInfo {
  padding: 10px 12px;
  min-height: 0;
}

.referenceInfo .refTitle {
  display: block;
  margin-bottom: 4px;
  color: var(--navy);
  font-size: 15px;
  font-weight: 700;
}

.referenceInfo .refExample {
  color: #516176;
  font-size: 13px;
}

.referenceInspection {
  display: grid;
  grid-template-columns: minmax(170px, 0.85fr) minmax(220px, 1fr);
  gap: 14px;
  align-items: start;
  margin-top: 2px;
  padding-top: 12px;
  border-top: 1px solid #e1e6ee;
}

.referencePreviewBlock {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.referencePreviewBlock h3 {
  margin: 0 0 8px;
}

.referencePreviewBlock #refPreview {
  width: 100%;
  max-width: 300px;
  min-width: 0;
}

.featurePanel {
  margin-top: 0;
  min-height: 0;
}

.featurePanel ul {
  list-style: none;
  padding-left: 0;
}

.featurePanel li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 6px;
}

.featurePanel li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--green);
  font-weight: 700;
}

.clearPointsRow {
  display: flex;
  justify-content: flex-start;
  margin-top: 8px;
}

.clearPointsRow .btnSmall {
  min-width: 96px;
}

@media (max-width: 760px) {
  .referenceInspection {
    grid-template-columns: 1fr;
  }

  .referencePreviewBlock #refPreview {
    max-width: 360px;
  }
}


/* v11 Edge Mode */
.modeRow {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: -2px;
  padding: 8px 10px;
  border: 1px solid #e1e6ee;
  background: #f8fafc;
  border-radius: 10px;
}

.modeOption {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #253044;
  font-size: 13px;
  font-weight: 700;
}

.modeOption input {
  accent-color: var(--blue);
}

.workflowHint.edge {
  border-color: rgba(31, 95, 159, 0.25);
  background: #f0f6ff;
  color: #174a7d;
}

.workflowHint.edge-ready {
  border-color: rgba(25,135,84,0.28);
  background: #effaf4;
  color: #146c43;
  font-weight: 700;
}

.workflowHint strong{color:#124a86}.workflowHint{line-height:1.45}