/* ===================================
   northstar.LM - Styles
   A bold, professional aesthetic
   =================================== */

:root {
    /* Color Palette - Deep navy with warm gold accents */
    --bg-primary: #0a0e17;
    --bg-secondary: #131a2b;
    --bg-card: #1a2332;
    --bg-card-hover: #222d42;
    
    --accent-primary: #d4a853;
    --accent-secondary: #e8c777;
    --accent-glow: rgba(212, 168, 83, 0.3);
    
    --text-primary: #f5f5f7;
    --text-secondary: #a8b2c1;
    --text-muted: #6b7a8f;
    
    --success: #4ade80;
    --warning: #fbbf24;
    --error: #f87171;
    --info: #60a5fa;
    
    /* Typography */
    --font-display: 'Bebas Neue', sans-serif;
    --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Animated Gradient Background */
.gradient-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(212, 168, 83, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(96, 165, 250, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(212, 168, 83, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* Header */
header {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    animation: fadeInDown 0.6s ease-out;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.logo-icon {
    font-size: 2.5rem;
    color: var(--accent-primary);
    filter: drop-shadow(0 0 20px var(--accent-glow));
}

.logo-image {
    height: 64px;
    width: auto;
    filter: drop-shadow(0 0 12px rgba(212, 168, 83, 0.4));
    border-radius: 8px;
}

.logo h1 {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 4rem);
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px var(--accent-glow);
}

/* Header Layout */
.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xl);
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.logo-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.logo-text h1 {
    margin: 0;
    line-height: 1;
}

.app-subtitle {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--accent-primary);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 2px;
}

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

.about-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.about-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.25);
}

.about-btn span {
    font-size: 0.9rem;
}

/* About Dropdown */
.about-dropdown-container {
    position: relative;
}

.about-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

.about-dropdown .about-intro {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-md);
}

.about-dropdown .about-models {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: var(--space-md);
}

.about-dropdown .model-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(212, 168, 83, 0.1);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--accent-primary);
}

.about-dropdown .about-privacy {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
    letter-spacing: 0.05em;
}

/* Main Content */
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--space-lg) var(--space-2xl);
}

/* Sections */
section {
    margin-bottom: var(--space-xl);
}

/* Config Section (API Key) */
/* Setup Section (Collapsible) */
.setup-section {
    animation: fadeIn 0.6s ease-out 0.1s both;
    margin-bottom: var(--space-lg);
}

.setup-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(26, 35, 50, 0.95) 100%);
    border: 1px solid rgba(212, 168, 83, 0.2);
    border-radius: var(--radius-lg);
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: all var(--transition-fast);
}

.setup-header::-webkit-details-marker {
    display: none;
}

.setup-header:hover {
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.1), rgba(26, 35, 50, 0.95));
    border-color: rgba(212, 168, 83, 0.4);
}

.setup-icon {
    font-size: 1.3rem;
}

.setup-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
    flex: 1;
}

.setup-toggle {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.setup-section[open] .setup-toggle {
    transform: rotate(0deg);
}

.setup-section:not([open]) .setup-toggle {
    transform: rotate(-90deg);
}

.setup-section[open] .setup-header {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: 1px solid rgba(212, 168, 83, 0.1);
}

.setup-content {
    padding: var(--space-lg);
    background: linear-gradient(180deg, rgba(26, 35, 50, 0.5), transparent);
    border: 1px solid rgba(212, 168, 83, 0.1);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    animation: slideDown 0.2s ease-out;
}

.config-section {
    animation: fadeIn 0.6s ease-out 0.1s both;
}

.api-key-container {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(26, 35, 50, 0.9) 100%);
    border: 1px solid rgba(212, 168, 83, 0.25);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Collapsed API Key State */
.api-key-collapsed {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.1), rgba(74, 222, 128, 0.05));
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: var(--radius-lg);
}

.key-status {
    color: var(--success);
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent-primary);
    font-weight: 600;
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-text:hover {
    background: rgba(212, 168, 83, 0.1);
    text-decoration: underline;
}

.api-key-container label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.label-icon {
    font-size: 1.2rem;
}

.input-group {
    display: flex;
    gap: var(--space-sm);
}

.input-group input {
    flex: 1;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.95rem;
    transition: border-color var(--transition-fast);
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.hint {
    margin-top: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.hint a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.hint a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

/* Screen-reader-only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.icon-btn {
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #c49a3d);
    color: #000000;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.btn-primary:disabled {
    background: linear-gradient(135deg, #6b6b6b, #5a5a5a);
    color: #999999;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-primary:disabled .btn-text {
    color: #999999;
}

.btn-primary .btn-text {
    color: #000000;
}

/* Refined analyze button - more compact and professional */
.btn-analyze {
    padding: 10px 24px;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    padding: var(--space-md) var(--space-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-primary);
}

.icon-btn {
    width: 44px;
    height: 44px;
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.icon-btn:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Input Section */
.input-section {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(26, 35, 50, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: fadeIn 0.6s ease-out 0.2s both;
}

/* Tabs */
.input-tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: var(--space-md);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

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

.tab-btn:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    color: var(--accent-primary);
    background: rgba(212, 168, 83, 0.1);
}

.tab-btn {
    position: relative;
}

.coming-soon-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.tab-icon {
    font-size: 1.3rem;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Upload Zone */
.upload-zone {
    display: block;
    border: 2px dashed rgba(212, 168, 83, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: rgba(212, 168, 83, 0.02);
    /* Mobile touch improvements */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(212, 168, 83, 0.3);
    user-select: none;
    -webkit-user-select: none;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(212, 168, 83, 0.05);
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
    opacity: 0.7;
}

.upload-zone p {
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.file-types {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-md);
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(212, 168, 83, 0.1);
    border: 1px solid rgba(212, 168, 83, 0.3);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-top: var(--space-md);
}

.file-name {
    color: var(--accent-primary);
    font-weight: 600;
}

.remove-file {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: var(--space-xs);
    transition: color var(--transition-fast);
}

.remove-file:hover {
    color: var(--error);
}

/* Image Preview */
.image-preview {
    margin-top: var(--space-md);
    border: 1px solid rgba(212, 168, 83, 0.3);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.image-preview img {
    display: block;
    max-width: 100%;
    max-height: 300px;
    margin: 0 auto;
    object-fit: contain;
}

/* Text Input */
#text-input {
    width: 100%;
    min-height: 200px;
    padding: var(--space-lg);
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color var(--transition-fast);
}

#text-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

#text-input::placeholder {
    color: var(--text-muted);
}

/* URL Input Tab */
.url-input-container {
    text-align: center;
}

.url-input-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-sm) var(--space-md);
    transition: border-color var(--transition-fast);
}

.url-input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.url-icon {
    font-size: 1.2rem;
    opacity: 0.6;
}

#url-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    padding: var(--space-sm);
}

#url-input:focus {
    outline: none;
}

#url-input::placeholder {
    color: var(--text-muted);
}

.btn-fetch {
    background: var(--accent-primary);
    color: #000000;
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

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

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

.btn-fetch .btn-loader {
    display: none;
}

.btn-fetch:disabled .btn-text {
    display: none;
}

.btn-fetch .btn-text {
    color: #000000;
}

.btn-fetch:disabled .btn-loader {
    display: flex;
}

.url-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: var(--space-sm);
}

.url-preview {
    margin-top: var(--space-lg);
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.url-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.url-preview-title {
    font-weight: 600;
    color: var(--accent-primary);
    font-size: 0.9rem;
}

.clear-url-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.clear-url-btn:hover {
    background: rgba(248, 113, 113, 0.1);
    border-color: var(--error);
    color: var(--error);
}

.url-preview-content {
    padding: var(--space-md);
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

/* Analyze Button */
#analyze-btn {
    width: 100%;
    margin-top: var(--space-lg);
    padding: var(--space-lg);
    font-size: 1.1rem;
}

.btn-loader {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Progress Section */
.progress-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    animation: fadeIn 0.3s ease;
}

.progress-bar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: var(--space-md);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Results Section */
.results-section {
    animation: fadeInUp 0.5s ease-out;
    margin-top: var(--space-xl);
}

.results-section h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    letter-spacing: 0.08em;
    color: var(--accent-primary);
    margin-bottom: var(--space-lg);
    text-align: center;
    text-shadow: 0 2px 10px rgba(212, 168, 83, 0.2);
}

