html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e51410;
}

.validation-message {
    color: #e51410;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Hide textarea text while recording dictation */
.chat-input-area.recording-active textarea {
    color: transparent !important;
    caret-color: transparent !important;
}

/* Voice selection list — bordered scrollable container */
.voice-selection-list {
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    max-height: 350px;
    overflow-y: auto;
}

.mud-theme-dark .voice-selection-list {
    border-color: rgba(255, 255, 255, 0.15);
    background: #1e1e1e;
}

.voice-section-header {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f5f5f5;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.mud-theme-dark .voice-section-header {
    background: #2d2d2d;
    border-bottom-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}

.voice-option-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.15s;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.voice-option-item:last-child {
    border-bottom: none;
}

.voice-option-item:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.mud-theme-dark .voice-option-item {
    border-bottom-color: rgba(255, 255, 255, 0.06);
    color: #e0e0e0;
    background: #1e1e1e;
}

.mud-theme-dark .voice-option-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.voice-option-item.active {
    border-left: 3px solid var(--mud-palette-primary);
    background-color: rgba(1, 129, 138, 0.06);
}

.voice-option-item.active:hover {
    background-color: rgba(1, 129, 138, 0.1);
}

.mud-theme-dark .voice-option-item.active {
    background-color: rgba(1, 129, 138, 0.12);
    color: #ffffff;
}

/* Softer tab name styling */
.mud-tab {
    text-transform: none !important;
    font-weight: 500;
    letter-spacing: normal;
}

/* Sticky tab headers */
.mud-tabs-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: inherit;
}

/* Sidebar overflow fix */
.mud-drawer,
.mud-drawer-content,
.mud-nav-menu {
    overflow-x: hidden !important;
}

/* Sidebar scrollbar auto-hide — visible on scroll/hover, fades after 2s inactivity */
.mud-drawer-content {
    overflow-y: auto !important;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.3s;
}

.mud-drawer-content.scrollbar-visible,
.mud-drawer-content:hover {
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.mud-theme-dark .mud-drawer-content.scrollbar-visible,
.mud-theme-dark .mud-drawer-content:hover {
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.mud-drawer-content::-webkit-scrollbar {
    width: 6px;
}

.mud-drawer-content::-webkit-scrollbar-track {
    background: transparent;
}

.mud-drawer-content::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
    transition: background 0.3s;
}

.mud-drawer-content.scrollbar-visible::-webkit-scrollbar-thumb,
.mud-drawer-content:hover::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

.mud-theme-dark .mud-drawer-content.scrollbar-visible::-webkit-scrollbar-thumb,
.mud-theme-dark .mud-drawer-content:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.conv-title {
    overflow: hidden;
    max-width: 100%;
}

.conv-title .mud-nav-link {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conv-title .mud-nav-link .mud-nav-link-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Message hover actions */
.message-wrapper {
    position: relative;
}

.message-wrapper .message-actions {
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
    margin-top: 2px;
}

.message-wrapper:hover .message-actions {
    opacity: 1;
}

/* Markdown body styles */
.markdown-body {
    line-height: 1.6;
    font-size: 0.95rem;
}

.markdown-body p {
    margin-bottom: 0.75em;
}

.markdown-body p:last-child {
    margin-bottom: 0;
}

.markdown-body pre {
    background-color: #f8f9fa;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin: 0.75em 0;
}

.mud-theme-dark .markdown-body pre {
    background-color: #1e1e1e;
    border-color: rgba(255, 255, 255, 0.12);
    color: #d4d4d4;
}

.mud-theme-dark .markdown-body pre code {
    color: #d4d4d4;
}

.mud-theme-dark .markdown-body th {
    background-color: #2d2d2d;
    border-color: rgba(255, 255, 255, 0.15);
}

.mud-theme-dark .markdown-body td {
    border-color: rgba(255, 255, 255, 0.15);
}

.mud-theme-dark .markdown-body a {
    color: #64b5f6;
}

.mud-theme-dark .markdown-body strong {
    color: #fff;
}

.markdown-body code {
    font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
    font-size: 0.875em;
}

.markdown-body :not(pre) > code {
    background-color: #f8f9fa;
    border-radius: 3px;
    padding: 0.2em 0.4em;
    color: #e83e8c;
}

.mud-theme-dark .markdown-body :not(pre) > code {
    background-color: rgba(255, 255, 255, 0.1);
    color: #f48fb1;
}

.markdown-body table {
    border-collapse: collapse;
    margin: 0.75em 0;
    width: 100%;
}

.markdown-body th {
    background-color: var(--mud-palette-background-gray, #f8f9fa);
    font-weight: 700;
    border: 1px solid var(--mud-palette-lines-default, rgba(0, 0, 0, 0.15));
    padding: 0.75rem;
    text-align: left;
    color: var(--mud-palette-text-primary, inherit);
}

.markdown-body td {
    border: 1px solid var(--mud-palette-lines-default, rgba(0, 0, 0, 0.1));
    padding: 0.75rem;
    text-align: left;
    color: var(--mud-palette-text-primary, inherit);
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 2rem;
    margin: 0.5em 0;
}

.markdown-body li {
    margin-bottom: 0.5rem;
}

.markdown-body blockquote {
    border-left: 4px solid var(--mud-palette-primary);
    margin: 0.75em 0;
    padding: 0.5em 1rem;
    color: rgba(0, 0, 0, 0.6);
}

.mud-theme-dark .markdown-body blockquote {
    color: rgba(255, 255, 255, 0.6);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.markdown-body img {
    max-width: 100%;
    border-radius: 6px;
}

.markdown-body hr {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    margin: 1.5em 0;
}

.mud-theme-dark .markdown-body hr {
    border-top-color: rgba(255, 255, 255, 0.12);
}

/* Message action bars - role-specific layout */
.message-actions-left,
.message-actions-right {
    display: flex;
    gap: 0;
}

.message-actions-bar {
    display: flex;
    justify-content: space-between;
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
    margin-top: 2px;
}

.message-wrapper:hover .message-actions-bar {
    opacity: 1;
}

/* Code block copy buttons */
.markdown-body pre {
    position: relative;
}

.code-copy-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    color: inherit;
    opacity: 0;
    transition: opacity 0.15s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.markdown-body pre:hover .code-copy-btn {
    opacity: 0.7;
}

.code-copy-btn:hover {
    opacity: 1 !important;
    background: rgba(0, 0, 0, 0.12);
}

.mud-theme-dark .code-copy-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.mud-theme-dark .code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

/* Drag-and-drop visual feedback */
.drag-over {
    outline: 2px dashed var(--mud-palette-primary) !important;
    outline-offset: -4px;
    background-color: rgba(1, 129, 138, 0.04) !important;
}

/* Esc to stop chip */
.esc-stop-chip {
    font-size: 0.75rem;
    opacity: 0.6;
    animation: pulse-subtle 2s infinite;
}

@keyframes pulse-subtle {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.9; }
}

/* ============================
   Phase 1 — Feature Parity
   ============================ */

/* 1. Streaming cursor — blinking caret appended to streaming content */
.streaming-cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background-color: var(--mud-palette-text-primary);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* 2. Thinking block accent — left border, italic monospace, subtle bg */
.thinking-block .mud-expand-panel {
    border-left: 2px solid var(--mud-palette-secondary);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 4px;
}

.thinking-block .mud-expand-panel-content {
    font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
    font-style: italic;
    font-size: 0.85rem;
}

.mud-theme-dark .thinking-block .mud-expand-panel {
    background: rgba(255, 255, 255, 0.03);
}

/* 3. Tool calls block accent — blue left border, subtle blue bg */
.tool-calls-block .mud-expand-panel {
    border-left: 2px solid #42a5f5;
    background: rgba(66, 165, 245, 0.04);
    border-radius: 4px;
}

.mud-theme-dark .tool-calls-block .mud-expand-panel {
    background: rgba(66, 165, 245, 0.08);
}

/* 4. Citation links — grouped with separator */
.message-citations {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: 8px;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-citations .mud-link {
    font-size: 0.8rem;
    transition: opacity 0.15s;
}

.message-citations .mud-link:hover {
    opacity: 0.8;
}

.mud-theme-dark .message-citations {
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* 5. Memory suggestion banner */
.memory-suggestion-banner {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.08), rgba(233, 30, 99, 0.06));
    border: 1px solid rgba(156, 39, 176, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
}

.memory-suggestion-banner .memory-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #9c27b0;
}

.memory-suggestion-banner .memory-value {
    font-size: 0.85rem;
    flex: 1;
}

.memory-suggestion-banner.saved {
    border-color: rgba(76, 175, 80, 0.3);
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.08), rgba(76, 175, 80, 0.04));
}

.memory-suggestion-banner.deleted {
    opacity: 0.5;
}

.mud-theme-dark .memory-suggestion-banner {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.15), rgba(233, 30, 99, 0.1));
    border-color: rgba(156, 39, 176, 0.3);
}

