:root {
    color-scheme: light;
    --app-bg: #f8fafc;
    --surface-1: #ffffff;
    --surface-2: #f1f5f9;
    --surface-hover: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #1d4ed8;
    --primary-soft: #eff6ff;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --positive-text: #047857;
    --positive-soft: #ecfdf5;
    --radius: 8px;
    --font-mono: 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
    font-family: Inter, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
}
* {
    box-sizing: border-box;
}
.graph-object-type { color: var(--muted); margin: 8px 0; font-size: 12px; }
.graph-object-id { display: block; max-width: 100%; overflow-wrap: anywhere; font: 11px var(--font-mono); padding: 6px 0; border: 0; background: transparent; color: var(--muted); text-align: left; }
.feature-records { margin-top: 24px; }
.feature-record-help, .feature-record-empty { font-size: 12px; color: var(--muted); line-height: 1.6; }
.feature-record { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; width: 100%; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 14px 2px; text-align: left; background: transparent; }
.feature-record strong { font-size: 14px; font-weight: 550; line-height: 1.6; overflow-wrap: anywhere; }
.graph-inspector .feature-record { white-space: normal; min-width: 0; max-width: 100%; }
.graph-inspector .feature-record strong { width: 100%; }
.feature-record-kind { color: var(--primary); font-size: 11px; }
.feature-record .date-badge { margin: 0; }
.feature-record-more { width: 100%; margin-top: 10px; }
.feature-children { margin: 24px 0 16px; }
.feature-children > summary { cursor: pointer; font-weight: 600; }
.feature-children .graph-related-list { margin-top: 12px; }
.document-feature-location { margin: 20px 0 24px; padding: 16px 20px; background: var(--primary-soft); border: 1px solid var(--border); border-radius: var(--radius); }
.document-feature-location h3 { margin: 0 0 12px; font-size: 14px; }
.document-feature-link { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; text-align: left; border: 0; border-radius: 4px; padding: 8px 0; background: transparent; }
.document-feature-link strong { color: var(--primary); font-size: 14px; }
.document-feature-link code { font-size: 11px; color: var(--text); overflow-wrap: anywhere; }
.document-feature-parent { color: #475569; font-size: 12px; overflow-wrap: anywhere; }
.document-feature-evidence { margin-top: 12px; font-size: 12px; }
.document-feature-evidence summary { cursor: pointer; color: var(--primary); }
.document-feature-evidence > div { padding: 10px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.document-feature-evidence button { display: block; max-width: 100%; margin-top: 8px; white-space: normal; overflow-wrap: anywhere; }
body {
    margin: 0;
    background-color: var(--app-bg);
    background-image:
        linear-gradient(to right, rgb(15 23 42 / 3%) 1px, transparent 1px),
        linear-gradient(to bottom, rgb(15 23 42 / 3%) 1px, transparent 1px);
    background-size: 28px 28px;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.nav-icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
::selection { color: #143b8f; background: #dce8ff; }
input, textarea { caret-color: var(--primary); }
input::placeholder, textarea::placeholder { color: #66758a; opacity: 1; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
* { scrollbar-width: thin; scrollbar-color: #b8c3d2 transparent; }
[hidden] {
    display: none !important;
}
button,
input,
select,
textarea {
    font: inherit;
}
button {
    cursor: pointer;
    color: var(--text);
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 14px;
    font-weight: 500;
    transition:
        background 120ms,
        border-color 120ms;
}
button:hover {
    background: var(--surface-2);
    border-color: #cbd5e1;
}
button:disabled {
    opacity: 0.5;
    cursor: default;
}
.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 2px 3px rgb(29 78 216 / 12%);
}
.primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}
.quiet {
    color: var(--muted);
    background: transparent;
    border-color: transparent;
    font-size: 12px;
}
input,
select,
textarea {
    width: 100%;
    color: var(--text);
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
}
input::placeholder {
    color: #66758a;
}
label {
    display: grid;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
    margin-bottom: 16px;
}
textarea {
    resize: vertical;
    line-height: 1.8;
    font-family: var(--font-mono);
    font-size: 13px;
}
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}
button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}
a {
    color: var(--primary);
    text-underline-offset: 3px;
}
h1,
h2,
h3,
p {
    margin-top: 0;
}
h1 {
    font-size: 27px;
    letter-spacing: -0.7px;
    font-weight: 680;
    margin-bottom: 0;
}
h2 {
    font-size: 17px;
    letter-spacing: -0.3px;
    margin-bottom: 18px;
}
h3 {
    font-size: 14px;
    margin-bottom: 10px;
}
.muted {
    color: var(--muted);
    line-height: 1.8;
}
.eyebrow {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--muted);
    margin-bottom: 10px;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #0f172a;
    box-shadow: 0 2px 5px rgb(15 23 42 / 15%);
    flex: none;
}
.brand-mark i {
    width: 8px;
    height: 8px;
    background: #60a5fa;
    border-radius: 50%;
}
.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    max-width: 1100px;
    margin: auto;
    align-items: center;
    gap: 80px;
    padding: 60px;
}
.login-intro .brand-mark {
    margin-bottom: 36px;
    width: 44px;
    height: 44px;
}
.login-intro h1 {
    font-size: 46px;
    line-height: 1.4;
    letter-spacing: -1.5px;
    margin-bottom: 24px;
}
.login-intro p {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.9;
}
.login-rule {
    width: 56px;
    height: 2px;
    background: var(--primary);
    margin: 36px 0 20px;
}
.login-intro > span {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.2px;
    color: var(--muted);
}
.login {
    padding: 36px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 14px 40px rgb(15 23 42 / 4%);
}
.login h2 {
    font-size: 23px;
    margin-bottom: 12px;
}
.login .muted {
    font-size: 13px;
    margin-bottom: 28px;
}
.login input {
    min-height: 44px;
}
.login > button {
    width: 100%;
    margin-top: 8px;
}
#login-error {
    color: var(--danger);
    font-size: 12px;
    margin: 16px 0 0;
}
#workspace {
    display: flex;
    flex-direction: column;
    height: 100vh;
}
.topbar {
    flex: none;
    min-height: 68px;
    background: var(--surface-1);
    border-bottom: 1px solid var(--border);
    padding: 0 30px;
    display: flex;
    align-items: center;
    gap: 30px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    white-space: nowrap;
}
.brand strong {
    font-size: 17px;
    letter-spacing: -0.5px;
}
.brand-caption {
    color: var(--muted);
    font-size: 11px;
    border-left: 1px solid var(--border);
    padding-left: 11px;
}
.topbar nav {
    display: flex;
    gap: 3px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 3px;
}
.nav {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 7px 13px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
}
.nav.active {
    background: white;
    color: var(--text);
    box-shadow: 0 1px 4px rgb(15 23 42 / 9%);
    position: relative;
}
.nav.active::after {
    content: '';
    position: absolute;
    height: 2px;
    background: var(--primary);
    bottom: -2px;
    left: 25%;
    right: 25%;
    border-radius: 1px;
}
.account-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}
.project-picker {
    margin: 0;
    min-width: 130px;
    max-width: 175px;
}
.project-picker select {
    padding: 8px 12px;
    background: var(--surface-hover);
    font-size: 12px;
}
.user-name {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.page-heading {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 36px 26px;
    gap: 16px;
}
.page-heading .eyebrow {
    margin-bottom: 8px;
}
.page {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0 36px 36px;
}
.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 26px;
}
.metric {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 23px 24px 20px;
    position: relative;
    box-shadow: 0 2px 4px rgb(15 23 42 / 3%);
    overflow: hidden;
    text-align: left;
}
.metric::after {
    content: '';
    height: 3px;
    background: var(--metric-color, var(--primary));
    bottom: 0;
    left: 0;
    right: 0;
    position: absolute;
}
.metric:nth-child(2) {
    --metric-color: #d97706;
}
.metric:nth-child(3) {
    --metric-color: #7c3aed;
}
.metric:nth-child(4) {
    --metric-color: #0d9488;
}
.metric-label {
    font-size: 12px;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.metric-label::after {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--metric-color, var(--primary));
    border-radius: 50%;
}
.metric-number {
    display: block;
    font-size: 38px;
    letter-spacing: -1.6px;
    font-weight: 720;
    line-height: 1.2;
    margin: 14px 0 8px;
    font-variant-numeric: tabular-nums;
}
.metric-caption {
    font-size: 11px;
    color: var(--muted);
}
.board-section {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 26px;
    background: var(--surface-1);
    box-shadow: 0 2px 5px rgb(15 23 42 / 3%);
}
.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
}
.section-heading h2 {
    margin: 0;
}
.section-heading p {
    font-size: 12px;
    color: var(--muted);
    margin: 8px 0 0;
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.note-card {
    display: flex;
    flex-direction: column;
    min-height: 215px;
    text-align: left;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgb(15 23 42 / 3%);
}
.note-card:hover {
    border-color: #93b4f4;
    background: #fbfdff;
    box-shadow: 0 3px 10px rgb(29 78 216 / 6%);
}
.card-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.pill {
    display: inline-flex;
    align-items: center;
    border: 1px solid #dbeafe;
    color: #1d4ed8;
    background: #eff6ff;
    border-radius: 4px;
    font-size: 10px;
    padding: 3px 7px;
    font-weight: 550;
}
.pill.status {
    color: #047857;
    border-color: #a7f3d0;
    background: #ecfdf5;
}
.pill.proposed {
    color: #b45309;
    border-color: #fde68a;
    background: #fffbeb;
}
.pill.rejected {
    color: #be123c;
    border-color: #fecdd3;
    background: #fff1f2;
}
.note-card h3 {
    font-size: 15px;
    line-height: 1.65;
    margin-bottom: 12px;
}
.note-card p {
    font-size: 12px;
    line-height: 1.9;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 400;
}
.card-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.7;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.overview-bottom {
    margin-top: 24px;
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 24px;
}
.summary-row {
    padding: 14px 0;
    display: flex;
    gap: 14px;
    border-bottom: 1px solid #f1f5f9;
    align-items: flex-start;
}
.summary-row:last-child {
    border: 0;
}
.summary-row strong {
    font-size: 12px;
    display: block;
    margin-bottom: 6px;
}
.summary-row p {
    color: var(--muted);
    font-size: 11px;
    margin: 0;
    line-height: 1.8;
}
.summary-row button {
    margin-left: auto;
    font-size: 11px;
    padding: 5px 8px;
    white-space: nowrap;
}
.timeline-item {
    display: flex;
    gap: 20px;
    padding: 24px 8px;
    border-bottom: 1px solid var(--border);
}
.timeline-date {
    font-family: var(--font-mono);
    color: var(--muted);
    font-size: 11px;
    min-width: 136px;
    line-height: 1.8;
}
.timeline-item button {
    text-align: left;
    border: 0;
    padding: 0;
    font-size: 15px;
}
.timeline-item .muted {
    margin: 8px 0 0;
    font-size: 12px;
}
#notes-view {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 280px minmax(320px, 1fr) 282px;
    overflow: hidden;
    background: white;
    border-top: 1px solid var(--border);
}
.list-pane {
    background: #fbfcfe;
    border-right: 1px solid var(--border);
    padding: 24px 18px;
    overflow: auto;
}
.filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.search-button {
    width: 100%;
}
.note-item {
    width: 100%;
    text-align: left;
    border: 1px solid transparent;
    background: transparent;
    padding: 14px 12px;
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.8;
}
.note-item.selected {
    border-color: #bfdbfe;
    background: #eff6ff;
}
.note-item span {
    display: block;
    font-size: 10px;
    margin-top: 6px;
    color: var(--muted);
}
.document-pane {
    overflow: auto;
    padding: 32px;
    min-width: 0;
}
.document-actions {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.document-actions h2 {
    flex: 1;
    margin: 2px auto 0 0;
    font-size: 21px;
    line-height: 1.6;
}
.document-actions button,
.document-actions a {
    font-size: 11px;
    white-space: nowrap;
}
.document-actions a {
    padding-top: 8px;
}
.document-pane .muted {
    font-size: 12px;
}
.markdown-body {
    line-height: 1.95;
    font-size: 14px;
    overflow-wrap: anywhere;
}
.markdown-body h1,
.markdown-body h2 {
    font-size: 19px;
    margin: 30px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}
.markdown-body h3 {
    margin-top: 24px;
    font-size: 15px;
}
.markdown-body p {
    margin: 14px 0;
}
.markdown-body li {
    margin-bottom: 5px;
}
.markdown-body blockquote {
    margin: 18px 0;
    padding: 8px 18px;
    border-left: 3px solid #bfdbfe;
    background: #f8fafc;
    color: #475569;
}
.markdown-body code {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--surface-2);
    padding: 2px 5px;
    border-radius: 4px;
}
.markdown-body pre {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 16px;
    overflow: auto;
}
.markdown-body pre code {
    background: none;
    padding: 0;
}
.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    display: block;
    overflow: auto;
}
.markdown-body th,
.markdown-body td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}
.markdown-body th {
    background: var(--surface-2);
}
pre.markdown {
    white-space: pre-wrap;
    font: 12px/1.8 var(--font-mono);
    overflow-wrap: anywhere;
}
.inspector {
    border-left: 1px solid var(--border);
    padding: 28px 20px;
    overflow: auto;
    background: #fcfdff;
}
.inspector > h2 {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 24px;
}
.impact,
.revision {
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
    overflow-wrap: anywhere;
}
.impact:first-child {
    padding-top: 0;
}
.impact h3 {
    font: 12px/1.7 var(--font-mono);
    color: var(--primary);
}
.impact p {
    font-size: 12px;
    line-height: 1.9;
    color: #475569;
}
.impact .muted {
    font-size: 10px;
}
.impact button {
    font-size: 10px;
}
.revision button {
    width: 100%;
    text-align: left;
    font-size: 10px;
    line-height: 1.8;
    background: white;
}
#context > h3 {
    margin: 26px 0 0;
    font-size: 12px;
}
#empty {
    margin: 14vh 0 0;
    text-align: center;
}
#empty h2 {
    font-size: 25px;
}
.advanced {
    margin-bottom: 24px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}
