/* ═══════════════════════════════════════════════════════
   Chat View — Jony Ive-inspired
   Radical simplicity. Every element earns its place.
   ═══════════════════════════════════════════════════════ */

.chat-view {
    display: flex;
    height: 100%;
    overflow: hidden;
    gap: 18px;
    padding: 2px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* ── Conversation Panel (left) ────────────────────────── */
.chat-panel {
    width: var(--chat-panel-width);
    display: flex;
    flex-direction: column;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--glass) 92%, white 8%), var(--glass)),
        radial-gradient(circle at top left, rgba(255,255,255,0.18), transparent 32%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    flex-shrink: 0;
    overflow: hidden;
}

.chat-panel-header {
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(180deg, rgba(255,255,255,0.08), transparent);
}

.chat-panel-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.chat-panel-actions .btn {
    flex: 1;
}

.chat-panel-file {
    padding: 16px 18px 18px;
    border-bottom: 1px solid var(--border-light);
}

.chat-panel-file label {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    display: block;
    margin-bottom: var(--space-1);
}

.chat-panel-file .select {
    width: 100%;
}

.chat-panel-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* ── Batch action bar ─────────────────────────────────── */
.chat-batch-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: fadeIn 150ms ease;
}

.batch-count {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
}

.batch-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.btn-text-danger {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--error);
    background: var(--error-light);
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    height: 30px;
}

.btn-text-danger:hover {
    background: var(--error);
    color: white;
}

.btn-text-muted {
    padding: var(--space-1) var(--space-3);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-tertiary);
    background: none;
    border: none;
    cursor: pointer;
    height: 30px;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.btn-text-muted:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* ── Subtle icon button (toolbar, panel) ──────────────── */
.btn-icon-subtle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.btn-icon-subtle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon-subtle:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-icon-subtle.btn-icon-danger:hover {
    color: var(--error);
    background: var(--error-light);
}

.btn-icon-subtle svg {
    width: 16px;
    height: 16px;
}

/* ── Conversation list items ──────────────────────────── */
.conversation-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 12px 14px;
    border-radius: var(--radius-field);
    cursor: pointer;
    transition: transform var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: var(--font-family);
    margin-bottom: 1px;
    border: 1px solid transparent;
}

.conversation-item:hover {
    background-color: color-mix(in srgb, var(--bg-hover) 86%, white 14%);
    transform: translateY(-1px);
}

.conversation-item.active {
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--accent-light) 78%, white 22%), rgba(255,255,255,0.08));
    border-color: color-mix(in srgb, var(--accent) 16%, transparent);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

.conversation-item.selected {
    background-color: color-mix(in srgb, var(--accent-light) 70%, transparent);
    border-color: color-mix(in srgb, var(--accent) 14%, transparent);
}

.conversation-item .conv-icon {
    width: 15px;
    height: 15px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    opacity: 0.6;
}

.conversation-item.active .conv-icon {
    color: var(--accent-text);
    opacity: 1;
}

/* Checkbox in select mode */
.conv-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    background: transparent;
}

.conv-checkbox svg {
    opacity: 0;
    transition: opacity var(--transition-fast);
    color: white;
}

.conv-checkbox.checked {
    background: var(--accent);
    border-color: var(--accent);
}

.conv-checkbox.checked svg {
    opacity: 1;
}

.conversation-item-content {
    flex: 1;
    min-width: 0;
}

.conversation-item-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: var(--letter-spacing-tight);
}

.conversation-item-date {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 1px;
    letter-spacing: 0.01em;
}

.message-trace-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--accent-light);
    color: var(--accent);
    font-size: 11px;
    font-weight: var(--font-weight-medium);
    margin-left: var(--space-2);
    letter-spacing: 0.02em;
}

.empty-conversations {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-10) var(--space-4);
    text-align: center;
}

.empty-conversations svg {
    color: var(--text-tertiary);
    opacity: 0.25;
    margin-bottom: var(--space-3);
}

.empty-conversations p {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
}

/* ── Chat Area (right) ────────────────────────────────── */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    background:
        radial-gradient(circle at top right, rgba(255,255,255,0.14), transparent 22%),
        linear-gradient(180deg, color-mix(in srgb, var(--glass) 94%, white 6%), var(--bg-surface));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-panel-lg);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
}

