/* Knit v0.3 — compact blue workspace and attachment library. */
:root{--accent:#2563eb;--ink:#1e293b;--accent-bg:#eff6ff;--bold-color:#1d4ed8;--italic-color:#ea580c;--internal-link-color:#2563eb;--external-link-color:#2563eb;--unresolved-link-color:#b45309;--heading-1:#2563eb;--heading-2:#ea580c;--heading-3:#7c3aed;--heading-4:#64748b;--heading-5:#64748b;--heading-6:#64748b;--heading-bar-width:3px;--sidebar:#f8faff;--border:#e1e7f0;--muted:#64748b}
body{color:var(--ink);background:#fff}
.primary{background:var(--accent)!important;border-color:var(--accent)!important;color:#fff!important}
.primary:hover{filter:brightness(.93)}
button:hover:not(:disabled){background:#eff6ff}
.selected,.entity-item.active,.folder-item.active{background:#e8f0ff!important;color:#1d4ed8!important}
.sidebar{gap:8px;padding:11px 11px 10px;width:252px;min-width:210px;flex-basis:252px}
.sidebar-top{gap:9px;padding-right:5px}
.sidebar-top .primary{font-size:11px;padding:8px 9px;white-space:nowrap}
.knit-wordmark{color:var(--accent)!important;font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif!important;font-weight:850!important;letter-spacing:-.055em!important;line-height:1.1!important}
.brand .knit-wordmark{font-size:30px}.brand{flex:0 0 auto}
.explorer-heading{font-size:10px;letter-spacing:.08em;margin:4px 0 2px;color:#687a97}
.folder-tree{max-height:none;overflow-y:auto;min-height:80px;flex:1;gap:0;padding-right:2px}
.knit-tree-row{display:flex;align-items:center;gap:2px;height:27px;min-height:27px;border-radius:5px;white-space:nowrap;color:#334155}
.knit-tree-row:hover{background:#eff6ff}.knit-tree-row.active{background:#dbeafe;color:#1d4ed8}
.tree-arrow{width:19px;min-width:19px;height:23px;border:0;padding:0;background:transparent!important;color:#64748b;font-size:12px}
.tree-name{flex:1;display:flex;align-items:center;gap:7px;min-width:0;overflow:hidden;background:none!important;border:0;text-align:left;padding:2px 2px;font-size:12px;border-radius:0}
.tree-icon{font-size:13px;display:flex;align-items:center;justify-content:center;min-width:15px;color:#62748c}.tree-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tree-count{padding:0 5px 0 2px;font-size:10px;color:#8090a6;font-variant-numeric:tabular-nums}
.explorer-filters select{padding:6px;font-size:11px}.entity-list{min-height:0;flex:0 1 32vh;max-height:32vh}
.entity-item{padding:6px 8px}.entity-item strong{font-size:12px}.entity-item small{font-size:10px}
.search-label input{padding:9px;font-size:12px;border:1px solid #e1e7f0;box-shadow:none}
.side-nav{padding-top:8px;gap:1px}.side-nav button{padding:7px 9px;font-size:12px}
.side-nav button.selected{font-weight:650}
#tag-explorer{overflow:auto;flex:1;min-height:100px}#tag-explorer input[type=text],#tag-tree-search{width:100%;padding:7px 9px;font-size:12px;margin:4px 0}
.tag-child-toggle{font-size:11px;gap:7px;margin:4px 0}#tag-clear-filter{width:100%;margin-top:8px}
.document-body{padding-top:22px!important}.document-title-input{color:#152841;font-size:35px}
.document-topbar{height:48px;padding-left:18px}.save-status{color:#516c96!important}
#save-entity{background:transparent!important;color:#2563eb!important;border:1px solid #dbeafe!important;padding:5px 10px!important;font-size:11px}
.editor-toolbar{padding-top:6px;padding-bottom:6px;gap:6px}.format-toolbar button,.editor-switch button{font-size:12px;padding:6px 8px}
.format-toolbar button:hover,.editor-switch button:hover{background:#e7f0ff}
.visual-editor a[data-entity]{cursor:pointer!important;text-decoration:underline;text-decoration-color:#93c5fd;text-underline-offset:3px}
.markdown-preview a[data-entity]{color:var(--internal-link-color)!important;cursor:pointer}.markdown-preview a[href^=http]{color:var(--external-link-color)!important}
.unresolved-link{color:var(--unresolved-link-color)!important}
.markdown-preview strong,.visual-editor strong{color:var(--bold-color)}.markdown-preview em,.visual-editor em{color:var(--italic-color)}
.markdown-preview h1,.visual-editor h1{--heading-current:var(--heading-1)}
.markdown-preview h2,.visual-editor h2{--heading-current:var(--heading-2)}
.markdown-preview h3,.visual-editor h3{--heading-current:var(--heading-3)}
.markdown-preview h4,.visual-editor h4{--heading-current:var(--heading-4)}
.markdown-preview h5,.visual-editor h5{--heading-current:var(--heading-5)}
.markdown-preview h6,.visual-editor h6{--heading-current:var(--heading-6)}
.markdown-preview :is(h1,h2,h3,h4,h5,h6){border-left:var(--heading-bar-width) solid var(--heading-current);padding-left:10px;color:var(--ink);line-height:1.4}
.hide-heading-bar .markdown-preview :is(h1,h2,h3,h4,h5,h6){border-left:0;padding-left:0}
.visual-editor{caret-color:var(--accent)}
.markdown-preview .md-table{width:100%;border-collapse:collapse;margin:18px 0 23px;font-size:13px;line-height:1.55;background:#fff}
.md-table th,.md-table td{border:1px solid #cbd5e1;padding:9px 12px;text-align:left;vertical-align:top;min-width:60px;overflow-wrap:anywhere}
.md-table th{background:#eff6ff;color:#1e3a8a;font-weight:700}
.visual-editor .md-table{width:100%}.visual-editor .md-table :is(th,td):focus{outline:2px solid #60a5fa}
.md-callout{border-left:4px solid #2563eb;background:#eff6ff;border-radius:5px;margin:16px 0 19px;padding:10px 14px;color:#233a60}
.md-callout .callout-title{font-weight:700;font-size:14px;margin-bottom:6px;display:block}
.md-callout .callout-body :first-child{margin-top:0}.md-callout .callout-body :last-child{margin-bottom:0}
.md-callout.callout-tip,.md-callout.callout-success{background:#eff6ff;border-color:var(--callout-tip-color);color:#1e40af}
.md-callout.callout-warning,.md-callout.callout-important{background:#fffbeb;border-color:#d97706;color:#92400e}
.md-callout.callout-danger,.md-callout.callout-failure,.md-callout.callout-bug{background:#fef2f2;border-color:#dc2626;color:#991b1b}
.md-callout.callout-question,.md-callout.callout-example{background:#faf5ff;border-color:#7c3aed;color:#6b21a8}
.md-callout.callout-quote{background:#f8fafc;border-color:#64748b;color:#334155}
.visual-editor .md-callout .callout-body{min-height:22px}
#toast{background:#1e3a8a!important;color:#fff!important;right:20px;top:20px;border:1px solid #93c5fd;box-shadow:0 9px 28px #0f172a25;z-index:9999;opacity:0;max-width:min(430px,calc(100vw - 30px));line-height:1.45}
#toast.error{background:#991b1b!important;color:#fff!important;border-color:#fca5a5!important}
.inspector{background:#fff}.inspector-header,.inspector-section summary{color:#284366}.inspector-section{border-color:#e6ecf4}
.attachment-library-page{padding:25px 25px 60px;max-width:1500px;margin:auto}
.library-toolbar{display:flex;gap:8px;align-items:center;margin:17px 0 12px;flex-wrap:wrap}.library-toolbar input{flex:1 1 260px;max-width:540px}.library-toolbar select{width:155px}
.library-shell{display:grid;grid-template-columns:minmax(0,1fr) minmax(240px,320px);gap:18px;margin-top:15px;align-items:start}
.library-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:12px}
.library-card{display:flex;flex-direction:column;gap:8px;padding:9px;min-width:0;text-align:left;background:#fff;border:1px solid #e2e8f0;border-radius:9px}
.library-card:hover,.library-card.selected{border-color:#60a5fa;background:#eff6ff}
.library-card img{width:100%;height:130px;object-fit:contain;background:#f8fafc;border-radius:5px}
.library-card-info{display:flex;flex-direction:column;gap:4px;min-width:0}.library-card-info strong{font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.library-card-info small{font-size:10px;color:#64748b}
.library-grid.is-list{grid-template-columns:1fr;gap:4px}.library-grid.is-list .library-card{flex-direction:row;align-items:center}.library-grid.is-list .library-card img{width:62px;height:56px}
.library-detail{position:sticky;top:12px;padding:15px;background:#f8faff;border:1px solid #e2e8f0;border-radius:10px;overflow-wrap:anywhere}
.library-detail h3{font-size:16px;margin:10px 0}.library-detail .muted{font-size:11px;line-height:1.6}.library-large-preview{width:100%;max-height:300px;object-fit:contain;border-radius:6px;background:#fff}
.library-detail-buttons{display:flex;gap:6px;flex-wrap:wrap;margin:13px 0}.library-detail-buttons button{font-size:11px}
.library-usage{border-top:1px solid #e2e8f0;padding-top:12px;margin-top:14px}.library-usage h4{margin:4px 0 9px;font-size:13px}.library-usage-link{width:100%;padding:7px;border:0;text-align:left;color:#2563eb;font-size:12px;background:transparent}
#library-more{margin:18px 0}
.appearance-color-row{display:flex;flex-direction:row;align-items:center;justify-content:space-between;min-height:38px}
.appearance-color-row input{height:32px;width:80px;padding:1px}.appearance-preview{padding:14px 20px;border:1px solid #e2e8f0;border-radius:8px;background:#fff}
:root[data-density=compact] .sidebar{gap:6px}:root[data-density=compact] .knit-tree-row{height:25px;min-height:25px}
:root[data-density=spacious] .knit-tree-row{height:37px;min-height:37px}
:root[data-note-width=focused] .document-body{max-width:680px}:root[data-note-width=medium] .document-body{max-width:850px}:root[data-note-width=wide] .document-body{max-width:1220px}
@media(max-width:1050px){.library-shell{grid-template-columns:1fr}.library-detail{position:static}}
@media(max-width:610px){.sidebar{max-width:none!important;flex-basis:auto}.library-shell{grid-template-columns:1fr}.attachment-library-page{padding:15px 8px}.library-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.library-toolbar select{width:100%}.folder-tree,#tag-explorer{display:none!important}}

.note-tabs{display:flex;gap:4px;align-items:center;padding:5px 10px;max-width:100%;overflow:auto;border-bottom:1px solid var(--border)}
.note-tab{display:flex;align-items:center;gap:2px;background:#f3f6fb;border:1px solid #e1e8f3;border-radius:6px 6px 0 0;max-width:190px}
.note-tab.active{background:#eff6ff;border-color:#bfdbfe;border-bottom-color:#2563eb}
.note-tab-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;max-width:155px;border:0;background:transparent!important;font-size:11px;padding:6px 8px}
.note-tab-close{border:0;padding:4px 7px;background:transparent!important;color:#64748b}
.inline-tag.clickable-tag{cursor:pointer}.inline-tag.clickable-tag:hover{text-decoration:underline;color:#2563eb}

:root{--callout-note-color:#2563eb;--callout-tip-color:#2563eb;--callout-warning-color:#d97706;--callout-danger-color:#dc2626;--body-font-size:15px}
.markdown-preview,.visual-editor{font-size:var(--body-font-size)}
:root[data-font-family=serif] .markdown-preview,:root[data-font-family=serif] .visual-editor{font-family:Georgia,Cambria,'Times New Roman',serif}
.md-callout.callout-note,.md-callout.callout-info,.md-callout.callout-abstract{border-color:var(--callout-note-color)}
.md-callout.callout-tip,.md-callout.callout-success{border-color:var(--callout-tip-color)}
.md-callout.callout-warning,.md-callout.callout-important{border-color:var(--callout-warning-color)}
.md-callout.callout-danger,.md-callout.callout-failure,.md-callout.callout-bug{border-color:var(--callout-danger-color)}
.inline-tag,.tag-chip{background:#eaf1ff!important;color:#1d4ed8!important}
.relationship-row{background:#f1f6ff!important}.relationship-row .relationship-label,.edge-direction,.entity-link{color:#2563eb!important}
.brand-expand{color:#334e80}.brand-tagline{color:#607da8}