.advanced summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 12px;
}
.advanced[open] summary {
    margin-bottom: 18px;
}
.settings {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px;
}
.settings h2 {
    font-size: 23px;
}
.setup-heading { display: flex; align-items: center; gap: 12px; margin-top: 28px; }
.setup-heading h3 { margin: 0; font-size: 16px; }
.setup-number { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius); color: var(--primary); background: var(--primary-soft); font-weight: 650; flex: 0 0 auto; }
.client-step { margin-top: 28px; padding-top: 4px; border-top: 1px solid var(--border); }
.client-actions, .client-copy-row { display: flex; align-items: center; gap: 12px; }
.client-actions { flex-wrap: wrap; margin: 18px 0; }
.client-copy-row input { flex: 1; min-width: 0; }
.client-copy-row button { flex: 0 0 auto; }
.client-instructions { padding-left: 22px; line-height: 1.7; }
.client-instructions li { padding: 4px 0 4px 3px; }
.client-credential-hint { padding: 12px 16px; background: var(--primary-soft); border-radius: var(--radius); line-height: 1.65; }
.client-step code { font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }
.client-step details { margin-top: 16px; }
.client-step summary { cursor: pointer; color: var(--muted); }
#client-sha { display: block; margin-top: 12px; }
@media (max-width: 600px) {
    #keys-view .settings { padding: 20px 16px; }
    .client-copy-row { align-items: stretch; flex-direction: column; }
    #keys-view .key-row { align-items: flex-start; flex-direction: column; }
}
.settings #key-form {
    max-width: 300px;
    margin-top: 28px;
}
.key-row {
    display: flex;
    gap: 12px;
    padding: 22px 0 0;
    margin-top: 24px;
    border-top: 1px solid var(--border);
    align-items: center;
}
.key-row span {
    flex: 1;
    color: var(--muted);
    font-size: 12px;
}
#key-secret {
    padding: 20px;
    margin-top: 24px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
}
#secret {
    font-family: var(--font-mono);
    font-size: 12px;
}
footer {
    flex: none;
    height: 29px;
    padding: 7px 30px;
    background: white;
    border-top: 1px solid var(--border);
    font-size: 10px;
    color: var(--muted);
    overflow: hidden;
    white-space: nowrap;
}
footer.error {
    color: var(--danger);
}
.empty-state {
    padding: 24px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.9;
    grid-column: 1/-1;
}
@media (max-width: 1250px) {
    .topbar {
        gap: 18px;
        padding: 0 22px;
    }
    .brand-caption {
        display: none;
    }
    .nav {
        padding: 7px 10px;
    }
    #notes-view {
        grid-template-columns: 245px minmax(300px, 1fr);
        grid-template-rows: minmax(0, 1fr) auto;
    }
    .inspector {
        grid-column: 2;
        border-top: 1px solid var(--border);
        max-height: 230px;
    }
    .list-pane {
        grid-row: 1/3;
    }
    .card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .metric {
        padding: 20px;
    }
}
@media (max-width: 900px) {
    .topbar {
        flex-wrap: wrap;
        gap: 12px;
        padding: 14px 22px;
    }
    .topbar nav {
        order: 3;
        width: 100%;
    }
    .nav {
        flex: 1;
    }
    .user-name {
        display: none;
    }
    .account-controls {
        gap: 5px;
    }
    .page-heading {
        padding: 24px;
    }
    .page {
        padding: 0 24px 24px;
    }
    .metrics {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }
    .overview-bottom {
        grid-template-columns: 1fr;
    }
    .login-shell {
        gap: 35px;
        padding: 32px;
    }
    .login-intro h1 {
        font-size: 34px;
    }
    .login {
        padding: 26px;
    }
}
@media (max-width: 700px) {
    .brand strong {
        font-size: 15px;
    }
    .topbar {
        padding: 12px 16px;
    }
    .project-picker {
        min-width: 100px;
        max-width: 125px;
    }
    .page-heading {
        padding: 22px 18px;
    }
    h1 {
        font-size: 23px;
    }
    .page {
        padding: 0 18px 24px;
    }
    .card-grid {
        grid-template-columns: 1fr;
    }
    .board-section {
        padding: 20px;
    }
    .metric-number {
        font-size: 32px;
    }
    .metric {
        padding: 18px;
    }
    .metric-caption {
        font-size: 10px;
    }
    #notes-view {
        display: block;
        overflow: auto;
    }
    .list-pane,
    .document-pane,
    .inspector {
        overflow: visible;
    }
    .list-pane {
        max-height: 45vh;
        overflow: auto;
        border-bottom: 1px solid var(--border);
    }
    .document-pane {
        padding: 24px 18px;
    }
    .inspector {
        max-height: none;
    }
    .login-shell {
        display: block;
        max-width: 450px;
        padding: 32px 20px;
    }
    .login-intro {
        margin: 12px 10px 36px;
    }
    .login-intro h1 {
        font-size: 31px;
    }
    .login-intro p,
    .login-intro > span,
    .login-rule {
        display: none;
    }
    .login-intro .brand-mark {
        margin-bottom: 20px;
    }
    .timeline-item {
        gap: 12px;
        flex-direction: column;
    }
    .section-heading p {
        line-height: 1.8;
    }
}
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* Functional architecture keeps the same light shell; evidence belongs in the inspector. */
#graph-view {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr) 300px;
    flex: 1;
    min-height: 0;
    border-top: 1px solid var(--border);
    background: var(--surface-1);
    overflow: hidden;
}
.graph-sidebar,
.graph-inspector {
    padding: 22px 20px;
    overflow: auto;
    min-width: 0;
    background: #fbfdff;
}
.graph-sidebar {
    border-right: 1px solid var(--border);
}
.graph-inspector {
    border-left: 1px solid var(--border);
}
.graph-side-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.graph-side-heading h2 {
    margin: 0;
}
#graph-search {
    display: grid;
    gap: 10px;
}
.graph-home {
    margin: 22px 0 12px;
    width: 100%;
    background: var(--primary-soft);
    color: var(--primary);
    border-color: #bfdbfe;
}
.feature-link {
    display: block;
    text-align: left;
    border: 0;
    border-radius: 6px;
    background: transparent;
    padding: 11px 9px;
    width: 100%;
    line-height: 1.6;
    font-size: 13px;
}
.feature-link.selected {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 650;
}
.feature-children {
    margin-left: 12px;
    padding-left: 8px;
    border-left: 1px solid var(--border);
}
.graph-history {
    border-top: 1px solid var(--border);
    margin-top: 28px;
    padding-top: 20px;
    font-size: 12px;
    color: var(--muted);
}
.graph-history-row {
    display: block;
    white-space: pre-wrap;
    text-align: left;
    width: 100%;
    font-size: 11px;
    margin-top: 12px;
    line-height: 1.8;
}
.graph-workspace {
    overflow: auto;
    min-width: 0;
    background-image: radial-gradient(#cbd5e1 0.7px, transparent 0.7px);
    background-size: 18px 18px;
    padding: 22px 26px;
}
.graph-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}
.graph-toolbar > div:last-child {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
#graph-breadcrumb {
    font-size: 12px;
    line-height: 1.8;
    overflow-wrap: anywhere;
}
#graph-breadcrumb button {
    font-size: 12px;
    padding: 4px 0;
}
.graph-notice {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.8;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.94);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
}
.architecture-root {
    text-align: center;
    padding: 18px 12px 36px;
    position: relative;
}
.architecture-root h2 {
    font-size: 25px;
    margin-bottom: 12px;
}
.architecture-root:after {
    content: '';
    position: absolute;
    width: 1px;
    height: 24px;
    background: #93c5fd;
    bottom: 0;
    left: 50%;
}
.architecture-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    padding-top: 22px;
    border-top: 1px solid #bfdbfe;
}
.architecture-module {
    position: relative;
    min-width: 0;
}
.architecture-module:before {
    content: '';
    position: absolute;
    width: 1px;
    height: 22px;
    background: #93c5fd;
    top: -22px;
    left: 50%;
}
.graph-node {
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 9px;
    width: 100%;
    background: var(--surface-1);
    padding: 15px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    box-shadow: 0 2px 6px rgb(15 23 42 / 4%);
    min-width: 0;
    position: relative;
    z-index: 1;
}
.graph-node:hover,
.graph-node.selected {
    border-color: #60a5fa;
    background: #f8fbff;
}
.graph-node-kind {
    font-size: 10px;
    letter-spacing: 0.5px;
    color: var(--primary);
    font-weight: 650;
}
.graph-node strong {
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}
.graph-node-summary {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.8;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}
.kind-table .graph-node-kind,
.kind-field .graph-node-kind {
    color: #059669;
}
.kind-note .graph-node-kind {
    color: #8b5cf6;
}
.kind-code .graph-node-kind,
.kind-api .graph-node-kind {
    color: #d97706;
}
.architecture-children {
    margin: 0 15px;
    padding: 13px 0 0 14px;
    border-left: 1px solid #cbd5e1;
}
.architecture-child {
    display: block;
    background: #f8fafc;
    border: 1px solid var(--border);
    width: 100%;
    text-align: left;
    margin: 9px 0;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.6;
}
.graph-totals {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    padding: 28px 0;
    color: var(--muted);
    font-size: 11px;
}
.graph-scene {
    position: relative;
    min-height: 240px;
    isolation: isolate;
}
.graph-connections {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: visible;
}
.graph-edge {
    fill: none;
    stroke: #93c5fd;
    stroke-width: 1.5;
    opacity: 0.7;
}
.edge-reads {
    stroke: #10b981;
}
.edge-writes {
    stroke: #f59e0b;
}
.edge-documents {
    stroke: #a78bfa;
    stroke-dasharray: 4 4;
}
.graph-lanes {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
}
.graph-lane {
    min-width: 0;
}
.graph-lane h3 {
    font-size: 11px;
    color: var(--muted);
    font-weight: 500;
    margin: 12px 0 18px;
}
.graph-lane .graph-node {
    margin-bottom: 18px;
    padding: 12px;
}
.graph-lane-empty {
    font-size: 11px;
    color: var(--muted);
    background: var(--surface-1);
    border: 1px dashed var(--border);
    padding: 16px 10px;
    line-height: 1.8;
    border-radius: 7px;
}
.graph-legend {
    font-size: 11px;
    line-height: 1.8;
    color: var(--muted);
    border-top: 1px solid var(--border);
    padding-top: 20px;
    margin-top: 20px;
}
.graph-relation {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.graph-relation > span {
    display: block;
    font-size: 11px;
}
.graph-relation button {
    padding: 6px 0;
    font-size: 12px;
    text-align: left;
}
.graph-relation p {
    font-size: 11px;
    margin-bottom: 0;
}
.graph-inspector h3 {
    margin-top: 26px;
    font-size: 12px;
}
.graph-inspector > p {
    font-size: 12px;
}
.graph-inspector h2 {
    font-size: 18px;
    line-height: 1.6;
}
.graph-evidence {
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: 10px/1.9 var(--font-mono);
    padding: 12px 0;
    color: var(--muted);
}
.graph-edit-node,
.graph-open-note {
    margin-top: 18px;
    width: 100%;
    font-size: 12px;
}
.graph-node-form,
.graph-relation-form {
    display: grid;
    gap: 14px;
}
.graph-node-form label,
.graph-relation-form label {
    font-size: 11px;
}
.graph-node-form textarea,
.graph-relation-form textarea {
    min-height: 100px;
}
.graph-remove-relation {
    font-size: 10px;
    margin-top: 10px;
    text-align: left;
    color: var(--danger);
}
#graph-update {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 18px;
    margin-top: 28px;
    padding: 18px;
}
#graph-update label {
    font-size: 12px;
}
.graph-result {
    display: grid;
    gap: 10px;
    text-align: left;
    width: 100%;
    padding: 18px;
    margin-bottom: 12px;
    background: var(--surface-1);
}
.graph-result .pill {
    justify-self: start;
}
.graph-result strong {
    font-size: 14px;
}
.graph-result p {
    margin: 0;
    font-size: 12px;
}
.graph-result-path {
    font-size: 11px;
    color: var(--primary);
    line-height: 1.8;
}
@media (min-width: 1550px) {
    .architecture-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
@media (max-width: 1200px) {
    #graph-view {
        grid-template-columns: 210px minmax(0, 1fr) 260px;
    }
    .graph-workspace {
        padding: 20px 18px;
    }
    .graph-lanes {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .graph-connections {
        display: none;
    }
    .graph-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }
    .graph-sidebar,
    .graph-inspector {
        padding: 18px 14px;
    }
    .architecture-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 850px) {
    #graph-view {
        grid-template-columns: 190px minmax(0, 1fr);
        overflow: auto;
    }
    .graph-inspector {
        grid-column: 1/-1;
        border-left: 0;
        border-top: 1px solid var(--border);
        overflow: visible;
    }
    .graph-workspace,
    .graph-sidebar {
        overflow: visible;
    }
    .architecture-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 600px) {
    #graph-view {
        display: block;
        overflow: auto;
    }
    .graph-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border);
        max-height: 38vh;
        overflow: auto;
    }
    .graph-workspace {
        padding: 20px 16px;
    }
    .graph-lanes {
        gap: 12px;
    }
    .architecture-grid {
        gap: 16px;
    }
    .graph-node {
        padding: 12px;
    }
    #graph-update {
        grid-template-columns: 1fr;
    }
    .topbar nav .nav {
        padding: 8px 6px;
        font-size: 11px;
        flex: 1;
        white-space: nowrap;
    }
    .topbar nav {
        width: 100%;
        min-width: 0;
    }
}
.graph-arrow {
    fill: #94a3b8;
}
/* Search-first reading shell, following Outline's navigation/list/reader hierarchy. */
body {
    background: #fafafa;
    background-image: none;
}
#workspace {
    display: grid;
    grid-template-columns: 218px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) 28px;
    height: 100vh;
    min-height: 0;
}
.topbar {
    grid-column: 1;
    grid-row: 1/4;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    height: auto;
    padding: 26px 16px;
    background: #f7f8fa;
    border: 0;
    border-right: 1px solid var(--border);
    gap: 24px;
    min-width: 0;
}
.brand {
    gap: 9px;
}
.brand-caption {
    display: none;
}
.brand-mark {
    width: 28px;
    height: 28px;
}
.brand strong {
    font-size: 16px;
}
.topbar nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 0;
    background: none;
    border: 0;
    min-width: 0;
}
.topbar .nav {
    text-align: left;
    white-space: normal;
    padding: 11px 12px;
    border-radius: 6px;
    font-size: 13px;
    background: none;
    box-shadow: none;
}
.topbar .nav.active {
    background: #e9edf3;
    color: #111827;
}
.topbar kbd {
    float: right;
    font-size: 10px;
    color: var(--muted);
    padding-top: 2px;
}
.account-controls {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.account-controls .project-picker {
    width: 100%;
    max-width: 100%;
}
.user-name {
    font-size: 11px;
}
.page-heading {
    grid-column: 2;
    grid-row: 1;
    padding: 24px 32px;
    background: white;
    border-bottom: 1px solid var(--border);
}
.page-heading h1 {
    font-size: 22px;
    font-weight: 650;
}
.page-heading .eyebrow {
    font-size: 9px;
    margin-bottom: 6px;
}
#workspace > main {
    grid-column: 2;
    grid-row: 2;
    min-height: 0;
}
#status {
    grid-column: 2;
    grid-row: 3;
    position: static;
    min-width: 0;
}
#unified-view {
    display: grid;
    grid-template-columns: 200px minmax(270px, 0.85fr) minmax(300px, 1.15fr);
    grid-template-rows: 76px minmax(0, 1fr);
    background: white;
    min-width: 0;
    overflow: hidden;
}
.knowledge-search-bar {
    grid-column: 1/-1;
    display: flex;
    gap: 12px;
    padding: 18px 28px;
    border-bottom: 1px solid var(--border);
}
.knowledge-search-bar input {
    font-size: 15px;
    flex: 1;
    min-width: 0;
    background: #f8fafc;
    border-color: #d7dde5;
}
.knowledge-filters {
    padding: 24px 18px;
    overflow: auto;
    border-right: 1px solid var(--border);
    font-size: 12px;
}
.knowledge-filters h2 {
    font-size: 14px;
    line-height: 1.7;
}
.knowledge-filters label {
    font-size: 11px;
    margin-bottom: 18px;
}
.knowledge-filters select {
    font-size: 12px;
}
.knowledge-filters h3 {
    margin-top: 32px;
    font-size: 12px;
}
.knowledge-filters details {
    border-top: 1px solid var(--border);
    padding-top: 18px;
    margin-top: 28px;
}
#knowledge-tree {
    display: grid;
    gap: 5px;
}
#knowledge-tree button {
    font-size: 11px;
    text-align: left;
    border: 0;
    background: none;
    padding: 9px 0;
    line-height: 1.7;
    color: var(--muted);
}
.knowledge-index-run {
    white-space: pre-wrap;
    font-size: 10px;
    overflow-wrap: anywhere;
    margin: 14px 0;
    color: var(--muted);
    line-height: 1.8;
}
.knowledge-results {
    overflow: auto;
    border-right: 1px solid var(--border);
    min-width: 0;
}
.knowledge-results-heading {
    display: flex;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    color: var(--muted);
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}
.knowledge-hit {
    display: grid;
    gap: 9px;
    padding: 20px;
    text-align: left;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
}
.knowledge-hit.selected {
    background: #f0f5ff;
    border-left: 3px solid var(--primary);
}
.knowledge-hit strong {
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}
.knowledge-kind {
    font-size: 10px;
    color: var(--primary);
    font-weight: 600;
}
.knowledge-path {
    font-size: 11px;
    color: var(--muted);
    overflow-wrap: anywhere;
    line-height: 1.8;
}
.knowledge-excerpt {
    font-size: 12px;
    color: #475569;
    line-height: 1.8;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    white-space: normal;
}
.knowledge-meta {
    font-size: 10px;
    color: var(--muted);
}
.knowledge-preview {
    padding: 30px;
    overflow: auto;
    min-width: 0;
}
.knowledge-preview-empty {
    margin: 90px auto;
    max-width: 350px;
    color: var(--muted);
    line-height: 1.9;
}
.knowledge-preview-empty h2 {
    color: var(--text);
    font-size: 22px;
}
.knowledge-document-heading h2 {
    font-size: 24px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.knowledge-source {
    font: 10px/1.8 var(--font-mono);
    color: var(--muted);
    overflow-wrap: anywhere;
}
.knowledge-sections {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 20px 0;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.knowledge-sections button {
    font-size: 10px;
    padding: 6px 9px;
}
.knowledge-document-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 28px 0;
}
.knowledge-document-links button {
    font-size: 11px;
}
.knowledge-code {
    white-space: pre;
    margin: 0;
    font: 12px/1.8 var(--font-mono);
    overflow: auto;
    background: #f8fafc;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.code-line {
    display: flex;
    gap: 18px;
}
.code-line-number {
    color: #94a3b8;
    min-width: 28px;
    text-align: right;
    user-select: none;
}
.code-line code {
    font: inherit;
}
@media (max-width: 1250px) {
    #workspace {
        grid-template-columns: 184px minmax(0, 1fr);
    }
    #unified-view {
        grid-template-columns: 160px minmax(240px, 1fr) minmax(270px, 1fr);
    }
    .knowledge-preview {
        padding: 22px;
    }
    .topbar {
        padding: 24px 12px;
    }
    .brand strong {
        font-size: 14px;
    }
    .knowledge-filters {
        padding: 20px 12px;
    }
}
@media (max-width: 1000px) {
    #unified-view {
        grid-template-columns: 160px minmax(0, 1fr);
        grid-template-rows: 76px minmax(200px, 1fr) minmax(240px, 1fr);
    }
    .knowledge-search-bar {
        grid-row: 1;
    }
    .knowledge-filters {
        grid-column: 1;
        grid-row: 2/4;
    }
    .knowledge-results {
        grid-column: 2;
        grid-row: 2;
        border-bottom: 1px solid var(--border);
    }
    .knowledge-preview {
        grid-column: 2;
        grid-row: 3;
    }
}
@media (max-width: 700px) {
    #workspace {
        display: flex;
        height: 100vh;
    }
    .topbar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 14px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .topbar nav {
        flex-direction: row;
        overflow: auto;
        width: 100%;
        gap: 4px;
    }
    .topbar .nav {
        font-size: 10px;
        white-space: nowrap;
        padding: 8px 5px;
        flex: 1;
    }
    .topbar kbd {
        display: none;
    }
    .account-controls {
        margin-top: 0;
        margin-left: auto;
        flex-wrap: nowrap;
        max-width: 53%;
    }
    .account-controls .project-picker {
        width: 120px;
        max-width: 120px;
        min-width: 70px;
    }
    .user-name {
        display: none;
    }
    .brand strong {
        font-size: 13px;
    }
    .page-heading {
        padding: 16px 18px;
    }
    .page-heading h1 {
        font-size: 20px;
    }
    #unified-view {
        display: block;
        overflow: auto;
    }
    .knowledge-search-bar {
        padding: 14px;
    }
    .knowledge-filters {
        padding: 14px;
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .knowledge-filters > .eyebrow,
    .knowledge-filters > h2,
    .knowledge-filters > h3,
    #knowledge-tree,
    .knowledge-filters details {
        display: none;
    }
    .knowledge-filters label {
        flex: 1;
        min-width: 85px;
        margin: 0;
    }
    .knowledge-filters select {
        padding: 8px;
    }
    .knowledge-results {
        max-height: 40vh;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .knowledge-preview {
        overflow: visible;
        padding: 22px 18px;
    }
    .knowledge-preview-empty {
        margin: 20px auto;
    }
    .knowledge-search-bar input {
        font-size: 13px;
    }
    .knowledge-document-heading h2 {
        font-size: 20px;
    }
}

/* Interactive project atlas: the canvas owns the workspace; directories are optional. */
:root {
    --atlas-bg: #f7f9fc;
    --atlas-ink: #16263d;
    --atlas-link: #b9c6d8;
    --atlas-node-shadow: 0 5px 16px rgb(34 57 85 / 6%);
    --atlas-family-0: #4976dc;
    --atlas-family-1: #22988d;
    --atlas-family-2: #9672c7;
    --atlas-family-3: #c08a3f;
    --atlas-family-4: #438ea9;
    --atlas-family-5: #bc6e85;
}
#workspace {
    grid-template-columns: 224px minmax(0, 1fr);
}
.topbar {
    padding-inline: 12px;
}
.topbar nav .nav {
    font-size: 13px;
    padding-inline: 13px;
    min-height: 43px;
}
.topbar .brand {
    padding-left: 5px;
}
.topbar nav kbd {
    font-size: 8px;
}
.page-heading {
    min-height: 80px;
    padding: 19px 28px;
}
.page-heading h1 {
    font-size: 23px;
}
#graph-view {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 342px;
    position: relative;
    overflow: hidden;
    min-height: 0;
    background: var(--atlas-bg);
}
#graph-view.inspector-collapsed {
    grid-template-columns: minmax(0, 1fr);
}
#graph-view.inspector-collapsed .graph-inspector {
    display: none;
}
#graph-view .graph-sidebar {
    display: none;
    position: absolute;
    z-index: 20;
    left: 12px;
    top: 58px;
    bottom: 38px;
    width: 256px;
    padding: 20px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-1);
    box-shadow: 0 12px 30px rgb(24 45 74 / 12%);
    overflow: auto;
}
#graph-view.directory-open .graph-sidebar {
    display: block;
}
#graph-view .graph-workspace {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    position: relative;
    background: transparent;
}
.graph-toolbar {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    background: white;
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0;
    min-height: 62px;
}
.graph-toolbar button {
    font-size: 12px;
    white-space: nowrap;
    padding: 9px 11px;
}
#graph-search {
    display: flex;
    gap: 6px;
    flex: 1;
    margin: 0 auto 0 0;
    max-width: 475px;
}
#graph-search input {
    margin: 0;
    padding: 9px 12px;
    font-size: 12px;
    min-width: 0;
    background: #f8fafc;
}
#graph-search button {
    padding-inline: 13px;
}
.graph-map-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 18px;
    min-height: 45px;
}
#graph-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    min-width: 0;
    gap: 0;
}
#graph-breadcrumb button {
    color: #52637b;
    font-size: 12px;
    padding: 4px 6px;
}
.graph-map-heading > div:last-child {
    display: flex;
    flex-shrink: 0;
}
.graph-map-heading .quiet {
    font-size: 11px;
    padding: 4px 7px;
}
#graph-canvas.knowledge-map {
    position: relative;
    padding: 0;
    min-height: 360px;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    background: radial-gradient(circle, #cbd4e1 0.8px, transparent 1px);
    background-size: 24px 24px;
    touch-action: none;
    user-select: none;
    cursor: grab;
    outline-offset: -3px;
    isolation: isolate;
}
.knowledge-map.is-dragging,
.knowledge-map.is-dragging .map-node-main {
    cursor: grabbing;
}
.map-world {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 1px;
    transform-origin: 0 0;
}
.map-edges {
    position: absolute;
    left: 0;
    top: 0;
    overflow: visible;
    pointer-events: none;
}
.map-edge {
    fill: none;
    stroke: var(--atlas-link);
    stroke-width: 1.6;
    vector-effect: non-scaling-stroke;
}
.map-edge[data-family='0'] {
    stroke: #9fb6e5;
}
.map-edge[data-family='1'] {
    stroke: #8dc7bf;
}
.map-edge[data-family='2'] {
    stroke: #c1addd;
}
.map-edge[data-family='3'] {
    stroke: #dcc099;
}
.map-edge[data-family='4'] {
    stroke: #9dc7d5;
}
.map-edge[data-family='5'] {
    stroke: #d5acba;
}
.map-edge-label {
    fill: #748298;
    font-size: 10px;
    paint-order: stroke;
    stroke: var(--atlas-bg);
    stroke-width: 5px;
    stroke-linejoin: round;
}
.map-node {
    position: absolute;
    left: 0;
    top: 0;
    width: 224px;
    height: 88px;
    --family: var(--atlas-family-0);
}
.map-node[data-family='1'] {
    --family: var(--atlas-family-1);
}
.map-node[data-family='2'] {
    --family: var(--atlas-family-2);
}
.map-node[data-family='3'] {
    --family: var(--atlas-family-3);
}
.map-node[data-family='4'] {
    --family: var(--atlas-family-4);
}
.map-node[data-family='5'] {
    --family: var(--atlas-family-5);
}
.map-node-main {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    padding: 12px 16px;
    text-align: left;
    border-radius: 12px;
    border: 1px solid #d9e1ec;
    border-left: 3px solid var(--family);
    color: var(--atlas-ink);
    background: white;
    box-shadow: var(--atlas-node-shadow);
    cursor: grab;
    user-select: none;
    transition:
        border-color 120ms,
        box-shadow 120ms;
}
.map-node-main:hover {
    background: white;
    border-color: var(--family);
    box-shadow: 0 7px 18px rgb(37 64 104 / 12%);
}
.map-node.selected .map-node-main {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(55 104 222 / 13%);
}
.map-node-kind {
    color: var(--family);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
}
.map-node-main strong {
    display: block;
    width: 100%;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.map-node-description {
    max-width: 100%;
    color: #77859a;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 400;
}
.map-node.kind-project .map-node-main {
    border: 1px solid #203c64;
    background: #203c64;
    color: white;
    box-shadow: 0 8px 22px rgb(27 54 92 / 16%);
}
.map-node.kind-project .map-node-kind,
.map-node.kind-project .map-node-description {
    color: #c6d5e9;
}
.map-node.kind-project strong {
    font-size: 19px;
    letter-spacing: -0.03em;
}
.map-node-toggle {
    position: absolute;
    right: -13px;
    top: 30px;
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 12px;
    border-radius: 50%;
    background: white;
    color: var(--family);
    border-color: #d6deeb;
    box-shadow: 0 2px 8px rgb(28 51 84 / 6%);
}
.map-controls {
    position: absolute;
    bottom: 19px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    width: max-content;
    align-items: center;
    padding: 5px;
    gap: 2px;
    background: white;
    border: 1px solid #d9e1ed;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgb(31 55 91 / 7%);
}
.map-controls button {
    border: none;
    padding: 6px 10px;
    font-size: 12px;
    min-width: 33px;
    height: 30px;
    background: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.map-controls button:hover {
    background: #edf2f8;
}
.map-controls button[aria-pressed='true'] {
    background: var(--primary-soft);
    color: var(--primary);
    box-shadow: inset 0 0 0 1px currentColor;
}
.knowledge-map.is-moving-nodes .map-node-main { cursor: move; }
.knowledge-map.is-dragging .map-node-main { cursor: grabbing; }
.map-controls button:first-child,
.map-controls button:nth-of-type(2) {
    font-size: 19px;
}
.map-zoom-value {
    font-size: 11px;
    color: #6e7e95;
    min-width: 42px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.map-hint {
    position: absolute;
    bottom: 26px;
    left: 18px;
    font-size: 10px;
    color: #8490a2;
    pointer-events: none;
}
.map-minimap {
    position: absolute;
    width: 132px;
    height: 94px;
    right: 18px;
    bottom: 18px;
    background: rgb(255 255 255 / 94%);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: crosshair;
}
.mini-node {
    fill: #c2cfdf;
}
.mini-project {
    fill: #3c5b85;
}
.mini-viewport {
    stroke: #6a92df;
    stroke-width: 5px;
}
#graph-results {
    position: absolute;
    z-index: 22;
    left: 18px;
    top: 64px;
    width: min(430px, calc(100% - 36px));
    max-height: calc(100% - 130px);
    overflow: auto;
    margin: 0;
    padding: 18px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 12px 30px rgb(27 54 92 / 12%);
}
#graph-results h2 {
    font-size: 15px;
}
#graph-notice {
    padding: 8px 18px;
    margin: 0;
    background: white;
    border-top: 1px solid var(--border);
    color: #8793a5;
    font-size: 10px;
    line-height: 1.5;
}
#graph-update {
    margin: 0;
    padding: 12px 18px;
    display: grid;
    grid-template-columns: 1fr 110px;
    gap: 12px;
    border-radius: 0;
}
#graph-update label {
    margin: 0;
}
#graph-view .graph-inspector {
    background: white;
    border-left: 1px solid var(--border);
    padding: 22px;
    font-size: 12px;
    overflow: auto;
    min-width: 0;
}
.graph-inspector h2 {
    font-size: 20px;
    line-height: 1.5;
    margin-bottom: 12px;
}
.graph-inspector h3 {
    font-size: 12px;
    margin-top: 24px;
}
.graph-inspector-close {
    display: block;
    margin: -10px 0 20px auto;
    font-size: 10px;
}
.graph-description {
    font-size: 12px;
    line-height: 1.9;
    color: #61728a;
}
.graph-related-list {
    display: grid;
    gap: 7px;
}
.graph-related-item {
    border-color: #e1e7ef;
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
}
.graph-content-reader {
    margin: 20px -4px;
}
.graph-content-reader .markdown-body {
    padding: 12px 0;
    font-size: 12px;
    line-height: 1.9;
}
.graph-content-reader .markdown-body h1 {
    font-size: 18px;
}
.graph-content-reader .markdown-body h2 {
    font-size: 15px;
}
.graph-content-reader select {
    font-size: 11px;
}
.graph-preview-meta {
    font-size: 10px;
    color: #8190a4;
    overflow-wrap: anywhere;
}
.graph-code-preview {
    padding: 12px;
    background: #f6f8fb;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: auto;
    max-height: 420px;
    font: 11px/1.8 var(--font-mono);
    tab-size: 4;
}
.graph-provenance {
    margin-block: 20px;
}
.graph-provenance summary {
    cursor: pointer;
    color: #65758c;
    font-size: 11px;
}
.graph-relation {
    padding-block: 10px;
}
.graph-relation .quiet {
    padding-left: 0;
    font-size: 12px;
    color: #324d75;
}
@media (max-width: 1179px) {
    .map-hint {
        display: none;
    }
    #graph-view {
        grid-template-columns: minmax(0, 1fr) 300px;
    }
    #graph-view .graph-inspector {
        padding: 18px;
    }
}
@media (max-width: 900px) {
    .map-minimap {
        display: none;
    }
    #graph-view {
        grid-template-columns: minmax(0, 1fr);
    }
    #graph-view .graph-inspector {
        position: absolute;
        z-index: 25;
        top: 62px;
        right: 0;
        bottom: 0;
        width: min(342px, 86vw);
        box-shadow: -8px 0 24px rgb(25 49 82 / 10%);
    }
    .graph-toolbar {
        padding-inline: 12px;
        gap: 5px;
    }
    .graph-toolbar #graph-add {
        font-size: 0;
        width: 32px;
        padding: 7px;
    }
    .graph-toolbar #graph-add::before {
        content: '+';
        font-size: 18px;
    }
}
@media (max-width: 700px) {
    #workspace {
        grid-template-columns: minmax(0, 1fr);
    }
    .page-heading {
        min-height: 68px;
        padding: 15px 18px;
    }
    .page-heading h1 {
        font-size: 20px;
    }
    #graph-view {
        min-height: 600px;
    }
    .graph-toolbar {
        flex-wrap: wrap;
    }
    #graph-search {
        order: 5;
        flex-basis: 100%;
        max-width: none;
    }
    .graph-map-heading {
        padding-inline: 10px;
    }
    #graph-breadcrumb {
        max-width: calc(100% - 130px);
    }
    #graph-breadcrumb .quiet {
        font-size: 10px;
    }
    .graph-map-heading .quiet {
        font-size: 9px;
        padding-inline: 4px;
    }
    #graph-view .graph-inspector {
        top: 105px;
        width: min(342px, 92vw);
    }
    #graph-canvas.knowledge-map {
        min-height: 440px;
    }
    #graph-results {
        top: 105px;
    }
    .graph-toolbar button {
        padding: 7px 9px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .map-node-main {
        transition: none;
    }
}

