/* components.css — messages, sidebar, source panel, settings */

/* === MESSAGES === */
.message {
    max-width: 800px;
    margin: 0 auto 20px auto;
    padding: 16px 20px;
    border-radius: 12px;
    line-height: 1.7;
    border: 1px solid transparent;
    position: relative;
}

.message.user {
    background: var(--bg-user);
    border-color: rgba(0, 200, 255, 0.08);
}

.message.assistant {
    background: var(--bg-assistant);
    border-color: var(--border);
}

.message .role {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.message.user .role {
    color: var(--cyan);
    opacity: 0.7;
}

.message.assistant .role {
    color: var(--violet);
    opacity: 0.7;
}

.message .content {
    font-size: 14px;
    color: var(--text);
}

/* === AGENT INDICATOR === */
.agent-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.5px;
    margin-left: 8px;
    padding: 1px 6px;
    border-radius: 3px;
    vertical-align: middle;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
}

.agent-indicator .agent-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-dim);
}

.agent-indicator.agent-blue { color: var(--cyan); border-color: rgba(0, 200, 255, 0.15); }
.agent-indicator.agent-blue .agent-dot { background: var(--cyan); }

.agent-indicator.agent-amber { color: var(--warning); border-color: rgba(255, 170, 48, 0.15); }
.agent-indicator.agent-amber .agent-dot { background: var(--warning); }

.agent-indicator.agent-green { color: var(--mint); border-color: rgba(0, 255, 180, 0.15); }
.agent-indicator.agent-green .agent-dot { background: var(--mint); }

.agent-indicator.agent-purple { color: var(--violet); border-color: rgba(120, 80, 255, 0.15); }
.agent-indicator.agent-purple .agent-dot { background: var(--violet); }