/* KPI Dashboard */
.kpi-dashboard {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(26, 35, 50, 0.9) 100%);
    border: 1px solid rgba(212, 168, 83, 0.2);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.kpi-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition-fast);
}

.kpi-item:hover {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(212, 168, 83, 0.3);
    transform: translateY(-2px);
}

.kpi-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.kpi-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.kpi-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.kpi-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sentiment-specific styling */
.kpi-sentiment .kpi-value.positive {
    color: var(--success);
}

.kpi-sentiment .kpi-value.negative {
    color: var(--error);
}

.kpi-sentiment .kpi-value.neutral {
    color: var(--text-secondary);
}

/* Responsive KPI grid */
@media (max-width: 1200px) {
    .kpi-dashboard {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .kpi-dashboard {
        grid-template-columns: repeat(2, 1fr);
        padding: var(--space-md);
        gap: var(--space-sm);
    }
    
    .kpi-item {
        padding: var(--space-sm);
    }
    
    .kpi-icon {
        font-size: 1.2rem;
    }
    
    .kpi-value {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .kpi-dashboard {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .kpi-label {
        font-size: 0.65rem;
    }
    
    .kpi-value {
        font-size: 0.9rem;
    }
}

/* Results Quick Navigation */
.results-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-lg);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(26, 35, 50, 0.95) 100%);
    border: 1px solid rgba(212, 168, 83, 0.2);
    border-radius: var(--radius-xl);
    position: sticky;
    top: var(--space-md);
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.results-nav::-webkit-scrollbar {
    display: none;
}

.nav-pill {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--transition-fast);
    cursor: pointer;
    flex-shrink: 0;
}

.nav-pill:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.nav-pill.active {
    color: var(--bg-primary);
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    font-weight: 600;
}

.nav-pill span:first-child {
    font-size: 1rem;
}

.nav-label {
    display: inline;
}

/* Results Actions - Updated positioning */
.results-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: var(--space-xl);
    padding: var(--space-md);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

@media (min-width: 768px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .result-card:first-child {
        grid-column: 1 / -1;
    }
}

.result-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(26, 35, 50, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.result-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.35);
    border-color: rgba(212, 168, 83, 0.15);
}

.card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: rgba(212, 168, 83, 0.08);
    border-bottom: 1px solid rgba(212, 168, 83, 0.15);
}

.card-icon {
    font-size: 1.3rem;
}

.card-header h3 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
}

.card-content {
    padding: var(--space-lg);
    color: var(--text-secondary);
    line-height: 1.8;
}

.card-content ul {
    list-style: none;
    padding: 0;
}

.card-content li {
    position: relative;
    padding-left: var(--space-lg);
    margin-bottom: var(--space-sm);
}

.card-content li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--accent-primary);
}

/* Sentiment Card */
.sentiment-card .card-content {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
    padding: var(--space-xl);
}

.sentiment-positive {
    color: var(--success);
}

.sentiment-negative {
    color: var(--error);
}

.sentiment-neutral {
    color: var(--text-muted);
}

/* Metrics Card */
.metrics-card .card-content {
    padding: var(--space-md) var(--space-lg);
}

/* Collapsible card header */
.card-header-collapsible {
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.card-header-collapsible::-webkit-details-marker {
    display: none;
}

.card-header-collapsible:hover {
    background: rgba(212, 168, 83, 0.12);
}

.collapse-toggle {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
    padding: var(--space-xs);
}

details[open] .collapse-toggle {
    transform: rotate(180deg);
}

details.result-card {
    overflow: hidden;
}

details.result-card .card-content {
    animation: slideDown 0.2s ease-out;
}

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

details.result-card:not([open]) .card-content {
    display: none;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.metric-item {
    text-align: center;
    padding: var(--space-sm);
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    display: block;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-breakdown {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.metric-breakdown-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-xs);
}

.metric-breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs) 0;
}

.metric-breakdown-item span:last-child {
    color: var(--text-secondary);
}

/* Feature Sections (Audio Briefing & Infographic) */
.feature-section {
    margin-top: var(--space-xl);
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(26, 35, 50, 0.8) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: var(--transition-normal);
}

.feature-section:hover {
    border-color: rgba(212, 168, 83, 0.2);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.2);
}

.feature-section h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
    margin-bottom: var(--space-xs);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.feature-section h3 span:first-child {
    font-size: 1.4rem;
}

.feature-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-lg);
}

.feature-controls {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    flex-wrap: wrap;
}

.voice-selector {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.voice-selector label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.voice-selector select {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
}

.voice-selector select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.prompt-input-group {
    flex: 1;
    min-width: 200px;
}

.prompt-input-group input {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
}

.prompt-input-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.prompt-input-group input::placeholder {
    color: var(--text-muted);
}

/* Audio Player */
.audio-player-container {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: rgba(212, 168, 83, 0.05);
    border: 1px solid rgba(212, 168, 83, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.audio-player-container audio {
    flex: 1;
    min-width: 250px;
    height: 40px;
}

/* Infographic Container */
.infographic-container {
    margin-top: var(--space-lg);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    overflow: visible;
}

.infographic-container img {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    margin-bottom: var(--space-md);
    display: block;
    object-fit: contain;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .feature-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .voice-selector {
        justify-content: space-between;
    }
    
    .audio-player-container {
        flex-direction: column;
    }
    
    .audio-player-container audio {
        width: 100%;
    }
}

.results-actions .btn-primary {
    min-width: 180px;
}

.results-actions .btn-secondary {
    min-width: 150px;
}

/* Error Section */
.error-section {
    animation: shake 0.5s ease;
}

.error-content {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
}

.error-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: var(--space-md);
}

#error-message {
    color: var(--error);
    margin-bottom: var(--space-md);
}

/* Footer */
footer {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid rgba(212, 168, 83, 0.1);
    margin-top: var(--space-2xl);
    background: linear-gradient(180deg, transparent 0%, rgba(10, 14, 23, 0.5) 100%);
}

footer p:first-child {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: var(--space-xs);
}

footer a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

footer a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

.credits {
    margin-top: var(--space-sm);
    font-size: 0.85rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

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

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-lg);
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-container {
    background: var(--bg-card);
    border: 1px solid rgba(212, 168, 83, 0.3);
    border-radius: var(--radius-xl);
    max-width: 480px;
    width: 100%;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(212, 168, 83, 0.1);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from { 
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(248, 113, 113, 0.2);
    border-color: rgba(248, 113, 113, 0.4);
    color: var(--error);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 var(--space-lg) 0;
}

.modal-input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.modal-input-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.modal-input-group input {
    padding: var(--space-md);
    background: var(--bg-input);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.modal-input-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.15);
}

.modal-input-group input::placeholder {
    color: var(--text-muted);
}

.modal-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.modal-footer .btn-primary,
.modal-footer .btn-secondary {
    padding: var(--space-sm) var(--space-lg);
}

/* ===================================
   Help Button & Modal
   =================================== */

.help-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    color: var(--bg-primary);
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 
        0 4px 15px rgba(212, 168, 83, 0.4),
        0 0 0 3px rgba(212, 168, 83, 0.1);
    transition: all var(--transition-fast);
    z-index: 100;
    animation: helpPulse 3s ease-in-out infinite;
}

@keyframes helpPulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(212, 168, 83, 0.4), 0 0 0 3px rgba(212, 168, 83, 0.1); }
    50% { box-shadow: 0 4px 20px rgba(212, 168, 83, 0.6), 0 0 0 6px rgba(212, 168, 83, 0.15); }
}

.help-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(212, 168, 83, 0.5);
    animation: none;
}

.help-btn:active {
    transform: scale(0.95);
}

/* Help Modal Specific Styles */
.help-modal-container {
    max-width: 560px;
}

/* ===================================
   Test Prompting & Analytics
   =================================== */

.run-test-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-weight: 600;
}

.test-modal-container {
    max-width: 720px;
}

.modal-intro {
    color: var(--text-secondary);
    margin: 0 0 var(--space-md) 0;
    line-height: 1.5;
}

.test-prompt-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.test-selected-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.test-prompt-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 320px;
    overflow-y: auto;
    padding-right: var(--space-xs);
}

.test-prompt-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--space-sm);
    align-items: start;
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.test-prompt-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 6px;
    accent-color: var(--accent-primary);
}

