
:root{
  --st-bg:#f6f8fb;--st-card:#ffffff;--st-line:#e4e9f1;--st-line-2:#eef2f7;
  --st-text:#0f172a;--st-muted:#64748b;--st-muted-2:#94a3b8;
  --st-blue:#2563eb;--st-blue-deep:#1d4ed8;--st-blue-soft:#eff4ff;--st-blue-line:#c7d7fe;
  --st-ok:#16a34a;--st-ok-soft:#eaf9ef;--st-warn:#b45309;--st-warn-soft:#fef5e7;
  --st-err:#dc2626;--st-err-soft:#fdecec;
  --st-radius:12px;--st-shadow:0 1px 2px rgba(15,23,42,.05),0 4px 14px rgba(15,23,42,.06);
  --st-shadow-sm:0 1px 2px rgba(15,23,42,.06);
}
[data-theme="dark"]{
  --st-bg:#0b1120;--st-card:#101a30;--st-line:#22304d;--st-line-2:#182641;
  --st-text:#f1f5f9;--st-muted:#94a3b8;--st-muted-2:#64748b;
  --st-blue:#60a5fa;--st-blue-deep:#3b82f6;--st-blue-soft:#14294d;--st-blue-line:#2b4a7e;
  --st-ok:#4ade80;--st-ok-soft:#0f2c1c;--st-warn:#fbbf24;--st-warn-soft:#2c230f;
  --st-err:#f87171;--st-err-soft:#2c1215;
  --st-shadow:0 1px 2px rgba(0,0,0,.3),0 4px 14px rgba(0,0,0,.3);
  --st-shadow-sm:0 1px 2px rgba(0,0,0,.3);
}
*{box-sizing:border-box}
html,body{height:100%}
/* No "Inter" in the stack: nothing on this page uses it, and having it as the first
   fallback made Chromium download a 49 KB webfont the moment any glyph was missing
   from the Work Sans latin subset (e.g. the check mark in "Saved"). */