.agent-indicator.agent-teal { color: #00b8a0; border-color: rgba(0, 184, 160, 0.15); }
.agent-indicator.agent-teal .agent-dot { background: #00b8a0; }

.agent-indicator.agent-rose { color: #ff6688; border-color: rgba(255, 102, 136, 0.15); }
.agent-indicator.agent-rose .agent-dot { background: #ff6688; }

.agent-indicator.agent-orange { color: #ff7744; border-color: rgba(255, 119, 68, 0.15); }
.agent-indicator.agent-orange .agent-dot { background: #ff7744; }

.agent-indicator.agent-indigo { color: #6488ff; border-color: rgba(100, 136, 255, 0.15); }
.agent-indicator.agent-indigo .agent-dot { background: #6488ff; }

/* Financial agent indicator */
.agent-indicator.agent-gold { color: #f5c542; border-color: rgba(245, 197, 66, 0.15); }
.agent-indicator.agent-gold .agent-dot { background: #f5c542; }

/* === COPY BUTTON === */
.copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-dim);
    cursor: pointer;
    padding: 3px 5px;
    font-size: 13px;
    line-height: 1;
    opacity: 0;
    transition: all 0.2s;
}

.message.assistant:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    color: var(--cyan);
    border-color: rgba(0, 200, 255, 0.2);
    background: rgba(0, 200, 255, 0.05);
}

.copy-btn.copied {
    color: var(--mint);
    opacity: 1;
}

/* === MARKDOWN CONTENT === */
.message .content p { margin-bottom: 8px; }
.message .content p:last-child { margin-bottom: 0; }
.message .content strong { color: var(--cyan); font-weight: 500; }
.message .content em { color: var(--text); }
.message .content ul, .message .content ol { margin: 6px 0 6px 20px; }
.message .content li { margin-bottom: 4px; }
.message .content a { color: var(--cyan); text-decoration: underline; }
.message .content h1, .message .content h2, .message .content h3 {
    color: var(--cyan);
    margin: 12px 0 6px 0;
    font-size: 15px;
    font-weight: 600;
}

.message .content code {
    background: var(--surface);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 13px;
    border: 1px solid var(--border);
    color: var(--cyan);
}

.message .content pre {
    background: var(--surface);
    padding: 14px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid var(--border);
    border-left: 2px solid rgba(0, 200, 255, 0.3);
}

.message .content pre code {
    background: none;
    padding: 0;
    border: none;
    color: var(--text);
    font-size: 13px;
}

/* === TERMINAL BLOCKS === */
.terminal-block {
    background: var(--void);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.5;
    overflow-x: auto;
}

.terminal-block code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text);
    font-size: 13px;
}

.terminal-block .prompt { color: var(--cyan); }
.terminal-block .output { color: var(--text); }
.terminal-block .success { color: var(--mint); }
.terminal-block .error { color: var(--error); }

/* === MERMAID DIAGRAMS === */
.mermaid-diagram {
    margin: 12px 0;
    padding: 16px;
    background: var(--deep);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-x: auto;
    text-align: center;
}

.mermaid-diagram svg {
    max-width: 100%;
    height: auto;
}

/* Mermaid fallback — shown when diagram fails to parse */
.mermaid-fallback {
    border-left: 3px solid var(--violet);
    opacity: 0.85;
}

.mermaid-error-label {
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 10px;
    color: var(--violet);
    opacity: 0.6;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === INLINE IMAGES (screen renders) === */
.message .content img {
    max-width: 320px;
    border-radius: 12px;
    margin: 12px 0;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: transform 0.2s;
    display: block;
}

.message .content img:hover {
    transform: scale(1.02);
    border-color: rgba(0, 200, 255, 0.3);
}

/* === CODE BLOCK CHROME (B2 · REQ-SYN-CHAT-001) ===
   Wrapper from markdown.js postProcessVisualBlocks: .code-block > .code-header + <pre>.
   The standalone `.message .content pre` frame is neutralized inside the wrapper so the
   wrapper owns the frame and the header bar sits flush on top. Terminal/mermaid blocks
   are NOT wrapped, so their existing styling is untouched. */
.message .content .code-block {
    margin: 12px 0;
    border: 1px solid var(--border);
    border-left: 2px solid rgba(0, 200, 255, 0.3);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
}
.message .content .code-block pre {
    margin: 0;
    border: none;
    border-left: none;
    border-radius: 0;
    background: none;
}
.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px 5px 12px;
    background: rgba(0, 0, 0, 0.22);
    border-bottom: 1px solid var(--border);
}
.code-lang {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-dim);
}
.code-copy-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    padding: 2px 8px;
    transition: all 0.2s;
}
.code-copy-btn:hover {
    color: var(--cyan);
    border-color: rgba(0, 200, 255, 0.2);
    background: rgba(0, 200, 255, 0.05);
}
.code-copy-btn.copied { color: var(--mint); border-color: rgba(0, 255, 180, 0.2); }

/* highlight.js — Aurora-tuned theme (token classes hand-mapped to the platform palette;
   kept compact to the common tokens; vendored build at js/vendor/highlight.min.js). */
.hljs { color: var(--text); background: none; }
.hljs-comment, .hljs-quote { color: var(--text-dim); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-section, .hljs-doctag { color: var(--violet); }
.hljs-built_in, .hljs-type, .hljs-class .hljs-title, .hljs-title.class_ { color: #6fd3ff; }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-meta .hljs-string { color: var(--mint); }
.hljs-number, .hljs-symbol, .hljs-bullet { color: var(--warning); }
.hljs-title, .hljs-title.function_, .hljs-function .hljs-title { color: var(--cyan); }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable { color: #7fd8ff; }
.hljs-name, .hljs-tag, .hljs-selector-id, .hljs-selector-class { color: var(--violet); }
.hljs-meta { color: var(--text-dim); }
.hljs-deletion { color: var(--error); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }

/* === GFM ELEMENTS (B3 · REQ-SYN-CHAT-001) — tables / blockquotes / task-lists / h4-6 / del / hr.
   marked already emits these (sanitized by DOMPurify); they were just unstyled. */
.message .content table {
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 13px;
    display: block;
    overflow-x: auto;
    max-width: 100%;
}
.message .content th,
.message .content td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
    vertical-align: top;
}
.message .content th { background: var(--surface); color: var(--cyan); font-weight: 600; }
.message .content tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.02); }
.message .content blockquote {
    margin: 8px 0;
    padding: 2px 0 2px 14px;
    border-left: 3px solid var(--violet);
    color: var(--text-dim);
}
.message .content blockquote p { margin-bottom: 4px; }
.message .content h4, .message .content h5, .message .content h6 {
    color: var(--text);
    margin: 10px 0 5px 0;
    font-weight: 600;
}
.message .content h4 { font-size: 14px; }
.message .content h5 { font-size: 13px; }
.message .content h6 { font-size: 12px; color: var(--text-dim); }
.message .content del { color: var(--text-dim); text-decoration: line-through; }
.message .content hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.message .content li input[type="checkbox"] { margin-right: 7px; accent-color: var(--cyan); }
.message .content li:has(> input[type="checkbox"]) { list-style: none; margin-left: -16px; }

/* === STOP BUTTON (B1 · REQ-SYN-CHAT-001) — swaps in for Send during streaming === */
.stop-btn {
    background: rgba(255, 68, 102, 0.12);
    color: #ff6f88;
    border: 1px solid rgba(255, 68, 102, 0.3);
    border-radius: 10px;
    padding: 12px 24px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.stop-btn:hover {
    background: rgba(255, 68, 102, 0.2);
    border-color: rgba(255, 68, 102, 0.5);
    box-shadow: 0 0 18px rgba(255, 68, 102, 0.12);
}

/* === JUMP-TO-LATEST (A1 · REQ-SYN-CHAT-001) — appears when scrolled up mid-stream.
   Visibility via the global `.hidden` (display:none) toggled from chat.js. === */
#chat-view { position: relative; }
.scroll-bottom-btn {
    position: absolute;
    right: 28px;
    bottom: 96px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid rgba(0, 200, 255, 0.25);
    color: var(--cyan);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.scroll-bottom-btn:hover {
    background: rgba(0, 200, 255, 0.12);
    border-color: rgba(0, 200, 255, 0.5);
    transform: translateY(-2px);
}

/* "stopped" marker on a turn the user cancelled mid-stream (B1). */
.stopped-tag {
    margin-left: 8px;
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0.7;
}

/* === IMAGE LIGHTBOX (REQ-SYN-CHAT-001) — click any chat image to zoom === */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(2, 4, 10, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4vh 4vw;
    cursor: zoom-out;
    backdrop-filter: blur(4px);
}
.lightbox-overlay img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 200, 255, 0.25);
}
.lightbox-close {
    position: fixed;
    top: 18px;
    right: 22px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}
.lightbox-close:hover { color: var(--cyan); }

/* === USER-MESSAGE ATTACHMENTS (REQ-SYN-CHAT-001) — image thumbnail / doc chip in the bubble === */
.user-attachment { margin-top: 8px; }
.user-attachment img.user-attach-img {
    max-width: 220px;
    max-height: 220px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: zoom-in;
    display: block;
}
.user-doc-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text);
}
.user-doc-chip .doc-icon { font-size: 15px; }
.user-doc-chip .doc-size { color: var(--text-dim); font-size: 11px; }

/* On-demand model rows in the cluster topology card (declared capability, not resident). */
.model-row.model-ondemand { opacity: 0.82; }

/* === MODE SELECTOR === */
.mode-selector {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.mode-btn {
    background: none;
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 5px 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn:last-child {
    border-right: none;
}

/* Role-driven visibility — gated tabs the user lacks caps for are removed. */
.mode-btn.hidden {
    display: none !important;
}

.mode-btn:hover {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
}

/* Mode-specific accent colors */
.mode-btn[data-mode="user"].active {
    color: var(--cyan);
    background: rgba(0, 200, 255, 0.1);
}

.mode-btn[data-mode="admin"].active {
    color: var(--violet);
    background: rgba(120, 80, 255, 0.1);
}

.mode-btn[data-mode="assessment"].active {
    color: var(--mint);
    background: rgba(0, 255, 180, 0.1);
}

.mode-btn[data-mode="brain"].active {
    color: #34e89e;
    background: rgba(52, 232, 158, 0.12);
}

/* === SERVICE STATUS DOTS === */
.service-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}

.service-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-dim);
    transition: background 0.3s;
    position: relative;
}

