.wf-selection { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; padding: 13px; border: 1px solid #ead8ca; border-radius: 9px; background: #fff9f4; }
.wf-selection-heading { grid-column: 1 / -1; display: grid; gap: 3px; }
.wf-selection-heading b { color: #7e4127; }
.wf-selection-heading small, .wf-muted { color: var(--muted); font-size: 11px; }
.wf-selection [data-wf-template-field][hidden] { display: none; }
.wf-preview { grid-column: 1 / -1; display: grid; gap: 5px; min-height: 38px; padding: 9px 11px; border-radius: 7px; background: #f8eee6; color: #5c554f; font-size: 11px; }
.wf-preview ol { display: flex; flex-wrap: wrap; gap: 5px 20px; margin: 3px 0 0; padding-left: 17px; }
.wf-preview p { line-height: 1.45; }
.wf-preview-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wf-preview-title span { color: #8a644b; }
.wf-error { color: var(--red); }
.wf-skeleton { display: block; width: min(100%, 310px); height: 9px; border-radius: 5px; background: linear-gradient(90deg,#eaded4,#f8eee6,#eaded4); background-size: 200% 100%; animation: wf-shimmer 1.2s ease-in-out infinite; }
.wf-template-panel { margin-top: 12px; }
.wf-template-panel .panelhead small { display: block; margin-top: 3px; color: var(--muted); }
.wf-template-list { display: grid; gap: 7px; }
.wf-template-row { display: flex; min-width: 0; align-items: center; gap: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.wf-template-row .grow { display: grid; gap: 3px; }
.wf-template-row small { color: var(--muted); font-size: 11px; }
.wf-template-code { display: grid; width: 42px; height: 34px; flex: none; place-items: center; border-radius: 6px; background: #f7e6d9; color: #8d431f; font-size: 11px; font-weight: 800; }
.wf-template-steps { display: grid; gap: 9px; }
.wf-template-step { padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.wf-template-step-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.wf-template-step .formgrid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.wf-product-progress { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 5px 9px; padding: 6px 0 2px; }
.wf-product-progress > div:first-child { display: flex; justify-content: space-between; gap: 6px; font-size: 10px; }
.wf-product-progress > div:first-child b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-product-progress > div:first-child span { flex: none; color: var(--muted); }
.wf-product-progress > i { grid-column: 1 / -1; height: 4px; overflow: hidden; border-radius: 9px; background: #ebe8e3; }
.wf-product-progress > i em { display: block; height: 100%; border-radius: inherit; background: var(--orange); }
.wf-line-summary { display: grid; gap: 2px; margin-top: 3px; color: var(--muted); font-size: 10px; text-align: left; }
.wf-station-counts { grid-column: 1 / -1; font-size: 10px; }
.wf-station-counts summary { color: #8c4a2b; cursor: pointer; }
.wf-station-counts > span { display: block; margin-top: 4px; color: var(--muted); }
.wf-reorder-note { padding: 8px 10px; border-left: 3px solid var(--orange); background: #fbf3ed; color: var(--muted); font-size: 11px; }
.wf-step-list { display: grid; gap: 7px; }
.wf-step-card { display: flex; min-width: 0; align-items: center; gap: 7px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.wf-step-card[draggable="true"] { cursor: grab; }
.wf-step-card:active { cursor: grabbing; }
.wf-step-card .grow { display: grid; gap: 3px; }
.wf-step-card small { color: var(--muted); }
.wf-step-card ul { margin: 2px 0 0; padding-left: 16px; color: var(--muted); font-size: 10px; }
.wf-step-index { display: grid; width: 25px; height: 25px; flex: none; place-items: center; border-radius: 50%; background: #f6e8dc; color: #8b4827; font-weight: 800; }
.wf-import-preview { margin: 8px 0; padding: 8px 10px; border-left: 3px solid var(--orange); border-radius: 0 6px 6px 0; background: #fbf3ed; color: #55473f; font-size: 11px; }
.wf-import-preview p { margin-top: 4px; color: var(--muted); }
.wf-import-preview ol { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 5px 0 0; padding-left: 17px; }
.wf-detail-controls { display: grid; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.wf-detail-controls-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wf-detail-controls-head span, .wf-detail-muted { color: var(--muted); font-size: 11px; }
.wf-detail-checks { display: grid; gap: 6px; }
.wf-detail-checks label, .wf-detail-defect { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.wf-detail-checks label span { display: grid; gap: 2px; }
.wf-detail-checks small { color: var(--muted); font-size: 10px; }
.wf-defect-state { padding: 8px 10px; border: 1px solid #cfdcd1; border-radius: 7px; background: #eff5ef; color: #40634a; }
.wf-defect-state p { margin-top: 4px; color: var(--muted); }
.wf-defect-state.is-defective { border-color: #e1b8b2; background: #fff2f0; color: #923f36; }
.wf-detail-defect { padding: 4px 0; }
.mg-workflow-controls { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 11px; border: 1px solid #ead8ca; border-radius: 8px; background: #fff9f4; }
.mg-workflow-controls > small { grid-column: 1 / -1; color: var(--muted); }
.mg-workflow-controls [hidden] { display: none; }
.dark .wf-detail-controls, .dark .mg-workflow-controls { border-color: #654a38; background: #342f2b; color: #e8d7c9; }
.dark .wf-defect-state { border-color: #46624b; background: #29392c; color: #c4e0c9; }
.dark .wf-defect-state.is-defective { border-color: #704540; background: #3c2e2c; color: #f0b3ad; }
.dark .wf-selection, .dark .wf-preview, .dark .wf-reorder-note, .dark .wf-import-preview { border-color: #654a38; background: #342f2b; color: #e8d7c9; }
.dark .wf-template-code, .dark .wf-step-index { background: #49382e; color: #f1b28c; }
@keyframes wf-shimmer { to { background-position: -200% 0; } }
@media(max-width:850px) {
  .wf-selection, .wf-template-step .formgrid { grid-template-columns: 1fr; }
  .wf-template-row { flex-wrap: wrap; }
  .wf-template-row .grow { flex-basis: calc(100% - 55px); }
  .wf-step-card { flex-wrap: wrap; }
  .wf-step-card .grow { flex-basis: calc(100% - 45px); }
  .mg-workflow-controls { grid-template-columns: 1fr; }
}
@media(prefers-reduced-motion:reduce) { .wf-skeleton { animation: none; } }
