/* Full-page drawing review; scoped to this workspace so the ledger stays unchanged. */
body.ai-review-detail-open .sidebar,
body.ai-review-detail-open .qcos-global-header,
body.ai-review-detail-open .erp-main-chrome { visibility: hidden; pointer-events: none; }
#page-ai-review .ai-draft-detail-shell { inset: 0 !important; display: block; background: #f5f7fb; }
#page-ai-review .ai-draft-detail-backdrop { display: none; }
#page-ai-review .ai-draft-detail-shell .ai-draft-detail-card { width: 100%; height: 100dvh; padding: 0 20px; border-radius: 0 !important; box-shadow: none !important; animation: none; background: #fff; }
#page-ai-review .ai-draft-detail-shell .ai-draft-decision-head { margin: 0; padding: 14px 0; border-radius: 0; min-height: 64px; box-shadow: none; }
#page-ai-review .ai-draft-decision-head h3 { font-size: 20px; }
#page-ai-review .ai-draft-decision-head p { display: none; }
#page-ai-review .ai-draft-detail-shell #ai-draft-detail-panel { display: flex; flex-direction: column; overflow: hidden; padding: 0; min-height: 0; }
#page-ai-review .ai-draft-source-summary { display: flex; flex-wrap: wrap; margin: 0 0 10px; gap: 12px; padding: 0; }
#page-ai-review .ai-draft-source-file { flex: 1; padding: 8px 12px; border-radius: 6px; min-width: 0; }
#page-ai-review .ai-draft-source-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#page-ai-review .ai-draft-status-rail { padding: 6px 12px; border-radius: 6px; }
#page-ai-review .ai-review-stepper { position: static; grid-template-columns: repeat(3,minmax(0,1fr)); box-shadow: none; border-radius: 6px; margin: 0 0 12px; padding: 4px; flex-shrink: 0; }
#page-ai-review .ai-review-stepper button { min-height: 36px; border-radius: 4px; }
#page-ai-review .ai-review-step-actions { position: static; min-height: 64px; margin: 0; padding: 10px 0; display: flex; align-items: center; gap: 10px; border-top: 1px solid #e4eaf2; flex: 0 0 auto; box-shadow: none; }
.aiw-save { margin-right: auto; font-size: 13px; color: #51617a; }
.aiw-save.is-error { color: #b42318; }
.aiw-body { display: grid; grid-template-columns: minmax(0,var(--aiw-preview,35%)) 10px minmax(0,1fr); flex: 1; min-height: 0; gap: 0; }
.aiw-preview { min-width: 0; min-height: 0; display: flex; flex-direction: column; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; background: #f7f9fc; margin-bottom: 12px; }
.aiw-preview-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff; border-bottom: 1px solid #e2e8f0; }
.aiw-preview-head strong { margin-right: auto; }
.aiw-document { flex: 1; min-height: 0; position: relative; overflow: auto; display: flex; }
.aiw-document iframe { flex: 1; width: 100%; height: 100%; border: 0; }
.aiw-document img { width: 100%; object-fit: contain; align-self: flex-start; }
.aiw-placeholder { margin: auto; padding: 28px; color: #64748b; line-height: 1.8; text-align: center; }
.aiw-divider { cursor: col-resize; position: relative; touch-action: none; }
.aiw-divider:after { content: ''; position: absolute; top: 45%; left: 3px; width: 4px; height: 40px; border-radius: 4px; background: #cbd5e1; }
.aiw-right { min-width: 0; min-height: 0; overflow: auto; padding: 0 0 12px 4px; }
.aiw-body.is-items .aiw-right { display: flex; flex-direction: column; overflow: hidden; }
#page-ai-review .aiw-body.is-items .ai-draft-review-layout { display: none; }
#page-ai-review .aiw-body .ai-draft-review-layout { display: block; }
#page-ai-review .aiw-body .ai-draft-decision-sidebar { display: block; }
#page-ai-review .aiw-body .ai-review-step { margin-bottom: 12px; }
#page-ai-review .aiw-body .ai-draft-items-section.is-active { display: flex; flex-direction: column; flex: 1; min-height: 0; margin: 0; padding: 0; }
#page-ai-review .aiw-body .ai-items-section-head { display: none; }
#page-ai-review .aiw-body .ai-item-review-meta { flex: 0 0 auto; margin: 0 0 8px; display: block; }
#page-ai-review .aiw-body .ai-item-stats { margin: 0; font-size: 12px; }
#page-ai-review .aiw-body .ai-model-response-inline { display: none; }
#page-ai-review .aiw-body .ai-balloon-warning { font-size: 12px; padding: 8px; margin: 0 0 8px; }
#page-ai-review .aiw-body .ai-item-review-shell { display: flex; flex: 1; min-height: 0; height: auto; max-height: none; flex-direction: column; border-radius: 6px; }
#page-ai-review .aiw-body .ai-item-workspace { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#page-ai-review .aiw-body .ai-item-table-wrap { flex: 1; height: auto; min-height: 0; max-height: none; overflow: auto; }
#page-ai-review .aiw-body .ai-item-table { width: 100%; min-width: 620px; table-layout: fixed; font-size: 13px; }
#page-ai-review .aiw-body .ai-item-table thead { transform: none; position: sticky; top: 0; }
#page-ai-review .aiw-body .ai-item-table th { font-size: 12px; background: #f5f7fb; padding: 12px 8px; white-space: normal; }
#page-ai-review .aiw-body .ai-item-table td { font-size: 13px; padding: 12px 8px; vertical-align: middle; height: auto; white-space: normal; word-break: break-word; }
#page-ai-review .aiw-body .ai-item-row { content-visibility: visible; }
#page-ai-review .aiw-body .ai-item-col-check { width: 32px; }
#page-ai-review .aiw-body .ai-item-col-balloon { width: 48px; }
#page-ai-review .aiw-body .ai-item-col-name { width: 24%; min-width: 0; }
#page-ai-review .aiw-body .aiw-spec { width: 22%; font-variant-numeric: tabular-nums; }
#page-ai-review .aiw-body .ai-item-col-lanes { width: 19%; min-width: 0; }
#page-ai-review .aiw-body .ai-item-col-status { width: 92px; }
#page-ai-review .aiw-body .aiw-op { width: 72px; }
.aiw-origin { display: block; color: #64748b; font-size: 11px; font-weight: 400; margin-top: 4px; }
.aiw-origin.is-auto { color: #9a6100; }
.aiw-problem { color: #b45309; font-size: 12px; display: block; }
.aiw-tools { padding: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid #e2e8f0; background: #fff; }
.aiw-tabs { display: flex; gap: 4px; }
.aiw-tabs button,.aiw-mobile-tabs button { padding: 8px 10px; border: 0; background: transparent; color: #55657c; border-radius: 4px; cursor: pointer; }
.aiw-tabs button.active,.aiw-mobile-tabs button.active { color: #1677ff; background: #eaf3ff; }
.aiw-tools input { min-width: 100px; flex: 1; width: 130px; max-width: 240px; }
#page-ai-review .aiw-body .ai-item-bulk-bar { display: none; margin: 0; border-radius: 0; background: #f0f7ff; padding: 10px; flex: 0 0 auto; }
#page-ai-review .aiw-body .ai-item-bulk-bar.has-selection { display: block; }
.aiw-bulk-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aiw-tools, .aiw-selection { flex: 0 0 auto; }
.aiw-selection { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; padding: 9px 10px; background: #fff; border-bottom: 1px solid #e2e8f0; font-size: 13px; }
.aiw-selection label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 32px; }
.aiw-selection input { accent-color: #1677ff; }
#aiw-selected-count { color: #1677ff; font-variant-numeric: tabular-nums; }
#page-ai-review .aiw-body .ai-item-row.is-selected > td { background: #edf5ff !important; }
#page-ai-review .aiw-body .ai-item-bulk-bar { max-height: 280px; overflow-y: auto; }
#aiw-active-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#aiw-lane-panel { padding-top: 8px; }
#aiw-lane-panel p { margin: 0; }
#aiw-lane-advanced { margin-top: 10px; }
#aiw-lane-advanced summary { cursor: pointer; font-size: 12px; color: #51617a; padding: 4px 0; }
.aiw-feedback { flex: 0 0 auto; max-height: 72px; overflow: auto; padding: 8px 10px; font-size: 12px; line-height: 1.6; color: #275a3d; background: #f3faf5; }
.aiw-feedback.is-error { color: #a34212; background: #fff8ed; }
.aiw-bulk-lanes { display: flex; flex-wrap: wrap; gap: 12px; padding: 8px 0; }
.aiw-bulk-lanes label { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; }
.aiw-body.no-preview { grid-template-columns: minmax(0,1fr); }
.aiw-body.no-preview .aiw-preview,.aiw-body.no-preview .aiw-divider { display: none; }
.aiw-mobile-tabs { display: none; }
.aiw-publish-preview { padding: 16px; margin: 12px 0; background: #f8faff; border: 1px solid #dce8f7; border-radius: 6px; }
.aiw-publish-preview table { width: 100%; border-collapse: collapse; }
.aiw-publish-preview th,.aiw-publish-preview td { padding: 8px; text-align: left; border-bottom: 1px solid #e2e8f0; font-size: 13px; }
.aiw-publish-preview p { font-size: 13px; line-height: 1.7; }
#page-ai-review .aiw-body .ai-item-edit-panel { padding: 16px; box-shadow: none; border-radius: 6px; background: #f6f9fe; }
.aiw-editor-actions { margin-top: 12px; }
#page-ai-review #ai-d-action-save, #page-ai-review #ai-d-action-approve, #page-ai-review #ai-d-action-publish { display: none !important; }
#page-ai-review .ai-draft-mobile-return-bar { display: none; }
@media(max-width:1000px) {
  #page-ai-review .ai-draft-detail-shell .ai-draft-detail-card { padding: 0 12px; }
  .aiw-body { grid-template-columns: minmax(0,1fr); }
  .aiw-divider { display: none; }
  .aiw-mobile-tabs { display: flex; gap: 8px; margin-bottom: 8px; flex-shrink: 0; }
  .aiw-body .aiw-preview { display: none; }
  .aiw-body.show-drawing .aiw-preview { display: flex; }
  .aiw-body.show-drawing .aiw-right { display: none; }
  #aiw-toggle-drawing { display: none; }
  #page-ai-review .ai-draft-status-rail { display: none; }
  #page-ai-review .ai-review-stepper strong { display: inline; font-size: 12px; white-space: normal; }
  #page-ai-review .ai-review-stepper button { gap: 4px; padding: 4px; }
  #page-ai-review .ai-draft-decision-head h3 { font-size: 17px; }
  #page-ai-review .ai-draft-detail-shell .ai-draft-decision-head { flex-direction: row; align-items: center; }
  .aiw-tools { display: grid; grid-template-columns: minmax(0,1fr) auto; }
  .aiw-tabs { grid-column: 1 / -1; }
  .aiw-tools input { width: 100%; max-width: none; }
  #page-ai-review .aiw-body .ai-item-bulk-bar { max-height: 180px; min-height: 52px; flex: 0 1 auto; }
  #page-ai-review .aiw-body .ai-item-workspace { min-height: 140px; }
  #page-ai-review .ai-item-bulk-bar:has(#aiw-lane-panel:not(.hidden)) > .aiw-bulk-head { display: none; }
  #aiw-lane-panel > p { display: none; }
  #aiw-lane-panel { padding-top: 0; }
  .aiw-bulk-lanes { gap: 4px 8px; padding: 4px 0 8px; }
  .aiw-bulk-lanes label { min-height: 24px; }
  #page-ai-review .aiw-bulk-lanes input[type="checkbox"] { width: 14px; height: 14px; min-height: 14px; margin: 0; }
  .aiw-selection { gap: 4px 12px; }
  .aiw-save { font-size: 12px; flex: 1; min-width: 80px; }
  #ai-review-step-progress { display: none; }
  #page-ai-review .ai-review-step-actions { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
  #aiw-save { grid-column: 1; grid-row: 1; }
  #aiw-save + button { grid-column: 2; grid-row: 1; }
  #ai-review-step-prev { grid-column: 1; grid-row: 2; justify-self: start; }
  #ai-review-step-next { grid-column: 2; grid-row: 2; }
}

/* Step one: one material decision followed by this drawing's editable metadata. */
.aiw-body { grid-template-columns: minmax(0,var(--aiw-preview,45%)) 12px minmax(0,1fr); }
#page-ai-review .aiw-body [data-ai-step-panel="2"] { display: none !important; }
#page-ai-review .aiw-body .aiw-material-step { max-width: 900px; margin: 0 auto 16px; padding: 24px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; box-shadow: none; }
#page-ai-review .aiw-material-step h4 { margin: 0; padding: 0; font-size: 15px; font-weight: 600; color: #334155; border: 0; }
#page-ai-review .aiw-material-step h3 { margin: 16px 0 6px; font-size: 21px; line-height: 1.5; color: #172b45; overflow-wrap: anywhere; }
.aiw-section-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.aiw-section-head > button { margin-left: auto; }
.aiw-associated, .aiw-pending { padding: 3px 8px; border-radius: 4px; font-size: 12px; background: #edf8f1; color: #257147; }
.aiw-pending { color: #8a5a14; background: #fff6e8; }
.aiw-material-code { color: #52647b; font-size: 14px; overflow-wrap: anywhere; }
.aiw-material-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0 12px; font-size: 14px; }
.aiw-material-facts > div { display: flex; gap: 12px; min-width: 0; }
.aiw-material-facts dt { color: #64748b; flex-shrink: 0; }
.aiw-material-facts dd { margin: 0; color: #334155; overflow-wrap: anywhere; }
#page-ai-review .aiw-note { font-size: 13px; color: #64748b; line-height: 1.7; margin: 8px 0; }
#aiw-material-picker, #aiw-new-material, .aiw-drawing-fields { border-top: 1px solid #e7ecf2; margin-top: 24px; padding-top: 20px; }
#page-ai-review .aiw-material-step .ai-review-field-grid { gap: 16px; margin-top: 16px; }
#page-ai-review .aiw-material-step .ai-review-field-grid label { font-size: 13px; color: #52647b; gap: 8px; }
#page-ai-review .aiw-material-step input:not([type="radio"]), #page-ai-review .aiw-material-step select { min-width: 0; width: 100%; height: 40px; padding: 8px 10px; font-size: 14px; border: 1px solid #cbd5e1; border-radius: 5px; background: #fff; }
#page-ai-review .aiw-material-step input:focus, #page-ai-review .aiw-material-step select:focus { outline: 2px solid #bfdbfe; outline-offset: 1px; }
#page-ai-review .aiw-material-step .ai-draft-code-mode-chips { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
#page-ai-review .aiw-material-step .ai-draft-code-mode-chips label { display: inline-flex; align-items: center; gap: 6px; }
#page-ai-review .aiw-material-step input[type="radio"] { width: 16px; height: 16px; margin: 0; accent-color: #1677ff; }
.aiw-search-row { display: flex; gap: 8px; margin: 8px 0 12px; }
.aiw-search-row input { flex: 1; }
#aiw-material-search { margin-top: 16px; }
#aiw-material-search > label { font-size: 13px; color: #52647b; }
.aiw-candidate { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid #e7ecf2; }
.aiw-candidate > div { min-width: 0; }
.aiw-candidate strong { display: block; font-size: 15px; margin-bottom: 6px; overflow-wrap: anywhere; }
.aiw-candidate > button { flex-shrink: 0; }
.aiw-candidate summary, .aiw-other-candidates > summary { font-size: 13px; color: #52647b; cursor: pointer; padding: 6px 0; }
.aiw-other-candidates { margin-top: 8px; }
#aiw-create-material { margin-top: 16px; }
.aiw-material-warning { padding: 12px; background: #fff7ed; border-left: 3px solid #d99539; color: #92400e; font-size: 14px; line-height: 1.7; }
@media(max-width:1000px) {
  .aiw-body { grid-template-columns: minmax(0,1fr); }
  #page-ai-review .aiw-body .aiw-material-step { padding: 16px; }
  #page-ai-review .aiw-material-step .ai-review-field-grid { grid-template-columns: minmax(0,1fr); }
  .aiw-material-facts { grid-template-columns: minmax(0,1fr); }
  .aiw-candidate { flex-wrap: wrap; }
  .aiw-candidate > button { margin-left: auto; }
}
#page-ai-review .aiw-material-step .ai-review-field-grid > label { display: flex; flex-direction: column; align-items: stretch; line-height: 1.5; }
#page-ai-review .aiw-material-step .ai-review-field-grid > label > input,
#page-ai-review .aiw-material-step .ai-review-field-grid > label > select { margin: 0; }