body{margin:0;background:var(--st-bg);color:var(--st-text);font:14px/1.5 "Work Sans","Segoe UI",system-ui,-apple-system,sans-serif;-webkit-font-smoothing:antialiased}
button{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--st-blue);outline-offset:2px;border-radius:6px}
.st-app{display:flex;flex-direction:column;height:100vh;height:100dvh;min-width:1180px}
@media(max-width:1180px){.st-app{min-width:0}.st-body{grid-template-columns:200px minmax(0,1fr)}.st-body.with-panel{grid-template-columns:200px minmax(0,1fr) 300px}}
/* short landscape phones (e.g. 804x360): fill the viewport, no dead band below */
@media(max-height:500px){
  .st-header{height:42px;padding:0 12px}
  .st-work{padding-top:8px !important;padding-bottom:8px !important}
  .st-empty{padding:14px !important;margin:8px 0 !important}
  .st-empty p{margin-bottom:10px !important}
  .st-steps-head{margin-top:8px !important}
}
/* ---------- Header ---------- */
.st-header{display:flex;align-items:center;gap:12px;height:50px;padding:0 16px;background:var(--st-card);border-bottom:1px solid var(--st-line);flex-shrink:0;z-index:60}
.st-brand{display:flex;align-items:center;gap:8px;white-space:nowrap;text-decoration:none;color:inherit}
.st-brand img{width:26px;height:26px;border-radius:6px}
.st-brand b{font-size:17px;font-weight:800;letter-spacing:-.01em}
.st-brand .studio-word{font-size:15px;font-weight:600;color:var(--st-muted)}
.st-beta{font-size:10.5px;font-weight:700;color:var(--st-blue);background:var(--st-blue-soft);border:1px solid var(--st-blue-line);border-radius:100px;padding:1px 8px}
.st-wfname{display:flex;align-items:center;gap:6px;margin-left:14px;padding-left:16px;border-left:1px solid var(--st-line);min-width:0}
.st-wfname .wf-dot{width:8px;height:8px;border-radius:50%;background:var(--st-muted-2);flex-shrink:0}
.st-wfname .wf-dot.ready{background:var(--st-ok)}.st-wfname .wf-dot.running{background:var(--st-blue)}.st-wfname .wf-dot.error{background:var(--st-err)}
#wfNameView{font-weight:700;font-size:14.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:280px}
#wfNameInput{font:inherit;font-weight:700;font-size:14.5px;border:1px solid var(--st-blue);border-radius:8px;padding:3px 8px;width:260px;background:var(--st-card);color:var(--st-text);display:none}
.st-wfname.editing #wfNameView,.st-wfname.editing #wfRenameBtn{display:none}
.st-wfname.editing #wfNameInput{display:block}
.st-icon-btn{display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:8px;border:1px solid transparent;background:transparent;cursor:pointer;color:var(--st-muted)}
.st-icon-btn:hover{background:var(--st-line-2);color:var(--st-text)}
.st-icon-btn:disabled{opacity:.35;cursor:not-allowed;background:transparent}
.st-icon-btn svg{width:17px;height:17px}
.st-header-spacer{flex:1}
.st-btn{display:inline-flex;align-items:center;gap:7px;border-radius:9px;padding:7px 12px;font-weight:600;font-size:13px;cursor:pointer;border:1px solid var(--st-line);background:var(--st-card);color:var(--st-text);white-space:nowrap}
.st-btn:hover{border-color:var(--st-muted-2)}
.st-btn:disabled{opacity:.45;cursor:not-allowed}
.st-btn svg{width:16px;height:16px}
.st-btn-secondary{background:var(--st-card)}
.st-btn-primary{background:var(--st-blue);border-color:var(--st-blue);color:#fff;box-shadow:0 4px 14px rgba(37,99,235,.35)}
.st-btn-primary:hover{background:var(--st-blue-deep);border-color:var(--st-blue-deep)}
.st-more-wrap{position:relative}
.st-menu{position:absolute;right:0;top:calc(100% + 6px);min-width:220px;background:var(--st-card);border:1px solid var(--st-line);border-radius:12px;box-shadow:var(--st-shadow);padding:6px;display:none;z-index:200}
.st-menu.open{display:block}
.st-menu button{display:flex;align-items:center;gap:9px;width:100%;text-align:left;border:none;background:none;padding:9px 10px;border-radius:8px;font-size:13.5px;cursor:pointer;color:var(--st-text)}
.st-menu button:hover:not(:disabled){background:var(--st-line-2)}
.st-menu button:disabled{opacity:.4;cursor:not-allowed}
.st-menu button.danger{color:var(--st-err)}
.st-menu .menu-sep{height:1px;background:var(--st-line);margin:5px 4px}
.st-menu kbd{margin-left:auto;font-size:11px;color:var(--st-muted);background:var(--st-line-2);border-radius:5px;padding:1px 6px;font-family:inherit}
/* ---------- Body grid ---------- */
.st-body{flex:1;display:grid;grid-template-columns:250px minmax(0,1fr);min-height:0}
.st-body.with-panel{grid-template-columns:250px minmax(0,1fr) 348px}
@media(max-width:1400px){.st-body{grid-template-columns:224px minmax(0,1fr)}.st-body.with-panel{grid-template-columns:224px minmax(0,1fr) 318px}}
/* ---------- Sidebar ---------- */
.st-side{background:var(--st-card);border-right:1px solid var(--st-line);overflow-y:auto;padding:10px 8px 16px;display:flex;flex-direction:column;gap:2px}
.st-nav{display:flex;flex-direction:column;gap:1px;margin-bottom:8px}
.st-nav button{display:flex;align-items:center;gap:9px;border:none;background:none;border-radius:8px;padding:6px 10px;font-size:13px;font-weight:500;cursor:pointer;color:var(--st-muted);text-align:left;width:100%}
.st-nav button svg{width:16px;height:16px;flex-shrink:0}
.st-nav button:hover{background:var(--st-line-2);color:var(--st-text)}
.st-nav button.active{background:var(--st-blue-soft);color:var(--st-blue);font-weight:700}
/* --st-muted-2 (#94a3b8) is 2.6:1 on the white sidebar - below the 4.5:1 AA
   minimum. --st-muted is 4.8:1 light / 6.8:1 dark and matches .st-tool-cat. */
.st-side-label{font-size:10.5px;font-weight:700;letter-spacing:.08em;color:var(--st-muted);padding:8px 10px 4px}
.st-search{position:relative;margin:0 2px 4px}
.st-search svg{position:absolute;left:10px;top:50%;transform:translateY(-50%);width:14px;height:14px;color:var(--st-muted-2)}
.st-search input{width:100%;border:1px solid var(--st-line);border-radius:8px;background:var(--st-bg);color:var(--st-text);padding:7px 10px 7px 30px;font-size:12.5px}
.st-search input::placeholder{color:var(--st-muted-2)}
#toolList{display:flex;flex-direction:column;gap:1px}
.st-tool-cat{font-size:12px;font-weight:600;color:var(--st-muted);padding:8px 10px 2px}
.st-tool{display:flex;align-items:center;gap:8px;width:100%;border:none;background:none;border-radius:7px;padding:4px 10px;cursor:grab;font-size:12.5px;color:var(--st-text);text-align:left}
.st-tool:hover{background:var(--st-line-2)}
.st-tool:active{cursor:grabbing}
.st-tool .t-ic{width:22px;height:22px;border-radius:6px;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;color:#fff}
.st-tool .t-ic svg{width:12px;height:12px}
.st-tool .t-name{min-width:0;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.st-tool small{display:block;font-size:11px;color:var(--st-muted);font-weight:400;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.st-tool .t-add{margin-left:auto;opacity:0;color:var(--st-blue);font-size:18px;line-height:1;font-weight:700}
.st-tool:hover .t-add,.st-tool:focus-visible .t-add{opacity:1}
.st-no-tools{padding:14px 12px;color:var(--st-muted);font-size:13px;text-align:center}
.st-side-foot{margin-top:auto;padding:12px 10px 0;font-size:11.5px;color:var(--st-muted-2);border-top:1px solid var(--st-line-2)}
/* ---------- Workspace ---------- */
.st-work{overflow-y:auto;padding:5px 26px 20px;min-width:0}
.st-work-inner{max-width:860px;margin:0 auto}
.st-wf-head h1{font-size:17px;margin:0;display:flex;align-items:center;gap:8px;letter-spacing:-.01em}
.st-wf-head h1 .st-icon-btn{width:24px;height:24px}
.st-wf-head p{margin:0;flex:1;min-width:0;color:var(--st-muted);font-size:12.5px}
.st-subrow{display:flex;align-items:center;gap:12px;margin-top:2px}
.st-subrow .st-chips{margin-top:0;flex-shrink:0}
.st-chips{display:flex;gap:8px;margin-top:10px;flex-wrap:wrap}
.st-chips-right{margin-top:0;justify-content:flex-end}
.st-chips-top{margin:0 0 4px;justify-content:flex-end}
.st-chips-title{margin:0 0 0 auto;justify-content:flex-end}
.st-chip{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;font-weight:600;color:var(--st-muted);background:var(--st-card);border:1px solid var(--st-line);border-radius:100px;padding:3px 10px}
.st-chip svg{width:13px;height:13px}
.st-chip.ok{color:var(--st-ok);border-color:currentColor}
.st-chip.warn{color:var(--st-warn);border-color:currentColor}
.st-chip.err{color:var(--st-err);border-color:currentColor}
.st-card{background:var(--st-card);border:1px solid var(--st-line);border-radius:var(--st-radius);box-shadow:var(--st-shadow-sm)}
.st-sec-title{font-size:13px;font-weight:700;letter-spacing:.02em;display:flex;align-items:center;gap:8px}
.st-sec-title .count-pill{font-size:11px;font-weight:700;background:var(--st-blue-soft);color:var(--st-blue);border-radius:100px;padding:1px 9px}
/* Input files */
.st-input-grid{display:grid;grid-template-columns:minmax(0,0.75fr) minmax(0,1.25fr);gap:14px;margin-top:7px;align-items:stretch}
.st-drop{border:1.5px dashed var(--st-blue-line);border-radius:var(--st-radius);background:linear-gradient(180deg,var(--st-blue-soft),transparent 130%);padding:12px 14px;text-align:center;cursor:pointer;transition:border-color .15s,background .15s;height:196px;display:flex;flex-direction:column;justify-content:center;min-height:0}
.st-drop:hover,.st-drop.drag{border-color:var(--st-blue);background:var(--st-blue-soft)}
.st-drop:focus-visible{outline:2px solid var(--st-blue);outline-offset:2px}
.st-drop .dz-ic{width:44px;height:44px;border-radius:12px;background:var(--st-card);border:1px solid var(--st-line);display:inline-flex;align-items:center;justify-content:center;box-shadow:var(--st-shadow-sm);position:relative;margin:0 auto 8px}
.st-drop .dz-ic svg{width:22px;height:22px;color:var(--st-muted)}
.st-drop .dz-plus{position:absolute;right:-7px;bottom:-7px;width:20px;height:20px;border-radius:50%;background:var(--st-blue);color:#fff;font-size:14px;font-weight:700;line-height:20px}
.st-drop p{margin:0 0 10px;font-weight:600;font-size:13px}
.st-choose-row{display:flex;justify-content:center}
.st-choose{display:inline-flex;border-radius:10px;overflow:hidden;box-shadow:0 4px 14px rgba(37,99,235,.3)}
.st-choose .main{background:var(--st-blue);color:#fff;border:none;font-weight:700;font-size:13px;padding:9px 14px;cursor:pointer;display:inline-flex;align-items:center;gap:8px}
.st-choose .main:hover{background:var(--st-blue-deep)}
.st-choose .caret{background:var(--st-blue-deep);color:#fff;border:none;border-left:1px solid rgba(255,255,255,.3);padding:9px 10px;cursor:pointer;font-size:12px}
.st-dz-note{margin:8px 0 0;font-size:11px;color:var(--st-muted);line-height:1.45}
.st-cloud-menu{position:absolute;background:var(--st-card);border:1px solid var(--st-line);border-radius:10px;box-shadow:var(--st-shadow);padding:5px;min-width:190px;z-index:120;display:none}
.st-cloud-menu.open{display:block}
.st-cloud-menu button{display:flex;gap:9px;align-items:center;width:100%;border:none;background:none;padding:9px 10px;border-radius:8px;cursor:pointer;font-size:13px;color:var(--st-text)}
.st-cloud-menu button:hover{background:var(--st-line-2)}
.st-input-right{display:flex;flex-direction:column;gap:8px;min-width:0}
.st-files{padding:10px 12px;display:flex;flex-direction:column;gap:6px;min-height:0;height:196px}
.st-files-head{display:flex;align-items:center;justify-content:space-between}
.st-files-head b{font-size:12.5px}
.st-link-btn{border:none;background:none;color:var(--st-muted);font-size:12px;font-weight:600;cursor:pointer;border-radius:6px;padding:2px 6px}
.st-link-btn:hover{color:var(--st-err);background:var(--st-err-soft)}
.st-file{display:flex;align-items:center;gap:8px;border:1px solid var(--st-line);border-radius:9px;padding:3px 8px;background:var(--st-card);flex-shrink:0}
.st-file:hover{border-color:var(--st-muted-2)}
.st-file .f-ic{width:26px;height:26px;border-radius:7px;background:#fee2e2;color:#dc2626;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;font-size:9px;font-weight:800}
[data-theme="dark"] .st-file .f-ic{background:#3a1414;color:#f87171}
.st-file .f-ic svg{width:13px;height:13px}
.st-file .f-meta{min-width:0;flex:1;line-height:1.2}
.st-file .f-name{font-weight:600;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.st-file .f-sub{font-size:10.5px;color:var(--st-muted)}
.st-file .grip{color:var(--st-muted-2);cursor:grab;letter-spacing:2px;font-size:12px;user-select:none}
.st-files-empty{color:var(--st-muted-2);font-size:12.5px;text-align:center;padding:18px 6px;border:1px dashed var(--st-line);border-radius:10px}
#fileList{display:flex;flex-direction:column;gap:6px;flex:1;min-height:0;overflow-y:auto;scrollbar-width:thin;padding-right:2px}
#fileList::-webkit-scrollbar{width:8px!important;height:8px!important;display:block!important}
#fileList::-webkit-scrollbar-thumb{background:var(--st-line-h,#cbd5e1);border-radius:4px}
#fileList::-webkit-scrollbar-track{background:transparent}
/* Merge step file list: scrollable, thin bar like the main file list */
.st-mfiles{border:1px solid var(--st-line);border-radius:10px;padding:8px;display:flex;flex-direction:column;gap:4px;max-height:178px;overflow-y:auto;scrollbar-width:thin!important}
.st-mfiles::-webkit-scrollbar{width:8px!important;height:8px!important;display:block!important}
.st-mfiles::-webkit-scrollbar-thumb{background:var(--st-line-h,#cbd5e1);border-radius:4px}
.st-mfiles::-webkit-scrollbar-track{background:transparent}
.st-mf-row{display:flex;align-items:center;gap:8px;padding:5px 6px;border-radius:8px}
.st-mf-row:hover{background:var(--st-line-2)}
.st-mf-pos{width:18px;height:18px;border-radius:50%;background:var(--st-blue-soft);color:var(--st-blue);font-size:10.5px;font-weight:800;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
.st-mf-row input[type="checkbox"]{width:15px;height:15px;accent-color:var(--st-blue);flex-shrink:0;margin:0;cursor:pointer}
.st-mf-ic{width:26px;height:26px;border-radius:7px;background:#fee2e2;color:#dc2626;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
.st-mf-ic svg{width:13px;height:13px}
.st-mf-name{font-weight:600;font-size:12.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}
.st-mf-sub{font-size:11px;color:var(--st-muted)}
.st-mf-main{flex:1;min-width:0;line-height:1.3}
.st-mf-range{width:58px;flex-shrink:0;border:1px solid var(--st-line);border-radius:7px;padding:4px 6px;font-size:11.5px;background:var(--st-card);color:var(--st-text)}
.st-mf-range::placeholder{color:var(--st-muted-2)}
.st-mf-range.st-mf-bad{border-color:var(--st-err);box-shadow:0 0 0 2px rgba(220,38,38,.15)}
.st-mf-mv{display:flex;gap:2px;flex-shrink:0}
.st-mf-mv button{width:22px;height:22px;border-radius:6px;border:1px solid var(--st-line);background:var(--st-card);color:var(--st-muted);font-size:11px;line-height:1;cursor:pointer;padding:0}
.st-mf-mv button:hover:not(:disabled){color:var(--st-blue);border-color:var(--st-blue)}
.st-mf-mv button:disabled{opacity:.3;cursor:not-allowed}
.st-mplan{border:1px solid var(--st-line);border-radius:10px;padding:10px 12px;font-size:12.5px}
.st-mplan ol{margin:6px 0;padding-left:20px;line-height:1.8}
.st-mplan .tot{border-top:1px solid var(--st-line);margin-top:8px;padding-top:8px;color:var(--st-muted);font-size:12px}
/* Studio scrollbars hidden everywhere except the file list (scrolling still works) */
.st-app ::-webkit-scrollbar,.stv-overlay ::-webkit-scrollbar,.st-overlay ::-webkit-scrollbar{width:0!important;height:0!important;display:none!important}
.st-app *,.stv-overlay *,.st-overlay *{scrollbar-width:none!important}
#fileList{scrollbar-width:thin!important}
.st-summary{font-size:12.5px;color:var(--st-muted);text-align:center}
/* Steps */
.st-steps-head{display:flex;align-items:flex-start;gap:12px;margin:18px 0 4px}
.st-steps-head h2{font-size:15.5px;margin:0}
.st-steps-head p{margin:3px 0 0;color:var(--st-muted);font-size:12.5px}
.st-steps-head .head-actions{margin-left:auto;display:flex;gap:8px;flex-shrink:0}
.st-steps-head .st-btn{padding:5px 10px;font-size:12.5px}
.st-steps-head .st-btn svg{width:14px;height:14px}
.st-steps{display:flex;flex-direction:column;margin-top:12px}
.st-step{position:relative}
.st-step-card{display:flex;align-items:center;gap:10px;background:var(--st-card);border:1.5px solid var(--st-line);border-radius:var(--st-radius);padding:7px 12px;box-shadow:var(--st-shadow-sm);cursor:pointer;transition:border-color .15s}
.st-step-card:hover{border-color:var(--st-muted-2)}
.st-step.selected .st-step-card{border-color:var(--st-blue);box-shadow:0 0 0 3px rgba(37,99,235,.15)}
.st-step.disabled .st-step-card{opacity:.62;background:var(--st-line-2)}
.st-step .num{width:28px;height:28px;border-radius:50%;background:var(--st-blue-soft);color:var(--st-blue);font-weight:800;font-size:12.5px;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
.st-step.disabled .num{background:var(--st-line);color:var(--st-muted)}
.st-step .s-ic{width:34px;height:34px;border-radius:10px;display:inline-flex;align-items:center;justify-content:center;color:#fff;flex-shrink:0}
.st-step .s-ic svg{width:16px;height:16px}
.st-step .s-mid{min-width:0;flex:1;display:flex;flex-direction:column;gap:1px;line-height:1.25}
.st-step .s-name{font-weight:700;font-size:13.5px;display:flex;align-items:center;gap:8px}
.st-step .s-desc{display:block;font-size:12px;color:var(--st-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.st-step .s-sum{font-size:12px;color:var(--st-muted);white-space:nowrap;flex-shrink:0;max-width:260px;overflow:hidden;text-overflow:ellipsis}
.st-step .s-flag{font-size:10.5px;font-weight:700;color:var(--st-warn);border:1px solid currentColor;border-radius:100px;padding:1px 8px;flex-shrink:0}
.st-step .s-flag.bad{color:var(--st-err)}
.st-conn{display:flex;justify-content:center;height:18px;color:var(--st-muted-2);font-size:13px;line-height:18px;user-select:none}
.st-step.dragging .st-step-card{opacity:.5;border-style:dashed}
.st-step.drop-before .st-step-card{box-shadow:0 -3px 0 var(--st-blue)}
.st-step-actions{display:flex;gap:2px;flex-shrink:0}
.st-drop-end{margin-top:10px;border:1.5px dashed var(--st-blue-line);border-radius:var(--st-radius);background:transparent;padding:20px 16px;text-align:center;cursor:pointer;transition:border-color .15s,background .15s}
.st-drop-end:hover{background:var(--st-blue-soft)}
.st-drop-end b{display:block;font-size:13.5px;color:var(--st-blue);font-weight:700}
.st-drop-end small{display:block;font-size:12px;color:var(--st-muted);margin-top:3px}
.st-drop-end.drag{border-color:var(--st-blue);background:var(--st-blue-soft);box-shadow:0 0 0 3px rgba(37,99,235,.15)}
.st-drop-end:focus-visible{outline:2px solid var(--st-blue);outline-offset:2px}
.st-empty{border:1.5px dashed var(--st-line);border-radius:var(--st-radius);background:var(--st-card);text-align:center;padding:38px 20px;margin-top:12px}
.st-empty h3{margin:0 0 6px;font-size:16px}
.st-empty p{margin:0 0 16px;color:var(--st-muted);font-size:13.5px}
/* validation strip */
.st-valid{display:none;margin-top:14px;border-radius:var(--st-radius);padding:12px 14px;font-size:13px;border:1px solid}
.st-valid.show{display:block}
.st-valid.err{background:var(--st-err-soft);border-color:var(--st-err);color:var(--st-text)}
.st-valid.warn{background:var(--st-warn-soft);border-color:var(--st-warn);color:var(--st-text)}
.st-valid.ok{background:var(--st-ok-soft);border-color:var(--st-ok);color:var(--st-text)}
.st-valid ul{margin:6px 0 0;padding-left:18px}
.st-valid li{margin:2px 0}
/* ---------- Right panel ---------- */
.st-panel{background:var(--st-card);border-left:1px solid var(--st-line);overflow-y:auto;padding:18px 18px 30px;display:none;min-height:0}
.st-body.with-panel .st-panel{display:block}
.st-panel-head{display:flex;align-items:flex-start;gap:12px}
.st-panel-head .p-ic{width:46px;height:46px;border-radius:13px;display:inline-flex;align-items:center;justify-content:center;color:#fff;flex-shrink:0}
.st-panel-head .p-ic svg{width:22px;height:22px}
.st-panel-head h2{margin:0;font-size:17px}
.st-panel-head p{margin:2px 0 0;font-size:12.5px;color:var(--st-muted)}
.st-tabs{display:flex;gap:26px;border-bottom:1px solid var(--st-line);margin:16px 0;padding:0}
.st-tabs button{border:none;background:none;border-radius:0;padding:10px 2px;font-weight:600;font-size:13.5px;cursor:pointer;color:var(--st-muted);border-bottom:2px solid transparent;margin-bottom:-1px}
.st-tabs button.active{background:none;color:var(--st-blue);box-shadow:none;border-bottom-color:var(--st-blue)}
.st-field{margin-bottom:16px}
.st-field>label,.st-flabel{font-size:13px;font-weight:700;display:block;margin-bottom:8px}
.st-opt-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.st-opt-grid.cols3{grid-template-columns:1fr 1fr 1fr}
/* half-half paired fields in one row (e.g. gap + direction) */
.st-duo{display:flex;gap:8px}
.st-duo>.st-field{flex:1;min-width:0}
.st-duo .st-select,.st-duo .st-text-in{min-width:0}
/* compact one-per-line option list (e.g. split modes) */
.st-mode-list{display:flex;flex-direction:column;gap:6px}
.st-mode-row{display:flex;align-items:center;gap:9px;border:1.5px solid var(--st-line);border-radius:9px;padding:7px 10px;cursor:pointer;background:var(--st-card);text-align:left;width:100%;font-size:13px;font-weight:600;color:var(--st-text)}
.st-mode-row:hover{border-color:var(--st-muted-2)}
.st-mode-row.sel{border-color:var(--st-blue);background:var(--st-blue-soft)}
.st-mode-row .radio{width:14px;height:14px;border-radius:50%;border:2px solid var(--st-muted-2);display:inline-block;flex-shrink:0}
.st-mode-row.sel .radio{border-color:var(--st-blue);background:var(--st-blue);box-shadow:inset 0 0 0 2.5px #fff}
.st-mode-row small{font-size:11px;color:var(--st-muted);margin-left:auto;white-space:nowrap}
.st-opt{border:1.5px solid var(--st-line);border-radius:10px;padding:9px 10px;cursor:pointer;background:var(--st-card);text-align:left}
.st-opt:hover{border-color:var(--st-muted-2)}
.st-opt.sel{border-color:var(--st-blue);background:var(--st-blue-soft)}
.st-opt b{font-size:13px;display:flex;align-items:center;gap:7px}
.st-opt small{display:block;font-size:11px;color:var(--st-muted);margin-top:2px}
.st-opt .radio{width:14px;height:14px;border-radius:50%;border:2px solid var(--st-muted-2);display:inline-block;flex-shrink:0}
.st-opt.sel .radio{border-color:var(--st-blue);background:var(--st-blue);box-shadow:inset 0 0 0 2.5px #fff}
.st-range-row{display:flex;align-items:center;gap:10px}
.st-range-row input[type=range]{flex:1;accent-color:var(--st-blue)}
.st-range-row output{font-weight:700;font-size:13px;min-width:46px;text-align:right}
.st-select,.st-text-in{width:100%;border:1px solid var(--st-line);border-radius:9px;padding:9px 11px;font-size:13.5px;background:var(--st-card);color:var(--st-text)}
.st-check{display:flex;align-items:flex-start;gap:9px;font-size:13px;padding:7px 0;cursor:pointer}
.st-check input{width:16px;height:16px;accent-color:var(--st-blue);margin-top:2px;flex-shrink:0}
.st-acc{border-top:1px solid var(--st-line);margin-top:6px}
.st-acc>button{width:100%;display:flex;justify-content:space-between;align-items:center;border:none;background:none;font-weight:700;font-size:13.5px;padding:12px 2px;cursor:pointer;color:var(--st-text)}
.st-acc-body{display:none;padding-bottom:10px}
.st-acc.open .st-acc-body{display:block}
.st-acc .chev{transition:transform .15s;color:var(--st-muted)}
.st-acc.open .chev{transform:rotate(180deg)}
.st-info{background:var(--st-blue-soft);border-radius:10px;padding:11px 12px;font-size:12.5px;color:var(--st-text);display:flex;gap:9px;margin:6px 0 14px}
.st-info svg{flex-shrink:0;width:16px;height:16px;color:var(--st-blue);margin-top:1px}
.st-apply{width:100%;background:var(--st-blue);color:#fff;border:none;border-radius:10px;font-weight:700;font-size:14px;padding:12px;cursor:pointer;margin-top:6px}
.st-apply:hover{background:var(--st-blue-deep)}
.st-apply:disabled{opacity:.5;cursor:not-allowed}
.st-filesel{border:1px solid var(--st-line);border-radius:10px;padding:10px 12px;margin-bottom:16px}
.st-filesel .fs-head{font-size:12px;font-weight:700;color:var(--st-muted);margin-bottom:6px;display:flex;justify-content:space-between}
.st-filesel label{display:flex;align-items:center;gap:9px;font-size:13px;padding:5px 0;cursor:pointer}
.st-filesel input{accent-color:var(--st-blue);width:15px;height:15px}
.st-filesel .fsub{font-size:11px;color:var(--st-muted-2);margin-left:auto}
.st-editor-ph{border:1.5px dashed var(--st-line);border-radius:10px;padding:30px 16px;text-align:center;color:var(--st-muted);font-size:13px}
.st-editor-ph svg{width:34px;height:34px;color:var(--st-muted-2);margin-bottom:8px}
/* ---------- Tool picker modal ---------- */
.st-overlay{position:fixed;inset:0;background:rgba(2,6,23,.55);display:none;align-items:flex-start;justify-content:center;padding:9vh 18px 18px;z-index:500}
.st-overlay.open{display:flex}
.st-dialog{background:var(--st-card);border-radius:16px;width:100%;max-width:620px;max-height:76vh;display:flex;flex-direction:column;box-shadow:0 24px 64px rgba(0,0,0,.3);overflow:hidden}
.st-dialog-head{padding:16px 18px 10px;border-bottom:1px solid var(--st-line-2)}
.st-dialog-head h2{margin:0;font-size:16px}
.st-dialog-head p{margin:3px 0 10px;font-size:13px;color:var(--st-muted)}
.st-dialog-body{overflow-y:auto;padding:10px 14px 18px}
.st-pick{display:flex;align-items:center;gap:11px;width:100%;text-align:left;border:1px solid transparent;background:none;border-radius:11px;padding:9px 10px;cursor:pointer}
.st-pick:hover{background:var(--st-line-2);border-color:var(--st-line)}
.st-pick .t-ic{width:34px;height:34px;border-radius:10px;display:inline-flex;align-items:center;justify-content:center;color:#fff;flex-shrink:0}
.st-pick .t-ic svg{width:17px;height:17px}
.st-pick b{font-size:13.5px;display:block}
.st-pick small{font-size:12px;color:var(--st-muted)}
.st-pick .go{margin-left:auto;color:var(--st-blue);font-weight:800;font-size:16px}
.st-pick:disabled{opacity:.55;cursor:default}
.st-pick:disabled:hover{background:none;border-color:transparent}
.st-pick:disabled .go{color:var(--st-ok)}
.st-confirm{max-width:440px;padding:22px}
.st-confirm h2{margin:0 0 8px;font-size:16px}
.st-confirm p{margin:0 0 18px;font-size:13.5px;color:var(--st-muted)}
.st-confirm .row{display:flex;gap:10px;justify-content:flex-end}
.st-btn-danger{background:var(--st-err);border-color:var(--st-err);color:#fff}
.st-btn-danger:hover{filter:brightness(.92)}
/* run checklist */
.st-run-list{list-style:none;margin:12px 0;padding:0;display:flex;flex-direction:column;gap:8px}
/* Run dialog: body scrolls, footer buttons stay pinned at the bottom */
#runBox{display:flex;flex-direction:column;overflow-y:auto;min-height:0;max-height:100%}
#runBox>.row:last-child{position:sticky;bottom:-22px;background:var(--st-card);padding:12px 0 2px;border-top:1px solid var(--st-line-2);margin-top:12px}
.st-run-list li{display:flex;gap:10px;align-items:flex-start;font-size:13.5px;border:1px solid var(--st-line);border-radius:10px;padding:10px 12px}
.st-run-list .rk{width:22px;height:22px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:800;flex-shrink:0}
.st-run-list .rk.ok{background:var(--st-ok-soft);color:var(--st-ok)}
.st-run-list .rk.bad{background:var(--st-err-soft);color:var(--st-err)}
.st-run-list .rk.skip{background:var(--st-warn-soft);color:var(--st-warn)}
.st-run-sim{background:var(--st-warn-soft);border:1px solid var(--st-warn);border-radius:10px;padding:11px 12px;font-size:12.5px;margin-top:4px}
/* run states on step cards (Phase 2 execution; layout untouched) */
@keyframes stblink{50%{opacity:.45}}
.st-step.is-running .num{background:var(--st-blue);color:#fff;animation:stblink 1s infinite}
.st-step.is-done .num{background:var(--st-ok-soft);color:var(--st-ok)}
.st-step.is-failed .st-step-card{border-color:var(--st-err)}
.st-step.is-failed .num{background:var(--st-err);color:#fff}
.st-step.is-skipped .st-step-card{opacity:.55}
.st-run-list .rk.run{background:var(--st-blue-soft);color:var(--st-blue);animation:stblink 1s infinite}
.st-run-list .rk.idle{background:var(--st-line-2);color:var(--st-muted)}
.st-run-list small{color:var(--st-muted);font-size:12px}
.st-run-err{background:var(--st-err-soft);border:1px solid var(--st-err);border-radius:10px;padding:11px 12px;font-size:12.5px;margin-top:4px}
/* ---------- Phase 4: advanced rows + history (same tokens) ---------- */
.st-condrow{display:flex;gap:6px}
.st-condrow .st-select{flex:1.4;min-width:0;padding:8px 6px;font-size:12.5px}
.st-condrow .st-text-in{flex:1;min-width:0}
.st-adv-note{font-size:12px;color:var(--st-blue);background:var(--st-blue-soft);border-radius:8px;padding:6px 10px;margin:0 0 12px}
.st-hist-row{display:flex;align-items:center;gap:10px;width:100%;text-align:left;border:1px solid var(--st-line);background:none;border-radius:11px;padding:10px 12px;cursor:pointer;font-size:13px;color:var(--st-text)}
.st-hist-row:hover{border-color:var(--st-muted-2)}
.st-hist-ic{width:30px;height:30px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:14px;font-weight:800;flex-shrink:0}
.st-hist-ic.ok{background:var(--st-ok-soft);color:var(--st-ok)}
.st-hist-ic.bad{background:var(--st-err-soft);color:var(--st-err)}
.st-hist-ic.mid{background:var(--st-warn-soft);color:var(--st-warn)}
.st-hist-meta{min-width:0;flex:1}
.st-hist-meta b{display:block;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.st-hist-meta small{color:var(--st-muted);font-size:11.5px}
.st-hist-sec{font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--st-muted);margin:14px 0 8px}
/* ---------- Phase 3 visual editor (same tokens, no redesign) ---------- */
.stv-overlay{position:fixed;top:50px;left:0;right:0;bottom:0;z-index:400;background:var(--st-bg);display:flex;flex-direction:column}
.stv-bar{display:flex;align-items:center;gap:8px;height:50px;padding:0 14px;background:var(--st-card);border-bottom:1px solid var(--st-line);flex-shrink:0}
.stv-title{display:flex;align-items:center;gap:8px;font-size:14px;min-width:0}
.stv-title b{white-space:nowrap}
.stv-title small{color:var(--st-muted);font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:220px}
.stv-dot{width:10px;height:10px;border-radius:3px;flex-shrink:0}
.stv-tools{display:flex;align-items:center;gap:4px;margin-left:8px;flex-wrap:nowrap;overflow-x:auto}
.stv-sep{width:1px;height:20px;background:var(--st-line);margin:0 4px;flex-shrink:0}
.stv-btn{display:inline-flex;align-items:center;justify-content:center;min-width:30px;height:30px;padding:0 8px;border-radius:8px;border:1px solid transparent;background:transparent;cursor:pointer;color:var(--st-muted);font-size:13px;font-weight:600;white-space:nowrap}
.stv-btn:hover:not(:disabled){background:var(--st-line-2);color:var(--st-text)}
.stv-btn:disabled{opacity:.35;cursor:not-allowed}
.stv-btn.on{background:var(--st-blue-soft);color:var(--st-blue);border-color:var(--st-blue-line)}
.stv-btn.stv-pulse{box-shadow:0 0 0 2px var(--st-blue);color:var(--st-blue);animation:stblink 1.2s infinite}
.stv-view{display:flex;align-items:center;gap:4px;margin-left:auto;flex-shrink:0}
.stv-pg{font-size:12.5px;color:var(--st-muted);min-width:64px;text-align:center;white-space:nowrap}
.stv-apply{background:var(--st-blue);color:#fff;border:none;border-radius:9px;font-weight:700;font-size:13px;padding:8px 16px;cursor:pointer;margin-left:8px;flex-shrink:0;box-shadow:0 4px 14px rgba(37,99,235,.3)}
.stv-apply:hover{background:var(--st-blue-deep)}
.stv-hint{font-size:12px;color:var(--st-muted);padding:6px 16px 0;flex-shrink:0}
.stv-main{flex:1;display:flex;gap:12px;padding:10px 16px;min-height:0}
.stv-files{width:200px;flex-shrink:0;background:var(--st-card);border:1px solid var(--st-line);border-radius:12px;padding:10px;display:flex;flex-direction:column;min-height:0}
.stv-files-head{font-weight:700;font-size:13px;color:var(--st-text);margin-bottom:8px;padding-bottom:8px;border-bottom:1px solid var(--st-line)}
.stv-files-list{flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:6px}
.stv-file-item{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:8px;cursor:pointer;background:transparent;transition:background .15s}
.stv-file-item:hover{background:var(--st-line-2)}
.stv-file-item.sel{background:var(--st-blue-soft);border:1px solid var(--st-blue-line)}
.stv-file-ic{width:28px;height:28px;border-radius:6px;background:var(--st-blue-soft);color:var(--st-blue);display:flex;align-items:center;justify-content:center;flex-shrink:0}
.stv-file-ic svg{width:14px;height:14px}
.stv-file-meta{flex:1;min-width:0}
.stv-file-name{font-size:12.5px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.stv-file-sub{font-size:11px;color:var(--st-muted)}
.stv-thumbs{width:196px;flex-shrink:0;overflow-y:auto;background:var(--st-card);border:1px solid var(--st-line);border-radius:12px;padding:10px;display:flex;flex-direction:column;gap:8px}
.stv-thumb{border:1.5px solid var(--st-line);border-radius:10px;padding:6px;cursor:pointer;background:var(--st-card)}
.stv-thumb:hover{border-color:var(--st-muted-2)}
.stv-thumb.sel{border-color:var(--st-blue);box-shadow:0 0 0 2px rgba(37,99,235,.18)}
.stv-thumb.active{border-color:var(--st-blue-deep)}
.stv-thumb.dragging{opacity:.5}
.stv-thumb.drop-before{box-shadow:0 -3px 0 var(--st-blue)}
.stv-thumb:focus-visible{outline:2px solid var(--st-blue);outline-offset:1px}
.stv-timg{background:var(--st-line-2);border-radius:6px;min-height:120px;display:flex;align-items:center;justify-content:center;overflow:hidden}
.stv-timg canvas{max-width:100%;height:auto;display:block}
.stv-tload{color:var(--st-muted-2);font-size:16px}
.stv-tmeta{display:flex;align-items:center;gap:6px;margin-top:5px;font-size:12px}
.stv-tmeta input{width:14px;height:14px;accent-color:var(--st-blue)}
.stv-tnum{font-weight:700}
.stv-tbadge{font-size:10px;font-weight:700;color:var(--st-blue);background:var(--st-blue-soft);border-radius:100px;padding:0 6px}
.stv-viewer{flex:1;min-width:0;overflow:auto;background:var(--st-card);border:1px solid var(--st-line);border-radius:12px;position:relative;display:flex;align-items:flex-start;justify-content:center;padding:16px}
.stv-viewer canvas{box-shadow:0 4px 18px rgba(15,23,42,.18);border-radius:4px;background:#fff;position:relative}
.stv-status{color:var(--st-muted);font-size:13px;margin:auto}
.stv-fatal{text-align:center;color:var(--st-text);font-size:13.5px;margin:auto}
.stv-fatal span{color:var(--st-muted);font-size:12.5px}
.stv-crop{position:absolute;border:2px solid var(--st-blue);background:rgba(37,99,235,.08);cursor:move;z-index:5;box-sizing:border-box}
.stv-h{position:absolute;width:12px;height:12px;background:#fff;border:2px solid var(--st-blue);border-radius:3px}
.stv-h[data-h="nw"]{left:-7px;top:-7px;cursor:nwse-resize}
.stv-h[data-h="ne"]{right:-7px;top:-7px;cursor:nesw-resize}
.stv-h[data-h="sw"]{left:-7px;bottom:-7px;cursor:nesw-resize}
.stv-h[data-h="se"]{right:-7px;bottom:-7px;cursor:nwse-resize}
.stv-foot{display:flex;align-items:center;gap:12px;height:34px;padding:0 16px;font-size:12px;color:var(--st-muted);border-top:1px solid var(--st-line);background:var(--st-card);flex-shrink:0}
.stv-foot #stvMsg{margin-left:auto}
.st-run-prog{height:8px;border-radius:100px;background:var(--st-line-2);overflow:hidden;margin-top:12px}
.st-run-prog i{display:block;height:100%;width:0;background:var(--st-blue);border-radius:100px;transition:width .3s}
/* toast */
#stToastWrap{position:fixed;left:50%;bottom:58px;transform:translateX(-50%);z-index:900;display:flex;flex-direction:column;gap:8px;align-items:center;pointer-events:none}
#stToastWrap div{background:#0f172a;color:#fff;font-size:13px;padding:10px 18px;border-radius:100px;box-shadow:0 8px 24px rgba(0,0,0,.3);max-width:88vw;text-align:center}
[data-theme="dark"] #stToastWrap div{background:#e2e8f0;color:#0f172a}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}
/* ---------- Phones (<=740px) ----------
   The desktop layout left the workspace with 166px after the 224px sidebar, so the
   dropzone was 38px wide and its note rendered one character per line - that was
   also the LCP element PSI reported at 16px wide. One column, a compact sidebar
   strip and an icon-only header keep everything readable and reachable.
   Scoped with min-height:501px so the short-landscape rule above still wins. */
@media(max-width:740px) and (min-height:501px){
  .st-app{min-width:0}
  .st-header{flex-wrap:wrap;height:auto;min-height:50px;padding:6px 10px;gap:8px;row-gap:6px}
  .st-brand .studio-word,.st-brand .st-beta{display:none}
  /* icon-only action buttons, label stays in the accessibility tree */
  .st-btn-txt{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap}
  .st-btn{padding:7px 9px}
  #btnTheme{display:none} /* dark mode lives in the More menu on phones */
  .st-body,.st-body.with-panel{grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto}
  .st-side{max-height:30vh;padding:6px 8px 8px;border-right:none;border-bottom:1px solid var(--st-line)}
  .st-nav,.st-search,#toolList{flex:0 0 auto}
  .st-nav{flex-direction:row;gap:4px;margin-bottom:6px;overflow-x:auto;padding-bottom:2px}
  .st-nav button{width:auto;white-space:nowrap;padding:6px 9px;font-size:12px}
  .st-side-label,.st-tool-cat{display:none}
  .st-search{margin:0 0 6px}
  #toolList{display:flex;flex-wrap:wrap;gap:5px}
  .st-tool{width:auto;max-width:100%;white-space:nowrap;border:1px solid var(--st-line);border-radius:999px;padding:4px 8px;font-size:11.5px}
  .st-tool small,.st-tool .t-add{display:none}
  .st-tool .t-name{flex:0 0 auto;overflow:visible}
  .st-work{padding:8px 12px 18px}
  .st-work-inner{max-width:100%}
  .st-input-grid{grid-template-columns:minmax(0,1fr);gap:10px}
  .st-drop{height:auto;min-height:176px;padding:14px}
  .st-files{height:auto;min-height:104px}
  .st-panel{max-height:52vh;padding:14px 14px 24px;border-left:none;border-top:1px solid var(--st-line)}
  .st-empty{padding:20px 14px}
  /* While a step is being configured the tool strip is not needed: reclaiming its
     height keeps the dropzone and its note fully visible on a 360px-tall viewport.
     Two rows only, because the hidden strip no longer occupies one. Closing the
     panel (x) restores the strip. */
  .st-body.with-panel{grid-template-rows:minmax(0,1fr) auto}
  .st-body.with-panel .st-side{display:none}
}
@media(max-width:400px) and (min-height:501px){
  .st-brand b{display:none} /* icon-only brand so the toolbar keeps one row */
}
