/* ===== CSS Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Theme Colors matching Hive Detect reference */
    --bg-light: #f7f6ff;
    --bg-gradient: linear-gradient(135deg, #f7f6ff 0%, #edf0fe 50%, #f5f3ff 100%);
    --card-bg: #ffffff;
    --card-border: #e2e0f8;
    
    --primary-purple: #5c46e5;
    --primary-purple-hover: #4a35d0;
    --pill-bg: #ede9fe;
    --pill-border: #ddd6fe;
    --pill-text: #4338ca;
    
    --text-primary: #1e1b4b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --success-color: #10b981;
    --error-color: #ef4444;
    
    /* Spacing & Radius */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(99, 102, 241, 0.04);
    --shadow-md: 0 6px 16px rgba(99, 102, 241, 0.06);
    --shadow-lg: 0 16px 36px -8px rgba(99, 102, 241, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

body {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Soft Ambient Gradient */
.gradient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient);
    z-index: -1;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Header Navbar */
.header {
    background: #ffffff;
    border-bottom: 1px solid #e8e6f5;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.03);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-bars {
    display: flex;
    gap: 3px;
    align-items: center;
}

.logo-bar {
    width: 4px;
    height: 18px;
    background: var(--primary-purple);
    border-radius: 2px;
}

.logo-bar:nth-child(2) {
    height: 24px;
}

.logo-bar:nth-child(3) {
    height: 14px;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.nav-item {
    cursor: pointer;
    transition: color 0.2s ease;
}

.nav-item:hover {
    color: var(--primary-purple);
}

.btn-nav-upload {
    background: var(--primary-purple);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-nav-upload:hover {
    background: var(--primary-purple-hover);
}

.lang-switcher {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 20px;
    padding: 3px;
    border: 1px solid #e2e8f0;
}

.lang-btn {
    background: transparent;
    border: none;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    color: var(--primary-purple);
}

.lang-btn.active {
    background: var(--primary-purple);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(92, 70, 229, 0.25);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f1f5f9;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

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

.status-dot.connected {
    background: var(--success-color);
}

/* Main Layout */
.main-content {
    padding: 20px 0;
}

/* Hero Header (Centered Top Description) */
.hero-header {
    text-align: center;
    max-width: 860px;
    margin: 0 auto 16px auto;
}

.hero-title {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.25;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}

.hero-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.feature-pills-centered {
    display: flex;
    justify-content: center;
}

.feature-pill {
    background: var(--pill-bg);
    border: 1px solid var(--pill-border);
    padding: 8px 18px;
    border-radius: 12px;
    color: var(--pill-text);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
    display: inline-block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(92, 70, 229, 0.1);
}

/* Detection Demo Visual */
.detection-demo-box {
    display: flex;
    gap: 16px;
    margin-top: 20px;
}

.demo-card {
    width: 130px;
    height: 130px;
    background: #ffffff;
    border-radius: 16px;
    border: 2px solid #5c46e5;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.08);
}

.demo-card.demo-fake {
    border-color: #5c46e5;
}

.demo-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    color: #ffffff;
}

.badge-real {
    background: #2563eb;
}

.badge-fake {
    background: #5c46e5;
}

/* Hero Upload Right Column */
.hero-upload-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 18px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-lg);
}

.upload-area {
    border: 2px dashed #c7d2fe;
    border-radius: 14px;
    padding: 16px 14px;
    text-align: center;
    background: #faf9ff;
    transition: all 0.2s ease;
    cursor: pointer;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary-purple);
    background: #f0ebff;
}

.upload-icon-wrapper {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #eef2ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.upload-headline {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.upload-subheadline {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.btn {
    font-family: inherit;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-browse {
    background: var(--primary-purple);
    color: #ffffff;
    padding: 8px 18px;
    font-size: 0.85rem;
}

.btn-browse:hover {
    background: var(--primary-purple-hover);
    transform: translateY(-1px);
}

.divider-or {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 10px 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.divider-or::before, .divider-or::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}

.divider-or span {
    padding: 0 10px;
}

.url-input-group {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 6px 12px;
    margin-bottom: 12px;
}

.url-icon {
    font-size: 0.95rem;
    margin-right: 6px;
    color: var(--text-muted);
}

.url-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--text-primary);
    outline: none;
}

