:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #70757a;
  --line: #e5e7eb;
  --soft-line: #f0f1f2;
  --sidebar: #f7f8f9;
  --panel: #ffffff;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eaf1ff;
  --danger: #b42318;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; color: var(--ink); background: white; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.compact { font-size: 11px; }
.toolbar { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.button { min-height: 36px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; font-weight: 650; }
.button:hover { background: #f7f8fa; }
.button.primary { color: white; border-color: var(--accent); background: var(--accent); }
.button.primary:hover { background: var(--accent-hover); }
.button.quiet { background: white; }
.button.wide { width: 100%; }
.button.icon-only { width: 36px; padding: 0; font-size: 18px; }
.icon-button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; color: var(--muted); background: transparent; }
.icon-button:hover { color: var(--ink); background: #e9ebee; }
.eyebrow { margin-bottom: 8px; color: var(--accent); font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }

/* Authentication */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1fr) minmax(420px, 560px); overflow: auto; background: #f6f7f9; }
.auth-story { min-height: 100vh; padding: clamp(42px, 7vw, 100px); display: flex; flex-direction: column; justify-content: space-between; color: white; background: #172033; }
.auth-brand { font-size: 21px; font-weight: 780; }
.auth-story h1 { margin: 0 0 24px; font-size: clamp(42px, 5.5vw, 78px); line-height: 1.02; letter-spacing: -.055em; }
.auth-story p { max-width: 570px; margin: 0; color: #cbd5e1; font-size: 18px; line-height: 1.7; }
.auth-card { width: calc(100% - 64px); max-width: 480px; align-self: center; justify-self: center; margin: 32px; padding: 36px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 24px 80px rgba(15, 23, 42, .08); }
.auth-card h2 { margin: 0 0 12px; font-size: 30px; letter-spacing: -.03em; }
.auth-card > p { line-height: 1.6; }
.stack { display: grid; gap: 15px; margin-top: 24px; }
label { display: grid; gap: 7px; color: #4b5563; font-size: 13px; font-weight: 650; }
input, select { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; color: var(--ink); background: white; }
input:focus, select:focus { outline: 3px solid rgba(37, 99, 235, .14); border-color: var(--accent); }
.secret { overflow-wrap: anywhere; padding: 14px; border: 1px solid #cbd5e1; border-radius: 10px; background: #f8fafc; }
.totp-enrollment { display: grid; gap: 12px; }
.totp-qr { display: grid; justify-items: center; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; text-align: center; }
.totp-qr img { display: block; width: min(232px, 100%); height: auto; image-rendering: pixelated; }
.totp-qr span { font-size: 12px; }
.secret summary { cursor: pointer; color: var(--accent); font-weight: 700; }
.totp-secret { margin: 12px 0 6px; font-weight: 750; letter-spacing: .08em; }
.codes { columns: 2; margin: 22px 0; padding: 18px 22px; border-radius: 10px; color: #e2e8f0; background: #172033; font: 700 14px/2 ui-monospace; }

/* Knowledge base + four-way dock */
.library-shell { --dock-top-track: 60px; --dock-left-track: 272px; --dock-right-track: 420px; --dock-bottom-track: 40px; height: 100vh; position: relative; display: grid; grid-template-columns: var(--dock-left-track) minmax(320px, 1fr) var(--dock-right-track); grid-template-rows: var(--dock-top-track) minmax(0, 1fr) var(--dock-bottom-track); overflow: hidden; background: #f4f5f6; }
.dock { min-width: 0; min-height: 0; position: relative; z-index: 4; display: flex; overflow: hidden; background: #f4f5f6; }
.dock-top { grid-column: 1 / 4; grid-row: 1; flex-direction: column; overflow: visible; border-bottom: 1px solid var(--line); background: white; }
.dock-left { grid-column: 1; grid-row: 2 / 4; flex-direction: row; border-right: 1px solid var(--line); }
.dock-right { grid-column: 3; grid-row: 2; flex-direction: row; border-left: 1px solid var(--line); }
.dock-bottom { grid-column: 2; grid-row: 3; flex-direction: column; border-top: 1px solid var(--line); }
.dock.peek { z-index: 30; overflow: visible; }
.dock-panel { min-width: 0; min-height: 0; flex: 1; display: flex; flex-direction: column; overflow: hidden; background: white; }
.dock-panel-body { min-width: 0; min-height: 0; flex: 1; overflow: auto; }
.dock-left .dock-panel-body { padding-bottom: 46px; }
.dock-rail { flex: none; display: flex; align-items: stretch; background: #f1f2f4; }
.dock-left .dock-rail, .dock-right .dock-rail { width: 43px; flex-direction: column; }
.dock-top .dock-rail, .dock-bottom .dock-rail { height: 39px; flex-direction: row; }
.dock-top .dock-rail { width: 100%; height: 59px; justify-content: flex-end; background: white; }
.dock-tab { padding: 5px 3px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; color: #6f7782; background: transparent; font-size: 10px; font-weight: 680; user-select: none; }
.dock-left .dock-tab, .dock-right .dock-tab { width: 43px; min-height: 82px; border-left: 2px solid transparent; }
.dock-top .dock-tab, .dock-bottom .dock-tab { width: 72px; height: 39px; border-top: 2px solid transparent; }
.dock-top .dock-tab { height: 59px; }
.dock-tab:hover { color: #253247; background: #e4e7eb; }
.dock-tab.active { color: #174ea6; background: #e5ecf8; }
.dock-left .dock-tab.active, .dock-right .dock-tab.active { border-left-color: var(--accent); }
.dock-top .dock-tab.active, .dock-bottom .dock-tab.active { border-top-color: var(--accent); }
.dock-tab.dragging { opacity: .4; }
.dock-tab .tool-icon { flex: none; font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.dock-left .tool-label, .dock-right .tool-label { writing-mode: vertical-rl; letter-spacing: .08em; }
.dock-top .tool-label, .dock-bottom .tool-label { line-height: 1; white-space: nowrap; }
.dock-drop-hint { display: none; place-items: center; color: #9aa0a6; border: 1px dashed #b8bec7; border-radius: 6px; pointer-events: none; }
.dock.empty .dock-drop-hint, .dock-rail.drag-over .dock-drop-hint { display: grid; }
.dock-left .dock-drop-hint, .dock-right .dock-drop-hint { width: 30px; height: 46px; margin: 8px 6px; }
.dock-top .dock-drop-hint, .dock-bottom .dock-drop-hint { width: 48px; height: 28px; margin: 5px 7px; }
.dock-top .dock-drop-hint { margin-top: 15px; }
.dock-rail.drag-over { background: #dfe9fb; outline: 2px solid #7aa2e8; outline-offset: -2px; }

.dock.peek .dock-panel { position: absolute; z-index: 2; border: 1px solid var(--line); box-shadow: 0 18px 45px rgba(31, 41, 55, .2); }
.dock-left.peek .dock-panel { width: calc(var(--dock-left-size) - 44px); top: 0; bottom: 0; left: 43px; }
.dock-right.peek .dock-panel { width: calc(var(--dock-right-size) - 44px); top: 0; right: 43px; bottom: 0; }
.dock-top .dock-panel { position: absolute; z-index: 2; height: calc(var(--dock-top-size) - 60px); top: 59px; right: 0; left: 0; border: 1px solid var(--line); box-shadow: 0 18px 45px rgba(31, 41, 55, .2); }
.dock-top.open .dock-panel { height: calc(var(--dock-top-size) - 60px); box-shadow: none; }
.dock-top.peek .dock-panel { height: calc(var(--dock-top-size) - 60px); top: 59px; right: 0; left: 0; }
.dock-bottom.peek .dock-panel { height: calc(var(--dock-bottom-size) - 40px); right: 0; bottom: 39px; left: 0; }

.dock-resize-handle { position: absolute; z-index: 35; touch-action: none; }
.dock-resize-handle:after { content: ''; position: absolute; background: transparent; transition: background .12s; }
.dock-resize-handle:hover:after, body.resizing-sidebar .dock-resize-handle:after { background: var(--accent); }
.dock-resize-handle.left-handle, .dock-resize-handle.right-handle { width: 7px; top: 0; bottom: 0; cursor: col-resize; }
.dock-resize-handle.top-handle, .dock-resize-handle.bottom-handle { height: 7px; right: 0; left: 0; cursor: row-resize; }
.dock-resize-handle.left-handle { right: 0; }
.dock-resize-handle.right-handle { left: 0; }
.dock-resize-handle.top-handle { bottom: 0; }
.dock-resize-handle.bottom-handle { top: 0; }
.dock.peek .dock-resize-handle.left-handle { left: calc(var(--dock-left-size) - 4px); right: auto; }
.dock.peek .dock-resize-handle.right-handle { right: calc(var(--dock-right-size) - 4px); left: auto; }
.dock.peek .dock-resize-handle.top-handle { top: calc(var(--dock-top-size) - 4px); bottom: auto; }
.dock.peek .dock-resize-handle.bottom-handle { bottom: calc(var(--dock-bottom-size) - 4px); top: auto; }
body.resizing-sidebar { cursor: col-resize; user-select: none; }
body.resizing-sidebar iframe { pointer-events: none; }

.document-navigation-panel { height: 100%; min-width: 0; display: flex; flex-direction: column; background: var(--sidebar); }
.site-library-header { height: 60px; padding: 7px 8px; position: relative; z-index: 20; display: grid; grid-template-columns: minmax(0,1fr) 28px; align-items: center; gap: 4px; }
.site-switcher { min-width: 0; height: 46px; padding: 5px 7px; display: grid; grid-template-columns: 32px minmax(0,1fr) 14px; align-items: center; gap: 8px; border: 0; border-radius: 9px; color: var(--ink); text-align: left; background: transparent; }
.site-switcher:hover, .site-switcher[aria-expanded=true] { background: #e9ebee; }
.site-switcher > span:nth-child(2), .site-option > span:nth-child(2) { min-width: 0; }
.site-switcher small, .site-switcher strong, .site-option small, .site-option strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-switcher small { color: var(--muted); font-size: 9px; font-weight: 650; }
.site-switcher strong { margin-top: 1px; font-size: 13px; }
.site-switcher > b { color: #7b818a; font-size: 11px; }
.site-switcher-menu { width: calc(100% - 16px); max-height: min(420px, calc(100vh - 90px)); padding: 6px; position: absolute; top: 55px; left: 8px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; background: white; box-shadow: 0 18px 50px rgba(31,41,55,.22); }
.site-option { width: 100%; min-width: 0; padding: 8px; display: grid; grid-template-columns: 32px minmax(0,1fr) 18px; align-items: center; gap: 9px; border: 0; border-radius: 8px; color: var(--ink); text-align: left; background: transparent; }
.site-option:hover, .site-option.active { background: #eef4ff; }
.site-option strong { font-size: 12px; }
.site-option small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.site-option > b { color: var(--accent); }
.site-option.create { margin-top: 5px; border-top: 1px solid var(--soft-line); border-radius: 0 0 8px 8px; }
.library-brand { height: 60px; padding: 0 14px; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: white; background: #1f2937; font-size: 14px; font-weight: 800; }
.library-brand strong { font-size: 16px; }
.sidebar-create { margin-left: auto; font-size: 19px; }
.search-box { margin: 2px 12px 12px; position: relative; display: block; }
.search-box span { position: absolute; left: 10px; top: 7px; color: #8a9099; font-size: 19px; }
.search-box input { height: 34px; padding: 7px 10px 7px 32px; border-color: transparent; background: #eceef1; }
.search-box input:focus { border-color: #cbd5e1; outline: 0; background: white; }
.document-tree { min-height: 0; flex: 1; overflow: auto; padding: 2px 8px 24px; }
.tree-group { margin-bottom: 16px; }
.tree-group-title { min-height: 30px; padding: 4px 5px 4px 9px; display: flex; align-items: center; gap: 8px; color: #6b7280; font-size: 11px; font-weight: 750; letter-spacing: .055em; text-transform: uppercase; }
.group-toggle { min-width: 0; min-height: 28px; flex: 1; padding: 0; display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: center; gap: 5px; border: 0; color: inherit; text-align: left; background: transparent; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.group-toggle > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-toggle small { color: #9aa0a6; font-size: 10px; }
.chevron { font-size: 16px; line-height: 1; }
.tree-document-entry { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 28px; align-items: center; border-radius: 7px; }
.tree-document-entry:hover { background: #e9ebee; }
.tree-document-entry.active { color: #174ea6; background: #e4ecfa; font-weight: 650; }
.tree-document, .tree-add { width: 100%; min-height: 35px; padding: 7px 9px; display: flex; align-items: center; gap: 8px; border: 0; border-radius: 7px; color: inherit; text-align: left; background: transparent; }
.tree-add:hover { background: #e9ebee; }
.tree-document > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-menu-trigger { width: 25px; height: 25px; padding: 0; border: 0; border-radius: 5px; color: #7b818a; background: transparent; opacity: 0; }
.tree-document-entry:hover .document-menu-trigger, .tree-document-entry.active .document-menu-trigger, .document-menu-trigger[aria-expanded=true] { opacity: 1; }
.document-menu-trigger:hover { color: var(--ink); background: rgba(255,255,255,.8); }
.document-context-menu { width: 210px; padding: 5px; position: absolute; z-index: 15; top: 30px; right: 2px; display: grid; border: 1px solid var(--line); border-radius: 9px; background: white; box-shadow: 0 12px 35px rgba(31,41,55,.18); }
.document-context-menu button { padding: 9px 10px; border: 0; border-radius: 6px; color: var(--ink); text-align: left; background: transparent; }
.document-context-menu button:hover { background: #f2f4f6; }
.document-context-menu strong, .document-context-menu small { display: block; }
.document-context-menu strong { font-size: 12px; }
.document-context-menu small { margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 500; }
.document-icon { width: 17px; color: #8a9099; text-align: center; }
.tree-add { color: #7b818a; font-size: 12px; }
.tree-empty { padding: 20px 12px; color: var(--muted); font-size: 13px; }
.tree-site { margin-bottom: 14px; }
.site-row { min-height: 36px; display: grid; grid-template-columns: minmax(0,1fr) 28px; align-items: center; }
.site-toggle { min-width: 0; padding: 7px 6px; display: grid; grid-template-columns: 14px minmax(0,1fr) auto; align-items: center; gap: 6px; border: 0; color: #253247; text-align: left; background: transparent; }
.site-toggle strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.site-toggle small { color: #9aa0a6; font-size: 9px; font-weight: 650; }
.site-modules { margin-left: 12px; padding-left: 5px; border-left: 1px solid #dfe3e8; }
.tree-module { margin: 2px 0 10px; }
.view-kind { width: 20px; height: 20px; flex: none; display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(15,23,42,.08); border-radius: 6px; color: white; background: #64748b; font: 750 9px/1 ui-monospace; }
.view-kind.app { background: #2563eb; }
.view-kind.page { background: #7c3aed; }
.view-kind.resource { background: #b45309; }
.view-kind.logo-loaded { background: white; }
.view-logo { width: 100%; height: 100%; display: none; padding: 2px; object-fit: contain; }
.view-kind.logo-loaded .view-logo { display: block; }
.view-kind.logo-loaded .view-kind-fallback { display: none; }
.tree-document { display: grid; grid-template-columns: 20px minmax(0,1fr) 8px; }
.visibility-dot { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; }
.visibility-dot.public { background: #16a34a; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: white; background: #475569; font-weight: 750; }
.global-account { width: 43px; height: 39px; position: absolute; z-index: 46; bottom: 0; left: 0; }
.global-account-trigger { width: 43px; height: 39px; padding: 0; display: grid; place-items: center; border: 0; border-top: 1px solid var(--line); border-right: 1px solid var(--line); background: #f1f2f4; }
.global-account-trigger:hover, .global-account:focus-within .global-account-trigger { background: #e4e7eb; }
.account-avatar { width: 25px; height: 25px; font-size: 10px; }
.account-popover { width: 250px; padding: 8px; position: absolute; bottom: 0; left: 50px; visibility: hidden; opacity: 0; pointer-events: none; border: 1px solid var(--line); border-radius: 11px; background: white; box-shadow: 0 16px 45px rgba(31,41,55,.22); transform: translateX(-4px); transition: opacity .1s ease, transform .1s ease, visibility .1s; }
.account-popover::before { content: ''; width: 9px; position: absolute; top: 0; bottom: 0; left: -9px; }
.global-account:hover .account-popover, .global-account:focus-within .account-popover { visibility: visible; opacity: 1; pointer-events: auto; transform: translateX(0); }
.account-popover-user { min-width: 0; padding: 7px 8px 10px; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 9px; border-bottom: 1px solid var(--soft-line); }
.account-popover-user strong, .account-popover-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-popover-user small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.account-popover-actions { padding-top: 5px; display: grid; gap: 2px; }
.account-language { display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 10px;border-top:1px solid var(--line);border-bottom:1px solid var(--line);font-size:12px;color:var(--muted); }
.account-language select { width:auto;min-width:112px;padding:6px 28px 6px 9px;border:1px solid var(--line);border-radius:8px;background:#fff;color:var(--ink); }
.check-row{display:flex!important;align-items:flex-start;gap:10px}.check-row input{width:auto!important;margin-top:4px}.check-row span{display:grid;gap:2px}.check-row small{font-weight:400;color:var(--muted)}
.account-popover-actions button { padding: 9px 10px; border: 0; border-radius: 7px; color: var(--ink); text-align: left; background: transparent; }
.account-popover-actions button:hover { background: #f1f3f5; }
.account-popover-actions span, .account-popover-actions small { display: block; }
.account-popover-actions span { font-size: 12px; font-weight: 680; }
.account-popover-actions small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.account-popover-actions .danger-row { color: var(--danger); }

.document-workspace { min-width: 0; min-height: 0; grid-column: 2; grid-row: 2; display: grid; grid-template-rows: minmax(0, 1fr); background: #f5f6f7; }
.document-header { min-width: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr) max-content minmax(0, 1fr); align-items: center; border-bottom: 1px solid var(--line); background: white; }
.dock-top > .document-header { width: 100%; height: 59px; flex: none; border-bottom: 0; }
.document-heading { min-width: 0; padding: 0 16px; }
.document-heading .breadcrumb { margin-bottom: 2px; color: var(--muted); font-size: 11px; }
.document-heading h1 { overflow: hidden; margin: 0; font-size: 16px; font-weight: 720; text-overflow: ellipsis; white-space: nowrap; }
.document-title-line { min-width: 0; display: flex; align-items: center; gap: 7px; }
.document-title-line h1 { min-width: 0; }
.title-open-button { width: 28px; height: 28px; min-height: 28px; flex: none; padding: 0; font-size: 15px; }
.document-center-controls { padding: 0 10px; display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.view-switch { padding: 3px; display: flex; gap: 2px; border-radius: 8px; background: #eef0f2; }
.view-switch button { height: 30px; padding: 0 10px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 650; }
.view-switch button.active { color: var(--ink); background: white; box-shadow: 0 1px 3px rgba(31, 41, 55, .12); }
.view-switch button:disabled { cursor: default; opacity: .65; }
.document-viewer { min-width: 0; min-height: 0; padding: 18px; }
.document-viewer iframe { width: 100%; height: 100%; display: block; border: 1px solid #dfe2e5; border-radius: 8px; background: white; box-shadow: 0 3px 15px rgba(31, 41, 55, .05); }
.document-viewer.draft-viewer { display: grid; grid-template-rows: 32px minmax(0, 1fr); }
.draft-viewer iframe { border-top-left-radius: 0; border-top-right-radius: 0; }
.draft-banner { padding: 7px 12px; border: 1px solid #bfdbfe; border-bottom: 0; border-radius: 8px 8px 0 0; color: #1e40af; background: #eff6ff; font-size: 11px; font-weight: 650; }
.source-viewer { min-width: 0; min-height: 0; margin: 18px; display: grid; grid-template-rows: 46px minmax(0, 1fr); overflow: hidden; border: 1px solid #dfe2e5; border-radius: 8px; background: #0f172a; }
.source-header { padding: 0 12px 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #d1d5db; border-bottom: 1px solid #334155; background: #1e293b; font-size: 11px; }
.source-header > div { min-width: 0; display: flex; align-items: center; gap: 8px; }
.source-path { overflow: hidden; color: #f1f5f9; text-overflow: ellipsis; white-space: nowrap; }
.language-badge { padding: 3px 6px; border: 1px solid #475569; border-radius: 5px; color: #93c5fd; font: 700 9px/1 ui-monospace; }
.source-tools { flex: none; color: #94a3b8; }
.source-tools button { padding: 5px 7px; border: 1px solid #475569; border-radius: 5px; color: #cbd5e1; background: transparent; font-size: 10px; }
.source-tools button:hover { color: white; border-color: #64748b; }
.source-viewer pre { min-width: 0; min-height: 0; overflow: auto; margin: 0; padding: 14px 0 30px; color: #dbe5f3; font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 2; counter-reset: line; }
.source-viewer code { display: block; min-width: max-content; }
.code-line { min-height: 21px; display: block; padding: 0 22px 0 66px; position: relative; white-space: pre; }
.code-line:before { content: attr(data-line); width: 42px; position: absolute; left: 0; color: #526178; text-align: right; user-select: none; }
.code-line:hover { background: #17233a; }
.source-viewer.wrap code { min-width: 0; }
.source-viewer.wrap .code-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.token.comment { color: #64748b; font-style: italic; }
.token.string { color: #a7f3d0; }
.token.property { color: #93c5fd; }
.token.number { color: #fbbf87; }
.token.keyword { color: #c4b5fd; font-weight: 650; }
.token.identifier { color: #dbe5f3; }
.token.punctuation { color: #94a3b8; }
.token.tag { color: #f9a8d4; }
.unpublished-document, .empty-library { min-width: 0; min-height: 0; display: grid; place-items: center; padding: 30px; }
.resource-landing { min-width: 0; min-height: 0; display: grid; place-items: center; padding: 40px; }
.resource-landing > div { max-width: 520px; text-align: center; }
.resource-landing h1 { margin: 14px 0 9px; letter-spacing: -.03em; }
.resource-landing p { margin: 0 0 22px; color: var(--muted); line-height: 1.65; }
.resource-glyph { width: 62px; height: 62px; margin: auto; display: grid; place-items: center; border-radius: 15px; color: white; background: #b45309; font: 800 24px/1 ui-monospace; }
.resource-browser { min-width: 0; min-height: 0; margin: 18px; display: grid; grid-template-columns: minmax(230px, 32%) minmax(0,1fr); overflow: hidden; border: 1px solid #dfe2e5; border-radius: 9px; background: white; box-shadow: 0 3px 15px rgba(31,41,55,.05); }
.resource-browser > aside { min-width: 0; min-height: 0; display: grid; grid-template-rows: 48px minmax(0,1fr); border-right: 1px solid var(--line); background: #fafbfc; }
.resource-browser-title { padding: 0 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); }
.resource-browser-title strong { font-size: 12px; }
.resource-browser-title small { color: var(--muted); font-size: 9px; }
.resource-main-tree { min-height: 0; overflow: auto; padding: 8px; }
.resource-preview { min-width: 0; min-height: 0; display: grid; grid-template-rows: 48px minmax(0,1fr); background: white; }
.resource-preview > header { min-width: 0; padding: 0 12px 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.resource-preview > header > div { min-width: 0; }
.resource-preview > header strong, .resource-preview > header small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resource-preview > header strong { font: 700 11px/1.4 ui-monospace; }
.resource-preview > header small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.resource-preview > header .button { min-height: 30px; padding: 5px 9px; font-size: 10px; }
.resource-image-preview { min-width: 0; min-height: 0; overflow: auto; display: grid; place-items: center; padding: 28px; background: repeating-conic-gradient(#f3f4f6 0 25%,#fff 0 50%) 50%/20px 20px; }
.resource-image-preview img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 8px 18px rgba(31,41,55,.12)); }
.resource-preview.code { background: #0f172a; }
.resource-preview.code > header { color: #e2e8f0; border-color: #334155; background: #1e293b; }
.resource-preview.code > header small { color: #94a3b8; }
.resource-preview.code > header .button { color: #dbeafe; border-color: #475569; background: transparent; }
.resource-preview.code pre { min-width: 0; min-height: 0; overflow: auto; margin: 0; padding: 14px 0 28px; color: #dbe5f3; font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; }
.resource-preview.code code { display: block; min-width: max-content; }
.resource-preview-empty { min-width: 0; min-height: 0; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 28px; color: var(--muted); text-align: center; }
.resource-preview-empty p { max-width: 420px; margin: 0; line-height: 1.6; }
.access-panel { padding: 16px; display: grid; gap: 15px; }
.access-callout { padding: 14px; border: 1px solid #bed2fa; border-radius: 10px; background: #eef4ff; }
.access-callout strong { font-size: 12px; }
.access-callout p { margin: 6px 0 0; color: #52627a; font-size: 11px; line-height: 1.55; }
.url-card { min-width: 0; padding: 12px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px 10px; border: 1px solid var(--line); border-radius: 9px; }
.url-card span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.url-card code { min-width: 0; grid-column: 1; overflow-wrap: anywhere; font-size: 10px; line-height: 1.5; }
.url-card button { grid-column: 2; grid-row: 1 / 3; border: 0; color: var(--accent); background: transparent; font-size: 11px; font-weight: 700; }
.url-card.public { border-color: #bde3ca; background: #f3fbf6; }
.url-card.disabled { color: var(--muted); background: #fafafa; }
.url-card.disabled p { grid-column: 1 / 3; margin: 0; font-size: 11px; }
.empty-page, .empty-library > div { max-width: 460px; text-align: center; }
.empty-page-icon { width: 54px; height: 66px; margin: 0 auto 18px; display: grid; place-items: center; border: 1px solid #cbd0d6; border-radius: 7px; color: #9aa0a6; background: white; font-size: 26px; }
.empty-page h2, .empty-library h1 { margin: 0 0 10px; letter-spacing: -.025em; }
.empty-page p, .empty-library p { margin: 0 0 22px; color: var(--muted); line-height: 1.6; }

.inspector { min-width: 0; position: relative; grid-column: 3; display: flex; border-left: 1px solid var(--line); background: white; overflow: hidden; }
.rail-only { justify-content: flex-end; background: #f8f9fa; }
.floating-inspector { width: var(--right-panel-width); position: absolute; z-index: 30; top: 0; right: 0; bottom: 0; box-shadow: -12px 0 32px rgba(31, 41, 55, .16); }
.empty-inspector { background: #fafafa; }
.sidebar-resize-handle { width: 7px; position: absolute; z-index: 35; top: 0; bottom: 0; touch-action: none; cursor: col-resize; }
.sidebar-resize-handle:after { content: ''; width: 1px; position: absolute; top: 0; bottom: 0; background: transparent; transition: background .12s; }
.sidebar-resize-handle:hover:after, body.resizing-sidebar .sidebar-resize-handle:after { background: var(--accent); }
.left-handle { right: 0; }
.left-handle:after { right: 0; }
.right-handle { left: 0; }
.right-handle:after { left: 0; }
body.resizing-sidebar { cursor: col-resize; user-select: none; }
body.resizing-sidebar iframe { pointer-events: none; }
.inspector-panel { min-width: 0; min-height: 0; flex: 1; display: flex; flex-direction: column; background: white; }
.inspector-panel-header { height: 48px; flex: none; padding: 0 10px 0 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.inspector-panel-header strong { font-size: 12px; }
.inspector-panel-header .icon-button { font-size: 18px; }
.inspector-panel-body { min-width: 0; min-height: 0; flex: 1; overflow: auto; }
.inspector-rail { width: 43px; min-height: 0; flex: none; display: flex; flex-direction: column; align-items: stretch; border-left: 1px solid var(--line); background: #f4f5f6; }
.inspector-rail button { width: 43px; min-height: 90px; padding: 8px 0; display: flex; align-items: center; justify-content: flex-start; gap: 6px; border: 0; border-left: 2px solid transparent; color: #6f7782; background: transparent; font-size: 11px; font-weight: 680; }
.inspector-rail button:hover { color: #253247; background: #e9ebee; }
.inspector-rail button.active { color: #174ea6; border-left-color: var(--accent); background: #e8eef9; }
.inspector-rail button:disabled { color: #b1b6bd; cursor: default; }
.inspector-rail button > span:last-child { writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: .05em; }
.inspector-rail .tool-icon { font-size: 13px; line-height: 1; }
.inspector-body { padding: 20px; }
.metadata { margin: 0; }
.metadata > div { padding: 10px 0; display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; border-bottom: 1px solid var(--soft-line); }
.metadata dt { color: var(--muted); font-size: 12px; }
.metadata dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 13px; }
.status-dot { width: 7px; height: 7px; margin-right: 7px; display: inline-block; border-radius: 50%; background: #9ca3af; }
.status-dot.published { background: #22a06b; }
.inspector-actions { margin-top: 20px; display: grid; }
.text-button { padding: 9px 0; border: 0; color: var(--accent); text-align: left; background: transparent; font-size: 13px; }
.text-button:hover { text-decoration: underline; }
.references-panel { padding: 16px 14px 32px; }
.references-panel section + section { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.references-panel h3 { margin: 0 2px 12px; color: #374151; font-size: 13px; }
.references-panel h3 span { margin-left: 4px; color: #9ca3af; font-weight: 600; }
.relation-card { margin-bottom: 12px; padding: 13px; border: 1px solid #dfe3e8; border-radius: 10px; background: #fafbfc; }
.relation-card.inbound { border-left: 3px solid #8b5cf6; }
.relation-card.outbound { border-left: 3px solid #2563eb; }
.relation-direction { display: grid; grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr); align-items: center; gap: 6px; }
.relation-direction > div, .relation-direction > button { min-width: 0; padding: 8px; border: 1px solid #e5e7eb; border-radius: 7px; color: var(--ink); text-align: left; background: white; }
.relation-direction > button:not(:disabled):hover { border-color: #93b4ed; background: #f5f8ff; }
.relation-direction span, .relation-direction strong { display: block; }
.relation-direction > div > span, .relation-direction > button > span { margin-bottom: 3px; color: var(--muted); font-size: 9px; }
.relation-direction strong { overflow-wrap: anywhere; font-size: 12px; line-height: 1.35; }
.direction-arrow { color: #8090a4; text-align: center; }
.relation-meta { margin: 9px 0; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; color: var(--muted); font-size: 9px; }
.relation-meta > span:not(.alias-badge) { padding: 3px 6px; border-radius: 999px; background: #eef0f3; }
.alias-badge { padding: 3px 6px; border-radius: 5px; color: #1e40af; background: #dbeafe; font-size: 10px; }
.resource-flow-list { display: grid; gap: 7px; }
.resource-flow { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr); align-items: stretch; gap: 5px; }
.resource-flow > div { min-width: 0; padding: 8px; border-radius: 6px; background: white; }
.resource-flow > div > span { display: block; margin-bottom: 4px; color: #8a929e; font-size: 8px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.resource-flow code { display: block; color: #26364d; font: 10px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; white-space: normal; }
.flow-arrow { align-self: center; color: #8090a4; text-align: center; }
.reference-note { padding: 9px; color: var(--muted); border-radius: 6px; background: white; font-size: 10px; line-height: 1.5; }
.relation-empty { padding: 20px 8px; }
.file-tree { padding: 8px; }
.file-tree-folder { min-width: 0; }
.folder-row { width: 100%; min-height: 34px; padding: 6px; display: grid; grid-template-columns: 12px 18px minmax(0, 1fr) auto; align-items: center; gap: 4px; border: 0; border-radius: 6px; color: #374151; text-align: left; background: transparent; font-size: 12px; }
.folder-row:hover { background: #f1f3f5; }
.folder-row strong { min-width: 0; overflow: hidden; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.folder-row small { color: #9ca3af; font-size: 9px; }
.folder-chevron { color: #8b929c; font-size: 14px; }
.folder-icon { color: #d2932f; font-size: 13px; }
.file-tree-children { margin-left: 11px; padding-left: 7px; border-left: 1px solid #e5e7eb; }
.file-item { width: 100%; min-height: 36px; padding: 7px 6px; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 6px; border: 0; border-bottom: 1px solid var(--soft-line); color: var(--ink); text-align: left; background: transparent; font-size: 12px; }
.file-item:hover, .file-item.active { background: #eef4ff; }
.file-item > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item small { color: var(--muted); font-size: 10px; }
.file-icon { color: #75808d; font: 700 9px/1 ui-monospace; text-align: center; }
.panel-empty { padding: 32px 20px; color: var(--muted); text-align: center; }
.panel-empty p { margin: 0 0 7px; font-size: 13px; }
.panel-empty small { line-height: 1.5; }
.compact-empty { padding: 16px 8px; }

.toast { position: fixed; z-index: 50; right: 20px; bottom: 20px; max-width: 420px; padding: 12px 16px; border-radius: 8px; color: white; background: #1f2937; box-shadow: 0 12px 35px rgba(0,0,0,.2); }
dialog { width: min(540px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: 14px; color: var(--ink); box-shadow: 0 24px 80px rgba(0,0,0,.22); }
dialog::backdrop { background: rgba(17, 24, 39, .42); backdrop-filter: blur(2px); }
dialog form[method=dialog] { margin-top: 18px; text-align: right; }
.modal-heading h2 { margin: 0 0 7px; }
.modal-heading p { margin: 0 0 20px; color: var(--muted); }
.menu-list { display: grid; gap: 4px; }
.menu-list button { padding: 12px; display: block; border: 0; border-radius: 8px; color: var(--ink); text-align: left; background: transparent; }
.menu-list button:hover { background: #f4f5f6; }
.menu-list span, .menu-list small { display: block; }
.menu-list small { margin-top: 3px; color: var(--muted); }
.menu-list .danger-row { color: var(--danger); }
.token-value { max-height: 180px; overflow: auto; user-select: all; }
.token-create-form { margin: 0 0 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.token-list { max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.token-row { min-height: 58px; padding: 9px 11px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--soft-line); }
.token-row:last-child { border-bottom: 0; }
.token-row strong, .token-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.token-row strong { font-size: 13px; }
.token-row small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.button.danger { color: var(--danger); border-color: #f0c7c4; background: #fffafa; }
.button.danger:hover { background: #fff0ef; }
.token-empty { padding: 28px 20px; color: var(--muted); text-align: center; }
.token-empty strong, .token-empty small { display: block; }
.token-empty strong { color: var(--ink); font-size: 13px; }
.token-empty small { margin-top: 6px; font-size: 11px; }
.token-created-actions { margin-top: 14px; }
.grant-list { max-height: 180px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.grant-list > div { min-height: 44px; padding: 7px 10px; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 8px; border-bottom: 1px solid var(--soft-line); font-size: 12px; }
.grant-list > div:last-child { border-bottom: 0; }
.grant-list > div > span:last-child { color: var(--muted); }
.avatar.mini { width: 26px; height: 26px; font-size: 11px; }
.fatal-error { margin: 30px; white-space: pre-wrap; }

@media (max-width: 1060px) {
  .library-shell { grid-template-columns: min(var(--dock-left-track), 230px) minmax(280px, 1fr) min(var(--dock-right-track), 330px); }
}

@media (max-width: 720px) {
  .library-shell { grid-template-columns: 44px minmax(0, 1fr) 44px; grid-template-rows: 60px minmax(0, 1fr) 40px; }
  .dock.open { z-index: 30; overflow: visible; }
  .dock-left.open .dock-panel, .dock-right.open .dock-panel { width: min(360px, calc(100vw - 88px)); position: absolute; top: 0; bottom: 0; box-shadow: 0 18px 45px rgba(31,41,55,.2); }
  .dock-left.open .dock-panel { left: 43px; }
  .dock-right.open .dock-panel { right: 43px; }
  .dock-top.open .dock-panel, .dock-bottom.open .dock-panel { height: min(330px, calc(100vh - 80px)); position: absolute; right: 0; left: 0; box-shadow: 0 18px 45px rgba(31,41,55,.2); }
  .dock-top.open .dock-panel { top: 59px; }
  .dock-bottom.open .dock-panel { bottom: 39px; }
  .library-brand { height: 52px; }
  .document-workspace { min-height: 0; grid-template-rows: minmax(0, 1fr); }
  .document-header { min-height: 60px; grid-template-columns: minmax(0, 1fr) auto 42%; }
  .dock-top .dock-rail { width: 100%; }
  .document-center-controls .view-switch { display: none; }
  .document-viewer { padding: 8px; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-story { min-height: 260px; padding: 34px 26px; }
  .auth-story h1 { margin-top: 54px; font-size: 42px; }
  .auth-card { width: calc(100% - 32px); margin: 16px; padding: 24px; }
}