.test-prompt-row textarea {
    width: 100%;
    min-height: 60px;
    resize: vertical;
    padding: var(--space-sm);
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.test-prompt-row textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(212, 168, 83, 0.15);
}

.test-prompt-row .prompt-tag {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 4px;
}

.test-rlm-options {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-lg);
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.test-rlm-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.test-rlm-option {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.test-rlm-option input {
    accent-color: var(--accent-primary);
}

.test-settings {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.test-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.test-settings-title {
    font-weight: 600;
    color: var(--text-secondary);
}

.test-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: var(--space-sm);
}

.test-setting {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.test-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: var(--space-sm);
}

.test-settings-note {
    margin-top: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.test-prompt-error {
    margin-top: var(--space-sm);
    color: var(--error);
    font-size: 0.9rem;
}

.test-running-container {
    max-width: 640px;
}

.test-progress {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.test-progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.test-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: width 0.4s ease;
}

.test-progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.test-status-stream {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 260px;
    overflow-y: auto;
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.test-status-line {
    display: flex;
    gap: var(--space-sm);
    align-items: baseline;
}

.test-status-line strong {
    color: var(--text-primary);
}

.test-status-line.streaming {
    flex-direction: column;
    align-items: flex-start;
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    border: 1px dashed rgba(212, 168, 83, 0.35);
    background: rgba(18, 22, 30, 0.5);
}

.test-status-line.streaming.streaming-error {
    border-color: rgba(248, 113, 113, 0.6);
    background: rgba(248, 113, 113, 0.08);
}

.test-stream-status {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.6);
}

.test-stream-prompt {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.test-stream-body {
    margin-top: var(--space-xs);
    color: var(--text-primary);
    white-space: pre-wrap;
}

.test-analytics-container {
    max-width: 820px;
}

.test-analytics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.test-summary-card {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.test-summary-card h4 {
    margin: 0 0 var(--space-xs) 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.test-summary-card p {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.test-summary-card.test-summary-card-wide {
    grid-column: 1 / -1;
}

.test-summary-card.test-summary-card-wide p {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.4;
}

.test-analytics-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 360px;
    overflow-y: auto;
    padding-right: var(--space-xs);
}

.test-analytics-item {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.test-analytics-item h5 {
    margin: 0 0 var(--space-xs) 0;
    font-size: 1rem;
    color: var(--accent-primary);
}

.test-analytics-item p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.test-analytics-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.help-modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

.help-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.help-step {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition-fast);
}

.help-step:hover {
    background: rgba(212, 168, 83, 0.05);
    border-color: rgba(212, 168, 83, 0.2);
}

.step-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--bg-primary);
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.step-content h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.step-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.step-content a {
    color: var(--accent-primary);
    text-decoration: none;
}

.step-content a:hover {
    text-decoration: underline;
}

.help-tips {
    padding: var(--space-md);
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.08), rgba(96, 165, 250, 0.02));
    border: 1px solid rgba(96, 165, 250, 0.2);
    border-radius: var(--radius-md);
}

.help-tips h4 {
    font-size: 0.9rem;
    color: #60a5fa;
    margin-bottom: var(--space-sm);
}

.help-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-tips li {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: var(--space-xs) 0;
    padding-left: var(--space-md);
    position: relative;
}

.help-tips li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: #60a5fa;
}

.help-tips li strong {
    color: var(--text-primary);
}

/* Mobile adjustments for help button */
@media (max-width: 768px) {
    .help-btn {
        bottom: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
    
    .help-modal-container {
        margin: var(--space-md);
    }
    
    .help-step {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }

    .modal-container {
        max-height: calc(100vh - 32px);
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        overflow-y: auto;
    }

    .modal-footer {
        margin-top: auto;
    }

    .test-modal-container .test-prompt-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .test-modal-container .test-prompt-list {
        max-height: 220px;
    }
}

@media (max-width: 480px) {
    .modal-container {
        margin: var(--space-md);
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer button {
        width: 100%;
    }
}

/* ===================================
   Wearable Tab & Modal Styles
   =================================== */

.wearable-coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    text-align: center;
    min-height: 200px;
}

.wearable-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.wearable-coming-soon h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.wearable-status {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    padding: var(--space-xs) var(--space-md);
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-md);
}

.wearable-desc {
    color: var(--text-secondary);
    max-width: 400px;
    line-height: 1.6;
}

/* Wearable Modal */
.wearable-modal-container {
    max-width: 520px;
}

.wearable-modal-content {
    text-align: center;
    padding: var(--space-md) 0;
}

.wearable-modal-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.wearable-modal-content h4 {
    font-size: 1.5rem;
    color: var(--accent-primary);
    margin-bottom: var(--space-md);
}

.wearable-modal-desc {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    line-height: 1.6;
}

.wearable-features-list {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-lg) 0;
    text-align: left;
}

.wearable-features-list li {
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.wearable-features-list li strong {
    color: var(--text-primary);
}

.wearable-modal-note {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
    padding-top: var(--space-md);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ===================================
   Chat with Data Section
   =================================== */
#chat-section {
    margin-top: var(--space-xl);
}

#chat-section .feature-header {
    margin-bottom: var(--space-md);
}

#chat-section .feature-header h3 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.chat-container {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.chat-messages {
    height: 280px;
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    background: linear-gradient(180deg, var(--bg-secondary) 0%, rgba(26, 35, 50, 0.5) 100%);
}

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

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-welcome {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.08), rgba(212, 168, 83, 0.02));
    border-radius: var(--radius-md);
    border: 1px solid rgba(212, 168, 83, 0.15);
}

.chat-welcome-icon {
    font-size: 1.8rem;
    line-height: 1;
    flex-shrink: 0;
}

.chat-welcome-text {
    flex: 1;
}

.chat-welcome-text strong {
    display: block;
    color: var(--accent-primary);
    font-size: 0.9rem;
    margin-bottom: var(--space-xs);
    letter-spacing: 0.02em;
}

.chat-welcome-text p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}