/* ── Chat Toolbar ─────────────────────────────────────── */
.chat-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(180deg, rgba(255,255,255,0.08), transparent);
    min-height: 68px;
}

.chat-toolbar-left {
    flex: 1;
    min-width: 0;
}

.chat-toolbar-title {
    font-size: 1.02rem;
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.03em;
}

.chat-toolbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px 28px 18px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
    background:
        radial-gradient(circle at 50% 0%, rgba(255,255,255,0.06), transparent 34%),
        linear-gradient(180deg, transparent, rgba(255,255,255,0.02));
}

/* ── Welcome state ────────────────────────────────────── */
.chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-8);
    max-width: 680px;
    margin: 0 auto;
}

.chat-welcome-orb {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-2xl);
    background: linear-gradient(135deg, var(--accent-light), var(--accent-subtle));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-6);
    position: relative;
}

.chat-welcome-orb .orb-glow {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-light) 0%, transparent 70%);
    opacity: 0.5;
    animation: orbPulse 3s ease-in-out infinite;
}

@keyframes orbPulse {
    0%, 100% { opacity: 0.3; transform: scale(0.95); }
    50% { opacity: 0.6; transform: scale(1.05); }
}

.chat-welcome-orb svg {
    width: 28px;
    height: 28px;
    color: var(--accent-text);
    position: relative;
    z-index: 1;
}

.chat-welcome h3 {
    font-size: clamp(1.6rem, 2.4vw, 2.3rem);
    font-weight: var(--font-weight-extrabold);
    margin-bottom: 10px;
    letter-spacing: -0.05em;
}

.chat-welcome p {
    color: var(--text-tertiary);
    font-size: 0.98rem;
    max-width: 460px;
    line-height: 1.72;
}

/* Phase 4 — Proactive insights on the welcome screen */
.chat-insights {
    width: 100%;
    max-width: 560px;
    margin-top: var(--space-6);
}

.insights-title {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    color: var(--text-tertiary);
    margin-bottom: var(--space-3);
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-2);
}

.insight-card {
    text-align: left;
    padding: 12px 14px;
    border-radius: var(--radius-card);
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent-light) 40%, var(--bg-card)), var(--bg-card));
    border: 1px solid var(--border-light);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    box-shadow: var(--shadow-xs);
}

/* Suggestion chips */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: center;
    margin-top: var(--space-6);
    max-width: 500px;
}

.suggestion-chip {
    padding: var(--space-2) var(--space-4);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-family);
    box-shadow: var(--shadow-xs);
}

.suggestion-chip:hover {
    border-color: var(--accent);
    color: var(--accent-text);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.suggestion-chip:active {
    transform: translateY(0);
}

/* ── Chat Messages ────────────────────────────────────── */
.chat-message {
    display: flex;
    flex-direction: column;
    max-width: min(820px, 82%);
    min-width: 0;
    animation: messageIn 250ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

@keyframes messageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
    align-self: flex-end;
}

.chat-message.assistant {
    align-self: flex-start;
    max-width: min(900px, 88%);
}

.message-meta {
    margin-bottom: 3px;
}

.message-label {
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
}

.chat-message.user .message-meta {
    text-align: right;
}

.message-bubble {
    padding: 14px 16px;
    border-radius: var(--radius-bubble);
    font-size: var(--font-size-base);
    line-height: 1.62;
    letter-spacing: var(--letter-spacing-tight);
    border: 1px solid transparent;
}

.chat-message.user .message-bubble {
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.22), transparent 28%),
        linear-gradient(135deg, var(--user-bubble), var(--accent-hover));
    color: var(--user-bubble-text);
    border-bottom-right-radius: 8px;
    box-shadow: 0 16px 32px color-mix(in srgb, var(--accent) 14%, transparent);
}

.chat-message.assistant .message-bubble {
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--ai-bubble) 88%, white 12%), var(--ai-bubble));
    color: var(--ai-bubble-text);
    border-bottom-left-radius: 8px;
    border-color: var(--border-light);
    box-shadow: var(--shadow-sm);
}

/* ── Typing indicator ─────────────────────────────────── */
.typing-bubble {
    display: flex;
    align-items: center;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-tertiary);
    animation: typingPulse 1.4s infinite both;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.16s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes typingPulse {
    0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
    40% { opacity: 1; transform: scale(1); }
}