.btn-primary {
    background: var(--primary-purple);
    color: #ffffff;
    width: 100%;
    padding: 10px;
    font-size: 0.9rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(92, 70, 229, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-purple-hover);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* Upload Footer Info */
.upload-footer-info {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.upload-footer-info a {
    color: var(--primary-purple);
    text-decoration: underline;
}

.formats-text {
    font-size: 0.75rem;
    color: #94a3b8;
}

.formats-text strong {
    color: var(--text-secondary);
}

/* Media Preview */
.media-preview {
    position: relative;
    width: 100%;
}

.media-preview img {
    max-width: 100%;
    max-height: 220px;
    border-radius: 12px;
}

.audio-preview-box {
    padding: 20px;
    background: #eef2ff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--primary-purple);
}

.btn-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #ef4444;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Grid Layout for Upload & Chat */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
    align-items: stretch;
}

.chat-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Chat Section */
.chat-messages {
    flex: 1;
    min-height: 320px;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    margin-bottom: 16px;
}

.welcome-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 10px;
    font-size: 0.95rem;
}

.message {
    margin-bottom: 14px;
}

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

.message-content {
    display: inline-block;
    padding: 12px 18px;
    border-radius: 14px;
    max-width: 90%;
    font-size: 0.9rem;
    line-height: 1.6;
    word-break: break-word;
}

.message.user .message-content {
    background: var(--primary-purple);
    color: #ffffff;
}

.message.agent .message-content {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: var(--text-primary);
    display: block;
    width: 100%;
}

/* Markdown HTML Elements inside Agent Chat Messages */
.message-content.markdown-body h1,
.message-content.markdown-body h2,
.message-content.markdown-body h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-top: 12px;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.message-content.markdown-body p {
    margin-bottom: 8px;
}

.message-content.markdown-body ul,
.message-content.markdown-body ol {
    margin-left: 20px;
    margin-bottom: 10px;
}

.message-content.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 0.82rem;
}

.message-content.markdown-body th,
.message-content.markdown-body td {
    border: 1px solid #cbd5e1;
    padding: 6px 10px;
    text-align: left;
}

.message-content.markdown-body th {
    background: #f1f5f9;
    font-weight: 700;
}

.message-content.markdown-body code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.82rem;
}

.message.system .message-content {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    display: block;
    max-width: 100%;
    text-align: center;
}

.chat-input-container {
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}

.chat-input:focus {
    border-color: var(--primary-purple);
    background: #ffffff;
}

.btn-send {
    padding: 12px 18px;
    background: var(--primary-purple);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    cursor: pointer;
    font-size: 1rem;
}

/* Results Display */
.results-card {
    grid-column: 1 / -1;
}

.result-prediction {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.prediction-label {
    font-size: 1.6rem;
    font-weight: 800;
    padding: 8px 24px;
    border-radius: 12px;
}

.prediction-label.realism,
.prediction-label.real {
    background: #dcfce7;
    color: #15803d;
}

.prediction-label.deepfake,
.prediction-label.fake {
    background: #fee2e2;
    color: #b91c1c;
}

.prediction-confidence {
    font-size: 1rem;
    color: var(--text-secondary);
}

#confidenceValue {
    font-weight: 800;
    color: var(--text-primary);
}

.confidence-meter {
    margin-bottom: 20px;
}

.meter-bar {
    height: 14px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    background: var(--primary-purple);
    border-radius: 10px;
    transition: width 0.8s ease;
}

.detailed-scores {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 0.88rem;
}

.explanation-section {
    margin-top: 20px;
    padding: 18px;
    background: #f5f3ff;
    border-left: 4px solid var(--primary-purple);
    border-radius: 10px;
}