.mud-theme-dark .memory-suggestion-banner .memory-label {
    color: #ce93d8;
}

/* 6. Space panel enhancement — split view layout */
.space-slide-panel {
    width: 50%;
    min-width: 300px;
    height: 100%;
    background: var(--mud-palette-surface);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
    border-left: 1px solid var(--mud-palette-lines-default);
}

.space-panel-header {
    border-bottom: 1px solid var(--mud-palette-lines-default);
    padding: 8px;
    display: flex;
    align-items: center;
}

.space-iframe-container {
    flex: 1;
    border: none;
    width: 100%;
}

.mud-theme-dark .space-slide-panel {
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 768px) {
    .space-slide-panel {
        width: 100% !important;
    }
}

.space-slide-panel.space-fullscreen {
    position: fixed;
    top: 48px;
    right: 0;
    width: 100% !important;
    height: calc(100% - 48px);
    z-index: 1200;
    left: 0;
}

.space-view-fullscreen {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1300;
    background: var(--mud-palette-surface);
    overflow-y: auto;
    max-width: 100% !important;
    padding: 16px !important;
}

/* ============================
   Phase 2 — Visual Gaps
   ============================ */

/* 7. Response review phases — color-coded */
.review-phase .mud-expand-panel {
    border-radius: 4px;
    margin-bottom: 4px;
}

