/* SIYA NEWS Studio — freeform canvas workspace (Konva), E-Office indigo/slate theme. */
:host,:root{
    --st-ink:#1e293b;--st-muted:#64748b;--st-line:#e2e8f0;--st-indigo:#4f46e5;
    --st-indigo-dark:#4338ca;--st-soft:#eef2ff;--st-bg:#f1f5f9;--st-danger:#b91c1c;
}
*{box-sizing:border-box}
.studio-page{position:relative;height:calc(100dvh - 36px);min-height:360px;display:flex;flex-direction:column;background:var(--st-bg);color:var(--st-ink);font-family:'Prompt','Noto Sans Thai',sans-serif;line-height:1.45;overflow:hidden}
.st-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.st-top{flex:none;display:flex;align-items:center;gap:6px;min-height:44px;padding:4px 10px;background:#fff;border-bottom:1px solid var(--st-line);overflow-x:auto}
.st-top :is(.st-select,.st-title-input){min-height:32px;padding:4px 7px}
.st-top .st-btn.st-icon{width:30px;height:30px}
.st-back{color:var(--st-indigo-dark);font-size:12px;text-decoration:none;white-space:nowrap;padding:6px 4px;border-radius:6px}
.st-back:hover{background:var(--st-soft)}
.st-brand{font-size:14px;font-weight:500;white-space:nowrap;color:#334155}
.st-brand b{color:var(--st-indigo-dark);font-weight:600}
.st-select,.st-title-input,.st-input{min-height:38px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;color:var(--st-ink);font:inherit;font-size:12px;padding:7px 9px;min-width:0}
.st-select{max-width:210px}
.st-title-input{width:210px;font-weight:500}
.st-select:focus,.st-title-input:focus,.st-input:focus,.st-field input:focus,.st-field textarea:focus,.st-field select:focus{outline:0;border-color:#818cf8;box-shadow:0 0 0 3px #6366f126}
.st-btn{border:1px solid #dbe2ea;background:#fff;border-radius:8px;color:#475569;font:inherit;font-size:12px;font-weight:500;padding:8px 11px;display:inline-flex;align-items:center;justify-content:center;gap:5px;cursor:pointer;white-space:nowrap}
.st-btn:hover{background:#f8fafc;border-color:#a5b4fc;color:var(--st-indigo-dark)}
.st-btn:disabled{opacity:.45;cursor:not-allowed}
.st-btn.st-primary{background:var(--st-indigo);border-color:var(--st-indigo);color:#fff}
.st-btn.st-primary:hover{background:#4338ca;border-color:#4338ca;color:#fff}
.st-btn.st-icon{width:36px;height:36px;padding:0;font-size:17px}
.st-btn.st-small{padding:5px 8px;font-size:11px}
.st-btn.st-warn{color:var(--st-danger)}
.st-btn.st-wide{width:100%;margin-top:6px}
.st-mid{display:flex;align-items:center;gap:5px;margin-left:auto}
.st-save{font-size:11px;color:var(--st-muted);white-space:nowrap;min-width:70px;text-align:center}
.st-save[data-state=error]{color:var(--st-danger)}
.st-save[data-state=saved]{color:#047857}
.st-right{display:flex;align-items:center;gap:5px;margin-left:auto}
.st-message{flex:none;margin:8px 12px 0;padding:9px 12px;border:1px solid #bbf7d0;border-radius:8px;background:#f0fdf4;color:#166534;font-size:12px;max-height:150px;overflow:auto}
.st-message.error{border-color:#fecaca;background:#fef2f2;color:#b91c1c}
.st-message ul{margin:5px 0 0;padding-left:18px}
.st-app{flex:1;min-height:0;display:grid;grid-template-columns:70px 258px minmax(320px,1fr) 292px}
.st-rail{background:#fff;border-right:1px solid var(--st-line);display:flex;flex-direction:column;align-items:center;gap:4px;padding:10px 5px;overflow-y:auto}
.st-rail-item{width:58px;min-height:60px;border:0;border-radius:11px;background:transparent;color:#64748b;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;font:inherit;font-size:10px;cursor:pointer}
.st-rail-item span{font-size:20px;line-height:1.2}
.st-rail-item:hover{background:#f8fafc}
.st-rail-item.is-active{background:var(--st-soft);color:var(--st-indigo-dark);font-weight:600}
.st-side{background:#fff;border-right:1px solid var(--st-line);overflow-y:auto;padding:15px 14px;min-width:0}
.st-side-head{display:none;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px;padding-bottom:8px;border-bottom:1px solid var(--st-line)}
.st-side-head strong{font-size:13px}
.st-panel{display:none}
.st-panel.is-active{display:block}
.st-panel-title{margin:0 0 6px;font-size:15px;font-weight:600;color:#1e293b}
.st-sub{margin:6px 0 12px;color:var(--st-muted);font-size:11px;line-height:1.65}
.st-label{display:block;margin:10px 0 4px;font-size:11px;color:#475569;font-weight:500}
.st-input{width:100%}
.st-news-pool{display:grid;gap:8px;max-height:calc(100dvh - 360px);overflow:auto;padding-right:2px}
.st-pool-note{margin-top:8px}
.st-pool-status{margin:6px 0;color:var(--st-muted)}
.st-pool-status.is-error{color:var(--st-danger)}
.st-news{border:1px solid var(--st-line);border-radius:9px;padding:8px;background:#fff}
.st-news:hover{border-color:#a5b4fc}
.st-news-head{display:block;width:100%;text-align:left;border:0;background:transparent;padding:0;color:inherit;font:inherit;cursor:pointer}
.st-news-head strong{display:block;font-size:12px;font-weight:500;line-height:1.45;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.st-news-head small{display:block;color:var(--st-muted);font-size:10px;margin-top:2px}
.st-news-thumbs{display:flex;gap:4px;flex-wrap:wrap;margin-top:6px}
.st-news-thumb{width:38px;height:38px;padding:0;border:2px solid var(--st-line);border-radius:5px;overflow:hidden;background:#f1f5f9;cursor:pointer}
.st-news-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.st-news-thumb:hover{border-color:#818cf8}
.st-news-thumb--none{display:grid;place-items:center;font-size:9px;color:var(--st-muted);cursor:default}
.st-news-meta{display:flex;align-items:center;justify-content:space-between;gap:6px;margin-top:6px;font-size:10px;color:var(--st-muted)}
.st-news-meta button{border:0;background:var(--st-soft);color:var(--st-indigo-dark);border-radius:6px;padding:4px 7px;font:inherit;font-size:10px;cursor:pointer}
.st-news-meta button:hover{background:#e0e7ff}
.st-text-option{display:block;width:100%;text-align:left;border:1px solid var(--st-line);border-radius:9px;background:#fff;color:var(--st-ink);margin:8px 0;padding:11px;cursor:pointer}
.st-text-option:hover{background:#f8fafc;border-color:#a5b4fc}
.st-text-option.st-h1{font-size:20px;font-weight:700}
.st-text-option.st-h2{font-size:16px;font-weight:500}
.st-text-option.st-body-text{font-size:12px}
.st-shape-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin-bottom:10px}
.st-shape{border:1px solid var(--st-line);border-radius:8px;background:#fff;aspect-ratio:1;display:grid;place-items:center;font-size:22px;color:#4f46e5;cursor:pointer}
.st-shape:hover{background:#f5f3ff;border-color:#a5b4fc}
.st-swatches .st-shape{border-radius:7px}
.st-template{display:block;width:100%;text-align:left;border:1px solid var(--st-line);border-radius:10px;background:#fff;padding:8px;margin-bottom:9px;cursor:pointer;color:var(--st-ink)}
.st-template:hover{border-color:#a5b4fc;box-shadow:0 4px 14px #4f46e512}
.st-template__preview{display:block;height:88px;border-radius:6px;padding:12px;font-weight:700;overflow:hidden;position:relative}
.st-template strong{display:block;font-size:12px;margin-top:6px}
.st-template small{display:block;color:var(--st-muted);font-size:10px}
.st-preview-cover{background:linear-gradient(140deg,#312e81,#4f46e5);color:#fff;font-size:22px;line-height:1.05}
.st-preview-feature{background:#fff7ed;color:#9a3412;border:1px solid #fed7aa;font-size:20px;line-height:1.1}
.st-preview-activity{background:#ecfdf5;color:#047857;border:1px solid #a7f3d0;font-size:18px}
.st-layer{display:flex;align-items:center;gap:5px;border:1px solid var(--st-line);border-radius:7px;padding:6px 7px;margin-bottom:5px;font-size:11px;cursor:pointer}
.st-layer.is-active{border-color:#818cf8;background:#eef2ff}
.st-layer>span:first-child{color:#4f46e5;font-weight:600}
.st-layer-name{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.st-layer>.st-layer-name{border:0;background:transparent;color:var(--st-ink);font:inherit;font-size:11px;text-align:left;padding:2px 0;cursor:pointer}
.st-layer>.st-layer-name:hover{color:var(--st-indigo-dark);text-decoration:underline}
.st-layer>.st-layer-name:focus-visible{outline:2px solid #818cf8;outline-offset:2px;border-radius:3px}
.st-layer button{border:0;background:transparent;color:#94a3b8;font:inherit;font-size:13px;padding:1px 3px;cursor:pointer;border-radius:4px}
.st-layer button:hover{background:#e2e8f0;color:#4338ca}
.st-page-actions{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0}
.st-color-row{display:flex;gap:6px;align-items:center}
.st-color-row input[type=color]{width:38px;height:35px;padding:2px;border:1px solid #cbd5e1;border-radius:7px;background:#fff;cursor:pointer;flex:none}
.st-color-row input[type=text]{min-width:0;flex:1}
.st-workspace{display:flex;flex-direction:column;min-width:0;min-height:0;background:#eef2f7;position:relative}
.st-workbar{flex:none;height:34px;display:flex;align-items:center;gap:8px;padding:0 10px;background:#f8fafc;border-bottom:1px solid #e2e8f0;overflow-x:auto}
.st-meta{font-size:11px;color:#64748b;white-space:nowrap}
.st-workbar-right{display:flex;align-items:center;gap:6px;margin-left:auto}
.st-workbar-right #inspectorToggle{display:none}
.st-workbar-right input[type=range]{width:80px;accent-color:var(--st-indigo)}
.st-canvas-scroll{flex:1;min-height:0;overflow:auto;display:flex;padding:10px 16px 12px}
.st-canvas-center{margin:auto;display:flex;flex-direction:column;align-items:center;gap:7px;min-width:min-content}
.st-page-label{font-size:11px;color:#64748b;align-self:flex-start}
.st-page-wrap{background:#fff;position:relative;box-shadow:0 10px 36px #1e293b1f,0 0 0 1px #dbe2ea;flex:none}
.st-page-wrap canvas{display:block}
#stageContainer .konvajs-content{touch-action:none}
.st-pages{flex:none;min-height:40px;display:flex;align-items:center;gap:6px;padding:4px 10px;background:#f8fafc;border-top:1px solid #e2e8f0;overflow-x:auto}
.st-page-item{flex:none;display:flex;align-items:center;gap:5px;min-height:30px;cursor:pointer;border:1px solid #dbe2ea;border-radius:5px;background:#fff;padding:3px 7px;color:inherit;font:inherit;text-align:left}
.st-page-thumb{width:16px;height:21px;border:1px solid #cbd5e1;border-radius:2px;background:#fff;display:block;overflow:hidden;font-size:0;color:transparent}
.st-page-item.is-active{border-color:#6366f1;background:#eef2ff}
.st-page-item.is-active .st-page-thumb{border-color:#6366f1}
.st-page-item small{display:block;font-size:11px;color:#475569;white-space:nowrap}
.st-page-add{flex:none;min-width:74px;min-height:30px;border:1px dashed #cbd5e1;border-radius:6px;background:#fff;color:#4f46e5;font:inherit;font-size:11px;display:flex;gap:4px;align-items:center;justify-content:center;cursor:pointer}
.st-page-add span{font-size:18px;line-height:1}
.st-inspector{background:#fff;border-left:1px solid var(--st-line);overflow-y:auto;padding:13px 14px;min-width:0}
.st-inspector-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.st-inspector h3{margin:0;font-size:14px;font-weight:600}
.st-inspector hr{border:0;border-top:1px solid #eef2f7;margin:14px 0}
.st-inspector-head .st-btn{display:none}
.st-muted-card{margin-top:18px;border:1px dashed #e2e8f0;border-radius:10px;padding:22px 12px;text-align:center;color:#94a3b8;font-size:11px;line-height:1.7}
.st-muted-card span{display:block;font-size:28px;margin-bottom:5px;color:#c7d2fe}
.st-props{margin-top:10px}
.st-field{margin-top:9px}
.st-field label{display:block;margin-bottom:4px;font-size:10px;color:#64748b;font-weight:500}
.st-field input,.st-field textarea,.st-field select{width:100%;border:1px solid #dbe2ea;border-radius:7px;background:#fff;color:#334155;font:inherit;font-size:11px;padding:6px 7px;min-height:32px}
.st-field textarea{min-height:86px;resize:vertical;line-height:1.55}
.st-field-row{display:grid;grid-template-columns:1fr 1fr;gap:7px}
.st-image-note{border:1px solid #e0e7ff;background:#eef2ff;border-radius:7px;padding:8px;color:#4338ca;font-size:10px;line-height:1.5}
.st-actions{display:flex;flex-wrap:wrap;gap:5px}
.st-check{display:flex;align-items:center;gap:7px;margin:10px 0;font-size:11px;color:#475569;cursor:pointer}
.st-check input[type=checkbox]{width:16px;height:16px;min-height:0;margin:0;accent-color:#4f46e5;flex:none}
.st-align-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin-top:7px}
.st-align-actions .st-btn{padding:6px 3px;font-size:10px}
#objectEditing.is-locked{opacity:.45}
#cropPanel,#borderPanel,#textExtra{border-top:1px solid #e2e8f0;padding-top:12px;margin-top:14px}
#cropPanel h3,#borderPanel h3{font-size:12px}
.st-field input[type=range]{accent-color:#4f46e5;padding:0;border:0}
.st-dialog{width:min(620px,calc(100vw - 26px));max-height:calc(100dvh - 30px);padding:0;border:1px solid var(--st-line);border-radius:10px;background:#fff;color:var(--st-ink);font-family:inherit;overflow:auto}
.st-dialog::backdrop{background:#0f172abf}
.st-dialog-head{position:sticky;top:0;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:11px 13px;background:#fff;border-bottom:1px solid var(--st-line)}
.st-dialog-head h2{margin:0;font-size:15px}
.st-history{padding:11px 13px;display:grid;gap:7px}
.st-history-row{display:flex;align-items:center;justify-content:space-between;gap:8px;border:1px solid var(--st-line);border-radius:7px;padding:8px 9px;font-size:11px}
.st-history-row small{display:block;color:var(--st-muted);font-size:10px}
.st-toast{position:absolute;left:14px;bottom:50px;z-index:8;max-width:min(420px,calc(100% - 28px));padding:8px 12px;border-radius:7px;background:#1e293be6;color:#fff;font-size:11px;box-shadow:0 8px 20px #0f172a33;opacity:0;transform:translateY(6px);transition:opacity .18s,transform .18s;pointer-events:none}
.st-toast.is-show{opacity:1;transform:translateY(0)}
.st-fatal{position:absolute;inset:0;z-index:12;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:30px;text-align:center;background:#f8fafc;color:#334155}
.st-fatal[hidden]{display:none}
.st-fatal p{margin:0;color:var(--st-muted);font-size:12px;max-width:420px}
.studio-page[aria-busy=true]{cursor:progress}
.studio-page[aria-busy=true] .st-app{pointer-events:none;opacity:.72}
@media(max-width:1240px){
    .st-app{grid-template-columns:60px 222px minmax(300px,1fr) 250px}
    .st-rail-item{width:50px;min-height:56px}
    .st-title-input{width:160px}
    .st-select{max-width:170px}
    .st-brand{display:none}
}
@media(max-width:1020px){
    .st-top{flex-wrap:wrap;padding:4px 8px;gap:4px}
    .st-mid{margin-left:0;justify-content:flex-start}
    .st-right{margin-left:auto}
    .st-app{grid-template-columns:54px 198px minmax(280px,1fr)}
    .st-inspector{position:fixed;right:0;top:64px;bottom:0;width:min(310px,92vw);z-index:24;box-shadow:-8px 0 26px #0f172a24;transform:translateX(102%);transition:transform .2s ease}
    .st-inspector.is-open{transform:none}
    .st-inspector-head .st-btn{display:inline-flex}
    .st-workbar-right #inspectorToggle{display:inline-flex}
}
@media(max-width:760px){
    .studio-page{height:auto;min-height:0;overflow:visible}
    .st-top{position:sticky;top:0;z-index:15}
    .st-app{display:block;min-height:0}
    .st-rail{flex-direction:row;overflow-x:auto;border-right:0;border-bottom:1px solid var(--st-line);padding:3px 7px;gap:3px}
    .st-rail-item{min-width:54px;min-height:46px;width:auto;padding:3px 6px;flex:none;font-size:9px}
    .st-rail-item span{font-size:16px}
    .st-side{position:fixed;left:0;top:0;bottom:0;z-index:26;width:min(330px,94vw);max-height:none;border-right:1px solid var(--st-line);border-bottom:0;padding:12px 13px;overflow:auto;box-shadow:10px 0 28px #0f172a2e;transform:translateX(-102%);transition:transform .2s ease}
    .st-side.is-open{transform:none}
    .st-side-head{display:flex}
    .st-news-pool{max-height:none}
    .st-workspace{height:auto}
    .st-canvas-scroll{height:62vh;min-height:320px;padding:12px 10px 18px}
    .st-pages{min-height:40px}
    .st-inspector{top:0;bottom:0;width:min(320px,94vw)}
    .st-workbar{height:auto;min-height:34px;flex-wrap:wrap;padding:3px 8px}
    .st-workbar-right{margin-left:auto;justify-content:flex-end}
    .st-workbar-right input[type=range],.st-workbar-right #zoomValue{display:none}
    .st-meta{font-size:10px}
    .st-message{margin:6px 8px 0}
    .st-top .st-btn.st-small{padding:5px 7px}
    .st-select{max-width:150px}
}
@media(max-width:440px){
    .st-title-input{width:130px}
    .st-select{max-width:128px}
    .st-right .st-btn:not(.st-primary){padding:5px 6px;font-size:10px}
    .st-back{font-size:11px}
    .st-brand{display:none}
}
@media(prefers-reduced-motion:reduce){.st-toast,.st-inspector{transition:none}}