.service-dot::after {
    content: attr(data-label);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid var(--border);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.service-dot:hover::after {
    opacity: 1;
}

.service-dot.ok { background: var(--mint); box-shadow: 0 0 6px rgba(0, 255, 180, 0.4); }
.service-dot.error { background: var(--error); box-shadow: 0 0 6px rgba(255, 68, 102, 0.4); }
.service-dot.unknown { background: var(--warning); }
.service-dot.disabled { background: var(--text-dim); opacity: 0.3; }
.service-dot.hidden { display: none !important; }

/* === TIER BADGE === */
.tier-badge {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--portable);
    background: rgba(155, 122, 255, 0.1);
    border: 1px solid rgba(155, 122, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
}

.tier-badge.hidden { display: none !important; }

/* S-014 follow-on 2026-05-18 — full-tier (cluster-reachable) badge variant.
 * Distinct color from EDGE tier so the cluster-vs-orin distinction is
 * immediately visible in the header. */
.tier-badge.full {
    color: #00dc82;
    background: rgba(0, 220, 130, 0.08);
    border-color: rgba(0, 220, 130, 0.2);
}

/* === RESPONSE PROVENANCE TAG === */
.provenance-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.5px;
    padding: 3px 10px;
    border-radius: 4px;
    margin-top: 8px;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.provenance-tag:hover { opacity: 1; }
.provenance-tag.backend-cluster {
    color: var(--accent);
    background: rgba(0, 200, 255, 0.08);
    border: 1px solid rgba(0, 200, 255, 0.15);
}
.provenance-tag.backend-local {
    color: var(--portable);
    background: rgba(155, 122, 255, 0.08);
    border: 1px solid rgba(155, 122, 255, 0.15);
}
.provenance-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}
.backend-cluster .provenance-dot { background: var(--accent); }
.backend-local .provenance-dot { background: var(--portable); }

/* Speculative provenance (dual-backend) */
.provenance-tag.backend-speculative {
    color: var(--mint);
    background: rgba(0, 255, 180, 0.08);
    border: 1px solid rgba(0, 255, 180, 0.15);
}
.backend-speculative .provenance-dot { background: var(--mint); }

/* === SPECULATIVE PREVIEW === */
.speculative-preview {
    opacity: 0.55;
    font-style: italic;
    transition: opacity 0.3s ease, font-style 0.3s ease;
}
.speculative-preview .content::before {
    content: '';
    display: block;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--portable);
    margin-bottom: 4px;
    opacity: 0.8;
}

