:root{--bg:#f1f5f9;--surface:#ffffff;--surface-2:#f8fafc;--border:#e2e8f0;--text:#0f172a;--muted:#64748b;--primary:#2563eb;--primary-hover:#1d4ed8;--primary-2:#eff6ff;--danger:#b91c1c;--danger-2:#fee2e2;--success:#166534;--success-2:#dcfce7;--shadow:0 10px 30px rgba(15,23,42,0.08);--radius:14px;--header-h:56px;--toolbar-h:52px;--footer-h:56px}*{box-sizing:border-box}body{margin:0;font-family:Segoe UI,Arial,sans-serif;background:var(--bg);color:var(--text);overflow:hidden}.app-shell{display:flex;flex-direction:column;height:100dvh;min-height:100vh}.app-header{justify-content:space-between;gap:16px;height:var(--header-h);padding:0 20px;border-bottom:1px solid var(--border);background:var(--surface);flex-shrink:0}.app-header,.header-brand{display:flex;align-items:center}.header-brand{gap:10px;min-width:0}.header-brand h1{margin:0;font-size:1.1rem;font-weight:700;white-space:nowrap}.header-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}.icon-btn{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--muted);cursor:pointer;transition:background .12s ease,color .12s ease,border-color .12s ease}.icon-btn:hover{background:var(--surface-2);color:var(--text)}.icon-btn svg{width:18px;height:18px}.help-wrap{position:relative}.help-popover{position:absolute;top:calc(100% + 8px);right:0;width:min(320px,80vw);padding:14px 16px;border:1px solid var(--border);border-radius:12px;background:var(--surface);box-shadow:var(--shadow);font-size:.88rem;line-height:1.5;color:var(--muted);z-index:50}.help-popover p{margin:0 0 8px}.help-popover p:last-child{margin-bottom:0}.user-menu-wrap{position:relative}.header-link{border:none;background:transparent;color:var(--primary);font:inherit;font-weight:700;cursor:pointer;padding:8px 10px;border-radius:10px}.header-link:hover{background:var(--primary-2)}.user-trigger{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--border);border-radius:999px;padding:6px 12px 6px 10px;background:var(--surface);font:inherit;font-weight:700;color:var(--text);cursor:pointer}.user-trigger:hover{background:var(--surface-2)}.user-menu{position:absolute;top:calc(100% + 6px);right:0;min-width:140px;padding:6px;border:1px solid var(--border);border-radius:12px;background:var(--surface);box-shadow:var(--shadow);z-index:50}.user-menu button{width:100%;text-align:left;padding:10px 12px;border:none;border-radius:8px;background:transparent;font:inherit;font-weight:600;color:var(--danger);cursor:pointer}.user-menu button:hover{background:var(--danger-2)}.toolbar{gap:12px;height:auto;min-height:var(--toolbar-h);padding:8px 16px;border-bottom:1px solid var(--border);background:var(--surface);flex-shrink:0}.toolbar,.toolbar-group{display:flex;align-items:center;flex-wrap:wrap}.toolbar-group{gap:6px}.toolbar-divider{width:1px;height:24px;background:var(--border);flex-shrink:0}.toolbar-label{font-size:.78rem;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;margin-right:2px}button{border:1px solid transparent;border-radius:10px;padding:8px 12px;font:inherit;font-size:.9rem;font-weight:600;cursor:pointer;transition:background .12s ease,border-color .12s ease}button:hover:not(:disabled){filter:brightness(.98)}button:disabled{cursor:not-allowed;opacity:.55}.btn-primary{background:var(--primary);color:#fff}.btn-primary:hover:not(:disabled){background:var(--primary-hover)}.btn-secondary{background:#fff;color:var(--text);border-color:var(--border)}.btn-secondary:hover:not(:disabled){background:var(--surface-2)}.btn-danger{background:var(--danger-2);color:var(--danger);border-color:#fecaca}.btn-tool-active{background:var(--primary-2);color:var(--primary);border-color:#bfdbfe}.btn-compact{padding:7px 10px;font-size:.85rem}.toolbar input[type=color]{width:36px;height:32px;border:1px solid var(--border);border-radius:8px;padding:2px;background:#fff;cursor:pointer}.toolbar input[type=range]{width:90px}.workspace{flex:1 1;min-height:0;display:flex;flex-direction:column;background:#e8edf3}.canvas-viewport{flex:1 1;min-height:0;overflow:auto;display:flex;align-items:center;justify-content:center;padding:16px}.canvas-stage{transform-origin:center center;line-height:0}canvas{display:block;border-radius:8px;background:linear-gradient(45deg,#f8fafc 25%,transparent 0),linear-gradient(-45deg,#f8fafc 25%,transparent 0),linear-gradient(45deg,transparent 75%,#f8fafc 0),linear-gradient(-45deg,transparent 75%,#f8fafc 0);background-size:20px 20px;background-position:0 0,0 10px,10px -10px,-10px 0;touch-action:none;box-shadow:0 4px 24px rgba(15,23,42,.12)}.app-footer{display:flex;align-items:center;gap:10px;min-height:var(--footer-h);padding:10px 16px;border-top:1px solid var(--border);background:var(--surface);flex-shrink:0}.note-field{flex:1 1;min-width:0}.note-field input,.note-field textarea{width:100%;border:1px solid var(--border);border-radius:10px;padding:10px 12px;font:inherit;color:var(--text);background:#fff;resize:none;line-height:1.4}.note-field input{height:40px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.note-field textarea{min-height:40px;max-height:120px}.footer-actions{display:flex;gap:8px;flex-shrink:0}.hidden{display:none!important}.modal-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.45);display:flex;align-items:center;justify-content:center;padding:20px;z-index:100}.modal{width:min(420px,100%);max-height:min(90vh,640px);overflow:auto;border:1px solid var(--border);border-radius:16px;background:var(--surface);box-shadow:var(--shadow)}.modal-header{display:flex;align-items:center;justify-content:space-between;padding:18px 20px 0}.modal-header h2{margin:0;font-size:1.15rem}.modal-body{padding:16px 20px 20px;display:grid;grid-gap:14px;gap:14px}.modal-close{width:32px;height:32px;padding:0;border:none;border-radius:8px;background:transparent;color:var(--muted);font-size:1.4rem;line-height:1;cursor:pointer}.modal-close:hover{background:var(--surface-2);color:var(--text)}.field-stack{display:grid;grid-gap:12px;gap:12px}.field-stack label{display:grid;grid-gap:6px;gap:6px;font-size:.88rem;font-weight:600;color:var(--muted)}.field-stack input{border:1px solid var(--border);border-radius:10px;padding:11px 12px;font:inherit;color:var(--text);background:#fff}.modal-actions{display:flex;gap:10px;flex-wrap:wrap}.modal-actions .btn-primary,.modal-actions .btn-secondary{flex:1 1;min-width:120px}.modal-switch{margin:0;font-size:.88rem;color:var(--muted);text-align:center}.modal-switch button{border:none;background:none;color:var(--primary);font-weight:700;padding:0 4px;cursor:pointer}.upload-modal .drop-zone{padding:28px 20px;border:2px dashed #93c5fd;border-radius:14px;text-align:center;background:#f8fbff;color:var(--muted);cursor:pointer;transition:background .12s ease,border-color .12s ease}.upload-modal .drop-zone.dragover{background:#eff6ff;border-color:var(--primary);color:var(--primary)}.upload-modal .drop-zone strong{display:block;margin-bottom:4px;color:var(--text)}.upload-options{display:grid;grid-template-columns:1fr 1fr;grid-gap:10px;gap:10px}.toast{position:fixed;bottom:80px;left:50%;transform:translateX(-50%);max-width:min(480px,calc(100vw - 32px));padding:12px 16px;border-radius:12px;font-size:.9rem;font-weight:600;box-shadow:var(--shadow);z-index:90;animation:toast-in .2s ease}.toast.success{background:var(--success-2);color:var(--success);border:1px solid #86efac}.toast.error{background:var(--danger-2);color:var(--danger);border:1px solid #fca5a5}.toast.info{background:var(--surface);color:var(--muted);border:1px solid var(--border)}@keyframes toast-in{0%{opacity:0;transform:translateX(-50%) translateY(8px)}to{opacity:1;transform:translateX(-50%) translateY(0)}}.zoom-label{font-size:.82rem;font-weight:700;color:var(--muted);min-width:44px;text-align:center}@media (max-width:768px){.app-header{padding:0 12px}.header-brand h1{font-size:1rem}.toolbar{padding:8px 10px}.toolbar-divider{display:none}.app-footer{flex-wrap:wrap}.footer-actions{width:100%}.footer-actions button{flex:1 1}}