.chat-message {
    display: flex;
    gap: var(--space-sm);
    animation: fadeSlideIn 0.3s ease;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.chat-message.user .chat-message-avatar {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.chat-message.assistant .chat-message-avatar {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.chat-message-content {
    max-width: 85%;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.6;
}

.chat-message.user .chat-message-content {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--bg-primary);
    border-bottom-right-radius: var(--radius-sm);
    font-weight: 500;
}

.chat-message.assistant .chat-message-content {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: var(--radius-sm);
}

.chat-message-content p {
    margin: 0;
}

.chat-input-area {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-card);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-input-area input {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.chat-input-area input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.btn-chat-send {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: var(--accent-primary);
    color: #000000;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.btn-chat-send:hover {
    background: var(--accent-secondary);
    transform: scale(1.08);
}

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

.btn-chat-send .btn-loader {
    display: none;
}

.btn-chat-send:disabled .btn-text {
    display: none;
}

.btn-chat-send:disabled .btn-loader {
    display: flex;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(10, 14, 23, 0.3);
    border-top-color: var(--bg-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.chat-typing {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
    max-width: 100px;
}

.chat-typing-dots {
    display: flex;
    gap: 4px;
}

.chat-typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    40% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* Thinking Indicator - Train of Thought */
.chat-thinking {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.08), rgba(212, 168, 83, 0.03));
    border-radius: var(--radius-md);
    border: 1px solid rgba(212, 168, 83, 0.2);
    min-width: 180px;
    max-width: 280px;
}

.thinking-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(212, 168, 83, 0.3);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.thinking-text {
    color: var(--accent-primary);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    animation: pulseOpacity 2s ease-in-out infinite;
}

@keyframes pulseOpacity {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

/* Responsive */
/* ===================================
   About Section
   =================================== */
.about-section {
    margin-top: var(--space-2xl);
}

.about-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(26, 35, 50, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.about-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    list-style: none;
}

.about-header::-webkit-details-marker {
    display: none;
}

.about-header:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

.about-icon {
    font-size: 1.2rem;
}

.about-toggle {
    margin-left: auto;
    font-size: 0.8rem;
    transition: transform var(--transition-fast);
}

details[open] .about-toggle {
    transform: rotate(180deg);
}

.about-content {
    padding: 0 var(--space-lg) var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.about-intro {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: var(--space-lg);
    padding-top: var(--space-md);
}

.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.model-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.model-icon {
    font-size: 1.3rem;
}

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

.model-info strong {
    font-size: 0.85rem;
    color: var(--accent-primary);
}

.model-info span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.about-privacy {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: var(--space-sm) var(--space-md);
    background: rgba(74, 222, 128, 0.05);
    border: 1px solid rgba(74, 222, 128, 0.15);
    border-radius: var(--radius-md);
    text-align: center;
}

/* ===================================
   Mobile Responsive Styles
   =================================== */
@media (max-width: 768px) {
    :root {
        font-size: 15px;
    }
    
    header {
        padding: var(--space-lg) var(--space-md);
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .logo-icon {
        font-size: 1.8rem;
    }
    
    main {
        padding: 0 var(--space-md) var(--space-xl);
    }
    
    /* Input tabs - horizontal scroll on mobile */
    .input-tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: var(--space-xs);
        padding-bottom: var(--space-sm);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .input-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .tab-btn {
        flex-shrink: 0;
        padding: var(--space-sm) var(--space-md);
        font-size: 0.9rem;
    }
    
    .tab-icon {
        font-size: 1.1rem;
    }
    
    /* Upload zone - improved mobile touch handling */
    .upload-zone {
        padding: var(--space-lg);
        min-height: 150px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(212, 168, 83, 0.2);
        user-select: none;
        -webkit-user-select: none;
    }
    
    .upload-zone:active {
        background: rgba(212, 168, 83, 0.1);
        border-color: var(--accent-primary);
    }
    
    .upload-icon {
        font-size: 2.5rem;
    }
    
    /* Text input */
    #text-input {
        min-height: 150px;
        font-size: 0.95rem;
    }
    
    /* URL input */
    .url-input-wrapper {
        flex-wrap: wrap;
    }
    
    #url-input {
        min-width: 100%;
        margin-bottom: var(--space-sm);
    }
    
    .btn-fetch {
        width: 100%;
        justify-content: center;
    }
    
    /* Results nav - fixed bottom on mobile */
    .results-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        justify-content: flex-start;
        padding: var(--space-sm) var(--space-md);
        padding-bottom: calc(var(--space-sm) + env(safe-area-inset-bottom, 0));
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    }
    
    .nav-label {
        display: none;
    }
    
    .nav-pill {
        padding: var(--space-sm) var(--space-md);
        flex-direction: column;
        gap: 2px;
    }
    
    .nav-pill span:first-child {
        font-size: 1.2rem;
    }
    
    /* Add bottom padding to results section for fixed nav */
    .results-section {
        padding-bottom: 80px;
    }
    
    /* Results grid */
    .results-grid {
        gap: var(--space-md);
    }
    
    .card-header {
        padding: var(--space-md);
    }
    
    /* Larger touch target for collapsible headers on mobile */
    .card-header-collapsible {
        padding: var(--space-md) var(--space-md);
        min-height: 56px;
    }
    
    .collapse-toggle {
        font-size: 1rem;
        padding: var(--space-sm);
    }
    
    .card-content {
        padding: var(--space-md);
        font-size: 0.9rem;
    }
    
    /* Results actions */
    .results-actions {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .results-actions button {
        width: 100%;
    }
    
    .results-actions .btn-primary,
    .results-actions .btn-secondary {
        min-width: unset;
    }
    
    /* Feature sections */
    .feature-section {
        padding: var(--space-md);
    }
    
    .feature-section h3 {
        font-size: 1.1rem;
    }
    
    .feature-controls {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-sm);
    }
    
    .voice-selector {
        justify-content: space-between;
        width: 100%;
    }
    
    .voice-selector select {
        flex: 1;
    }
    
    .feature-controls button {
        width: 100%;
    }
    
    /* Chat section */
    .chat-messages {
        height: 250px;
    }
    
    .chat-welcome {
        flex-direction: column;
        text-align: center;
        gap: var(--space-sm);
    }
    
    .chat-message-content {
        max-width: 90%;
    }
    
    /* Audio player */
    .audio-player-container {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .audio-player-container audio {
        width: 100%;
    }
    
    .audio-player-container button {
        width: 100%;
    }
    
    /* Infographic - allow full height on mobile */
    .infographic-container img {
        max-width: 100%;
        height: auto;
        max-height: none;
    }
    
    /* About section */
    .models-grid {
        grid-template-columns: 1fr;
    }
    
    /* Footer */
    footer {
        padding: var(--space-lg) var(--space-md);
    }
    
    .credits a {
        display: block;
        margin-top: var(--space-xs);
    }
}

@media (max-width: 480px) {
    :root {
        font-size: 14px;
    }
    
    header h1 {
        font-size: 1.7rem;
    }
    
    .tagline {
        font-size: 0.9rem;
    }
    
    .api-key-container {
        padding: var(--space-md);
    }
    
    .api-key-group {
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .api-key-group input {
        width: 100%;
    }
    
    .api-key-group .icon-btn,
    .api-key-group button {
        width: 100%;
    }
    
    .input-section {
        padding: var(--space-md);
    }
    
    .tab-btn {
        padding: var(--space-xs) var(--space-sm);
        font-size: 0.85rem;
    }
    
    .chat-input-area {
        padding: var(--space-sm);
    }
    
    .chat-input-area input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .btn-chat-send {
        width: 38px;
        height: 38px;
    }
}

/* ===================================
   Agent Import/Export & Tools
   =================================== */
.agent-import-section,
.agent-tools-section {
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    text-align: center;
}

.agent-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.agent-divider::before,
.agent-divider::after {
    content: '';
    flex: 1;
    max-width: 120px;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(212, 168, 83, 0.4), transparent);
}

.agent-buttons {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    flex-wrap: wrap;
}

.agent-tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 200px;
}

.agent-divider span {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: var(--font-body);
}

.btn-agent-import {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.1), rgba(96, 165, 250, 0.05));
    border: 1px dashed rgba(96, 165, 250, 0.5);
    border-radius: var(--radius-lg);
    color: var(--info);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.1);
}

.btn-agent-import:hover {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(96, 165, 250, 0.1));
    border-color: var(--info);
    border-style: solid;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(96, 165, 250, 0.2);
}

.btn-agent-import:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.1);
}

.btn-agent-import span {
    font-size: 1.2rem;
}

/* Agent Orchestrator Button */
.btn-agent-orchestrator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.1), rgba(212, 168, 83, 0.05));
    border: 1px dashed rgba(212, 168, 83, 0.5);
    border-radius: var(--radius-lg);
    color: var(--accent-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(212, 168, 83, 0.1);
}

.btn-agent-orchestrator:hover {
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.2), rgba(212, 168, 83, 0.1));
    border-color: var(--accent-primary);
    border-style: solid;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(212, 168, 83, 0.2);
}

.btn-agent-orchestrator:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(212, 168, 83, 0.1);
}

.btn-agent-orchestrator span {
    font-size: 1.2rem;
}

.agent-hint {
    margin-top: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    max-width: 220px;
}

/* Export Agent Button - styled similar to other secondary buttons but distinct */
#export-agent-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.1), rgba(212, 168, 83, 0.05));
    border: 1px solid rgba(212, 168, 83, 0.3);
}

#export-agent-btn:hover {
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.2), rgba(212, 168, 83, 0.1));
    border-color: var(--accent-primary);
}

#export-agent-btn span {
    font-size: 1.1rem;
}

/* Imported Agent Metrics */
.metrics-imported {
    text-align: center;
    padding: var(--space-md);
}

.imported-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.15), rgba(96, 165, 250, 0.05));
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: var(--radius-lg);
    color: var(--info);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: var(--space-md);
}

.imported-badge span {
    font-size: 1.2rem;
}

.imported-note {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: var(--space-sm);
}

.imported-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

/* Mobile adjustments for agent section */
@media (max-width: 768px) {
    .agent-import-section,
    .agent-tools-section {
        margin-top: var(--space-lg);
        padding-top: var(--space-md);
    }
    
    .agent-buttons {
        flex-direction: column;
        gap: var(--space-lg);
    }
    
    .agent-tool {
        min-width: auto;
        width: 100%;
    }
    
    .btn-agent-import,
    .btn-agent-orchestrator {
        width: 100%;
        padding: var(--space-md) var(--space-lg);
    }
    
    .agent-divider::before,
    .agent-divider::after {
        max-width: 80px;
    }
    
    .results-actions {
        flex-wrap: wrap;
    }
    
    #export-agent-btn {
        order: 2;
    }
}

