/* ============================================================
   DASHBOARD
   ============================================================ */

/* ── Debug Filter Toggle Button ──────────────────────────── */

.debug-filter-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
    transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s, bottom 0.2s ease, opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
    
    /* Hidden by default - only show when interaction is visible */
    opacity: 0;
    transform: translateX(100px);
    pointer-events: none;
}

.debug-filter-btn.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.debug-filter-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary-light);
    color: var(--text-primary);
    box-shadow: 0 4px 18px rgba(108,92,231,0.18);
}

.debug-filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 18px rgba(108,92,231,0.35);
}

.debug-filter-btn.active:hover {
    background: var(--primary-hover, #5a4fcf);
    border-color: var(--primary-hover, #5a4fcf);
}

/* When debug filter is active, hide debug-level processing steps */
body.debug-filter-active .processing-step[data-step-type="debug"] {
    display: none;
}

/* Hide Python code block inside graph steps when filter is active */
body.debug-filter-active .processing-step[data-step-type="important"] .code-block {
    display: none;
}

/* Lift the button above the progress bar when it is running */
#ws-progress-bar.running ~ .debug-filter-btn,
body:has(#ws-progress-bar.running) .debug-filter-btn {
    bottom: calc(56px + 16px);
}

.dashboard-header { margin-bottom: 36px; }

.dashboard-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 6px;
    letter-spacing: -0.03em;
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 400;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 36px;
    margin-bottom: 32px;
    width: 100%;
    max-width: 100%;
}

.dashboard-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-xs);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
}

.dashboard-dashboard-shell {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dashboard-filter-row {
    display: flex;
    justify-content: flex-start;
}

.dashboard-filter-group {
    margin-bottom: 0;
    min-width: min(320px, 100%);
}

.dashboard-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.08em;
    margin-bottom: 18px;
}

/* legacy — keep for backwards compat */
.dashboard-container-header,
.dashboard-container-title,
.dashboard-container-subtitle { display: none; }

/* ── Contexts Grid ──────────────────────────────────── */

.contexts-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    padding-top: 4px !important;
}

.context-card {
    padding: 20px 18px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.context-card:hover {
    border-left-color: var(--primary);
    border-color: var(--primary-light);
    background: var(--bg-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.context-card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--accent-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
    transition: background var(--transition-normal);
}

.context-card:hover .context-card-icon { background: rgba(37, 99, 235, 0.12); }

.context-card-body {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    max-width: calc(100% - 80px);
}

.context-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    word-break: break-word;
}

.context-card p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.context-card-arrow {
    flex-shrink: 0;
    color: var(--text-light);
    transition: all var(--transition-normal);
}

.context-card:hover .context-card-arrow {
    color: var(--primary);
    transform: translateX(2px);
}

.context-card.is-disabled {
    cursor: not-allowed;
    opacity: 0.72;
    border-left-color: #f59e0b;
    background: #fffbeb;
    transform: none;
    box-shadow: var(--shadow-xs);
}

.context-card.is-disabled:hover {
    border-color: #fcd34d;
    border-left-color: #f59e0b;
    background: #fffbeb;
    transform: none;
    box-shadow: var(--shadow-xs);
}

.context-card.is-disabled .context-card-icon {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.context-card.is-disabled .context-card-arrow {
    color: #d1a34a;
}

.context-card-status {
    flex-shrink: 0;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 10px;
}

/* ── Recent Queries ─────────────────────────────────── */

.recent-queries-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    padding-top: 4px !important;
}

.recent-query-item {
    padding: 14px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-normal);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.recent-query-item:last-child { margin-bottom: 0; }

.recent-query-item:hover {
    background: var(--bg-hover);
    border-color: var(--primary-light);
    border-left-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.recent-query-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.recent-query-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    max-width: calc(100% - 60px);
}

.recent-query-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    max-width: 100%;
    word-break: break-word;
}

.recent-query-context {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 0;
    letter-spacing: 0.02em;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.recent-query-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-light);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.3; }
.empty-state p { margin: 0; font-size: 14px; }

/* ============================================================
   QUERY INTERFACE
   ============================================================ */

