/**
 * Deal Deep Dive - Main Stylesheet
 * Organized by component
 */

/* ==================
   Base & Layout
   ================== */

body {
    background: #ffffff;
    overflow: hidden; /* Prevent body scroll */
}

#app {
    height: 100vh;
    overflow: hidden;
}

/* ==================
   Left Navigation
   ================== */

.left-nav {
    background: #171717;
    width: 64px;
    min-width: 64px;
    flex-shrink: 0;
    transition: width 0.2s ease, min-width 0.2s ease;
}

.left-nav.expanded {
    width: 200px;
    min-width: 200px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px;
    color: #a3a3a3;
    border-radius: 8px;
    margin: 4px 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* Ensure icons are always visible */
.nav-item svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.nav-item-text {
    margin-left: 12px;
    white-space: nowrap;
    overflow: hidden;
    opacity: 0;
    width: 0;
    transition: opacity 0.2s, width 0.2s;
}

.left-nav.expanded .nav-item-text {
    opacity: 1;
    width: auto;
}

/* ==================
   Main Content Area
   ================== */

.main-content {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==================
   Page Container
   ================== */

.page-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Pages wrapper - contains all pages but not chat */
#pagesWrapper {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

/* Pages - only one visible at a time */
.page {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
}

.page.active {
    display: block;
    position: relative;
    flex: 1;
}

/* ==================
   Search Bar
   ================== */

.search-container {
    position: relative;
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    max-height: 70vh;
    overflow-y: auto;
    z-index: 50;
    margin-top: 4px;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.1s;
}

.search-result-item:hover,
.search-result-item.selected {
    background: #f0f9ff;
}

.search-result-item.selected {
    background: #dbeafe;
}

.search-result-item:last-child {
    border-bottom: none;
}

/* ==================
   Chat Panel
   ================== */

#chatPanel {
    width: 480px;
    min-width: 380px;
    max-width: 700px;
    flex-shrink: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

#chatPanel.collapsed {
    width: 56px !important;
    min-width: 56px !important;
    max-width: 56px !important;
}

#chatPanel.collapsed .chat-panel-content {
    display: none;
}

#chatPanel.collapsed #toggleChatBtn svg {
    transform: rotate(180deg);
}

.chat-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: ew-resize;
    background: transparent;
    transition: background 0.15s;
    z-index: 10;
}

.chat-resize-handle:hover,
.chat-resize-handle.dragging {
    background: #3b82f6;
}

/* Chat message styles */
.chat-message-user {
    background: #f0f9ff;
    border: 1px solid #e0f2fe;
}

.chat-message-assistant {
    background: #ffffff;
}

/* Shared conversation banner - sticky at top of chat */
.shared-conversation-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 0;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-bottom: 1px solid #f59e0b;
    font-size: 12px;
    color: #92400e;
    flex-shrink: 0;  /* Don't shrink - stay at fixed height */
}

.shared-conversation-banner svg {
    flex-shrink: 0;
    color: #d97706;
}

/* Copy chat link button */
.copy-chat-link-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 11px;
    color: #6b7280;
    background: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.copy-chat-link-btn:hover {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

.copy-chat-link-btn.copied {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

/* ==================
   @ Mention Dropdown
   ================== */

.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 4px;
    z-index: 100;
}

.mention-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid #f0f0f0;
}

.mention-item:last-child {
    border-bottom: none;
}

.mention-item:hover,
.mention-item.selected {
    background: #f0f9ff;
}

/* Deal context tags */
.deal-tag {
    display: inline-flex;
    align-items: center;
    background: #dbeafe;
    color: #1d4ed8;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-right: 4px;
}

.deal-tag .remove {
    margin-left: 4px;
    cursor: pointer;
    opacity: 0.6;
    font-size: 14px;
    line-height: 1;
}

.deal-tag .remove:hover {
    opacity: 1;
}

/* Add deal to context tag */
.deal-tag-add {
    display: inline-flex;
    align-items: center;
    background: #f3f4f6;
    color: #6b7280;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-right: 4px;
    cursor: pointer;
    border: 1px dashed #d1d5db;
    transition: all 0.15s ease;
}