/* ===================================
   Agent Orchestrator Styles
   =================================== */

/* Header navigation links */
.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xl);
    flex-wrap: wrap;
}

.orchestrator-link,
.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.1), rgba(212, 168, 83, 0.05));
    border: 1px solid rgba(212, 168, 83, 0.3);
    border-radius: var(--radius-lg);
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}


.orchestrator-link:hover,
.back-link:hover {
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.2), rgba(212, 168, 83, 0.1));
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 168, 83, 0.2);
}

.orchestrator-link span,
.back-link span {
    font-size: 1.1rem;
}

/* Section headers for orchestrator */
.section-header {
    margin-bottom: var(--space-lg);
}

.section-header h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.section-header h2 span {
    font-size: 1.4rem;
}

.section-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: var(--space-xs);
}

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

.knowledge-base-section {
    margin-bottom: var(--space-xl);
}

/* Compact Upload Zone */
.upload-area {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-lg);
}

.upload-zone-compact {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.1), rgba(212, 168, 83, 0.05));
    border: 2px dashed rgba(212, 168, 83, 0.4);
    border-radius: var(--radius-xl);
    color: var(--accent-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.upload-zone-compact:hover {
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.2), rgba(212, 168, 83, 0.1));
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(212, 168, 83, 0.2);
}

.upload-icon-small {
    font-size: 1.2rem;
}

/* Knowledge Base Container */
.knowledge-base-container {
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    border: 1px solid rgba(212, 168, 83, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-sm) var(--space-md);
    position: relative;
    box-shadow: 0 0 20px rgba(212, 168, 83, 0.08);
}

.kb-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid rgba(212, 168, 83, 0.15);
    flex-wrap: wrap;
}

.kb-title {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.kb-icon {
    font-size: 1.2rem;
}

.kb-title h2 {
    font-family: var(--font-display);
    font-size: 1rem;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
    margin: 0;
}

.kb-stats {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.kb-count {
    color: var(--accent-primary);
    font-weight: 600;
}

.kb-active {
    color: var(--success);
}

.btn-sm {
    font-size: 0.65rem;
    padding: 2px var(--space-xs);
}

.btn-text-danger {
    background: none;
    border: none;
    color: var(--error);
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    margin-left: auto;
}

.btn-text-danger:hover {
    background: rgba(248, 113, 113, 0.1);
}

/* Agent Chain */
.agent-chain {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
    justify-content: center;
    padding: var(--space-sm) 0;
    min-height: 60px;
    position: relative;
}

.agent-chain-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: var(--space-md);
    color: var(--text-muted);
    text-align: center;
}

.agent-chain-empty .empty-icon {
    font-size: 1.5rem;
    margin-bottom: var(--space-xs);
    opacity: 0.5;
}

.agent-chain-empty p {
    margin: 0;
    font-size: 0.8rem;
}

.agent-chain-empty .hint {
    display: none;
}

/* Agent Node */
.agent-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.15), rgba(96, 165, 250, 0.05));
    border: 1px solid rgba(96, 165, 250, 0.4);
    border-radius: var(--radius-md);
    padding: var(--space-xs) var(--space-sm);
    min-width: 100px;
    max-width: 140px;
    position: relative;
    transition: all var(--transition-fast);
    animation: nodeAppear 0.3s ease-out;
}

@keyframes nodeAppear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.agent-node:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(96, 165, 250, 0.2);
    border-color: rgba(96, 165, 250, 0.6);
}

.agent-node.disabled {
    opacity: 0.5;
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.agent-node.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Connection line between nodes */
.agent-node:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -18px;
    top: 50%;
    width: 20px;
    height: 3px;
    background-image: repeating-linear-gradient(
        90deg,
        var(--accent-primary) 0px,
        var(--accent-primary) 4px,
        transparent 4px,
        transparent 8px
    );
    transform: translateY(-50%);
    opacity: 0.8;
}

.agent-node.disabled::after {
    background-image: repeating-linear-gradient(
        90deg,
        var(--text-muted) 0px,
        var(--text-muted) 4px,
        transparent 4px,
        transparent 8px
    );
    opacity: 0.3;
}

.agent-node-icon {
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.agent-node-name {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    padding: 2px 4px;
    transition: all var(--transition-fast);
}

.agent-node-name:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.2);
}

.agent-node-name:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(0, 0, 0, 0.3);
}

.agent-node-meta {
    display: none;
}

.agent-node-controls {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.agent-control-btn {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.65rem;
    padding: 2px 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.agent-control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.agent-control-btn.toggle-btn {
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agent-control-btn.toggle-btn.active {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.agent-control-btn.remove-btn:hover {
    background: rgba(248, 113, 113, 0.2);
    border-color: rgba(248, 113, 113, 0.4);
    color: var(--error);
}

/* Knowledge Base to Chat Connector */
.kb-to-chat-connector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-lg) 0;
}

.connector-line {
    flex: 1;
    max-width: 100px;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(212, 168, 83, 0.5), transparent);
}

.connector-label {
    color: var(--accent-primary);
    font-size: 0.9rem;
    font-weight: 600;
    padding: var(--space-xs) var(--space-md);
    background: rgba(212, 168, 83, 0.1);
    border: 1px solid rgba(212, 168, 83, 0.3);
    border-radius: var(--radius-lg);
    white-space: nowrap;
}

/* KB to Chat Flow Indicator */
.kb-flow-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
}

.kb-flow-indicator .flow-line {
    flex: 1;
    max-width: 80px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 168, 83, 0.4), transparent);
}

.kb-flow-indicator .flow-icon {
    color: var(--accent-primary);
    font-size: 1rem;
    opacity: 0.6;
    animation: flowPulse 2s ease-in-out infinite;
}

@keyframes flowPulse {
    0%, 100% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 0.8; transform: translateY(2px); }
}

/* ===================================
   Modern Chatbot Interface
   =================================== */

.chatbot-container {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 
        0 4px 24px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Chatbot Header */
.chatbot-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.12), rgba(212, 168, 83, 0.04));
    border-bottom: 1px solid rgba(212, 168, 83, 0.15);
}

.chatbot-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.2), rgba(212, 168, 83, 0.1));
    border-radius: 50%;
    border: 2px solid rgba(212, 168, 83, 0.4);
}

.avatar-icon {
    font-size: 1.5rem;
}

.avatar-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(212, 168, 83, 0.3);
    animation: avatarPulse 2s ease-in-out infinite;
}

@keyframes avatarPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.5; }
}

.chatbot-info {
    flex: 1;
}

.chatbot-name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
    margin: 0 0 2px 0;
}

.chatbot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.chatbot-status.ready .status-dot {
    background: var(--success);
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-left: auto;
}

.chatbot-clear-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    color: #ef4444;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-clear-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

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

.chatbot-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: rgba(96, 165, 250, 0.15);
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    color: var(--text-primary);
}

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

.badge-count {
    font-weight: 700;
    color: var(--accent-primary);
}

/* Model Settings Panel */
.model-settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    align-items: start;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-lg);
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
    min-width: 0;
}

.setting-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.setting-section {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-top: var(--space-xs);
}

.setting-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.setting-section-help {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.setting-group.setting-toggle {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: var(--space-sm);
}

.setting-help {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
}

.setting-group select {
    appearance: none;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 4px 24px 4px 8px;
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a8b2c1' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
}

.setting-group select:hover {
    border-color: rgba(212, 168, 83, 0.4);
    background-color: var(--bg-card-hover);
}

.setting-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(212, 168, 83, 0.2);
}

