/* Diagram Studio: structural editing, with the existing renderer as the canvas. */
#studioRoot{--st-text:#e9e8e3;--st-muted:#aba9a1;color:var(--st-text);font-size:12px;line-height:1.5}
#studioRoot *,#st-templates *{box-sizing:border-box}
#studioRoot button,#st-templates button{font:inherit;cursor:pointer;color:inherit}
.st-kicker{font:9px var(--mono);letter-spacing:.18em;color:var(--gold);margin:0 0 9px;display:block}
.st-intro{margin-bottom:16px}.st-intro h2{font-size:20px;line-height:1.2;letter-spacing:-.04em;font-weight:500;margin:0;max-width:185px}.st-intro p{color:var(--st-muted)}
.st-headline{display:flex;align-items:center;justify-content:space-between;gap:10px}
.st-btn{border:1px solid #ffffff20!important;background:#ffffff04!important;border-radius:7px;padding:8px 11px;min-height:36px;line-height:1.25;transition:background .15s,border-color .15s;white-space:normal}
.st-btn:hover{background:#ffffff0e!important;border-color:#ffffff50!important}.st-btn.primary{background:var(--gold)!important;border-color:var(--gold)!important;color:#1c170c!important;font-weight:600!important}
.st-btn.active{border-color:var(--gold)!important;color:var(--gold)!important;background:#e9b44c0d!important}
.st-btn.danger{color:#ffb49e!important}.st-btn.wide{width:100%}.st-btn.subtle{margin-top:12px;color:var(--st-muted)!important;font-size:11px!important}
.st-btn:disabled{opacity:.32;cursor:not-allowed!important}
.st-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:1px;border:1px solid #ffffff12;border-radius:8px;overflow:hidden;margin:16px 0}.st-stats span{background:#ffffff03;padding:11px 8px;text-align:center;color:var(--st-muted);font-size:10px}.st-stats b{font-size:18px;font-weight:500;color:var(--st-text);margin-right:4px}
.st-tabs{display:flex;border-bottom:1px solid #ffffff15;margin-bottom:12px;gap:6px;padding-bottom:10px}.st-tabs button{flex:1}
.st-node-list{display:flex;flex-wrap:wrap;gap:5px;max-height:154px;overflow:auto;padding:2px 1px 12px;margin-bottom:12px;border-bottom:1px solid #ffffff14}
.st-node{display:inline-flex;align-items:center;gap:6px;border:1px solid #ffffff1b;background:#ffffff03;border-radius:6px;padding:7px 9px;max-width:100%;min-height:34px;text-align:left}.st-node span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:205px}.st-node i{font-style:normal;color:#a5a5a3}.st-node.active{border-color:var(--gold);background:#e9b44c12;color:var(--gold)!important}.st-add{border-style:dashed!important;color:var(--st-muted)!important}
.st-section-label{font:10px var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--st-muted);display:flex;justify-content:space-between;gap:8px;margin:0 0 10px}.st-section-label span{font-size:9px;color:#aaa79f;text-transform:none;letter-spacing:0}
#studioRoot label{display:block;font-size:11px;margin:9px 0 4px;color:#d4d2ca}#studioRoot label span{color:var(--st-muted);font-size:10px;margin-left:4px}
#studioRoot input:not([type=checkbox]),#studioRoot select,#st-template-search{width:100%;min-width:0;border:1px solid #ffffff24;border-radius:7px;padding:9px 10px;background:#0c0c10;color:#eeece6;font:12px var(--sans);min-height:38px}
#studioRoot select{appearance:auto}#studioRoot option{color:#eeece6;background:#151519}
#studioRoot :is(button,input,select):focus-visible,#st-templates :is(button,input):focus-visible{outline:2px solid var(--gold);outline-offset:3px}
.st-two{display:grid;grid-template-columns:1fr 1fr;gap:12px;align-items:end}.st-two .st-check{display:flex!important;align-items:center;gap:7px;min-height:38px;margin:0!important}.st-check input{accent-color:var(--gold);width:16px;height:16px}
.st-actions{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0 0}.st-actions button{flex:1;padding:8px!important;font-size:11px!important}
.st-error{color:#ffb49e;margin:5px 0 0;min-height:0}.st-error:empty{display:none}
.st-connections{border-top:1px solid #ffffff14;margin-top:17px;padding-top:16px}.st-edge{display:flex;align-items:center;gap:10px;width:100%;border:1px solid #ffffff15;border-radius:7px;background:#ffffff03;text-align:left;padding:9px 11px;margin-bottom:7px}.st-edge>span:nth-child(2){flex:1;min-width:0}.st-edge strong{display:block;font-size:12px;font-weight:500;overflow-wrap:anywhere}.st-edge small{display:block;color:var(--st-muted);font-size:10px}.st-edge-arrow{font-size:20px;color:var(--gold)}.st-edge:hover{border-color:#e9b44c80}.st-edge-form{padding:12px;border:1px solid #e9b44c50;border-radius:9px;background:#e9b44c05;margin-top:10px}
.st-health{display:flex;gap:10px;border-radius:8px;background:#8fc6b40c;border:1px solid #8fc6b425;padding:11px;margin-top:16px;color:#a8d5c4}.st-health>span{font-size:17px}.st-health strong{font-size:11px;font-weight:500}.st-health p{font-size:10px;color:#afbbb4;line-height:1.5;margin:3px 0 0}.st-health.note{color:#e9c783;background:#e9b44c08;border-color:#e9b44c25}.st-health.note p{color:#c8b894}.st-hint{font-size:11px;line-height:1.6;color:var(--st-muted);margin:8px 0 12px}.st-empty{padding:14px 10px;text-align:center}.st-empty-icon{font-size:25px;color:var(--gold);display:block;margin-bottom:8px}.st-empty strong{font-size:13px;font-weight:500;display:block}.st-empty p{font-size:11px;color:var(--st-muted);max-width:260px;margin:8px auto 12px}
.st-visual #txt,.st-visual #txt+.help{display:none}
#paper .dn-node.st-selected{filter:drop-shadow(0 0 4px #e9b44c88)}
#paper .dn-node:focus-visible{outline:2px solid #e9b44c;outline-offset:5px}
#st-templates{width:min(1080px,calc(100vw - 48px));max-height:calc(100dvh - 48px);padding:28px;border:1px solid #ffffff25;border-radius:16px;background:#111114;color:#eeece6;font-family:var(--sans);box-shadow:0 30px 100px #0009;overflow:auto}
#st-templates::backdrop{background:#050508c9;backdrop-filter:blur(8px)}
.st-dialog-head{display:flex;justify-content:space-between;align-items:start;gap:20px}.st-dialog-head h2{font-size:32px;font-weight:500;line-height:1.15;letter-spacing:-.04em;margin:0 0 8px}.st-dialog-head p:not(.st-kicker){font-size:14px;color:#aaa79f;margin:0}.st-close{font-size:23px!important;width:40px;min-width:40px;height:40px;padding:0!important}
.st-template-controls{display:flex;justify-content:space-between;align-items:center;gap:16px;margin:25px 0 12px}#st-template-search{max-width:340px}#st-filters{display:flex;gap:6px}.st-template-note{font-size:11px;color:#aaa79f;margin:0 0 18px}#st-template-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.st-template{padding:0;border:1px solid #ffffff19;background:#18181c;border-radius:10px;overflow:hidden;text-align:left;transition:transform .16s,border-color .16s}.st-template:hover{border-color:#e9b44caa;transform:translateY(-2px)}.st-template-preview{aspect-ratio:16/9;overflow:hidden;background:#09090d;pointer-events:none}.st-template-preview img{display:block;width:100%;height:100%}.st-template-copy{padding:15px}.st-template-copy>span{font:9px var(--mono);text-transform:uppercase;letter-spacing:.09em;color:#aaa79f}.st-template-copy h3{font-size:16px;line-height:1.2;font-weight:500;letter-spacing:-.02em;margin:9px 0 7px}.st-template-copy p{color:#b5b3ac;font-size:11px;line-height:1.6;margin:0 0 14px;min-height:35px}.st-template-copy>strong{font-size:11px;font-weight:500;color:var(--gold)}#st-template-count{color:#aaa79f;font-size:11px;margin-bottom:0}.st-no-results{grid-column:1/-1;padding:50px 20px;text-align:center;color:#aaa79f}
@media(min-width:861px){#pbody>.sec[data-id=structure]>.glab{display:none}#pbody>.sec[data-id=structure]{padding-top:18px}.stage-tl{gap:6px}.stage-tl .chip{padding:7px 10px}}
@media(max-width:860px){#studioRoot .st-btn,#studioRoot .st-node{min-height:44px}#studioRoot input:not([type=checkbox]),#studioRoot select{font-size:16px;min-height:44px}.st-intro h2{max-width:none;font-size:21px}.st-node-list{max-height:130px}#st-templates{width:calc(100vw - 20px);max-height:calc(100dvh - 20px);padding:18px}.st-dialog-head h2{font-size:26px}.st-template-controls{flex-direction:column;align-items:stretch;gap:10px}#st-template-search{max-width:none;font-size:16px}#st-filters{flex-wrap:wrap}#st-filters button{min-height:44px}#st-template-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.st-template-copy{padding:12px}.st-template-copy p{min-height:53px}.st-template-launch{display:none}}
@media(max-width:460px){#st-template-grid{grid-template-columns:1fr}.st-template-preview{aspect-ratio:2/1}.st-template-copy p{min-height:0}.st-two{gap:8px}}
@media(prefers-reduced-motion:reduce){.st-btn,.st-template{transition:none}}
/* Node editing v2: keep the selected object and its connections above the fold. */
.st-intro{margin-bottom:10px}.st-intro h2{font-size:17px;max-width:220px}.st-stats{margin:10px 0}.st-stats span{padding:7px}.st-stats b{font-size:15px}.st-tabs{margin-bottom:8px;padding-bottom:8px}
.st-outline{border-bottom:1px solid #ffffff14;margin:0 0 10px}.st-outline summary{font-size:11px;color:var(--st-muted);cursor:pointer;padding:8px 0}.st-outline .st-node-list{margin:0;border:0;max-height:150px}
.st-create-row{display:flex;gap:8px;margin:10px 0 17px}.st-create-row button:first-child{flex:1}.st-selected-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:14px 0}.st-selected-heading>strong{font-size:17px;font-weight:500;letter-spacing:-.02em;overflow-wrap:anywhere}.st-selected-heading button{white-space:nowrap}
.st-autosave{display:block;width:100%;font-size:10px;color:#a3c9b9;margin-bottom:2px}.st-inspector .st-actions{margin-top:8px}.st-inspector .st-actions .st-btn{flex:0 1 auto;font-size:10px!important;min-height:30px}.st-inspector .st-two .st-hint{margin:0}
#st-add-dialog{width:min(480px,calc(100vw - 24px));padding:26px;border:1px solid #ffffff30;border-radius:14px;background:#141418;color:#f1efe9;font:13px var(--sans);max-height:calc(100dvh - 24px);overflow:auto;box-shadow:0 25px 100px #000b}#st-add-dialog::backdrop{background:#050509b0;backdrop-filter:blur(6px)}#st-add-dialog .st-dialog-head h2{font-size:25px}#st-add-dialog label{display:block;margin:20px 0 7px;font-size:12px;color:#c2c0b7}#st-add-dialog input,#st-add-dialog select{width:100%;padding:12px;border:1px solid #ffffff2a;border-radius:8px;background:#09090e;color:#efeee9;font:14px var(--sans)}#st-add-dialog .st-hint{color:#bab7af;line-height:1.6;margin-top:14px}#st-add-dialog button{font:inherit;cursor:pointer}#st-add-dialog option{background:#151519;color:#efeee9}#st-add-dialog :is(input,select,button):focus-visible{outline:2px solid var(--gold);outline-offset:3px}
#paper .dn-node{touch-action:none}#paper .st-canvas-edge{cursor:pointer}#paper .st-canvas-edge:hover path:not([stroke=transparent]){stroke-width:2.5}
.st-draggable #paper .dn-node{cursor:grab}.node-drag #paper .dn-node{cursor:grabbing}.st-component-fields{grid-template-columns:repeat(2,minmax(0,1fr))}.st-flags{margin-top:8px}
#st-canvas-bar[hidden]{display:none}#st-canvas-bar{position:absolute;bottom:18px;left:50%;transform:translateX(-50%);z-index:30;display:flex;align-items:center;gap:12px;padding:12px 15px;border:1px solid #e9b44c88;border-radius:12px;background:#1b1914f5;box-shadow:0 6px 35px #0008;font-size:11px;max-width:calc(100% - 190px)}#st-canvas-bar strong{font-weight:500;white-space:nowrap}#st-canvas-bar>span{color:#c5bdad}#st-canvas-bar select{color:#efeee9;background:#25221b;border:1px solid #ffffff30;padding:8px;border-radius:6px}.st-connecting #paper .dn-node{cursor:crosshair}.st-connecting #paper .dn-node:hover{filter:drop-shadow(0 0 5px #e9b44c)}
@media(max-width:860px){.st-intro h2{font-size:18px}.st-outline summary{min-height:44px;padding:12px 0}.st-inspector .st-actions .st-btn{min-height:44px}#st-add-dialog input,#st-add-dialog select{font-size:16px;min-height:44px}#st-canvas-bar{bottom:10px;max-width:calc(100% - 20px);width:calc(100% - 20px);gap:6px;padding:8px;flex-wrap:wrap}#st-canvas-bar>span{display:none}#st-canvas-bar strong{font-size:10px;max-width:130px;overflow:hidden;text-overflow:ellipsis}#st-canvas-bar select{font-size:12px}#st-canvas-bar .st-btn{min-height:38px;padding:6px}}

.st-draft-notes #guardBox{display:none}

#st-add-dialog button{color:inherit}

/* S338d — one list, opened in place. The editor used to be a collapsed outline, a
   separate inspector and a connections block, so the thing you clicked and the thing
   you edited were never in the same place. */
.st-count{font:9.5px var(--mono);letter-spacing:.14em;text-transform:uppercase;color:var(--st-muted);margin:2px 0 10px}
.st-steps{border-top:1px solid #ffffff14;margin-bottom:12px}
.st-step{border-bottom:1px solid #ffffff14}
.st-step-h{display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:10px 2px;background:none;border:0;min-height:38px}
.st-step-h i{font-style:normal;color:#a5a5a3;width:13px;flex:none}
.st-step-h>span{flex:none;max-width:52%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px}
.st-step-h small{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--st-muted);font-size:10.5px}
.st-step-h .car{opacity:.42;flex:none;transition:transform .22s}
.st-step-h:hover>span{color:var(--gold)}
.st-step.open>.st-step-h{color:var(--gold)}
.st-step.open>.st-step-h .car{transform:rotate(90deg)}
.st-step-b{padding:2px 0 14px}
.st-step-b .st-connections{margin-top:13px;padding-top:12px}
.st-step-b .st-section-label{margin-bottom:6px}
@media(max-width:860px){.st-step-h{min-height:46px}}

.st-create-row.top{margin:0 0 10px}

/* ---------- editing on the picture (S338e) ----------
   A card that belongs to the box it came from: the same hairline, radius and shadow
   language as the panel, a tip pointing at the box, and nothing in it that is not
   about that box. */
#st-pop{position:absolute;z-index:40;width:290px;max-width:calc(100% - 16px);padding:12px;
  border:1px solid rgba(255,255,255,.14);border-radius:13px;background:rgba(17,17,21,.93);
  backdrop-filter:blur(18px) saturate(1.25);-webkit-backdrop-filter:blur(18px) saturate(1.25);
  box-shadow:0 26px 60px -22px rgba(0,0,0,.92),0 2px 0 rgba(255,255,255,.04) inset;
  color:#efeee9;font:12px var(--sans);animation:stPop .16s cubic-bezier(.32,.72,0,1)}
@keyframes stPop{from{opacity:0;transform:translateY(-4px) scale(.985)}to{opacity:1;transform:none}}
#st-pop[hidden]{display:none}
#st-pop::before{content:'';position:absolute;left:var(--tip,24px);width:11px;height:11px;
  background:inherit;border:1px solid rgba(255,255,255,.14);transform:rotate(45deg);margin-left:-6px}
#st-pop[data-side=below]::before{top:-6px;border-right:0;border-bottom:0}
#st-pop[data-side=above]::before{bottom:-6px;border-left:0;border-top:0}
#st-pop[data-side=beside]::before,#st-pop[data-side=sheet]::before{display:none}
.st-pop-head{display:flex;align-items:center;gap:8px}
#st-pop-name,#st-pop-detail,#st-pop-label{width:100%;background:rgba(0,0,0,.35);border:1px solid rgba(255,255,255,.1);
  border-radius:8px;padding:8px 10px;color:#f4f2ec;font:13px var(--sans);outline:none}
#st-pop-name{font-size:14px;font-weight:500}
#st-pop-detail,#st-pop-label{margin-top:6px;font-size:12px;color:#d7d4cc}
#st-pop :is(input,select,button):focus-visible{outline:2px solid var(--gold);outline-offset:2px}
#st-pop-name:focus,#st-pop-detail:focus,#st-pop-label:focus{border-color:rgba(233,180,76,.55)}
.st-pop-x{flex:none;width:26px;height:26px;border:0;background:none;color:#8a8983;font-size:17px;line-height:1;border-radius:7px;cursor:pointer}
.st-pop-x:hover{background:rgba(255,255,255,.07);color:#efeee9}
.st-pop-title{flex:1;font-size:13px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.st-pop-title span{color:var(--gold);margin:0 2px}
.st-pop-row{display:flex;flex-wrap:wrap;gap:5px;margin-top:9px}
.st-seg{display:flex;gap:3px;background:rgba(255,255,255,.04);border-radius:8px;padding:2px}
.st-seg button,.st-chipbtn{border:0;background:none;color:#aba9a1;font:11px var(--sans);padding:5px 9px;border-radius:6px;cursor:pointer;white-space:nowrap}
.st-seg button.on{background:rgba(233,180,76,.14);color:var(--gold)}
.st-chipbtn{border:1px solid rgba(255,255,255,.1)}
.st-seg button:hover,.st-chipbtn:hover{color:#efeee9}
.st-chipbtn.on{border-color:rgba(233,180,76,.5);color:var(--gold)}
.st-pop-icons{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;margin-top:8px}
.st-pop-icons[hidden]{display:none}
.st-ic{display:flex;align-items:center;justify-content:center;height:28px;border:1px solid rgba(255,255,255,.08);
  border-radius:7px;background:none;color:#cfccc4;cursor:pointer;font-size:11px}
.st-ic:hover{border-color:rgba(255,255,255,.25)}
.st-ic.on{border-color:var(--gold);color:var(--gold);background:rgba(233,180,76,.08)}
.st-pop-conns{margin-top:11px;border-top:1px solid rgba(255,255,255,.08);padding-top:9px;max-height:168px;overflow:auto}
.st-pop-conn{display:flex;align-items:baseline;gap:7px;width:100%;text-align:left;border:0;background:none;
  color:#efeee9;padding:6px 4px;border-radius:7px;cursor:pointer;font:12px var(--sans)}
.st-pop-conn:hover{background:rgba(255,255,255,.05)}
.st-pop-conn .a{color:var(--gold);font-size:13px}
.st-pop-conn b{font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:120px}
.st-pop-conn small{margin-left:auto;color:#8a8983;font-size:10.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:110px}
.st-pop-none{color:#8a8983;font-size:11px;line-height:1.5;margin:2px 4px 8px}
.st-pop-add select{width:100%;margin-top:4px;background:rgba(0,0,0,.35);border:1px solid rgba(255,255,255,.1);
  border-radius:8px;padding:7px 9px;color:#d7d4cc;font:11.5px var(--sans)}
.st-pop-foot{display:flex;gap:6px;margin-top:11px;border-top:1px solid rgba(255,255,255,.08);padding-top:9px}
.st-pop-foot button{flex:1;border:1px solid rgba(255,255,255,.1);background:none;color:#cfccc4;
  font:11px var(--sans);padding:7px;border-radius:7px;cursor:pointer}
.st-pop-foot button:hover{border-color:rgba(255,255,255,.28);color:#efeee9}
.st-pop-foot button.danger{color:#ffb49e}
.st-pop-foot button.danger:hover{border-color:rgba(255,180,158,.5)}
/* the dot you drag to connect */
#st-handles{position:absolute;inset:0;pointer-events:none;z-index:35}
.st-handle{position:absolute;width:14px;height:14px;padding:0;border-radius:50%;pointer-events:auto;
  border:1.5px solid var(--gold);background:#12120f;cursor:crosshair;
  box-shadow:0 0 0 3px rgba(233,180,76,.14),0 2px 8px rgba(0,0,0,.6);transition:transform .12s}
.st-handle:hover,body.st-linking .st-handle{transform:scale(1.25)}
#st-band{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:36;color:var(--gold)}
#st-band[hidden]{display:none}
body.st-linking{cursor:crosshair}
#paper .dn-node.st-target{filter:drop-shadow(0 0 7px rgba(233,180,76,.95))}
@media(max-width:900px){#st-pop{width:calc(100% - 16px)}}
body.st-linking #st-pop{pointer-events:none;opacity:.32}
.st-pop-icons{max-height:132px;overflow:auto}
.st-ic.fit{border-color:rgba(233,180,76,.32)}
.st-edit{position:absolute;width:14px;height:14px;padding:0;border-radius:50%;pointer-events:auto;
  display:flex;align-items:center;justify-content:center;
  border:1px solid rgba(255,255,255,.28);background:#15151a;color:#cfccc4;cursor:pointer;
  box-shadow:0 2px 8px rgba(0,0,0,.6);transition:transform .12s,border-color .12s}
.st-edit:hover{transform:scale(1.2);border-color:var(--gold);color:var(--gold)}
body.st-linking .st-edit{display:none}