/* Transition: preview fades out, primary fades in */
.speculative-replacing .content {
    animation: specReplace 0.4s ease-out forwards;
}
@keyframes specReplace {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* === DEGRADED-MODE BANNER (T-203 / S-011 Phase 3) === */
/* Surfaced when the cluster primary fell back to the edge preview, so
   the user can tell an edge-model answer apart from a cluster answer. */
.degraded-banner {
    margin: 4px 0 8px 0;
    padding: 6px 10px;
    border-left: 3px solid var(--portable, #f4a261);
    background: rgba(244, 162, 97, 0.08);
    color: var(--portable, #f4a261);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2px;
    line-height: 1.4;
    border-radius: 2px;
}
.degraded-banner::before {
    content: 'EDGE FALLBACK · ';
    font-weight: 700;
    letter-spacing: 1px;
    font-size: 9px;
    margin-right: 4px;
}

/* === CONTINUATION CARD (graceful frontier hand-back) ===
   Replaces the orange "DEGRADED — answer may be less reliable" banner
   for parallel-consult / tool-iter / rag-truncate / reasoning-timeout
   cap-hits. Lives BELOW the answer body, not above — reads as a natural
   conversational hand-back, not a warning. Neutral accent (platform
   primary, not portable amber) so the user perceives it as "more to
   explore" rather than "the system failed." Leap-off chips are
   clickable buttons that fire the chip text as a follow-up message via
   sendMessage. */
.continuation-card {
    margin: 10px 0 4px 0;
    padding: 10px 12px;
    border-left: 3px solid var(--accent-secondary, #6dd5ed);
    background: rgba(109, 213, 237, 0.06);
    border-radius: 4px;
}
.continuation-header {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--accent-secondary, #6dd5ed);
    margin-bottom: 4px;
}
.continuation-message {
    font-size: 12px;
    line-height: 1.45;
    color: var(--fg-muted, #b5c2cc);
    margin-bottom: 8px;
}
.continuation-leapoffs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.continuation-chip {
    font-family: inherit;
    font-size: 11px;
    line-height: 1.3;
    padding: 5px 10px;
    border-radius: 14px;
    border: 1px solid rgba(109, 213, 237, 0.35);
    background: rgba(109, 213, 237, 0.05);
    color: var(--fg, #e0e6ec);
    cursor: pointer;
    text-align: left;
    max-width: 100%;
    white-space: normal;
    transition: background-color 120ms ease, border-color 120ms ease;
}
.continuation-chip:hover {
    background: rgba(109, 213, 237, 0.14);
    border-color: rgba(109, 213, 237, 0.6);
}
.continuation-chip:active {
    transform: translateY(1px);
}

/* === DEPTH TOGGLE === */
.depth-btn {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 10px;
    min-width: 56px;
    text-align: center;
    color: var(--text-muted);
}

.depth-btn.depth-cyan {
    color: var(--cyan);
    border-color: rgba(0, 200, 255, 0.2);
}

.depth-btn.depth-violet {
    color: var(--violet);
    border-color: rgba(120, 80, 255, 0.2);
}

/* === BUFFER TOGGLE === */
.buffer-btn {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 10px;
    min-width: 42px;
    text-align: center;
    color: var(--text-muted);
}

.buffer-btn.buffer-violet {
    color: var(--violet);
    border-color: rgba(120, 80, 255, 0.2);
}

.buffer-btn.buffer-cyan {
    color: var(--cyan);
    border-color: rgba(0, 200, 255, 0.2);
}

/* === ROUTE TOGGLES (REASONER / COUNCIL) — binary on/off ===
   Size + font MATCH .depth-btn / .buffer-btn (THOROUGH / STREAM) so the header
   reads as one consistent control row (operator, 2026-06-17). The leading ○/●
   glyph was removed per operator; the ON state is signalled by the filled,
   colored pill below — amber = REASONER (heavy CoT), violet = COUNCIL (breadth). */
.route-toggle {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 10px;
    text-align: center;
    color: var(--text-muted);
    transition: all 0.18s ease;
}
#reasoner-toggle.active {
    color: var(--warning);
    border-color: var(--warning);
    background: rgba(255, 170, 48, 0.16);
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(255, 170, 48, 0.30), 0 0 10px rgba(255, 170, 48, 0.16);
}
#reasoner-toggle.active:hover {
    color: var(--warning);
    border-color: var(--warning);
    background: rgba(255, 170, 48, 0.24);
}
#council-toggle.active {
    color: #b9a6ff;             /* lighter violet — legible text on dark */
    border-color: var(--violet);
    background: rgba(120, 80, 255, 0.22);
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(120, 80, 255, 0.34), 0 0 10px rgba(120, 80, 255, 0.18);
}
#council-toggle.active:hover {
    color: #cabfff;
    border-color: var(--violet);
    background: rgba(120, 80, 255, 0.30);
}
#composite-toggle.active {
    color: #acc4ff;             /* lighter blue — legible text on dark; matches the help-card indigo */
    border-color: #5a82ff;
    background: rgba(90, 130, 255, 0.20);
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(90, 130, 255, 0.34), 0 0 10px rgba(90, 130, 255, 0.18);
}
#composite-toggle.active:hover {
    color: #c6d6ff;
    border-color: #5a82ff;
    background: rgba(90, 130, 255, 0.28);
}