/* Back button */
.btn-back {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-normal);
}

.btn-back:hover {
    background: var(--accent-light);
    color: var(--primary);
    transform: translateX(-2px);
}

.btn-back:active { transform: translateX(0); }
.btn-back svg { display: block; }

.section-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* Query textarea */
.query-input-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-xs);
}

#query-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-primary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 14px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#query-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.query-input-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.fluxo-livre-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    width: max-content;
    min-width: 0;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    user-select: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.fluxo-livre-toggle input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--accent-primary);
}

.query-mic-btn,
.followup-mic-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast), transform 0.1s;
}

.query-mic-btn:hover,
.followup-mic-btn:hover {
    border-color: #6C5CE7;
    color: #6C5CE7;
    background: rgba(108, 92, 231, 0.08);
    transform: translateY(-1px);
}

.query-mic-btn.is-recording,
.followup-mic-btn.is-recording {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
}

.query-mic-btn.is-transcribing,
.followup-mic-btn.is-transcribing {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(37, 99, 235, 0.1);
}

.query-mic-btn:disabled,
.followup-mic-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Data summary */
.data-summary-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-xs);
}

.data-summary-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    gap: 12px;
}

.data-summary-toggle:hover .collapse-arrow { color: var(--primary); }

.data-summary-toggle-text { flex: 1; }

.data-summary-section h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.data-summary-section .example-subtitle { margin-bottom: 0; }

.collapse-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform var(--transition-normal), color var(--transition-fast);
}

.data-summary-section.collapsed .collapse-arrow { transform: rotate(-90deg); }
.data-summary-section.collapsed .data-summary-container { display: none; }
.data-summary-section:not(.collapsed) .data-summary-container { margin-top: 16px; }

.data-summary-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.data-table-summary {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.data-table-summary h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 10px;
}

.columns-list { display: flex; flex-direction: column; gap: 4px; }

.column-item {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 5px 10px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Example questions */
.example-questions-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-xs);
}

.example-questions-container h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.example-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.example-questions-list { display: flex; flex-wrap: wrap; gap: 8px; }

.example-question-chip {
    padding: 8px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: inline-block;
}

.example-question-chip:hover {
    background: var(--accent-light);
    border-color: rgba(37, 99, 235, 0.2);
    color: var(--accent-primary);
    transform: translateY(-1px);
}

/* ── Processing Steps ───────────────────────────────── */

.processing-container { display: flex; flex-direction: column; }

