/* Application layout only. Controls, typography, surfaces and themes come from BlazorBlueprintUI. */
:root {
    --radius: .5rem;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--foreground);
    font-family: var(--font-sans);
}

* {
    box-sizing: border-box;
}

h1[tabindex="-1"]:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: .25rem;
    border-radius: var(--radius);
}

.workspace-body {
    min-width: 0;
    min-height: 100svh;
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.topbar-start, .topbar-end, .theme-controls, .account {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.topbar-end {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.page-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    max-width: 112rem;
    margin-inline: auto;
    padding: 2rem;
    min-width: 0;
    flex: 1;
}

html[data-content-width="full"] .page-content {max-width:none}
.layout-width-toggle {min-height:2.75rem;min-width:2.75rem;gap:.5rem}
.layout-width-label {white-space:nowrap}
@media(max-width:640px){.layout-width-label{display:none}}

.page-content > *, .page-heading > *, .form-grid > *, .settings-grid > *, .document-canvas, .published-document, .review-panel, .detail-editor, .list-panel {
    min-width: 0;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.page-heading > div:first-child {
    flex: 1;
    min-width: min(100%, 18rem);
}

.page-heading h1 {
    margin-block: .5rem;
    overflow-wrap: anywhere;
}

.heading-actions, .actions, .section-tools, .thread-decisions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .625rem;
}

.heading-actions {
    padding-top: .5rem;
}

.project-grid, .document-grid, .principles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
    gap: 1.25rem;
}

.project-grid a, .document-grid a {
    white-space: normal;
    height: auto;
    text-align: start;
    justify-content: flex-start;
    padding-inline: 0;
    overflow-wrap: anywhere;
}

.principles {
    margin-top: 1rem;
}

.section-heading, .section-toolbar, .published-section-heading, .thread-author, .member-row {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.section-heading, .published-section-heading {
    justify-content: space-between;
}

.section-toolbar {
    flex-wrap: wrap;
}

.section-tools {
    margin-left: auto;
}

.form-stack, .document-canvas, .published-document, .story-cell, .disclosure-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-grid, .settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.panel-content {
    padding-top: 1.5rem;
}

.editor-panel > .panel-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.filterbar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1rem;
}

.filterbar > :first-child {
    flex: 1;
    min-width: min(100%, 18rem);
}

.filterbar > :nth-child(2) {
    min-width: min(100%, 13rem);
}

.split-view.with-editor {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(20rem, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.document-workspace {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.publication-workspace {
    display: grid;
    grid-template-columns: 13rem minmax(0, 1fr) minmax(19rem, 22rem);
    gap: 1.25rem;
    align-items: start;
}

.outline-panel {
    position: sticky;
    top: 1.5rem;
    min-width: 0;
}

.outline-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .25rem;
}

.outline-links a, .outline-links button {
    white-space: normal;
    height: auto;
    min-height: 2.5rem;
    justify-content: flex-start;
    text-align: start;
    overflow-wrap: anywhere;
}

.section-separator {
    margin-block: 1.25rem;
}

.editable-section, .published-section {
    scroll-margin-top: 1.5rem;
}

.in-review {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.prose {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.prose:first-child {
    margin-top: 0;
}

.code-input textarea, .code-block {
    font-family: var(--font-mono, ui-monospace, monospace);
}

.code-block {
    padding: 1rem;
    margin: 0;
    overflow: auto;
    max-width: 100%;
    background: var(--muted);
    color: var(--foreground);
    border-radius: var(--radius);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Mermaid source/SVG rendering has no Blueprint equivalent. Published SVGs preserve their original theme. */
.diagram {
    min-width: 0;
    max-width: 100%;
    padding: 1rem;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}

.diagram img {
    display: block;
    max-width: 100%;
    height: auto;
    margin-inline: auto;
}

.diagram pre {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.file-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.file-row > .panel-content, .version-row > .panel-content {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.file-info, .version-info {
    flex: 1;
    min-width: min(100%, 15rem);
    overflow-wrap: anywhere;
}

.file-history {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
}

.file-history a {
    white-space: normal;
    height: auto;
}

.member-row {
    padding-block: 1rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    overflow-wrap: anywhere;
}

.member-row > div {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.review-target {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-bottom: 1rem;
}

.review-thread {
    margin-block: 1rem;
}

.thread-author {
    flex-wrap: wrap;
}

.thread-decisions button, .review-panel button {
    white-space: normal;
    height: auto;
    min-height: 2.25rem;
}

.new-comment {
    margin-top: 1.5rem;
}

.reply {
    border-left: 2px solid var(--border);
    padding-left: .75rem;
}

.story-cell {
    padding-block: .5rem;
    min-width: 15rem;
}

.story-card {
    white-space: normal;
}

.helper {
    color: var(--muted-foreground);
}

.workspace-footer {
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border);
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: .5rem;
    left: 1rem;
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: translateY(0);
}

.login-layout {
    min-height: 100svh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.login-story {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    gap: 3rem;
    padding: clamp(2rem, 6vw, 6rem);
    background: var(--muted);
    color: var(--foreground);
}

.login-story > div {
    max-width: 34rem;
}

.login-panel {
    position: relative;
    display: grid;
    align-items: center;
    padding: 5rem 2rem 3rem;
}

.login-form {
    width: 100%;
    max-width: 29rem;
    margin-inline: auto;
}

.login-theme {
    position: absolute;
    right: 1.5rem;
    top: 1.25rem;
}

.login-divider {
    margin-block: 1.5rem;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 1000;
}

@media (max-width: 1399px) {
    .publication-workspace {
        grid-template-columns: minmax(0, 1fr) minmax(18rem, 21rem);
    }

    .publication-workspace > .outline-panel {
        grid-column: 1 / -1;
        position: static;
    }

    .publication-workspace .outline-links {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 1050px) {
    .document-workspace, .split-view.with-editor, .settings-grid, .publication-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .outline-panel {
        position: static;
    }

    .outline-links {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .account-name {
        display: none;
    }
}

@media (max-width: 767px) {
    .page-content {
        padding: 1rem;
        gap: 1.25rem;
    }

    .topbar {
        padding: .75rem 1rem;
    }

    .topbar-start {
        flex: 1;
    }

    .topbar-end {
        gap: .5rem;
    }

    .topbar-start > :last-child {
        display: none;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .heading-actions {
        width: 100%;
    }

    .heading-actions a, .heading-actions button {
        white-space: normal;
        height: auto;
        min-height: 2.5rem;
    }

    .login-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .login-story {
        padding: 2rem 1.25rem;
        gap: 1.5rem;
    }

    .login-story h1 {
        font-size: 2rem;
    }

    .login-panel {
        padding-inline: 1rem;
    }

    .workspace-footer {
        padding: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Stable categorical tokens, independent of the chosen accent palette. */
:root {
 --nq-feature:oklch(.49 .2 295); --nq-story:oklch(.46 .15 240);
 --nq-requirement:oklch(.48 .12 70); --nq-criterion:oklch(.43 .12 165);
 --nq-danger:oklch(.47 .19 25); --nq-diagram:#0f766e;
 --nq-map-journey:#4338ca; --nq-map-activity:#6d28d9; --nq-map-task:#0f766e; --nq-map-task-surface:#ccfbf1;
 --nq-map-activity-banner:#6d28d9; --nq-map-activity-foreground:#fff;
}
.dark {
 --nq-feature:oklch(.8 .15 295); --nq-story:oklch(.8 .13 240);
 --nq-requirement:oklch(.85 .14 80); --nq-criterion:oklch(.8 .13 165);
 --nq-danger:oklch(.8 .13 25); --nq-diagram:#5eead4;
 --nq-map-journey:#a5b4fc; --nq-map-activity:#c4b5fd; --nq-map-task:#5eead4; --nq-map-task-surface:color-mix(in srgb,var(--nq-map-task) 18%,var(--background));
 --nq-map-activity-banner:#5b21b6;
}
.content-type-diagram {--kind-color:var(--nq-diagram)}
.tree-content-diagram {color:var(--nq-diagram)}
.content-type-feature {--kind-color:var(--nq-feature)}
.content-type-story {--kind-color:var(--nq-story)}
.content-type-requirement {--kind-color:var(--nq-requirement)}
.content-type-acceptancecriterion {--kind-color:var(--nq-criterion)}
.content-type {color:var(--kind-color);background:color-mix(in srgb,var(--kind-color) 12%,transparent);border-color:color-mix(in srgb,var(--kind-color) 40%,var(--border));white-space:normal}
.tree-content-feature {color:var(--nq-feature)}
.tree-content-story {color:var(--nq-story)}
.tree-content-requirement {color:var(--nq-requirement)}
.tree-content-acceptancecriterion {color:var(--nq-criterion)}
.repository-dock {height:calc(100svh - 15rem);min-height:36rem;min-width:0;contain:inline-size}
.repository-panel {padding:1rem;min-width:0}
.repository-panel h2 {font-size:1.25rem;border:0}
.repository-workspace {min-width:0;height:100%;overflow:auto}
.repository-workspace [role=tablist] {max-width:100%}
.repository-workspace [role=tabpanel] {min-width:0}
.rich-text {line-height:1.65;overflow-wrap:anywhere;white-space:normal;min-width:0}
.rich-text > :first-child {margin-top:0}
.rich-text p {margin-block:.75rem}
.rich-text h1,.rich-text h2,.rich-text h3,.rich-text h4 {font-weight:650;line-height:1.3;margin-block:1.5rem .75rem}
.rich-text h1 {font-size:1.75rem}.rich-text h2{font-size:1.5rem}.rich-text h3{font-size:1.25rem}
.rich-text ul {list-style:disc;padding-left:1.5rem}.rich-text ol{list-style:decimal;padding-left:1.5rem}
.rich-text li {margin-block:.35rem}
.rich-text blockquote {border-left:3px solid var(--border);padding-left:1rem;color:var(--muted-foreground)}
.rich-text pre {white-space:pre-wrap;padding:1rem;background:var(--muted);border-radius:var(--radius)}
.rich-text code {font-family:var(--font-mono,monospace);background:var(--muted)}
.rich-text a {color:var(--primary);text-decoration:underline}
.rich-text table {display:block;overflow:auto;max-width:100%;border-collapse:collapse}
.rich-text th,.rich-text td {border:1px solid var(--border);padding:.5rem;text-align:left}
.rich-text .ql-align-center {text-align:center}.rich-text .ql-align-right{text-align:right}.rich-text .ql-align-justify{text-align:justify}
.rich-text-field {min-width:0}
.rich-text-field [contenteditable] {overflow-wrap:anywhere}
@media(max-width:1100px) {.repository-panel{padding:.75rem}.repository-workspace{min-height:20rem}}

.repository-native-dock {height:100%;min-height:0;min-width:0}
.repository-mobile-dock {height:70svh;min-height:30rem}
.repository-pane-title {padding:.75rem 1rem;border-bottom:1px solid var(--border);font-size:.875rem}
.relation-row {display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;overflow-wrap:anywhere}
.relation-row > :nth-child(2) {flex:1;min-width:0}
/* Structured reading: the template is visible independently of the theme accent. */
.content-reading {display:grid;gap:1.5rem;min-width:0;max-width:78ch;line-height:1.7}
.spec-structure {display:grid;gap:1rem;padding:1.15rem;border:1px solid color-mix(in srgb,var(--kind-color) 22%,var(--border));border-left:3px solid var(--kind-color);border-radius:var(--radius);background:color-mix(in srgb,var(--kind-color) 5%,var(--background));min-width:0}
.spec-clause {display:flex;align-items:start;gap:.75rem;min-width:0}
.spec-clause-icon {display:inline-flex;align-items:center;justify-content:center;flex:0 0 28px;width:28px;height:28px;border-radius:7px;background:color-mix(in srgb,var(--kind-color) 10%,var(--background));color:var(--kind-color)}
.spec-clause-text {margin:0!important;font-size:15px;line-height:1.7;overflow-wrap:anywhere;min-width:0;color:var(--foreground)}
.spec-clause-text strong {font-weight:700;color:var(--kind-color)}
.spec-placeholder {font-style:italic;color:var(--muted-foreground)}
.content-reading .rich-text h1,.content-reading .rich-text h2,.content-reading .rich-text h3,.content-reading .rich-text h4 {color:var(--kind-color)}
.content-reading .rich-text h4 {font-size:1rem;padding-bottom:.5rem;border-bottom:1px solid var(--border)}
.content-reading .rich-text th {background:color-mix(in srgb,var(--kind-color) 6%,var(--background));font-weight:650}
.content-reading .rich-text strong {font-weight:700}
.content-planning-badges {display:flex;align-items:center;flex-wrap:wrap;gap:5px;min-width:0}
.content-planning-badges > * {font-size:12px;line-height:17px}
.item-state {--state-color:var(--muted-foreground)}
.item-state-inprogress,.item-state-planned {--state-color:var(--nq-story)}
.item-state-done {--state-color:var(--nq-criterion)}
.item-state-blocked,.item-risk-critical {--state-color:var(--nq-danger)}
.item-risk-high,.item-priority {--state-color:var(--nq-requirement)}
.item-state,.item-risk-critical,.item-risk-high,.item-priority {color:var(--state-color);border-color:color-mix(in srgb,var(--state-color) 32%,var(--border));background:color-mix(in srgb,var(--state-color) 7%,var(--background))}
.item-effort {color:var(--muted-foreground);background:var(--background)}
.content-legend {width:min(360px,calc(100vw - 24px))!important;display:grid;gap:1rem}
.content-legend h3 {font-size:14px;margin:0}
.content-legend-types,.content-legend-states {display:flex;flex-wrap:wrap;gap:8px}
.content-legend p {font-size:13px;line-height:1.6;margin:0}
.repository-reading-toolbar {gap:.75rem;flex-wrap:wrap}
.repository-reading-toolbar .actions {gap:.5rem;flex-wrap:wrap}
.repository-reading-toolbar [role=radiogroup] {flex-shrink:0}
.repository-reading-toolbar [role=radio],.map-display-controls [role=radio] {gap:6px}

.topics-layout {display:grid;grid-template-columns:minmax(16rem,1fr) minmax(0,2fr);gap:1.5rem;align-items:start}
.topic-message {padding:1rem;border-left:2px solid var(--border);overflow-wrap:anywhere}
@media(max-width:900px){.topics-layout{grid-template-columns:minmax(0,1fr)}}

.repository-panel h3 {font-size:1rem}

.repository-center {height:100%;min-height:0;min-width:0}
.repository-linked-area {height:100%;min-height:0;min-width:0;display:flex;flex-direction:column}
.repository-linked-heading {padding:.5rem 1rem;border-bottom:1px solid var(--border);flex:none}
.repository-linked-heading h3 {font-size:.875rem;display:flex;align-items:center;gap:.5rem;flex-wrap:wrap}
.repository-linked-heading p {font-size:.75rem}
.repository-linked-dock {flex:1;min-height:0;min-width:0}
.repository-linked-dock .repository-panel {padding:.75rem;user-select:text}

/* Les nouvelles pages conservent les tokens du thème Blueprint. */
.assurance-columns{display:grid;grid-template-columns:minmax(15rem,1fr) minmax(0,2fr);gap:1.5rem;align-items:start}
.assurance-columns>*{min-width:0}.metric-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1rem}
.comparison-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}.comparison-grid>*{min-width:0}
.diff-code{display:block;white-space:pre-wrap;overflow-wrap:anywhere;max-height:28rem;overflow:auto;font-weight:400}
.revision-picker{max-height:20rem;overflow:auto;display:grid;gap:.5rem;padding:.25rem}
@media(max-width:900px){.assurance-columns{grid-template-columns:1fr}.metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.comparison-grid{grid-template-columns:1fr}.page-content [role=tablist]{max-width:100%;overflow-x:auto;justify-content:flex-start}}

.assurance-table{min-width:0;max-width:100%;overflow-x:auto}

.assurance-table-shell{min-width:0;max-width:100%;overflow-x:auto}

@media(max-width:600px){.assurance-table-shell ul{flex-wrap:wrap;gap:.75rem}.assurance-table-shell [class*="bb:justify-between"]{flex-wrap:wrap;gap:.75rem}}

/* Narrative order is preserved in a locally scrollable matrix. */
.story-map-controls { display:flex; align-items:end; gap:1rem; flex-wrap:wrap; margin-bottom:1rem; }
.story-map-controls > * { min-width:0; }
.story-map-controls > .bb-field { flex:1 1 18rem; }
.story-map-scroll { width:100%; max-width:100%; overflow-x:auto; border-radius:var(--radius); }
.story-map-scroll:focus-visible { outline:2px solid var(--ring); outline-offset:3px; }
.story-map-journey { min-width:0; overflow:hidden; }
.story-map-journey .story-card { min-width:0; }
.story-map-journey th { white-space:normal; }
.spec-guide { max-width:78ch; margin-inline:auto; }
@media(max-width:640px) { .story-map-controls { align-items:stretch; flex-direction:column; } .story-map-controls > * { width:100%; flex-basis:auto; } }

/* Story map colors identify hierarchy, independent of the application accent theme. */
.map-kind {color:var(--map-kind);background:color-mix(in srgb,var(--map-kind) 14%,var(--background));border-color:color-mix(in srgb,var(--map-kind) 45%,var(--border))}
.map-kind-journey {--map-kind:var(--nq-map-journey)}
.map-kind-activity {--map-kind:var(--nq-map-activity);background:var(--nq-map-activity-banner);color:var(--nq-map-activity-foreground);border-color:var(--nq-map-activity-banner)}
.map-kind-task {--map-kind:var(--nq-map-task);background:var(--nq-map-task-surface)}

/* Visual story map: narrative columns, release bands and connected Blueprint Sortables. */
.map-view-toolbar,.map-board-toolbar { display:flex; gap:1rem; align-items:end; flex-wrap:wrap; margin-bottom:1rem; }
.map-view-toolbar > :first-child,.map-board-toolbar > :first-child { flex:1 1 16rem; min-width:0; }
.map-view-toolbar .actions,.map-board-toolbar .actions { align-self:center; }
.map-workspace {min-width:0;display:flex;flex-direction:column;gap:1rem}
.map-surface { position:relative; width:100%; max-width:100%; height:var(--map-height,min(74vh,1100px)); min-height:380px; overflow:auto; overscroll-behavior:contain; border:1px solid var(--border); border-radius:var(--radius); background-color:var(--muted); background-image:radial-gradient(var(--border) 1px,transparent 1px); background-size:18px 18px; margin-top:0;scroll-padding-top:136px; }
.map-surface:focus-visible { outline:2px solid var(--ring); outline-offset:2px; }
.map-canvas { min-width:max-content; padding:1.25rem; }
.map-journey { margin-bottom:2rem; }
.map-journey-heading { display:flex; justify-content:space-between; align-items:center; gap:1rem; margin-bottom:1rem; max-width:1100px; padding:1rem; border-left:4px solid var(--nq-map-journey); border-radius:var(--radius); background:color-mix(in srgb,var(--nq-map-journey) 12%,var(--background)); }
.map-journey-heading h2 { display:flex;align-items:start;gap:.625rem;margin:0 0 .25rem; }
.map-journey-heading h2 > svg {color:var(--nq-map-journey);flex-shrink:0;margin-top:.2rem}
.map-journey-heading p {color:var(--nq-map-journey)}
.map-journey-body { display:flex; align-items:start; gap:12px; }
.map-release-labels { position:sticky; left:0; z-index:8; width:180px; flex:0 0 180px; background:var(--muted); }
.map-backbone-spacer {position:sticky;top:0;z-index:16;background:var(--muted);height:124px; display:flex; align-items:end; padding:12px; }
.map-release-label { display:flex; flex-direction:column; align-items:start; justify-content:start; gap:.5rem; padding:20px 10px; border-top:1px solid var(--border); }
.map-activities,.map-tasks { display:flex!important; flex-direction:row!important; flex-wrap:nowrap; align-items:stretch; gap:12px!important; }
.map-activities > [data-bb-sortable-item],.map-tasks > [data-bb-sortable-item] { flex:0 0 auto; }
.map-activity { border:1px solid color-mix(in srgb,var(--nq-map-activity) 45%,var(--border)); border-radius:var(--radius); background:var(--background);overflow:visible; }
.map-activity-heading {position:sticky;top:0;z-index:14;border-radius:calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;height:54px; display:flex; align-items:center; gap:8px; padding:6px 10px; background:var(--nq-map-activity-banner); color:var(--nq-map-activity-foreground); border-bottom:1px solid var(--nq-map-activity-banner); }
.map-activity-heading h3 { display:flex;align-items:center;gap:.5rem;flex:1;min-width:0;margin:0;font-size:14px;line-height:20px;color:inherit; }
.map-activity-heading h3 > svg,.map-task-heading svg {flex-shrink:0}
.map-activity-heading button {color:inherit}
.map-activity-heading button:hover,.map-activity-heading button:focus-visible {background:rgb(255 255 255 / 18%);color:inherit}
.map-activity-heading button:focus-visible {outline:2px solid currentColor;outline-offset:2px}
.map-tasks { gap:0!important; }
.map-task-column { width:var(--map-column-width,336px); }
.map-task-heading {position:sticky;top:54px;z-index:12;height:70px; display:flex; align-items:center; gap:6px; padding:10px 8px; background:var(--nq-map-task-surface);color:var(--nq-map-task); border-bottom:1px solid color-mix(in srgb,var(--nq-map-task) 40%,var(--border)); }
.map-task-heading > :nth-child(2) {display:flex;align-items:center;gap:.5rem;flex:1;white-space:normal;min-width:0;font-weight:650}
.map-task-heading button {color:inherit}
.map-task-heading button:hover,.map-task-heading button:focus-visible {background:var(--background);color:inherit}
.map-cell { width:var(--map-column-width,336px); border-right:1px solid var(--border); border-bottom:1px solid var(--border); padding:6px; display:flex; flex-direction:column; background:var(--background); }
.map-card-stack { min-height:calc(100% -32px); gap:8px!important; padding:2px; }
.map-card-stack > [data-bb-sortable-item],.map-backlog-stack > [data-bb-sortable-item] { height:var(--map-card-height,328px); flex:0 0 auto; }
.map-add-story { align-self:start; margin-top:auto; }
.map-story-card { height:var(--map-card-height,328px);border:1px solid color-mix(in srgb,var(--nq-story) 50%,var(--border));border-left:4px solid var(--nq-story);box-shadow:0 1px 3px color-mix(in oklch,var(--nq-story) 12%,transparent);overflow:hidden;transition:opacity .15s,border-color .15s;background:color-mix(in srgb,var(--nq-story) 18%,var(--background)); }
.map-story-card:hover,.map-story-card:focus-within {border-color:var(--nq-story)}
.map-story-inner { height:100%; padding:12px!important; display:flex; flex-direction:column; gap:10px;min-width:0; }
.map-story-top { display:flex; align-items:center; gap:6px;min-width:0; }
.map-story-key {font-family:var(--font-mono,monospace);font-size:11px;min-width:0;overflow-wrap:anywhere;max-width:calc(100% - 60px);background:var(--background)}
.map-story-top > .map-revision { margin-left:auto;color:var(--nq-story);font-size:11px;flex-shrink:0 }
.map-story-top .story-grip {color:var(--nq-story)}
.map-story-title { display:-webkit-box!important; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; height:auto!important; min-height:20px; max-height:40px;flex-shrink:0; padding:0!important; text-align:left; white-space:normal!important; color:var(--foreground)!important; line-height:20px; font-size:14px;font-weight:700; text-decoration:none!important;overflow-wrap:anywhere; }
.map-story-title:hover {text-decoration:underline!important;text-underline-offset:3px}
.map-story-excerpt { display:-webkit-box; -webkit-line-clamp:7; -webkit-box-orient:vertical; overflow:hidden; font-size:13px!important; line-height:19px!important; margin:0!important; }
.map-story-card .spec-structure-compact {padding:0;border:0;background:transparent;gap:10px;min-height:0}
.map-story-card .spec-clause {gap:7px}
.map-story-card .spec-clause-icon {flex-basis:16px;width:16px;height:18px;background:transparent;border-radius:0}
.map-story-card .spec-clause-text {font-size:13px;line-height:18px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.map-story-card .spec-clause-text strong {font-weight:700}
.map-story-meta {display:flex;align-items:start;flex-wrap:wrap;gap:4px;margin-top:auto;padding-top:8px;border-top:1px solid color-mix(in srgb,var(--nq-story) 30%,var(--border));min-width:0;flex-shrink:0}
.map-story-meta .content-planning-badges {gap:4px}
.map-story-meta .content-planning-badges > * {font-size:11px;line-height:15px;padding:2px 6px;gap:4px}
.map-density-compact .map-story-inner {padding:10px!important;gap:7px}
.map-density-compact .spec-structure-compact {gap:6px}
.map-density-compact .spec-actor .spec-clause-text,.map-density-compact .spec-benefit .spec-clause-text {-webkit-line-clamp:1}
.map-density-compact .map-story-excerpt {-webkit-line-clamp:4}
.map-density-compact .map-story-meta {padding-top:5px}
.map-display-controls {gap:.5rem}
.map-story-dimmed { opacity:.24; }
.map-story-dimmed:focus-within { opacity:1; }
.map-drag-preview { width:244px; padding:12px; background:var(--background); color:var(--foreground); border:2px solid var(--primary); border-radius:var(--radius); box-shadow:0 8px 24px #0003; }
.map-backlog { margin-top:1.25rem; padding:1rem; border:1px solid var(--border); border-radius:var(--radius); background:var(--background); }
.map-backlog h2 { margin:0; }
.map-backlog-stack { display:grid!important; grid-template-columns:repeat(auto-fill,minmax(min(100%,296px),1fr)); min-height:100px; gap:12px!important; padding-top:12px; }
.map-activity-empty { width:var(--map-column-width,336px); padding:1rem; }
.map-empty-hint { padding:1rem; }
.map-editor-dialog { max-width:min(860px,95vw)!important; max-height:90dvh; overflow-y:auto; }
.map-node-dialog { max-width:min(660px,95vw)!important; max-height:90dvh; overflow-y:auto; }
.vocabulary-field [role=combobox] { width:100%; }
@media(max-width:640px) { .map-view-toolbar,.map-board-toolbar { align-items:stretch; flex-direction:column; } .map-view-toolbar > *,.map-board-toolbar > * { width:100%; flex-basis:auto!important; } .map-surface { height:65dvh; } .map-release-labels { width:112px; flex-basis:112px; } .map-canvas { padding:.75rem; } .map-journey-heading { max-width:calc(100vw -60px); align-items:start; flex-direction:column; } }
@media(prefers-reduced-motion:reduce) { .map-story-card { transition:none; } }

@media(min-width:1100px) {
 .map-board.map-backlog-open {grid-template-columns:minmax(0,1fr) 310px}
 .map-backlog {margin-top:0;align-self:start;height:var(--map-height,min(74vh,1100px));overflow:auto;padding:12px}
 .map-backlog .section-heading {align-items:start;flex-direction:column}
 .map-backlog .section-heading h2 {font-size:16px}
 .map-backlog-stack {grid-template-columns:1fr}
}

.map-board-toolbar > :nth-child(2) { flex:0 1 220px; width:auto; }
.map-board-toolbar > :first-child { width:auto; }

@media(max-width:640px) { .map-board-toolbar > :nth-child(2) { width:100%; flex-basis:auto; } }

.document-reader {display:grid;gap:1.25rem;min-width:0}
.document-reader {container-type:inline-size}
.document-reader-layout {display:grid;grid-template-columns:15rem minmax(0,1fr);gap:1.25rem;align-items:start;min-width:0}
.document-reader-sidebar {position:sticky;top:1rem;min-width:0}
.document-reader-content {display:grid;gap:1.1rem;min-width:0}
.document-reader-section {scroll-margin-top:5rem;min-width:0}
.document-preview-dialog {max-width:min(1440px,96vw)!important;height:min(94svh,1200px);max-height:94svh;overflow:hidden;display:flex;flex-direction:column}
.document-preview-dialog .document-reader {display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden}
.document-preview-dialog .document-reader-layout {flex:1;min-height:0}
.document-preview-dialog .document-reader-content {height:100%;min-height:0;overflow:auto;padding:.25rem .5rem .5rem;scroll-padding-top:1rem}
.document-preview-dialog .document-outline-list {max-height:calc(94svh - 24rem)}
.document-sharing-dialog {max-width:min(700px,95vw)!important;max-height:92svh;overflow:auto}
.shared-document-workspace {display:grid;grid-template-columns:minmax(0,1fr) minmax(300px,380px);gap:1.5rem;align-items:start;min-width:0}
.shared-document-workspace > * {min-width:0}
.shared-review {display:grid;gap:1rem}
.shared-review .spec-clause-text {font-size:14px}
@media(max-width:1100px){.shared-document-workspace{grid-template-columns:minmax(0,1fr)}}

/* Planning workspace: one journey, a fixed backbone and details on demand. */
.map-journey-navigation {display:flex;align-items:end;justify-content:space-between;gap:1rem;flex-wrap:wrap}
.map-journey-select {flex:1 1 28rem;min-width:0}
.map-journey-navigation .actions {gap:.5rem}
.map-board {display:grid;grid-template-columns:minmax(0,1fr);gap:1rem;min-width:0}
.map-board > * {min-width:0}
.map-board-toolbar {margin-bottom:0;gap:.75rem}
.map-instructions {font-size:12px}
.map-overview {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,22rem),1fr));gap:1rem}
.map-overview-card {border-top:3px solid var(--nq-map-journey);min-width:0}
.map-overview-card h3 {display:flex;gap:.5rem;align-items:start;font-size:1.1rem}
.map-overview-card svg {color:var(--nq-map-journey);flex-shrink:0}
.map-release-total {font-weight:650}
.map-release-effort {font-size:12px;line-height:1.5;overflow-wrap:anywhere}
.map-card-menu {width:24px;height:24px;min-width:24px;color:var(--nq-story)}
.map-story-key {max-width:calc(100% - 90px)}
.map-story-persona {display:flex;align-items:center;gap:6px;color:var(--nq-story);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-height:18px;max-width:100%}
.map-story-persona svg {flex-shrink:0}
.map-story-dependencies {font-size:11px;line-height:15px;padding:2px 6px;background:var(--background);color:var(--nq-story)}
.map-density-compact .map-story-title {min-height:40px}
.map-surface .story-grip,.map-surface .map-story-title {scroll-margin-top:136px}
.map-workspace[data-dragging="true"] .map-cell[data-locked="false"] {background:color-mix(in srgb,var(--nq-story) 7%,var(--background));outline:1px dashed var(--nq-story);outline-offset:-2px}
.map-workspace[data-dragging="true"] .map-cell[data-drop-target="true"] {background:color-mix(in srgb,var(--nq-story) 17%,var(--background));outline:2px solid var(--nq-story)}
.map-workspace .sortable-ghost,.map-workspace [data-keyboard-dragging="true"] {outline:2px dashed var(--nq-story);outline-offset:2px}
.map-page-workspace {display:grid;grid-template-columns:minmax(0,1fr);gap:1rem;align-items:start;min-width:0}
.map-page-workspace > * {min-width:0}
.map-story-inspector {min-width:0;scroll-margin-top:1rem;border-top:4px solid var(--nq-story)}
.map-story-inspector .form-grid {grid-template-columns:minmax(0,1fr)}
.map-story-inspector-header {display:flex;align-items:start;justify-content:space-between;gap:.75rem}
.map-story-inspector-header h2 {font-size:1.25rem;margin:0}
.map-story-inspector-header p {font-size:13px}
.map-inspector-actions {display:flex;gap:.5rem;flex-wrap:wrap;position:sticky;bottom:0;background:var(--background);padding:1rem;border-top:1px solid var(--border);z-index:2}
.map-prerequisites {display:grid;gap:.5rem}
.map-prerequisite {display:grid;gap:.35rem;border-left:3px solid var(--nq-story);padding:.5rem .75rem;background:var(--muted)}
.map-undo {display:flex;align-items:center;gap:.75rem;justify-content:space-between;flex-wrap:wrap;padding:.75rem 1rem;background:var(--muted);border-radius:var(--radius)}
@media(min-width:1200px){
 .map-page-workspace.map-inspector-open {grid-template-columns:minmax(0,1fr) minmax(360px,460px)}
 .map-story-inspector {position:sticky;top:1rem;max-height:calc(100dvh - 2rem);overflow:auto}
}
@media(max-width:640px){.map-journey-navigation{align-items:stretch}.map-journey-select{flex-basis:100%}.map-display-controls{flex-wrap:wrap}.map-board-toolbar{gap:.75rem}.map-journey-heading h2{font-size:1.25rem}}

/* A shared, route-free outline for editing, preview and shared documents. */
.document-section-neutral {--kind-color:var(--nq-map-journey)}
.document-outline {min-width:0}
.document-outline-toggle {width:100%;justify-content:flex-start;gap:.5rem;font-weight:650;padding:0;white-space:normal;height:auto;text-align:left}
.document-outline-toggle > svg:last-child {margin-left:auto;flex-shrink:0}
.document-outline-content {padding:.5rem!important}
.document-outline-list {display:flex;flex-direction:column;gap:.25rem;max-height:calc(100svh - 12rem);overflow:auto;overscroll-behavior:contain;padding:.25rem}
.document-outline-link {justify-content:flex-start;align-items:flex-start;text-align:left;gap:.55rem;white-space:normal;height:auto;min-height:44px;padding:.65rem .65rem .65rem calc(.65rem + var(--section-depth,0)*.65rem);border-left:3px solid transparent;flex-shrink:0;min-width:0}
.document-outline-link > svg {color:var(--kind-color);flex-shrink:0;margin-top:.15rem}
.document-outline-link[aria-current="location"] {border-color:var(--kind-color);background:color-mix(in srgb,var(--kind-color) 12%,var(--background))}
.document-outline-text {display:grid;gap:.2rem;min-width:0;overflow-wrap:anywhere}
.document-outline-text > :first-child {font-weight:600;line-height:1.4;color:var(--foreground)}
.document-outline-text > :last-child {font-size:11px;line-height:1.4;color:var(--kind-color)}
.document-reader-section,.editable-section {border-top:3px solid var(--kind-color);min-width:0}
.document-section-child {margin-left:calc(var(--section-depth,1)*.8rem);border-left:3px solid var(--kind-color);background:color-mix(in srgb,var(--kind-color) 4%,var(--background));position:relative}
.document-parent-hint {display:flex;align-items:center;gap:.4rem;font-size:12px;color:var(--kind-color);line-height:1.4}
.document-reader-section h3 {font-size:1.25rem}.document-reader-section h4{font-size:1.1rem}
.document-section-kind {background:color-mix(in srgb,var(--kind-color) 12%,var(--background));color:var(--kind-color);border-color:color-mix(in srgb,var(--kind-color) 40%,var(--border))}
.document-reader-section:focus-visible,.editable-section:focus-visible {outline:2px solid var(--ring);outline-offset:3px}
@container(width < 760px){
 .document-reader-layout {grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr)}
 .document-reader-sidebar {position:static}
 .document-reader .document-outline-list {max-height:13rem}
 .document-reader-section.document-section-child {margin-left:calc(var(--section-depth,1)*.4rem)}
}
@media(max-width:1050px){.document-workspace .document-outline-list {max-height:14rem}}
@media(max-width:640px){.document-preview-dialog {max-height:96svh}.document-preview-dialog .document-reader-content {height:100%;min-height:0}.document-preview-dialog .document-reader .document-outline-list {max-height:9rem}.document-section-child{margin-left:calc(var(--section-depth,1)*.4rem)}}

.content-reading.content-type-diagram {max-width:none}

/* Folding keeps each section's identity visible and never unmounts an editor. */
[data-document-section][hidden] {display:none!important}
.document-section-title-row {display:flex;align-items:center;gap:.35rem;min-width:0}
.document-section-title-row [data-slot="card-title"] {margin:0;min-width:0}
.document-section-toggle {flex-shrink:0;min-width:36px;min-height:36px;color:var(--kind-color,var(--foreground))}
.document-descendant-count {padding-left:2.6rem;font-size:.8rem}
.document-section-body {min-width:0}
.document-editor-section-title {min-width:0;flex:1;overflow-wrap:anywhere;font-weight:650}
.document-fold-controls {gap:.25rem}
.document-section-body[data-state="closed"] {visibility:hidden}
.diagram.published-svg {background:#fff;color:#172033;color-scheme:light}
.rich-text img {max-width:100%;height:auto;display:block;margin-block:1rem;border-radius:var(--radius)}
.rich-text h5 {font-size:.95rem;font-weight:650;margin-block:1.1rem .5rem}
.rich-text h6 {font-size:.875rem;font-weight:650;margin-block:1rem .4rem;color:var(--muted-foreground)}
.rich-text-field .rich-editor-controls {display:flex;align-items:center;flex-wrap:wrap;gap:.75rem;justify-content:space-between}
.rich-text-field .rich-editor-styles {width:min(100%,19rem)}
.rich-html-source textarea {min-height:20rem;font-family:var(--font-mono,monospace);font-size:.85rem;line-height:1.6;tab-size:2}
.rich-text-field [hidden] {display:none!important}
@media print {[data-document-section][hidden]{display:block!important}.document-section-body{visibility:visible!important;grid-template-rows:1fr!important}.document-fold-controls,.document-section-toggle{display:none!important}}

.diagram[data-diagram-surface="light"] {background:#fff;color:#172033;color-scheme:light}
.diagram[data-diagram-surface="dark"] {background:var(--card);color-scheme:dark}

/* The shared style selector also exposes h4-h6, replacing the native h1-h3 subset. */
.rich-text-field [data-slot="toolbar"] select[data-bb-native-select] {display:none}

/* Blueprint puts the content class on an inner wrapper; hide its closed region
   while retaining the native disclosure state and every mounted editor. */
[data-document-section] [role="region"][data-state="closed"]:has(> div > .document-section-body) {display:none}
@media print {[data-document-section] [role="region"]:has(> div > .document-section-body){display:block!important}}

/* Identity and explicit ordering. */
.entity-visual {width:3rem;height:3rem;flex-shrink:0;border:1px solid var(--border);border-radius:.65rem;background:var(--muted);color:var(--primary)}
.entity-visual img {object-fit:cover;width:100%;height:100%}
.project-heading-identity,.document-heading-identity,.entity-visual-choice {display:flex;align-items:center;gap:.85rem;min-width:0}
.project-heading-identity .entity-visual {width:2.25rem;height:2.25rem}
.entity-visual-picker {gap:.75rem;max-width:36rem}.entity-visual-picker [data-slot="file-upload"]{min-width:0}
.document-list-toolbar {display:flex;align-items:end;justify-content:space-between;gap:1rem;flex-wrap:wrap}
.document-sort-controls {display:flex;flex-direction:column;gap:.75rem;width:100%}
.document-sort-field {min-width:0}
@media (min-width:768px) {
    .document-sort-controls {flex-direction:row;align-items:center;width:auto;max-width:100%}
    .document-sort-controls .document-sort-field {flex-direction:row;align-items:center;gap:.6rem}
    .document-sort-field > label {flex:none}
}
.document-list-status {display:flex;flex-wrap:wrap;align-items:center;gap:.6rem 1.2rem}
.document-archive-filter {display:flex;align-items:center;gap:.5rem}
.document-type-section {display:grid;gap:.85rem;min-width:0}
.document-type-section + .document-type-section {margin-top:.5rem}
.document-type-section .document-grid {grid-template-columns:repeat(auto-fill,minmax(min(100%,19rem),1fr))}
.document-type-heading {display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.6rem;padding-bottom:.65rem;border-bottom:1px solid var(--border)}
.document-type-label {display:flex;align-items:center;gap:.65rem;min-width:0}
.document-type-label svg {flex-shrink:0;color:var(--primary)}
.document-type-title {font-size:1.12rem;line-height:1.35;margin:0;overflow-wrap:anywhere}
.document-card-badges {display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:.35rem;min-width:0}
.document-type-badge {white-space:normal;overflow-wrap:anywhere;max-width:100%;color:var(--primary)}
.document-story-version {width:fit-content;max-width:100%;white-space:normal;overflow-wrap:anywhere}
.document-order-list {list-style:decimal outside;display:grid;gap:.35rem;margin:0;padding:0 .15rem 0 1.6rem;max-height:50dvh;overflow:auto}
.document-order-list li::marker {color:var(--muted-foreground);font-variant-numeric:tabular-nums}
.document-order-row {display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:.5rem;padding:.45rem .15rem .45rem .45rem;border-bottom:1px solid var(--border)}
.document-order-title {display:block;overflow-wrap:anywhere}
.document-order-actions {display:flex;gap:.2rem}
/* Modal content stays inside the viewport, with one bounded scrolling body. */
[role="dialog"][aria-modal="true"] {max-height:calc(100dvh - 2rem);overflow:auto;overscroll-behavior:contain}
.document-preview-dialog[role="dialog"] {overflow:hidden;min-height:0;max-height:94dvh}
.document-preview-dialog>*,.document-reader-layout>*,.repository-center>*,.repository-linked-dock>*,.repository-native-dock>* {min-height:0;min-width:0}
.document-reader-content {align-content:start;grid-auto-rows:max-content}
.document-preview-dialog .document-reader-layout {height:100%;overflow:hidden;align-items:stretch}
.document-preview-dialog .document-reader-sidebar {position:static;min-height:0;overflow:hidden}
.document-preview-dialog .document-outline {max-height:100%}
.document-preview-dialog .document-outline>div {max-height:100%}
.document-preview-dialog .document-outline-list {max-height:calc(94dvh - 26rem);overscroll-behavior:contain}
.repository-dock {min-height:min(36rem,calc(100dvh - 2rem))}
.repository-workspace,.repository-panel,.repository-linked-dock,.repository-native-dock {min-height:0;min-width:0;overscroll-behavior:contain}
.repository-workspace {overflow:hidden;display:flex;flex-direction:column}
.repository-workspace .repository-panel {min-height:0;flex:1;overflow:auto}
.repository-linked-dock [data-dock-content],.repository-native-dock [data-dock-content] {min-height:0;overflow:auto;overscroll-behavior:contain}
.diagram {max-height:min(65dvh,40rem);overscroll-behavior:contain}
.diagram-frame,.zoom-image {position:relative;min-width:0;max-width:100%}
.excalidraw-editor-dialog[role="dialog"] {width:min(96vw,84rem);max-width:none}
.excalidraw-canvas {height:clamp(16rem,64dvh,46rem);min-width:0;border:1px solid var(--border);border-radius:.65rem;overflow:hidden}
.zoom-image {display:inline-block;vertical-align:middle;line-height:normal}
.zoom-image>img {display:block;margin:0;max-width:100%;height:auto}
.diagram-frame .media-expand,.zoom-image .media-expand {position:absolute;top:.5rem;right:.5rem;z-index:2;background:var(--background);color:var(--foreground);box-shadow:0 1px 5px #0002;min-width:36px;min-height:36px}
@media(hover:hover) and (pointer:fine){.media-expand {opacity:0;transition:opacity .12s}.diagram-frame:hover>.media-expand,.zoom-image:hover>.media-expand,.diagram-frame:focus-within>.media-expand,.zoom-image:focus-within>.media-expand {opacity:1}}
.media-viewer-dialog[role="dialog"] {position:fixed!important;inset:0!important;transform:none!important;translate:none!important;width:100dvw!important;height:100dvh!important;max-width:100dvw!important;max-height:100dvh!important;margin:0!important;border-radius:0!important;padding:0!important;display:grid;grid-template-rows:auto minmax(0,1fr);gap:0;overflow:hidden}
.media-viewer-header {display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap;padding:.8rem 1.25rem;border-bottom:1px solid var(--border);margin:0}
.media-viewer-header h2 {font-size:1.05rem}.media-viewer-header p {font-size:.8rem}
.media-viewer-scroll {min-height:0;min-width:0;overflow:auto;overscroll-behavior:contain;padding:1rem;background:var(--background)}
.media-viewer-scroll>img {display:block;margin:auto}
.media-viewer-scroll.media-fit {display:flex;justify-content:center;align-items:center}
.media-viewer-scroll.media-fit>img {max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain;flex-shrink:1}
.media-viewer-scroll.media-actual>img {max-width:none;max-height:none;width:auto;height:auto}
.media-viewer-scroll.media-white {background:#fff;color-scheme:light}
/* Inline references use native Blueprint hover cards and stay within the viewport. */
.inline-reference {display:inline!important;vertical-align:baseline!important;padding:0 .12rem!important;height:auto!important;min-height:0!important;font-size:inherit!important;font-weight:650!important;line-height:inherit!important;color:var(--kind-color,var(--primary))!important;white-space:normal!important;text-decoration:underline;text-decoration-style:dotted;text-underline-offset:.2em}
.reference-hover-card[role="dialog"] {width:min(34rem,calc(100vw - 2rem))!important;max-height:min(70dvh,42rem);overflow:auto;overscroll-behavior:contain;z-index:70!important}
.reference-preview {display:grid;gap:.8rem;min-width:0}.reference-preview h3 {font-size:1.1rem;overflow-wrap:anywhere}.reference-preview-content {min-width:0}.reference-preview .content-reading {max-width:100%}
.reference-detail-dialog[role="dialog"] {width:min(60rem,96vw)!important;max-width:60rem!important;height:min(85dvh,60rem);display:flex;flex-direction:column;overflow:hidden}
.reference-detail-content {min-height:0;flex:1;overflow:auto;overscroll-behavior:contain}
.reference-insert-popover {width:min(34rem,90vw)!important;max-height:70dvh;overflow:hidden;display:flex;flex-direction:column;gap:.75rem}
.reference-insert-results {min-height:0;max-height:20rem;overflow:auto;overscroll-behavior:contain;display:flex;flex-direction:column;gap:.25rem}
.reference-insert-results>button {height:auto;min-height:44px;justify-content:start;text-align:left;white-space:normal}
.reference-insert-results>button svg {flex-shrink:0}
@container(width < 760px){.document-preview-dialog .document-reader-layout{overflow:hidden;grid-template-rows:auto minmax(0,1fr)}.document-preview-dialog .document-outline-list{max-height:9rem}.document-preview-dialog .document-reader-sidebar{max-height:15rem}}
@media(max-width:640px){.media-viewer-header{padding:.65rem;gap:.5rem}.media-viewer-header .actions{gap:.4rem}.document-preview-dialog .document-reader>div:first-child [class*="p-6"]{padding:1rem}}
@media(prefers-reduced-motion:reduce){.media-expand{transition:none}}

/* A continuous flex chain lets the outline scroll inside the preview viewport. */
.document-outline-card {display:flex;flex-direction:column;min-height:0;max-height:inherit;overflow:hidden;gap:0}
.document-outline-header {flex-shrink:0}
.document-outline-content {display:flex;flex-direction:column;min-height:0;overflow:hidden}
.document-outline-content[hidden] {display:none!important}
.document-outline-list {min-height:0;scrollbar-gutter:stable}
.document-preview-dialog .document-outline {height:100%;min-height:0}
.document-preview-dialog .document-outline-card {height:100%;max-height:100%}
.document-preview-dialog .document-outline-content {flex:1}
.document-preview-dialog .document-outline-list {flex:1;max-height:none}
.document-preview-dialog .document-outline[data-open="false"],
.document-preview-dialog .document-outline[data-open="false"] .document-outline-card {height:auto}
@container(width < 760px){
 .document-preview-dialog .document-reader-sidebar{height:min(30dvh,15rem)}
 .document-preview-dialog .document-reader-sidebar:has(.document-outline[data-open="false"]){height:auto}
}

.inline-reference-trigger {display:inline;line-height:inherit}
.rich-text a.inline-reference {color:var(--kind-color,var(--primary));text-decoration-style:dotted}

.media-viewer-header {flex-direction:row;align-items:center;text-align:left;width:100%}
.media-viewer-header .actions {margin-left:auto}

.repository-dock {height:var(--repository-height,calc(100dvh - 16rem));min-height:min(24rem,var(--repository-height,calc(100dvh - 16rem)));max-height:calc(100dvh - 2rem);overflow:hidden}

/* Reference completion stays beside the caret, outside scrolling editor panels. */
.reference-completion {position:fixed;pointer-events:auto;max-width:calc(100vw - 16px);max-height:min(420px,50dvh);overflow:hidden;display:flex;flex-direction:column;gap:0;box-shadow:0 12px 36px rgb(0 0 0 / .18);background:var(--popover);color:var(--popover-foreground)}
.reference-completion[hidden],.reference-completion [hidden] {display:none!important}
.reference-completion-header {padding:.7rem .85rem;display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:1rem;flex-shrink:0}
.reference-completion-count {font-size:.75rem}
.reference-completion-content {padding:.25rem!important;min-height:0;overflow:auto;overscroll-behavior:contain}
.reference-completion-list {display:flex;flex-direction:column;gap:.15rem}
.reference-completion-option {height:auto;min-height:44px;justify-content:flex-start;align-items:flex-start;text-align:left;white-space:normal;gap:.6rem;padding:.55rem .65rem;flex-shrink:0}
.reference-completion-option>svg {margin-top:.15rem;flex-shrink:0;color:var(--primary)}
.reference-completion-option>span {display:grid;gap:.15rem;min-width:0}
.reference-completion-option strong {font-size:.8rem;color:var(--primary)}
.reference-completion-option [data-reference-title] {font-size:.8rem;line-height:1.35;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.reference-completion-option[aria-selected="true"] {background:var(--accent);color:var(--accent-foreground);outline:1px solid var(--ring);outline-offset:-1px}
.reference-completion-empty {padding:.75rem}
.reference-completion-help {padding:.55rem .85rem;font-size:.7rem;color:var(--muted-foreground);border-top:1px solid var(--border);flex-shrink:0}

/* Insertion points are quiet until hovered, keyboard-focused or opened. */
.section-insert {height:1.5rem;margin-block:-.6rem;position:relative;min-width:0}
.section-insert[hidden] {display:none!important}
.section-insert>div {width:100%}
.section-insert-trigger {width:100%;height:1.5rem;gap:.5rem;opacity:0;color:var(--primary);font-size:.75rem;padding:0 .5rem}
.section-insert-line {height:1px;background:var(--primary);flex:1;opacity:.45}
.section-insert:hover .section-insert-trigger,.section-insert:focus-within .section-insert-trigger,.section-insert[data-open="true"] .section-insert-trigger {opacity:1}
.section-insert-trigger:focus-visible {outline:2px solid var(--ring);outline-offset:2px}
.section-insert-menu {width:16rem;max-width:calc(100vw - 2rem)}
.section-insert-choices {display:grid;gap:.2rem;margin-top:.5rem}
.section-insert-choices>button {justify-content:flex-start;gap:.6rem}
@media(hover:none){.section-insert-trigger{opacity:1;min-height:44px;height:44px}.section-insert{height:44px;margin-block:0}}

/* The outline sorts sibling groups; nested rows remain inside the moved item. */
.document-outline-branch,.document-outline-sortable,.document-outline-entry {min-width:0}
.document-outline-branch,.document-outline-sortable {display:flex;flex-direction:column;gap:.25rem}
.document-outline-row {display:flex;align-items:center;gap:.1rem;min-width:0}
.document-outline-row>.document-outline-link {flex:1;min-width:0}
.document-outline-grip {width:24px;min-width:24px;min-height:44px;flex-shrink:0;color:var(--muted-foreground);border-radius:.3rem;cursor:grab;touch-action:none}
.document-outline-grip:disabled {cursor:default;opacity:.25}
.document-outline-grip:hover:not(:disabled),.document-outline-grip:focus-visible {background:var(--accent);color:var(--accent-foreground)}
.document-outline-sort-help {display:flex;gap:.4rem;align-items:flex-start;font-size:.7rem;line-height:1.5;margin-top:.35rem}
.document-outline-sort-help>svg {flex-shrink:0;margin-top:.15rem}
.document-outline-children {margin-top:.25rem}
.document-outline-sortable>[data-bb-sortable-item] {border-radius:.4rem}
.document-outline-sortable>[data-keyboard-dragging="true"] {outline:2px solid var(--ring);outline-offset:1px;background:var(--accent)}
.document-outline-sortable>.sortable-ghost {outline:2px dashed var(--primary);background:var(--accent);opacity:.55}
.document-outline-sortable>.sortable-chosen>.document-outline-entry>.document-outline-children {display:none}
.document-outline-drag-preview {display:flex;align-items:center;gap:.65rem;max-width:min(320px,80vw);padding:.75rem 1rem;border:1px solid var(--ring);border-radius:.6rem;background:var(--popover);color:var(--popover-foreground);box-shadow:0 8px 28px rgb(0 0 0 / .2)}
.document-outline-drag-preview>span {display:grid;gap:.25rem}
.document-outline-drag-preview strong {font-size:.85rem}
.document-outline-drag-preview small {color:var(--muted-foreground);font-size:.75rem}
@media(hover:none){.document-outline-grip{width:44px;min-width:44px}}