.review-initial .mud-expand-panel {
    border-left: 3px solid #42a5f5;
    background: rgba(66, 165, 245, 0.04);
}

.review-check .mud-expand-panel {
    border-left: 3px dashed #ff9800;
    background: rgba(255, 152, 0, 0.04);
}

.review-correction .mud-expand-panel {
    border-left: 3px solid #66bb6a;
    background: rgba(102, 187, 106, 0.04);
}

.mud-theme-dark .review-initial .mud-expand-panel {
    background: rgba(66, 165, 245, 0.08);
}

.mud-theme-dark .review-check .mud-expand-panel {
    background: rgba(255, 152, 0, 0.08);
}

.mud-theme-dark .review-correction .mud-expand-panel {
    background: rgba(102, 187, 106, 0.08);
}

/* 8. Agent phase stepper */
.agent-phase-stepper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 4px 0;
}

.agent-phase-stepper .phase-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.15);
    transition: all 0.3s;
}

.agent-phase-stepper .phase-dot.completed {
    background: var(--mud-palette-primary);
}

.agent-phase-stepper .phase-dot.active {
    background: #9c27b0;
    box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.3);
    animation: pulse-agent 1.5s infinite;
}

.agent-phase-stepper .phase-label {
    font-size: 0.75rem;
    opacity: 0.6;
}

.agent-phase-stepper .phase-label.active {
    opacity: 1;
    font-weight: 600;
    color: #9c27b0;
}

.mud-theme-dark .agent-phase-stepper .phase-dot {
    background: rgba(255, 255, 255, 0.15);
}

.mud-theme-dark .agent-phase-stepper .phase-label.active {
    color: #ce93d8;
}

@keyframes pulse-agent {
    0%, 100% { box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(156, 39, 176, 0.1); }
}

/* 9. Dictation recording states */
.mic-btn.recording {
    background-color: #9c27b0 !important;
    color: white !important;
    animation: pulse-recording 1.5s infinite;
}

.mic-btn.transcribing {
    background-color: #009688 !important;
    color: white !important;
}