.explanation-section h4 {
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.explanation-text {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
}

/* Floating Agent Status */
.agent-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #ffffff;
    padding: 12px 20px;
    border-radius: 20px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-lg);
    z-index: 200;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.status-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top-color: var(--primary-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    border-top: 1px solid #e8e6f5;
}

@media (max-width: 900px) {
    .hero-split {
        grid-template-columns: 1fr;
    }
    .content-grid {
        grid-template-columns: 1fr;
    }
    .nav-links {
        display: none;
    }
}

/* ========================================================================= */
/* ⚡ LIVE BENCHMARK HUB & TERMINAL CONSOLE STYLING (OPTION A + B)           */
/* ========================================================================= */

.btn-benchmark-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 100%);
    border: 1px solid #c7d2fe;
    border-radius: 20px;
    color: #4338ca;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-benchmark-nav:hover {
    background: #6366f1;
    color: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    transform: translateY(-1px);
}

.benchmark-card {
    border: 1px solid #e0e7ff;
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.08), 0 8px 10px -6px rgba(99, 102, 241, 0.04);
    background: #ffffff;
    border-radius: 18px;
    padding: 24px;
    transition: all 0.3s ease;
}

.benchmark-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 16px;
    margin-bottom: 18px;
}

.benchmark-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.benchmark-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.benchmark-badge.idle {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.benchmark-badge.running {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    animation: pulse 1.5s infinite;
}

.benchmark-badge.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

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

.benchmark-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.benchmark-select {
    padding: 7px 12px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 0.82rem;
    font-weight: 600;
    color: #1e293b;
    outline: none;
    cursor: pointer;
}

.benchmark-select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.btn-start-bench {
    background: #10b981;
    color: #ffffff;
    font-weight: 700;
    padding: 7px 14px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.2s ease;
}

.btn-start-bench:hover:not(:disabled) {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-stop-bench {
    background: #ef4444;
    color: #ffffff;
    font-weight: 700;
    padding: 7px 14px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.2s ease;
}

.btn-stop-bench:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-view-report {
    background: #3b82f6;
    color: #ffffff;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
}

.btn-view-report:hover {
    background: #2563eb;
}

.btn-clear-logs {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
    padding: 7px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.82rem;
}

.btn-clear-logs:hover {
    background: #f1f5f9;
    color: #1e293b;
}

/* Metric Cards Grid */
.benchmark-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.bench-metric-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.bench-metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bench-metric-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: #0f172a;
    margin: 4px 0 2px 0;
}

.bench-metric-val.highlight {
    color: #6366f1;
}

.bench-metric-val.mono {
    font-size: 0.85rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: #059669;
}

.bench-progress-bar {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}

.bench-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #10b981 100%);
    width: 0%;
    transition: width 0.3s ease;
}

/* Live Terminal Window */
.live-terminal-container {
    background: #0b0f19;
    border-radius: 14px;
    border: 1px solid #1e293b;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.terminal-bar {
    background: #111827;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #1f2937;
}

.terminal-dots {
    display: flex;
    gap: 6px;
}

.terminal-dots .dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
}