.deal-tag-add:hover {
    background: #e5e7eb;
    color: #374151;
    border-color: #9ca3af;
}

/* ==================
   Unified Search UI
   ================== */

/* Search tabs */
.search-tabs {
    display: flex;
    gap: 2px;
    padding: 8px 12px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.search-tab {
    padding: 4px 10px;
    font-size: 12px;
    color: #6b7280;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.search-tab:hover {
    background: #e5e7eb;
    color: #374151;
}

.search-tab.active {
    background: #1f2937;
    color: white;
}

.search-tab-count {
    font-size: 10px;
    padding: 1px 5px;
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}

.search-tab.active .search-tab-count {
    background: rgba(255,255,255,0.2);
}

/* Search sections */
.search-section {
    padding: 8px 0;
}

.search-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 16px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==================
   Entity Context Tags
   ================== */

.context-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 6px;
    border-radius: 4px;
    font-size: 11px;
    margin-right: 4px;
    margin-bottom: 4px;
    transition: all 0.15s;
}

.context-tag-green {
    background: #dcfce7;
    color: #166534;
}

.context-tag-blue {
    background: #dbeafe;
    color: #1e40af;
}

.context-tag-purple {
    background: #f3e8ff;
    color: #6b21a8;
}

.context-tag-amber {
    background: #fef3c7;
    color: #92400e;
}

.context-tag.current {
    box-shadow: 0 0 0 2px currentColor;
}

.context-tag-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.context-tag-remove {
    margin-left: 2px;
    cursor: pointer;
    opacity: 0.6;
    font-size: 14px;
    line-height: 1;
    background: none;
    border: none;
    padding: 0;
    color: inherit;
}

.context-tag-remove:hover {
    opacity: 1;
}

/* Locked context tags (can't be removed - part of conversation history) */
.context-tag.locked {
    opacity: 0.9;
    padding-right: 8px; /* No remove button, balance padding */
}

/* Add entity to context */
.context-tag-add {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    border: 1px dashed;
    transition: all 0.15s ease;
    margin-bottom: 4px;
}

.context-tag-add-green {
    background: #f0fdf4;
    color: #166534;
    border-color: #86efac;
}

.context-tag-add-green:hover {
    background: #dcfce7;
    border-color: #22c55e;
}

.context-tag-add-blue {
    background: #eff6ff;
    color: #1e40af;
    border-color: #93c5fd;
}

.context-tag-add-blue:hover {
    background: #dbeafe;
    border-color: #3b82f6;
}

.context-tag-add-purple {
    background: #faf5ff;
    color: #6b21a8;
    border-color: #d8b4fe;
}

.context-tag-add-purple:hover {
    background: #f3e8ff;
    border-color: #a855f7;
}

.context-tag-add-amber {
    background: #fffbeb;
    color: #92400e;
    border-color: #fcd34d;
}

.context-tag-add-amber:hover {
    background: #fef3c7;
    border-color: #f59e0b;
}

/* ==================
   Mention Dropdown (Enhanced)
   ================== */

.mention-tabs {
    display: flex;
    gap: 2px;
    padding: 6px 10px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.mention-tab {
    padding: 3px 8px;
    font-size: 11px;
    color: #6b7280;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 3px;
}

.mention-tab:hover {
    background: #e5e7eb;
    color: #374151;
}

.mention-tab.active {
    background: #1f2937;
    color: white;
}

.mention-tab-count {
    font-size: 9px;
    padding: 1px 4px;
    background: rgba(0,0,0,0.1);
    border-radius: 8px;
}

.mention-tab.active .mention-tab-count {
    background: rgba(255,255,255,0.2);
}

.mention-results-list {
    max-height: 240px;
    overflow-y: auto;
}

.mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid #f0f0f0;
}

.mention-item:last-child {
    border-bottom: none;
}

.mention-item:hover,
.mention-item.selected {
    background: #f0f9ff;
}

.mention-item-icon {
    flex-shrink: 0;
}

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

