/* Orbit Wiki V3 — durable production workflows, using the shared shell. */
.workspace-rail-nav { display: grid; gap: 6px; margin-bottom: 18px; }
.workspace-rail-nav a { color: var(--ink-secondary); font-size: 13px; }
.workspace-rail-nav a.active { color: var(--accent); font-weight: 650; }
.workspace-main, .studio-main, .settings-main { width: 100%; max-width: 1390px; margin: 0 auto; padding: 34px 40px 60px; }
.workspace-header, .studio-header, .settings-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 0; padding: 20px 40px; border-bottom: 1px solid var(--border); background: var(--surface); color: var(--ink); }
.workspace-header .wiki-brand, .settings-brand { display: flex; align-items: center; gap: 10px; margin: 0; padding: 0; color: var(--ink); font-size: 19px; font-weight: 700; white-space: nowrap; }
.workspace-nav, .studio-header nav { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; }
.workspace-nav a, .studio-header nav a, .settings-home { display: inline-flex; align-items: center; min-height: 36px; color: var(--ink-secondary); font-size: 12px; }
.workspace-heading, .editor-heading { max-width: 850px; margin-bottom: 28px; }
.workspace-heading h1, .studio-title h1, .editor-heading h1, .settings-title h1, .settings-main > h1, .page-heading h1 { margin: 10px 0 12px; color: var(--ink); font-size: 32px; font-weight: 750; letter-spacing: -.9px; line-height: 1.4; }
.workspace-heading p, .studio-title p, .editor-heading > p, .settings-intro, .page-description { margin: 0; color: var(--ink-secondary); font-size: 14px; line-height: 1.9; }
.workspace-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 22px; margin-bottom: 24px; font-size: 12px; }
.studio-primary, .studio-secondary, .settings-primary, .settings-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px 17px; border: 1px solid var(--accent); border-radius: 11px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; line-height: 1.65; white-space: nowrap; transition: background .16s, border-color .16s; }
.studio-primary:hover, .settings-primary:hover { border-color: var(--accent-dark); background: var(--accent-dark); color: #fff; }
.studio-secondary, .settings-secondary { border-color: var(--border); background: var(--surface); color: var(--ink-secondary); }
.studio-secondary:hover, .settings-secondary:hover { border-color: #c2cdf8; background: #f9faff; color: var(--accent); }
.studio-primary:disabled, .studio-secondary:disabled { cursor: wait; }

/* Source collection and grounded knowledge links. */
.source-search { display: flex; align-items: center; gap: 15px; min-height: 52px; padding: 10px 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.source-search label { color: var(--ink-secondary); font-size: 12px; white-space: nowrap; }
.source-search input { flex: 1; min-width: 0; padding: 5px 0; border: 0; background: transparent; color: var(--ink); }
.source-search:focus-within { border-color: #8ba0fa; box-shadow: 0 0 0 3px #4664ed12; }
.source-search button { min-height: 34px; padding: 6px 15px; border: 1px solid #dce3fa; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 12px; }
.result-meta { margin: 23px 0 18px; color: var(--ink-faint); font-size: 12px; }
.source-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.source-card { display: flex; flex-direction: column; min-width: 0; padding: 23px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.source-type { display: inline-flex; align-self: flex-start; padding: 4px 7px; border-radius: 6px; background: var(--purple-soft); color: #6d58ac; font-size: 10px; font-weight: 600; }
.source-card h2 { margin: 12px 0 10px; color: var(--ink); font-size: 17px; font-weight: 650; line-height: 1.6; }
.source-card p { margin: 0 0 12px; color: var(--ink-secondary); font-size: 12px; line-height: 1.9; overflow-wrap: anywhere; }
.source-card .source-domain { color: var(--ink-faint); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.source-citations { margin-top: auto; }
.source-citations a { display: block; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); font-size: 12px; line-height: 1.85; }
.source-card .read-link { display: inline-flex; margin-top: 16px; font-size: 12px; }
.workspace-form-panel { max-width: 850px; margin-top: 35px; padding: 27px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.workspace-form-panel h2 { margin: 0 0 20px; font-size: 21px; }
.workspace-form-panel form { display: grid; gap: 16px; }
.workspace-form-panel label { display: grid; gap: 7px; color: var(--ink-secondary); font-size: 13px; font-weight: 550; }
.workspace-form-panel input, .workspace-form-panel textarea, .workspace-form-panel select { width: 100%; min-width: 0; max-width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid #d5def2; border-radius: 9px; background: #fbfcff; color: var(--ink); font-size: 14px; line-height: 1.75; }
.workspace-form-panel textarea { resize: vertical; }
.workspace-form-panel button { justify-self: start; }
.graph-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 28px; align-items: start; }
.knowledge-nodes { display: grid; gap: 16px; }
.knowledge-node { min-width: 0; padding: 23px 25px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.knowledge-node > span { color: var(--ink-faint); font-size: 11px; }
.knowledge-node h2 { margin: 8px 0 15px; font-size: 20px; line-height: 1.6; }
.graph-edge { display: block; margin-bottom: 7px; padding: 10px 14px; border: 1px solid #e3e9fa; border-radius: 9px; background: #f3f6ff; color: #5873b8; font-size: 13px; }
.graph-edge:hover { border-color: #c7d3ff; color: var(--accent); }
.knowledge-note { padding: 10px 0 0 22px; border-left: 1px solid var(--border); color: var(--ink-secondary); font-size: 12px; line-height: 1.9; }
.knowledge-note h2 { font-size: 16px; }
.knowledge-note h3 { margin-top: 24px; font-size: 13px; }
.knowledge-note code { padding: 2px 5px; border-radius: 5px; background: var(--accent-soft); color: #5c6faa; font-size: 11px; }
.workspace-main > .folder-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.workspace-main > .folder-list article { min-width: 0; padding: 22px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.workspace-main > .folder-list h2 { margin-bottom: 10px; font-size: 17px; }
.workspace-main > .folder-list p { margin-bottom: 14px; color: var(--ink-secondary); font-size: 12px; line-height: 1.9; }
.workspace-main > .folder-list code { padding: 3px 6px; border-radius: 5px; background: var(--surface-soft); color: var(--ink-faint); font-size: 11px; }
.workflow-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; margin: 0 0 25px; padding: 15px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--ink-faint); font-size: 12px; }
.workflow-strip span + span::before { content: "→"; margin-right: 20px; color: #8596be; }
.quiet-workflow { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 29px; padding: 18px 22px; border: 1px solid var(--border); border-radius: 16px; background: #ffffffb8; }
.quiet-workflow > div { display: flex; align-items: center; gap: 13px; min-width: 0; }
.quiet-workflow strong, .quiet-workflow small { display: block; }
.quiet-workflow strong { color: var(--ink-secondary); font-size: 12px; font-weight: 600; }
.quiet-workflow small { margin-top: 3px; color: var(--ink-faint); font-size: 11px; }
.quiet-workflow > a { flex-shrink: 0; font-size: 12px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 28px 0 0; color: var(--ink-faint); font-size: 12px; }
.pagination button, .pagination > a { display: inline-flex; align-items: center; min-height: 34px; padding: 6px 13px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--accent); }
.pagination > div, .pagination-buttons { display: flex; align-items: center; gap: 10px; }
.connection-panel { margin-top: 35px; padding-top: 25px; border-top: 1px solid var(--border); }
.connection-panel h2 { margin: 0 0 20px; font-size: 20px; }
.connection-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.connection-grid h3 { margin: 0 0 12px; color: var(--ink-faint); font-size: 12px; }
.connection-grid a { display: block; margin-bottom: 9px; font-size: 13px; line-height: 1.8; }

/* Drafts, editing, review and history keep every original form and state. */
.studio-title { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.studio-title > div { min-width: 0; }
.studio-note { margin: 0 0 30px; padding: 16px 19px; border-left: 3px solid #9baee8; border-radius: 0 12px 12px 0; background: #edf2ff; color: #596f9e; font-size: 13px; line-height: 1.9; }
.studio-section-title { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 32px 0 20px; }
.studio-section-title h2 { margin: 0; font-size: 21px; }
.studio-section-title span { color: var(--ink-faint); font-size: 12px; }
.draft-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.draft-card { min-width: 0; padding: 24px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.draft-badge { display: inline-flex; padding: 4px 8px; border: 1px solid #e6ddf6; border-radius: 6px; background: var(--purple-soft); color: #6f59a9; font-size: 11px; line-height: 1.7; }
.draft-card h3 { margin: 14px 0 10px; font-size: 20px; line-height: 1.6; }
.draft-card > p { margin: 0 0 18px; color: var(--ink-secondary); font-size: 13px; line-height: 1.9; }
.draft-meta { display: flex; gap: 20px; color: var(--ink-faint); font-size: 11px; }
.draft-actions { display: flex; justify-content: space-between; gap: 15px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.draft-actions a { display: inline-flex; align-items: center; min-height: 34px; font-size: 12px; }
.studio-empty { grid-column: 1 / -1; padding: 30px; border: 1px dashed #cdd7f4; border-radius: 16px; background: var(--surface); color: var(--ink-secondary); }
.studio-empty h3, .studio-empty h2 { margin: 0 0 10px; font-size: 19px; }
.studio-empty p { margin: 0; font-size: 13px; line-height: 1.9; }
.studio-published-list { overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.studio-published-list > article { display: flex; align-items: center; gap: 24px; padding: 21px 24px; border-bottom: 1px solid var(--border-soft); }
.studio-published-list > article:last-child { border-bottom: 0; }
.studio-published-list > article > div { flex: 1; min-width: 0; }
.published-title { color: var(--ink); font-size: 16px; font-weight: 600; }
.studio-published-list p { margin: 5px 0 0; color: var(--ink-faint); font-size: 11px; }
.studio-published-list > article > a { display: flex; align-items: center; min-height: 36px; font-size: 12px; }
.studio-back, .editor-heading > a { display: inline-flex; align-items: center; min-height: 34px; color: var(--ink-faint); font-size: 12px; }
.editor-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.editor-tabs a { display: inline-flex; align-items: center; min-height: 38px; padding: 8px 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--ink-secondary); font-size: 12px; }
.editor-tabs a.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.editor-writing, .editor-meta-panel { min-width: 0; padding: 26px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.editor-meta-panel { padding: 23px; }
.editor-meta-panel h2 { margin: 0 0 21px; font-size: 19px; }
.field-label { display: block; margin: 19px 0 8px; color: #536483; font-size: 13px; font-weight: 600; }
.field-label:first-child { margin-top: 0; }
.editor-layout input, .editor-layout textarea, .editor-layout select, #publish-summary { width: 100%; min-width: 0; max-width: 100%; min-height: 43px; padding: 11px 12px; border: 1px solid #d5def2; border-radius: 9px; background: #fbfcff; color: var(--ink); font-size: 14px; line-height: 1.75; resize: vertical; }
.editor-layout input:focus, .editor-layout textarea:focus, .editor-layout select:focus, #publish-summary:focus, .workspace-form-panel input:focus, .workspace-form-panel textarea:focus, .workspace-form-panel select:focus { border-color: #8ba0fa; box-shadow: 0 0 0 3px #4664ed12; }
.editor-layout input::placeholder, .editor-layout textarea::placeholder { color: var(--ink-faint); }
.editor-writing #title { padding: 13px 15px; font-size: 22px; font-weight: 650; line-height: 1.5; }
.editor-writing #body_markdown { min-height: 630px; color: #4d6085; font: 14px/1.9 ui-monospace, SFMono-Regular, Consolas, monospace; tab-size: 2; }
.editor-body-label { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 15px; margin-top: 24px; }
.editor-body-label .field-label { margin: 0 0 10px; }
.editor-body-label > span { margin-bottom: 10px; color: var(--ink-faint); font-size: 11px; }
.legacy-hint { padding: 12px 14px; border-left: 3px solid #c49d58; border-radius: 0 9px 9px 0; background: #fff8e9; color: #7a6646; font-size: 12px; line-height: 1.85; }
.field-help { margin: 8px 0 16px; color: var(--ink-faint); font-size: 12px; line-height: 1.85; }
.stable-url { margin-top: 20px; padding: 10px; border-radius: 8px; background: var(--surface-soft); overflow-wrap: anywhere; }
.editor-meta-panel .studio-primary { width: 100%; margin-top: 22px; }
.source-picker { margin: 10px 0 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.image-upload-panel { display: grid; gap: 10px; padding: 15px 0; color: var(--ink-faint); font-size: 12px; }
.image-upload-panel input { max-width: 100%; font-size: 12px; }
#live-preview { margin-top: 22px; padding: 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.form-error { margin: 13px 0 0; color: #a23e50; font-size: 13px; line-height: 1.8; white-space: pre-wrap; }
.form-error:empty { display: none; }
#editor-message, #workspace-message { position: fixed; bottom: 24px; left: 50%; z-index: 100; max-width: min(680px, calc(100vw - 30px)); padding: 12px 19px; border: 1px solid #5c73df; border-radius: 11px; background: #334783; color: #fff; box-shadow: 0 8px 35px #273d7622; font-size: 13px; line-height: 1.75; transform: translateX(-50%); }
#editor-message { opacity: 0; pointer-events: none; transition: opacity .2s; }
#editor-message.visible { opacity: 1; }
#workspace-message:empty { display: none; }
.review-panel { min-width: 0; margin: 25px 0; padding: 28px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); scroll-margin-top: 100px; }
.review-panel > h2 { margin: 0 0 20px; font-size: 22px; }
.meta-diff { margin: 0 0 25px; }
.meta-diff > div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 19px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; line-height: 1.8; }
.meta-diff dt { color: var(--ink-faint); }
.meta-diff dd { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; min-width: 0; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-before { padding: 9px 12px; border-radius: 7px; background: #fff0f1; color: #984756; }
.diff-after { padding: 9px 12px; border-radius: 7px; background: var(--green-soft); color: #267359; }
.diff-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.diff-grid > div { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 11px; }
.diff-grid h3 { margin: 0; padding: 11px 15px; font-size: 12px; }
.diff-grid > div:first-child h3 { background: #fff0f1; color: #984756; }
.diff-grid > div:last-child h3 { background: var(--green-soft); color: #267359; }
.diff-grid pre { max-height: 450px; margin: 0; padding: 15px; overflow: auto; background: #fbfcff; color: #4d6085; font: 12px/1.8 ui-monospace, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.no-change { padding: 15px; border-radius: 9px; background: var(--green-soft); color: #267359; font-size: 13px; }
.preview-panel { max-width: 1100px; margin-inline: auto; padding: 34px 40px; }
.preview-panel > h1, .version-preview > h1 { margin: 21px 0 15px; color: var(--ink); font-size: 32px; letter-spacing: -.8px; line-height: 1.5; }
.review-sources { padding-left: 20px; font-size: 14px; line-height: 2; }
.review-sources a { overflow-wrap: anywhere; }
.publish-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px; margin-top: 30px; padding: 28px; border: 1px solid #dce3fa; border-radius: 16px; background: #edf2ff; scroll-margin-top: 100px; }
.publish-panel h2 { margin: 0 0 12px; font-size: 23px; }
.publish-panel p { color: #5a6f99; font-size: 14px; line-height: 1.9; }
.publish-confirm { display: flex; align-items: flex-start; gap: 10px; margin: 18px 0; color: #53678e; font-size: 13px; line-height: 1.8; }
.publish-confirm input { flex-shrink: 0; width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); }
.publish-panel .studio-primary { width: 100%; }
.history-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.version-list { display: flex; flex-direction: column; gap: 11px; }
.version-item { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 17px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--ink-faint); }
.version-item:hover { border-color: #c2cdf8; }
.version-item.selected { border-color: #a4b5fa; background: var(--accent-soft); }
.version-item > span { color: #6c7faa; font-size: 11px; }
.version-item strong { color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.8; }
.version-item small { font-size: 10px; }
.version-item em { color: var(--green); font-size: 10px; font-style: normal; }
.version-preview { min-width: 0; margin: 0; padding: 28px; }
.version-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 25px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.version-preview-head h2 { margin: 0 0 8px; font-size: 22px; }
.version-preview-head p { margin: 0; color: var(--ink-faint); font-size: 13px; }

/* Settings use the same cool white and blue as every other page. */
.settings-title { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.settings-title > div { min-width: 0; }
.admin-badge { padding: 6px 11px; border: 1px solid #cfe7da; border-radius: 8px; background: var(--green-soft); color: var(--green); font-size: 12px; white-space: nowrap; }
.settings-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; padding: 24px 0; }
.settings-tabs a { display: inline-flex; align-items: center; min-height: 38px; padding: 8px 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--ink-secondary); font-size: 12px; }
.settings-tabs a:hover { color: var(--accent); border-color: #c2cdf8; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.settings-card { min-width: 0; padding: 28px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); scroll-margin-top: 100px; }
.settings-card.wide { grid-column: 1 / -1; }
.settings-card-label { color: #687dbb; font-size: 11px; letter-spacing: 1px; }
.settings-card h2 { margin: 9px 0 21px; font-size: 22px; font-weight: 650; letter-spacing: -.4px; }
.settings-card p { margin: 0 0 14px; color: var(--ink-secondary); font-size: 14px; line-height: 1.9; }
.settings-card .identity-name { margin-bottom: 4px; color: var(--ink); font-size: 21px; font-weight: 600; overflow-wrap: anywhere; }
.settings-card .identity-email { color: var(--ink-faint); font-size: 13px; word-break: break-all; }
.settings-card .settings-note { margin: 17px 0 0; color: var(--ink-faint); font-size: 12px; }
.settings-primary, .settings-secondary { margin-top: 20px; }
.settings-facts { margin: 0; }
.settings-facts > div { display: flex; align-items: start; justify-content: space-between; gap: 18px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; line-height: 1.8; }
.settings-facts dt { color: var(--ink-faint); }
.settings-facts dd { max-width: 75%; margin: 0; color: var(--ink); text-align: right; overflow-wrap: anywhere; }
.settings-facts > div:last-child { border-bottom: 0; }
.settings-facts .endpoint-value { max-width: 75%; word-break: break-all; font-size: 12px; }
.settings-card-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.config-state { padding: 4px 8px; border: 1px solid #eadfca; border-radius: 7px; background: var(--amber-soft); color: var(--amber); font-size: 11px; white-space: nowrap; }
.config-state.neutral { border-color: var(--border); background: var(--surface-soft); color: var(--ink-faint); }
.config-state.ready { border-color: #cfe7da; background: var(--green-soft); color: var(--green); }
.settings-boundary { margin-top: 21px; padding: 20px 22px; border-left: 3px solid #9baee8; border-radius: 0 11px 11px 0; background: #f2f5ff; }
.settings-boundary h3 { margin: 0 0 9px; color: #566fa6; font-size: 14px; }
.settings-boundary p { margin: 0 0 9px; color: #5b6d90; font-size: 13px; }
.settings-boundary p:last-child { margin-bottom: 0; }
.settings-footer { display: block; margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--border); color: var(--ink-faint); font-size: 11px; }
.mcp-tools-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; margin: 25px 0; padding: 0; list-style: none; }
.mcp-tools-list li { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: 12px; background: #fbfcff; }
.mcp-tools-list code { display: inline-block; padding: 4px 7px; border-radius: 6px; background: var(--accent-soft); color: #5d72ac; font-size: 11px; overflow-wrap: anywhere; }
.mcp-tools-list strong { display: block; margin: 10px 0 7px; color: var(--ink); font-size: 14px; }
.settings-card .mcp-tools-list p { margin: 0; color: var(--ink-secondary); font-size: 12px; }
.mcp-config-detail { margin-top: 15px; padding: 5px 0; border-top: 1px solid var(--border); }
.mcp-config-detail summary { display: flex; align-items: center; min-height: 48px; padding: 11px 32px 11px 0; color: #52678e; font-size: 14px; font-weight: 550; }

/* HTML import previews and original pages preserve their own viewport. */
.html-import-panel { margin: 0 0 28px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.html-import-panel > summary { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 17px 45px 17px 22px; color: var(--ink); font-size: 14px; font-weight: 650; }
.html-import-fields { display: grid; gap: 16px; padding: 4px 22px 23px; }
.html-import-fields label { display: grid; gap: 7px; color: var(--ink-secondary); font-size: 13px; font-weight: 550; }
.html-import-fields input, .html-import-fields textarea { width: 100%; min-width: 0; max-width: 100%; min-height: 43px; padding: 11px 12px; border: 1px solid #d5def2; border-radius: 9px; background: #fbfcff; color: var(--ink); font-size: 14px; line-height: 1.75; }
.html-import-fields textarea { min-height: 230px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.html-import-fields input:focus, .html-import-fields textarea:focus { border-color: #8ba0fa; box-shadow: 0 0 0 3px #4664ed12; }
.html-import-fields small, .html-import-fields > p { margin: 0; color: var(--ink-faint); font-size: 12px; line-height: 1.85; }
.html-import-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
#html-import-result { color: var(--ink-secondary); font-size: 13px; line-height: 1.85; white-space: pre-wrap; }
#html-import-result:empty { display: none; }
#html-original-stage, #html-original-container, .original-stage { min-width: 0; max-width: 100%; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
#html-original-stage { margin-top: 20px; }
#html-original-stage > #html-original-container { border: 0; border-radius: 0; box-shadow: none; }
.original-stage > iframe, .original-frame, #html-original-container > iframe { display: block; width: 100%; height: 76vh; min-height: 520px; margin: 0; border: 0; background: #fff; }
.original-main { max-width: 1600px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.original-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 18px; padding: 15px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--ink-secondary); font-size: 12px; line-height: 1.8; }
.original-toolbar a { overflow-wrap: anywhere; }
.original-caption { margin: 13px 2px 0; color: var(--ink-faint); font-size: 12px; line-height: 1.85; }

/* Durable knowledge references fit the existing reading and search surfaces. */
.knowledge-block-anchor { display: block; position: relative; scroll-margin-top: 110px; }
.knowledge-block-anchor:target + .block-actions { border-color: #b9c5fa; background: var(--accent-soft); }
.block-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 16px; padding: 8px 12px; border: 1px solid var(--border-soft); border-radius: 9px; color: var(--ink-faint); font-size: 11px; line-height: 1.7; }
.block-actions > span { margin-right: auto; }
.block-actions a, .block-actions button { display: inline-flex; align-items: center; min-height: 30px; padding: 0; border: 0; background: transparent; color: var(--accent); font: inherit; cursor: pointer; }
.block-actions a:focus-visible, .block-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
.block-search-hit .block-hit-meta { display: block; margin-top: 8px; color: var(--ink-faint); font-size: 11px; line-height: 1.7; }
@media print { .block-actions { display: none; } }

@media (max-width: 1199px) {
  .workspace-main, .studio-main, .settings-main { padding-inline: 30px; }
  .source-grid, .workspace-main > .folder-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-layout { grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; }
  .editor-writing, .editor-meta-panel { padding: 22px; }
  .graph-layout { grid-template-columns: minmax(0, 1fr) 220px; gap: 23px; }
  .history-layout { grid-template-columns: 210px minmax(0, 1fr); gap: 20px; }
}
@media (max-width: 1099px) {
  .editor-layout { grid-template-columns: minmax(0, 1fr); }
  .editor-writing #body_markdown { min-height: 500px; }
  .publish-panel { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .graph-layout { grid-template-columns: minmax(0, 1fr); }
  .knowledge-note { padding: 23px 0 0; border-left: 0; border-top: 1px solid var(--border); }
  .settings-card-top, .version-preview-head { align-items: start; flex-direction: column; gap: 12px; }
}
@media (max-width: 899px) {
  .workspace-main, .studio-main, .settings-main { padding: 28px 23px 45px; }
  .workspace-header, .studio-header, .settings-header { padding-inline: 23px; }
  .quiet-workflow { gap: 15px; }
}
@media (max-width: 699px) {
  .workspace-main, .studio-main, .settings-main { padding: 25px 16px 36px; }
  .workspace-header, .studio-header, .settings-header { flex-wrap: wrap; gap: 12px; padding: 17px 16px; }
  .workspace-nav { gap: 15px; }
  .workspace-heading h1, .studio-title h1, .editor-heading h1, .settings-title h1, .settings-main > h1, .page-heading h1 { font-size: 27px; letter-spacing: -.6px; }
  .workspace-heading p, .studio-title p, .editor-heading > p, .settings-intro { font-size: 13px; }
  .studio-title, .settings-title, .page-heading { align-items: start; flex-direction: column; gap: 15px; }
  .studio-title .studio-primary { width: 100%; }
  .source-grid, .workspace-main > .folder-list, .draft-grid, .settings-grid, .connection-grid, .mcp-tools-list { grid-template-columns: minmax(0, 1fr); }
  .source-search { flex-wrap: wrap; gap: 9px; }
  .source-search label { width: 100%; }
  .source-search input { font-size: 16px; }
  .source-card, .workspace-form-panel, .draft-card, .settings-card { padding: 21px; }
  .settings-card.wide { grid-column: auto; }
  .quiet-workflow { flex-wrap: wrap; padding: 17px 18px; }
  .workflow-strip { gap: 10px; font-size: 11px; }
  .workflow-strip span + span::before { margin-right: 10px; }
  .studio-published-list > article { flex-wrap: wrap; gap: 10px 18px; padding: 19px; }
  .studio-published-list > article > div { flex-basis: 100%; }
  .editor-writing, .editor-meta-panel, .review-panel { padding: 21px; }
  .editor-writing #title { font-size: 21px; }
  .editor-layout input, .editor-layout textarea, .editor-layout select, #publish-summary, .workspace-form-panel input, .workspace-form-panel textarea, .workspace-form-panel select, .html-import-fields input { font-size: 16px; }
  .editor-writing #body_markdown { min-height: 440px; font-size: 14px; }
  .editor-tabs a { min-height: 42px; }
  .meta-diff > div { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .meta-diff dd, .diff-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .diff-grid pre { max-height: 300px; }
  .preview-panel > h1, .version-preview > h1 { font-size: 28px; }
  .publish-panel { padding: 22px; }
  .history-layout { grid-template-columns: minmax(0, 1fr); }
  .version-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .version-item { padding: 14px; }
  .version-preview { padding: 21px; }
  .version-preview-head .studio-secondary { width: 100%; }
  .settings-facts > div { gap: 12px; }
  .settings-facts dd, .settings-facts .endpoint-value { max-width: 65%; }
  .settings-boundary { padding: 18px; }
  .html-import-panel > summary { padding-left: 18px; }
  .html-import-fields { padding: 3px 18px 19px; }
  .html-import-actions > button { min-height: 42px; }
  .original-stage > iframe, .original-frame, #html-original-container > iframe { height: 72vh; min-height: 420px; }
  .original-toolbar { padding: 14px 16px; }
}
@media (max-width: 449px) {
  .version-list { grid-template-columns: minmax(0, 1fr); }
  .settings-facts > div { flex-direction: column; gap: 4px; }
  .settings-facts dd, .settings-facts .endpoint-value { max-width: 100%; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .studio-primary, .studio-secondary, .settings-primary, .settings-secondary, #editor-message { transition: none; }
}
@media print {
  .workspace-header, .studio-header, .settings-header, #editor-message, #workspace-message, .html-import-panel { display: none !important; }
  .workspace-main, .studio-main, .settings-main { max-width: none; margin: 0; padding: 0; }
  .original-stage { border: 0; box-shadow: none; }
}
.compilation-review { margin: 1rem 0 1.5rem; padding: 1.1rem 1.3rem; border: 1px solid #dbe1ff; border-radius: 16px; background: #f7f8ff; }
.compilation-review h3 { margin: .5rem 0; font-size: 1rem; }
.compilation-review ul { padding-left: 1.25rem; line-height: 1.8; }
.block-evidence { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin: 1rem 0; }
:root { --html-import-accent: #7057b5; }
.html-import-url { display:flex; align-items:center; gap:10px; }
.html-import-url input { flex:1; min-width:0; }
.html-import-review { border:1px solid #e1d9ec; border-radius:12px; padding:20px; margin-bottom:24px; background:#fbf9fe; }
.html-import-review h3 { margin:12px 0; font-size:18px; }
.html-import-stats { color:var(--html-import-accent); font-size:14px; font-weight:600; margin:12px 0; }
#html-import-report { padding:14px 18px; background:#f8f6fc; border-radius:8px; }
#html-import-report ul,.html-import-review ul { font-size:12px; line-height:1.8; color:#77717e; padding-left:18px; }
.html-import-review details { margin-top:14px; }
.html-import-review .field-help { overflow-wrap:anywhere; }
@media(max-width:640px) { .html-import-url { flex-direction:column; align-items:stretch; } }
