:root{--bg:#f4f5f7;--surface:#fff;--border:#dcdfe4;--border-strong:#b8bdc6;--text:#1d2129;--muted:#6b7280;--accent:#1f4fd1;--accent-soft:#e6edfc;--danger:#c62828;--danger-soft:#fdecec;--radius:8px;--header-h:52px;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;color:var(--text);background:var(--bg);font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;font-size:15px;line-height:1.4}*{box-sizing:border-box}body{background:var(--bg);margin:0}h1,h2,h3{margin:0;font-weight:600}h1{font-size:1.35rem}h2{font-size:1.1rem}h3{font-size:.95rem}p{margin:0 0 .6em}button,input,select{font:inherit;color:inherit}.muted{color:var(--muted)}.pad{padding:24px}.small{font-size:.85rem}.app{flex-direction:column;min-height:100vh;display:flex}.header{z-index:20;height:var(--header-h);background:var(--surface);border-bottom:1px solid var(--border);align-items:center;gap:24px;padding:0 20px;display:flex;position:sticky;top:0}.brand{color:var(--accent);font-size:1.15rem;font-weight:700;text-decoration:none}.nav{flex:1;gap:4px;display:flex}.nav a{border-radius:var(--radius);color:var(--muted);padding:6px 12px;text-decoration:none}.nav a:hover{background:var(--bg);color:var(--text)}.nav a.active{background:var(--accent-soft);color:var(--accent);font-weight:500}.main{flex-direction:column;flex:1;min-height:0;display:flex}.page{width:100%;max-width:1200px;margin:0 auto;padding:24px}.toolbar{flex-wrap:wrap;align-items:center;gap:8px;margin-bottom:20px;display:flex}.toolbar .spacer{flex:1}.btn{border:1px solid var(--border-strong);border-radius:var(--radius);background:var(--surface);cursor:pointer;white-space:nowrap;justify-content:center;align-items:center;gap:6px;height:34px;padding:0 14px;text-decoration:none;display:inline-flex}.btn:hover:not(:disabled){background:var(--bg)}.btn:disabled{opacity:.5;cursor:default}.btn.primary{background:var(--accent);border-color:var(--accent);color:#fff}.btn.primary:hover:not(:disabled){background:#1a43b3}.btn.danger{background:var(--danger);border-color:var(--danger);color:#fff}.btn.danger:hover:not(:disabled){background:#a82020}.btn.ghost{background:0 0;border-color:#0000}.btn.ghost:hover:not(:disabled){background:var(--bg)}.btn.icon{width:34px;padding:0;font-size:1.1rem}.btn.sm{height:28px;padding:0 10px;font-size:.85rem}.btn.sm.icon{width:28px}.btn.active{background:var(--accent-soft);border-color:var(--accent);color:var(--accent)}.menu{position:relative}.menu-pop{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);z-index:30;min-width:180px;padding:4px;position:absolute;top:calc(100% + 4px);right:0;box-shadow:0 6px 20px #0000001f}.menu-item{text-align:left;cursor:pointer;background:0 0;border:0;border-radius:6px;width:100%;padding:8px 10px;display:block}.menu-item:hover{background:var(--bg)}.menu-item.danger{color:var(--danger)}.menu-item.danger:hover{background:var(--danger-soft)}.modal-backdrop{z-index:100;background:#0f141e66;justify-content:center;align-items:center;padding:24px;display:flex;position:fixed;inset:0}.modal{background:var(--surface);border-radius:10px;flex-direction:column;width:100%;max-width:440px;max-height:calc(100vh - 48px);display:flex;box-shadow:0 12px 40px #00000040}.modal.wide{max-width:980px}.modal-head{border-bottom:1px solid var(--border);justify-content:space-between;align-items:center;padding:14px 16px 14px 20px;display:flex}.modal-body{padding:20px;overflow:auto}.modal-foot{border-top:1px solid var(--border);justify-content:flex-end;gap:8px;padding:12px 20px;display:flex}.field{flex-direction:column;gap:6px;display:flex}.field>span{color:var(--muted);font-size:.85rem}input[type=text],input:not([type]),select{border:1px solid var(--border-strong);border-radius:var(--radius);background:var(--surface);height:36px;padding:0 10px}input:focus-visible,select:focus-visible,.btn:focus-visible{outline:2px solid var(--accent);outline-offset:1px}input[type=range]{width:100%;accent-color:var(--accent)}input[type=color]{border:1px solid var(--border-strong);background:var(--surface);cursor:pointer;border-radius:6px;width:36px;height:32px;padding:2px}.breadcrumbs{flex-wrap:wrap;align-items:center;gap:4px;font-size:1.2rem;font-weight:600;display:flex}.crumb{color:var(--muted);border-radius:6px;padding:2px 6px;text-decoration:none}.crumb:hover{background:var(--surface);color:var(--text)}.crumb.current{color:var(--text)}.crumb.drop-target,.card.drop-target{outline:2px dashed var(--accent);outline-offset:2px;background:var(--accent-soft)}.crumb-sep{color:var(--border-strong)}.section-title{text-transform:uppercase;letter-spacing:.04em;color:var(--muted);margin:24px 0 10px;font-size:.8rem;font-weight:600}.grid{grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:16px;display:grid}.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);cursor:pointer;color:inherit;-webkit-user-select:none;user-select:none;flex-direction:column;text-decoration:none;display:flex;position:relative}.card:hover{border-color:var(--border-strong);box-shadow:0 2px 8px #0000000f}.card.dragging{opacity:.4}.folder-card{flex-direction:row;align-items:center;gap:10px;padding:12px}.folder-icon{font-size:1.5rem;line-height:1}.card-name{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-weight:500;overflow:hidden}.folder-card .card-name{white-space:normal;overflow-wrap:anywhere;-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box}.doc-thumb{aspect-ratio:3/4;border-radius:var(--radius) var(--radius) 0 0;background:#e9ebef;justify-content:center;align-items:center;display:flex;position:relative;overflow:hidden}.doc-thumb img{max-width:100%;max-height:100%;box-shadow:0 1px 4px #00000026}.doc-info{border-top:1px solid var(--border);align-items:center;gap:4px;padding:8px 6px 8px 10px;display:flex}.doc-info .card-name{font-size:.9rem}.card-menu-btn{flex:none}.card .menu-pop{top:auto;bottom:calc(100% + 4px)}.folder-card .menu-pop{top:calc(100% + 4px);bottom:auto}.empty{text-align:center;color:var(--muted);border:2px dashed var(--border);border-radius:10px;padding:48px 24px}.drop-overlay{z-index:50;border:3px dashed var(--accent);color:var(--accent);pointer-events:none;background:#1f4fd114;justify-content:center;align-items:center;font-size:1.3rem;font-weight:600;display:flex;position:fixed;inset:0}.folder-list{flex-direction:column;gap:2px;max-height:50vh;display:flex;overflow:auto}.folder-option{text-align:left;cursor:pointer;background:0 0;border:0;border-radius:6px;padding:8px 10px}.folder-option:hover{background:var(--bg)}.folder-option.selected{background:var(--accent-soft);color:var(--accent)}.folder-option:disabled{opacity:.4;cursor:default}.doc-layout{height:calc(100vh - var(--header-h));flex:none;display:flex;overflow:hidden}.doc-main{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex}.doc-toolbar{background:var(--surface);border-bottom:1px solid var(--border);align-items:center;gap:8px;padding:8px 16px;display:flex}.doc-title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;font-weight:600;overflow:hidden}.zoom-label{text-align:center;min-width:48px;color:var(--muted);font-size:.85rem}.pages{background:#e2e5ea;flex:1;padding:24px;overflow:auto}.pages-inner{flex-direction:column;align-items:center;gap:20px;width:max-content;min-width:100%;display:flex}.page-wrap{background:#fff;position:relative;box-shadow:0 1px 6px #0000002e}.page-wrap canvas{width:100%;height:100%;display:block}.page-wrap.drop-target{outline:3px solid var(--accent)}.page-number{color:var(--muted);margin-left:8px;font-size:.75rem;position:absolute;bottom:0;left:100%}.page-overlay{position:absolute;inset:0}.placed{cursor:move;touch-action:none;position:absolute}.placed img{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;display:block}.placed:hover{outline:1px dashed #1f4fd199}.placed.selected{outline:1.5px solid var(--accent)}.handle{border:1.5px solid var(--accent);background:#fff;border-radius:2px;width:12px;height:12px;margin:-6px;position:absolute}.handle.nw{cursor:nwse-resize;top:0;left:0}.handle.ne{cursor:nesw-resize;top:0;left:100%}.handle.sw{cursor:nesw-resize;top:100%;left:0}.handle.se{cursor:nwse-resize;top:100%;left:100%}.handle.rotate{cursor:grab;border-radius:50%;top:-28px;left:50%}.rotate-stem{background:var(--accent);pointer-events:none;width:1.5px;height:22px;position:absolute;top:-22px;left:50%;transform:translate(-50%)}.placed-delete{background:var(--danger);color:#fff;cursor:pointer;border:0;border-radius:50%;width:22px;height:22px;font-size:.75rem;line-height:22px;position:absolute;top:-30px;right:-30px}.side-panel{background:var(--surface);border-left:1px solid var(--border);flex-direction:column;flex:none;width:260px;display:flex}.side-head{border-bottom:1px solid var(--border);justify-content:space-between;align-items:center;padding:12px 14px;display:flex}.side-list{flex-direction:column;flex:1;gap:10px;padding:12px;display:flex;overflow:auto}.side-hint{border-top:1px solid var(--border);color:var(--muted);padding:10px 14px;font-size:.8rem}.sig-tile{border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);cursor:grab;-webkit-user-select:none;user-select:none;text-align:left;flex-direction:column;gap:4px;padding:8px;display:flex}.sig-tile:hover{border-color:var(--accent);background:var(--accent-soft)}.sig-tile:active{cursor:grabbing}.sig-tile-img{justify-content:center;align-items:center;height:70px;display:flex}.sig-tile-img img{pointer-events:none;max-width:100%;max-height:100%}.sig-tile-name{color:var(--muted);text-overflow:ellipsis;white-space:nowrap;font-size:.8rem;overflow:hidden}.sig-grid{grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:16px;display:grid}.sig-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);flex-direction:column;display:flex}.sig-card-img{border-bottom:1px solid var(--border);justify-content:center;align-items:center;height:130px;padding:12px;display:flex}.sig-card-img img{max-width:100%;max-height:100%}.sig-card-foot{align-items:center;gap:4px;padding:8px 6px 8px 12px;display:flex}.checker{background-color:#fff;background-image:linear-gradient(45deg,#eceef1 25%,#0000 25%),linear-gradient(-45deg,#eceef1 25%,#0000 25%),linear-gradient(45deg,#0000 75%,#eceef1 75%),linear-gradient(-45deg,#0000 75%,#eceef1 75%);background-position:0 0,0 8px,8px -8px,-8px 0;background-size:16px 16px}.editor{flex-direction:column;gap:14px;display:flex}.editor-row{flex-wrap:wrap;align-items:center;gap:10px;display:flex}.editor-row .spacer{flex:1}.draw-canvas{aspect-ratio:3;border:1px solid var(--border-strong);border-radius:var(--radius);cursor:crosshair;touch-action:none;background:#fff;width:100%;display:block}.draw-area{position:relative}.draw-baseline{border-bottom:1px dashed var(--border-strong);pointer-events:none;position:absolute;bottom:28%;left:8%;right:8%}.swatches{align-items:center;gap:6px;display:flex}.swatch{cursor:pointer;border:2px solid #0000;border-radius:50%;width:26px;height:26px;box-shadow:inset 0 0 0 1px #00000026}.swatch.selected{border-color:var(--surface);outline:2px solid var(--accent)}.steps{color:var(--muted);gap:8px;font-size:.85rem;display:flex}.steps .on{color:var(--accent);font-weight:600}.crop-stage{border-radius:var(--radius);-webkit-user-select:none;user-select:none;background:#2a2d33;height:calc(60vh + 24px);padding:12px;display:flex;position:relative;overflow:auto}.crop-inner{cursor:crosshair;flex:none;margin:auto;line-height:0;position:relative}.crop-inner canvas{display:block}.crop-box{cursor:move;border:2px solid #fff;position:absolute}.crop-shade{pointer-events:none;position:absolute;box-shadow:0 0 0 9999px #00000080}.crop-box .handle{background:var(--accent);border-color:#fff}.crop-clip{pointer-events:none;position:absolute;inset:0;overflow:hidden}.extract-layout{grid-template-columns:1fr 260px;align-items:start;gap:20px;display:grid}.extract-preview{border:1px solid var(--border);border-radius:var(--radius);justify-content:center;align-items:center;min-height:260px;padding:16px;display:flex}.extract-preview canvas{max-width:100%;max-height:50vh}.controls{flex-direction:column;gap:16px;display:flex}.control label{justify-content:space-between;margin-bottom:4px;font-size:.85rem;display:flex}.control .hint{color:var(--muted);margin-top:2px;font-size:.75rem}.seg{border:1px solid var(--border-strong);border-radius:var(--radius);display:inline-flex;overflow:hidden}.seg button{background:var(--surface);cursor:pointer;border:0;padding:6px 12px;font-size:.85rem}.seg button+button{border-left:1px solid var(--border-strong)}.seg button.on{background:var(--accent-soft);color:var(--accent);font-weight:500}.pdf-pages{grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:12px;display:grid}.pdf-page-pick{border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);cursor:pointer;color:var(--muted);padding:6px;font-size:.8rem}.pdf-page-pick:hover{border-color:var(--accent)}.pdf-page-pick img{width:100%;margin-bottom:4px;display:block;box-shadow:0 1px 3px #00000026}.choice-grid{grid-template-columns:1fr 1fr;gap:12px;display:grid}.choice{border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);cursor:pointer;text-align:left;flex-direction:column;gap:6px;padding:18px;display:flex}.choice:hover{border-color:var(--accent);background:var(--accent-soft)}.choice-icon{font-size:1.6rem}.page.with-note{min-height:calc(100vh - var(--header-h));padding-bottom:80px;position:relative}.local-note{text-align:center;color:var(--muted);margin:0;font-size:.85rem;position:absolute;bottom:24px;left:24px;right:24px}.date-stage{border:1px solid var(--border-strong);border-radius:var(--radius);touch-action:none;background:#fff;width:100%;position:relative;overflow:hidden}.date-layer{cursor:move;outline:1px dashed #0000;position:absolute}.date-layer:hover{outline-color:var(--border-strong)}.date-layer.selected{outline:1.5px solid var(--accent)}.date-layer img{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;display:block}