.mention-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mention-item-subtitle {
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mention-item-type {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* ==================
   Prose / Markdown Styles
   ================== */

/* Ensure chat prose matches component font */
.prose {
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.5;
}

.prose-sm {
    font-size: 0.875rem;
}

.prose ul {
    list-style-type: disc;
    padding-left: 1.5em;
    margin: 0.5em 0;
}

.prose ol {
    list-style-type: decimal;
    padding-left: 1.5em;
    margin: 0.5em 0;
}

.prose li {
    margin: 0.25em 0;
}

.prose li > ul,
.prose li > ol {
    margin: 0.25em 0;
}

.prose strong {
    font-weight: 600;
}

.prose p {
    margin: 0.5em 0;
}

.prose h1, .prose h2, .prose h3, .prose h4 {
    font-weight: 600;
    margin-top: 1em;
    margin-bottom: 0.5em;
}

.prose h2 {
    font-size: 0.95rem;
    color: #171717;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #e5e5e5;
}

.prose h2:first-child {
    margin-top: 0;
}

.prose h3 {
    font-size: 0.875rem;
    color: #404040;
    margin-top: 1rem;
    margin-bottom: 0.375rem;
}

.prose code {
    background: #f3f4f6;
    padding: 0.125em 0.25em;
    border-radius: 0.25em;
    font-size: 0.875em;
}

.prose pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 1em;
    border-radius: 0.5em;
    overflow-x: auto;
    margin: 0.5em 0;
}

.prose pre code {
    background: transparent;
    padding: 0;
}

/* Tables in prose/markdown */
.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.prose thead {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.prose th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    min-width: 80px;
}

.prose td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    color: #4b5563;
    vertical-align: top;
    min-width: 100px;
    max-width: 280px;
}

.prose tbody tr:hover {
    background: #f9fafb;
}

.prose tbody tr:last-child td {
    border-bottom: none;
}

/* Table container for horizontal scroll */
.prose-table-wrapper {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 1em 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.prose-table-wrapper table {
    margin: 0;
    width: 100%;
    min-width: 100%;
}

.prose-table-wrapper::-webkit-scrollbar {
    height: 6px;
}

.prose-table-wrapper::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 0 0 8px 8px;
}

.prose-table-wrapper::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.prose-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Ensure prose content doesn't overflow chat panel */
#chatMessages .prose {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Constrain the chat message content area */
#chatMessages .flex-1 {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

/* ==================
   Chat Typing Indicator
   ================== */

.chat-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
}

.chat-typing-indicator span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.chat-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-4px);
    }
}

/* ==================
   Chat History
   ================== */

.chat-history-item {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.chat-history-item:hover {
    background: #e5e7eb;
}

.chat-history-item.active {
    background: #dbeafe;
}

/* ==================
   Search Step Display
   ================== */

.search-step {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 100%);
    border: 1px solid #e0e7ff;
    border-radius: 8px;
    font-size: 12px;
    animation: slideIn 0.2s ease-out;
}

.search-step.searching {
    border-color: #a5b4fc;
}