/* === MODES QUICK-REFERENCE (the "?" affordance + popover) === */
.modes-help-btn {
    min-width: 26px;
    padding: 5px 8px;
    font-weight: 700;
    color: var(--text-muted);
}
.modes-help-btn.open {
    color: var(--cyan);
    border-color: rgba(0, 200, 255, 0.4);
    background: rgba(0, 200, 255, 0.08);
}
.modes-help-popover {
    position: fixed;
    z-index: 2000;
    width: 340px;
    max-width: calc(100vw - 24px);
    background: rgba(14, 20, 28, 0.98);
    border: 1px solid rgba(0, 200, 255, 0.22);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    padding: 14px 16px 12px;
    font-family: 'Inter', sans-serif;
    color: var(--fg, #e0e6ec);
    animation: modesHelpIn 130ms ease;
}
.modes-help-popover.hidden { display: none; }
@keyframes modesHelpIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.modes-help-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--cyan);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modes-help-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}
.modes-help-close:hover { color: var(--fg, #e0e6ec); }
.modes-help-item {
    margin-bottom: 9px;
    font-size: 12px;
    line-height: 1.45;
}
.modes-help-item:last-child { margin-bottom: 0; }
.modes-help-item .mh-name {
    font-weight: 700;
    letter-spacing: 0.5px;
}
.modes-help-item .mh-name.mh-amber  { color: var(--warning); }
.modes-help-item .mh-name.mh-violet { color: #b9a6ff; }
.modes-help-item .mh-name.mh-indigo { color: #7aa2ff; }
.modes-help-item .mh-name.mh-cyan   { color: var(--cyan); }
.modes-help-item .mh-name.mh-mint   { color: var(--mint); }
.modes-help-item .mh-when {
    color: var(--text-muted);
    font-size: 11px;
}

/* === FEEDBACK WIDGET === */
.feedback-widget {
    position: absolute;
    top: 12px;
    right: 36px;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message.assistant:hover .feedback-widget {
    opacity: 1;
}

.feedback-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 12px;
    line-height: 1;
    opacity: 0.5;
    transition: all 0.2s;
    filter: grayscale(1);
}

.feedback-btn:hover {
    opacity: 1;
    filter: grayscale(0);
    border-color: rgba(120, 80, 255, 0.2);
    background: rgba(120, 80, 255, 0.05);
}

.feedback-detail {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 240px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
}

.feedback-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.feedback-flag {
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
}

.feedback-flag input {
    accent-color: var(--violet);
}

.feedback-correction {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    padding: 6px 8px;
    resize: vertical;
}

.feedback-correction::placeholder {
    color: var(--text-dim);
}

.feedback-submit {
    align-self: flex-end;
    background: rgba(120, 80, 255, 0.15);
    border: 1px solid rgba(120, 80, 255, 0.2);
    border-radius: 4px;
    color: var(--violet);
    font-size: 11px;
    font-weight: 500;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.feedback-submit:hover {
    background: rgba(120, 80, 255, 0.25);
}

.feedback-thanks {
    font-size: 11px;
    font-style: italic;
    color: var(--text-dim);
}

.feedback-event-id {
    font-size: 9px;
    font-family: monospace;
    color: var(--text-dim);
    opacity: 0.5;
    margin-left: 4px;
}

/* === SOURCE PANEL (expandable) === */
.sources {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.sources-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.sources-toggle .label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--mint);
    opacity: 0.6;
}

.sources-toggle .arrow {
    font-size: 9px;
    color: var(--mint);
    opacity: 0.4;
    transition: transform 0.2s;
}

.sources.expanded .sources-toggle .arrow {
    transform: rotate(90deg);
}

.sources-toggle .source-count {
    font-size: 10px;
    color: var(--text-dim);
}

.sources-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sources.expanded .sources-body {
    max-height: 500px;
}

.source-item {
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--bg-source);
    border-radius: 6px;
    border: 1px solid rgba(0, 255, 180, 0.1);
}

.source-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.source-item-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--mint);
}

.source-item-score {
    font-size: 10px;
    color: var(--text-dim);
    font-family: monospace;
}

.source-item-preview {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    max-height: 3em;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Reasoning-only source items (dimmed) */
.source-item.reasoning-only {
    opacity: 0.6;
    border-left: 2px solid var(--text-dim);
}

/* === SOURCE METADATA TAGS === */
.source-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.meta-tag {
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.3px;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

.meta-tag.vis-public {
    color: var(--mint);
    background: rgba(0, 255, 180, 0.1);
    border: 1px solid rgba(0, 255, 180, 0.15);
}

.meta-tag.vis-internal {
    color: var(--warning);
    background: rgba(255, 170, 48, 0.1);
    border: 1px solid rgba(255, 170, 48, 0.15);
}

.meta-tag.vis-proprietary {
    color: var(--error);
    background: rgba(255, 68, 102, 0.1);
    border: 1px solid rgba(255, 68, 102, 0.15);
}

.meta-tag.type-tag {
    color: var(--cyan);
    background: rgba(0, 200, 255, 0.08);
    border: 1px solid rgba(0, 200, 255, 0.12);
}

.meta-tag.releaseable {
    color: var(--mint);
    background: rgba(0, 255, 180, 0.08);
    border: 1px solid rgba(0, 255, 180, 0.12);
}

.meta-tag.not-releaseable {
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
}

.meta-tag.reasoning-tag {
    color: var(--violet);
    background: rgba(120, 80, 255, 0.1);
    border: 1px solid rgba(120, 80, 255, 0.15);
}

/* === ASSESSMENT DATA BLOCK === */
.assessment-block {
    margin-top: 14px;
    padding: 14px;
    background: rgba(0, 255, 180, 0.04);
    border: 1px solid rgba(0, 255, 180, 0.1);
    border-radius: 8px;
}

.assessment-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--mint);
    opacity: 0.7;
    margin-bottom: 10px;
}

.assessment-grid {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.assessment-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 14px;
    background: rgba(0, 255, 180, 0.06);
    border-radius: 6px;
    border: 1px solid rgba(0, 255, 180, 0.08);
}

.metric-value {
    font-size: 20px;
    font-weight: 300;
    color: var(--mint);
    font-family: 'Outfit', sans-serif;
}

.metric-label {
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-top: 2px;
}

.assessment-distribution {
    padding-top: 10px;
    border-top: 1px solid rgba(0, 255, 180, 0.08);
}

.distribution-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.distribution-item {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 11px;
}

.dist-type {
    color: var(--text-muted);
}

.dist-count {
    color: var(--mint);
    font-family: monospace;
}

/* === UTILITY === */
.hidden { display: none !important; }

/* === CHAT PAGE NAV TABS === */
.dash-nav {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.dash-nav-link {
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-decoration: none;
    padding: 5px 12px;
    border-right: 1px solid var(--border);
    transition: all 0.2s;
}

.dash-nav-link:last-child { border-right: none; }
.dash-nav-link:hover { color: var(--text-muted); background: rgba(255,255,255,0.03); }
.dash-nav-link.active { color: var(--violet); background: rgba(120,80,255,0.1); }

/* === TEACHING MODE TOGGLE === */
.teaching-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.3s;
}

.teaching-toggle:hover {
    border-color: rgba(0, 255, 180, 0.2);
}

.teaching-toggle:has(input:checked) {
    border-color: rgba(0, 255, 180, 0.4);
    background: rgba(0, 255, 180, 0.08);
    box-shadow: 0 0 12px rgba(0, 255, 180, 0.1);
}

.teaching-toggle input[type="checkbox"] {
    accent-color: var(--mint);
    width: 12px;
    height: 12px;
    cursor: pointer;
}

.teaching-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-dim);
    transition: color 0.3s;
}

