/* 편집기 화면 */
@font-face{font-family:"PFText";src:url(/fonts/PF-Regular.ttf) format("truetype");font-weight:400;font-display:swap}
@font-face{font-family:"PFText";src:url(/fonts/PF-Bold.ttf) format("truetype");font-weight:700;font-display:swap}
body.tool--editor{overflow:hidden}
body.tool--editor .hdr{position:relative}
.ed{display:flex;flex-direction:column;height:calc(100dvh - 61px);background:#d8d5ce;min-height:420px}
.ed-bar{display:flex;align-items:center;gap:8px;padding:8px 12px;background:var(--white);border-bottom:2px solid var(--ink);flex-wrap:wrap}
.ed-bar .sep{width:1px;height:24px;background:var(--line-2);margin:0 4px}
.ed-bar .grow,.ed-ctx .grow{flex:1}
.docname{height:36px;border:1.5px solid var(--line-2);border-radius:9px;padding:0 10px;min-width:120px;max-width:240px;background:var(--paper);font-weight:700}
.ed-bar output{font:700 13px var(--mono);min-width:44px;text-align:center}
.pgind{color:var(--muted);margin-left:6px}
.only-m{display:none}
.ed-ctx{display:flex;align-items:center;gap:12px;padding:7px 12px;background:#fff7f4;border-bottom:1.5px solid var(--line);min-height:50px;flex-wrap:wrap;font-size:14px}
.ed-ctx .hint{color:var(--muted)}.cxl{font-weight:800}
.cx{display:flex;align-items:center;gap:6px;font-weight:600;font-size:13.5px}
.cx select{height:32px;border:1.5px solid var(--ink);border-radius:8px;background:#fff;padding:0 6px}
.cx input[type=range]{width:90px;accent-color:var(--ink)}
.tg{min-width:34px;height:32px;border:1.5px solid var(--ink);background:#fff;border-radius:8px;font-weight:800;cursor:pointer}
.tg.on{background:var(--ink);color:#fff}
.sw-row{display:flex;align-items:center;gap:5px}
.sw{width:24px;height:24px;border-radius:50%;border:2px solid var(--ink);cursor:pointer;padding:0}
.sw[aria-pressed=true]{box-shadow:0 0 0 3px #fff,0 0 0 5px var(--ink)}
.swc{width:30px;height:28px;border:1.5px solid var(--ink);border-radius:8px;padding:1px;background:#fff;cursor:pointer}

.ed-body{flex:1;display:flex;min-height:0;position:relative}
.ed-tools{width:76px;flex:none;background:var(--white);border-right:2px solid var(--ink);display:flex;flex-direction:column;gap:2px;padding:8px 6px;overflow-y:auto}
.tl{display:flex;flex-direction:column;align-items:center;gap:1px;border:0;background:none;border-radius:10px;padding:5px 2px 4px;cursor:pointer;color:var(--ink-2)}
.tl:hover{background:var(--paper)}
.tl[aria-pressed=true]{background:var(--ink);color:#fff}
.tli{width:24px;height:24px;display:block}.tli svg{width:100%;height:100%}
.tll{font-size:11.5px;font-weight:700}
.ed-thumbs{width:178px;flex:none;background:#efede8;border-right:1.5px solid var(--line-2);display:flex;flex-direction:column;min-height:0}
.th-h{padding:10px 12px 4px;font-size:13px;color:var(--muted)}
.th-a{display:flex;flex-wrap:wrap;gap:6px;padding:4px 10px 10px}
.thumbs{flex:1;overflow-y:auto;padding:4px 12px 20px;display:flex;flex-direction:column;gap:12px}
.tb{position:relative;display:flex;flex-direction:column;align-items:center;gap:4px;padding:6px 6px 4px;border-radius:10px;border:2px solid transparent;cursor:pointer}
.tb:hover{background:rgba(20,17,15,.05)}
.tb.sel{border-color:var(--ink);background:#fff}
.tb.cur .tno{background:var(--red);color:var(--ink)}
.tb.drop-b::before,.tb.drop-a::after{content:"";position:absolute;left:0;right:0;height:4px;background:var(--red);border-radius:2px}
.tb.drop-b::before{top:-8px}.tb.drop-a::after{bottom:-8px}
.tb.drag{opacity:.35}
.tpv{background:#fff;box-shadow:2px 3px 0 rgba(20,17,15,.2);border:1px solid var(--line-2);line-height:0}
.tpv canvas{width:120px;height:auto;max-width:100%}
.tno{font:800 11.5px var(--mono);padding:1px 8px;border-radius:99px;background:var(--line)}
.tacts{position:absolute;right:4px;top:6px;display:none;flex-direction:column;gap:3px}
.tb:hover .tacts,.tb:focus-within .tacts{display:flex}
.tact{width:26px;height:26px;border-radius:7px;border:1.5px solid var(--ink);background:#fff;cursor:pointer;font-size:14px;line-height:1;padding:0}
.tact:hover{background:var(--ink);color:#fff}

.ed-view{flex:1;min-width:0;overflow:auto;padding:22px 26px 80px;position:relative;scroll-behavior:auto;outline:none}
.ed-view[data-tool=text]{cursor:text}
.ed-view:not([data-tool=select]):not([data-tool=text]){cursor:crosshair}
.pgw{position:relative;background:#fff;margin:0 auto 20px;box-shadow:0 2px 0 rgba(20,17,15,.2),0 10px 30px -10px rgba(20,17,15,.45);flex:none;touch-action:pan-y}
.pc{position:absolute;inset:0;display:block;user-select:none;-webkit-user-drag:none}
.pgno{position:absolute;left:-2px;top:-20px;font:700 11.5px var(--mono);color:#6a645d}
.ov{position:absolute;inset:0;overflow:hidden;user-select:none}
.ov-svg{position:absolute;left:0;top:0;pointer-events:none;overflow:visible}
.an{position:absolute;pointer-events:none;transform-origin:center center}
.an-svg{pointer-events:none}
.ed-view[data-tool=select] .an,.ed-view[data-tool=select] .an-svg{pointer-events:auto;cursor:move}
.ed-view[data-tool=select] .an-svg line,.ed-view[data-tool=select] .an-svg path{pointer-events:stroke}
.ed-view[data-tool=text] .an-text{pointer-events:auto;cursor:text}
.an-text{font-family:PFText,"Pretendard",sans-serif;line-height:1.25;white-space:pre;overflow:visible;word-break:keep-all}
.an-text.editing{outline:2px dashed var(--red-d);background:rgba(255,255,255,.7);cursor:text;user-select:text;pointer-events:auto;min-width:1em}
.an-img{object-fit:fill;-webkit-user-drag:none;user-select:none}
.an-hl{mix-blend-mode:multiply}
.an-cover.burn{box-shadow:0 0 0 2px var(--red-d) inset;background-image:repeating-linear-gradient(45deg,rgba(217,45,32,.35) 0 4px,transparent 4px 9px)!important;background-blend-mode:normal}
.an-shape{box-sizing:content-box}.an-shape.ell{border-radius:50%}
.sel-box{position:absolute;border:1.5px dashed #1b6bff;pointer-events:none;z-index:5}
.hd{position:absolute;width:11px;height:11px;margin:-6px 0 0 -6px;background:#fff;border:2px solid #1b6bff;border-radius:3px;pointer-events:auto;cursor:pointer;display:block}
.hd-pt{border-radius:50%}
.hd-nw{left:0;top:0;cursor:nwse-resize}.hd-n{left:50%;top:0;cursor:ns-resize}.hd-ne{left:100%;top:0;cursor:nesw-resize}
.hd-e{left:100%;top:50%;cursor:ew-resize}.hd-se{left:100%;top:100%;cursor:nwse-resize}.hd-s{left:50%;top:100%;cursor:ns-resize}
.hd-sw{left:0;top:100%;cursor:nesw-resize}.hd-w{left:0;top:50%;cursor:ew-resize}

.ed-panel{display:none;width:290px;flex:none;background:var(--white);border-left:2px solid var(--ink);overflow-y:auto;padding:8px 12px 30px}
.ed-panel.open{display:block}
.ps{border-bottom:1.5px solid var(--line);padding:6px 0}
.ps summary{cursor:pointer;font-weight:800;padding:8px 0;list-style:none;display:flex;justify-content:space-between}
.ps summary::after{content:"+";font:800 18px var(--mono);color:var(--red-d)}.ps[open] summary::after{content:"\2212"}
.ps summary::-webkit-details-marker{display:none}
.psb{display:flex;flex-direction:column;gap:10px;padding:2px 0 10px}
.psb .fld input,.psb .fld select,.psb .fld textarea{height:36px;border:1.5px solid var(--ink);border-radius:8px;padding:0 10px;background:#fff;font-size:14px}
.psb .fld textarea{height:auto;padding:8px 10px}
.psb input[type=range]{height:auto;border:0;padding:0;accent-color:var(--ink)}
.psb input[type=color]{padding:2px;width:60px}

.ed-empty{position:absolute;inset:0;display:grid;place-items:center;background:#d8d5ce;z-index:10;padding:20px}
.empty-card{max-width:520px;width:100%;background:var(--white);border:2.5px dashed var(--ink);border-radius:var(--r);padding:44px 28px;display:flex;flex-direction:column;gap:10px;align-items:center;text-align:center;cursor:pointer}
.empty-card:hover{background:var(--red-l)}
.empty-card svg{width:56px;height:56px}.empty-card b{font-size:21px;letter-spacing:-.02em}.empty-card span{color:var(--muted)}
.empty-card .warn{color:var(--red-d);font-style:normal;font-weight:700}
body.has-doc .ed-empty{display:none}

/* 모달 */
.modal{position:fixed;inset:0;background:rgba(20,17,15,.55);display:grid;place-items:center;z-index:120;padding:16px}
.modal-box{background:var(--white);border:2.5px solid var(--ink);border-radius:var(--r);box-shadow:8px 9px 0 var(--ink);width:min(680px,100%);max-height:calc(100dvh - 32px);overflow:auto;display:flex;flex-direction:column}
.modal-h{display:flex;justify-content:space-between;align-items:center;padding:14px 18px;border-bottom:2px solid var(--ink);font-size:18px}
.modal-f{display:flex;justify-content:flex-end;gap:8px;padding:14px 18px;border-top:1.5px solid var(--line)}
.modal-box>.col,.modal-box>.sigbody{padding:16px 18px}
.col{display:flex;flex-direction:column;gap:12px}
.sigbody{display:flex;flex-direction:column;gap:12px}
.sigpad{width:100%;height:auto;aspect-ratio:8/3;border:2px dashed var(--ink);border-radius:10px;background:repeating-linear-gradient(#fff 0 39px,#eee 39px 40px);touch-action:none;cursor:crosshair}
.sigtxt,.col input[type=text],.col select{height:42px;border:2px solid var(--ink);border-radius:10px;padding:0 12px;font-size:16px}
.sigsaved{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:13px;color:var(--muted)}
.sigthumb{border:1.5px solid var(--ink);background:#fff;border-radius:8px;padding:4px;cursor:pointer}.sigthumb img{height:34px;display:block}
.stampgrid{display:flex;flex-wrap:wrap;gap:6px}
.stampprev{width:100%;max-width:360px;height:auto;align-self:center;background:#f3f1ec;border-radius:10px}
.modal .tabs{width:auto}

@media (max-width:900px){
  .only-m{display:inline-flex}
  .ed-body{flex-wrap:wrap}
  .ed-tools{width:100%;flex-direction:row;overflow-x:auto;border-right:0;border-bottom:2px solid var(--ink);padding:4px 6px}
  .tl{min-width:56px}
  .ed-thumbs,.ed-panel{position:absolute;top:66px;bottom:0;z-index:20;box-shadow:6px 0 24px rgba(20,17,15,.3);display:none}
  .ed-thumbs{left:0}.ed-panel{right:0;width:min(290px,86vw)}
  .ed-thumbs.open{display:flex}.ed-panel.open{display:block}
  .ed-view{width:100%;flex:1 1 100%;padding:12px 10px 60px}
  .docname{max-width:140px}
  .pgind{display:none}
}