.search-step.complete {
    background: linear-gradient(135deg, #f0fdf4 0%, #f0f4ff 100%);
    border-color: #bbf7d0;
}

.search-step-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.search-step-icon.searching {
    background: #6366f1;
    animation: pulse 1.5s infinite;
}

.search-step-icon.complete {
    background: #22c55e;
}

.search-step-icon.error {
    background: #ef4444;
}

.search-step.error {
    border-color: #fecaca;
    background: linear-gradient(135deg, #fef2f2 0%, #fff 100%);
}

.search-step-content {
    flex: 1;
    min-width: 0;
}

.search-step.clickable {
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.search-step.clickable:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.search-step-query {
    color: #4f46e5;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-step-result {
    color: #6b7280;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==================
   Thinking Step (Collapsible model reasoning in timeline)
   ================== */

.thinking-step {
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    /* Prevent copying - thinking is internal reasoning */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.thinking-step.complete {
    border-color: #d1d5db;
}

.thinking-step-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.thinking-step-header:hover {
    background: rgba(0, 0, 0, 0.02);
}

.thinking-step-icon {
    font-size: 0.875rem;
    line-height: 1;
}

.thinking-step-label {
    flex: 1;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
}

.thinking-step-toggle {
    color: #9ca3af;
    transition: transform 0.2s;
}

.thinking-step.collapsed .thinking-step-toggle {
    transform: rotate(-90deg);
}

.thinking-step-body {
    padding: 0 12px 12px 12px;
    max-height: 300px;
    overflow-y: auto;
}

.thinking-step.collapsed .thinking-step-body {
    display: none;
}

.thinking-step-content {
    font-size: 0.7rem;
    line-height: 1.5;
    color: #6b7280;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Live thinking animation */
.thinking-step:not(.complete) .thinking-step-label::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    background: #6366f1;
    border-radius: 50%;
    animation: thinking-dot-pulse 1.5s infinite;
}

@keyframes thinking-dot-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* ==================
   Dashboard Cards
   ================== */

.dashboard-card {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 20px;
    transition: box-shadow 0.2s;
}

.dashboard-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.stat-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
}

/* ==================
   Deal Cards
   ================== */

.deal-card {
    transition: background 0.15s ease;
}

.deal-card:hover {
    background: #f0f0f0;
}

.deal-card.selected {
    background: #e8e8e8;
}

/* Deal List View Cards */
.deal-list-card {
    transition: all 0.15s ease;
}

.deal-list-card:hover {
    border-color: #9ca3af;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.stage-group {
    margin-bottom: 1.5rem;
}

.stage-group:last-child {
    margin-bottom: 0;
}

/* Back button for deal detail */
.back-to-list-btn {
    transition: all 0.15s ease;
}

.back-to-list-btn:hover {
    background: #f3f4f6;
}

/* ==================
   Activity Cards
   ================== */

.activity-card {
    transition: all 0.15s ease;
}

.activity-card:hover {
    background: #f9f9f9;
}

/* ==================
   Scrollbar
   ================== */

.scrollbar-thin::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: transparent;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background: #d4d4d4;
    border-radius: 3px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: #a3a3a3;
}

/* ==================
   Animations
   ================== */

@keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fade-in 0.2s ease-out forwards;
}

.animate-fade-out {
    animation: fade-out 0.3s ease-out forwards;
}

@keyframes fade-out {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(10px); }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

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

/* ==================
   Transcript
   ================== */

.transcript-block {
    border-left: 2px solid;
}

.transcript-block.internal {
    border-color: #6366f1;
}

.transcript-block.external {
    border-color: #f97316;
}

/* ==================
   Modal
   ================== */

.modal-backdrop {
    background: rgba(0, 0, 0, 0.4);
}

/* ==================
   Spinner
   ================== */

.spinner {
    border: 2px solid #e5e5e5;
    border-top-color: #737373;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ==================
   Filter Buttons
   ================== */

.filter-btn {
    transition: all 0.15s ease;
}

.filter-btn.active {
    background: #171717;
    color: white;
}

/* ==================
   Contact Cards
   ================== */

.contact-card {
    transition: all 0.15s ease;
}

.contact-card:hover {
    background: #f5f5f5;
}

.contact-card.selected {
    background: #f0f0f0;
    border-color: #737373;
}

/* ==================
   Activity Heatmap
   ================== */

.heatmap-cell {
    transition: transform 0.1s ease, opacity 0.1s ease;
}

.heatmap-cell:hover {
    transform: scale(1.2);
    opacity: 0.9;
}

.heatmap-tooltip {
    position: absolute;
    background: #171717;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 50;
}

/* Deal detail header - stays above scrolling content */
#dealDetail > header {
    z-index: 20;
}

.heatmap-section {
    position: relative;
    z-index: 1;
}

#activityHeatmap {
    position: relative;
}

/* ==================
   Info Cards
   ================== */

.info-card {
    transition: all 0.2s ease;
}

.info-card.expandable:hover {
    background: #f3f4f6;
}

.info-card.expanded {
    background: #f3f4f6;
}

.info-card.expanded .info-card-content {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
    white-space: pre-wrap;
}

.info-card.expanded .info-card-chevron {
    transform: rotate(180deg);
}

.info-card .info-card-chevron {
    transition: transform 0.2s ease;
}

/* ==================
   Search Results Modal (for chat)
   ================== */

.search-results-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.search-results-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    overflow: hidden;
    z-index: 101;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e5e5;
}