.teaching-toggle:has(input:checked) .teaching-label {
    color: var(--mint);
}

/* === TEACHING CONTROLS PANEL === */
.teaching-controls {
    background: rgba(0, 255, 180, 0.03);
    border-bottom: 1px solid rgba(0, 255, 180, 0.12);
    padding: 10px 20px;
    transition: all 0.3s;
}

.teaching-controls.hidden {
    display: none;
}

.teaching-controls-inner {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.teaching-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.teaching-active-badge {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--mint);
    background: rgba(0, 255, 180, 0.1);
    border: 1px solid rgba(0, 255, 180, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    animation: teaching-pulse 2s ease-in-out infinite;
}

@keyframes teaching-pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(0, 255, 180, 0.1); }
    50% { box-shadow: 0 0 12px rgba(0, 255, 180, 0.25); }
}

.teaching-event-count {
    font-size: 11px;
    color: var(--text-muted);
    font-family: monospace;
}

.teaching-fields {
    display: flex;
    gap: 8px;
}

.teaching-input {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    padding: 5px 8px;
}

.teaching-input:focus {
    outline: none;
    border-color: rgba(0, 255, 180, 0.3);
}

.teaching-input::placeholder {
    color: var(--text-dim);
}

select.teaching-input {
    min-width: 140px;
    cursor: pointer;
}

select.teaching-input option {
    background: var(--bg-primary);
    color: var(--text);
}

.teaching-notes-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.teaching-notes {
    flex: 1;
    resize: vertical;
    min-height: 28px;
}

.teaching-save-btn {
    background: rgba(0, 255, 180, 0.12);
    border: 1px solid rgba(0, 255, 180, 0.25);
    border-radius: 4px;
    color: var(--mint);
    font-size: 11px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.teaching-save-btn:hover {
    background: rgba(0, 255, 180, 0.2);
    border-color: rgba(0, 255, 180, 0.4);
}

/* Teaching active indicator on input area */
#input-area.teaching-active {
    border-color: rgba(0, 255, 180, 0.2);
    box-shadow: 0 0 20px rgba(0, 255, 180, 0.05);
}