@keyframes pulse-recording {
    0%, 100% { box-shadow: 0 0 0 0 rgba(156, 39, 176, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(156, 39, 176, 0); }
}

.mud-theme-dark .mic-btn.recording {
    background-color: #ab47bc !important;
}

.mud-theme-dark .mic-btn.transcribing {
    background-color: #26a69a !important;
}

/* 10. Cancelled/error message states */
.message-cancelled .mud-paper {
    opacity: 0.7;
    border: 1px dashed rgba(0, 0, 0, 0.2);
}

.message-error .mud-paper {
    background-color: rgba(244, 67, 54, 0.06) !important;
    border: 1px solid rgba(244, 67, 54, 0.2);
}

.mud-theme-dark .message-cancelled .mud-paper {
    border-color: rgba(255, 255, 255, 0.2);
}

.mud-theme-dark .message-error .mud-paper {
    background-color: rgba(244, 67, 54, 0.12) !important;
    border-color: rgba(244, 67, 54, 0.3);
}

/* ============================
   Phase 3 — Polish
   ============================ */

/* 11. Attachment display in messages */
.attachment-image-container img {
    transition: max-width 0.2s, max-height 0.2s;
}

/* 13. Drag-and-drop zone states */
.drag-available {
    outline: 2px dashed rgba(0, 0, 0, 0.15);
    outline-offset: -4px;
}

.drag-error {
    outline: 2px dashed var(--mud-palette-error) !important;
    outline-offset: -4px;
    background-color: rgba(244, 67, 54, 0.04) !important;
}

/* 14. Image/video generation progress */
.generation-progress {
    margin: 8px 0;
    border-radius: 4px;
    overflow: hidden;
}

.generation-progress .mud-progress-linear {
    height: 6px;
}

.generation-progress-label {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 4px;
}

/* Smaller collapsed thinking/tool divs */
.thinking-block .mud-expand-panel-header,
.tool-calls-block .mud-expand-panel-header {
    padding: 4px 10px;
    min-height: unset;
    font-size: 0.8em;
}

.thinking-block .mud-expand-panel-content,
.tool-calls-block .mud-expand-panel-content {
    padding: 6px 10px;
    font-size: 0.8em;
}

/* Preview text in collapsed panels */
.thinking-preview,
.tool-calls-preview {
    opacity: 0.5;
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
    margin-left: 8px;
}

/* Tool call entry — compact style */
.tool-call-entry {
    font-size: 0.8em;
    padding: 4px 8px;
    border-left: 3px solid #42a5f5;
    background: rgba(66, 165, 245, 0.04);
    border-radius: 0 4px 4px 0;
    margin: 3px 0;
    cursor: pointer;
    transition: background 0.15s;
}

.tool-call-entry:hover {
    background: rgba(66, 165, 245, 0.08);
}

.mud-theme-dark .tool-call-entry {
    background: rgba(66, 165, 245, 0.08);
}

.mud-theme-dark .tool-call-entry:hover {
    background: rgba(66, 165, 245, 0.14);
}

.tool-call-entry .tool-duration {
    font-family: 'SFMono-Regular', 'Consolas', monospace;
    font-variant-numeric: tabular-nums;
    opacity: 0.6;
    font-size: 0.9em;
}

.tool-call-entry .tool-result-content {
    margin-top: 4px;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: monospace;
    font-size: 0.85em;
    max-height: 200px;
    overflow-y: auto;
    opacity: 0.8;
}

/* Chat input — darker outline in dark mode + vertical text centering */
.mud-theme-dark .chat-input-area .mud-input-outlined-border {
    border-color: rgba(255, 255, 255, 0.5) !important;
}

.chat-input-area .mud-input-outlined-border {
    z-index: 0 !important;
}

.chat-input-area textarea {
    position: relative;
    z-index: 1;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
    line-height: 24px !important;
    background: transparent !important;
}

/* Auto-suggest ghost text overlay — positioned inside .chat-input-area */
.suggestion-ghost {
    position: absolute;
    top: 12px;
    left: 58px; /* 44px left button space + 14px textarea padding */
    right: 154px; /* 140px right buttons + 14px textarea padding */
    bottom: 12px;
    font-family: Inter, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 24px;
    color: var(--mud-palette-text-secondary);
    opacity: 0.6;
    pointer-events: none;
    white-space: pre-wrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 0;
}

.suggestion-hint {
    font-size: 12px;
    opacity: 0.5;
    font-style: italic;
}

.chat-input-area.has-suggestion textarea::placeholder {
    color: transparent !important;
}

/* Input area layout */
.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 4px;
}

.chat-input-row .mud-input-control {
    flex: 1;
}