.search-results-body {
    padding: 16px;
    max-height: 70vh;
    overflow-y: auto;
}

.search-results-body .search-result-item {
    margin-bottom: 8px;
    padding: 12px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
}

.search-results-body .search-result-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.search-results-body .search-result-title a {
    color: #2563eb;
    text-decoration: none;
}

.search-results-body .search-result-title a:hover {
    text-decoration: underline;
}

.search-results-body .search-result-url {
    font-size: 11px;
    color: #22c55e;
    margin-bottom: 4px;
}

.search-results-body .search-result-content {
    font-size: 13px;
    color: #374151;
    line-height: 1.6;
}

/* Markdown content in search results */
.search-results-body .search-result-content.prose {
    font-size: 14px;
    color: #374151;
}

.search-results-body .search-result-content.prose h1,
.search-results-body .search-result-content.prose h2,
.search-results-body .search-result-content.prose h3,
.search-results-body .search-result-content.prose h4 {
    font-weight: 600;
    color: #111827;
    margin-top: 1em;
    margin-bottom: 0.5em;
}

.search-results-body .search-result-content.prose h1 { font-size: 1.25em; }
.search-results-body .search-result-content.prose h2 { font-size: 1.15em; }
.search-results-body .search-result-content.prose h3 { font-size: 1.05em; }
.search-results-body .search-result-content.prose h4 { font-size: 1em; }

.search-results-body .search-result-content.prose p {
    margin-bottom: 0.75em;
}

.search-results-body .search-result-content.prose ul,
.search-results-body .search-result-content.prose ol {
    margin-left: 1.5em;
    margin-bottom: 0.75em;
}

.search-results-body .search-result-content.prose li {
    margin-bottom: 0.25em;
}

.search-results-body .search-result-content.prose strong {
    font-weight: 600;
    color: #111827;
}

.search-results-body .search-result-content.prose code {
    background: #f3f4f6;
    padding: 0.125em 0.375em;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: ui-monospace, monospace;
}

.search-results-body .search-result-content.prose pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.75em 0;
}

.search-results-body .search-result-content.prose pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

/* AI Answer card - highlighted */
.search-results-body .search-result-answer {
    background: #f0f9ff;
    border-color: #bae6fd;
}

/* Code Execution card */
.search-results-body .search-result-code {
    background: #fefce8;
    border-color: #fef08a;
}

/* URL Content card */
.search-results-body .search-result-url-content {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

/* Source links - inline chips */
.search-results-body .sources-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-top: 8px;
}

.search-results-body .sources-label {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    width: 100%;
    margin-bottom: 4px;
}

.search-result-source-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #059669;
    text-decoration: none;
    transition: all 0.15s ease;
}

.search-result-source-link:hover {
    background: #ecfdf5;
    border-color: #059669;
    color: #047857;
}

/* ==================
   Profile Page
   ================== */

#profileAvatar {
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

#nameDisplayMode {
    padding: 8px 12px;
    margin: -8px -12px;
    border-radius: 8px;
    transition: background 0.15s ease;
}

#nameDisplayMode:hover {
    background: #f9fafb;
}

#nameDisplayMode:hover button {
    opacity: 1 !important;
}

/* Success toast animation */
#profileSuccessToast {
    animation: slideInUp 0.3s ease-out;
}

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

/* ==================
   Line Clamp Utilities
   ================== */

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==================
   Pagination Controls
   ================== */

.pagination-controls {
    padding-top: 16px;
    margin-top: 24px;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pagination-btn:hover:not(.disabled) {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.pagination-btn:active:not(.disabled) {
    background: #e5e7eb;
}

.pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

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

/* ==================
   Pipeline Filter Indicator
   ================== */

.pipeline-filter-indicator {
    margin-left: 12px;
    flex-shrink: 0;
}

.pipeline-filter-indicator button {
    padding: 0 2px;
    font-size: 18px;
    line-height: 1;
}

/* ==================
   Deals Table
   ================== */

#dealsTable {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    width: 100%;
}

#dealsTable thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

#dealsTable thead th {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#dealsTable thead th:first-child {
    border-top-left-radius: 8px;
}