.typing-text {
    font-size: var(--font-size-sm);
    color: var(--text-tertiary);
    font-style: italic;
}

/* ── Markdown body inside AI bubbles ──────────────────── */
.message-bubble.markdown-body p {
    margin: 0 0 0.6em 0;
}

.message-bubble.markdown-body p:last-child {
    margin-bottom: 0;
}

.message-bubble.markdown-body h1,
.message-bubble.markdown-body h2,
.message-bubble.markdown-body h3 {
    margin: 0.8em 0 0.4em 0;
    font-weight: var(--font-weight-semibold);
    line-height: 1.3;
    letter-spacing: var(--letter-spacing-tight);
}

.message-bubble.markdown-body h1:first-child,
.message-bubble.markdown-body h2:first-child,
.message-bubble.markdown-body h3:first-child {
    margin-top: 0;
}

.message-bubble.markdown-body h1 { font-size: 1.2em; }
.message-bubble.markdown-body h2 { font-size: 1.1em; }
.message-bubble.markdown-body h3 { font-size: 1.02em; }

.message-bubble.markdown-body ul,
.message-bubble.markdown-body ol {
    margin: 0.4em 0;
    padding-left: 1.4em;
}

.message-bubble.markdown-body li {
    margin-bottom: 0.2em;
    line-height: 1.55;
}

.message-bubble.markdown-body li:last-child { margin-bottom: 0; }

.message-bubble.markdown-body strong {
    font-weight: var(--font-weight-semibold);
}

.message-bubble.markdown-body code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.12em 0.35em;
    border-radius: 4px;
    font-size: 0.88em;
    font-family: var(--font-mono);
}

[data-theme="dark"] .message-bubble.markdown-body code {
    background-color: rgba(255, 255, 255, 0.07);
}

.message-bubble.markdown-body pre {
    background-color: rgba(0, 0, 0, 0.03);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 0.4em 0;
}

[data-theme="dark"] .message-bubble.markdown-body pre {
    background-color: rgba(255, 255, 255, 0.05);
}

.message-bubble.markdown-body pre code {
    background: none;
    padding: 0;
}

.message-bubble.markdown-body br+br {
    display: none;
}

/* ── Phase 4: token transparency + follow-up suggestions ── */
.message-used-columns {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: var(--space-3);
}

.used-columns-label {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
}

.used-column-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: var(--radius-full);
    background: var(--accent-light);
    color: var(--accent-text);
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-mono);
}

.message-followups {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.followup-chip {
    padding: 7px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-family);
    box-shadow: var(--shadow-xs);
    text-align: left;
}

.followup-chip::before {
    content: "↳ ";
    color: var(--text-tertiary);
}

.followup-chip:hover {
    border-color: var(--accent);
    color: var(--accent-text);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ── AI result attachments ────────────────────────────── */
.message-attachments {
    margin-top: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.message-table-container {
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 92%, white 8%), var(--bg-card));
    border: 1px solid var(--border-light);
    border-radius: var(--radius-container);
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
}

.message-table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.message-table-container th,
.message-table-container td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-light);
    text-align: left;
    white-space: nowrap;
}

.message-table-container th {
    background-color: var(--bg-secondary);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 1;
}

.message-chart-container {
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 92%, white 8%), var(--bg-card));
    border: 1px solid var(--border-light);
    border-radius: var(--radius-container);
    padding: 18px;
    overflow: hidden;
    width: 100%;
    min-height: 380px;
    aspect-ratio: 16/9;
    box-shadow: var(--shadow-sm);
}

.message-code-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font-family);
    transition: color var(--transition-fast);
    border-radius: var(--radius-full);
}

.message-code-toggle:hover {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.message-code-toggle svg {
    width: 13px;
    height: 13px;
}

.message-code-block {
    display: none;
    margin-top: var(--space-2);
}

.message-code-block.open {
    display: block;
    animation: fadeIn 150ms ease;
}


/* ── Chat Input ───────────────────────────────────────── */
.chat-input-area {
    padding: 18px 24px 24px;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,0.04));
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: var(--space-2);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--bg-primary) 88%, white 12%), var(--bg-primary));
    border: 1px solid color-mix(in srgb, var(--border-light) 76%, white 24%);
    border-radius: var(--radius-2xl);
    padding: 8px 8px 8px 20px;
    transition: all var(--transition-base);
    max-width: 860px;
    margin: 0 auto;
    box-shadow: var(--shadow-md);
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

