/* Desktop-only Run Inspection refinements. Existing mobile rules remain authoritative. */
.inspection-desktop-only { display: none; }
@media (min-width: 961px) {
  .inspection-desktop-only:not([hidden]) { display: block; }
  .app-shell .run-view { width: min(calc(100% - 64px),1440px); gap: 22px; margin: 28px auto 40px; }
  .app-shell .run-view .summary-card { display: grid; grid-template-columns: minmax(230px,1.25fr) minmax(180px,.85fr) minmax(210px,1fr) minmax(170px,.8fr); gap: 0; padding: 0; border: 1px solid #e4dee8; border-radius: 10px; background: #fff; box-shadow: 0 1px 2px #30203905; }
  .app-shell .run-view .summary-block { min-width: 0; padding: 22px; border: 0; border-right: 1px solid #eee9f1; }
  .app-shell .run-view .summary-block:last-child { border-right: 0; }
  .app-shell .run-view .summary-block > .label { display: block; margin: 0 0 10px; color: #7d7085; font-size: 11px; font-weight: 550; letter-spacing: .025em; text-transform: none; }
  .app-shell .run-view #currentJobNumber { margin: 0 0 8px; color: #3f2b4a; font-size: 27px; font-weight: 600; letter-spacing: -.035em; }
  .app-shell .run-view .job-product-description { margin: 0 0 12px; color: #63576b; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
  .app-shell .run-view .mini-grid { margin: 0; }
  .app-shell .run-view .mini-grid :is(span,b) { font-size: 11px; line-height: 1.5; }
  .app-shell .run-view #currentProgressPercent { display: block; margin: 0 0 12px; color: #51395d; font-size: 27px; font-weight: 600; }
  .app-shell .run-view .job-completion-meter { height: 5px; margin-bottom: 14px; border-radius: 3px; background: #efe9f2; overflow: hidden; }
  .job-completion-meter i { display: block; width: 0; height: 100%; background: #775484; border-radius: inherit; }
  .app-shell .run-view .summary-job-context { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
  .app-shell .run-view .summary-job-context :is(small,b,strong) { font-size: 11px; line-height: 1.5; }
  .app-shell .run-view .job-room-block > label { font-size: 11px; color: #716579; margin-bottom: 12px; }
  .app-shell .run-view .job-room-entry { display: flex; gap: 6px; }
  .app-shell .run-view .job-room-entry input { min-width: 0; width: 100%; }
  .app-shell .run-view .job-room-entry :is(input,button), .app-shell .run-view .gtin-scan-open { min-height: 38px; font-size: 12px; border-radius: 6px; }
  .app-shell .run-view :is(.job-room-status,.job-gtin-status) { font-size: 11px; line-height: 1.6; margin-top: 10px; }
  .app-shell .run-view :is(.run-operation-card,.plans-panel) { border: 1px solid #e6e2e9; border-radius: 10px; box-shadow: 0 1px 2px #30203905; }
  .app-shell .run-view :is(.summary-card,.run-operation-card,.plans-panel):hover { box-shadow: 0 1px 2px #30203905; border-color: #ddd5e2; }
  .app-shell .run-view .plans-panel > .section-header { padding: 22px 24px; border-bottom: 1px solid #eae5ed; background: #fff; }
  .app-shell .run-view .plans-panel-heading h2 { margin: 3px 0 6px; font-size: 19px; font-weight: 600; letter-spacing: -.025em; }
  .app-shell .run-view .plans-panel-heading p { font-size: 12px; color: #7c7083; }
  .app-shell .run-view .plans-panel-icon { display: none; }
  .app-shell .run-view .plans-grid:not(.empty-state) { display: grid; grid-template-columns: minmax(0,1fr); gap: 16px; padding: 20px; }
  .app-shell .run-view .plan-responsibility-group { border: 1px solid #e7e1eb; border-radius: 8px; overflow: hidden; }
  .app-shell .run-view .plans-grid .plan-responsibility-header { min-height: 50px; padding: 14px 18px; background: #f8f6fa; border-color: #e8e2ed; }
  .app-shell .run-view .plans-grid .plan-responsibility-title strong { color: #584262; font-size: 13px; font-weight: 600; }
  .app-shell .run-view .plans-grid .plan-responsibility-summary { color: #7c6d85; font-size: 11px; }
  .app-shell .run-view .plan-row { min-height: 92px; padding: 18px; gap: 16px; background: #fff; border-bottom: 1px solid #eeeaf1; }
  .app-shell .run-view .plan-row:last-child { border-bottom: 0; }
  .app-shell .run-view .plan-row.has-submission { box-shadow: inset 3px 0 #8aba9f; }
  .app-shell .run-view .plan-row.has-draft { box-shadow: inset 3px 0 #caa66b; }
  .app-shell .run-view .plan-row.has-witness-action { box-shadow: inset 3px 0 #a87baf; }
  .app-shell .run-view .plan-title-line { gap: 9px; }
  .app-shell .run-view .plan-title-line strong { color: #3f3348; font-size: 14px; font-weight: 600; line-height: 1.5; }
  .app-shell .run-view .plan-content .muted { color: #7b7082; font-size: 11px; line-height: 1.6; margin-top: 5px; }
  .app-shell .run-view .status-badge { padding: 3px 8px; font-size: 10px; font-weight: 550; border-radius: 5px; }
  .app-shell .run-view .plan-icon { width: 34px; height: 34px; border-radius: 8px; color: #8b7496; background: #f6f2f8; border: 1px solid #eae1ef; }
  .app-shell .run-view .plan-actions { gap: 8px; }
  .app-shell .run-view .plan-actions button { min-height: 38px; padding: 9px 14px; font-size: 12px; border-radius: 6px; font-weight: 550; }
  .app-shell .run-view .plan-actions button[data-index] { color: #51355f; background: #f6f0f8; border: 1px solid #daccdf; box-shadow: none; }
  .app-shell .run-view .plan-row.has-draft .plan-actions button[data-index] { color: #fff; background: #62416f; border-color: #62416f; }
  .app-shell .run-view .plan-actions .plan-delete-button { color: #a05050; background: #fff; border-color: transparent; font-size: 11px; }
  .app-shell .run-view .plan-actions .plan-delete-button:hover { background: #fff4f3; border-color: #edd3d0; }
  /* Form hierarchy and a stable footer inside the dialog's scrolling shell. */
  #planDialog { border: 1px solid #e3dce7; border-radius: 12px; box-shadow: 0 24px 80px #22142d40; }
  #planDialog .dialog-shell { background: #faf9fb; }
  #planDialog .dialog-header { grid-template-columns: minmax(0,1fr) minmax(300px,370px); padding: 24px 28px; gap: 28px; background: #fff; border-bottom: 1px solid #e6e0ea; }
  #planDialog .dialog-header-main .eyebrow { margin-bottom: 9px; font-size: 10px; color: #90799b; letter-spacing: .09em; }
  #planDialog #dialogTitle { color: #3e2d48; font-size: 23px; font-weight: 600; line-height: 1.3; letter-spacing: -.03em; }
  #planDialog #dialogMeta { margin-top: 10px; color: #7e7186; font-size: 12px; line-height: 1.7; }
  #planDialog .dialog-progress.dialog-progress-inline { padding: 14px 16px; border: 1px solid #e9e1ed; border-radius: 8px; background: #faf7fc; }
  #planDialog .dialog-progress-overview span, #planDialog .dialog-progress-metrics span { color: #82708d; font-size: 11px; }
  #planDialog .dialog-progress-overview strong { font-size: 23px; color: #674676; font-weight: 600; }
  #planDialog .dialog-progress-track { height: 5px; background: #e9deee; }
  #planDialog .dialog-progress-track i { background: #876296; }
  #planDialog .dialog-progress-metrics strong { color: #62496d; font-size: 13px; }
  #planDialog .question-tools { padding: 14px 28px; gap: 10px; background: #fff; border-bottom: 1px solid #eae5ee; }
  #planDialog .question-search-wrap { flex: 1; max-width: 420px; }
  #planDialog .question-tools :is(input,button) { min-height: 38px; font-size: 12px; }
  #planDialog #reviewOutstandingBtn { margin-left: auto; color: #815e2d; background: #fffaf1; border: 1px solid #e5d6b9; white-space: nowrap; }
  #planDialog #reviewOutstandingBtn:disabled { color: #63756a; background: #f6faf7; border-color: #dce8e0; opacity: 1; cursor: default; }
  #planDialog .questions-table-wrap { padding: 12px 28px 24px; scroll-padding-block: 20px; }
  #planDialog .questions-table { border-spacing: 0 9px; }
  #planDialog .questions-table thead th { padding: 10px 16px; color: #8a7a95; background: #faf9fb; font-size: 11px; font-weight: 550; letter-spacing: .02em; text-transform: none; }
  #planDialog .question-row td { padding: 16px; border-color: #e7e1eb; background: #fff; vertical-align: middle; }
  #planDialog .question-row .outline-text, #planDialog .question-label { color: #44374d; font-size: 13px; line-height: 1.65; font-weight: 500; }
  #planDialog .question-row .outline-number { color: #967aa4; font-size: 12px; }
  #planDialog .question-extra { color: #807488; font-size: 12px; line-height: 1.65; }
  #planDialog .question-row.is-valid td { background: #fff; border-color: #e0e8e2; }
  #planDialog .question-row.is-invalid td { background: #fffcfa; border-color: #e7ceba; }
  #planDialog .question-row.is-invalid td:first-child { border-left: 3px solid #c58d5d; }
  #planDialog .required-pill { padding: 4px 8px; border-radius: 5px; font-size: 10px; font-weight: 550; }
  #planDialog .required-pill.optional { color: #8d8294; background: #f5f3f7; border-color: #e9e5ed; }
  #planDialog :is(.answer-control,select,textarea) { min-height: 42px; padding: 10px 12px; border-radius: 6px; font-size: 13px; border-color: #d8cedf; box-shadow: none; }
  #planDialog :is(.answer-control,select,textarea):focus { border-color: #9373a1; box-shadow: 0 0 0 3px #f0e8f5; outline: none; }
  #planDialog :is(button,[tabindex]):focus-visible { outline: 3px solid #9a7aa7; outline-offset: 3px; }
  #planDialog .dialog-actions { flex: 0 0 auto; padding: 18px 28px; gap: 18px; border-top: 1px solid #e4dce9; background: #fff; box-shadow: 0 -4px 16px #3b254505; }
  #planDialog .dialog-status { font-size: 12px; line-height: 1.6; color: #6f6079; overflow-wrap: anywhere; }
  #planDialog .dialog-actions-buttons { gap: 10px; flex-shrink: 0; }
  #planDialog .dialog-actions-buttons > button { min-height: 42px; padding: 10px 20px; border-radius: 7px; font-size: 13px; font-weight: 550; }
  #planDialog #submitInspectionBtn { color: #fff; background: #62416f; border-color: #62416f; box-shadow: none; }
  #planDialog #submitInspectionBtn:hover:not(:disabled) { background: #493153; border-color: #493153; }
}
@media (min-width: 961px) and (max-width: 1200px) {
  .app-shell .run-view .summary-card { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .app-shell .run-view .summary-block:nth-child(2) { border-right: 0; }
  .app-shell .run-view .summary-block:nth-child(-n+2) { border-bottom: 1px solid #eee9f1; }
}
.inspection-desktop-only[hidden] { display: none !important; }
@media (max-width: 960px) {
  #planDialog #reviewOutstandingBtn, #jobProductDescription, #jobCompletionMeter { display: none !important; }
}
@media (min-width: 961px) {
  .app-shell .run-view .gtin-summary-block { display: block; }
  .app-shell .run-view .gtin-summary-block .gtin-scan-open { display: inline-flex; width: auto; margin: 0; }
  .app-shell .run-view .gtin-summary-block .job-gtin-status { display: block; margin: 10px 0 0; overflow-wrap: anywhere; }
}
@media (min-width: 961px) {
  #planDialog .dialog-progress-metrics > div { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
  #planDialog .dialog-progress-metrics span { font-size: 10px; letter-spacing: 0; text-transform: none; white-space: nowrap; }
}

.witness-draft-preview { width: min(880px, calc(100vw - 48px)); max-height: 85vh; padding: 0; border: 1px solid #e4dce8; border-radius: 16px; color: #33283c; background: white; box-shadow: 0 24px 80px #23142c40; }
.witness-draft-preview::backdrop { background: #21172788; }
.witness-draft-preview > header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 24px; border-bottom: 1px solid #e8e2ec; }
.witness-draft-preview h2 { margin: 0; font-size: 1.25rem; }
.witness-draft-preview .witness-draft-close { width: 36px; height: 36px; padding: 0; font-size: 26px; background: #f5f1f7; color: #51365e; border: 0; border-radius: 8px; }
.witness-draft-body { padding: 16px 24px 24px; overflow-y: auto; max-height: calc(85vh - 84px); }
.witness-draft-body > p { color: #756b7d; }
.witness-draft-body section { padding: 16px 0; border-bottom: 1px solid #eee8f1; }
.witness-draft-body h3 { font-size: .95rem; margin: 0 0 8px; }
.witness-draft-value { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
[data-view-witness-draft] { margin-top: 10px; }