/* Context Window Gauge */
.context-gauge {
    padding: var(--space-md) var(--space-lg);
    background: rgba(10, 14, 23, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.context-gauge-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.context-gauge-title {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.context-gauge-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.context-gauge-status {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(74, 222, 128, 0.15);
    color: var(--success);
    font-weight: 600;
}

.context-gauge-status.warn {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
}

.context-gauge-status.critical {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.context-gauge-bars {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.context-gauge-row {
    display: grid;
    grid-template-columns: 160px 1fr 56px;
    align-items: center;
    gap: var(--space-sm);
}

.context-gauge-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.context-gauge-bar {
    position: relative;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.context-gauge-bar-raw {
    background: rgba(96, 165, 250, 0.15);
}

.context-gauge-fill {
    position: absolute;
    inset: 0;
    width: 0%;
    background: linear-gradient(90deg, rgba(212, 168, 83, 0.9), rgba(250, 204, 21, 0.8));
    border-radius: inherit;
    transition: width 0.3s ease;
}

.context-gauge-fill-raw {
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.9), rgba(59, 130, 246, 0.8));
}

.context-gauge-value {
    font-size: 0.75rem;
    color: var(--text-primary);
    text-align: right;
}

.context-gauge-footnote {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Toggle Switch Styling */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    transition: background-color var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: rgba(74, 222, 128, 0.3);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(16px);
    background-color: var(--success);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 2px rgba(212, 168, 83, 0.2);
}

/* Responsive: Stack settings on smaller screens */
@media (max-width: 600px) {
    .model-settings {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
        padding: var(--space-sm);
    }
}

/* Chat Messages Area */
.chatbot-messages {
    min-height: 280px;
    max-height: 450px;
    overflow-y: auto;
    padding: var(--space-lg);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), transparent);
    scroll-behavior: smooth;
}

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

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(212, 168, 83, 0.3);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 168, 83, 0.5);
}

/* Welcome Card */
.chat-welcome-card {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.08), rgba(212, 168, 83, 0.02));
    border: 1px solid rgba(212, 168, 83, 0.15);
    border-radius: var(--radius-lg);
}

.welcome-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: rgba(212, 168, 83, 0.15);
    border-radius: 50%;
    flex-shrink: 0;
}

.welcome-content {
    flex: 1;
}

.welcome-title {
    font-weight: 600;
    color: var(--accent-primary);
    margin: 0 0 var(--space-xs) 0;
    font-size: 1rem;
}

.welcome-text {
    color: var(--text-secondary);
    margin: 0 0 var(--space-md) 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.welcome-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.suggestion-chip {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.suggestion-chip:hover {
    background: rgba(212, 168, 83, 0.15);
    border-color: rgba(212, 168, 83, 0.4);
    color: var(--accent-primary);
    transform: translateY(-1px);
}

/* Chat Message Bubbles */
.chat-message {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    animation: messageSlideIn 0.3s ease-out;
}

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

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-message.assistant .chat-message-avatar {
    background: rgba(212, 168, 83, 0.15);
}

.chat-message.user .chat-message-avatar {
    background: rgba(96, 165, 250, 0.15);
}

.chat-message-content {
    max-width: 80%;
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    line-height: 1.6;
}

.chat-message.assistant .chat-message-content {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top-left-radius: 4px;
}

.chat-message.user .chat-message-content {
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.2), rgba(212, 168, 83, 0.1));
    border: 1px solid rgba(212, 168, 83, 0.3);
    border-top-right-radius: 4px;
    color: var(--text-primary);
}

.chat-message.streaming .chat-message-content {
    border: 1px dashed rgba(212, 168, 83, 0.4);
    background: rgba(22, 26, 34, 0.6);
}

.chat-message.streaming.streaming-error .chat-message-content {
    border-color: rgba(248, 113, 113, 0.6);
    background: rgba(248, 113, 113, 0.08);
}

.streaming-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: var(--space-xs);
}

.streaming-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--accent-primary);
    box-shadow: 0 0 12px rgba(212, 168, 83, 0.6);
    animation: streamingPulse 1.4s ease-in-out infinite;
}

.streaming-body {
    white-space: pre-wrap;
    color: var(--text-primary);
}

.streaming-cursor {
    display: inline-block;
    margin-left: 2px;
    color: var(--accent-primary);
    animation: streamingBlink 1s steps(2, start) infinite;
}

/* Chat Message Markdown Styling */
.chat-message-content p {
    margin: 0 0 var(--space-sm) 0;
}

.chat-message-content p:last-child {
    margin-bottom: 0;
}

.chat-message-content ul,
.chat-message-content ol {
    list-style: none;
    padding: 0;
    margin: var(--space-sm) 0;
}

.chat-message-content li {
    position: relative;
    padding-left: var(--space-lg);
    margin-bottom: var(--space-xs);
    color: var(--text-secondary);
}

.chat-message-content ul li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-weight: bold;
}

.chat-message-content ol {
    counter-reset: list-counter;
}

.chat-message-content ol li {
    counter-increment: list-counter;
}

.chat-message-content ol li::before {
    content: counter(list-counter) ".";
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 0.85em;
}

@keyframes streamingPulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.35);
        opacity: 1;
    }
}

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

.chat-message-content h1,
.chat-message-content h2,
.chat-message-content h3,
.chat-message-content h4,
.chat-message-content h5,
.chat-message-content h6 {
    font-family: var(--font-display);
    color: var(--accent-primary);
    margin: var(--space-md) 0 var(--space-sm) 0;
    letter-spacing: 0.03em;
}

.chat-message-content h1:first-child,
.chat-message-content h2:first-child,
.chat-message-content h3:first-child {
    margin-top: 0;
}

.chat-message-content h1 { font-size: 1.3rem; }
.chat-message-content h2 { font-size: 1.15rem; }
.chat-message-content h3 { font-size: 1.05rem; }
.chat-message-content h4 { font-size: 0.95rem; }

.chat-message-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85em;
    color: var(--accent-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-message-content pre {
    background: rgba(0, 0, 0, 0.4);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: var(--space-sm) 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-message-content pre code {
    background: none;
    padding: 0;
    border: none;
    color: var(--text-primary);
}

.chat-message-content blockquote {
    border-left: 3px solid var(--accent-primary);
    padding-left: var(--space-md);
    margin: var(--space-sm) 0;
    color: var(--text-secondary);
    font-style: italic;
    background: rgba(212, 168, 83, 0.05);
    padding: var(--space-sm) var(--space-md);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.chat-message-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.chat-message-content em {
    color: var(--text-secondary);
    font-style: italic;
}

.chat-message-content hr {
    border: none;
    border-top: 1px solid rgba(212, 168, 83, 0.3);
    margin: var(--space-md) 0;
}

.chat-message-content a {
    color: var(--accent-primary);
    text-decoration: none;
    border-bottom: 1px solid rgba(212, 168, 83, 0.3);
    transition: border-color var(--transition-fast);
}

.chat-message-content a:hover {
    border-bottom-color: var(--accent-primary);
}

.chat-message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-sm) 0;
    font-size: 0.85em;
}

.chat-message-content th,
.chat-message-content td {
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
}

.chat-message-content th {
    background: rgba(212, 168, 83, 0.1);
    color: var(--accent-primary);
    font-weight: 600;
}

.chat-message-content td {
    background: rgba(0, 0, 0, 0.2);
}

/* Thinking Indicator - Enhanced Train of Thought */
.chat-thinking {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    align-items: flex-start;
}

.chat-thinking-bubble {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.1), rgba(212, 168, 83, 0.03));
    border: 1px solid rgba(212, 168, 83, 0.25);
    border-radius: var(--radius-lg);
    border-top-left-radius: 4px;
    flex: 1;
    min-width: 0;
    max-width: 80%;
    width: auto;
    box-shadow: 0 2px 8px rgba(212, 168, 83, 0.1);
}

/* Header with dots and title */
.thinking-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid rgba(212, 168, 83, 0.2);
}

.thinking-title {
    color: var(--accent-primary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.95;
}

.thinking-dots {
    display: flex;
    gap: 3px;
}

.thinking-dots span {
    width: 6px;
    height: 6px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: thinkingBounce 1.4s ease-in-out infinite;
}

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

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

@keyframes thinkingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Scrolling log of steps */
.thinking-log {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding: var(--space-xs) 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 168, 83, 0.3) transparent;
    margin: var(--space-xs) 0;
}

.thinking-log::-webkit-scrollbar {
    width: 4px;
}

.thinking-log::-webkit-scrollbar-track {
    background: transparent;
}

.thinking-log::-webkit-scrollbar-thumb {
    background: rgba(212, 168, 83, 0.3);
    border-radius: 2px;
}

/* Individual step in the log */
.thinking-step {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.82rem;
    line-height: 1.5;
    animation: stepFadeIn 0.3s ease-out;
    padding: 2px 0;
}

