:root{--ac:#d32f2f;--ac2:#b71c1c;--ink:#111827;--mut:#6b7280;--bg:#fff;--soft:#f7f6f6;--line:#e5e7eb;--ok:#059669;--bad:#dc2626;--r:12px;font-family:system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;color:var(--ink);-webkit-text-size-adjust:100%}
*{box-sizing:border-box}html,body{margin:0}body{background:var(--bg);line-height:1.5}
a{color:var(--ac2)}img,svg{max-width:100%}
.wrap{max-width:1040px;margin:0 auto;padding:0 18px}
.site-hd{border-bottom:1px solid var(--line);background:#fff}
.hd-in{display:flex;align-items:center;justify-content:space-between;height:58px}
.brand{display:flex;align-items:center;gap:9px;font-weight:700;font-size:19px;color:var(--ink);text-decoration:none}
.logo-mark{width:30px;height:30px}
.hd-nav a{margin-left:16px;color:var(--ink);text-decoration:none;font-size:15px}
.hero{background:linear-gradient(180deg,#fff0f0,#fff);padding:34px 0 26px;text-align:center}
.hero h1{font-size:clamp(28px,7vw,46px);line-height:1.15;margin:0 0 10px;letter-spacing:-.02em}
.lead{font-size:18px;color:#374151;max-width:640px;margin:0 auto 22px}
.drop{border:2px dashed #ffcdd2;background:#fff;border-radius:18px;padding:26px 16px;max-width:560px;margin:0 auto;transition:.15s}
.drop.over{border-color:var(--ac);background:#ffebee}
.drop-hint{color:var(--mut);margin:10px 0 0;font-size:14px}
.alt-acts{margin:12px 0 0;font-size:14px}
.priv{color:#065f46;font-size:14px;margin:14px 0 0}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;background:var(--ac);color:#fff;border:0;border-radius:12px;padding:12px 18px;font:600 16px/1.2 inherit;cursor:pointer;text-decoration:none;min-height:44px}
.btn:hover{background:var(--ac2)}.btn.big{font-size:19px;padding:16px 30px;min-width:220px}
.btn.ghost{background:#fff;color:var(--ac2);border:1.5px solid #ffcdd2;margin-top:10px}
.btn.sec{background:#ffebee;color:var(--ac2)}.btn.danger{background:var(--bad)}
.btn:disabled{opacity:.5;cursor:default}
.sec{padding:30px 0}.sec.alt{background:var(--soft)}.sec h2{font-size:24px;margin:0 0 14px}
.feat{list-style:none;padding:0;margin:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:12px}
.feat li{background:var(--soft);border-radius:var(--r);padding:14px;font-size:15px;color:#374151}.feat b{display:block;color:var(--ink);font-size:16px}
.steps{padding-left:22px;font-size:17px}.steps li{margin:6px 0}
details{border-bottom:1px solid var(--line);padding:12px 0}summary{font-weight:600;cursor:pointer}details p{margin:8px 0 0;color:#374151}
.grid-h{font-size:15px;color:var(--mut);margin:18px 0 8px;text-transform:uppercase;letter-spacing:.05em}
.tool-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px}
.tool-card{display:flex;gap:10px;align-items:flex-start;padding:12px;border:1px solid var(--line);border-radius:var(--r);text-decoration:none;color:var(--ink);background:#fff}
.tool-card:hover{border-color:#ffcdd2;background:#fff8f8}.ti{font-size:22px;line-height:1}.tool-card small{display:block;color:var(--mut);font-size:13px;line-height:1.35}
.site-ft{background:#0f172a;color:#cbd5e1;padding:28px 0 18px;margin-top:20px}
.ft-cols{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:16px}
.site-ft h3{color:#fff;font-size:14px;margin:0 0 6px}.site-ft ul{list-style:none;margin:0;padding:0}.site-ft li{margin:3px 0}
.site-ft a{color:#cbd5e1;text-decoration:none;font-size:14px}.ft-note{font-size:13px;color:#94a3b8;margin:18px 0 0}
.prose{padding-top:22px;padding-bottom:30px;max-width:760px}.prose h1{font-size:30px}.muted{color:var(--mut)}.cta{margin-top:24px}
.cform{display:grid;gap:12px;max-width:520px}.cform label{display:grid;gap:4px;font-weight:600;font-size:15px}
.cform input,.cform select,.cform textarea{font:16px inherit;padding:11px;border:1px solid #d1d5db;border-radius:10px;width:100%}
.hp{position:absolute;left:-9999px;width:1px;height:1px;opacity:0}
#cStatus.ok{color:var(--ok)}#cStatus.err{color:var(--bad)}
@media (max-width:640px){.hd-nav a{margin-left:12px;font-size:14px}.hero{padding-top:24px}.lead{font-size:16px}}

/* ---------------- editor ---------------- */
body.ed-open{overflow:hidden;height:100%;overscroll-behavior:none}
body.ed-open .site-hd,body.ed-open #home,body.ed-open .site-ft{display:none}
#editor{position:fixed;inset:0;display:flex;flex-direction:column;background:#ecebeb;z-index:10}
#editor[hidden]{display:none}
.ed-top{display:flex;align-items:center;gap:4px;height:52px;padding:0 6px;padding-top:env(safe-area-inset-top);background:#fff;border-bottom:1px solid var(--line);flex:none}
.ed-name{flex:1;min-width:0;font-weight:600;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:0 4px}
.ib{background:none;border:0;min-width:44px;height:44px;border-radius:10px;font-size:20px;color:var(--ink);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;padding:0 8px}
.ib:hover{background:#f3f4f6}.ib:disabled{opacity:.3}
.ib svg{width:22px;height:22px}
.ed-top .btn{padding:9px 14px;min-height:40px;font-size:15px}
#viewer{flex:1;overflow:auto;position:relative;-webkit-overflow-scrolling:touch;touch-action:pan-x pan-y}
#pages{display:flex;flex-direction:column;align-items:center;gap:14px;padding:14px 8px 120px;transform-origin:0 0;min-width:min-content}
.pg{position:relative;background:#fff;box-shadow:0 1px 4px rgba(0,0,0,.18);flex:none}
.pg canvas,.pg img.raster{position:absolute;inset:0;width:100%;height:100%}
.pg .ov{position:absolute;inset:0}
.pg .ov svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.pg-num{position:absolute;bottom:-18px;right:0;font-size:11px;color:var(--mut)}
.tool-draw .ov,.tool-hl .ov,.tool-shape .ov,.tool-redact .ov,.tool-text .ov,.tool-note .ov,.tool-place .ov,.tool-edit .ov{touch-action:none;cursor:crosshair}
.tool-edit .ov{cursor:text}
.an{position:absolute;transform-origin:0 0}
.an-text{white-space:pre;line-height:1.2;pointer-events:auto}
.an-img{pointer-events:auto}.an-img img{width:100%;height:100%;display:block;pointer-events:none}
.an-edit{background:#fff;pointer-events:auto}
.an-note{width:26px;height:26px;margin:-2px 0 0 -2px;font-size:20px;line-height:26px;text-align:center;pointer-events:auto;cursor:pointer;filter:drop-shadow(0 1px 1px rgba(0,0,0,.3))}
.an-redact{background:rgba(0,0,0,.82);outline:2px solid #ef4444;pointer-events:auto}
.sel-box{position:absolute;border:1.5px dashed var(--ac);pointer-events:none;border-radius:2px}
.sel-h{position:absolute;width:26px;height:26px;right:-14px;bottom:-14px;border-radius:50%;background:var(--ac);border:3px solid #fff;pointer-events:auto;touch-action:none;box-shadow:0 1px 3px rgba(0,0,0,.3)}
.sel-bar{position:absolute;top:-46px;left:50%;transform:translateX(-50%);display:flex;gap:2px;background:#111827;border-radius:10px;padding:3px;pointer-events:auto;white-space:nowrap}
.sel-bar button{background:none;border:0;color:#fff;font:600 13px inherit;padding:8px 10px;border-radius:7px;cursor:pointer;min-height:36px}
.sel-bar button:hover{background:#374151}
.tl-item{position:absolute;border:1px dashed rgba(211,47,47,.55);background:rgba(211,47,47,.06);pointer-events:auto;cursor:text;border-radius:2px}
.tl-item:hover,.tl-item:active{background:rgba(211,47,47,.18)}
.fld{position:absolute;pointer-events:auto;background:rgba(219,234,254,.55);border:1px solid rgba(37,99,235,.5);border-radius:2px;font:inherit;color:#000;padding:0 3px;margin:0}
textarea.fld{resize:none;padding:2px 3px;line-height:1.15}
input.fld[type=checkbox],input.fld[type=radio]{appearance:auto;accent-color:var(--ac);padding:0}
select.fld{padding:0}
.inl-ed{position:absolute;z-index:5;min-width:120px;border:2px solid var(--ac);background:rgba(255,255,255,.96);font:inherit;padding:0 2px;resize:none;outline:0;line-height:1.2;overflow:hidden;white-space:pre}
#topts{flex:none;background:#fff;border-top:1px solid var(--line);display:flex;gap:8px;align-items:center;padding:6px 10px;overflow-x:auto;min-height:0}
#topts:empty{display:none}
#topts label{font-size:13px;color:var(--mut);display:flex;align-items:center;gap:4px;white-space:nowrap}
#topts .hint{font-size:13px;color:#374151;white-space:nowrap}
.sw{width:28px;height:28px;border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px #d1d5db;cursor:pointer;flex:none;padding:0}
.sw.on{box-shadow:0 0 0 2.5px var(--ac)}
.chip{border:1px solid #d1d5db;background:#fff;border-radius:999px;padding:6px 12px;font:600 13px inherit;cursor:pointer;white-space:nowrap;min-height:34px}
.chip.on{background:var(--ac);border-color:var(--ac);color:#fff}
#tbar{flex:none;display:flex;overflow-x:auto;background:#fff;border-top:1px solid var(--line);padding:4px 4px calc(4px + env(safe-area-inset-bottom));gap:2px;scrollbar-width:none}
#tbar::-webkit-scrollbar{display:none}
.tb{flex:none;display:flex;flex-direction:column;align-items:center;gap:2px;min-width:64px;padding:6px 4px;border:0;background:none;border-radius:10px;font:500 11.5px inherit;color:#374151;cursor:pointer}
.tb .i{font-size:21px;line-height:1.1}
.tb.on{background:#ffebee;color:var(--ac2)}
.zoom{position:absolute;right:10px;bottom:10px;display:flex;flex-direction:column;gap:6px;z-index:3}
.zoom button{width:42px;height:42px;border-radius:50%;border:0;background:#fff;box-shadow:0 1px 4px rgba(0,0,0,.25);font-size:20px;cursor:pointer}
#edWrap{flex:1;position:relative;display:flex;flex-direction:column;min-height:0}
/* sheets */
.sheet-bg{position:fixed;inset:0;background:rgba(15,23,42,.45);z-index:40;display:flex;align-items:flex-end;justify-content:center}
.sheet{background:#fff;width:100%;max-width:640px;max-height:92vh;overflow:auto;border-radius:18px 18px 0 0;padding:16px 16px calc(18px + env(safe-area-inset-bottom));box-shadow:0 -4px 20px rgba(0,0,0,.2)}
.sheet.full{max-width:none;height:100%;max-height:none;border-radius:0;display:flex;flex-direction:column;padding:0}
.sheet h2{font-size:19px;margin:0 0 12px;display:flex;justify-content:space-between;align-items:center}
.sheet .row{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}
.sheet .row.end{justify-content:flex-end}
.sheet label.f{display:grid;gap:4px;font-weight:600;font-size:14px;margin:10px 0}
.sheet input[type=text],.sheet input[type=password],.sheet input[type=number],.sheet select,.sheet textarea{font:16px inherit;padding:10px;border:1px solid #d1d5db;border-radius:10px;width:100%}
.sheet .note{font-size:13px;color:var(--mut);margin:6px 0}
.sheet .warn{font-size:13px;background:#fef3c7;color:#92400e;padding:8px 10px;border-radius:8px}
.opt{display:flex;gap:10px;align-items:flex-start;border:1.5px solid var(--line);border-radius:12px;padding:12px;margin:8px 0;cursor:pointer}
.opt:has(input:checked){border-color:var(--ac);background:#fff5f5}.opt b{display:block}.opt small{color:var(--mut)}
.tabs{display:flex;gap:6px;margin-bottom:10px}
.sigpad{width:100%;height:190px;border:1.5px dashed #ffcdd2;border-radius:12px;background:#fff;touch-action:none;display:block}
.sig-list{display:flex;gap:8px;flex-wrap:wrap;margin:8px 0}
.sig-item{position:relative;border:1.5px solid var(--line);border-radius:10px;padding:6px;background:#fff;cursor:pointer;height:64px;display:flex;align-items:center}
.sig-item img{max-height:50px;max-width:160px}
.sig-item .x{position:absolute;top:-8px;right:-8px;width:22px;height:22px;border-radius:50%;border:0;background:#374151;color:#fff;font-size:12px;cursor:pointer}
.typed{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:8px}
.typed button{border:1.5px solid var(--line);background:#fff;border-radius:10px;padding:6px;font-size:26px;cursor:pointer;min-height:58px;overflow:hidden;white-space:nowrap}
.typed button.on{border-color:var(--ac)}
/* organizer */
.org-top{display:flex;align-items:center;gap:6px;padding:8px 10px;padding-top:calc(8px + env(safe-area-inset-top));border-bottom:1px solid var(--line);flex:none}
.org-top h2{flex:1;margin:0;font-size:17px}
.org-grid{flex:1;overflow:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:14px;padding:14px;align-content:start;background:#f3f2f2}
.th{position:relative;background:#fff;border-radius:10px;padding:6px 6px 4px;box-shadow:0 1px 3px rgba(0,0,0,.15);border:2px solid transparent;touch-action:pan-y;user-select:none;-webkit-user-select:none}
.th.sel{border-color:var(--ac)}.th.drag{opacity:.4}.th.drop-l{box-shadow:-4px 0 0 var(--ac)}.th.drop-r{box-shadow:4px 0 0 var(--ac)}
.th .im{height:150px;display:flex;align-items:center;justify-content:center}
.th canvas,.th img{max-width:100%;max-height:150px;box-shadow:0 0 0 1px #e5e7eb;transition:transform .2s}
.th .cap{display:flex;justify-content:space-between;align-items:center;font-size:12px;color:var(--mut)}
.th .cap button{border:0;background:none;font-size:17px;cursor:pointer;padding:4px 6px;border-radius:6px}
.th .ck{position:absolute;top:8px;left:8px;width:24px;height:24px;border-radius:50%;background:#fff;border:2px solid #9ca3af;display:flex;align-items:center;justify-content:center;font-size:14px;color:#fff;pointer-events:none}
.th.sel .ck{background:var(--ac);border-color:var(--ac)}
.th .grip{position:absolute;top:6px;right:6px;width:34px;height:34px;border-radius:8px;background:rgba(255,255,255,.9);border:1px solid #e5e7eb;font-size:18px;cursor:grab;touch-action:none;display:flex;align-items:center;justify-content:center}
.org-bar{flex:none;display:flex;gap:6px;overflow-x:auto;padding:8px 10px calc(8px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:#fff}
.org-bar .btn{white-space:nowrap;padding:10px 12px;font-size:14px}
.scan-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:10px;margin:10px 0}
.scan-list .th .im{height:130px}
/* toast + busy */
#toast{position:fixed;left:50%;bottom:110px;transform:translateX(-50%);background:#111827;color:#fff;padding:10px 16px;border-radius:12px;font-size:14px;z-index:60;max-width:90vw;box-shadow:0 4px 14px rgba(0,0,0,.3);opacity:0;transition:opacity .2s;pointer-events:none}
#toast.show{opacity:1}#toast.err{background:#b91c1c}
#busy{position:fixed;inset:0;background:rgba(255,255,255,.7);z-index:70;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;font-weight:600}
#busy[hidden]{display:none}
.spin{width:38px;height:38px;border:4px solid #ffcdd2;border-top-color:var(--ac);border-radius:50%;animation:sp 0.8s linear infinite}
@keyframes sp{to{transform:rotate(360deg)}}
@media (min-width:900px){.tb{min-width:72px}.sheet{border-radius:18px;margin-bottom:5vh}.sheet-bg{align-items:center}}

.ft-count{font-size:14px;font-weight:600;margin:16px 0 0;color:inherit}