#dealsTable thead th:last-child {
    border-top-right-radius: 8px;
}

#dealsTableFilters td {
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

#dealsTable tbody tr {
    transition: background-color 0.15s ease;
}

#dealsTable tbody tr:hover {
    background-color: #f9fafb;
}

#dealsTable tbody td {
    vertical-align: top;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Column settings dropdown */
#columnSettingsDropdown {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

#columnSettingsList label:hover {
    background: #f3f4f6;
}

/* Quick filter buttons active state */
.quick-filter-btn.active {
    background-color: var(--active-bg);
    border-color: var(--active-border);
}

/* ==================
   Chat Copy Button
   ================== */

.chat-message-actions {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.chat-message-wrapper:hover .chat-message-actions {
    opacity: 1;
}

.copy-message-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.copy-message-btn:hover {
    background: #e5e7eb;
    color: #374151;
    border-color: #d1d5db;
}

.copy-message-btn.copied {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.copy-message-btn svg {
    flex-shrink: 0;
}

.copy-message-text {
    font-weight: 500;
}

/* ==================
   Chat Mode Toggle
   ================== */

.chat-mode-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    min-width: 70px; /* Fixed width to prevent size change between modes */
}

.chat-mode-toggle svg {
    flex-shrink: 0;
}

/* Standard mode - thoughtful blue */
.chat-mode-toggle.chat-mode-standard {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

.chat-mode-toggle.chat-mode-standard:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

/* Fast mode - energetic yellow/orange */
.chat-mode-toggle.chat-mode-fast {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #b45309;
}

.chat-mode-toggle.chat-mode-fast:hover {
    background: #fde68a;
    border-color: #f59e0b;
}

/* Mode indicator in chat thinking/status */
.chat-mode-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.chat-mode-indicator.fast {
    background: #fef3c7;
    color: #b45309;
}

.chat-mode-indicator.standard {
    background: #eff6ff;
    color: #1d4ed8;
}

/* ==================
   Chat Document Upload
   ================== */

/* Upload button in chat input area */
.chat-upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chat-upload-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

/* Pending documents container above chat input */
.pending-documents-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0;
    margin-bottom: 4px;
}

.pending-documents-container.hidden {
    display: none;
}

/* Individual pending document chip */
.pending-document {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    font-size: 11px;
}

.pending-document.uploading {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #6b7280;
}

.pending-document-name {
    color: #92400e;
    font-weight: 500;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pending-document-size {
    color: #b45309;
    font-size: 10px;
}

.pending-document-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    background: none;
    border: none;
    color: #92400e;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.pending-document-remove:hover {
    opacity: 1;
}

/* Document chips below user messages in chat */
.chat-message-documents {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    justify-content: flex-end;
}

.chat-document-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    font-size: 10px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.chat-document-chip:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.chat-document-name {
    color: #991b1b;
    font-weight: 500;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-document-size {
    color: #b91c1c;
    font-size: 9px;
}

/* ==================
   Knowledge Base
   ================== */

/* KB Item in list */
.kb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: white;
    border-bottom: 1px solid #f3f4f6;
}

.kb-item:hover {
    background: #f9fafb;
}

.kb-item.selected {
    background: #eff6ff;
    border-left: 2px solid #3b82f6;
    padding-left: 14px;
}

.kb-item-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0;
}

.kb-item-icon.folder {
    background: #fef3c7;
    color: #d97706;
}

.kb-item-icon.document {
    background: #eff6ff;
    color: #3b82f6;
}

.kb-item-info {
    flex: 1;
    min-width: 0;
}

.kb-item-name {
    font-weight: 500;
    color: #111827;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kb-item-meta {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 1px;
}

.kb-item-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.kb-item:hover .kb-item-actions {
    opacity: 1;
}

.kb-action-btn {
    padding: 4px;
    border-radius: 4px;
    color: #9ca3af;
    transition: all 0.15s ease;
    background: transparent;
    border: none;
    cursor: pointer;
}

.kb-action-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