/* Timing display in message header */
.message-timing {
    font-family: 'SFMono-Regular', 'Consolas', monospace;
    font-variant-numeric: tabular-nums;
    opacity: 0.5;
    font-size: 0.85em;
}

/* EasyMDE dark mode overrides */
.mud-theme-dark .EasyMDEContainer .CodeMirror {
    background: #1e1e2e !important;
    color: #cdd6f4 !important;
    border-color: #45475a !important;
}
.mud-theme-dark .EasyMDEContainer .CodeMirror-cursor {
    border-left-color: #cdd6f4;
}
.mud-theme-dark .EasyMDEContainer .editor-toolbar {
    background: #1e1e2e;
    border-color: #45475a;
}
.mud-theme-dark .EasyMDEContainer .editor-toolbar button {
    color: #cdd6f4 !important;
}
.mud-theme-dark .EasyMDEContainer .editor-toolbar button:hover,
.mud-theme-dark .EasyMDEContainer .editor-toolbar button.active {
    background: #313244;
    border-color: #585b70;
}
.mud-theme-dark .EasyMDEContainer .editor-toolbar i.separator {
    border-left-color: #45475a;
    border-right-color: #45475a;
}
.mud-theme-dark .EasyMDEContainer .editor-preview {
    background: #1e1e2e;
    color: #cdd6f4;
}
.mud-theme-dark .EasyMDEContainer .editor-preview-side {
    background: #1e1e2e;
    color: #cdd6f4;
    border-color: #45475a;
}
.mud-theme-dark .EasyMDEContainer {
    border-color: #45475a;
}
.mud-theme-dark .EasyMDEContainer .CodeMirror-selected {
    background: #45475a !important;
}
.mud-theme-dark .EasyMDEContainer .CodeMirror-gutters {
    background: #1e1e2e;
    border-right-color: #45475a;
}

/* ─── Team Mode: Phase Stepper ─── */
.team-phase-stepper {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(var(--mud-palette-primary-rgb), 0.06);
    border: 1px solid rgba(var(--mud-palette-primary-rgb), 0.15);
}
.team-phase-stepper .phase-step {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}
.team-phase-stepper .phase-step.completed {
    opacity: 0.7;
}
.team-phase-stepper .phase-step.completed .mud-icon-root {
    color: var(--mud-palette-success) !important;
}
.team-phase-stepper .phase-step.active {
    opacity: 1;
}
.team-phase-stepper .phase-step.active .mud-icon-root {
    color: var(--mud-palette-primary) !important;
    animation: teamPulse 1.5s ease-in-out infinite;
}
.team-phase-stepper .phase-label {
    font-size: 0.8rem;
    font-weight: 500;
}
.team-phase-stepper .phase-step.active .phase-label {
    font-weight: 700;
    color: var(--mud-palette-primary);
}
.team-phase-stepper .phase-sub {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--mud-palette-primary);
}
.team-phase-stepper .phase-sep {
    width: 24px;
    height: 2px;
    background: rgba(var(--mud-palette-text-primary-rgb), 0.15);
    border-radius: 1px;
    flex-shrink: 0;
}
@keyframes teamPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ─── Team Mode: Plan Card ─── */
.team-plan-card {
    border: 1px solid rgba(var(--mud-palette-primary-rgb), 0.2);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.team-plan-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(var(--mud-palette-primary-rgb), 0.08);
    border-bottom: 1px solid rgba(var(--mud-palette-primary-rgb), 0.12);
    font-weight: 600;
    font-size: 0.9rem;
}
.team-plan-goal-text {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.65;
    max-width: 50%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.team-plan-tasks {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: rgba(var(--mud-palette-text-primary-rgb), 0.04);
}
.team-plan-task {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    background: var(--mud-palette-surface);
    transition: background 0.2s ease;
    animation: taskSlideIn 0.3s ease forwards;
    opacity: 0;
}
.team-plan-task:nth-child(1) { animation-delay: 0s; }
.team-plan-task:nth-child(2) { animation-delay: 0.1s; }
.team-plan-task:nth-child(3) { animation-delay: 0.2s; }
.team-plan-task:nth-child(4) { animation-delay: 0.3s; }
.team-plan-task:nth-child(5) { animation-delay: 0.4s; }
.team-plan-task.running {
    background: rgba(var(--mud-palette-primary-rgb), 0.04);
}
.team-plan-task.completed {
    opacity: 0.7;
}
.team-plan-task-icon {
    flex-shrink: 0;
    width: 24px;
    padding-top: 1px;
    display: flex;
    justify-content: center;
}
.team-plan-task-body {
    flex: 1;
    font-size: 0.85rem;
    line-height: 1.5;
}
.team-plan-task-id {
    font-weight: 700;
    margin-right: 2px;
}
.team-plan-task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin-top: 4px;
}
@keyframes taskSlideIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
.team-plan-task.completed { animation: none; opacity: 0.7; }

