:root {
    /* New React Design System Colors */
    --font-size: 16px;
    --background: #ffffff;
    --foreground: #464646;
    --card: #ffffff;
    --card-foreground: #464646;
    --popover: #ffffff;
    --popover-foreground: #464646;
    --primary: #464646;
    --primary-foreground: #ffffff;
    --secondary: #F1F1F1;
    --secondary-foreground: #464646;
    --muted: #F1F1F1;
    --muted-foreground: #464646;
    --accent: #fff38D;
    --accent-foreground: #464646;
    --destructive: #d4183d;
    --destructive-foreground: #ffffff;
    --border: rgba(70, 70, 70, 0.1);
    --input: transparent;
    --input-background: #F1F1F1;
    --switch-background: #F1F1F1;
    --font-weight-medium: 500;
    --font-weight-normal: 400;
    --ring: oklch(0.708 0 0);
    --radius: 0.625rem;
    
    /* Backward compatibility aliases */
    --ledewire-yellow: var(--accent);
    --yellow-hover: var(--accent);
    --yellow-light: rgba(255, 243, 141, 0.1);
    --bg-card: var(--card);
    --bg-secondary: var(--secondary);
    --bg-primary: var(--background);
    --border-light: var(--border);
    --border-color: var(--border);
    --text-primary: var(--foreground);
    --text-secondary: var(--muted-foreground);
    --text-muted: var(--muted-foreground);
    --charcoal: var(--primary);
    --medium-grey: var(--muted-foreground);
    --silver: var(--muted-foreground);
    --accent-color: var(--accent);
    --surface-primary: var(--card);
    --surface-secondary: var(--secondary);
    
    /* Additional missing tokens */
    --radius-lg: calc(var(--radius) + 2px);
    --radius-xl: calc(var(--radius) + 4px);
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --pure-white: #ffffff;
    --light-grey: #9ca3af;
    --error-color: var(--destructive);
    --warning-color: var(--accent);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-yellow: 0 4px 12px 0 rgb(255 243 141 / 0.25);
    
    /* Additional design system values from Figma */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --line-clamp-2: -webkit-line-clamp: 2;
    --line-clamp-3: -webkit-line-clamp: 3;
}

/* Figma Research Results Design */
.research-results.figma-design {
    background: var(--background);
    border-radius: var(--radius);
    margin: 1rem 0;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.research-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.research-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 6xl;
    margin: 0 auto;
}

.header-info {
    flex: 1;
}

.header-title {
    font-size: var(--text-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--foreground);
    margin: 0 0 0.25rem 0;
}

.header-subtitle {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    margin: 0;
}

.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    color: var(--foreground);
}

.results-area {
    padding: 1rem;
}

.results-meta {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(var(--muted), 0.3);
}

.results-count {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 6xl;
    margin: 0 auto;
}

.results-count span {
    font-size: var(--text-sm);
    color: var(--foreground);
}

/* Source Cards Grid - Matching Figma Design */
.source-cards-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    max-width: 6xl;
    margin: 0 auto;
    padding: 1rem 0;
}