.processing-step {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    animation: slideIn 0.3s ease-out;
    box-shadow: var(--shadow-xs);
    margin: 10px 0;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.step-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.step-icon.loading {
    background: rgba(245, 158, 11, 0.08);
    animation: pulse 1.5s ease-in-out infinite;
}

.step-icon.success { background: rgba(22, 163, 74, 0.08); }
.step-icon.error   { background: rgba(239, 68, 68, 0.08); }
.step-icon.warning {
    background: rgba(245, 158, 11, 0.10);
    border: 1px solid rgba(245, 158, 11, 0.18);
}

.step-title { flex: 1; }
.step-title h4 { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.step-title p  { font-size: 13px; color: var(--text-secondary); }
.step-content  { margin-top: 14px; }

/* ── Code blocks ────────────────────────────────────── */

.code-block {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ── Explanation / Markdown ─────────────────────────── */

.explanation-box {
    background: #f0f4ff;
    border: 1px solid rgba(37, 99, 235, 0.10);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
}

.explanation-box p       { margin: 0 0 10px 0; padding: 0; line-height: 1.6; }
.explanation-box p:last-child { margin-bottom: 0; }
.explanation-box strong  { color: var(--accent-primary); }
.explanation-box em      { color: var(--text-secondary); font-style: italic; }

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 { color: black; margin-top: 16px; margin-bottom: 10px; letter-spacing: -0.02em; }
.markdown-content h1 { font-size: 22px; font-weight: 700; }
.markdown-content h2 { font-size: 18px; font-weight: 600; }
.markdown-content h3 { font-size: 16px; font-weight: 600; }
.markdown-content h1:first-child,
.markdown-content h2:first-child,
.markdown-content h3:first-child { margin-top: 0; }

.markdown-content ul,
.markdown-content ol { margin: 8px 0; padding-left: 22px; }
.markdown-content li   { margin: 4px 0; line-height: 1.6; }
.markdown-content p    { margin: 10px 0; line-height: 1.7; }

.markdown-content code {
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    color: black;
}

.markdown-content pre {
    background: var(--bg-primary);
    padding: 14px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 12px 0;
    border: 1px solid var(--border);
}

.markdown-content pre code { background: none; padding: 0; color: black; }

.markdown-content blockquote {
    border-left: 3px solid var(--primary-lighter);
    padding-left: 16px;
    margin: 12px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.markdown-content strong { font-weight: 600; color: black; }
.markdown-content em     { font-style: italic; color: black; }
.markdown-content a      { color: black; text-decoration: none; transition: color var(--transition-fast); }
.markdown-content a:hover { color: black; text-decoration: underline; }

.markdown-content table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.markdown-content table th {
    background: white;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: black;
    border-bottom: 2px solid var(--border);
}
.markdown-content table td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: black; }
.markdown-content table tr:hover { background: var(--accent-light); }
.markdown-content hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.markdown-content img { max-width: 100%; height: auto; border-radius: var(--radius-sm); margin: 12px 0; }

/* ── Data display ───────────────────────────────────── */

.data-display {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 12px;
    margin-bottom: 12px;
}

.data-display pre {
    margin: 0;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
    overflow-x: auto;
}

.graph-container {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 12px;
    min-height: 520px;
}

.table-container { overflow-x: auto; margin-top: 12px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
    background: var(--bg-primary);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border);
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
.data-table tr:hover { background: var(--accent-light); }

/* Loading indicator */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ── Follow-up / Conversation Thread ───────────────────── */

.followup-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 16px;
    animation: slideIn 0.3s ease-out;
}

.followup-separator-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(108, 92, 231, 0.4),
        rgba(0, 200, 255, 0.4),
        rgba(108, 92, 231, 0.4),
        transparent
    );
}

.followup-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    border-radius: 100px;
    background: linear-gradient(135deg,
        rgba(108, 92, 231, 0.15) 0%,
        rgba(0, 200, 255, 0.15) 100%
    );
    border: 1px solid rgba(108, 92, 231, 0.3);
    font-size: 12px;
    font-weight: 600;
    color: #6C5CE7;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

/* -- Follow-up input box -------------------------------- */

.followup-input-box {
    background: var(--bg-secondary);
    border: 1.5px solid rgba(108, 92, 231, 0.35);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin: 16px 0;
    box-shadow:
        0 0 0 4px rgba(108, 92, 231, 0.06),
        var(--shadow-sm);
    opacity: 0;
    transform: translateY(12px);
    transition:
        opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.2s ease;
}

.followup-input-box--visible {
    opacity: 1;
    transform: translateY(0);
}

.followup-input-box:focus-within {
    border-color: rgba(108, 92, 231, 0.7);
    box-shadow:
        0 0 0 4px rgba(108, 92, 231, 0.12),
        var(--shadow-md);
}

.followup-input-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.followup-input-icon {
    font-size: 22px;
    flex-shrink: 0;
    line-height: 1;
}

.followup-input-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.followup-thread-label {
    font-size: 13px;
    font-weight: 600;
    color: #6C5CE7;
    letter-spacing: 0.01em;
}

.followup-thread-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.followup-new-thread-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
}

.followup-new-thread-btn:hover {
    border-color: #6C5CE7;
    color: #6C5CE7;
    background: rgba(108, 92, 231, 0.06);
}

.followup-input-area {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.followup-textarea {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-family: var(--font-family, 'Inter', sans-serif);
    font-size: 14px;
    color: var(--text-primary);
    resize: vertical;
    min-height: 56px;
    max-height: 200px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    line-height: 1.55;
}

.followup-textarea:focus {
    outline: none;
    border-color: #6C5CE7;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12);
}

.followup-textarea::placeholder {
    color: var(--text-muted);
}

.followup-submit-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: #6C5CE7;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    transition: background var(--transition-fast), transform 0.1s;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.35);
}