/* KB Breadcrumbs */
.kb-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    font-size: 12px;
    color: #6b7280;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.kb-breadcrumb:hover {
    background: #f3f4f6;
    color: #374151;
}

.kb-breadcrumb.current {
    color: #374151;
    font-weight: 500;
    cursor: default;
}

.kb-breadcrumb.current:hover {
    background: transparent;
}

.kb-breadcrumb-sep {
    color: #d1d5db;
    font-size: 11px;
}

/* KB Context Menu */
.kb-context-menu {
    position: fixed;
    z-index: 100;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    padding: 4px;
    min-width: 140px;
}

.kb-context-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    color: #374151;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s ease;
    text-align: left;
}

.kb-context-item:hover {
    background: #f3f4f6;
}

.kb-context-item.text-red-600 {
    color: #dc2626;
}

.kb-context-item.text-red-600:hover {
    background: #fef2f2;
}

/* KB Version History */
.kb-version-item {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.kb-version-item:hover {
    background: white;
    border-color: #e5e7eb;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.kb-version-item.current {
    background: white;
    border-color: #dbeafe;
}

/* KB AI Prompt Auto-expand */
.kb-ai-prompt {
    min-height: 44px;
    max-height: 200px; /* roughly 10 lines */
    overflow-y: auto;
}

/* KB Context Menu Divider */
.kb-context-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 0;
}

/* KB Multi-Select Mode */
.kb-item.select-mode {
    cursor: pointer;
}

.kb-item.multi-selected {
    background: #eff6ff;
    border-left: 2px solid #3b82f6;
    padding-left: 14px;
}

.kb-item-checkbox {
    display: flex;
    align-items: center;
    padding-right: 8px;
}

.kb-checkbox {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid #d1d5db;
    cursor: pointer;
    accent-color: #3b82f6;
}

.kb-checkbox:checked {
    background: #3b82f6;
    border-color: #3b82f6;
}

/* KB Selection Toolbar */
.kb-selection-toolbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    gap: 8px;
}

.kb-selection-toolbar.active {
    display: flex;
}

.kb-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kb-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kb-toolbar-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 12px;
    color: #374151;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.kb-toolbar-btn:hover {
    background: #e5e7eb;
}

.kb-toolbar-action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.kb-toolbar-action-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.kb-toolbar-action-btn.danger {
    color: #dc2626;
    border-color: #fecaca;
}

.kb-toolbar-action-btn.danger:hover {
    background: #fef2f2;
    border-color: #f87171;
}

.kb-toolbar-cancel-btn {
    padding: 6px 10px;
    font-size: 12px;
    color: #6b7280;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.kb-toolbar-cancel-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

/* KB Move Modal */
.kb-move-modal {
    max-width: 480px;
    width: 100%;
}

.kb-move-items-preview {
    margin-bottom: 16px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
}

.kb-move-items-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.kb-move-item-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    color: #374151;
}

.kb-move-item-more {
    font-size: 11px;
    color: #6b7280;
    padding: 4px 8px;
}

.kb-folder-picker {
    margin-top: 12px;
}

.kb-folder-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: white;
}

.kb-folder-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid #f3f4f6;
}

.kb-folder-option:last-child {
    border-bottom: none;
}

.kb-folder-option:hover {
    background: #f9fafb;
}

.kb-folder-option.selected {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    padding-left: 9px;
}

.kb-folder-option.current {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f3f4f6;
}

.kb-folder-option.current::after {
    content: '(current)';
    font-size: 11px;
    color: #9ca3af;
    margin-left: auto;
}

/* KB Synced Items */
.kb-item.synced {
    background: linear-gradient(to right, #faf5ff 0%, white 8%);
}

.kb-item.synced:hover {
    background: linear-gradient(to right, #f5f3ff 0%, #f9fafb 8%);
}

.kb-item.synced.selected {
    background: linear-gradient(to right, #ede9fe 0%, #eff6ff 8%);
    border-left-color: #8b5cf6;
}

.kb-item-icon.folder.synced {
    background: #f3e8ff;
    color: #9333ea;
}

.kb-item-icon.document.synced {
    background: #f3e8ff;
    color: #9333ea;
}