@keyframes stepFadeIn {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

.thinking-step .step-icon {
    flex-shrink: 0;
    font-size: 0.85rem;
    width: 20px;
    text-align: center;
    line-height: 1.5;
}

.thinking-step .step-text {
    color: var(--text-secondary);
    opacity: 0.95;
    flex: 1;
    word-wrap: break-word;
}

/* Step type colors */
.thinking-step.classify .step-text {
    color: #a78bfa; /* Purple */
}

.thinking-step.decompose .step-text {
    color: #60a5fa; /* Blue */
}

.thinking-step.code .step-text {
    color: #34d399; /* Green */
}

.thinking-step.execute .step-text {
    color: #fbbf24; /* Amber */
}

.thinking-step.recurse .step-text {
    color: #f472b6; /* Pink */
}

.thinking-step.aggregate .step-text {
    color: #22d3ee; /* Cyan */
}

.thinking-step.success .step-text {
    color: #4ade80; /* Bright green */
    font-weight: 500;
}

.thinking-step.warning .step-text {
    color: #fb923c; /* Orange */
}

.thinking-step.cache .step-text {
    color: #c084fc; /* Purple for cache hits */
}

/* Phase 3.2: Depth-based indentation for nested sub_lm calls */
.thinking-step.depth-1 {
    margin-left: 16px;
    padding-left: 8px;
    border-left: 2px solid rgba(244, 114, 182, 0.3);
}

.thinking-step.depth-2 {
    margin-left: 32px;
    padding-left: 8px;
    border-left: 2px solid rgba(244, 114, 182, 0.2);
}

.thinking-step.depth-3 {
    margin-left: 48px;
    padding-left: 8px;
    border-left: 2px solid rgba(244, 114, 182, 0.15);
}

/* Depth badge for recursive sub_lm calls */
.thinking-step .depth-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 1px 4px;
    margin-right: 4px;
    border-radius: 3px;
    background: rgba(244, 114, 182, 0.2);
    color: #f472b6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.thinking-step.depth-1 .depth-badge { background: rgba(244, 114, 182, 0.25); }
.thinking-step.depth-2 .depth-badge { background: rgba(244, 114, 182, 0.20); }
.thinking-step.depth-3 .depth-badge { background: rgba(244, 114, 182, 0.15); }

/* Timing badge for completed steps */
.thinking-step .timing-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 500;
    padding: 1px 5px;
    margin-left: 6px;
    border-radius: 3px;
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
    font-family: 'Source Code Pro', monospace;
}

.thinking-step.warning .timing-badge {
    background: rgba(251, 146, 60, 0.15);
    color: #fb923c;
}

/* Current active step */
.thinking-current {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding-top: var(--space-sm);
    margin-top: var(--space-xs);
    border-top: 1px solid rgba(212, 168, 83, 0.15);
}

.thinking-current .thinking-text {
    color: var(--accent-primary);
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.9;
}

.thinking-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(212, 168, 83, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

.thinking-text {
    color: var(--accent-primary);
    font-size: 0.8rem;
    font-weight: 500;
    animation: pulseOpacity 2s ease-in-out infinite;
}

@keyframes pulseOpacity {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Chat Input Area */
.chatbot-input-area {
    padding: var(--space-md) var(--space-lg) var(--space-lg);
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.chatbot-input-wrapper {
    display: flex;
    gap: var(--space-sm);
    background: var(--bg-input);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 4px;
    transition: all var(--transition-fast);
}

.chatbot-input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.15);
}

.chatbot-input-wrapper textarea {
    flex: 1;
    padding: var(--space-md);
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    line-height: 1.5;
}

.chatbot-input-wrapper textarea:focus {
    outline: none;
}

.chatbot-input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: var(--radius-md);
    color: var(--bg-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.chatbot-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(212, 168, 83, 0.4);
}

.chatbot-send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

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

.chatbot-send-btn .send-icon svg {
    display: block;
}

.chatbot-send-btn .send-loader {
    display: flex;
}

.input-hint {
    margin: var(--space-xs) 0 0 var(--space-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Disabled state */
.chatbot-container.disabled {
    opacity: 0.7;
}

.chatbot-container.disabled .chatbot-input-wrapper {
    background: rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.chatbot-container.disabled .chatbot-send-btn {
    opacity: 0.3;
    pointer-events: none;
}

.chatbot-container.disabled .suggestion-chip {
    pointer-events: none;
    opacity: 0.5;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-header {
        flex-wrap: wrap;
        gap: var(--space-sm);
    }
    
    .chatbot-header-actions {
        order: -1;
        width: 100%;
        justify-content: center;
    }
    
    .chatbot-badge {
        /* Already in header-actions, no need for separate mobile rules */
    }
    
    .chatbot-messages {
        min-height: 200px;
        max-height: 350px;
    }
    
    .chat-welcome-card {
        flex-direction: column;
        text-align: center;
    }
    
    .welcome-avatar {
        margin: 0 auto;
    }
    
    .welcome-suggestions {
        justify-content: center;
    }
    
    .chat-message-content {
        max-width: 90%;
    }

    .chat-thinking-bubble {
        max-width: 100%;
    }
    
    .input-hint {
        display: none;
    }
}

/* Insights hint */
.insights-hint {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
    max-width: 400px;
    line-height: 1.5;
}

.insights-hint::before {
    content: "💡 ";
}

/* Disabled chat state */
.chat-interface-container.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.chat-interface-container.disabled .chat-input-inline input {
    background: rgba(0, 0, 0, 0.3);
}

/* Mobile responsive for integrated chat */
@media (max-width: 768px) {
    .chat-header-inline {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .chat-kb-indicator {
        width: 100%;
        justify-content: center;
    }
    
    .kb-to-chat-connector {
        padding: var(--space-md) 0;
    }
    
    .connector-line {
        max-width: 50px;
    }
}

/* KB Actions - Generate Insights Button Area */
.kb-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    padding: var(--space-lg);
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.08) 0%, rgba(212, 168, 83, 0.02) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(212, 168, 83, 0.15);
}

.kb-actions .btn-large {
    padding: var(--space-md) var(--space-2xl);
    font-size: 1.1rem;
    min-width: 320px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.kb-actions .btn-large:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(212, 168, 83, 0.3);
}

/* Chat Header with KB Connection */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.chat-header-info h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin: 0;
}

.chat-kb-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.indicator-dot.active {
    background: var(--success);
    animation: dotPulse 1.5s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(74, 222, 128, 0); }
}

.indicator-text strong {
    color: var(--accent-primary);
}

/* Mobile Responsive for Knowledge Base */
@media (max-width: 768px) {
    .kb-header {
        flex-direction: row;
        align-items: center;
        gap: var(--space-xs);
    }
    
    .btn-text-danger {
        margin-left: auto;
    }
    
    .agent-chain {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .agent-node {
        width: auto;
        max-width: 140px;
    }
    
    .agent-node:not(:last-child)::after {
        right: -20px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .chat-header {
        flex-direction: column;
    }
    
    .chat-kb-indicator {
        width: 100%;
        justify-content: center;
    }
}

.agent-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.agent-icon {
    font-size: 1.5rem;
}

.agent-details {
    display: flex;
    flex-direction: column;
}

.agent-title {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.agent-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.remove-agent-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.remove-agent-btn:hover {
    color: var(--error);
    background: rgba(248, 113, 113, 0.1);
}

/* Insights Section */
.insights-section {
    margin-top: var(--space-xl);
    animation: fadeIn 0.4s ease-out;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

.insight-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    border: 1px solid rgba(212, 168, 83, 0.15);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-fast);
}

.insight-card:hover {
    border-color: rgba(212, 168, 83, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.insight-card.full-width {
    grid-column: 1 / -1;
}

.insight-card .card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid rgba(212, 168, 83, 0.1);
}

.insight-card .card-icon {
    font-size: 1.3rem;
}

.insight-card h3 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
}

.insight-list {
    list-style: none;
    padding: 0;
}

.insight-list li {
    position: relative;
    padding-left: var(--space-lg);
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

.insight-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-weight: bold;
}

.no-data {
    color: var(--text-muted);
    font-style: italic;
}

/* Orchestrator Chat Section */
.chat-section {
    margin-top: var(--space-xl);
    animation: fadeIn 0.4s ease-out;
}

/* Typing indicator animation */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: var(--space-md);
}

.typing-indicator .dot {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0; }

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Metrics Card (Fixed Position) */
.metrics-card {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    width: 420px;
    max-width: calc(100vw - 2 * var(--space-lg));
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
    border: 1px solid rgba(212, 168, 83, 0.3);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    animation: slideInUp 0.3s ease-out;
}

.metrics-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    border-bottom: 1px solid rgba(212, 168, 83, 0.2);
    background: rgba(212, 168, 83, 0.08);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.metrics-card-header h4 {
    margin: 0;
    color: var(--accent-primary);
    font-family: var(--font-display);
    font-size: 1.1rem;
    letter-spacing: 0.05em;
}

.metrics-controls {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.metrics-download-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding: var(--space-xs);
    transition: var(--transition-fast);
}

.metrics-download-btn:hover {
    color: var(--accent-primary);
    transform: scale(1.1);
}

.metrics-pin-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding: var(--space-xs);
    transition: var(--transition-fast);
}

.metrics-pin-btn:hover {
    color: var(--accent-primary);
    transform: scale(1.1);
}

.metrics-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: var(--space-xs);
    transition: var(--transition-fast);
}