.followup-submit-btn:hover {
    background: #5a4bc2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.45);
}

.followup-submit-btn:active {
    transform: translateY(0);
}

@media (max-width: 600px) {
    .followup-input-header {
        flex-wrap: wrap;
    }
    .followup-new-thread-btn {
        margin-left: auto;
    }
}

/* -- Follow-up prompt header (shows the question above results) -- */

.followup-prompt-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: linear-gradient(135deg,
        rgba(108, 92, 231, 0.07) 0%,
        rgba(0, 200, 255, 0.07) 100%
    );
    border-left: 3px solid #6C5CE7;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.followup-prompt-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

.followup-prompt-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.5;
    font-style: italic;
}

.followup-prompt-enriched {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 6px;
    font-size: 13px;
    color: #6C5CE7;
    font-weight: 500;
    font-style: normal;
    opacity: 0.9;
}

.pinned-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(560px, 1fr));
    gap: 20px;
}

.pinned-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pinned-card-header {
    padding: 18px 18px 12px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.pinned-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.pinned-card-context {
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
}

.pinned-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 18px 14px;
}

.pinned-card-meta-pill {
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.pinned-card-graph {
    margin: 0 18px;
    border-radius: var(--radius-md);
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid var(--border);
    background: #fff;
    min-height: 320px;
    height: auto;
    max-height: 680px;
    width: calc(100% - 36px);
}

.pinned-card-graph iframe {
    width: 100%;
    min-height: 320px;
    height: 320px;
    border: 0;
    display: block;
    background: #fff;
}

.pinned-card-empty {
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 24px;
    text-align: center;
}

.pinned-card-footer {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
}

.pinned-card-prompt {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.pinned-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pinned-card-actions .btn-secondary,
.pinned-card-actions .btn-primary {
    width: auto;
    min-width: 110px;
    padding: 10px 14px;
    font-size: 13px;
    justify-content: center;
    text-align: center;
}

.btn-secondary.btn-danger-soft {
    color: var(--error);
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-secondary.btn-danger-soft:hover {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.28);
    color: var(--error);
}

.dashboard-empty-state {
    border: 1px dashed rgba(37, 99, 235, 0.18);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    color: var(--text-secondary);
    background: rgba(37, 99, 235, 0.03);
}

.dashboard-modal {
    max-width: min(960px, calc(100vw - 32px));
    width: 100%;
    padding: 22px 22px 18px;
}

.dashboard-modal-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 6px;
}

.dashboard-modal-header .confirm-dialog-title {
    text-align: left;
    margin-bottom: 2px;
}

.dashboard-modal-header .confirm-dialog-message {
    text-align: left;
    margin-bottom: 0;
    line-height: 1.45;
}

.dashboard-modal-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 6px;
}

.dashboard-modal-toolbar:empty {
    display: none;
}

.dashboard-modal-toolbar .form-group {
    margin-bottom: 0;
    min-width: 220px;
}

.dashboard-modal-body {
    max-height: min(72vh, 720px);
    overflow: auto;
    padding-right: 2px;
}

.dashboard-modal-body > *:first-child {
    margin-top: 0 !important;
}

.dashboard-modal-body .code-block,
.dashboard-modal-body .explanation-box {
    margin-bottom: 4px;
}

.dashboard-modal-body .explanation-box {
    padding: 16px 18px;
}

.dashboard-run-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dashboard-run-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    background: var(--bg-white);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.dashboard-run-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.dashboard-run-item-meta {
    color: var(--text-secondary);
    font-size: 12px;
}

.pin-action-wrap {
    margin-bottom: 18px;
    display: flex;
    justify-content: flex-start;
}

.pin-query-btn {
    width: auto;
    min-width: 240px;
    justify-content: center;
    text-align: center;
}

.pin-query-btn.is-pinned {
    background: rgba(22, 163, 74, 0.1);
    color: var(--success);
    border: 1px solid rgba(22, 163, 74, 0.18);
    box-shadow: none;
}
