:root {
  --color-primary: #d71920;
  --color-primary-dark: #ad1117;
  --color-navy: #17365d;
  --color-blue: #1769aa;
  --color-bg: #f7f8fa;
  --color-surface: #ffffff;
  --color-surface-muted: #f0f3f7;
  --color-text: #172033;
  --color-text-muted: #586174;
  --color-border: #d9dee7;
  --color-success: #18794e;
  --color-warning: #986800;
  --color-danger: #b42318;
  --shadow-card: 0 8px 28px rgba(23, 32, 51, 0.06);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --focus-ring: 0 0 0 3px rgba(23, 105, 170, 0.28);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }

:focus-visible {
  outline: 2px solid var(--color-blue);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  padding: 10px 14px;
  background: var(--color-navy);
  color: white;
  border-radius: var(--radius-sm);
  transform: translateY(-140%);
}
.skip-link:focus { transform: translateY(0); }

.app-header {
  min-height: 64px;
  padding: 10px clamp(18px, 4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.brand-block, .header-actions, .workflow-heading, .section-heading, .step-actions,
.action-cluster, .split-actions, .preview-switch, .archive-card, .dialog-actions {
  display: flex;
  align-items: center;
}

.brand-block { gap: 12px; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50% 50% 50% 12px;
  background: var(--color-primary);
  color: white;
  font-size: 21px;
  font-weight: 800;
}
.brand-block h1, .workflow-heading h2, .section-heading h3,
.result-layout h4, .archive-card h4, dialog h2 { margin: 0; }
.brand-block h1 { font-size: 18px; }
.eyebrow, .step-kicker {
  margin: 0 0 2px;
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.header-actions { gap: 12px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.header-actions label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.header-actions select { max-width: min(280px, 50vw); padding: 7px; border: 1px solid var(--color-border); border-radius: 8px; }
.brand-block { flex-shrink: 0; }
@media (max-width: 900px) {
  .app-header { flex-wrap: wrap; gap: 12px; }
  .header-actions { width: 100%; justify-content: flex-start; }
  .header-actions .prototype-badge { display: none; }
}
.prototype-badge, .status-pill, .context-note {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
}
.prototype-badge { background: #fff2f2; color: #8f1419; border: 1px solid #f2c5c7; }
.mobile-only { display: none; }

.step-view h3[tabindex="-1"]:focus {
  outline: 0;
  box-shadow: none;
}

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

.workflow-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.workflow-panel { overflow: hidden; }
.workflow-heading {
  justify-content: space-between;
  gap: 20px;
  padding: 22px 28px 18px;
}
.workflow-heading h2 { font-size: 24px; }
.save-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 600;
}
.save-state::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success);
}

.stepper {
  list-style: none;
  margin: 0;
  padding: 0 28px 18px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  border-bottom: 1px solid var(--color-border);
}
.stepper li {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-weight: 650;
}
.stepper span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--color-surface-muted);
  font-size: 13px;
}
.stepper li.is-active { background: #fff3f3; color: #8f1419; }
.stepper li.is-active span { background: var(--color-primary); color: white; }
.stepper li.is-complete { color: var(--color-success); }
.stepper li.is-complete span { background: #e3f5ec; }

.task-context {
  margin: 0 28px;
  border-bottom: 1px solid var(--color-border);
}
.task-context > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}
.task-context > summary:hover { color: var(--color-blue); }
.task-context-grid {
  padding: 4px 0 20px;
  display: grid;
  grid-template-columns: 1fr 1fr .8fr;
  gap: 24px;
}
.task-context-grid h3 { margin: 0; font-size: 15px; }
.compact-list { margin: 8px 0 0; }
.compact-list li { padding: 7px 0; }
.boundary-list {
  margin: 8px 0 0;
  padding-left: 20px;
  color: var(--color-text-muted);
  font-size: 14px;
}
.boundary-list li { margin: 5px 0; }
.backend-fields { margin: 0; }
.backend-fields > summary { color: var(--color-blue); }

.step-view { padding: 26px 28px 30px; }
.section-heading {
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}
.section-heading h3 { font-size: clamp(22px, 2vw, 28px); line-height: 1.3; }
.section-heading p:not(.step-kicker) { margin: 6px 0 0; color: var(--color-text-muted); }
.context-note { background: #edf5fb; color: var(--color-blue); }

.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.form-grid label { display: flex; flex-direction: column; gap: 7px; font-weight: 650; }
.form-grid input, .form-grid select, .form-grid textarea {
  min-height: 48px;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid #c5ccd6;
  border-radius: var(--radius-sm);
  background: white;
  color: var(--color-text);
}
.form-grid textarea { resize: vertical; }
.form-grid input:hover, .form-grid select:hover, .form-grid textarea:hover { border-color: #9ba8b8; }
.form-grid small { color: var(--color-text-muted); font-weight: 400; }
.form-span-2 { grid-column: span 2; }

.reference-upload-panel {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: #f8fafc;
}
.reference-upload-panel legend { padding: 0 8px; font-weight: 750; }
.reference-upload-panel > p { margin: 0 0 14px; color: var(--color-text-muted); font-size: 14px; }
.reference-upload-panel > .reference-speed-note { padding: 10px 12px; border-left: 3px solid var(--color-blue); border-radius: 8px; background: #edf5fb; color: var(--color-navy); }
.reference-review-option { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; color: var(--color-navy); font-size: 14px; font-weight: 650; }
.reference-review-option input { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 1px; accent-color: var(--color-primary); }
.reference-upload-grid, .reference-understanding-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.reference-upload-slot, .reference-understanding-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: #fff;
}
.reference-upload-slot input, .reference-upload-slot select, .reference-upload-slot textarea {
  width: 100%;
  box-sizing: border-box;
}
.reference-preview {
  min-height: 92px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #aab4c2;
  border-radius: 12px;
  color: var(--color-text-muted);
  background: #f3f5f8;
}
.reference-preview img { width: 100%; height: 160px; object-fit: contain; background: #fff; }
.reference-understanding { margin-top: 18px; padding: 0 18px 18px; border: 1px solid #b7c6db; border-radius: 16px; background: #f7fbff; }
.reference-understanding > summary { color: var(--color-navy); }
.reference-understanding-content { padding-top: 4px; }
.reference-understanding-card img { width: 100%; height: 180px; object-fit: contain; background: #fff; border-radius: 10px; }
.reference-understanding-card dl { display: grid; gap: 8px; margin: 0; }
.reference-understanding-card dt { font-weight: 750; }
.reference-understanding-card dd { margin: 2px 0 0; color: var(--color-text-muted); }
.reference-understanding-card textarea { width: 100%; box-sizing: border-box; }

.info-strip, .mobile-checklist {
  margin-top: 18px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-md);
  background: #edf5fb;
  color: #174d76;
  font-size: 14px;
}
.info-strip svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }

.step-actions { justify-content: space-between; gap: 14px; margin-top: 24px; }
.split-actions { align-items: flex-end; }
.action-cluster { justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.button {
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 700;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}
.button-primary { background: var(--color-primary); color: white; }
.button-primary:hover:not(:disabled) { background: var(--color-primary-dark); box-shadow: 0 6px 16px rgba(173, 17, 23, .18); }
.button-secondary { background: white; color: var(--color-navy); border-color: #aeb9c8; }
.button-secondary:hover:not(:disabled), .button-ghost:hover:not(:disabled) { background: var(--color-surface-muted); }
.button-ghost { background: transparent; color: var(--color-text); border-color: transparent; }
.button-danger { background: var(--color-danger); color: white; }

.direction-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.direction-card {
  position: relative;
  min-height: 300px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: white;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.direction-card:hover { border-color: #8aa5c1; }
.direction-card.is-selected { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(215,25,32,.1); }
.direction-card input { position: absolute; top: 18px; right: 18px; width: 22px; height: 22px; accent-color: var(--color-primary); }
.direction-code { color: var(--color-primary); font-size: 13px; font-weight: 800; }
.direction-card h4 { margin: 7px 36px 8px 0; font-size: 20px; line-height: 1.35; }
.direction-card p { margin: 0 0 15px; color: var(--color-text-muted); }
.direction-meta { margin-top: auto; display: grid; gap: 10px; }
.meta-row { padding-top: 9px; border-top: 1px solid var(--color-border); }
.meta-row strong { display: block; color: var(--color-navy); font-size: 13px; }
.meta-row span { font-size: 14px; }

.inline-message { min-height: 26px; margin-top: 12px; color: var(--color-text-muted); font-size: 14px; }
.inline-message.is-error { color: var(--color-danger); font-weight: 650; }
.inline-message.is-quality-stop { color: var(--color-navy); font-weight: 650; }
.inline-message.is-waiting {
  max-width: 760px;
  padding: 18px 20px;
  border: 1px solid #f1b5b8;
  border-left: 5px solid var(--color-primary);
  border-radius: 14px;
  background: linear-gradient(135deg, #fff7f7 0%, #fffdfd 68%, #fff3f4 100%);
  color: var(--color-text);
  box-shadow: 0 10px 28px rgba(173, 17, 23, .09);
}
.waiting-card-head { display: flex; align-items: center; gap: 12px; }
.waiting-card-head > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; }
.waiting-card-head strong { color: var(--color-navy); font-size: 17px; }
.waiting-elapsed { color: var(--color-text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.waiting-orbit { width: 20px; height: 20px; flex: 0 0 20px; border: 3px solid #f2c7c9; border-top-color: var(--color-primary); border-radius: 50%; animation: waiting-spin 900ms linear infinite; }
.waiting-steps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.waiting-step { padding: 5px 10px; border: 1px solid #d9dee7; border-radius: 999px; background: white; color: var(--color-text-muted); font-size: 12px; font-weight: 650; }
.waiting-step.is-active { border-color: #ef9da1; background: #fff0f1; color: #9f1118; }
.waiting-step.is-done { border-color: #b8dcc8; background: #eef8f2; color: #21643a; }
.waiting-step.is-error { border-color: #e3aaa5; background: #fff1f0; color: var(--color-danger); }
.waiting-note { margin: 13px 0 0; color: var(--color-navy); font-weight: 650; }
.waiting-save { margin: 5px 0 0; color: var(--color-text-muted); font-size: 13px; }
@keyframes waiting-spin { to { transform: rotate(360deg); } }

.scope-confirmation {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: #f8fafc;
}
.scope-confirmation label { display: flex; flex-direction: column; gap: 7px; font-weight: 650; }
.scope-confirmation input[type="number"], .scope-confirmation input[type="text"], .scope-confirmation input:not([type]) {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  background: #fff;
  color: var(--color-text);
}
.scope-confirmation small { color: var(--color-text-muted); font-weight: 400; }
.scope-confirmation .scope-ack {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: flex-start;
  font-weight: 500;
}
.scope-ack input { margin-top: 3px; }

.preview-switch { padding: 3px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface-muted); }
.preview-switch button { min-height: 38px; padding: 7px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--color-text-muted); font-weight: 650; white-space: nowrap; }
.preview-switch button.is-active { background: white; color: var(--color-navy); box-shadow: 0 2px 8px rgba(23,54,93,.1); }
.mobile-checklist { flex-wrap: wrap; margin: 0 0 18px; background: #fff8e8; color: #6e4c00; }
.mobile-checklist span { padding-left: 10px; border-left: 1px solid #d5b66c; }

.candidate-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.candidate-card { border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; background: white; transition: border-color 180ms ease, box-shadow 180ms ease; }
.candidate-card.is-selected { border-color: var(--color-primary); }
.candidate-card.is-selected { box-shadow: 0 0 0 2px rgba(215,25,32,.1); }
.candidate-card.is-blocked { border-color: #d8a19d; }
.candidate-card.is-unchecked { border-color: #d8c177; }
.candidate-card.is-technical-failed { border-color: #c0c7d2; }
.candidate-image-wrap { min-height: 240px; padding: 16px; display: grid; place-items: center; background: #edf0f4; }
.candidate-image-wrap img { display: block; width: 100%; max-width: 430px; aspect-ratio: 1; object-fit: cover; border-radius: 8px; transition: width 180ms ease; }
.preview-mobile .candidate-image-wrap img { width: 200px; max-width: 100%; }
.candidate-body { padding: 16px; }
.candidate-delivery-status { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin: 0 0 12px; padding: 9px 10px; border-radius: 8px; font-size: 12px; line-height: 1.45; }
.candidate-delivery-status strong { flex: 0 0 auto; }
.candidate-delivery-status span { text-align: right; }
.candidate-delivery-status.status-pass { background: #eaf6f0; color: #11613d; }
.candidate-delivery-status.status-blocked { background: #fff1f0; color: #8c241e; }
.candidate-delivery-status.status-unchecked { background: #fff8e8; color: #6e4c00; }
.candidate-delivery-status.status-technical_failed { background: #eef1f5; color: #34445a; }
.candidate-image-missing { display: grid; width: 100%; min-height: 200px; place-items: center; color: var(--color-text-muted); font-size: 14px; }
.candidate-select { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; font-weight: 750; }
.candidate-select input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--color-primary); }
.candidate-select input:disabled { cursor: not-allowed; opacity: .55; }
.candidate-subtitle { margin: 4px 0 13px; color: var(--color-text-muted); font-size: 13px; }
.candidate-event, .candidate-risk { margin: 10px 0; font-size: 13px; }
.candidate-event { color: var(--color-navy); }
.candidate-risk { padding: 10px; border-radius: 8px; background: #fff8e8; color: #6e4c00; }
.scene-type { display: inline-flex; width: fit-content; margin: 8px 0 2px; padding: 4px 8px; border-radius: 999px; background: #fff0f1; color: #9f1118; font-size: 12px; font-weight: 750; }
.candidate-mobile-check { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.candidate-mobile-check strong, .candidate-mobile-check span { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 8px; border-radius: 999px; font-size: 12px; line-height: 1.3; }
.candidate-mobile-check strong { background: #fff0f1; color: #9f1118; }
.candidate-mobile-check span { background: #eef7f1; color: #21643a; }
.candidate-quality-reasons { margin: 0 0 14px; padding: 11px 12px; border: 1px solid #e3aaa5; border-radius: 8px; background: #fff8f7; color: #76231e; font-size: 13px; line-height: 1.55; }
.candidate-quality-reasons ul { margin: 7px 0 0; padding-left: 20px; }
.candidate-quality-reasons p { margin: 7px 0 0; }
.candidate-quality-reasons.is-technical { border-color: #c8d0dc; background: #f5f7fa; color: #34445a; }
.feedback-label { display: block; margin: 14px 0 7px; font-size: 14px; font-weight: 700; }
.tag-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-button { min-height: 36px; padding: 6px 10px; border: 1px solid #c5ccd6; border-radius: 999px; background: white; color: var(--color-text); font-size: 13px; }
.tag-button.is-selected { background: #edf5fb; border-color: var(--color-blue); color: #174d76; }
.candidate-body textarea { width: 100%; min-height: 76px; padding: 10px; border: 1px solid #bfc7d4; border-radius: var(--radius-sm); resize: vertical; }
.feedback-help { display: block; margin-top: 6px; color: var(--color-text-muted); line-height: 1.45; }
.candidate-action-guide { margin-top: 18px; padding: 13px 15px; border: 1px solid #cbd8e7; border-radius: 10px; background: #f4f8fc; color: var(--color-navy); font-size: 14px; font-weight: 650; line-height: 1.6; }

.status-waiting { background: #fff3d7; color: #755000; }
.result-layout { display: grid; grid-template-columns: 1.35fr .8fr; gap: 24px; }
.selected-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.selected-result { padding: 10px; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.selected-result img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.selected-result strong { display: block; margin-top: 8px; }
.system-summary { padding: 18px; border-radius: var(--radius-md); background: var(--color-surface-muted); }
.system-summary ul { padding: 0; margin: 14px 0 0; list-style: none; }
.system-summary li { display: flex; align-items: flex-start; gap: 9px; margin: 11px 0; }
.check-icon { color: var(--color-success); font-weight: 800; }
.archive-card { justify-content: space-between; align-items: flex-end; gap: 24px; margin-top: 26px; padding: 22px; border: 1px solid #e2c275; border-radius: var(--radius-md); background: #fffaf0; }
.archive-card p { margin: 6px 0 0; max-width: 760px; }
.archive-controls { display: flex; flex: 0 0 360px; flex-direction: column; align-items: flex-end; gap: 12px; }
.archive-ack { display: flex; align-items: flex-start; gap: 8px; max-width: 360px; color: var(--ink-soft); font-size: 13px; line-height: 1.55; cursor: pointer; }
.archive-ack input { flex: 0 0 auto; margin-top: 3px; }
.prototype-warning { color: var(--color-danger); font-weight: 650; }
.archive-result { min-height: 48px; margin-top: 14px; padding: 0; }
.archive-result.is-complete { padding: 14px; border-radius: var(--radius-md); background: #eaf6f0; color: #11613d; font-weight: 700; }
.archive-plan { display: grid; gap: 8px; padding: 16px; border: 1px solid #e2c275; border-radius: var(--radius-md); background: #fffdf7; }
.archive-plan > strong { overflow-wrap: anywhere; }
.archive-plan summary { cursor: pointer; font-weight: 700; }
.archive-plan ul { display: grid; gap: 10px; margin: 12px 0 0; padding: 0; list-style: none; }
.archive-plan li { display: grid; grid-template-columns: minmax(180px, 1fr) auto minmax(280px, 2fr); gap: 12px; align-items: center; padding-top: 10px; border-top: 1px solid var(--line); }
.archive-plan code { overflow-wrap: anywhere; white-space: normal; font-size: 12px; }

.reference-list { list-style: none; padding: 0; margin: 16px 0; }
.reference-list li { display: grid; gap: 3px; padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.reference-list span { color: var(--color-text-muted); font-size: 14px; }
details { margin-top: 14px; }
summary { min-height: 44px; display: flex; align-items: center; color: var(--color-blue); font-weight: 700; cursor: pointer; }
.field-list { margin: 8px 0 0; }
.field-list div { padding: 9px 0; border-top: 1px solid var(--color-border); }
.field-list dt { color: var(--color-text-muted); font-size: 12px; }
.field-list dd { margin: 3px 0 0; font-weight: 650; }
dialog { width: min(440px, calc(100% - 32px)); padding: 24px; border: 0; border-radius: var(--radius-lg); box-shadow: 0 24px 80px rgba(0,0,0,.26); }
dialog::backdrop { background: rgba(12, 22, 38, .55); }
dialog p { color: var(--color-text-muted); }
.dialog-actions { justify-content: flex-end; gap: 10px; margin-top: 22px; }

@media (max-width: 1100px) {
  .task-context-grid { grid-template-columns: 1fr 1fr; }
  .backend-fields { grid-column: 1 / -1; }
  .direction-grid, .candidate-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-span-2 { grid-column: 1 / -1; }
  .reference-upload-grid, .reference-understanding-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .workflow-heading, .section-heading, .step-actions, .archive-card { align-items: stretch; flex-direction: column; }
  .archive-controls { flex-basis: auto; align-items: stretch; }
  .app-header { align-items: center; flex-direction: row; }
  .header-actions { margin-left: auto; gap: 4px; }
  .prototype-badge { justify-content: center; text-align: center; }
  .desktop-only { display: none; }
  .mobile-only { display: inline; }
  .app-header { min-height: 58px; padding-block: 9px; }
  .brand-block { gap: 9px; }
  .brand-mark { width: 34px; height: 34px; font-size: 19px; }
  .brand-block h1 { font-size: 17px; }
  .brand-block .eyebrow { display: none; }
  .prototype-badge { min-height: 28px; padding-inline: 8px; font-size: 12px; }
  .header-actions .button { min-height: 36px; padding-inline: 8px; font-size: 13px; }
  .app-shell { width: min(100% - 16px, 680px); margin-top: 8px; }
  .workflow-heading, .step-view { padding: 18px; }
  .inline-message.is-waiting { padding: 15px; }
  .workflow-heading { gap: 8px; }
  .workflow-heading h2 { font-size: 22px; }
  .stepper { padding: 0 10px 12px; gap: 2px; }
  .stepper li { padding: 7px 5px; flex-direction: column; text-align: center; font-size: 12px; }
  .task-context { margin: 0 18px; }
  .task-context-grid, .form-grid, .direction-grid, .candidate-grid, .result-layout, .selected-results, .scope-confirmation { grid-template-columns: 1fr; }
  .backend-fields { grid-column: auto; }
  .form-span-2 { grid-column: auto; }
  .preview-switch { width: 100%; }
  .preview-switch button { flex: 1; }
  .action-cluster { width: 100%; }
  .action-cluster .button { flex: 1 1 100%; }
  .split-actions > .button { width: 100%; }
  .mobile-checklist { align-items: flex-start; flex-direction: column; }
  .mobile-checklist span { padding-left: 0; border-left: 0; }
  .candidate-image-wrap { min-height: 230px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