/* Project spaces and reading navigation share the same light workspace tokens. */
:root {
    --personal: #0f766e;
    --personal-soft: #edf9f5;
    --priority-key: #995b08;
    --priority-key-soft: #fff7e6;
    --priority-core: #7541b8;
    --priority-core-soft: #f5efff;
}
.topbar { gap: 20px; overflow-y: auto; }
.topbar nav .nav { min-height: 40px; border: 1px solid transparent; }
.topbar .nav { display: flex; align-items: center; gap: 10px; }
.topbar > .spaces-navigation { display: flex; flex-direction: row; gap: 4px; }
.spaces-navigation #spaces-nav { flex: 1; }
#create-project-nav { display: grid; place-items: center; padding: 8px; }
.topbar .nav.active { color: var(--primary); background: #eaf0fd; border-color: #d7e3fa; font-weight: 650; }
.topbar .nav.active::after { display: none; }
.nav-section-label { color: var(--muted); font-size: 10px; letter-spacing: .08em; margin: 0 0 9px; }
#selected-project { padding: 18px 12px 0; border-top: 1px solid var(--border); }
#sidebar-project-name { display: block; margin-bottom: 8px; overflow-wrap: anywhere; font-size: 15px; }
.scope-badge { display: inline-flex; align-items: center; border-radius: 5px; background: var(--primary-soft); color: var(--primary); padding: 4px 7px; font-size: 11px; font-weight: 600; }
.scope-badge[data-scope='personal'] { color: var(--personal); background: var(--personal-soft); }
.account-controls { border-top: 1px solid var(--border); padding-top: 16px; }
.account-controls > .nav-section-label, .account-controls > .nav { width: 100%; }
.account-controls > .nav { text-align: left; padding: 8px 10px; }
.page-heading { min-height: 125px; padding: 16px 28px 18px; gap: 16px; align-items: center; }
.page-heading .eyebrow { display: none; }
.page-heading h1 { font-size: 23px; margin: 5px 0; }
#page-description { margin: 3px 0 0; font-size: 12px; }
.heading-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.heading-actions button { white-space: nowrap; font-size: 12px; }
#location-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
#location-trail .quiet { padding: 0; font-size: inherit; color: var(--muted); }
#location-trail .quiet:hover { color: var(--primary); background: transparent; }
#location-trail strong { color: var(--text); font-weight: 500; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#spaces-view { overflow-y: auto; padding: 24px 28px; background: var(--surface-1); }
.spaces-toolbar { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 0 0 8px; }
.space-tabs { display: inline-flex; background: #edf1f6; padding: 4px; border-radius: 9px; gap: 4px; }
.space-tabs button { border: 0; background: transparent; color: var(--muted); padding: 10px 16px; font-weight: 600; white-space: nowrap; }
.space-tabs button[aria-pressed='true'] { background: white; color: var(--primary); box-shadow: 0 1px 4px #182e4312; }
.space-tabs button span { margin-left: 6px; font-size: 11px; background: #e8edf5; padding: 1px 5px; border-radius: 4px; }
.space-search { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 12px; }
.space-search input { width: 220px; margin: 0; background: white; }
#spaces-explanation { font-size: 12px; margin: 10px 0 22px; }
.project-cards { border-top: 1px solid var(--border); }
.project-space-card { border-bottom: 1px solid var(--border); }
.project-card-open { display: flex; width: 100%; gap: 18px; align-items: center; padding: 20px 14px; border: 0; border-radius: 0; text-align: left; background: transparent; }
.project-card-open:hover { background: var(--surface-hover); }
.project-card-open > .nav-icon:first-child { color: var(--primary); width: 22px; height: 22px; }
.project-card-open > .nav-icon:last-child { color: var(--muted); width: 15px; height: 15px; }
.project-row-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.project-row-title strong { display: block; font-size: 15px; font-weight: 600; }
.project-row-role { color: var(--muted); font-size: 12px; }
.project-id { display: block; font-family: var(--font-mono); font-size: 10px; color: var(--muted); overflow-wrap: anywhere; margin-top: 5px; }
.project-card-open > .date-badge { font-size: 11px; font-weight: 400; color: var(--muted); background: none; padding: 0; }
.spaces-empty { grid-column: 1/-1; padding: 62px 20px; border: 1px dashed #cad4e2; border-radius: 12px; text-align: center; background: white; }
.spaces-empty h3 { margin: 0 0 12px; font-size: 19px; }
.spaces-empty button { margin-top: 14px; }
dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 40px); border: 1px solid var(--border); border-radius: 14px; padding: 28px; color: var(--text); box-shadow: 0 25px 90px #152b3d33; }
dialog::backdrop { background: #13243e70; backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-heading h2 { margin: 0; font-size: 22px; }
.dialog-heading button { font-size: 22px; padding: 0 8px; border: 0; }
#project-form { display: grid; gap: 18px; }
#project-form p { margin: 0; line-height: 1.7; }
.visibility-options { display: grid; gap: 10px; border: 0; padding: 0; margin: 0; min-width: 0; }
.visibility-options legend { font-weight: 600; font-size: 12px; margin-bottom: 8px; }
.visibility-options label { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; }
.visibility-options label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.visibility-options input { width: 16px; height: 16px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--primary); }
.visibility-options strong { display: block; margin-bottom: 5px; }
.visibility-options small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.5; }
.form-help { font-size: 11px; color: var(--muted); }
#project-form-error { color: var(--danger); font-size: 12px; }
.date-badge { display: inline-block; width: fit-content; font-size: 12px; font-weight: 600; line-height: 1.5; color: #40566f; background: #f0f4f9; padding: 5px 8px; border-radius: 5px; font-variant-numeric: tabular-nums; }
.note-item .date-badge { color: #40566f; font-size: 11px; margin-top: 9px; }
#reader > .date-badge { margin: 0 0 12px; background: #eaf0fd; color: #284a8a; font-size: 13px; }
.version-banner { font-size: 11px; color: var(--muted); margin: 4px 0 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.version-banner.historical { color: var(--priority-key); padding: 10px 12px; background: var(--priority-key-soft); border: 1px solid #ead5ac; border-radius: 6px; }
.card-footer { flex-wrap: wrap; gap: 8px; }
.timeline-date { font-size: 13px; font-weight: 600; color: #40566f; }
#graph-view .graph-workspace { grid-template-rows: auto auto auto minmax(0, 1fr) auto auto; }
.map-legend { display: flex; align-items: center; gap: 14px; padding: 4px 22px 10px; color: var(--muted); font-size: 10px; flex-wrap: wrap; }
.map-legend > span:first-child { color: var(--muted); }
.legend-normal { color: var(--primary); }
.legend-key { color: var(--priority-key); }
.legend-core { color: var(--priority-core); }
.legend-help { margin-left: auto; }
.map-node.kind-feature { --family: var(--primary); }
.map-node.kind-code, .map-node.kind-api { --family: #38877f; }
.map-node.kind-note { --family: #6b7790; }
.map-node.kind-field, .map-node.kind-table { --family: #6675a1; }
.map-node.kind-feature[data-priority='key'] { --family: var(--priority-key); }
.map-node.kind-feature[data-priority='core'] { --family: var(--priority-core); }
.map-node[data-priority='key'] .map-node-main { background: var(--priority-key-soft); border-color: #ead5ac; border-left-color: var(--priority-key); }
.map-node[data-priority='core'] .map-node-main { background: var(--priority-core-soft); border-color: #d6c3ef; border-left-color: var(--priority-core); }
.priority-badge { display: inline-flex; font-size: 10px; padding: 3px 6px; border-radius: 4px; color: var(--priority-key); background: var(--priority-key-soft); margin-left: 6px; }
.priority-badge[data-priority='core'], [data-priority='core'] > .priority-badge { color: var(--priority-core); background: var(--priority-core-soft); }
.graph-inspector > .priority-badge { margin: 14px 0 0; }
.graph-reference-group { margin: 24px 0 0; padding-top: 18px; border-top: 1px solid var(--border); }
.graph-reference-group summary { font-size: 12px; font-weight: 600; cursor: pointer; }
.graph-reference-group .graph-relation { margin-top: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 7px; background: #fafbfd; }
.graph-reference-group .graph-relation > .quiet { display: block; margin-top: 4px; color: var(--primary); text-align: left; padding: 0; }
.graph-preview-meta { margin: 10px 0; }
.graph-content-reader > .date-badge { margin: 0 0 12px; }
.knowledge-hit .date-badge { margin: 8px 0 2px; font-size: 10px; }
.knowledge-document-heading .date-badge { margin-top: 12px; }
body:has(#document-dialog[open]) { overflow: hidden; }
#document-dialog { width: min(1160px, calc(100vw - 48px)); height: min(880px, calc(100dvh - 56px)); max-width: none; max-height: none; padding: 0; border-radius: 14px; overflow: hidden; }
#document-dialog[open] { display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.document-dialog-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--border); padding: 16px 24px; background: #fafbfd; min-width: 0; }
.document-dialog-toolbar > div:first-child { min-width: 0; }
#document-location { display: block; margin-bottom: 5px; font-size: 10px; letter-spacing: 0; overflow-wrap: anywhere; }
#document-dialog-title { font-size: 14px; display: block; max-width: 440px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.document-dialog-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.document-dialog-actions button { font-size: 11px; white-space: nowrap; padding: 7px 10px; }
#document-close { color: var(--primary); border-color: #cbd9f3; background: var(--primary-soft); }
#document-close kbd { font-family: inherit; font-size: 9px; color: var(--muted); margin-left: 5px; }
#document-dialog-body { display: grid; grid-template-columns: minmax(0,1fr) 310px; min-height: 0; overflow: hidden; }
#document-reader-slot { overflow: auto; padding: 28px 42px 48px; min-width: 0; }
#document-reader-slot #reader { max-width: 780px; margin: 0 auto; }
#document-reader-slot #reader h2 { overflow-wrap: anywhere; }
#document-dialog #context { grid-column: auto; grid-row: auto; border-top: 0; border-left: 1px solid var(--border); padding: 24px; overflow: auto; max-height: none; min-height: 0; }
#document-dialog.details-collapsed #document-dialog-body { grid-template-columns: minmax(0,1fr); }
#document-dialog.details-collapsed #context { display: none; }
.document-dialog-footer { color: var(--muted); font-size: 10px; padding: 9px 24px; border-top: 1px solid var(--border); background: #fafbfd; }
#notes-view { grid-template-columns: 260px minmax(0,1fr); }
#document-list .section-heading { margin: 0 0 24px; }
#note-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 14px; }
#note-list .note-item { border: 1px solid var(--border); border-radius: 9px; padding: 18px; margin: 0; text-align: left; background: white; font-size: 14px; line-height: 1.7; }
#note-list .note-item:hover, #note-list .note-item.selected { border-color: #a9c0ed; background: #f8faff; }
#note-list .note-item > span { display: block; font-size: 11px; }
#note-list .note-item > .date-badge { display: inline-block; }
#document-list-items > #more { margin-top: 20px; }
@media (max-width: 1200px) {
    #workspace { grid-template-columns: 204px minmax(0,1fr); }
    .page-heading { padding-inline: 22px; }
    #spaces-view { padding: 24px; }
    .heading-actions { max-width: 210px; }
}
@media (max-width: 700px) {
    #workspace { grid-template-columns: minmax(0,1fr); height: auto; min-height: 100vh; }
    .topbar { gap: 10px; padding: 14px; overflow: visible; }
    .topbar > nav { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; }
    .topbar nav .nav { padding: 7px 9px; min-height: 34px; font-size: 12px; }
    .topbar .brand { margin-bottom: 0; }
    #selected-project { padding: 10px 4px 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
    #selected-project .nav-section-label { margin: 0; }
    #sidebar-project-name { margin: 0; font-size: 13px; }
    .account-controls { padding-top: 8px; gap: 8px; align-items: center; width: 100%; max-width: none; margin: 0; flex-wrap: wrap; }
    .account-controls > .nav-section-label { display: none; }
    .account-controls > .nav { width: auto; padding: 6px; }
    .account-controls .project-picker { width: auto; flex: 1; min-width: 0; max-width: none; }
    .account-controls .project-picker select { font-size: 11px; }
    .page-heading { flex-direction: column; align-items: stretch; padding: 14px 18px; gap: 10px; min-height: 110px; }
    .page-heading h1 { font-size: 21px; }
    .heading-actions { max-width: none; justify-content: flex-start; }
    #location-trail strong { max-width: 170px; }
    #spaces-view { padding: 20px 18px 36px; }
    .spaces-toolbar { flex-direction: column; align-items: stretch; gap: 14px; }
    .space-tabs { width: fit-content; }
    .space-tabs button { padding: 9px 12px; }
    .space-search input { width: auto; flex: 1; min-width: 0; }
    .project-card-open { display: grid; grid-template-columns: 22px minmax(0,1fr) 15px; gap: 10px 14px; padding: 18px 4px; }
    .project-row-role, .project-card-open > .date-badge { grid-column: 2; }
    .project-card-open > .nav-icon:last-child { grid-column: 3; grid-row: 1; }
    .map-legend { padding: 4px 12px 10px; gap: 10px; }
    .legend-help { width: 100%; margin-left: 0; }
    dialog { padding: 22px; }
    #document-dialog { width: calc(100vw - 20px); height: calc(100dvh - 24px); border-radius: 10px; }
    .document-dialog-toolbar { align-items: stretch; flex-direction: column; gap: 12px; padding: 14px 16px; }
    .document-dialog-actions { justify-content: flex-start; }
    #document-reader-slot { padding: 22px 18px 40px; }
    .document-actions h2 { flex-basis: 100%; font-size: 20px; }
    #document-dialog:not(.details-collapsed) #document-dialog-body { display: block; overflow: auto; }
    #document-dialog:not(.details-collapsed) #document-reader-slot { overflow: visible; }
    #document-dialog #context { border-left: 0; border-top: 1px solid var(--border); }
    #notes-view { display: block; }
    #notes-view .list-pane { max-height: none; }
}

/* Administration extends the existing knowledge workspace; content keeps its own project scope. */
.management-tabs { display: flex; gap: 4px; width: fit-content; padding: 4px; border-radius: var(--radius); background: var(--surface-2); }
.management-tabs button { border-color: transparent; background: transparent; }
.management-tabs button[aria-pressed="true"] { background: var(--surface-1); color: var(--primary); }
.management-help { max-width: 75ch; margin: 20px 0; color: var(--muted); line-height: 1.7; }
.management-toolbar { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.management-toolbar label { margin: 0; min-width: 130px; }
.management-toolbar input, .management-toolbar select { width: 100%; }
#management-search { display: flex; align-items: end; gap: 12px; flex: 1; }
#management-search label:first-child { flex: 1; max-width: 320px; }
#management-feedback { min-height: 22px; margin: 18px 0; color: var(--muted); }
#management-feedback.error { color: var(--danger); }
.management-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.management-layout:has(.management-editor:not([hidden])) { grid-template-columns: minmax(0, 1fr) 320px; }
.management-list { min-width: 0; }
.management-table-wrap { max-width: 100%; overflow-x: auto; border-block: 1px solid var(--border); }
.management-table { width: 100%; min-width: 620px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.management-table th { padding: 12px; text-align: left; color: var(--muted); font-size: 12px; font-weight: 500; background: var(--surface-hover); }
.management-table td { padding: 16px 12px; border-top: 1px solid var(--border); vertical-align: middle; overflow-wrap: anywhere; }
.management-table td:first-child { min-width: 130px; }
.management-table td:last-child { width: 116px; white-space: nowrap; }
.management-table tr[aria-selected="true"] { background: var(--primary-soft); }
.management-table tbody tr:hover { background: var(--surface-hover); }
.management-table .date-badge { white-space: nowrap; font-size: 12px; background: transparent; border: 0; padding: 0; }
.management-role-badge { display: inline-block; margin: 3px 6px 3px 0; padding: 3px 7px; color: var(--text); background: var(--surface-2); border-radius: 4px; font-size: 12px; }
.management-state { white-space: nowrap; font-size: 12px; border-radius: 4px; padding: 4px 7px; }
.management-state.active { color: var(--positive-text); background: var(--positive-soft); }
.management-state.inactive { color: var(--text); background: var(--surface-2); }
.management-editor { min-width: 0; padding: 0 0 0 24px; border-left: 1px solid var(--border); }
.management-editor-heading { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.management-editor h2 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.management-editor h3 { font-size: 14px; margin-top: 20px; }
.management-editor hr { border: 0; border-top: 1px solid var(--border); margin-top: 28px; }
.management-form { display: flex; flex-direction: column; gap: 16px; }
.management-form > label, .management-form > p { margin: 0; }
.management-form > button { align-self: start; }
.management-check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.management-check input { width: 16px; height: 16px; flex: 0 0 auto; margin: 0; accent-color: var(--primary); }
.management-role-options { margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.management-role-options legend { padding-inline: 4px; font-weight: 600; }
.management-role-options label { margin: 0; }
.management-danger { color: var(--danger); border-color: var(--danger); background: var(--surface-1); }
#management-audit { margin-top: 24px; }
#management-audit summary { width: fit-content; cursor: pointer; padding: 8px 0; }
.management-event { display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.management-event p { margin: 0; flex-basis: 100%; }
@media(max-width: 1180px) {
    .management-layout:has(.management-editor:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
    .management-editor { padding: 20px 0 0; border-left: 0; border-top: 1px solid var(--border); }
    .management-editor-heading, .management-form, .management-editor > p { max-width: 600px; }
}
@media(max-width: 640px) {
    .management-toolbar { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
    .management-toolbar label { min-width: 0; }
    #management-search { display: grid; grid-template-columns: minmax(0,1fr) 120px; grid-column: 1 / -1; }
    #management-search label:first-child { max-width: none; min-width: 0; }
    #management-search > button { grid-column: 1 / -1; justify-self: start; }
    .management-toolbar > label { width: 100%; grid-column: 1 / -1; }
    .management-toolbar > button { min-height: 38px; }
    .management-tabs { width: 100%; }
    .management-tabs button { flex: 1; padding-inline: 8px; }
}
/* Search text is transient; stable identifiers stay in hidden form controls. */
.search-picker { display: block; min-width: 0; }
.search-picker input[type="search"] { width: 100%; min-width: 0; text-overflow: ellipsis; }
.search-picker-popup { position: fixed; z-index: 100; overflow: auto; overscroll-behavior: contain; padding: 5px; border: 1px solid #ccd4df; border-radius: 8px; background: #fff; color: #24324a; box-shadow: 0 8px 24px rgb(29 43 65 / 16%); }
.search-picker-popup[hidden] { display: none; }
.search-picker-option { padding: 9px 10px; border-radius: 4px; cursor: pointer; overflow-wrap: anywhere; }
.search-picker-option strong, .search-picker-option small { display: block; }
.search-picker-option strong { font-size: 13px; font-weight: 600; }
.search-picker-option small { margin-top: 3px; color: #52617a; font-size: 12px; }
.search-picker-option[aria-selected="true"] { background: #eaf0fb; color: #193d7b; }
.search-picker-status { margin: 5px 10px; color: #52617a; font-size: 12px; line-height: 1.6; }
.knowledge-filters .knowledge-version-controls { display: block; flex-basis: 100%; min-width: 0; }
.knowledge-version-controls label { display: block; margin-top: 12px; }
.knowledge-version-controls input, .knowledge-version-controls select { width: 100%; min-width: 0; }
.knowledge-version-controls p { font-size: 12px; line-height: 1.6; }
.knowledge-resolved-scope { padding: 0 18px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.knowledge-original { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.knowledge-original:empty { display: none; }
.knowledge-original code { display: block; font-size: 12px; margin-block: 10px; }
.knowledge-provenance { margin-block: 18px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.knowledge-provenance code { overflow-wrap: anywhere; min-width: 0; }
.knowledge-provenance p { flex-basis: 100%; margin: 0; }
.knowledge-provenance .muted { color: var(--text); }
.knowledge-provenance.superseded { border-color: var(--warning); }

/* A focused map workspace, with a native fullscreen option and an embedded-browser fallback. */
.document-heading { min-width: 0; flex: 1; }
#document-identity { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; color: var(--text); font-size: 12px; }
#document-identity[hidden] { display: none; }
#document-id { overflow-wrap: anywhere; user-select: text; min-width: 0; }
#document-copy-id { flex: none; padding: 4px 9px; min-height: 30px; font-size: 12px; }
#document-copy-status { color: var(--muted); }
.document-reference { text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.document-reference[aria-busy="true"] { opacity: .7; }
.graph-toolbar { flex-wrap: wrap; position: relative; z-index: 26; }
#graph-search { min-width: 0; flex: 1 1 240px; }
#graph-fullscreen { display: inline-flex; align-items: center; gap: 6px; }
#graph-fullscreen .nav-icon { width: 16px; height: 16px; flex: none; }
#graph-fullscreen[aria-pressed="true"] { background: var(--surface-2); color: var(--primary); }
body.graph-fullscreen { overflow: hidden; }
body.graph-fullscreen #workspace > .topbar,
body.graph-fullscreen #workspace > .page-heading { display: none; }
body.graph-fullscreen #graph-view {
    position: fixed;
    inset: 0;
    z-index: 30;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    grid-template-columns: minmax(0, 1fr);
}
body.graph-fullscreen #graph-view .graph-workspace { min-height: 0; height: 100%; }
body.graph-fullscreen #graph-view .graph-inspector {
    position: absolute;
    inset: var(--graph-toolbar-height, 62px) 0 0 auto;
    width: min(342px, calc(100% - 24px));
    max-height: none;
    z-index: 25;
    box-shadow: -8px 0 24px rgb(34 57 85 / 10%);
}
body.graph-fullscreen #graph-canvas.knowledge-map { min-height: 0; height: 100%; }
body.graph-fullscreen #graph-view .graph-toolbar { display: flex; flex-wrap: wrap; }
@media (max-width: 720px) {
    body.graph-fullscreen #graph-search { order: 2; flex-basis: 100%; max-width: none; }
    body.graph-fullscreen #graph-view .graph-inspector { top: var(--graph-toolbar-height, 108px); }
}
@media (max-width: 900px) {
    #graph-view .graph-inspector { top: var(--graph-toolbar-height, 62px); }
}
.reference-choices { display: block; margin-block: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.reference-choices button { display: block; margin-top: 8px; max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: left; }