@media (max-width: 768px) {
    .source-cards-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

/* REMOVED FIGMA SOURCE CARD - Using main SourceCard component instead */
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Buttons matching Figma design */
.btn-secondary, .btn-download, .btn-unlock {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    border: 1px solid;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary {
    background: var(--background);
    color: var(--foreground);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--secondary);
}

.btn-download {
    background: #16a34a;
    color: white;
    border-color: #16a34a;
}

.btn-download:hover {
    background: #15803d;
}

.btn-unlock {
    background: var(--accent);
    color: var(--accent-foreground);
    border-color: var(--accent);
}

.btn-unlock:hover {
    background: color-mix(in srgb, var(--accent) 90%, transparent);
}

.btn-icon {
    font-size: var(--text-xs);
}

.selection-cost {
    font-weight: var(--font-weight-semibold);
    color: var(--accent);
}

/* Selected Sources List Styles */
.selected-sources-list {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* Report Builder Selected Sources */
.selected-sources-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.selected-sources-section h4 {
    margin: 0 0 1rem 0;
    color: var(--foreground);
    font-size: var(--text-lg);
    font-weight: var(--font-weight-semibold);
}

.selected-source-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    margin-bottom: 0.75rem;
}

.selected-source-item .source-title a {
    color: var(--foreground);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    font-size: var(--text-base);
}

.selected-source-item .source-title a:hover {
    color: var(--accent-foreground);
    text-decoration: underline;
}

.selected-source-item .source-meta {
    color: var(--muted-foreground);
    font-size: var(--text-sm);
}

.selected-source-item .source-excerpt {
    color: var(--muted-foreground);
    font-size: var(--text-sm);
    line-height: 1.4;
}

.source-remove-btn {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.25rem 0.5rem;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.source-remove-btn:hover {
    background: var(--destructive);
    color: var(--destructive-foreground);
    border-color: var(--destructive);
}

.sources-cost-summary {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    text-align: right;
    font-weight: var(--font-weight-semibold);
    color: var(--foreground);
}

.no-sources-message {
    text-align: center;
    color: var(--muted-foreground);
    font-style: italic;
}

.sources-summary h3 {
    margin: 0 0 0.5rem 0;
    color: var(--foreground);
    font-size: var(--text-lg);
    font-weight: var(--font-weight-semibold);
}

.sources-count {
    margin: 0 0 1rem 0;
    color: var(--muted-foreground);
    font-size: var(--text-sm);
}

.sources-compact-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.compact-source-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--secondary);
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid var(--border);
}

.source-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.source-publisher {
    font-size: var(--text-xs);
    color: var(--muted-foreground);
    font-weight: var(--font-weight-medium);
}

.source-title {
    font-size: var(--text-sm);
    color: var(--foreground);
    font-weight: var(--font-weight-medium);
}

.source-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.remove-source-btn {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--muted-foreground);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: bold;
    transition: all 0.2s ease;
}

.remove-source-btn:hover {
    background: var(--destructive);
    color: var(--destructive-foreground);
    border-color: var(--destructive);
}

