/* ── LimatiBlazorUIKit shared styles ────────────────────────── */

/* Frosted glass effect for dropdown menus */
.frosted-glass {
    background-color: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* CodeEditor (Monaco) host — the panel decides the height, while the editor
   itself fills the available flex space. */
.code-editor-host {
    min-height: 12rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.375rem;
    overflow: hidden;
    flex: 1 1 auto;
}

/* Monaco's rendered div must fill the host container */
.code-editor-host > div {
    width: 100% !important;
    height: 100% !important;
    min-height: 0;
    flex: 1 1 auto;
}

.code-editor-fill {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    width: 100%;
    display: flex;
}

.code-editor-fill > div {
    flex: 1 1 auto;
    width: 100% !important;
    height: 100% !important;
    min-height: 0;
}

/* MarkdownEditor — draggable vertical splitter between the CodeEditor pane
   and the live preview pane (see wwwroot/js/split-panel.js). */
.markdown-split-divider {
    position: relative;
    background-color: var(--bs-border-color, #dee2e6);
    border-radius: 3px;
    margin: 0 0.25rem;
    touch-action: none;
}

.markdown-split-divider:hover,
.markdown-split-divider:active {
    background-color: var(--bs-secondary-color, #6c757d);
}

/* A page that is shorter than its pane can still be scrolled a little, so a heading at the very top
   is reachable by a click. The room used to be most of a viewport, which left a long blank tail after
   the last line of every page - the reader scrolled past the end of the text into nothing. A few
   lines are enough for the one case it is for (a heading near the bottom moving up), and the address
   no longer has to be kept in step with a scroll that crosses all that emptiness. */
.uikit-markdown-browser-page {
    padding-inline: clamp(0.75rem, 2vw, 1.5rem);
    padding-bottom: 4rem;
}
.markdown-view-content > :first-child {
    margin-top: 0;
}

/* A screenshot in a page is often wider than the column that shows it: it has to scale down
   instead of forcing a horizontal scrollbar, and never be stretched beyond its own size. */
.markdown-view-content img {
    max-width: 100%;
    height: auto;
}

.markdown-view-content table {
    margin-bottom: 1rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
}

.markdown-view-content th,
.markdown-view-content td {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
}

.markdown-view-content thead th {
    background-color: var(--bs-tertiary-bg, #f8f9fa);
}

.markdown-view-content .mermaid-diagram {
    position: relative;
    display: block;
    margin: 1rem 0;
}

.markdown-view-content .mermaid-diagram .mermaid-diagram-surface {
    position: relative;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    display: block;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.75rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(248, 249, 250, 0.8));
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.markdown-view-content .mermaid-diagram .mermaid-diagram-surface.is-dragging {
    cursor: grabbing;
}

.markdown-view-content .mermaid-diagram svg {
    position: absolute;
    left: 0;
    top: 0;
    display: block;
    max-width: none;
    height: auto;
    margin: 0;
    transform-origin: top left;
    will-change: transform;
    pointer-events: none;
}

/* Diagram controls: framed keypad with pan / zoom / export buttons. */
.mermaid-diagram-toolbar {
    position: absolute;
    z-index: 2;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    padding: 0.45rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.75rem;
    user-select: none;
    -webkit-user-select: none;
    background-color: rgba(255, 255, 255, 0.88);
    box-shadow: 0 0.5rem 1rem rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0.9;
    transition: opacity 0.12s ease-in-out;
}

.markdown-view-content .mermaid-diagram:hover .mermaid-diagram-toolbar,
.visimer-editor-host:hover .mermaid-diagram-toolbar,
.mermaid-diagram-toolbar:focus-within {
    opacity: 1;
}

.mermaid-diagram-toolbar-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(2rem, 1fr));
    gap: 0.3rem;
}

.mermaid-diagram-control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.45rem;
    background-color: var(--bs-body-bg, #fff);
    color: var(--bs-secondary-color, #6c757d);
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    font-weight: 600;
}

.mermaid-diagram-text-btn {
    font-size: 0.54rem;
    letter-spacing: 0.02em;
}

.mermaid-diagram-control-btn:hover,
.mermaid-diagram-control-btn:focus-visible {
    background-color: var(--bs-tertiary-bg, #f8f9fa);
    color: var(--bs-body-color, #212529);
    border-color: var(--bs-primary, #0d6efd);
    outline: none;
}

/* Visimer editor host */
.visimer-editor-host {
    min-height: 18rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.75rem;
    background: var(--bs-body-bg, #fff);
    overflow: hidden;
}

.visimer-editor-host svg {
    max-width: 100%;
    height: auto;
}

.visimer-editor-host .visimer-canvas {
    width: 100%;
    height: 100%;
}

/* ── SplitPanel (REQ-UI-022) ─────────────────────────────────────────── */

.uikit-split-panel {
    display: flex;
    flex-grow: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.uikit-split-pane {
    min-width: 6rem;
    min-height: 0;
    overflow: auto;
}

.uikit-split-pane-left {
    flex-grow: 0;
    flex-shrink: 0;
}

.uikit-split-pane-right {
    flex: 1 1 0;
}

.uikit-split-divider {
    flex: 0 0 6px;
    width: 6px;
    cursor: col-resize;
    touch-action: none;
    background-color: var(--bs-border-color, #dee2e6);
    transition: background-color 0.15s ease-in-out;
}

.uikit-split-divider:hover,
.uikit-split-divider:focus-visible {
    background-color: var(--bs-primary, #0d6efd);
    outline: none;
}


/* The divider sits between the panes; stacked panes move it up and down. */
.uikit-split-panel-vertical {
    flex-direction: column;
}

.uikit-split-panel-vertical > .uikit-split-pane {
    min-width: 0;
    min-height: 4rem;
    width: 100%;
}

.uikit-split-panel-vertical > .uikit-split-pane-left {
    flex-grow: 0;
    flex-shrink: 0;
}

.uikit-split-panel-vertical > .uikit-split-divider {
    flex: 0 0 6px;
    width: auto;
    height: 6px;
    cursor: row-resize;
}
/* ── TreeView (REQ-UI-023) ───────────────────────────────────────────── */

.uikit-tree {
    outline: none;
}

.uikit-tree-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
    padding-right: 0.5rem;
    border-radius: 0.25rem;
    cursor: default;
    user-select: none;
    white-space: nowrap;
}

.uikit-tree-row:hover {
    background-color: var(--bs-tertiary-bg, #f8f9fa);
}

.uikit-tree-row.uikit-tree-selected {
    background-color: var(--bs-primary-bg-subtle, #cfe2ff);
}

.uikit-tree-row:focus-visible {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: -2px;
}

.uikit-tree-toggle {
    flex: 0 0 1rem;
    width: 1rem;
    display: inline-flex;
    justify-content: center;
    /* The chevron is the only content: without a line box the toggle collapses to no height and
       can no longer be pressed. */
    align-items: center;
    min-height: 1.25rem;
    line-height: 1;
    cursor: pointer;
    color: var(--bs-secondary-color, #6c757d);
}

.uikit-tree-toggle-spacer {
    display: inline-block;
    width: 1rem;
}

.uikit-tree-icon {
    flex: 0 0 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bs-secondary-color, #6c757d);
}

.uikit-tree-icon-emoji {
    line-height: 1;
    font-size: 0.95em;
    color: inherit;
}

.uikit-tree-detail-icon-emoji {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.uikit-tree-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uikit-tree-more {
    color: var(--bs-link-color, #0d6efd);
    cursor: pointer;
    font-size: 0.875rem;
}

.uikit-tree-error {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 24rem;
}

.uikit-tree-spinner {
    flex: 0 0 auto;
}

/* ── FramedWindow (REQ-UI-025) ───────────────────────────────────────── */

/* The shell keeps the page layout stable: the placeholder reserves the area
   the embedded content used to occupy, while the window floats above it. */
.uikit-framed-window-shell {
    position: relative;
}

.uikit-framed-window-placeholder {
    width: 100%;
    /* The placeholder only keeps the space the window occupied in the page flow. It is invisible
       but would still lie over the windows opened before it and swallow the presses aimed at their
       title bars, so it must not receive pointer events. */
    pointer-events: none;
}

/* Absolutely positioned inside the shell until the script takes over, so the
   window covers exactly the reserved area from the very first paint. */
.uikit-framed-window {
    position: absolute;
    inset: 0;
    z-index: 1040;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.5rem;
    /* The window surface is a theme decision, not a per-application override:
       a host changes these two variables instead of restyling the component. */
    background-color: var(--uikit-window-surface, var(--bs-body-bg, #fff));
    backdrop-filter: blur(var(--uikit-window-blur, 0px));
    -webkit-backdrop-filter: blur(var(--uikit-window-blur, 0px));
    box-shadow: 0 0.75rem 2rem rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

.uikit-framed-window-maximized {
    border-width: 0;
    border-radius: 0;
    box-shadow: none;
}

.uikit-framed-window-titlebar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.5rem;
    padding: 0.3rem 0.4rem 0.3rem 0.85rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    background-color: var(--bs-tertiary-bg, #f8f9fa);
    cursor: move;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.uikit-framed-window-titlebar:focus-visible {
    outline: 2px solid var(--bs-primary, #0d6efd);
    outline-offset: -2px;
}

.uikit-framed-window-title {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.uikit-framed-window-title-icon {
    flex: 0 0 auto;
    margin-right: 0.5rem;
    color: var(--bs-secondary-color, #6c757d);
}

.uikit-framed-window-title-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uikit-framed-window-actions {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex: 0 0 auto;
}

.uikit-framed-window-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 0.35rem;
    background-color: transparent;
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
}

.uikit-framed-window-button:hover,
.uikit-framed-window-button:focus-visible {
    border-color: var(--bs-border-color, #dee2e6);
    background-color: var(--bs-body-bg, #fff);
    color: var(--bs-body-color, #212529);
    outline: none;
}

.uikit-framed-window-button-close:hover,
.uikit-framed-window-button-close:focus-visible {
    color: var(--bs-danger, #dc3545);
}

.uikit-framed-window-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

/* Resize handles: the visible edges and corners of the frame. */
.uikit-framed-window-handle {
    position: absolute;
    z-index: 3;
    touch-action: none;
}

.uikit-framed-window-handle-n,
.uikit-framed-window-handle-s {
    left: 0.75rem;
    right: 0.75rem;
    height: 6px;
    cursor: ns-resize;
}

.uikit-framed-window-handle-n {
    top: 0;
}

.uikit-framed-window-handle-s {
    bottom: 0;
}

.uikit-framed-window-handle-e,
.uikit-framed-window-handle-w {
    top: 0.75rem;
    bottom: 0.75rem;
    width: 6px;
    cursor: ew-resize;
}

.uikit-framed-window-handle-e {
    right: 0;
}

.uikit-framed-window-handle-w {
    left: 0;
}

.uikit-framed-window-handle-ne,
.uikit-framed-window-handle-nw,
.uikit-framed-window-handle-se,
.uikit-framed-window-handle-sw {
    width: 12px;
    height: 12px;
}

.uikit-framed-window-handle-ne {
    top: 0;
    right: 0;
    cursor: nesw-resize;
}

.uikit-framed-window-handle-nw {
    top: 0;
    left: 0;
    cursor: nwse-resize;
}

.uikit-framed-window-handle-se {
    bottom: 0;
    right: 0;
    cursor: nwse-resize;
}

.uikit-framed-window-handle-sw {
    bottom: 0;
    left: 0;
    cursor: nesw-resize;
}

.uikit-framed-window-maximized .uikit-framed-window-handle {
    display: none;
}

/* ── TreeDetailView (REQ-UI-024) ─────────────────────────────────────── */

.uikit-tree-detail {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.uikit-tree-detail-header {
    flex: 0 0 auto;
}

.uikit-tree-detail-title {
    min-width: 0;
}

.uikit-tree-detail-body {
    min-height: 0;
}

.uikit-tree-detail-empty {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

/* ---- MarkdownView opened with a document tree ------------------------- */

/* A TreeView of documents beside a TreeDetailView that shows the selected one,
   separated by the kit's splitter (REQ-UI-022): the reader can trade tree width for
   reading width, which a fixed column could not do for a deep tree and a wide table
   at the same time. The view fills the area it is given; both panes scroll on their
   own, so a long page never scrolls the tree away. */
.markdown-view-with-tree {
    display: flex;
    min-width: 0;
    min-height: 0;
    height: 100%;
}

.markdown-view-with-tree > .uikit-split-panel {
    flex: 1 1 auto;
    min-height: 0;
}

.markdown-view-tree-pane {
    min-width: 0;
    padding: 0.25rem;
}

.markdown-view-with-tree .uikit-tree-detail {
    height: 100%;
}

/* ── MarkdownBrowser (REQ-UI-027) ────────────────────────────────────── */

/* The browser fills the area it is given: navigation bar on top, tree and page below it, separated
   by the splitter. The page scrolls inside its own pane, so the breadcrumbs stay visible while
   reading. */
.markdown-browser {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.markdown-browser-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    background: var(--bs-tertiary-bg, #f8f9fa);
}

.markdown-browser-nav .btn,
.markdown-browser-tree-controls .btn,
.markdown-browser .uikit-tree-detail-header .btn {
    --bs-btn-padding-y: 0.1rem;
    --bs-btn-padding-x: 0.4rem;
    line-height: 1;
}

.markdown-browser-breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.15rem;
    min-width: 0;
    overflow: hidden;
}

.markdown-browser-breadcrumb {
    appearance: none;
    border: 0;
    background: none;
    padding: 0 0.15rem;
    color: var(--bs-link-color, #0d6efd);
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 16rem;
}

.markdown-browser-breadcrumb:hover:not(:disabled) {
    text-decoration: underline;
}

.markdown-browser-breadcrumb.is-current {
    color: var(--bs-secondary-color, #6c757d);
    cursor: default;
}

.markdown-browser-breadcrumb-separator {
    font-size: 0.7rem;
    color: var(--bs-secondary-color, #6c757d);
}

.markdown-browser-body {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.markdown-browser-body > .uikit-split-panel {
    flex: 1 1 auto;
    min-height: 0;
}

/* Every pane of the browser's split panels is a non-scrolling column: its header
   stays pinned at the top and only its inner body (tree, article, canvas, list)
   scrolls. The generic split pane carries `overflow: auto`, which would otherwise
   let the pane itself scroll header and all — putting a scrollbar over the title bar
   and scrolling the header out of view. */
.markdown-browser-tree-split > .uikit-split-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.markdown-browser-tree {
    min-width: 0;
    min-height: 0;
    padding: 0.25rem;
    /* The tree scrolls in its pane instead of growing the browser. Without a bound it took the
       height of every row - 1764 px inside a 661 px window, which pushed the splitter and the
       page out of the frame. */
    flex: 1 1 auto;
    overflow: auto;
}

.markdown-browser-body .uikit-tree-detail {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}

.markdown-browser-detail-raw .uikit-tree-detail-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 !important;
}

.markdown-browser-raw-source {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}

.markdown-browser-raw-source .code-editor-host {
    border: 0;
    border-radius: 0;
}

.markdown-browser-loading {
    display: flex;
    align-items: center;
    padding: 1rem;
    color: var(--bs-secondary-color, #6c757d);
}
/* ── Chat controls (REQ-UI-028) ─────────────────────────────────────────
   A chat surface: transcript, tool calls, raw exchange, composer. The panel is a
   flex column so the transcript takes the height that is left and the composer
   stays reachable — a chat whose input scrolls out of view is unusable at length. */

.uikit-chat-panel {
    height: 100%;
    min-height: 0;
}

.uikit-chat-panel-header {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    flex: 0 0 auto;
}

.uikit-chat-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    overflow: hidden;
}

.uikit-chat-panel-footer {
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem 0.75rem;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
}

.uikit-chat-transcript {
    flex: 1 1 auto;
    min-height: 6rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-right: 0.25rem;
}

.uikit-chat-empty {
    margin: auto;
    text-align: center;
    padding: 1.5rem;
}

.uikit-chat-turn {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.uikit-chat-user {
    align-items: flex-end;
}

.uikit-chat-author {
    padding-left: 0.15rem;
}

.uikit-chat-time {
    margin-left: 0.4rem;
    opacity: 0.7;
}

.uikit-chat-duration {
    margin-left: 0.45rem;
    padding: 0.05rem 0.35rem;
    border-radius: 0.25rem;
    background: var(--bs-tertiary-bg, #f8f9fa);
    border: 1px solid var(--bs-border-color, #dee2e6);
    font-variant-numeric: tabular-nums;
}

.uikit-chat-trace {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.4rem;
}

.uikit-chat-trace > .uikit-chat-thinking,
.uikit-chat-trace > .uikit-chat-tool {
    margin-bottom: 0;
}

.uikit-chat-trace-tool.uikit-chat-tool-running {
    border-left: 3px solid var(--bs-primary, #0d6efd);
}

.uikit-chat-trace-tool.uikit-chat-tool-succeeded {
    border-left: 3px solid var(--bs-success, #198754);
}

.uikit-chat-trace-tool.uikit-chat-tool-failed {
    border-left: 3px solid var(--bs-danger, #dc3545);
}

.uikit-chat-thinking {
    margin-bottom: 0.35rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-left: 3px solid var(--bs-info, #0dcaf0);
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    background: var(--bs-body-bg, #fff);
}

.uikit-chat-thinking-summary {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.uikit-chat-thinking-meta {
    opacity: 0.75;
    font-variant-numeric: tabular-nums;
}

.uikit-chat-thinking-duration {
    font-variant-numeric: tabular-nums;
    margin-left: 0.15rem;
}

.uikit-chat-thinking-body {
    margin-top: 0.35rem;
    max-height: 14rem;
    overflow-y: auto;
    font-size: 0.8rem;
    color: var(--bs-secondary-color, #6c757d);
}

.uikit-chat-bubble {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    max-width: 100%;
    overflow-wrap: anywhere;
    background: var(--bs-tertiary-bg, #f8f9fa);
}

.uikit-chat-user .uikit-chat-bubble {
    background: var(--bs-primary-bg-subtle, #cfe2ff);
}

.uikit-chat-system .uikit-chat-bubble {
    background: transparent;
    border: 1px dashed var(--bs-border-color, #dee2e6);
    color: var(--bs-secondary-color, #6c757d);
}

.uikit-chat-error {
    background: var(--bs-danger-bg-subtle, #f8d7da);
}

.uikit-chat-markdown > :last-child {
    margin-bottom: 0;
}

/* The cursor marks an answer that is still arriving; it is the only cue that the
   text below it is incomplete, so it must not depend on colour alone. */
.uikit-chat-cursor {
    display: inline-block;
    width: 0.5ch;
    height: 1em;
    margin-left: 1px;
    vertical-align: text-bottom;
    background: currentColor;
    animation: uikit-chat-blink 1s step-end infinite;
}

@keyframes uikit-chat-blink {
    50% { opacity: 0; }
}

.uikit-chat-tools {
    flex: 0 0 auto;
    max-height: 40%;
    overflow-y: auto;
}

.uikit-chat-tools-header {
    margin-bottom: 0.25rem;
}

.uikit-chat-tool {
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.25rem;
}

.uikit-chat-tool-summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.uikit-chat-tool-body {
    padding-top: 0.35rem;
}

.uikit-chat-pre {
    margin: 0;
    padding: 0.5rem;
    font-size: 0.8125rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: var(--bs-tertiary-bg, #f8f9fa);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.375rem;
}

.uikit-chat-raw-stack {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.uikit-chat-raw-summary {
    cursor: pointer;
}

.uikit-chat-composer {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.uikit-chat-input {
    resize: vertical;
    min-height: 2.5rem;
}

.uikit-chat-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.uikit-chat-hint {
    margin-left: auto;
}

/* ---- Loading indicator (REQ-UI-026) ---- */

:root {
    /*
       The floating-window surface. A host that wants a more transparent layer
       sets these two variables once; it must not restyle .uikit-framed-window.
    */
    --uikit-window-surface: rgba(255, 255, 255, 0.94);
    --uikit-window-blur: 6px;
}

/*
   Covers the positioned parent while its content is arriving, so a loading state
   never adds or removes layout height.
*/
.uikit-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--uikit-loading-surface, rgba(255, 255, 255, 0.82));
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.9rem;
}
/* ── GraphView (REQ-UI-026) ───────────────────────────────────────────────────
   A force-directed graph. The component owns the frame, the header, the legend
   and the drawing area; d3 owns the SVG inside the canvas. */

.uikit-graph-view {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    background: #fff;
}

.uikit-graph-head {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    font-size: 0.85rem;
}

.uikit-graph-title {
    font-weight: 600;
}

.uikit-graph-badge {
    padding: 0.05rem 0.4rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.75rem;
    font-size: 0.75rem;
    color: var(--bs-secondary-color, #6c757d);
}

.uikit-graph-badge-warn {
    border-color: #ffc107;
    color: #664d03;
    background: #fff3cd;
}

.uikit-graph-actions {
    margin-left: auto;
    display: flex;
    gap: 0.35rem;
}

/* d3 owns everything inside, so the canvas must not carry layout of its own. */
.uikit-graph-canvas {
    flex: 1 1 auto;
    min-height: 220px;
    overflow: hidden;
}

/* A drag on the background moves the drawing, so the background says it is grabbable.
   The nodes keep their own cursor: they are a different gesture. The dragging state
   comes after the base rule, so it wins on equal specificity. */
.uikit-graph-svg {
    cursor: grab;
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.uikit-graph-svg.is-panning {
    cursor: grabbing;
}

.uikit-graph-edge {
    stroke: #ced4da;
    stroke-width: 1;
    /* Lighter than a hairline would be at full strength: the lines are context, the
       nodes and their words are what the reader is looking at. */
    stroke-opacity: 0.55;
    /* Edges cross the nodes they connect. Without this they sit on top of a node's
       hit area and swallow its click - the centre node is unreachable. */
    pointer-events: none;
}

.uikit-graph-node {
    cursor: default;
}

/* **The symbol carries no border.** A node is one handle - symbol and word - and the frame behind both is what
   says "this is the thing you are on" (see the frame rules below): an outline around the symbol alone drew a
   second, competing box, and the symbol's own shape and colour already say which kind it is. Sections are not
   framed at all, so a section's place is the red branch of the selection - its symbol and its edges. */

/* The hit area spans the symbol and its label, so a reader can aim at the word. */
.uikit-graph-hit {
    fill: transparent;
    pointer-events: all;
}

.uikit-graph-node[data-interactive="true"],
.uikit-graph-label-group[data-interactive="true"] {
    cursor: pointer;
}

.uikit-graph-node[data-interactive="true"]:hover circle,
.uikit-graph-node[data-interactive="true"]:hover .uikit-graph-mark {
    stroke: #495057;
    stroke-width: 2;
}

.uikit-graph-mark-emoji {
    stroke: none !important;
    user-select: none;
    pointer-events: none;
}

.uikit-graph-node[data-emphasized="true"] .uikit-graph-mark {
    stroke: #212529;
    stroke-width: 2;
}

.uikit-graph-label {
    /* A size that can be read at a glance. The plate behind it keeps it legible over
       the lines, so it does not have to be bold as well. */
    font-size: 11.5px;
    fill: #212529;
    /* Glyph-level, not bounding-box: the word stays clickable without an invisible
       box that reaches over the neighbour. */
    pointer-events: all;
    user-select: none;
}

/* The plate under a label. Nearly white and slightly transparent: it separates the
   word from the lines without turning the drawing into a table. Sized in the view, so
   it hugs the glyphs. */
.uikit-graph-label-bg {
    fill: rgba(255, 255, 255, 0.82);
    pointer-events: none;
}

/* **A page's and a folder's word sits on a lighter plate than a heading's.** Their node already
   carries a frame behind symbol *and* word, and two nearly opaque whites over each other turned the
   drawing into a table of cards - the plate now lets the edges show through, while a heading has no
   frame behind it and keeps the strong plate that holds its word apart from the inset's lines. */
.uikit-graph-label-group[data-kind="Page"] .uikit-graph-label-bg,
.uikit-graph-label-group[data-kind="Folder"] .uikit-graph-label-bg {
    fill: rgba(255, 255, 255, 0.45);
}

/* The area the pointer may rest on, independent of what the plate currently shows.
   Invisible, but it takes the pointer: a label that changes under the cursor - a ghost
   dropping its "+N" once it is the answer - must not take the ground away from it. */
.uikit-graph-label-hit {
    fill: transparent;
    pointer-events: all;
}

.uikit-graph-empty {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 1rem;
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.85rem;
}

.uikit-graph-legend {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    padding: 0.3rem 0.6rem;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    font-size: 0.75rem;
    color: #495057;
}

.uikit-graph-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* The key shows the shape the drawing uses, so a folder in the key is a folder on the
   canvas. Sized like the symbol it replaced. */
.uikit-graph-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    flex: none;
}

.uikit-graph-symbol {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: #868e96;
}
/* Dragging: no text selection, and the cursor says the node is held. */
.uikit-graph-node.is-dragging {
    cursor: grabbing;
}

.uikit-graph-node.is-dragging circle,
.uikit-graph-node.is-dragging .uikit-graph-mark {
    stroke: #212529;
    stroke-width: 2;
    opacity: 0.9;
}
/* An edge in the legend is a line, not a symbol: the drawing separates node kinds from
   edge kinds, and so should the key. */
.uikit-graph-line {
    display: inline-block;
    width: 14px;
    height: 3px;
    border-radius: 2px;
    margin-right: 0.25rem;
    vertical-align: middle;
}
/* The node of interest has to read as the place the reader came from, not as one symbol
   among many.
   
   This rule is deliberately last and carries the extra [data-node-id] attribute, so it
   wins over the kind and route rules below it. It used to lose to them: a corpus node is
   drawn with a dark ring of its own, and the selected corpus was therefore nearly
   identical to its unselected neighbours - with several corpora on screen the reader
   could not tell which one they had picked. The ring is now visibly heavier than any
   kind's, and the halo behind it carries the accent colour. */
.uikit-graph-node[data-emphasized="true"][data-node-id] .uikit-graph-mark {
    stroke: #212529;
    stroke-width: 4;
    paint-order: stroke;
}

/* A soft halo behind it in the accent colour, so the selection is unmistakable even
   where the symbol itself sits on a dark or same-coloured neighbour. */
.uikit-graph-node[data-emphasized="true"][data-node-id] .uikit-graph-halo {
    fill: none;
    stroke: rgba(13, 110, 253, 0.55);
    stroke-width: 9;
}

/* The label lives in its own layer under the nodes, so it is selected through the
   label group rather than through the node group. */

.uikit-graph-label-group[data-emphasized="true"] .uikit-graph-label {
    font-weight: 700;
    fill: #212529;
}

/* A soft halo behind it, so the ring does not have to grow to be noticed. */
/* Emphasis is not selection. The large symbol and the ring mark the node the drawing is arranged
   around - the root of the tree the open page lives in - while the selected path is marked by its
   frame and its colour. A host names the emphasised node (`GraphNode.Emphasized`); these rules only
   draw it. */
.uikit-graph-node[data-emphasized="true"] .uikit-graph-halo {
    fill: none;
    stroke: rgba(33, 37, 41, 0.25);
    stroke-width: 6;
}
/* Symbol and label are one handle the reader aims at, so they are framed together. The two used
   to answer the pointer separately: the label drew a ring when the pointer was on the word and
   nothing when it was on the symbol, so aiming at a node and aiming at its name looked like two
   different things. One rectangle behind both says "this is one thing".

   **The frame is drawn from the first frame on, and its colour is where the node sits in the
   corpus**: a root folder's is red, a folder's yellow, a document's is the colour of its symbol -
   blue for a page, green for one that points at another - and the grey base is left to whatever a
   host draws without a colour of its own. **The document the reader is at is the red one**: its frame
   takes the path's red and its symbol turns blue, so the page the picture is about stands out from the
   other documents without losing what it is. Since the symbol carries no border at all, this
   rectangle is the only outline a node has.

   The pointer state does not repaint the frame, it **thickens** it - the colour is the place, the
   weight is what the reader is doing:

     plain               1 px, in the node's place colour
     hovered             2 px, same colour (the word takes the accent as well)
     selected            2 px, same colour (the word is bold, and the path edges are red)
     hovered + selected  2 px, same colour

   **A section is never framed.** Its selection is the branch itself: the symbols of the section
   the reader is at and of every heading above it take the path's colour, and so do the edges
   between them - a frame around a bookmark would claim a second kind of selection the picture
   already states. The frame keeps its other job for the remaining kinds: it is the area the
   pointer rests on.

   A muted node draws no frame of its own; muted is carried by the symbol and the label tone. */
/*
   A frame is an **outline with a hint of plate**, not a card: the label already has its plate, and
   two nearly opaque whites over each other made the drawing look like a table of cards - the frame's
   fill is light enough now that the edges below it stay visible.
*/
.uikit-graph-frame {
    fill: rgba(255, 255, 255, 0.45);
    stroke: #adb5bd;
    stroke-width: 1;
    rx: 5;
    pointer-events: none;
}

/* A folder's frame: yellow. (The root rule comes after this one, so a root folder keeps its red.) */
.uikit-graph-label-group[data-kind="Folder"] .uikit-graph-frame {
    stroke: #fcc419;
}

/* A root folder's frame: red - the place a tree starts. */
.uikit-graph-label-group[data-root="true"] .uikit-graph-frame {
    stroke: var(--uikit-graph-selected, #c92a2a);
}

/* **A document's frame takes the colour of its symbol.** A page is blue and a page that points at another one
   is green; the frame says the same thing the symbol does, so a reader can sort the documents by their outline
   alone. The grey base is left to whatever a host draws without a colour of its own. */
.uikit-graph-label-group[data-kind="Page"] .uikit-graph-frame {
    stroke: #0d6efd;
}

/* A referencing document's **symbol and frame** are green, the colour its reference edges carry. */
.uikit-graph-node[data-references="true"] .uikit-graph-mark {
    fill: #2f9e44;
}

.uikit-graph-label-group[data-kind="Page"][data-references="true"] .uikit-graph-frame {
    stroke: #2f9e44;
}

/* **The document the reader is at is the red one, frame and symbol.** The path's red around it and the path's red
   in it: the open page is the one page the picture is about, and painting it in the colour of the routes that lead
   to it makes the whole path - root, folders, page - read as one red thread. A page's blue symbol stays the colour
   of the documents the reader is *not* at. */
.uikit-graph-label-group[data-kind="Page"][data-focus="true"] .uikit-graph-frame {
    stroke: var(--uikit-graph-selected, #c92a2a);
}

.uikit-graph-node[data-kind="Page"][data-focus="true"] .uikit-graph-mark {
    fill: var(--uikit-graph-selected, #c92a2a);
}

/* A selected document's **symbol is blue** - the colour a document has. The selection is already marked three times
   over: the frame carries the path's weight, the word is bold, and the red path runs through it. A fourth mark on the
   symbol in the path's own red made the symbol say "you are here" where the reader expected "this is a document", and it
   competed with the red frame around it. The frame keeps the path's red, so the open page is still the one red thread
   while every symbol in the drawing reads as what it is. */
.uikit-graph-node[data-kind="Page"][data-selected="true"] .uikit-graph-mark {
    fill: #0d6efd;
}

/* The state is the weight: pointing at a node, or the path running through it, makes the frame
   read as "you are on this" without taking its colour away. */
.uikit-graph-label-group[data-selected="true"] .uikit-graph-frame {
    stroke-width: 2;
}

.uikit-graph-label-group[data-hovered="true"] .uikit-graph-frame,
.uikit-graph-label-group[data-hover-path="true"] .uikit-graph-frame {
    stroke-width: 2;
}

/* ... but not around a section. The mark of a section's selection is its branch (its symbol and its
   edges take the path's colour), and a bookmark with a ring around it read as a selected *box* in
   a drawing of places. The rectangle stays in the DOM as the pointer's area - it is only not drawn. */
.uikit-graph-label-group[data-kind="Section"] .uikit-graph-frame {
    display: none;
}

/* Inside the frame the word takes the accent colour - the plate no longer needs a ring of its
   own, and two rings around one handle would read as two things again. */
.uikit-graph-node[data-hovered="true"] .uikit-graph-label,
.uikit-graph-label-group[data-hovered="true"] .uikit-graph-label {
    fill: #0b5ed7;
}
/* Context behind the answer. A node the reader did not ask about is still drawn and
   still clickable, but it steps back so the centre and its own ring can lead. */
.uikit-graph-node[data-muted="true"] .uikit-graph-mark {
    /* A muted node is context, not answer: it keeps its kind's hue - the kind still says what it is - but lighter,
       so the answered nodes lead the eye.
       **Opacity, not brightness.** `brightness(1.45)` was the wrong tool for the light kinds: a section's own grey
       (`#adb5bd`) has nowhere to go but white, and the muted headings lost their glyph entirely - measured, all 34
       of them had their mark in the DOM, filled `rgb(173,181,189)` pushed to near-white. Fading towards the
       background keeps the shape at every hue, including the pale ones. */
    opacity: 0.55;
}

.uikit-graph-label-group[data-muted="true"] .uikit-graph-label {
    fill: #9aa4ae;
}

/* A node that is part of the answer carries its name in weight; a ghost, which is context,
   keeps the light one. The two used to be told apart by opacity alone, which at eleven and a
   half pixels is a difference the eye has to look for - weight is read at a glance, and it
   says the same thing: this one counts, that one is here to be looked up if you want it. */
.uikit-graph-label-group:not([data-muted="true"]) .uikit-graph-label {
    font-weight: 600;
}

.uikit-graph-label-group[data-muted="true"] .uikit-graph-label-bg {
    opacity: 0.45;
}

/* **A hovered node is not context.** The pointer is on it, so the reader is asking what it is - the one answer a faded
   node cannot give. It stays at full strength after the pointer leaves (the hover outlives the pointer) and is faded again
   only when another node is hovered. */
.uikit-graph-node[data-hovered="true"][data-muted="true"] .uikit-graph-mark {
    opacity: 1;
}

.uikit-graph-label-group[data-hovered="true"][data-muted="true"] .uikit-graph-label {
    fill: #0b5ed7;
    font-weight: 600;
}

.uikit-graph-label-group[data-hovered="true"][data-muted="true"] .uikit-graph-label-bg {
    opacity: 1;
}

/* Hovering a node pulls its own connections forward. The lines are context until one
   node is singled out, and then they are what that node is.

   Emphasis raises the *opacity* and the colour, never the width. It used to set
   `stroke-width: 2.5`, which is an absolute value: hovering the open page turned its
   containment edges (2), its path edges (3) and every relation (1) into one uniform
   line. The width says what *kind* an edge is, and a hover is not a kind - so a hover
   that is not on a path edge leaves the width alone and lets the kind keep speaking. */
.uikit-graph-edge.is-emphasised {
    stroke-opacity: 1;
    filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, 0.16));
}

/* The directory structure is the skeleton of the drawing, and it is drawn at the same weight as every other
   edge. A thicker line was tried: it made the tree read as one more claim between two documents, and it stood
   out against the reference links beside it for no reason a reader could name - a folder and what it holds is
   the plainest fact in the picture, not the loudest. What marks a kind is its colour, and what marks the path
   is the path's own rule below. */
.uikit-graph-edge[data-kind="CONTAINS_FILE"],
.uikit-graph-edge[data-kind="CONTAINS_FOLDER"] {
    stroke-width: 1;
}
/* A host can name its own kind for the thing everything else belongs to. The corpus is
   not one folder among many, and a ring plus a heavier word says so without a new
   mechanism - the colour comes from the host's kind map like any other. */
.uikit-graph-node[data-kind="Corpus"] .uikit-graph-mark {
    stroke: #7f1d1d;
    /* Weighted, not outlined black: at fourteen pixels a two-pixel ring ate the shape
       and the corpus read as a dark blob instead of as a folder. */
    stroke-width: 1.5;
}

.uikit-graph-node[data-kind="Corpus"] .uikit-graph-label {
    font-weight: 700;
}
/* A route the host points out - the way from a node back to its root. Its lines are
   drawn stronger than their neighbours, and its nodes keep a ring, because the answer
   to "how did I get here" deserves more weight than the background it crosses. */
.uikit-graph-edge.is-path {
    /* A path is heavier than the context it crosses, and only a little: at 3 the red thread read as a band laid over
       the picture, at 2.5 it still pulled the eye off the nodes it joins. The weight says "follow this", not "look at
       me", and the halo is what makes it findable on a busy background. */
    stroke-width: 2;
    stroke-opacity: 1;
    stroke-linecap: round;
    /* A halo, because a thin line on a busy background is lost among its neighbours. */
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.18));
}

.uikit-graph-node.is-path .uikit-graph-label {
    font-weight: 600;
}
/* A relation between two nodes that are context themselves - two pages beside the open one
   that link to each other. The relation is real and belongs in the picture, but it is not
   what the reader opened: drawn, and plainly secondary. Thinner and faded rather than hidden,
   because a context line the reader cannot see is a context line that does not exist. */
.uikit-graph-edge.is-muted {
    /* **Muted is thinner and fainter, never dashed.** A dashed line reads as "not really there" - a hint, an optional
       relation - and a context line is a real relation that is merely secondary. Solid at a lower weight and opacity says
       exactly that; the dash said something the model does not claim. */
    stroke-width: 1;
    stroke-opacity: 0.45;
}

/* The line through the roots. Red, because the nodes it joins are red - it is one statement about where a corpus
   begins, and a grey line between two red folders would read as a third thing. Thinner than an ordinary edge: the row
   of roots is something the reader can follow, but the line only says "these begin side by side" - it is not a
   relation between two documents, and at the weight of one it competed with the reference links it crosses. */
.uikit-graph-edge[data-kind="SIBLING_ROOT"] {
    stroke-width: 0.75;
    stroke-opacity: 1;
}

/* Hovering a document or folder traces its directory containment chain up to the red-framed
   ancestor: thick and at full opacity, keeping the containment edge's own colour so it reads as
   the hovered item's location rather than replacing the active red path. Placed after the
   containment and muted rules so it wins even on muted ghost chains. */
.uikit-graph-edge.is-hover-path,
.uikit-graph-edge.is-muted.is-hover-path,
.uikit-graph-edge[data-kind="CONTAINS_FILE"].is-hover-path,
.uikit-graph-edge[data-kind="CONTAINS_FOLDER"].is-hover-path {
    stroke-width: 2.5;
    stroke-opacity: 1;
    stroke-linecap: round;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.18));
}

/* Previewing a section highlights its entire hierarchical heading path in the parent
   document's colour: marks, labels and SECTION_OF edges read as one branch. */
.uikit-graph-edge.is-preview-path,
.uikit-graph-edge.is-muted.is-preview-path {
    stroke-width: 2;
    stroke-opacity: 1;
    stroke-linecap: round;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.18));
}

.uikit-graph-node[data-preview="true"] .uikit-graph-mark {
    opacity: 1;
}

.uikit-graph-label-group[data-preview="true"] .uikit-graph-label {
    font-weight: 600;
}

.uikit-graph-label-group[data-preview="true"] .uikit-graph-label-bg {
    opacity: 1;
}
/* A node that was not in the previous drawing: the ghosts a hover adds fade in and grow
   into place, so an addition reads as an answer to the pointer rather than as a glitch. */
.uikit-graph-node.is-new {
    animation: uikit-graph-node-in 240ms ease-out both;
}

/* Opacity only. A `transform` here would override the `transform` attribute that carries
   the node's position - the symbol would sit at the origin while its label and edges stayed
   where they belong, which looked exactly like a node that never moved. */
@keyframes uikit-graph-node-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ── GraphNavigator (REQ-UI-028) ───────────────────────────────────────────────
   The frame around a drawing: the provider's answer, the selection and the depth.
   It adds no layout of its own beyond what the drawing inside needs. */

.uikit-graph-nav {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    height: 100%;
    overflow: hidden;
}

/* A busy provider is a state, not an overlay: the drawing it already has stays on
   screen, because a blank frame between two answers reads as "this document has no
   neighbours". */
.uikit-graph-badge-busy {
    border-color: #0dcaf0;
    color: #055160;
    background: #cff4fc;
}

/* The depth stepper sits with the other controls in the header. It is a segmented
   control rather than a select: two buttons and a number are faster to use. */
.uikit-graph-depth {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.75rem;
    padding: 0.05rem 0.2rem;
}

.uikit-graph-depth .btn {
    --bs-btn-padding-y: 0.05rem;
    --bs-btn-padding-x: 0.3rem;
    --bs-btn-font-size: 0.7rem;
    line-height: 1;
}

.uikit-graph-depth-label {
    font-size: 0.75rem;
    color: var(--bs-secondary-color, #6c757d);
    white-space: nowrap;
}


/* ── StringListEditor / ListSelectionEditor (REQ-UI-029) ──────────────────────
   Both are list editors with the same three needs: a filter, a body that scrolls
   inside a bound, and a collapsed start. The rules are one block because the
   behaviour is one behaviour. */

.uikit-string-list,
.uikit-list-selection {
    min-width: 0;
}

/* The collapse toggle is a row, not a button: it carries a summary and reads as a
   section heading that happens to open. A full-width primary button would compete
   with the form's own actions. */
.uikit-string-list-toggle,
.uikit-list-selection-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0.25rem 0.1rem;
    border: 0;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    background: transparent;
    color: inherit;
    font-size: 0.9rem;
    text-align: left;
}

.uikit-string-list-toggle:hover,
.uikit-list-selection-toggle:hover {
    background: var(--bs-tertiary-bg, #f8f9fa);
}

.uikit-string-list-toggle .bi,
.uikit-list-selection-toggle .bi {
    font-size: 0.75rem;
    color: var(--bs-secondary-color, #6c757d);
}

.uikit-string-list-label {
    margin-left: auto;
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.85rem;
}

/* The filter sits in one line with its clear button, at the size of the rows it
   filters - a full-size input would be taller than the list it belongs to. */
.uikit-string-list-filter {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.4rem;
}

.uikit-string-list-filter .bi {
    font-size: 0.8rem;
    color: var(--bs-secondary-color, #6c757d);
}

.uikit-string-list-filter .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

/* The rows keep their own scrollbar; the border makes the bound visible, so a
   list that scrolls is not mistaken for one that has ended. */
.uikit-string-list-rows {
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.375rem;
    padding: 0.35rem;
}

.uikit-string-list-empty {
    padding: 0.25rem 0.15rem;
    color: var(--bs-secondary-color, #6c757d);
    font-size: 0.85rem;
}

/* The side pane of the MarkdownBrowser: the page is the subject, this is what it
   is placed in. It scrolls on its own so a long legend cannot push the page.
   
   No padding here. The pane holds the graph and the lists, and both put their header
   first - a padding on the container therefore pushed the graph's header down by
   exactly that amount, so it sat a few pixels below the tree's controls and the
   page's title while all three are meant to be one row. The gutter belongs to the
   drawing, not to the bar above it; the graph view carries its own. */
.markdown-browser-side {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    padding: 0;
    overflow: hidden;
}

/* The pane beside the page fills the reading area. Without an explicit height the split
   sizes itself to the taller pane's content and grows past the window - the graph then
   sits below the fold instead of beside the page (measured: 1484 px tall in a 659 px area). */
.markdown-browser-side-split {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}

.markdown-browser-side-split > .uikit-split-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.markdown-browser-graph-toggle {
    flex: 0 0 auto;
}
/* ── MarkdownBrowser side lists (REQ-UI-030) ──────────────────────────────────
   The sections of the open page and its references, under its graph. Both are
   tables of one column: the reader picks a row, not a card. */

.markdown-browser-lists {
    display: flex;
    flex-direction: row;
    flex: 1 1 auto;
    gap: 0.35rem;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.markdown-browser-list {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.375rem;
    overflow: hidden;
}

.markdown-browser-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 0 0 auto;
    gap: 0.35rem;
    padding: 0.2rem 0.45rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    background: var(--bs-tertiary-bg, #f8f9fa);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.markdown-browser-list ul {
    margin: 0;
    padding: 0.15rem;
    list-style: none;
    flex: 1 1 auto;
    overflow: auto;
    min-height: 0;
}

/* A row is a button, so it is focusable and reachable by keyboard, but it reads as a row:
   no border, no background until it is hovered or current. */
.markdown-browser-section,
.markdown-browser-reference {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
    padding: 0.15rem 0.3rem;
    border: 0;
    border-radius: 0.25rem;
    background: transparent;
    color: inherit;
    font-size: 0.8rem;
    line-height: 1.35;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.markdown-browser-section:hover,
.markdown-browser-reference:hover {
    background: var(--bs-tertiary-bg, #f8f9fa);
}

/* The section the page is scrolled to. The marker on the left is what makes it findable
   while the reader's eyes are on the text, not on the list. */
.markdown-browser-section.is-current {
    background: var(--bs-primary-bg-subtle, #cfe2ff);
    font-weight: 600;
    box-shadow: inset 2px 0 0 var(--bs-primary, #0d6efd);
}

.markdown-browser-reference .bi {
    flex: 0 0 auto;
    font-size: 0.7rem;
    color: var(--bs-secondary-color, #6c757d);
}

.markdown-browser-reference.is-incoming .bi {
    color: var(--bs-success, #198754);
}

.markdown-browser-reference-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The graph keeps at least half the column when both are shown, so neither becomes a
   single row of pixels at the default split. Neither split pane scrolls itself: the
   graph header and the list headers stay pinned at the top of their panes. */
.markdown-browser-side-graph-split {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}

.markdown-browser-side-graph-split > .uikit-split-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Inside the browser's vertical side split, the splitter owns the canvas height. The
   standalone 220px floor forced the graph taller than a short viewport or a raised
   divider, which made the pane scroll and pushed .uikit-graph-head out of view. */
.markdown-browser-side .uikit-graph-canvas {
    min-height: 0;
}
/* The toolbar's own actions sit at its right; the breadcrumbs stay at its left, where the
   reader's position belongs. `ms-auto` on the group is what pushes it, not the breadcrumbs. */
.markdown-browser-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 0.25rem;
}

.markdown-browser-breadcrumbs {
    flex: 1 1 auto;
    min-width: 0;
}
/* The tree's own controls sit directly above the rows they act on, in the tree's pane, so a
   reader does not have to look for them in the window toolbar. */
.markdown-browser-tree-controls {
    display: flex;
    justify-content: flex-end;
    gap: 0.35rem;
    padding: 0 0.25rem 0.25rem;
    flex: 0 0 auto;
}

.markdown-browser-tree-search {
    flex: 1 1 auto;
    min-width: 0;
}

.markdown-browser-tree-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex: 0 0 auto;
    margin-left: auto;
}

.markdown-browser-tree-search .select2-container {
    width: 100% !important;
    min-width: 0;
}

.markdown-browser-tree-search .select2-container--bootstrap-5 .select2-selection--single {
    min-height: 1.65rem;
    height: 1.65rem;
    padding: 0.1rem 1.75rem 0.1rem 0.45rem;
    font-size: 0.8125rem;
    line-height: 1.35;
    display: flex;
    align-items: center;
}

.markdown-browser-tree-search .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding: 0;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.markdown-browser-tree-search .form-select {
    height: 1.65rem;
    min-height: 1.65rem;
    padding: 0.1rem 1.75rem 0.1rem 0.45rem;
    font-size: 0.8125rem;
    line-height: 1.35;
}

.select2-dropdown.markdown-browser-tree-search-dropdown {
    width: min(30rem, calc(100vw - 1.5rem)) !important;
    min-width: min(24rem, calc(100vw - 1.5rem));
    max-width: min(36rem, calc(100vw - 1.5rem));
}

.select2-dropdown.markdown-browser-tree-search-dropdown .select2-results__options:not(.select2-results__options--nested) {
    max-height: 22rem;
}

.markdown-browser-tree-search-option {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.markdown-browser-tree-search-option-title {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    min-width: 0;
}

.markdown-browser-tree-search-option-label {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
}

.markdown-browser-tree-search-option-emoji,
.markdown-browser-tree-search-option-icon {
    flex: 0 0 auto;
    line-height: 1.3;
}

.markdown-browser-tree-search-option-path {
    font-size: 0.72rem;
    opacity: 0.78;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
}

.select2-results__option--highlighted .markdown-browser-tree-search-option-path {
    opacity: 0.92;
}

mark.uikit-search-highlight,
.uikit-search-highlight {
    padding: 0 0.1rem;
    border-radius: 0.15rem;
    background-color: rgba(255, 193, 7, 0.55);
    color: inherit;
    font-weight: 600;
}

.select2-results__option--highlighted mark.uikit-search-highlight,
.select2-results__option--highlighted .uikit-search-highlight {
    background-color: rgba(255, 193, 7, 0.7);
    color: inherit;
}

.select2-results__option--selected:not(.select2-results__option--highlighted) mark.uikit-search-highlight,
.select2-results__option[aria-selected="true"]:not(.select2-results__option--highlighted) mark.uikit-search-highlight {
    background-color: rgba(255, 224, 102, 0.45);
    color: #fff;
}

.uikit-select2-group {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.uikit-select2-group-icon {
    opacity: 0.75;
}

.markdown-browser-tree-search-dropdown .select2-results__group {
    padding: 0.25rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--bs-secondary-color, #6c757d);
}

.markdown-browser-tree-search-dropdown .select2-results__options--nested {
    padding-left: 0.75rem;
    margin-left: 0.45rem;
    border-left: 1px solid var(--bs-border-color, #dee2e6);
}
/* ── One header height across the three panes (REQ-UI-030) ────────────────────
   Tree, page and graph stand side by side, so their headers are one row to the
   eye. They were three different heights, which made the panes look misaligned
   even though the split itself was exact. One value, applied to all three. */

.markdown-browser {
    --markdown-browser-header: 2.15rem;
}

.markdown-browser-tree-controls,
.markdown-browser .uikit-tree-detail-header,
.markdown-browser-side .uikit-graph-head {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    min-height: var(--markdown-browser-header);
    height: var(--markdown-browser-header);
    padding-block: 0;
    overflow: hidden;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    background: var(--bs-tertiary-bg, #f8f9fa);
}

/* The controls sit in a column above the rows, so they hold their place without sticking: the
   pane does not scroll any more, the tree does. `position: sticky` was what kept them visible
   while the *pane* scrolled - the behaviour that also put a scrollbar over the pane's title. */
.markdown-browser-tree-controls {
    padding-inline: 0.35rem;
}

.markdown-browser .uikit-tree-detail-header,
.markdown-browser-side .uikit-graph-head {
    padding-inline: 0.6rem;
}

/* Keep the graph header on one static row matching the tree and page headers: in a narrow
   graph pane, wrapping pushed the depth stepper onto a second line over the SVG canvas.
   The title and controls never wrap; SplitPanel clamps the Navigator column width to fit the
   full header row, and only on extreme narrow viewports does the count badge ellipsize. */
.markdown-browser-side .uikit-graph-head {
    flex-wrap: nowrap;
    gap: 0.35rem;
    white-space: nowrap;
}

.markdown-browser-side .uikit-graph-title,
.markdown-browser-side .uikit-graph-actions,
.markdown-browser-side .uikit-graph-depth {
    flex: 0 0 auto;
    white-space: nowrap;
}

.markdown-browser-side .uikit-graph-badge {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* A reference row the pointer is on marks the drawing beside it: the two are the same
   node seen twice, so the row says which symbol it means. */
.markdown-browser-reference.is-hovered {
    background: var(--bs-primary-bg-subtle, #cfe2ff);
    box-shadow: inset 2px 0 0 var(--bs-primary, #0d6efd);
}

/* The lists column splits between the sections and the references, so both need the same
   height rules as the panes above them: without `min-height: 0` a list grows to its content
   and the splitter has nothing to divide. */
.markdown-browser-lists-split {
    min-height: 0;
    height: 100%;
}

/* Side by side: each list may be narrower than its content's longest word, so the pane has to be
   allowed to shrink and let the labels wrap or ellipsise instead of pushing the divider away. */
.markdown-browser-lists-split > * {
    min-height: 0;
    min-width: 0;
    height: 100%;
}

/* The pane is a column so the list inside it stretches to the strip's full height - the splitter
   decides the width, the strip decides the height, and the list scrolls inside that. Without it the
   list was as tall as its content, so a page with two sections left the rest of the strip empty
   while the references beside it scrolled. */
.markdown-browser-lists-split > .uikit-split-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
/*
   A lone references list takes what the pane gives it.

   The height is decided by the splitter above it - the graph keeps three quarters - so the list
   must not cap itself again: two limits fighting over one column is what made the divider sit in
   the middle while the list inside it shrank. It scrolls in whatever room it is given.
*/
.markdown-browser-lists > .markdown-browser-list > ul {
    overflow: auto;
    min-height: 0;
}
/* ── Selected nodes ────────────────────────────────────────────────────────────────────
   Set in bold, and stated last on purpose: several rules give a label a weight (a muted one 400,
   an answered one 600, a corpus 700), and a selected node has to win against all of them whatever
   order they were written in. The frame says where the path runs; the weight says the same thing in
   a way that survives a glance - it is what an emphasised entry in a table of contents looks like. */
.uikit-graph-label-group[data-selected="true"] .uikit-graph-label {
    font-weight: 700;
    fill: #212529;
}