#input-area.teaching-active #input-form {
    border-color: rgba(0, 255, 180, 0.2);
}

/* === ATTACH BUTTON === */
.attach-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    cursor: pointer;
    padding: 6px 8px;
    font-size: 14px;
    line-height: 1;
    transition: all 0.2s;
    flex-shrink: 0;
}

.attach-btn:hover {
    color: var(--cyan);
    border-color: rgba(0, 200, 255, 0.3);
    background: rgba(0, 200, 255, 0.05);
}

/* === ATTACHMENT PREVIEW BAR === */
.attachment-preview {
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    border-bottom: none;
    margin: 0 0 -1px 0;
}

.attachment-preview.hidden { display: none !important; }

.attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.attachment-thumb {
    max-height: 80px;
    max-width: 80px;
    border-radius: 6px;
    border: 1px solid var(--border);
    object-fit: cover;
}

.attachment-icon {
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 200, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 6px;
    flex-shrink: 0;
}

.attachment-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.attachment-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-size {
    font-size: 10px;
    color: var(--text-dim);
    font-family: monospace;
}

.attachment-teach-badge {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--mint);
    background: rgba(0, 255, 180, 0.1);
    border: 1px solid rgba(0, 255, 180, 0.2);
    padding: 1px 6px;
    border-radius: 3px;
    align-self: flex-start;
    margin-top: 2px;
}

.attachment-tier-warn {
    font-size: 9px;
    color: var(--warning);
    margin-top: 2px;
}

.attachment-remove {
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.attachment-remove:hover {
    color: var(--error);
    border-color: rgba(255, 68, 102, 0.2);
    background: rgba(255, 68, 102, 0.05);
}

/* === DRAG-OVER STATE === */
#input-area.drag-over {
    border-color: var(--cyan);
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.15), inset 0 0 30px rgba(0, 200, 255, 0.03);
}

#input-area.drag-over #input-form {
    border-color: rgba(0, 200, 255, 0.3);
}

/* === UPLOAD STATUS === */
.upload-status {
    font-size: 11px;
    padding: 4px 12px;
    text-align: center;
    transition: all 0.3s;
}

.upload-status.hidden {
    display: none;
}

.upload-status.info {
    color: var(--cyan);
}

.upload-status.success {
    color: var(--mint);
}

.upload-status.warning {
    color: var(--warning);
}

.upload-status.error {
    color: var(--error);
}

/* ── Action Proposal Cards ── */
.action-proposal-card {
    background: var(--surface);
    border: 1px solid var(--cyan);
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 12px;
    transition: opacity 0.3s;
}