/* Build Report Button */
.build-report-section {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.build-report-btn {
    background: var(--accent);
    color: var(--accent-foreground);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 0.75rem 2rem;
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 200px;
}

.build-report-btn:hover:not(:disabled) {
    background: color-mix(in srgb, var(--accent) 90%, transparent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.build-report-btn:disabled {
    background: var(--muted);
    color: var(--muted-foreground);
    border-color: var(--muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}











.btn-basic {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.btn-basic:hover {
    background: color-mix(in srgb, var(--primary) 90%, transparent);
}

.btn-research {
    background: #fff38D !important;
    color: black !important;
    border-color: #fff38D !important;
    font-weight: var(--font-weight-semibold);
}

.btn-research:hover {
    background: #f5e65c !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px 0 rgb(255 243 141 / 0.25);
}

.btn-pro {
    background: #fff38D !important;
    color: black !important;
    border-color: #fff38D !important;
}

.btn-pro:hover {
    background: #f5e65c !important;
    transform: translateY(-1px);
}



/* Authentication Button */
.auth-btn {
    background: #fff38D !important;
    color: black !important;
    border: 1px solid #fff38D !important;
    border-radius: calc(var(--radius) - 2px);
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-btn:hover {
    background: #f5e65c !important;
    transform: translateY(-1px);
}

.dark {
    --background: #464646;
    --foreground: #ffffff;
    --card: #464646;
    --card-foreground: #ffffff;
    --popover: #464646;
    --popover-foreground: #ffffff;
    --primary: #ffffff;
    --primary-foreground: #464646;
    --secondary: rgba(255, 255, 255, 0.1);
    --secondary-foreground: #ffffff;
    --muted: rgba(255, 255, 255, 0.1);
    --muted-foreground: rgba(255, 255, 255, 0.7);
    --accent: #fff38D;
    --accent-foreground: #464646;
    --destructive: #d4183d;
    --destructive-foreground: #ffffff;
    --border: rgba(255, 255, 255, 0.1);
    --input: rgba(255, 255, 255, 0.1);
    --ring: rgba(255, 255, 255, 0.3);
}

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

body {
    font-family: 'Montserrat', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    background-color: var(--secondary);
    color: var(--foreground);
    min-height: 100vh;
    font-weight: var(--font-weight-normal);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: var(--font-size);
    margin: 0;
    padding: 0;
}

.bg-background {
    background-color: var(--background);
}

.text-foreground {
    color: var(--foreground);
}

.dark .bg-background {
    background-color: var(--background);
}

.dark .text-foreground {
    color: var(--foreground);
}

/* Chat Interface */
.chat-interface {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: var(--background);
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.chat-title h2 {
    font-size: 1.125rem;
    font-weight: var(--font-weight-medium);
    color: var(--card-foreground);
    margin: 0;
}

.chat-title p {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin: 0;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--foreground);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.15s ease;
}

.new-chat-btn:hover {
    background: var(--muted);
}

.refresh-icon {
    font-size: 1rem;
}

/* Messages Area */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--background);
    scroll-behavior: smooth;
    
    /* Custom scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: var(--muted-foreground) var(--background);
}

.messages-area::-webkit-scrollbar {
    width: 6px;
}

.messages-area::-webkit-scrollbar-track {
    background: var(--secondary);
}

.messages-area::-webkit-scrollbar-thumb {
    background: var(--muted-foreground);
    border-radius: 3px;
}

.messages-area::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Restoring Overlay - Flicker-free project loading */
#messagesContainer.restoring {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 2rem;
}

.welcome-content {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
    padding: 4rem 2rem;
}

.welcome-icon {
    width: 64px;
    height: 64px;
    background: var(--accent);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
    box-shadow: var(--shadow-sm);
}

.sparkle-icon {
    font-size: 2rem;
    color: var(--accent-foreground);
}

.welcome-content h1 {
    font-size: 2.5rem;
    font-weight: var(--font-weight-medium);
    color: var(--foreground);
    margin-bottom: 1.5rem;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.welcome-content h2 {
    font-size: 1.25rem;
    color: var(--muted-foreground);
    margin-bottom: 1rem;
    font-weight: var(--font-weight-normal);
    line-height: 1.4;
}

.welcome-content p {
    font-size: 1.125rem;
    color: var(--muted-foreground);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.trust-tagline {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.mode-explanation {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.mode-card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.mode-card:hover {
    border-color: var(--ledewire-yellow);
    box-shadow: var(--shadow-yellow);
    transform: translateY(-2px);
}

.mode-card h3 {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
    font-size: 1.1rem;
}

.mode-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Research Results - Linear Inspired */
.research-results {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    margin: 1.5rem 0;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    animation: messageSlideIn 0.4s ease-out;
}

.research-header {
    background: linear-gradient(135deg, var(--charcoal), var(--dark-grey));
    color: var(--pure-white);
    padding: 1.5rem;
    text-align: center;
}

.research-header h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    font-weight: var(--font-weight-semibold);
}

.research-header p {
    color: var(--silver);
    font-size: 0.95rem;
}

.licensing-summary {
    background: var(--yellow-light);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.licensing-summary h4 {
    color: var(--charcoal);
    margin-bottom: 0.75rem;
    font-weight: var(--font-weight-semibold);
}

.purchase-btn {
    background: var(--ledewire-yellow);
    color: var(--charcoal);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    margin-top: 0.75rem;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
    font-size: 0.9rem;
}

.purchase-btn:hover {
    background: var(--yellow-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-yellow);
}

.sources-preview {
    padding: 1.5rem;
}

/* Preview Header for Source Results */
.preview-header {
    padding: 1.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.preview-header h3 {
    font-size: var(--text-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--foreground);
    margin: 0 0 0.5rem 0;
}

.preview-header p {
    font-size: var(--text-sm);
    color: var(--muted-foreground);
    margin: 0;
    opacity: 0.9;
}

/* Dark mode specific adjustments for better contrast */
.dark .preview-header h3 {
    color: #ffffff;
}

.dark .preview-header p {
    color: rgba(255, 255, 255, 0.85);
}

/* Tier selection & packages - Moved to components/tier-selection.css */
/* Input area - Keep here as it's part of main chat layout */
.input-area {
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    padding: 1.25rem 2rem;
}

.dark .input-area {
    background: rgba(70, 70, 70, 0.5);
}

.input-container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.search-input {
    flex: 1;
    border: none;
    background: var(--input-background);
    border-radius: calc(var(--radius) * 2);
    padding: 0.875rem 1rem;
    font-size: 1rem;
    color: var(--foreground);
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    min-height: 48px;
    max-height: 200px;
    overflow-y: auto;
    transition: all 0.15s ease;
    outline: none;
}

.search-input:focus {
    box-shadow: 0 0 0 2px var(--accent);
}

.search-input::placeholder {
    color: var(--muted-foreground);
}

.dark .search-input {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.dark .search-input::placeholder {
    color: rgba(255, 255, 255, 0.75);
}

.send-btn {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border: none;
    background: var(--accent);
    color: var(--accent-foreground);
    border-radius: calc(var(--radius) * 2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.send-btn:hover:not(:disabled) {
    background: var(--accent);
    opacity: 0.9;
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.send-icon {
    font-size: 1rem;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.character-count {
    font-weight: 500;
}

.tip {
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        height: 100vh;
    }
    
    .app-header {
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-controls {
        justify-content: space-between;
    }
    
    .mode-explanation {
        grid-template-columns: 1fr;
    }
    
    .message--user {
        max-width: 75%;
    }
    
    .message--assistant {
        max-width: 85%;
    }
    
    .message--system {
        max-width: 90%;
    }
    
    .messages-container {
        padding: 1rem;
    }
    
    .chat-input-container {
        padding: 1rem;
    }
    
    .input-container {
        gap: 0.5rem;
    }
    
    .send-btn {
        width: 44px;
        height: 44px;
    }
    
    .input-footer {
        flex-direction: column;
        gap: 0.25rem;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .app-header h1 {
        font-size: 1.25rem;
    }
    
    .welcome-content {
        padding: 1.5rem;
    }
    
    .mode-card {
        padding: 1rem;
    }
    
    .message-content {
        padding: 0.75rem 1rem;
    }
}

/* Modals - Moved to components/modals.css */

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --bg-primary: #1e293b;
        --bg-secondary: #334155;
        --border-color: #475569;
        --border-light: #475569;
        --secondary-color: #334155;
        --surface-primary: #334155;
        --surface-secondary: #475569;
    }
    
    body {
        background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    }
}

/* Research Package Display Styles */
.research-package-chat {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin: 10px 0;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.package-header {
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.package-header h3 {
    margin: 0 0 5px 0;
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 600;
}

.package-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.package-section {
    margin-bottom: 25px;
}

.package-section:last-child {
    margin-bottom: 0;
}

.package-section h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.package-section .content {
    color: var(--text-secondary);
    line-height: 1.6;
}

.package-section .content p {
    margin: 0 0 12px 0;
}

.package-section .content p:last-child {
    margin-bottom: 0;
}

.sources-grid-chat {
    display: grid;
    gap: 15px;
    margin-top: 15px;
}

/* REMOVED SOURCE-CARD-CHAT - Using main SourceCard component instead */
    margin-top: 4px;
}

.unlock-btn-chat.licensed:hover {
    background: #059669;
}

/* Unlicensed source styling */
.source-unlock.unlicensed {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.no-license-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.view-source {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.no-license-info small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.view-btn-chat {
    background: #f59e0b;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.view-btn-chat:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.research-package-message {
    max-width: none !important;
    width: 100%;
}

.research-package-message .system-message {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

/* TIER CARD STYLES MOVED TO: backend/static/styles/components/tier-selection.css */

/* Progressive Loading Animations */
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

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

.enrichment-loading {
    font-size: 0.8em;
    color: #6b7280;
    font-style: italic;
    animation: pulse 2s infinite;
}

.enriched-badge {
    transition: all 0.3s ease;
    display: inline-block;
}

/* REMOVED DUPLICATE SOURCE-CARD - Using main SourceCard component instead */

.licensing-badge {
    background: var(--primary);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
}

.unlock-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.unlock-btn:hover {
    background: var(--primary-hover, #1d4ed8);
    transform: translateY(-1px);
}

/* Selected Sources Compact Styling */
.selected-sources-compact {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 0.9em;
    color: #495057;
    text-align: center;
}

.selected-sources-compact.has-warning {
    border-color: #f39c12;
    background: #fdf6e3;
}

.selected-sources-compact .sources-summary {
    margin-bottom: 8px;
}

.selected-sources-compact .budget-warning {
    color: #e67e22;
    font-weight: 600;
    font-size: 0.85em;
    padding: 4px 8px;
    background: #ffeaa7;
    border-radius: 4px;
    display: inline-block;
}

@media (max-width: 768px) {
    .sources-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .source-card {
        padding: 14px;
    }
}

/* Research results, reports, citation badges - Moved to components/research-results.css */
/* Toast notifications - Moved to components/toast.css */

/* ====================================
   ONBOARDING MODAL - First-time user tutorial
   ==================================== */

.onboarding-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.onboarding-modal.show {
    opacity: 1;
    visibility: visible;
}

.onboarding-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.onboarding-content {
    position: relative;
    z-index: 1;
    background: var(--card);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    padding: 2.5rem;
    overflow-y: auto;
    animation: slideUp 0.4s ease-out;
}

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

.onboarding-skip {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--muted-foreground);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.onboarding-skip:hover {
    background: var(--secondary);
    color: var(--foreground);
}

.onboarding-slide {
    text-align: center;
    padding: 1rem 0;
}

.slide-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    line-height: 1;
}

.onboarding-slide h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 1.5rem;
    font-family: 'Montserrat', sans-serif;
}

.onboarding-slide h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 1rem;
}

.slide-body {
    text-align: left;
    color: var(--muted-foreground);
    line-height: 1.6;
}

.slide-body p {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.tab-feature {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: var(--radius);
    background: var(--secondary);
    transition: all 0.2s ease;
}

.tab-feature:hover {
    transform: translateX(4px);
    background: var(--muted);
}

.feature-icon {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
}

.feature-content h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.feature-content p {
    font-size: 0.9375rem;
    color: var(--muted-foreground);
    margin-bottom: 0.25rem;
}

.login-required {
    font-size: 0.8125rem;
    color: var(--accent-foreground);
    background: var(--accent);
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius);
    display: inline-block;
    margin-top: 0.25rem;
}

.workflow-steps {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.workflow-step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.step-number {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--primary);
    color: var(--primary-foreground);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.step-content h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.25rem;
}

.step-content p {
    font-size: 0.9375rem;
    color: var(--muted-foreground);
}

.onboarding-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.onboarding-dots {
    display: flex;
    gap: 0.5rem;
}

.dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--muted);
    transition: all 0.3s ease;
}

.dot.active {
    background: var(--primary);
    width: 1.5rem;
    border-radius: 0.25rem;
}

.onboarding-next {
    padding: 0.625rem 1.5rem;
    background: var(--secondary);
    color: var(--foreground);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Montserrat', sans-serif;
}

.onboarding-next:hover {
    background: var(--muted);
    transform: translateY(-1px);
}

.onboarding-next.primary {
    background: var(--primary);
    color: var(--primary-foreground);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.onboarding-next.primary:hover {
    background: var(--foreground);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Dark mode adjustments */
body.dark-mode .onboarding-content {
    background: var(--card);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

body.dark-mode .tab-feature {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .tab-feature:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .login-required {
    background: rgba(255, 243, 141, 0.2);
    color: var(--accent);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .onboarding-content {
        padding: 2rem 1.5rem;
        width: 95%;
    }
    
    .slide-icon {
        font-size: 3rem;
    }
    
    .onboarding-slide h2 {
        font-size: 1.5rem;
    }
    
    .tab-feature {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .feature-icon {
        font-size: 1.5rem;
    }
}

/* ========================================
   SUMMARY POPOVER COMPONENT
   ======================================== */

/* Backdrop overlay */
.summary-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.summary-backdrop.visible {
    opacity: 1;
}

/* Popover container */
.summary-popover {
    position: fixed;
    z-index: 9999;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg), 0 20px 40px rgba(0, 0, 0, 0.15);
    max-width: 600px;
    width: calc(100vw - 32px);
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.summary-popover.visible {
    opacity: 1;
    transform: translateY(0);
}

.summary-popover.position-below {
    transform: translateY(8px);
}

.summary-popover.position-below.visible {
    transform: translateY(0);
}

/* Header */
.summary-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.25rem 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.summary-title-section {
    flex: 1;
    min-width: 0;
}

.summary-article-title {
    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
    color: var(--foreground);
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
}

.summary-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-price-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: var(--accent);
    color: var(--accent-foreground);
    border-radius: var(--radius);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
}

.summary-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
}

.summary-type-full {
    background: hsl(142, 76%, 36%);
    color: white;
}

.summary-type-excerpt {
    background: hsl(48, 96%, 53%);
    color: hsl(25, 95%, 16%);
}

.summary-close-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: var(--muted-foreground);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.summary-close-btn:hover {
    background: var(--secondary);
    color: var(--foreground);
}

/* Content */
.summary-content {
    padding: 1.25rem;
}

.summary-text {
    font-size: var(--text-sm);
    line-height: 1.6;
    color: var(--foreground);
    margin: 0;
}

/* Footer */
.summary-footer {
    padding: 1rem 1.25rem 1.25rem 1.25rem;
    border-top: 1px solid var(--border);
}

.summary-view-full {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: var(--text-sm);
    font-weight: var(--font-weight-medium);
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.summary-view-full:hover {
    color: var(--foreground);
    text-decoration: underline;
}

/* Dark mode */
body.dark-mode .summary-backdrop {
    background: rgba(0, 0, 0, 0.6);
}

body.dark-mode .summary-popover {
    background: var(--card);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-lg), 0 20px 40px rgba(0, 0, 0, 0.4);
}

body.dark-mode .summary-article-title {
    color: var(--foreground);
}

body.dark-mode .summary-text {
    color: var(--muted-foreground);
}

body.dark-mode .summary-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .summary-popover {
        max-width: calc(100vw - 24px);
    }
    
    .summary-header {
        padding: 1rem 1rem 0.75rem 1rem;
    }
    
    .summary-content {
        padding: 1rem;
    }
    
    .summary-footer {
        padding: 0.75rem 1rem 1rem 1rem;
    }
    
    .summary-article-title {
        font-size: var(--text-sm);
    }
}

/* ========================================
   SUMMARIZE BUTTON
   ======================================== */

.summarize-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--accent);
    color: var(--accent-foreground);
    border: none;
    border-radius: var(--radius);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.summarize-btn:hover:not(:disabled) {
    background: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-yellow);
}

.summarize-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.summarize-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Dark mode */
body.dark-mode .summarize-btn {
    background: var(--accent);
    color: var(--accent-foreground);
}

body.dark-mode .summarize-btn:hover:not(:disabled) {
    box-shadow: var(--shadow-yellow);
}