.terminal-dots .dot.red { background: #ef4444; }
.terminal-dots .dot.yellow { background: #f59e0b; }
.terminal-dots .dot.green { background: #10b981; }

.terminal-title {
    color: #94a3b8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.76rem;
    font-weight: 600;
}

.terminal-options {
    color: #94a3b8;
    font-size: 0.76rem;
}

.terminal-autoscroll-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    user-select: none;
}

.terminal-body {
    padding: 14px 16px;
    height: 240px;
    overflow-y: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.55;
    color: #e2e8f0;
}

.terminal-body::-webkit-scrollbar {
    width: 6px;
}

.terminal-body::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

.terminal-line {
    word-break: break-all;
    white-space: pre-wrap;
    margin-bottom: 2px;
}

.terminal-line.comment { color: #64748b; font-style: italic; }
.terminal-line .lvl-info { color: #38bdf8; font-weight: 700; }
.terminal-line .lvl-metric { color: #facc15; font-weight: 700; }
.terminal-line .lvl-warn { color: #fb923c; font-weight: 700; }
.terminal-line .lvl-error { color: #f87171; font-weight: 700; }
.terminal-line .tag-match { color: #4ade80; font-weight: 700; }
.terminal-line .tag-mismatch { color: #f87171; font-weight: 700; }
.terminal-line .timestamp { color: #475569; }

/* Modal Styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-dialog {
    background: #ffffff;
    border-radius: 16px;
    width: 95vw;
    max-width: 1200px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    animation: modalSlide 0.25s ease-out;
}

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

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
}

.btn-close-modal:hover {
    color: #0f172a;
    background: #e2e8f0;
}

.modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    font-size: 0.92rem;
    line-height: 1.65;
    color: #334155;
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    background: #f8fafc;
}

/* =========================================================================
   MARKDOWN FORENSIC REPORT & TABLE STYLING
   ========================================================================= */
.markdown-body {
    overflow-x: auto;
}

.markdown-body h1 {
    font-size: 1.45rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 12px;
}

.markdown-body h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
    margin-top: 24px;
    margin-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 6px;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0 24px 0;
    font-size: 0.88rem;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.markdown-body th {
    background: #f1f5f9;
    color: #0f172a;
    font-weight: 700;
    padding: 11px 14px;
    border: 1px solid #cbd5e1;
    text-align: center;
    white-space: nowrap;
}

.markdown-body td {
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    color: #334155;
    vertical-align: middle;
}

.markdown-body tr:nth-child(even) td {
    background-color: #f8fafc;
}

.markdown-body tr:hover td {
    background-color: #f0fdf4;
}

.markdown-body code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.84rem;
    color: #0f172a;
    border: 1px solid #e2e8f0;
}

.markdown-body pre {
    background: #0f172a;
    color: #f8fafc;
    padding: 14px 18px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.85rem;
    margin: 16px 0;
}

.markdown-body pre code {
    background: transparent;
    color: inherit;
    border: none;
    padding: 0;
}

/* ===== Ablation Study & Subnav Styles ===== */
.btn-subtab:hover {
    color: #4338ca !important;
    background-color: #f5f3ff !important;
}

.btn-subtab.active {
    color: #4338ca !important;
    border-bottom: 3px solid #4338ca !important;
    font-weight: 700 !important;
}

#ablationGridTable tr:hover {
    background-color: #f1f5f9 !important;
}

/* ========================================================= */
/* 🌟 GENERATIVE UI (GenUI) - MULTI-AGENT LIVE FORENSIC STUDIO */
/* ========================================================= */

.genui-stepper-card {
    background: linear-gradient(135deg, #090d16 0%, #111827 50%, #1e1b4b 100%);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 18px;
    padding: 24px;
    color: #f8fafc;
    box-shadow: 0 16px 36px -8px rgba(67, 56, 202, 0.35);
    margin-top: 24px;
    position: relative;
    overflow: hidden;
}

.genui-stepper-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(124, 77, 255, 0.15) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.genui-radar-dot {
    width: 10px;
    height: 10px;
    background-color: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 10px #10b981;
    animation: radarPulse 1.8s infinite;
}

@keyframes radarPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.15); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.genui-stepper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    position: relative;
    z-index: 1;
}

.genui-step-item {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    backdrop-filter: blur(8px);
}

.genui-step-item:hover {
    border-color: rgba(129, 140, 248, 0.4);
    transform: translateY(-2px);
}

.genui-step-item.active {
    border-color: #6366f1;
    background: rgba(30, 27, 75, 0.85);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.35);
}

.genui-step-item.done {
    border-color: rgba(16, 185, 129, 0.6);
    background: rgba(6, 78, 59, 0.25);
}

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

.genui-step-icon {
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.genui-step-item.active .genui-step-icon {
    background: rgba(99, 102, 241, 0.3);
    animation: iconBounce 1s infinite alternate;
}

@keyframes iconBounce {
    from { transform: translateY(0); }
    to { transform: translateY(-3px); }
}

.genui-step-meta {
    flex: 1;
}

.genui-step-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #e2e8f0;
}

.genui-step-task {
    font-size: 0.72rem;
    color: #94a3b8;
}

.genui-step-status {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    text-transform: uppercase;
}

.genui-step-item.active .genui-step-status {
    background: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.6);
}

.genui-step-item.done .genui-step-status {
    background: rgba(16, 185, 129, 0.25);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.5);
}

.genui-step-metric {
    font-size: 0.78rem;
    color: #cbd5e1;
    margin: 8px 0;
    min-height: 20px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

.genui-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.genui-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #10b981);
    transition: width 0.4s ease;
}

/* ========================================================= */
/* 🔬 INTERACTIVE FORENSIC EVIDENCE STUDIO ARTIFACTS */
/* ========================================================= */

.genui-studio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 18px;
    margin-top: 24px;
}

.genui-artifact-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
}

.genui-artifact-card.gold-border {
    border: 1.5px solid #d97706;
    background: linear-gradient(180deg, #fffdfa 0%, #ffffff 100%);
    box-shadow: 0 8px 24px rgba(217, 119, 6, 0.12);
}

.genui-artifact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
    margin-bottom: 14px;
}

.genui-artifact-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.genui-artifact-badge {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 700;
}

/* Split-Slider (Before / After 2D-DWT High Frequency) */
.split-slider-wrapper {
    position: relative;
    width: 100%;
    height: 260px;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    user-select: none;
    cursor: ew-resize;
}

.split-slider-img-after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #0f172a;
}

.split-slider-img-before-wrap {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 50%;
    overflow: hidden;
    border-right: 2px solid #ffffff;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.split-slider-img-before {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    object-fit: contain;
    background: #0f172a;
}

.split-slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #4338ca;
    z-index: 10;
    pointer-events: none;
    font-size: 0.85rem;
}

