/* FixedOps AI Consultant v4 — Styles
   ======================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

body, html {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #ffffff;
    color: #3f3f46;
    line-height: 1.6;
    height: 100%;
}

/* ============================================================================
   HEADER
   ============================================================================ */
#header {
    background-image: url('/static/images/redline.png');
    background-repeat: repeat-x;
    display: flex;
    position: relative;
    font-style: italic;
    align-items: center;
    height: 71px;
}
#header img { float: left; }
#logoSection {
    background-image: url('/static/images/shadow.png');
    display: flex; align-items: center;
    font-size: 10px; font-weight: 900; letter-spacing: 1.1px;
    line-height: 70px; text-transform: uppercase; color: #000; padding-right: 10px;
}
#welcome {
    margin-left: auto; width: fit-content; align-self: center;
    padding: 0 5px;
    background-image: url('/static/images/shadow.png');
    font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; color: #000;
}
#welcome i { margin-right: 5px; }

/* ============================================================================
   LAYOUT
   ============================================================================ */
.main-row { display: flex; height: calc(100vh - 120px); overflow: hidden; }
.column-side-nav {
    width: 240px; min-width: 180px; max-width: 40vw;
    background-color: #fafafa;
    border-right: 1px solid #e4e4e7; overflow-y: auto; flex-shrink: 0;
}
.sidebar-resize-handle {
    width: 4px; cursor: col-resize; background: transparent;
    flex-shrink: 0; transition: background 0.15s;
}
.sidebar-resize-handle:hover, .sidebar-resize-handle.active { background: #d71921; }
.column-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ============================================================================
   NAVIGATION & SETTINGS
   ============================================================================ */
.side-nav { padding: 15px 0; }
.nav-menu { list-style: none; }
.nav-item { margin: 2px 0; }
.nav-link {
    display: flex; align-items: center; padding: 12px 20px;
    color: #52525b; text-decoration: none; transition: background-color 0.2s, color 0.2s;
}
.nav-link:hover { background-color: #fee2e2; color: #d71921; }
.nav-link i { width: 20px; margin-right: 10px; }
.nav-divider { height: 1px; background-color: #e4e4e7; margin: 10px 15px; }
.nav-section-title {
    padding: 8px 20px 4px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; color: #a1a1aa; letter-spacing: 0.5px;
}
.nav-section-title i { margin-right: 6px; }
.nav-info { padding: 3px 20px; font-size: 12px; color: #71717a; }
.nav-info i { margin-right: 6px; color: #d71921; }
.nav-setting { padding: 4px 20px; }
.setting-label {
    display: flex; flex-direction: column; gap: 4px;
    font-size: 13px; color: #52525b; cursor: pointer;
}
.setting-label input[type="checkbox"] { accent-color: #d71921; margin-right: 6px; }
.setting-slider { width: 100%; accent-color: #d71921; }

/* Domain Toggle */
.domain-toggle {
    display: flex; gap: 4px; padding: 2px;
    background: #f1f1f4; border-radius: 8px;
}
.domain-btn {
    flex: 1; padding: 6px 8px; border: none; border-radius: 6px;
    background: transparent; color: #71717a; cursor: pointer;
    font-size: 12px; font-weight: 500; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 4px;
}
.domain-btn:hover { background: #e4e4e7; color: #3f3f46; }
.domain-btn.domain-active {
    background: #d71921; color: #fff; font-weight: 600;
    box-shadow: 0 1px 3px rgba(215, 25, 33, 0.3);
}

/* ============================================================================
   CHAT HISTORY SIDEBAR
   ============================================================================ */
.chat-history-container { padding: 0 8px; max-height: 260px; overflow-y: auto; }
.chat-history-loading, .chat-history-empty {
    padding: 12px 12px; font-size: 12px; color: #a1a1aa; text-align: center;
}
.conv-group-label {
    font-size: 10px; font-weight: 700; text-transform: uppercase; color: #a1a1aa;
    padding: 8px 8px 2px; letter-spacing: 0.5px;
}
.conv-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px 10px; margin: 1px 0; border-radius: 6px; cursor: pointer;
    font-size: 13px; color: #3f3f46; transition: background-color 0.15s;
    overflow: hidden;
}
.conv-item:hover { background-color: #f4f4f5; }
.conv-item.conv-active { background-color: #fef2f2; border-left: 3px solid #d71921; }
.conv-title {
    flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    pointer-events: none;
}
.conv-actions { display: none; gap: 6px; flex-shrink: 0; margin-left: 6px; }
.conv-item:hover .conv-actions { display: flex; }
.conv-action-icon { font-size: 11px; color: #a1a1aa; padding: 2px; cursor: pointer; transition: color 0.15s; }
.conv-action-icon:hover { color: #52525b; }
.conv-action-delete:hover { color: #dc2626; }

/* Collapsible nav sections */
.nav-collapsible { cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.nav-collapse-icon { font-size: 9px; transition: transform 0.2s; }

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
    display: inline-flex; align-items: center; padding: 10px 20px;
    border: none; border-radius: 6px; font-size: 14px; font-weight: 500;
    cursor: pointer; text-decoration: none; transition: background-color 0.2s;
}
.btn i { margin-right: 8px; }
.btn-primary { background-color: #d71921; color: #fff; }
.btn-primary:hover { background-color: #b81419; }
.btn-primary:disabled { background-color: #a1a1aa; cursor: not-allowed; }


/* ============================================================================
   LOGIN
   ============================================================================ */
.login-container {
    display: flex; justify-content: center; align-items: center;
    height: 100%; padding: 40px;
}
.login-card {
    background: #fff; border: 1px solid #e4e4e7; border-radius: 12px;
    padding: 40px; max-width: 420px; width: 100%; text-align: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.login-icon { font-size: 48px; color: #d71921; margin-bottom: 16px; }
.login-card h2 { color: #18181b; margin-bottom: 8px; }
.login-subtitle { color: #a1a1aa; font-size: 13px; margin-bottom: 24px; }
.login-btn { width: 100%; justify-content: center; margin-top: 8px; }

/* ============================================================================
   CHAT CONTAINER
   ============================================================================ */
.chat-container { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px 40px; scroll-behavior: smooth; }

/* Welcome */
.chat-welcome { text-align: center; padding: 60px 20px; color: #71717a; }
.welcome-icon { font-size: 48px; color: #d71921; margin-bottom: 16px; }
.chat-welcome h2 { color: #18181b; margin-bottom: 10px; }
.welcome-hint { font-size: 13px; color: #a1a1aa; margin-top: 8px; }
.version-badge {
    display: inline-block; padding: 2px 8px; background: #d71921; color: #fff;
    font-size: 11px; border-radius: 4px; vertical-align: super; font-style: normal;
}

/* ============================================================================
   CHAT MESSAGES
   ============================================================================ */
.chat-message {
    margin-bottom: 16px; padding: 16px 20px; border-radius: 8px;
    border: 1px solid #e4e4e7; animation: fadeInUp 0.3s ease-out;
}
.chat-message-user { background-color: #fef2f2; border-left: 3px solid #d71921; position: relative; }
.chat-message-assistant { background-color: #f9fafb; border-left: 3px solid #3b82f6; }
.message-label {
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: 8px; color: #71717a;
}
.message-label i { margin-right: 6px; }
.chat-message-user .message-label { color: #d71921; }
.chat-message-assistant .message-label { color: #3b82f6; }

/* Prompt edit pencil icon */
.chat-message-user .edit-prompt-btn {
    position: absolute; top: 10px; right: 10px;
    background: none; border: none; color: #a1a1aa; cursor: pointer;
    font-size: 14px; padding: 4px 6px; border-radius: 4px;
    opacity: 0; transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.chat-message-user:hover .edit-prompt-btn { opacity: 1; }
.chat-message-user .edit-prompt-btn:hover { color: #d71921; background: #fee2e2; }

/* Word export button on assistant messages */
.chat-message-assistant .export-word-btn {
    position: absolute; top: 10px; right: 10px;
    background: none; border: none; color: #a1a1aa; cursor: pointer;
    font-size: 14px; padding: 4px 6px; border-radius: 4px;
    opacity: 0; transition: opacity 0.15s, color 0.15s, background 0.15s;
    display: flex; align-items: center; gap: 4px;
}
.chat-message-assistant:hover .export-word-btn { opacity: 1; }
.chat-message-assistant .export-word-btn:hover { color: #2563eb; background: #dbeafe; }
.chat-message-assistant .export-word-btn.exporting {
    opacity: 1; color: #6b7280; cursor: wait;
}
.chat-message-assistant .export-word-btn .export-label {
    font-size: 11px; font-weight: 500;
}

/* Edit mode textarea */
.edit-prompt-area {
    width: 100%; min-height: 60px; max-height: 300px; padding: 8px 10px;
    border: 2px solid #d71921; border-radius: 8px; font-size: 14px;
    font-family: inherit; line-height: 1.5; resize: vertical;
    background: #fff; color: #18181b; outline: none;
}
.edit-prompt-actions {
    display: flex; gap: 8px; margin-top: 6px; justify-content: flex-end;
}
.edit-prompt-actions button {
    padding: 5px 14px; border-radius: 6px; font-size: 12px; font-weight: 600;
    cursor: pointer; border: 1px solid #e4e4e7;
}
.edit-prompt-actions .edit-save { background: #d71921; color: #fff; border-color: #d71921; }
.edit-prompt-actions .edit-save:hover { background: #b91c1c; }
.edit-prompt-actions .edit-cancel { background: #fff; color: #52525b; }
.edit-prompt-actions .edit-cancel:hover { background: #f4f4f5; }

/* Response timer badge */
.response-timer {
    display: inline-block; margin-left: 8px;
    font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
    color: #a1a1aa; background: #f4f4f5; border-radius: 10px;
    padding: 1px 8px; letter-spacing: 0; text-transform: none;
    animation: timerPulse 2s infinite;
}
.response-timer-done {
    animation: none; color: #71717a; background: #e4e4e7;
}
@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.message-content { font-size: 14.5px; line-height: 1.75; color: #27272a; }
.message-content p { margin-bottom: 10px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content ul, .message-content ol { margin: 8px 0 8px 20px; }
.message-content li { margin: 6px 0; line-height: 1.65; }
.message-content strong { color: #18181b; font-weight: 600; }
/* Quoted checklist items — give them a subtle left-border treatment */
.message-content blockquote {
    border-left: 3px solid #d71921;
    margin: 10px 0;
    padding: 6px 12px;
    background: #fafafa;
    font-size: 14px;
    color: #3f3f46;
}

/* Inline source citations — small muted badges */
.inline-citation {
    display: inline;
    font-size: 11px;
    font-weight: 500;
    color: #71717a;
    background: #f4f4f5;
    border: 1px solid #e4e4e7;
    border-radius: 4px;
    padding: 1px 6px;
    margin-left: 2px;
    white-space: nowrap;
    vertical-align: baseline;
    letter-spacing: 0.01em;
}
.inline-citation .fa-bookmark {
    font-size: 9px;
    margin-right: 3px;
    color: #a1a1aa;
}

/* "Sources provided via metadata" footer — collapse into muted line */
.sources-footer {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #e4e4e7;
    font-size: 11px;
    color: #a1a1aa;
}
.message-content code {
    background-color: #f4f4f5; padding: 2px 6px; border-radius: 4px;
    font-family: 'Consolas', monospace; font-size: 13px; color: #d71921;
}
.message-content pre {
    background-color: #27272a; color: #fafafa; padding: 12px;
    border-radius: 6px; overflow-x: auto; margin: 10px 0;
}
.message-content pre code { background: none; color: #fafafa; padding: 0; }
.message-content table {
    width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 14px;
}
.message-content th, .message-content td {
    padding: 8px 12px; border: 1px solid #e4e4e7; text-align: left;
}
.message-content th { background-color: #f4f4f5; font-weight: 600; }

/* ============================================================================
   CHAT INPUT
   ============================================================================ */
.chat-input-area {
    padding: 16px 40px 24px; border-top: 1px solid #e4e4e7; background: #fff;
}
.chat-input-wrapper {
    display: flex; align-items: flex-end; gap: 10px;
    background-color: #fff; border: 2px solid #e4e4e7;
    border-radius: 12px; padding: 4px 8px; transition: border-color 0.2s;
}
.chat-input-wrapper:focus-within { border-color: #d71921; }
#chat-input {
    flex: 1; border: none; outline: none; padding: 12px 8px;
    font-size: 15px; background: transparent; color: #18181b;
    resize: none; overflow-y: auto; max-height: 200px;
    line-height: 1.4; font-family: inherit;
}
.chat-send-btn { border-radius: 8px; padding: 10px 16px; }
.chat-stop-btn {
    border-radius: 8px; padding: 10px 16px;
    background-color: #d71921; color: #fff; border: none;
    cursor: pointer; font-size: 14px; transition: background-color 0.2s;
}
.chat-stop-btn:hover { background-color: #b91c1c; }
.stopped-text { color: #a1a1aa; font-style: italic; font-size: 13px; }

/* ============================================================================
   SOURCES
   ============================================================================ */
.sources-wrapper {
    margin-top: 12px; border: 1px solid #e4e4e7; border-radius: 6px;
    overflow: hidden;
}
.sources-header {
    display: flex; align-items: center; padding: 8px 12px; cursor: pointer;
    background: #f9fafb; font-size: 13px; font-weight: 600; color: #71717a;
}
.sources-header:hover { background: #f4f4f5; }
.sources-header i { margin-right: 8px; color: #d71921; }
.sources-list { display: none; padding: 8px 12px; }
.sources-expanded .sources-list { display: block; }
.source-item { margin: 4px 0; }
.source-badge {
    display: inline-block; padding: 4px 10px; font-size: 12px;
    background: #f4f4f5; border-radius: 4px; cursor: pointer;
    color: #3f3f46; transition: background 0.15s;
}
.source-badge:hover { background: #e4e4e7; }
.source-badge i { margin-right: 4px; color: #d71921; }
.source-content { display: none; margin-top: 6px; }
.source-item-expanded .source-content { display: block; }
.page-content-text {
    font-size: 12px; line-height: 1.5; background: #fafafa;
    padding: 10px; border-radius: 4px; white-space: pre-wrap;
    max-height: 300px; overflow-y: auto; border: 1px solid #e4e4e7;
}
.source-error { font-size: 12px; color: #dc2626; font-style: italic; }

/* ============================================================================
   MEMORY MODAL
   ============================================================================ */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    animation: fadeInUp 0.2s ease-out;
}
.modal-content {
    background: #fff; border-radius: 12px; width: 90%; max-width: 520px;
    max-height: 80vh; display: flex; flex-direction: column;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #e4e4e7;
}
.modal-header h3 { font-size: 16px; color: #18181b; margin: 0; }
.modal-header h3 i { margin-right: 8px; color: #8b5cf6; }
.modal-close {
    background: none; border: none; font-size: 22px; color: #71717a;
    cursor: pointer; padding: 0 4px; line-height: 1;
}
.modal-close:hover { color: #18181b; }
.modal-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid #e4e4e7; text-align: right; }
.memory-item {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 10px 0; border-bottom: 1px solid #f4f4f5;
}
.memory-item:last-child { border-bottom: none; }
.memory-text { font-size: 14px; color: #3f3f46; flex: 1; line-height: 1.5; }
.memory-delete-btn {
    background: none; border: none; color: #a1a1aa; cursor: pointer;
    padding: 2px 6px; margin-left: 8px; font-size: 14px; flex-shrink: 0;
}
.memory-delete-btn:hover { color: #dc2626; }
.memory-empty { color: #a1a1aa; font-style: italic; text-align: center; padding: 24px 0; }
.btn-danger-sm {
    background: #fef2f2; color: #dc2626; border: 1px solid #fecaca;
    padding: 6px 14px; border-radius: 6px; font-size: 13px;
    cursor: pointer; transition: all 0.15s;
}
.btn-danger-sm:hover { background: #fee2e2; border-color: #dc2626; }

/* ============================================================================
   STREAMING CURSOR & THINKING DOTS
   ============================================================================ */
.streaming-cursor {
    display: inline-block; width: 2px; height: 1em;
    background-color: #d71921; margin-left: 2px;
    animation: cursorBlink 0.8s infinite;
}
.thinking-dots { font-size: 24px; color: #a1a1aa; letter-spacing: 4px; }
.thinking-dots span { animation: dotPulse 1.4s infinite; }
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Memory notification */
.memory-updated-note {
    text-align: center; padding: 6px 0; margin: 4px 0;
    font-size: 12px; color: #a1a1aa; font-style: italic;
    animation: fadeInUp 0.3s ease-out;
}
.memory-updated-note i { margin-right: 4px; color: #a1a1aa; }

/* Error */
.error-text { color: #dc2626; font-style: italic; }
.error-text i { margin-right: 6px; }
.loading-text { color: #a1a1aa; font-style: italic; text-align: center; }
.loading-text i { margin-right: 4px; }

/* ============================================================================
   FILE UPLOAD
   ============================================================================ */
.file-upload-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 40px; background: #fafafa; border-top: 1px solid #e4e4e7;
}
.file-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; background: #eff6ff; color: #1d4ed8;
    border-radius: 16px; font-size: 12px; font-weight: 500;
}
.file-chip.uploading { background: #f4f4f5; color: #71717a; }
.file-chip.error { background: #fef2f2; color: #dc2626; }
.chip-remove { cursor: pointer; font-weight: 700; margin-left: 4px; }
.chip-remove:hover { color: #dc2626; }

.file-upload-btn {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 8px;
    color: #71717a; cursor: pointer; transition: all 0.2s;
    flex-shrink: 0;
}
.file-upload-btn:hover { background: #f4f4f5; color: #d71921; }

/* ============================================================================
   IMAGE PREVIEW
   ============================================================================ */
.image-preview-bar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 40px; background: #fafafa; border-top: 1px solid #e4e4e7;
}
.image-previews { display: flex; gap: 8px; flex-wrap: wrap; }
.image-preview-item {
    position: relative; display: inline-block;
    border: 2px solid #d4d4d8; border-radius: 8px; overflow: hidden;
}
.image-preview-item img {
    display: block; max-height: 80px; max-width: 120px; object-fit: cover;
}
.image-remove {
    position: absolute; top: 2px; right: 2px;
    background: rgba(0,0,0,0.6); color: #fff; border: none;
    width: 20px; height: 20px; border-radius: 50%; font-size: 14px;
    line-height: 20px; text-align: center; cursor: pointer;
}
.image-remove:hover { background: #dc2626; }

/* User message image thumbnails */
.user-images { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.user-image-thumb {
    max-height: 120px; max-width: 200px; border-radius: 6px;
    border: 1px solid #e4e4e7; object-fit: cover; cursor: pointer;
}
.user-image-thumb:hover { border-color: #d71921; }

/* Attached files in user bubble */
.attached-files { font-size: 13px; color: #71717a; font-style: italic; }

/* Drag-over highlight */
.chat-input-area.drag-over {
    background-color: #eff6ff; border-top: 2px dashed #3b82f6;
}

/* ============================================================================
   INLINE CHARTS
   ============================================================================ */
.chart-container {
    position: relative; width: 100%; max-width: 600px;
    margin: 16px 0; padding: 16px; background: #fafafa;
    border: 1px solid #e4e4e7; border-radius: 10px;
    cursor: pointer; transition: box-shadow 0.2s;
}
.chart-container:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    border-color: #d71921;
}
.chart-container canvas {
    max-height: 400px;
}

/* ============================================================================
   MERMAID DIAGRAMS
   ============================================================================ */
.mermaid-container {
    margin: 16px 0; padding: 16px; background: #fafafa;
    border: 1px solid #e4e4e7; border-radius: 10px;
    overflow-x: auto; text-align: center;
}
.mermaid-container pre.mermaid {
    background: transparent; border: none; margin: 0; padding: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
}
.mermaid-container svg { max-width: 100%; height: auto; }

/* ============================================================================
   HTML VISUAL (sandboxed iframe dashboards from Visual Agent)
   ============================================================================ */
.html-visual-container {
    position: relative; width: 100%; margin: 16px 0;
    border: 1px solid #e4e4e7; border-radius: 10px; overflow: hidden;
    background: #0f1117; transition: all 0.3s ease;
}
.html-visual-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 12px; background: #1a1b26; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.html-visual-label {
    font-size: 11px; font-weight: 600; color: #8b7cf8;
    display: flex; align-items: center; gap: 6px;
}
.html-visual-actions { display: flex; gap: 4px; }
.html-visual-btn {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
    color: #94a3b8; font-size: 11px; padding: 3px 8px; border-radius: 4px; cursor: pointer;
}
.html-visual-btn:hover { background: rgba(139,124,248,0.15); color: #8b7cf8; border-color: #8b7cf8; }
.html-visual-iframe {
    width: 100%; min-height: 300px; height: 600px; border: none; background: #0f1117;
}
.html-visual-resize-handle {
    height: 6px; cursor: ns-resize; background: linear-gradient(to bottom, transparent, rgba(139,124,248,0.15));
    display: flex; align-items: center; justify-content: center; transition: background 0.2s;
}
.html-visual-resize-handle:hover { background: linear-gradient(to bottom, transparent, rgba(139,124,248,0.35)); }
.html-visual-resize-handle::after {
    content: ''; width: 32px; height: 3px; border-radius: 2px;
    background: rgba(255,255,255,0.15);
}
.html-visual-container.html-visual-expanded {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999; margin: 0; border-radius: 0; border: none;
}
.html-visual-container.html-visual-expanded .html-visual-iframe {
    height: calc(100vh - 36px);
}
.html-visual-container.html-visual-expanded .html-visual-resize-handle { display: none; }

/* ============================================================================
   REASONING INDICATOR (ephemeral single-line, like ChatGPT "Thinking...")
   ============================================================================ */
.reasoning-indicator {
    margin-bottom: 8px; padding: 0;
    font-size: 12.5px; color: #a1a1aa; font-style: italic;
    display: flex; align-items: center; gap: 5px;
    transition: opacity 0.4s ease-out;
    min-height: 20px;
}
.reasoning-indicator.fade-out {
    opacity: 0;
}
.reasoning-indicator .step-icon { font-size: 12px; opacity: 0.6; }

/* ============================================================================
   LIGHTBOX MODAL
   ============================================================================ */
.lightbox-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75); z-index: 9999;
    justify-content: center; align-items: center;
}
.lightbox-overlay.active { display: flex; }
.lightbox-content {
    position: relative; width: 88vw; height: 85vh;
    background: #fff; border-radius: 12px; padding: 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    overflow: auto; display: flex; flex-direction: column;
}
.lightbox-close {
    position: absolute; top: 10px; right: 16px;
    background: none; border: none; font-size: 32px; color: #71717a;
    cursor: pointer; line-height: 1; z-index: 1;
}
.lightbox-close:hover { color: #dc2626; }
.lightbox-body {
    display: flex; justify-content: center; align-items: center;
    flex: 1; width: 100%; height: 100%;
}
.lightbox-body img { border-radius: 8px; max-height: 80vh; max-width: 85vw; object-fit: contain; }
.lightbox-body canvas { width: 100% !important; height: 100% !important; }

/* ============================================================================
   FOOTER
   ============================================================================ */
footer {
    text-align: center; padding: 8px 20px; background: #fafafa;
    border-top: 1px solid #e4e4e7; font-size: 12px; color: #71717a;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0; }
}
@keyframes dotPulse {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 1; }
}

/* ============================================================================
   DOMAIN BADGE IN SIDEBAR
   ============================================================================ */
.conv-domain-badge {
    flex-shrink: 0; font-size: 10px; margin-right: 6px; opacity: 0.7;
}

/* ============================================================================
   MESSAGE TIMESTAMP
   ============================================================================ */
.msg-timestamp {
    font-size: 10px; font-weight: 400; color: #a1a1aa; margin-left: 8px;
    letter-spacing: 0; text-transform: none;
}
.msg-domain-badge {
    font-size: 10px; font-weight: 500; margin-left: 8px;
    letter-spacing: 0; text-transform: none; opacity: 0.8;
}

/* ============================================================================
   AGENT TRACE PANEL (right slide-out)
   ============================================================================ */
.trace-panel {
    width: 0; min-width: 0; max-width: 50vw;
    background: #fafafa; border-left: 1px solid #e4e4e7;
    overflow: hidden; flex-shrink: 0;
    transition: width 0.2s ease, min-width 0.2s ease;
    display: flex; flex-direction: column;
}
.trace-panel.open { width: 360px; min-width: 280px; }

.trace-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid #e4e4e7;
    font-weight: 600; font-size: 13px; color: #18181b;
    background: #f4f4f5; flex-shrink: 0;
}
.trace-panel-header button { background: none; border: none; cursor: pointer; font-size: 16px; color: #71717a; }
.trace-panel-header button:hover { color: #d71921; }

.trace-panel-body { flex: 1; overflow-y: auto; padding: 10px 14px; font-size: 12px; }

/* Resize handle */
.trace-resize-handle {
    width: 4px; cursor: col-resize; background: transparent;
    flex-shrink: 0; position: relative;
    transition: background 0.15s;
}
.trace-resize-handle:hover, .trace-resize-handle.active { background: #d71921; }

/* Trace cards */
.trace-card {
    background: #fff; border: 1px solid #e4e4e7; border-radius: 8px;
    padding: 10px 12px; margin-bottom: 8px;
}
.trace-card-title { font-weight: 600; font-size: 12px; color: #18181b; margin-bottom: 6px; }
.trace-stat { display: flex; justify-content: space-between; padding: 2px 0; color: #52525b; font-size: 11px; }
.trace-stat-label { color: #71717a; }
.trace-stat-value { font-weight: 500; font-family: 'SFMono-Regular', Consolas, monospace; }
.trace-stat-value.cost { color: #d71921; }

.trace-tool-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 3px 0; border-bottom: 1px solid #f4f4f5;
}
.trace-tool-name { color: #18181b; font-weight: 500; }
.trace-tool-dur { color: #71717a; font-family: monospace; font-size: 11px; }

.trace-thinking-block {
    background: #fffbeb; border-left: 3px solid #f59e0b;
    padding: 6px 10px; margin: 4px 0; border-radius: 4px;
    font-size: 11px; color: #92400e; line-height: 1.4;
}

.trace-empty { text-align: center; color: #a1a1aa; padding: 40px 20px; font-size: 13px; }

/* Toggle button in header */
.trace-toggle-btn {
    background: none; border: 1px solid #e4e4e7; border-radius: 6px;
    padding: 4px 10px; cursor: pointer; font-size: 16px;
    color: #71717a; transition: all 0.15s; margin-left: 8px;
}
.trace-toggle-btn:hover { border-color: #d71921; color: #d71921; }
.trace-toggle-btn.active { background: #fef2f2; border-color: #d71921; color: #d71921; }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 768px) {
    .column-side-nav { display: none; }
    .trace-panel { display: none; }
    .chat-messages { padding: 15px 16px; }
    .chat-input-area { padding: 12px 16px 16px; }
}