:root{--ink:#2b2b2b;--muted:#6b6b66;--line:#dcdbd4;--bg:#f1f1ee;--card:#fff;--olive:#6f6f42;--olive-d:#58582f;--soft:#eeeee2;--bad:#a3261b;--warn:#7a5200}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{font:15px/1.45 system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--ink);background:var(--bg);display:flex;flex-direction:column}
button,input,select,textarea{font:inherit;color:inherit}
button{border:1px solid var(--line);background:var(--card);border-radius:6px;padding:8px 12px;cursor:pointer;min-height:38px}
button:hover:not(:disabled){background:var(--soft)}
button:disabled{opacity:.4;cursor:default}
button.primary{background:var(--olive);border-color:var(--olive);color:#fff;font-weight:600}
button.primary:hover:not(:disabled){background:var(--olive-d)}
:focus-visible{outline:2px solid var(--olive);outline-offset:2px}
.bar{display:flex;gap:12px;align-items:center;justify-content:space-between;padding:10px 18px;background:var(--card);border-bottom:1px solid var(--line);flex-wrap:wrap}
.brand{font-weight:700;font-size:18px}.brand span{font-weight:400;color:var(--muted)}
.actions{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap}
[hidden]{display:none!important}
.notice{padding:9px 18px;background:#fff6dc;border-bottom:1px solid #ecd9a0}
main{flex:1;min-height:0}
.loading{padding:60px;text-align:center;color:var(--muted)}
.error{max-width:700px;margin:50px auto;background:#fff;border:1px solid var(--line);border-radius:10px;padding:24px}
.chooser{max-width:980px;margin:0 auto;padding:36px 20px}
.chooser h1{font-weight:600;margin:0 0 6px}
.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:14px;margin-top:22px}
.cards button{padding:20px;text-align:left;font-weight:600}.cards small{display:block;font-weight:400;color:var(--muted);margin-top:4px}
.work{display:grid;grid-template-columns:290px 1fr 270px;height:100%}
.panel{background:var(--card);padding:16px;overflow:auto;border-right:1px solid var(--line)}
.panel.right{border-right:0;border-left:1px solid var(--line)}
.panel h2{font-size:13px;margin:0 0 8px;color:var(--muted);font-weight:600}
.panel section{margin-bottom:22px}
label.f{display:block;margin-bottom:10px;font-size:13px;color:var(--muted)}
label.f>*{display:block;width:100%;margin-top:3px;color:var(--ink);font-size:15px}
input[type=text],input[type=number],select,textarea{border:1px solid var(--line);border-radius:6px;padding:8px;background:#fff;min-height:38px}
textarea{min-height:76px;resize:vertical}
.locked{font-size:15px;padding:8px 0;color:var(--ink)}
.row{display:flex;gap:6px;flex-wrap:wrap}.row>button{flex:1}
.two{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.full{width:100%;margin-bottom:8px}
.swatches{display:flex;flex-wrap:wrap;gap:7px}
.swatches button{width:38px;height:38px;min-height:0;padding:0;font-size:12px;font-weight:700;border-radius:50%}
.swatches button[aria-pressed=true]{outline:3px solid var(--olive);outline-offset:2px}
.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}
.grid button{padding:8px;aspect-ratio:1}.grid svg{width:100%;height:100%}
.tpls{display:grid;gap:8px}.tpls button{padding:6px;text-align:left;font-size:13px}.tpls svg{width:100%;display:block;border-radius:4px;margin-bottom:5px}
.stage{display:flex;flex-direction:column;min-width:0;min-height:0}
.stage svg#canvas{flex:1;min-height:0;width:100%;touch-action:none;user-select:none;-webkit-user-select:none}
.stage .status{padding:8px 16px;color:var(--muted);font-size:13px;display:flex;gap:16px;justify-content:space-between;border-top:1px solid var(--line);background:var(--card)}
.item{cursor:move}
.hint{font-size:13px;color:var(--muted)}
.bad{color:var(--bad)}.warn{color:var(--warn)}
dialog{border:0;border-radius:12px;padding:24px;max-width:min(640px,94vw);width:640px;max-height:92vh;overflow:auto;box-shadow:0 12px 50px #0005}
dialog::backdrop{background:#0007}
dialog h1{margin:0 0 10px;font-size:21px;font-weight:600}
dialog .prev{width:100%;max-height:34vh;margin:8px 0}
dialog ul{padding-left:20px;margin:8px 0}
dialog .check{display:flex;gap:9px;margin:10px 0;align-items:flex-start}.check input{margin-top:4px}
dialog .end{display:flex;gap:8px;justify-content:flex-end;margin-top:18px;flex-wrap:wrap}
@media(max-width:900px){
 .embedded .brand,.embedded #open{display:none}
 .embedded .bar{gap:8px;padding:10px 12px}.embedded .actions{margin-left:0}
 body{height:auto;min-height:100%}
 .work{display:flex;flex-direction:column;height:auto}
 .stage{order:-2;height:36vh;position:sticky;top:0;z-index:2;background:var(--bg)}
 .panel,.panel.right{border:0;border-top:1px solid var(--line);overflow:visible}
 .panel.right{order:-1}
}