.split-slider-label {
    position: absolute;
    bottom: 8px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.65);
    z-index: 5;
    pointer-events: none;
}

.split-slider-label.left { left: 8px; }
.split-slider-label.right { right: 8px; }

/* GenUI Artifact Tab Switcher */
.genui-tab-bar {
    display: flex;
    gap: 6px;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-bottom: 10px;
}

.genui-tab-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.genui-tab-btn:hover {
    color: #1e293b;
    background: rgba(255, 255, 255, 0.7);
}

.genui-tab-btn.active {
    background: #ffffff;
    color: #4338ca;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.genui-tab-btn.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Corneal Ray-Tracing Canvas */
.corneal-canvas-box {
    position: relative;
    width: 100%;
    height: 240px;
    background: #090d16;
    border-radius: 12px;
    overflow: hidden;
}

.corneal-canvas-box canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Interactive Decision Threshold Panel */
.threshold-panel {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #e2e8f0;
}

.threshold-slider-group {
    margin-bottom: 14px;
}

.threshold-slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.threshold-slider-header span.val {
    color: #4338ca;
    font-family: monospace;
    font-weight: 700;
}

.threshold-range-input {
    width: 100%;
    height: 6px;
    border-radius: 4px;
    background: #cbd5e1;
    outline: none;
    cursor: pointer;
    accent-color: #4338ca;
}

.threshold-recalc-box {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.threshold-verdict-pill {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 800;
    text-align: center;
    color: #ffffff;
}

/* Multi-Agent Debate Accordion */
.debate-thread {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 4px;
}

.debate-bubble {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.82rem;
    line-height: 1.45;
    border-left: 3px solid #6366f1;
    background: #f8fafc;
}

.debate-bubble.vision { border-color: #3b82f6; background: #eff6ff; }
.debate-bubble.corneal { border-color: #8b5cf6; background: #f5f3ff; }
.debate-bubble.lipsync { border-color: #ec4899; background: #fdf2f8; }
.debate-bubble.magistrate { border-color: #10b981; background: #f0fdf4; }

.debate-speaker {
    font-weight: 700;
    font-size: 0.78rem;
    margin-bottom: 2px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Auditable Certificate Stamp */
.cert-seal-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #166534 0%, #15803d 100%);
    color: #ffffff;
    font-weight: 800;
    font-size: 0.78rem;
    padding: 6px 14px;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(22, 101, 52, 0.25);
    letter-spacing: 0.5px;
}

.btn-download-advisor-docx {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 18px;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
    transition: all 0.2s;
    margin-top: 14px;
}

.btn-download-advisor-docx:hover {
    background: linear-gradient(135deg, #172554 0%, #1d4ed8 100%);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

/* ===== Visual 6-Step Forensic Detection Pipeline Banner ===== */
.forensic-pipeline-banner {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.05);
}

.pipeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
    margin-bottom: 14px;
}

.pipeline-pulse-icon {
    font-size: 1.1rem;
    color: #f59e0b;
}

.pipeline-route-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.pipeline-route-badge.dual-stream {
    background: #fdf2f8;
    color: #db2777;
    border-color: #fbcfe8;
}

.pipeline-steps-grid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.pipeline-step-node {
    flex: 1;
    min-width: 110px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
    transition: all 0.2s ease;
}

.pipeline-step-node.active {
    background: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}

.pipeline-step-node.bypassed {
    background: #f1f5f9;
    border-color: #cbd5e1;
    opacity: 0.75;
}

.pipeline-step-node .step-num {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #6366f1;
    margin-bottom: 3px;
}

.pipeline-step-node.bypassed .step-num {
    color: #64748b;
}

.pipeline-step-node .step-icon {
    font-size: 1.25rem;
    margin-bottom: 4px;
}

.pipeline-step-node .step-name {
    font-size: 0.74rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2px;
    line-height: 1.25;
    word-break: break-word;
}

.pipeline-step-node .step-desc {
    font-size: 0.68rem;
    color: #64748b;
    line-height: 1.25;
    word-break: break-word;
}

.pipeline-arrow {
    color: #cbd5e1;
    font-weight: bold;
    font-size: 0.85rem;
    user-select: none;
}

/* Chat Dispute Chips */
.chat-dispute-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.chat-dispute-chip {
    font-size: 0.72rem;
    padding: 5px 10px;
    background: #f1f5f9;
    color: #4338ca;
    border: 1px solid #e0e7ff;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 600;
}

.chat-dispute-chip:hover {
    background: #e0e7ff;
    color: #3730a3;
    border-color: #c7d2fe;
}

/* ===== Option A: Compact Forensic Badge & Non-Pushing Chat Flow ===== */
.chat-forensic-summary.compact-mode {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-forensic-summary.compact-mode:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.06);
}

.compact-action-bar button {
    cursor: pointer;
    font-family: inherit;
    line-height: 1.3;
}

.compact-action-bar button:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

.compact-action-bar button:active {
    transform: translateY(0);
}

.chat-forensic-collapsible {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
}

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

.chat-forensic-collapsible::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 4px;
}

.chat-forensic-collapsible::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.chat-forensic-collapsible::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Glowing Pulse Animation for Jumping to Certificate Card */
@keyframes certGlowPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(92, 70, 229, 0.7), 0 4px 12px rgba(217, 119, 6, 0.2);
        border-color: #5c46e5 !important;
    }
    40% {
        box-shadow: 0 0 0 10px rgba(92, 70, 229, 0.22), 0 8px 30px rgba(217, 119, 6, 0.4);
        border-color: #d97706 !important;
        transform: scale(1.012);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(92, 70, 229, 0), 0 2px 8px rgba(0, 0, 0, 0.05);
        border-color: #fed7aa;
        transform: scale(1);
    }
}

.glow-highlight {
    animation: certGlowPulse 2.4s ease-out !important;
}