.metrics-toggle:hover {
    color: var(--accent-primary);
}

.metrics-card-content {
    padding: var(--space-md);
    max-height: 500px;
    overflow-y: auto;
}

.metrics-card-content::-webkit-scrollbar {
    width: 4px;
}

.metrics-card-content::-webkit-scrollbar-track {
    background: transparent;
}

.metrics-card-content::-webkit-scrollbar-thumb {
    background: rgba(212, 168, 83, 0.3);
    border-radius: 2px;
}

/* Enhanced Metrics Display - Per-Prompt Breakdown */
.metrics-summary {
    margin-bottom: var(--space-md);
}

.metrics-summary-header {
    color: var(--accent-primary);
    font-family: var(--font-display);
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid rgba(212, 168, 83, 0.2);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.metrics-card-content .metric-item {
    text-align: center;
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.metrics-card-content .metric-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.metrics-card-content .metric-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Prompt Logs Section */
.metrics-prompt-logs {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid rgba(212, 168, 83, 0.2);
}

.prompt-logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--accent-primary);
    font-family: var(--font-display);
    font-size: 0.9rem;
    letter-spacing: 0.03em;
    margin-bottom: var(--space-sm);
}

.prompt-logs-count {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(212, 168, 83, 0.1);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.prompt-logs-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

/* Individual Prompt Log Entry */
.prompt-log-entry {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: var(--transition-fast);
}

.prompt-log-entry:hover {
    border-color: rgba(212, 168, 83, 0.3);
}

.prompt-log-entry[open] {
    border-color: rgba(212, 168, 83, 0.4);
    background: rgba(212, 168, 83, 0.05);
}

.prompt-log-header::-webkit-details-marker {
    display: none;
}

.prompt-log-number {
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--accent-primary);
    text-align: center;
}

.prompt-log-name {
    font-size: 0.8rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prompt-log-cost {
    font-size: 0.75rem;
    color: var(--accent-success);
    font-weight: 600;
}

.prompt-log-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Prompt Log Details (expanded view) */
.prompt-log-details {
    padding: var(--space-sm) var(--space-md) var(--space-md);
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.prompt-log-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: var(--space-xs) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.prompt-log-row:last-child {
    border-bottom: none;
}

.log-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 80px;
}

.log-value {
    font-size: 0.8rem;
    color: var(--text-primary);
    text-align: right;
    word-break: break-word;
}

.log-value.model-tag {
    background: rgba(212, 168, 83, 0.15);
    color: var(--accent-primary);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 0.7rem;
}

.log-value.cost-highlight {
    color: var(--accent-success);
    font-weight: 600;
}

/* Confidence Indicators */
.log-value.confidence-high {
    color: var(--accent-success);
}

.log-value.confidence-medium {
    color: #fbbf24;
}

.log-value.confidence-low {
    color: #ef4444;
}

.log-value.confidence-na {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.7rem;
}

.log-value.warning-text {
    color: #fbbf24;
}

/* Prompt Preview */
.prompt-log-row.prompt-preview {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
}

.prompt-log-row.prompt-preview .log-value {
    text-align: left;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.4;
    max-height: 60px;
    overflow: hidden;
}

.prompt-json {
    background: rgba(0, 0, 0, 0.35);
    border-radius: var(--radius-sm);
    padding: var(--space-xs);
    font-size: 0.7rem;
    color: var(--text-muted);
    max-height: 160px;
    overflow-y: auto;
    text-align: left;
}

/* Mode and RLM Indicators */
.prompt-log-mode {
    font-size: 0.9rem;
    min-width: 20px;
    text-align: center;
}

.prompt-log-entry.uses-rlm {
    border-left: 3px solid var(--accent-primary);
}

/* Memory Debug Panel */
.metrics-debug-panel {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid rgba(212, 168, 83, 0.2);
}

.metrics-debug-panel .debug-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.metrics-debug-panel .debug-grid.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metrics-debug-panel .debug-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    padding: var(--space-sm);
}

.metrics-debug-panel .debug-title {
    font-size: 0.8rem;
    color: var(--accent-primary);
    margin-bottom: var(--space-xs);
    font-weight: 600;
}

.metrics-debug-panel .debug-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metrics-debug-panel .debug-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-secondary);
    padding: 2px 0;
}

.metrics-debug-panel .debug-section {
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
}

.metrics-debug-panel .debug-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.metrics-debug-panel .debug-pill {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(212, 168, 83, 0.15);
    color: var(--accent-primary);
    font-size: 0.65rem;
    margin-right: 6px;
}

.metrics-debug-panel .debug-text {
    margin-top: 4px;
    font-size: 0.72rem;
    color: var(--text-primary);
}

.metrics-debug-panel .muted {
    color: var(--text-muted);
}

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

.mode-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
}

.mode-tag.mode-direct {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
}

.mode-tag.mode-rlm {
    background: rgba(212, 168, 83, 0.15);
    color: var(--accent-primary);
}

.mode-tag.mode-repl {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}

.setting-help {
    margin: 6px 0 0;
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.rlm-indicator {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 6px;
    background: rgba(212, 168, 83, 0.2);
    color: var(--accent-primary);
    border-radius: var(--radius-xs);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Effort Level Badges */
.effort-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
}

.effort-badge.effort-low {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
}

.effort-badge.effort-medium {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.effort-badge.effort-high {
    background: rgba(251, 146, 60, 0.2);
    color: #fb923c;
}

.effort-badge.effort-xhigh {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.effort-display {
    font-weight: 500;
}

.effort-display.effort-none {
    color: var(--text-muted);
}

.effort-display.effort-low {
    color: #4ade80;
}

.effort-display.effort-medium {
    color: #fbbf24;
}

.effort-display.effort-high {
    color: #fb923c;
}

.effort-display.effort-xhigh {
    color: #ef4444;
}

/* Sub-calls Badge */
.subcalls-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
    border-radius: var(--radius-xs);
    font-size: 0.65rem;
    font-weight: 600;
}

.cache-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    background: rgba(34, 197, 94, 0.18);
    color: #22c55e;
    border-radius: var(--radius-xs);
    font-size: 0.65rem;
    font-weight: 600;
}

/* Updated prompt log header for mode indicator */
.prompt-log-header {
    display: grid;
    grid-template-columns: 32px 24px 1fr auto auto;
    gap: var(--space-sm);
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    user-select: none;
    list-style: none;
}

/* Mobile Responsive for Enhanced Metrics */
@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .prompt-log-header {
        grid-template-columns: 28px 20px 1fr auto;
    }
    
    .prompt-log-time {
        display: none;
    }
    
    .rlm-indicator {
        display: none;
    }
}

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

/* Chat above insights on orchestrator */
main {
    display: flex;
    flex-direction: column;
}

#insights-section {
    order: 2;
}

#chat-section {
    order: 1;
}

/* Orchestrator Mobile Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: var(--space-md);
    }

    .orchestrator-link,
    .back-link {
        font-size: 0.85rem;
        padding: var(--space-sm) var(--space-md);
    }

    .insights-grid {
        grid-template-columns: 1fr;
    }

    .insight-card.full-width {
        grid-column: 1;
    }

    .agents-list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }

    .agent-card {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }

    .remove-agent-btn {
        align-self: flex-end;
    }

    /* Metrics card mobile adjustments */
    .metrics-card {
        bottom: var(--space-md);
        right: var(--space-md);
        left: var(--space-md);
        width: auto;
        max-width: none;
    }
}
