#modal.flow-dialog { padding: 0; overflow: hidden; }
.flow-dialog #modal-content { display: flex; flex-direction: column; max-height: 88dvh; }
.flow-dialog .dialog-head { padding: 18px 20px; margin: 0; position: static; flex-shrink: 0; background: #fff; }
.flow-dialog .dialog-head h2 { font-size: 18px; margin: 0; }
.flow-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.flow-nav button { display: flex; align-items: center; justify-content: center; gap: 5px; border: 0; background: transparent; font-size: 12px; padding: 8px 2px; color: var(--muted); }
.flow-nav button span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); flex-shrink: 0; }
.flow-nav .active { color: var(--primary); font-weight: 600; }
.flow-nav .active span { background: var(--primary); color: #fff; border-color: var(--primary); }
#flow-form { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.flow-body { overflow-y: auto; padding: 18px 20px; min-height: 0; overscroll-behavior: contain; }
.flow-body h3 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.flow-body label small, .flow-intro { color: var(--muted); font-size: 12px; }
.flow-intro { line-height: 1.6; margin: 0 0 14px; }
.flow-section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.flow-section-title h3 { font-size: 15px; }
.flow-section-title h3 small { color: var(--muted); font-size: 11px; font-weight: 400; }
.flow-section-title button { padding: 6px 9px; font-size: 12px; white-space: nowrap; }
.flow-step-list { display: grid; gap: 8px; }
.flow-step-list > button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px; background: #fff; }
.flow-step-list > button > span:nth-child(2) { flex: 1; min-width: 0; }
.flow-step-list strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.flow-step-list small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.flow-step-list > button.active { border-color: var(--primary); background: var(--bg); }
.flow-step-number { flex-shrink: 0; width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--primary); }
.flow-body .step-editor { margin: -8px 0 8px; border-top: 0; background: var(--bg); padding: 14px; border-radius: 0 0 16px 16px; }
.flow-body .step-editor legend { font-weight: 600; color: var(--primary); }
.flow-body .step-order button { width: 44px; height: 44px; padding: 8px; }
.flow-upload { position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 16px; border: 1px dashed var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: center; overflow: hidden; }
.flow-upload > span { font-size: 13px; color: var(--primary); }
.flow-upload > input { position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.flow-upload:focus-within { outline: 2px solid var(--primary); }
.flow-upload .editor-image { height: 110px; max-width: 100%; object-fit: contain; margin: 0; }
.flow-preview-list { display: grid; gap: 12px; margin-top: 16px; }
.flow-preview-list .step-card h3 { font-size: 15px; }
.flow-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px max(14px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; flex-shrink: 0; }
#flow-form .form-error { margin: 0; padding: 10px 20px; font-size: 12px; flex-shrink: 0; }
#flow-form .form-error:empty { display: none; }
@media (max-width: 600px) {
  html[data-surface="staff"] #modal.flow-dialog { padding: 0; max-height: 92dvh; }
  .flow-dialog #modal-content { max-height: 92dvh; }
  .flow-nav { padding: 10px 12px; }
  .flow-body { padding: 16px; }
  .flow-body .step-editor { padding: 12px; }
  .flow-footer { padding-left: 16px; padding-right: 16px; }
}

.flow-step-list > button.active { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

#flow-form .flow-body:has(.flow-execution-preview) { display:flex; flex:1; padding:0; overflow:hidden; }
.flow-execution-preview { display:flex; flex:1; min-width:0; min-height:0; }

.flow-edit-tools { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:12px; }
.flow-edit-tools button { display:inline-flex; align-items:center; justify-content:center; gap:4px; min-height:44px; font-size:12px; padding:8px; }
.flow-edit-tools .step-order { display:flex; gap:4px; }
.flow-edit-tools .step-order button { width:44px; padding:6px; }
.flow-dialog .flow-edit-title { margin:0 0 16px; color:#718477; font-size:11px; }
.flow-dialog .flow-edit-title input { font-size:23px; font-weight:700; padding:8px 0; border:0; border-bottom:1px solid #e4eae2; border-radius:0; background:transparent; }
.flow-dialog .flow-edit-guide { margin:16px 0 0; font-size:11px; color:#718477; }
.flow-dialog .flow-edit-guide textarea { font-size:15px; line-height:1.9; background:#f8faf6; border-color:#e4eae2; }
.flow-execution-preview .flow-upload { padding:12px; }
.flow-execution-preview .flow-upload .editor-image { width:100%; height:auto; max-height:170px; margin:0; }

.flow-dialog .flow-edit-title input,.flow-dialog .flow-edit-guide textarea { color:#17382e; }

.flow-execution-preview .flow-upload { margin-top:16px; }

.flow-dialog .flow-execution-preview .execution-steps button,
.flow-dialog .flow-execution-preview .execution-steps button:hover { background:var(--primary); border-color:var(--primary); color:white; }
