:root{
  --desk:#eef1f5; --surface:#ffffff; --surface-2:#f6f8fb; --line:#e2e6ee; --line-2:#d3d9e4;
  --text:#1c2230; --muted:#667085; --faint:#98a2b3;
  --ink:#1f3fae; --ink-strong:#18318a; --ink-soft:#e8edfc; --ink-text:#1f3fae;
  --seal:#0f8a5f; --seal-soft:#e3f5ed; --danger:#c2352b;
  --paper-shadow:0 1px 2px rgba(23,32,58,.08),0 12px 32px -8px rgba(23,32,58,.22),0 40px 80px -40px rgba(23,32,58,.3);
  --pop:0 10px 30px -10px rgba(23,32,58,.28),0 2px 6px rgba(23,32,58,.08);
  --r-lg:18px; --r-md:12px; --r-sm:9px;
  --font:"Segoe UI Variable Text","Segoe UI Variable","SF Pro Text",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --display:"Segoe UI Variable Display","SF Pro Display",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  color-scheme:light;
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --desk:#11141b; --surface:#191d27; --surface-2:#1f2430; --line:#2a3040; --line-2:#363d50;
  --text:#e8ebf2; --muted:#9aa3b5; --faint:#6c7589;
  --ink:#5b7cff; --ink-strong:#7b96ff; --ink-soft:#232c4d; --ink-text:#9fb2ff;
  --seal:#34c08a; --seal-soft:#173528; --danger:#ff7b70;
  --paper-shadow:0 1px 2px rgba(0,0,0,.4),0 18px 40px -10px rgba(0,0,0,.6);
  --pop:0 12px 32px -10px rgba(0,0,0,.6);
  color-scheme:dark;
}}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;min-height:100dvh;background:var(--desk);color:var(--text);font:14px/1.45 var(--font);-webkit-font-smoothing:antialiased;display:flex;flex-direction:column;overflow-x:hidden}
svg{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
button{font:inherit;color:inherit;cursor:pointer;border:0;background:none;padding:0}
button:disabled{cursor:not-allowed}
:focus-visible{outline:2px solid var(--ink);outline-offset:2px;border-radius:8px}
h1,h2,h3,p{margin:0}
[hidden]{display:none!important}

/* buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:42px;padding:0 16px;border-radius:var(--r-md);font-weight:600;transition:background .15s,box-shadow .15s,transform .1s,opacity .15s;white-space:nowrap}
.btn:active:not(:disabled){transform:translateY(1px)}
.btn.primary{background:var(--ink);color:#fff;box-shadow:0 1px 0 rgba(255,255,255,.2) inset,0 6px 16px -6px color-mix(in srgb,var(--ink) 70%,transparent)}
.btn.primary:hover:not(:disabled){background:var(--ink-strong)}
.btn.primary:disabled{background:var(--line-2);color:var(--faint);box-shadow:none}
.btn.secondary{background:var(--ink-soft);color:var(--ink-text)}
.btn.secondary:hover{background:color-mix(in srgb,var(--ink-soft) 80%,var(--ink) 20%)}
.btn.wide{width:100%}
.ghost{display:inline-flex;align-items:center;gap:6px;height:36px;padding:0 12px;border-radius:var(--r-sm);color:var(--muted);font-weight:600;border:1px solid var(--line);background:var(--surface)}
.ghost:hover:not(:disabled){color:var(--text);border-color:var(--line-2)}
.ghost:disabled{opacity:.45}
.ghost.small{height:30px;padding:0 10px;font-size:13px}
.ghost.small svg{width:15px;height:15px}
.icon-btn{display:grid;place-items:center;width:34px;height:34px;border-radius:var(--r-sm);color:var(--muted)}
.icon-btn:hover:not(:disabled){background:var(--surface-2);color:var(--text)}
.icon-btn:disabled{opacity:.35}

/* top bar */
.topbar{display:flex;align-items:center;gap:20px;padding:14px 24px;position:sticky;top:0;z-index:20;background:color-mix(in srgb,var(--desk) 82%,transparent);backdrop-filter:saturate(1.4) blur(14px);-webkit-backdrop-filter:saturate(1.4) blur(14px)}
.brand{display:flex;align-items:center;gap:10px;color:var(--text);text-decoration:none;font:700 17px/1 var(--display);letter-spacing:-.02em}
.logo{display:grid;place-items:center;width:34px;height:34px;border-radius:10px;background:var(--ink);box-shadow:0 6px 14px -6px var(--ink)}
.logo svg{width:24px;height:24px;stroke:#fff;stroke-width:2.2}
.steps{display:flex;align-items:center;gap:6px;margin:0 auto;padding:4px;list-style:none;background:var(--surface);border:1px solid var(--line);border-radius:999px}
.steps li{display:flex;align-items:center;gap:8px;padding:5px 12px 5px 5px;border-radius:999px;color:var(--faint);font-weight:600;font-size:13px;transition:background .2s,color .2s}
.steps .dot{display:grid;place-items:center;width:24px;height:24px;border-radius:50%;background:var(--surface-2);border:1px solid var(--line);font-size:12px}
.steps .dot svg{display:none;width:14px;height:14px;stroke-width:2.6}
.steps li.current{background:var(--ink-soft);color:var(--ink-text)}
.steps li.current .dot{background:var(--ink);border-color:var(--ink);color:#fff}
.steps li.done{color:var(--text)}
.steps li.done .dot{background:var(--seal);border-color:var(--seal);color:#fff}
.steps li.done .dot svg{display:block}
.steps li.done .dot b{display:none}
.privacy{display:inline-flex;align-items:center;gap:7px;color:var(--seal);font-weight:600;font-size:13px;white-space:nowrap}
.privacy svg{width:17px;height:17px}

/* layout */
.workspace{flex:1;display:grid;grid-template-columns:300px minmax(0,1fr) 320px;gap:16px;padding:4px 24px 24px;min-height:0}
.queue,.panel{display:flex;flex-direction:column;gap:12px;min-width:0}
.queue{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);padding:16px;align-self:start;position:sticky;top:76px;max-height:calc(100dvh - 100px)}
.pane-head,.card-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.pane-head h2,.card h2{font:650 15px/1.2 var(--display);letter-spacing:-.01em;display:flex;align-items:center;gap:8px}
.count{display:inline-grid;place-items:center;min-width:22px;height:20px;padding:0 6px;border-radius:999px;background:var(--surface-2);border:1px solid var(--line);color:var(--muted);font-size:12px;font-weight:700}

.drop{display:flex;align-items:center;gap:12px;width:100%;padding:14px;border:1.5px dashed var(--line-2);border-radius:var(--r-md);text-align:left;background:var(--surface-2);transition:border-color .15s,background .15s}
.drop:hover,.drop.drag{border-color:var(--ink);background:var(--ink-soft)}
.drop-icon{display:grid;place-items:center;width:38px;height:38px;border-radius:10px;background:var(--surface);color:var(--ink-text);border:1px solid var(--line);flex:none}
.drop-text{display:flex;flex-direction:column;min-width:0}
.drop-text strong{font-weight:650}
.drop-text small{color:var(--muted);font-size:12.5px}
.queue.has-docs .drop{display:none}

.doc-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px;overflow-y:auto;min-height:0}
.doc-list li{position:relative;display:flex;align-items:center;border-radius:var(--r-md);transition:background .12s}
.doc-list li:hover{background:var(--surface-2)}
.doc-list li.active{background:var(--ink-soft)}
.doc-button{flex:1;min-width:0;display:flex;align-items:center;gap:11px;padding:9px 6px 9px 9px;text-align:left;border-radius:var(--r-md)}
.doc-thumb{position:relative;display:grid;place-items:center;width:34px;height:42px;border-radius:6px;background:var(--surface);border:1px solid var(--line);color:var(--muted);flex:none}
.doc-thumb svg{width:17px;height:17px}
.doc-thumb.word{color:#2b6be0}
.doc-thumb .tick{position:absolute;right:-5px;bottom:-5px;display:grid;place-items:center;width:18px;height:18px;border-radius:50%;background:var(--seal);color:#fff;border:2px solid var(--surface)}
.doc-thumb .tick svg{width:11px;height:11px;stroke-width:3}
.doc-meta{display:flex;flex-direction:column;min-width:0}
.doc-name{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.doc-sub{font-size:12.5px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.doc-sub .ok{color:var(--seal);font-weight:600}
li.active .doc-name{color:var(--ink-text)}
.doc-list .remove{display:grid;place-items:center;width:30px;height:30px;margin-right:4px;border-radius:8px;color:var(--faint);opacity:0;transition:opacity .12s}
.doc-list li:hover .remove,.doc-list li.active .remove,.doc-list .remove:focus-visible{opacity:1}
.doc-list .remove:hover{color:var(--danger);background:var(--surface)}
.doc-list .remove svg{width:15px;height:15px}
.queue-summary{font-size:12.5px;color:var(--muted);padding:4px 4px 0;border-top:1px solid var(--line);padding-top:10px}

/* stage */
.stage-wrap{display:flex;flex-direction:column;min-width:0;position:relative}
.stage-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:6px 4px 14px}
.stage-title{min-width:0}
.stage-title h1{font:700 21px/1.2 var(--display);letter-spacing:-.025em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.stage-title p{color:var(--muted);margin-top:3px}
.stage-title p.attention{color:var(--ink-text);font-weight:600}
.stage{flex:1;display:flex;align-items:flex-start;justify-content:center;padding:8px 8px 90px;min-height:560px;border-radius:var(--r-lg);
  background-image:radial-gradient(circle at 1px 1px,color-mix(in srgb,var(--text) 9%,transparent) 1px,transparent 0);background-size:22px 22px}
.empty{align-self:center;display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center;padding:40px 28px;max-width:420px;border-radius:24px;color:var(--muted)}
.empty strong{font:700 22px/1.25 var(--display);letter-spacing:-.025em;color:var(--text);margin-top:14px;text-wrap:balance}
.empty .btn{margin-top:14px;pointer-events:none}
.empty:hover .btn{background:var(--ink-strong)}
.empty-sheets{position:relative;width:150px;height:150px}
.empty-sheets .sheet{position:absolute;inset:14px 30px;border-radius:8px;background:var(--surface);border:1px solid var(--line);box-shadow:var(--pop)}
.empty-sheets .s1{transform:rotate(-10deg) translate(-16px,6px);opacity:.6}
.empty-sheets .s2{transform:rotate(7deg) translate(14px,2px);opacity:.8}
.empty-sheets .s3{display:flex;flex-direction:column;gap:7px;padding:16px 12px;transition:transform .3s cubic-bezier(.3,1.4,.5,1)}
.empty-sheets .s3 i{display:block;height:4px;border-radius:2px;background:var(--line)}
.empty-sheets .s3 i:nth-child(2){width:80%}.empty-sheets .s3 i:nth-child(4){width:55%}
.empty-sheets .s3 svg{width:72px;height:26px;margin-top:auto;stroke:var(--ink);stroke-width:3;stroke-dasharray:420;stroke-dashoffset:420;animation:write 1.6s .3s ease forwards}
.empty:hover .s3{transform:translateY(-6px) rotate(-2deg)}
@keyframes write{to{stroke-dashoffset:0}}

#paper{position:relative;width:100%;background:#fff;border-radius:4px;box-shadow:var(--paper-shadow);touch-action:pan-y;animation:paperIn .28s ease}
@keyframes paperIn{from{opacity:0;transform:translateY(8px) scale(.99)}}
#pdfCanvas{display:block;width:100%;height:auto;border-radius:4px}
#marks{position:absolute;inset:0}
#paper.placing{cursor:none;outline:2px dashed var(--ink);outline-offset:6px}
#ghost{position:absolute;pointer-events:none;opacity:.55;transform:translate(-50%,-50%);filter:drop-shadow(0 2px 4px rgba(31,63,174,.25))}
.mark{position:absolute;cursor:grab;touch-action:none;border-radius:4px;outline:1.5px solid transparent;transition:outline-color .12s}
.mark:hover,.mark:focus-within{outline-color:color-mix(in srgb,var(--ink) 60%,transparent);background:color-mix(in srgb,var(--ink) 5%,transparent)}
.mark:active{cursor:grabbing}
.mark img{width:100%;height:100%;display:block;user-select:none;-webkit-user-drag:none;pointer-events:none}
.mark button{position:absolute;top:-12px;right:-12px;display:grid;place-items:center;width:24px;height:24px;border-radius:50%;background:var(--surface);color:var(--danger);box-shadow:var(--pop);border:1px solid var(--line);opacity:0;transition:opacity .12s}
.mark:hover button,.mark button:focus-visible{opacity:1}
.mark button svg{width:13px;height:13px;stroke-width:2.4}
.mark.fresh{animation:stamp .35s cubic-bezier(.3,1.5,.5,1)}
@keyframes stamp{from{transform:scale(1.25);opacity:0}}

/* floating toolbar */
.toolbar{position:sticky;bottom:18px;align-self:center;display:flex;align-items:center;gap:6px;padding:6px;margin-top:-70px;background:color-mix(in srgb,var(--surface) 88%,transparent);backdrop-filter:blur(16px) saturate(1.5);-webkit-backdrop-filter:blur(16px) saturate(1.5);border:1px solid var(--line);border-radius:16px;box-shadow:var(--pop);z-index:5;max-width:100%}
.pages{display:flex;align-items:center;gap:2px}
#pageText{min-width:82px;text-align:center;font-weight:600;font-variant-numeric:tabular-nums;font-size:13px}
.sep{width:1px;height:24px;background:var(--line);margin:0 4px}
.tool{display:inline-flex;align-items:center;gap:7px;height:38px;padding:0 14px;border-radius:11px;font-weight:650;background:var(--ink);color:#fff;white-space:nowrap}
.tool:hover:not(:disabled){background:var(--ink-strong)}
.tool.active-button{background:var(--ink-soft);color:var(--ink-text);box-shadow:inset 0 0 0 1.5px var(--ink)}
.tool:disabled{opacity:.5}
.size-control{display:flex;align-items:center;gap:8px;padding:0 8px 0 10px;color:var(--muted);font-weight:600;font-size:13px}
.size-control output{min-width:44px;font-variant-numeric:tabular-nums;color:var(--text);text-align:right}

input[type=range]{-webkit-appearance:none;appearance:none;width:120px;height:20px;background:transparent}
input[type=range]::-webkit-slider-runnable-track{height:4px;border-radius:2px;background:var(--line-2)}
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;margin-top:-7px;border-radius:50%;background:var(--surface);border:2px solid var(--ink);box-shadow:0 1px 3px rgba(0,0,0,.2)}
input[type=range]::-moz-range-track{height:4px;border-radius:2px;background:var(--line-2)}
input[type=range]::-moz-range-thumb{width:14px;height:14px;border-radius:50%;background:var(--surface);border:2px solid var(--ink)}

/* right panel */
.panel{align-self:start;position:sticky;top:76px}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r-lg);padding:16px;display:flex;flex-direction:column;gap:12px}
.card-note{color:var(--muted);font-size:13px}
.sig-slot{position:relative;display:grid;place-items:center;height:108px;border-radius:var(--r-md);background:var(--surface-2);border:1px solid var(--line);overflow:hidden;transition:border-color .15s}
.sig-slot:hover{border-color:var(--ink)}
.sig-slot .sig-line{position:absolute;left:18px;right:18px;bottom:24px;border-bottom:1px solid var(--line-2)}
.sig-slot .sig-line::before{content:"×";position:absolute;left:0;bottom:2px;color:var(--faint);font-size:13px}
#signaturePreview{position:relative;z-index:1;display:grid;place-items:center;width:100%;height:100%;padding:12px 30px 20px;background:#fff}
#signaturePreview img{max-width:100%;max-height:72px;object-fit:contain}
.sig-empty{display:flex;flex-direction:column;align-items:center;gap:6px;color:var(--muted);font-size:13px;padding:0 24px 18px;text-align:center}
.sig-empty svg{color:var(--ink-text)}
.repeat{display:grid;gap:8px}
.option{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:var(--r-md);border:1px solid var(--line);text-align:left;transition:border-color .15s,background .15s}
.option:hover:not(:disabled){border-color:var(--ink);background:var(--ink-soft)}
.option:disabled{opacity:.5}
.option strong{display:block;font-weight:650}
.option small{color:var(--muted);font-size:12.5px}
.opt-icon{display:grid;place-items:center;width:34px;height:34px;border-radius:10px;background:var(--surface-2);color:var(--ink-text);flex:none}
.export{display:grid;grid-template-columns:auto 1fr;align-items:center;gap:12px 14px}
.export .btn{grid-column:1/-1}
.export-text small{color:var(--muted);font-size:13px;display:block;margin-top:2px}
.progress-ring{position:relative;width:48px;height:48px;display:grid;place-items:center}
.progress-ring svg{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg)}
.progress-ring circle{fill:none;stroke:var(--line);stroke-width:4}
#ringFill{stroke:var(--seal);stroke-linecap:round;stroke-dasharray:113.1;stroke-dashoffset:113.1;transition:stroke-dashoffset .5s cubic-bezier(.3,1,.4,1)}
.progress-ring b{font:700 15px/1 var(--display);font-variant-numeric:tabular-nums}

/* toast */
.stage-head .ghost{flex:none;white-space:nowrap}
.toast{position:fixed;left:50%;top:72px;z-index:60;transform:translate(-50%,-14px);max-width:min(560px,calc(100vw - 32px));padding:11px 16px;border-radius:12px;background:#1c2230;color:#fff;font-weight:500;box-shadow:var(--pop);opacity:0;pointer-events:none;transition:opacity .2s,transform .25s cubic-bezier(.3,1.3,.5,1);overflow-wrap:anywhere}
.toast.show{opacity:1;transform:translate(-50%,0)}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .toast{background:#e8ebf2;color:#11141b}}

/* whole-window drop overlay */
.dropzone-overlay{position:fixed;inset:0;z-index:70;display:grid;place-items:center;padding:24px;background:color-mix(in srgb,var(--ink) 14%,transparent);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);pointer-events:none}
.dropzone-overlay>div{display:flex;flex-direction:column;align-items:center;gap:6px;padding:40px 56px;border-radius:24px;background:var(--surface);border:2px dashed var(--ink);box-shadow:var(--pop);color:var(--muted)}
.dropzone-overlay svg{width:34px;height:34px;color:var(--ink)}
.dropzone-overlay strong{font:700 20px/1.2 var(--display);color:var(--text)}

/* dialog */
dialog{width:min(620px,calc(100vw - 32px));max-height:calc(100dvh - 32px);padding:0;border:0;border-radius:22px;background:var(--surface);color:var(--text);box-shadow:0 30px 80px -20px rgba(0,0,0,.45);overflow:auto}
dialog::backdrop{background:rgba(15,20,35,.42);backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px)}
dialog[open]{animation:dlg .22s cubic-bezier(.3,1.2,.5,1)}
@keyframes dlg{from{opacity:0;transform:translateY(12px) scale(.98)}}
.sheet-inner{display:flex;flex-direction:column;gap:16px;padding:22px}
.dialog-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.dialog-head h2{font:700 20px/1.2 var(--display);letter-spacing:-.02em}
.dialog-head p{color:var(--muted);margin-top:3px}
.tabs{position:relative;display:grid;grid-template-columns:repeat(3,1fr);padding:4px;border-radius:13px;background:var(--surface-2);border:1px solid var(--line)}
.tabs button{position:relative;z-index:1;display:flex;align-items:center;justify-content:center;gap:7px;height:36px;border-radius:10px;font-weight:600;color:var(--muted);transition:color .15s}
.tabs button[aria-pressed=true]{color:var(--text)}
.tabs svg{width:16px;height:16px}
.tab-thumb{position:absolute;top:4px;bottom:4px;left:4px;width:calc((100% - 8px)/3);border-radius:10px;background:var(--surface);box-shadow:0 1px 3px rgba(0,0,0,.1),0 0 0 1px var(--line);transition:transform .25s cubic-bezier(.3,1.2,.5,1)}
.tabs[data-mode=type] .tab-thumb{transform:translateX(100%)}
.tabs[data-mode=photo] .tab-thumb{transform:translateX(200%)}
.inks{display:flex;align-items:center;gap:10px;color:var(--muted);font-weight:600;font-size:13px}
.ink{width:26px;height:26px;border-radius:50%;background:var(--c);box-shadow:0 0 0 2px var(--surface),0 0 0 3px var(--line-2);transition:box-shadow .15s}
.ink[aria-checked=true]{box-shadow:0 0 0 2px var(--surface),0 0 0 4px var(--c)}
.panel-body{display:flex;flex-direction:column;gap:10px}
#drawPanel{align-items:flex-end}
.pad-wrap{position:relative;width:100%;border-radius:var(--r-md);background:#fff;border:1px solid var(--line-2);overflow:hidden}
#pad{display:block;width:100%;height:auto;aspect-ratio:840/300;touch-action:none;cursor:crosshair;position:relative;z-index:1}
.pad-hint{position:absolute;inset:0;display:grid;place-items:center;color:#98a2b3;font-size:14px;pointer-events:none;padding:0 20px 30px;text-align:center}
.pad-line{position:absolute;left:28px;right:28px;bottom:30%;border-bottom:1.5px dashed #d3d9e4;pointer-events:none}
.field-label{font-weight:600}
#typed{width:100%;height:46px;padding:0 14px;border-radius:var(--r-md);border:1px solid var(--line-2);background:var(--surface);color:var(--text);font:inherit;font-size:15px}
#typed:focus{outline:none;border-color:var(--ink);box-shadow:0 0 0 4px var(--ink-soft)}
.styles{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.style-opt{display:flex;align-items:center;min-height:68px;padding:8px 14px;border-radius:var(--r-md);background:#fff;border:1.5px solid var(--line);color:var(--sig-ink,#1b2a6b);font-size:24px;line-height:1.1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-align:left;min-width:0}
.style-opt span{overflow:hidden;text-overflow:ellipsis}
.style-opt[aria-checked=true]{border-color:var(--ink);box-shadow:0 0 0 3px var(--ink-soft)}
.photo-drop{display:flex;flex-direction:column;align-items:center;gap:6px;padding:26px 20px;border:1.5px dashed var(--line-2);border-radius:var(--r-md);background:var(--surface-2);text-align:center;color:var(--muted)}
.photo-drop:hover{border-color:var(--ink);background:var(--ink-soft)}
.photo-drop svg{width:28px;height:28px;color:var(--ink-text)}
.photo-drop strong{color:var(--text)}
.photo-preview{display:grid;place-items:center;min-height:120px;padding:14px;border-radius:var(--r-md);border:1px solid var(--line);background:#fff;background-image:linear-gradient(45deg,#f1f3f7 25%,transparent 25%,transparent 75%,#f1f3f7 75%),linear-gradient(45deg,#f1f3f7 25%,transparent 25%,transparent 75%,#f1f3f7 75%);background-size:16px 16px;background-position:0 0,8px 8px;margin-top:4px}
.photo-preview img{max-width:100%;max-height:150px}
.photo-preview span{color:#667085}
.cleanup-control{display:flex;align-items:center;justify-content:space-between;gap:12px;font-weight:600;margin-top:6px}
.cleanup-control input{flex:1;max-width:260px}
.form-error{color:var(--danger);font-weight:600;min-height:1px}
.form-error:empty{display:none}
.dialog-actions{display:flex;justify-content:flex-end;gap:10px}
.dialog-actions .ghost{height:42px}

/* hidden Word renderer (used during .docx conversion) */
.word-conversion{position:absolute;left:-20000px;top:0;width:max-content;background:white;color:black;pointer-events:none}
.word-conversion section.word-page{margin:0;box-shadow:none}
.word-conversion a{color:inherit}

.mobile-bar{display:none}

/* responsive */
@media (max-width:1180px){
  .workspace{grid-template-columns:260px minmax(0,1fr) 290px;gap:12px;padding:4px 16px 20px}
  .steps .label{display:none}
  .steps li{padding:5px}
  .steps li.current .label{display:inline;padding-right:6px}
}
@media (max-width:920px){
  .topbar{padding:12px 16px;gap:12px}
  .privacy span{display:none}
  .workspace{grid-template-columns:minmax(0,1fr);padding:4px 16px calc(96px + env(safe-area-inset-bottom))}
  .queue,.panel{position:static;max-height:none}
  .queue{order:1}
  .stage-wrap{order:2}
  .panel{order:3;display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px}
  .stage{min-height:420px;padding:4px 0 84px}
  .doc-list{max-height:240px}
  .export .btn{display:none}
  .mobile-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;position:fixed;left:0;right:0;bottom:0;z-index:30;padding:12px 16px calc(12px + env(safe-area-inset-bottom));background:color-mix(in srgb,var(--surface) 90%,transparent);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);border-top:1px solid var(--line)}
  .mobile-bar span{font-weight:600;color:var(--muted);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .toast{top:calc(64px + env(safe-area-inset-top))}
  .doc-list .remove{opacity:1}
  .mark button{opacity:1}
}
@media (max-width:560px){
  .brand>span:last-child{display:none}
  .steps{margin:0 0 0 auto}
  .stage-head{flex-direction:column;gap:10px}
  .stage-head .ghost{align-self:stretch;justify-content:center;height:40px}
  .stage-title h1{font-size:18px;white-space:normal;overflow-wrap:anywhere}
  .toolbar{flex-wrap:wrap;justify-content:center;bottom:calc(82px + env(safe-area-inset-bottom));border-radius:14px}
  .toolbar .sep{display:none}
  .size-control{order:3;width:100%;justify-content:center;padding:4px 0 2px}
  .size-control input{flex:1;max-width:220px}
  .empty{padding:24px 12px}
  .empty strong{font-size:19px}
  dialog{width:100vw;max-width:100vw;margin:auto 0 0;border-radius:22px 22px 0 0;max-height:calc(100dvh - 12px)}
  dialog[open]{animation:sheetUp .28s cubic-bezier(.3,1.1,.5,1)}
  @keyframes sheetUp{from{transform:translateY(40%);opacity:.4}}
  .sheet-inner{padding:18px 16px calc(16px + env(safe-area-inset-bottom))}
  .styles{grid-template-columns:1fr}
  .dialog-actions{position:sticky;bottom:0;background:var(--surface);padding-top:8px}
  .dialog-actions .btn{flex:1}
}
/* phones: 16px fields so iOS does not zoom; native-look reset for date/time */
@media (pointer:coarse){
  input,select,textarea{font-size:16px!important}
  input[type=date],input[type=time],input[type=datetime-local]{-webkit-appearance:none;appearance:none;min-width:0}
  input[type=range]{width:100%}
}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}