/* ─── Team Mode: Plan Approval / Task Input ─── */
.team-plan-approval {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-top: 1px solid rgba(var(--mud-palette-primary-rgb), 0.12);
    background: rgba(var(--mud-palette-primary-rgb), 0.04);
    flex-wrap: wrap;
}
.team-plan-approval .mud-button-root {
    white-space: nowrap;
    min-width: fit-content;
}

/* ─── Agent Task Blocks ─── */
.agent-task-block {
    border-left: 3px solid rgba(var(--mud-palette-lines-default-rgb, 158, 158, 158), 0.4);
    border-radius: 8px;
    margin: 8px 16px;
    background: rgba(0, 0, 0, 0.02);
    transition: border-color 0.3s ease;
    animation: taskBlockSlideIn 0.3s ease-out;
}
.agent-task-block[data-status="running"] {
    border-left-color: var(--mud-palette-primary);
}
.agent-task-block[data-status="completed"] {
    border-left-color: var(--mud-palette-success);
}
.agent-task-block[data-status="failed"] {
    border-left-color: var(--mud-palette-error);
}
@keyframes taskBlockSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.agent-task-header {
    padding: 8px 12px;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.agent-task-tool-label {
    font-weight: 400;
    opacity: 0.6;
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 250px;
}
.agent-task-section {
    margin: 0 4px 4px;
}
.agent-task-section .mud-expand-panel {
    background: transparent !important;
    box-shadow: none !important;
}
.agent-task-section .mud-expand-panel-header {
    padding: 4px 8px !important;
    min-height: unset !important;
}
.agent-task-section .mud-expand-panel-content {
    padding: 0 8px 8px !important;
    max-height: 400px;
    overflow-y: auto;
}
.agent-task-thinking-content {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-style: italic;
    font-size: 0.85rem;
    opacity: 0.7;
    white-space: pre-wrap;
    word-break: break-word;
}
.agent-task-output-content {
    font-size: 0.9rem;
    word-break: break-word;
}

/* ─── Wave Labels ─── */
.agent-wave-label {
    padding: 6px 16px 2px;
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0.6;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ─── Verification Card ─── */
.agent-verify-card {
    border-radius: 8px;
    margin: 8px 16px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.02);
}
.agent-verify-pass { border-left: 3px solid var(--mud-palette-success); }
.agent-verify-corrections { border-left: 3px solid var(--mud-palette-warning); }
.agent-verify-failed { border-left: 3px solid var(--mud-palette-error); }
.agent-verify-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 8px;
}
.agent-verify-summary {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-bottom: 8px;
}
.agent-verify-checks, .agent-verify-issues {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.agent-verify-check-item, .agent-verify-issue-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

/* ─── SVG Countdown Ring ─── */
.agent-approve-ring {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.approve-ring-svg {
    transform: rotate(-90deg);
    flex-shrink: 0;
}
.approve-ring-svg .ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 2;
}
.approve-ring-svg .ring-progress {
    fill: none;
    stroke: rgba(255, 255, 255, 0.8);
    stroke-width: 2;
    transition: stroke-dashoffset 1s linear;
}
.approve-ring-text {
    font-size: 0.8rem;
    white-space: nowrap;
}

/* ─── Dark Mode: Agent Components ─── */
.dark-mode .agent-task-block,
.mud-theme-dark .agent-task-block {
    background: rgba(255, 255, 255, 0.02);
}
.dark-mode .agent-verify-card,
.mud-theme-dark .agent-verify-card {
    background: rgba(255, 255, 255, 0.02);
}

/* ─── Scrollbar: prevent overlap with fixed AppBar ─── */
.mud-main-content {
    overflow-y: auto;
    scroll-padding-top: 48px;
}

/* Tooltip — instant show/hide (override MudBlazor's inline transition-duration) */
.mud-popover.mud-tooltip-root {
    transition-duration: 0ms !important;
}

/* Fix MudMenu popover flash at top-left before repositioning */
.mud-popover.mud-popover-open:not(.mud-tooltip-root) {
    animation: popover-fade-in 0.05s ease-out;
}
@keyframes popover-fade-in {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Project nav links — highlight background only, preserve text/icon color */
.mud-nav-link.project-navlink-active {
    background-color: var(--mud-palette-action-default-hover) !important;
}
.mud-nav-link.project-navlink-active,
.mud-nav-link.project-navlink-active .mud-nav-link-text,
.mud-nav-link.project-navlink-active .mud-icon-root,
.mud-nav-link.project-navlink-active .mud-svg-icon {
    color: inherit !important;
    fill: currentColor !important;
}

/* Project drag-reorder visual feedback */
.project-drag-handle {
    display: flex;
    align-items: center;
    padding: 2px 0;
    flex-shrink: 0;
}

.project-drag-handle:hover .mud-icon-root {
    opacity: 0.8 !important;
}

.project-drag-over {
    background-color: rgba(1, 129, 138, 0.08);
    border-top: 2px solid rgba(1, 129, 138, 0.5);
}

.mud-theme-dark .project-drag-over {
    background-color: rgba(52, 161, 168, 0.12);
    border-top-color: rgba(52, 161, 168, 0.5);
}

/* Constrain images in markdown to prevent resize flash (4f) */
.markdown-body img {
    max-width: 400px;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
}

/* Blazor reconnect modal — dark mode support */
.mud-theme-dark #components-reconnect-modal,
.mud-theme-dark blazor-reconnect-modal {
    background: rgba(18, 18, 18, 0.95) !important;
    color: #e9e9e9 !important;
}

.mud-theme-dark #components-reconnect-modal *,
.mud-theme-dark blazor-reconnect-modal * {
    color: #e9e9e9 !important;
}

.mud-theme-dark #components-reconnect-modal a,
.mud-theme-dark blazor-reconnect-modal a {
    color: #34A1A8 !important;
}

.mud-theme-dark #components-reconnect-modal button,
.mud-theme-dark blazor-reconnect-modal button {
    background: #34A1A8 !important;
    color: #fff !important;
    border: none !important;
}

/* Also cover the overlay/backdrop */
.mud-theme-dark #components-reconnect-modal::before,
.mud-theme-dark blazor-reconnect-modal::before {
    background: rgba(0, 0, 0, 0.7) !important;
}

/* Dark mode body background to prevent flash */
.mud-theme-dark body,
html.mud-theme-dark {
    background-color: #121212;
}

/* Space panel resize handle */
.space-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    cursor: col-resize;
    z-index: 1400;
    background: transparent;
}

.space-resize-handle:hover,
.space-resize-handle:active {
    background: rgba(52, 161, 168, 0.4);
}

/* ============================
   Mobile responsive
   ============================ */

/* Dynamic viewport height for iOS keyboard handling */
.mud-layout {
    -webkit-tap-highlight-color: transparent;
    height: 100vh;
    height: 100dvh;
}

/* Active press feedback on interactive elements */
.mud-button-root:active,
.mud-icon-button:active,
.mud-nav-link:active {
    transform: scale(0.92);
    transition: transform 0.1s ease;
}

/* Mobile sidebar — 90% width overlay */
@media (max-width: 959.98px) {
    .mud-drawer {
        width: 90vw !important;
        min-width: 90vw !important;
        max-width: 90vw !important;
    }
    .sidebar-resize-handle {
        display: none !important;
    }
    .mud-main-content {
        margin-left: 0 !important;
    }
}

/* Force drawer fully off-screen when closed (overrides MudBlazor fixed-px translate) */
aside.mud-drawer--closed.mud-drawer-pos-left {
    transform: translateX(-100%) !important;
    visibility: hidden;
}

/* Ensure chat textarea stays 1 line when empty */
.chat-input-area textarea.mud-input-slot {
    min-height: unset;
    height: auto;
    box-sizing: border-box;
}