/* Generating state — subtle pulse */
.chat-input-wrapper.is-generating {
    border-color: var(--error);
    box-shadow: 0 0 0 3px var(--error-light);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    resize: none;
    height: 24px;
    max-height: 150px;
    line-height: 24px;
    padding: 6px 0;
    box-sizing: content-box;
    letter-spacing: var(--letter-spacing-tight);
}

.chat-input::placeholder {
    color: var(--text-tertiary);
}

.chat-input:focus {
    outline: none;
}

/* Send / Stop button */
.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-base);
    box-shadow: 0 16px 28px color-mix(in srgb, var(--accent) 18%, transparent);
    position: relative;
}

.chat-send-btn .send-icon {
    display: block;
    width: 16px;
    height: 16px;
    color: white;
}

.chat-send-btn .stop-icon {
    display: none;
    width: 14px;
    height: 14px;
    color: white;
}

/* Stop mode */
.chat-send-btn.is-stop {
    background: var(--error);
    box-shadow: 0 2px 8px var(--error-light);
    animation: stopPulse 2s ease-in-out infinite;
}

.chat-send-btn.is-stop .send-icon {
    display: none;
}

.chat-send-btn.is-stop .stop-icon {
    display: block;
}

@keyframes stopPulse {
    0%, 100% { box-shadow: 0 2px 8px var(--error-light); }
    50% { box-shadow: 0 2px 16px var(--error-light); }
}

.chat-send-btn:hover:not(:disabled) {
    transform: translateY(-1px) scale(1.04);
}

.chat-send-btn:active:not(:disabled) {
    transform: scale(0.96);
}

.chat-send-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Loading spinner */
.spinner-sm {
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* ── Unified Output Styles ────────────────────────────── */
.message-table-container,
.message-chart-container {
    overflow-x: auto;
    max-width: 100%;
    background: var(--bg-card);
    border-radius: var(--radius-container);
    padding: var(--space-4);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 1100px) {
    .chat-view {
        gap: 14px;
    }

    .chat-panel {
        width: 300px;
    }

    .chat-messages {
        padding: 22px 20px 16px;
    }
}

@media (max-width: 820px) {
    .chat-view {
        flex-direction: column;
        gap: 12px;
        padding: 0;
    }

    .chat-panel,
    .chat-main {
        width: 100%;
        border-radius: var(--radius-container);
    }

    .chat-panel {
        max-height: 42vh;
    }

    .chat-toolbar {
        min-height: 60px;
        padding: 14px 16px 12px;
    }

    .chat-messages {
        padding: 18px 14px 14px;
    }

    .chat-input-area {
        padding: 14px;
    }

    .chat-message,
    .chat-message.assistant {
        max-width: 100%;
    }
}

.tahlix-data-table {
    width: max-content;
    min-width: 60%;
    border-collapse: collapse;
    margin: var(--space-4) 0;
    font-size: var(--font-size-sm);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-card);
}

.tahlix-data-table thead {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
}

.tahlix-data-table th {
    padding: var(--space-2) var(--space-3);
    text-align: left;
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    font-size: var(--font-size-xs);
}

.tahlix-data-table td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.tahlix-data-table tr:last-child td {
    border-bottom: none;
}

.tahlix-data-table tbody tr {
    transition: background-color var(--transition-fast);
}

.tahlix-data-table tbody tr:hover {
    background-color: var(--bg-hover);
}

/* Report sections */
.report-section {
    margin-bottom: var(--space-6);
}

.report-section h3 {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    letter-spacing: var(--letter-spacing-tight);
}

.report-section p {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-3);
}


/* ── Mobile Responsive ────────────────────────────────── */
@media (max-width: 768px) {
    .chat-view {
        flex-direction: column;
    }

    .chat-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
        max-height: 220px;
    }

    .chat-panel-list {
        display: flex;
        flex-direction: column;
        flex: 1;
        overflow-y: auto;
    }

    .chat-message {
        max-width: 92%;
    }

    .chat-message.assistant {
        max-width: 95%;
    }

    .chat-input-area {
        padding: var(--space-3);
    }

    .chat-toolbar {
        padding: var(--space-2) var(--space-3);
    }
}