/* Severity-specific borders */
.action-proposal-card.severity-low { border-color: var(--mint); }
.action-proposal-card.severity-medium { border-color: var(--warning); }
.action-proposal-card.severity-high { border-color: #ff8830; }
.action-proposal-card.severity-critical { border-color: var(--error); }

.action-proposal-card.action-completed { opacity: 0.7; }
.action-proposal-card.action-denied { opacity: 0.5; }
.action-proposal-card.action-expired { opacity: 0.4; }

.proposal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.proposal-icon { font-size: 16px; }
.proposal-title {
    font-weight: 600;
    color: var(--cyan);
    flex: 1;
}
.proposal-severity {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border: 1px solid;
    border-radius: 4px;
}
.proposal-severity.severity-low { color: var(--mint); border-color: var(--mint); background: rgba(0, 255, 180, 0.08); }
.proposal-severity.severity-medium { color: var(--warning); border-color: var(--warning); background: rgba(255, 170, 48, 0.08); }
.proposal-severity.severity-high { color: #ff8830; border-color: #ff8830; background: rgba(255, 136, 48, 0.08); }
.proposal-severity.severity-critical { color: var(--error); border-color: var(--error); background: rgba(255, 68, 102, 0.08); }

.proposal-description {
    color: var(--text);
    margin-bottom: 8px;
    font-size: 14px;
}
.proposal-details {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.proposal-tool strong { color: var(--cyan); }
.proposal-params {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.param-item {
    font-size: 11px;
    background: rgba(0, 200, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 6px;
}
.param-key { color: var(--text-dim); }

.proposal-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.proposal-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.proposal-approve, .proposal-deny {
    padding: 6px 20px;
    border-radius: 4px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}
.proposal-approve {
    background: var(--mint);
    color: #000;
}
.proposal-approve:hover { opacity: 0.85; }
.proposal-approve:disabled { opacity: 0.5; cursor: default; }
.proposal-approve.approved { background: var(--mint); }
.proposal-deny {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
}
.proposal-deny:hover { border-color: var(--error); color: var(--error); }
.proposal-deny:disabled { opacity: 0.5; cursor: default; }
.proposal-deny.denied { border-color: var(--error); color: var(--error); }

.proposal-expiry {
    margin-top: 8px;
    font-size: 10px;
    color: var(--text-dim);
    font-family: monospace;
}
.proposal-expiry.expiry-warning .countdown { color: var(--error); }
.proposal-expired-label {
    font-size: 12px;
    color: var(--text-dim);
    font-style: italic;
}

.proposal-result {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
}
.result-success {
    background: rgba(0, 255, 180, 0.1);
    color: var(--mint);
}
.result-error {
    background: rgba(255, 68, 102, 0.1);
    color: var(--error);
}

/* ── Auto-Executed Action Result Card ── */
.action-result-card {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
}
.action-result-card.status-success {
    background: rgba(0, 255, 180, 0.06);
    border: 1px solid rgba(0, 255, 180, 0.15);
    color: var(--mint);
}
.action-result-card.status-error {
    background: rgba(255, 68, 102, 0.06);
    border: 1px solid rgba(255, 68, 102, 0.15);
    color: var(--error);
}
.action-result-icon { font-size: 14px; flex-shrink: 0; }
.action-result-text { flex: 1; }

/* REQ-SYN-MODAL gen — sovereign image generation (image.generate) output. */
.generated-images {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}
.generated-image {
    margin: 0;
    max-width: 512px;
    border: 1px solid rgba(120, 160, 255, 0.18);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(120, 160, 255, 0.04);
}
.generated-image a { display: block; line-height: 0; }
.generated-image img {
    display: block;
    max-width: 100%;
    height: auto;
    cursor: zoom-in;
}
.generated-image figcaption {
    padding: 7px 10px;
    font-size: 12px;
    color: var(--text-muted, #8aa);
    line-height: 1.4;
}
.generated-image.failed { opacity: 0.6; }
.generated-image.failed img { display: none; }

/* ── Autonomy Settings Panel ── */
.autonomy-tools-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.autonomy-tool-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    gap: 12px;
}

.autonomy-tool-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.autonomy-tool-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    font-family: monospace;
}

.autonomy-tool-agent {
    font-size: 10px;
    color: var(--text-dim);
}

/* #52 dynamic capability surface — live summary + read-capability list + flags */
.autonomy-caps-head {
    font-size: 11px;
    color: var(--text-muted);
    padding: 4px 0 8px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
    margin-bottom: 8px;
}
.autonomy-tool-irrev {
    font-size: 10px;
    color: var(--danger, #e06c75);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.autonomy-tool-cap {
    font-size: 10px;
    color: var(--text-dim);
    font-family: monospace;
}
.autonomy-reads {
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
}
.autonomy-reads > summary {
    cursor: pointer;
    color: var(--text-dim);
    padding: 4px 0;
}
.autonomy-reads-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 6px 0 2px 12px;
}
.autonomy-read-row {
    display: flex;
    gap: 8px;
    align-items: baseline;
}

.autonomy-selector {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.autonomy-option {
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.autonomy-option input[type="radio"] {
    accent-color: var(--cyan);
    cursor: pointer;
}

.autonomy-empty {
    font-size: 12px;
    color: var(--text-dim);
    text-align: center;
    padding: 16px;
    font-style: italic;
}

/* Training-readiness fuel gauge (REQ-SYN-SELF-003) — Trainer & Flywheel panel. */
.assess-gauges {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.assess-gauge-label {
    font-size: 12px;
    color: var(--text-dim, #8a93a6);
    margin-bottom: 2px;
}
.assess-gauge-label b { color: var(--text, #e6e9ef); }
.assess-gauge-track {
    height: 6px;
    border-radius: 3px;
    background: var(--bg-elevated, rgba(255, 255, 255, 0.06));
    overflow: hidden;
}
.assess-gauge-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}
.assess-gauge-corpus {
    font-size: 11px;
    color: var(--text-dim, #8a93a6);
    margin-top: 2px;
}
.assess-warrant-on {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--warning, #d6a019);
}
.assess-warrant-off {
    margin-top: 8px;
    font-size: 12px;
    opacity: 0.6;
}

/* Cluster Base Prompt editor (REQ-SYN-CHAT-003) — admin org-guidance layer of the prompt
   composition stack, surfaced as a dashboard admin card instead of an env var. */
.card-subtle {
    margin: 0 0 10px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-dim, #8a93a6);
}
.cluster-prompt-textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    box-sizing: border-box;
    padding: 10px 12px;
    font: 13px/1.5 var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    color: var(--text, #e6e9ef);
    background: var(--bg-elevated, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border, rgba(255, 255, 255, 0.10));
    border-radius: 8px;
    outline: none;
}
.cluster-prompt-textarea:focus {
    border-color: var(--accent, #4f8cff);
}
.cluster-prompt-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}
.cluster-prompt-status {
    font-size: 12px;
    color: var(--text-dim, #8a93a6);
}
.cluster-prompt-status.ok { color: var(--success, #46c93a); }
.cluster-prompt-status.err { color: var(--danger, #ff5c5c); }
