﻿/* ============================================================================
   DataChanges Pro - Complete SaaS-Grade Stylesheet
   © 2026 Mubsira Analytics
   ============================================================================ */

/* ============================================================================
   CSS Variables & Design Tokens
   ============================================================================ */
:root {
    /* Colors - Light Theme */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #3b82f6;
    --primary-bg: #eff6ff;
    
    --success: #059669;
    --success-hover: #047857;
    --success-bg: #ecfdf5;
    
    --warning: #8b5cf6;
    --warning-hover: #7c3aed;
    --warning-bg: #f5f3ff;
    
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-bg: #fef2f2;
    
    --info: #0891b2;
    --info-bg: #ecfeff;
    
    /* Neutrals */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Semantic */
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-elevated: #ffffff;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    
    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    
    /* Borders */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
}

/* Dark Theme */
[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-bg: rgba(59, 130, 246, 0.1);
    
    --success-bg: rgba(5, 150, 105, 0.1);
    --warning-bg: rgba(139, 92, 246, 0.1);
    --danger-bg: rgba(220, 38, 38, 0.1);
    --info-bg: rgba(8, 145, 178, 0.1);
    
    --bg-page: #0f172a;
    --bg-card: #1e293b;
    --bg-elevated: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --border-strong: #475569;
    
    --gray-50: #1e293b;
    --gray-100: #334155;
    --gray-200: #475569;
    --gray-700: #cbd5e1;
    --gray-800: #e2e8f0;
    --gray-900: #f1f5f9;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-page);
    min-height: 100vh;
}

/* ============================================================================
   App Container
   ============================================================================ */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================================================
   Unified Dark Mubsira Navigation (matches Aynalyx/DataVariance)
   ============================================================================ */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background-color: rgba(15, 24, 37, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-container {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.02em;
}

.nav-brand .brand-dot { color: #4a8eff; }
.nav-brand .brand-sep {
    opacity: 0.3;
    font-weight: 400;
    margin: 0 4px;
}
.nav-brand .brand-app {
    font-weight: 600;
    opacity: 0.85;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links {
    display: flex;
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    font-size: 13px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    transition: color 0.15s ease;
}

.nav-links a:hover { color: #fff; }

.nav-mobile-only { display: none; }
.nav-mobile-divider { display: none; }
.nav-mobile-controls { display: none; }

.nav-pro-link {
    color: #a78bfa !important;
    font-weight: 600 !important;
}

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

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
}

.nav-btn:hover {
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}

.nav-upgrade-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.nav-upgrade-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    cursor: pointer;
    background: none;
    border: none;
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 1.5px;
    background-color: #fff;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ============================================================================
   Hero Section - Dark, Aynalyx-style clean hero
   ============================================================================ */
.hero-section {
    position: relative;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 50%, #0d1b2a 100%);
    padding: calc(56px + 60px) 0 40px;
    overflow: hidden;
    min-height: auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

.hero-bg-effects {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.hero-grid-pattern {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
}

.hero-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-content {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-main-proposition {
    text-align: center;
    margin-bottom: 32px;
    animation: fadeInUp 0.6s ease-out;
}

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

.hero-main-title {
    font-size: 48px;
    font-weight: 900;
    letter-spacing: -2px;
    margin-bottom: 16px;
    color: #ffffff;
    line-height: 1.1;
}

.hero-main-tagline {
    font-size: 18px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* Privacy Trust Block */
.hero-privacy-block {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 16px;
    padding: 20px 28px;
    margin-bottom: 36px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
    animation: fadeInUp 0.6s ease-out 0.2s;
    animation-fill-mode: both;
}

.privacy-icon-large { flex-shrink: 0; color: #4ade80; }
.privacy-icon-large svg { stroke: #4ade80; }

.privacy-text-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.privacy-headline {
    font-size: 16px;
    font-weight: 700;
    color: #4ade80;
    margin: 0;
}

.privacy-detail {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.5;
    margin: 0;
}

/* Hero CTA Buttons */
.hero-cta-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    animation: fadeInUp 0.6s ease-out 0.4s;
    animation-fill-mode: both;
}

.btn-hero-primary {
    background: #1E40AF;
    color: white;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.25);
    border: none;
}

.btn-hero-primary:hover {
    background: #1E3A8A;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(30, 64, 175, 0.35);
}

.btn-hero-secondary {
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.25);
}

.btn-hero-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}

.btn-large {
    padding: 14px 28px;
    font-size: 16px;
    border-radius: 12px;
}

.btn-glow {
    box-shadow: 0 4px 20px rgba(30, 64, 175, 0.35);
}

/* ============================================================================
   Tool Section
   ============================================================================ */
.tool-section {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
    scroll-margin-top: 80px;
}

/* ============================================================================
   Upload Section
   ============================================================================ */
.upload-section {
    margin-bottom: var(--space-8);
}

.upload-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--space-6);
    align-items: center;
}

.upload-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.upload-dropzone {
    padding: var(--space-10);
    text-align: center;
    cursor: pointer;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    margin: var(--space-4);
    transition: all var(--transition);
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}

.dropzone-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.dropzone-icon svg {
    width: 32px;
    height: 32px;
}

.dropzone-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.dropzone-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.dropzone-hint {
    font-size: 13px;
    color: var(--primary);
    font-weight: 500;
}

.dropzone-formats {
    font-size: 12px;
    color: var(--text-muted);
}

/* File A/B label badge on upload cards */
.dropzone-file-label {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 10px;
    border-radius: var(--radius-full, 100px);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: var(--primary-bg, #eff6ff);
    color: var(--primary, #2563eb);
    border: 1px solid rgba(37, 99, 235, 0.15);
}

/* File Info */
.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    background: var(--success-bg);
    border-top: 1px solid var(--border);
}

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

.file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border-radius: var(--radius);
    color: var(--success);
}

.file-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.file-stats {
    font-size: 12px;
    color: var(--text-muted);
}

.file-actions {
    display: flex;
    gap: 4px;
}

/* Minimalist Icon Buttons */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

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

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

.btn-preview:hover {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
}

.btn-remove:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.preview-data-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.preview-data-btn:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.file-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.file-remove:hover {
    background: var(--danger-bg);
    border-color: var(--danger);
    color: var(--danger);
}

/* Swap Button / Divider */
.swap-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.swap-divider:hover {
    transform: scale(1.05);
}

.swap-divider:active {
    transform: scale(0.95);
}

.swap-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--primary-bg);
    border-radius: var(--radius-full);
    color: var(--primary);
    opacity: 0.8;
    transition: all 0.2s ease;
}

.swap-icon svg {
    transition: transform 0.3s ease;
}

.swap-divider:hover .swap-icon {
    opacity: 1;
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.swap-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    padding: 6px 14px;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    transition: all 0.2s ease;
}

.swap-divider:hover .swap-text {
    background: var(--primary);
    color: white;
}

/* Swap animation */
.swap-divider.swapping .swap-icon svg {
    animation: spin-swap 0.5s ease;
}

@keyframes spin-swap {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(180deg); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35); }
    50% { box-shadow: 0 4px 28px rgba(37, 99, 235, 0.55); }
}

/* Legacy Compare Icon - keep for backwards compatibility */
.upload-compare-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--primary);
}

/* ============================================================================
   Configuration Section
   ============================================================================ */
.config-section {
    margin-bottom: var(--space-8);
}

/* Persistent Collapse Toggle Bar */
.config-collapse-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all var(--transition);
    margin-bottom: var(--space-3);
}

.config-collapse-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

.config-collapse-toggle-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-collapse-toggle-content svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.config-collapse-toggle:hover .config-collapse-toggle-content svg {
    color: var(--primary);
}

.config-collapse-chevron {
    transition: transform 0.25s ease;
    color: var(--text-muted);
    flex-shrink: 0;
}

.config-collapse-toggle[aria-expanded="true"] .config-collapse-chevron {
    transform: rotate(180deg);
}

/* When collapsed, hide the config card but keep the toggle visible */
.config-section.config-collapsed .config-card {
    display: none;
}

/* When expanded, style the toggle bar as connected to the card */
.config-section:not(.config-collapsed) .config-collapse-toggle {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    margin-bottom: 0;
    border-bottom-color: transparent;
    color: var(--primary);
}

.config-section:not(.config-collapsed) .config-collapse-toggle .config-collapse-toggle-content svg {
    color: var(--primary);
}

.config-section:not(.config-collapsed) .config-card {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.config-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-6);
}

.config-header {
    margin-bottom: var(--space-6);
}

.config-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-2);
}

.config-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

.config-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.config-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.config-select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
}

.config-select:hover {
    border-color: var(--border-strong);
}

.config-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.config-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* ============================================================
   Comparison Mode Radio Cards
   ============================================================ */
.compare-mode-group {
    margin-bottom: 4px;
}
.compare-mode-radios {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}
.compare-mode-option {
    flex: 1;
    cursor: pointer;
    position: relative;
}
.compare-mode-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.compare-mode-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg, 12px);
    background: var(--bg-card, #fff);
    transition: all 0.2s ease;
    position: relative;
}
.compare-mode-option:hover .compare-mode-card {
    border-color: var(--primary);
    background: var(--primary-bg, #eff6ff);
}
.compare-mode-option.selected .compare-mode-card {
    border-color: var(--primary);
    background: var(--primary-bg, #eff6ff);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.compare-mode-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--bg-page, #f8fafc);
    color: var(--text-muted);
    transition: all 0.2s ease;
}
.compare-mode-option.selected .compare-mode-icon {
    background: var(--primary);
    color: #fff;
}
.compare-mode-text {
    flex: 1;
    min-width: 0;
}
.compare-mode-text strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}
.compare-mode-text span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}
.compare-mode-badge {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 100px;
    background: #dcfce7;
    color: #166534;
}
[data-theme="dark"] .compare-mode-badge {
    background: rgba(22, 163, 74, 0.15);
    color: #86efac;
}
@media (max-width: 640px) {
    .compare-mode-radios {
        flex-direction: column;
    }
}

/* Context bar mode badges */
.context-mode-badge {
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
}
.context-mode-badge.mode-key {
    background: var(--primary-bg, #eff6ff);
    color: var(--primary, #2563eb);
    border: 1px solid rgba(37, 99, 235, 0.15);
}
.context-mode-badge.mode-position {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid rgba(22, 163, 74, 0.15);
}
[data-theme="dark"] .context-mode-badge.mode-key {
    background: rgba(37, 99, 235, 0.1);
    color: #93c5fd;
    border-color: rgba(37, 99, 235, 0.2);
}
[data-theme="dark"] .context-mode-badge.mode-position {
    background: rgba(22, 163, 74, 0.1);
    color: #86efac;
    border-color: rgba(22, 163, 74, 0.2);
}

/* Key Column Feedback (live analysis) */
.key-column-feedback {
    display: none;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.5;
    margin-top: 8px;
    animation: feedbackSlideIn 0.25s ease;
}
@keyframes feedbackSlideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.key-column-feedback svg {
    flex-shrink: 0;
    margin-top: 1px;
}
.key-column-feedback.feedback-good {
    background: #ecfdf5;
    border: 1px solid rgba(5, 150, 105, 0.2);
    color: #065f46;
}
.key-column-feedback.feedback-good svg {
    color: #059669;
}
.key-column-feedback.feedback-warn {
    background: #fffbeb;
    border: 1px solid rgba(217, 161, 12, 0.25);
    color: #92400e;
}
.key-column-feedback.feedback-warn svg {
    color: #d97706;
}
.key-column-feedback.feedback-bad {
    background: #fef2f2;
    border: 1px solid rgba(220, 38, 38, 0.2);
    color: #991b1b;
}
.key-column-feedback.feedback-bad svg {
    color: #dc2626;
}
.feedback-suggest {
    margin-top: 6px;
    font-size: 12px;
    color: #78716c;
}
.feedback-suggest strong {
    color: #059669;
    font-weight: 600;
}

[data-theme="dark"] .key-column-feedback.feedback-good {
    background: rgba(5, 150, 105, 0.08);
    border-color: rgba(5, 150, 105, 0.2);
    color: #6ee7b7;
}
[data-theme="dark"] .key-column-feedback.feedback-good svg {
    color: #34d399;
}
[data-theme="dark"] .key-column-feedback.feedback-warn {
    background: rgba(217, 161, 12, 0.07);
    border-color: rgba(217, 161, 12, 0.2);
    color: #fbbf24;
}
[data-theme="dark"] .key-column-feedback.feedback-warn svg {
    color: #f59e0b;
}
[data-theme="dark"] .key-column-feedback.feedback-bad {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.2);
    color: #fca5a5;
}
[data-theme="dark"] .key-column-feedback.feedback-bad svg {
    color: #f87171;
}
[data-theme="dark"] .feedback-suggest {
    color: #a8a29e;
}
[data-theme="dark"] .feedback-suggest strong {
    color: #34d399;
}

.config-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    padding: var(--space-4);
    background: var(--bg-page);
    border-radius: var(--radius);
}

.config-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.config-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.config-actions {
    display: flex;
    justify-content: center;
}

/* Columns Select */
.columns-select {
    padding: var(--space-4);
    background: var(--bg-page);
    border-radius: var(--radius);
    margin-bottom: var(--space-6);
}

.columns-checkbox-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.columns-actions {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border);
}

.column-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

/* ============================================================================
   Buttons
   ============================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
}

.btn-sm {
    padding: var(--space-1) var(--space-2);
    font-size: 12px;
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: 15px;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--gray-100);
    border-color: var(--border-strong);
}

.btn-link {
    background: transparent;
    color: var(--primary);
    border: none;
    padding: 0;
}

.btn-link:hover {
    text-decoration: underline;
}

/* ============================================================================
   Results Section
   ============================================================================ */
.results-section {
    animation: fadeIn 0.3s ease;
    scroll-margin-top: 72px;
}

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

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    text-align: center;
    transition: all var(--transition);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-3);
    border-radius: var(--radius);
    font-size: 20px;
    font-weight: 700;
}

.kpi-icon svg {
    width: 22px;
    height: 22px;
}

.kpi-card.neutral .kpi-icon {
    background: var(--gray-100);
    color: var(--gray-600);
}

.kpi-card.up .kpi-icon {
    background: var(--success-bg);
    color: var(--success);
}

.kpi-card.down .kpi-icon {
    background: var(--danger-bg);
    color: var(--danger);
}

.kpi-card.warning .kpi-icon {
    background: var(--warning-bg);
    color: var(--warning);
}

.kpi-card.info .kpi-icon {
    background: var(--info-bg);
    color: var(--info);
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: var(--space-2);
}

.kpi-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.kpi-sublabel {
    font-size: 11px;
    color: var(--text-muted);
}

/* Duplicate KPI Card */
.kpi-card.duplicate .kpi-icon {
    background: #fffbeb;
    color: #b45309;
}
.kpi-card.duplicate .kpi-value {
    color: #b45309;
}

[data-theme="dark"] .kpi-card.duplicate .kpi-icon {
    background: rgba(180, 83, 9, 0.12);
}
[data-theme="dark"] .kpi-card.duplicate .kpi-value {
    color: #fbbf24;
}

/* Duplicate Keys Inline Banner - Informational amber style */
.duplicate-banner {
    display: none;
    padding: var(--space-5) var(--space-6);
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
    border: 1px solid rgba(217, 161, 12, 0.25);
    border-left: 4px solid #d97706;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
}

.duplicate-banner-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #b45309;
    margin-bottom: 6px;
    font-size: 14px;
}

.duplicate-banner-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 99px;
    background: #d97706;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.duplicate-banner-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 12px;
    line-height: 1.6;
}

.duplicate-banner-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: #b45309;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 2px;
    transition: color 0.15s ease;
}
.duplicate-banner-toggle:hover {
    color: #92400e;
}
.duplicate-banner-toggle svg {
    transition: transform 0.2s ease;
}
.duplicate-banner-toggle.expanded svg {
    transform: rotate(180deg);
}

.duplicate-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.duplicate-details.collapsed {
    display: none;
}

.duplicate-file-group {
    font-size: 13px;
    color: var(--text-primary);
}

.duplicate-key-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.duplicate-key-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 99px;
    background: rgba(217, 161, 12, 0.1);
    color: #92400e;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
    border: 1px solid rgba(217, 161, 12, 0.18);
}

.duplicate-key-chip small {
    font-weight: 400;
    opacity: 0.7;
    font-family: var(--font-sans);
}

.duplicate-key-chip.more {
    background: var(--gray-100);
    color: var(--text-muted);
    font-family: var(--font-sans);
    border-color: var(--border);
}

[data-theme="dark"] .duplicate-banner {
    background: linear-gradient(135deg, rgba(217, 161, 12, 0.07) 0%, var(--bg-card) 100%);
    border-color: rgba(217, 161, 12, 0.2);
    border-left-color: #d97706;
}

[data-theme="dark"] .duplicate-banner-header {
    color: #fbbf24;
}

[data-theme="dark"] .duplicate-banner-count {
    background: #b45309;
}

[data-theme="dark"] .duplicate-banner-toggle {
    color: #fbbf24;
}

[data-theme="dark"] .duplicate-key-chip {
    background: rgba(217, 161, 12, 0.12);
    color: #fbbf24;
    border-color: rgba(217, 161, 12, 0.2);
}

/* Filter Tabs */
.filter-tabs-wrapper {
    position: relative;
    margin-bottom: var(--space-6);
}

.filter-tabs-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(to left, var(--gray-100) 0%, transparent 100%);
    border-radius: 0 var(--radius) var(--radius) 0;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.filter-tabs-wrapper.scrolled-end::after {
    opacity: 0;
}

.filter-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: 0;
    padding: var(--space-1);
    background: var(--gray-100);
    border-radius: var(--radius);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filter-tabs::-webkit-scrollbar {
    display: none;
}

.filter-tab {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.filter-tab:hover {
    color: var(--text-primary);
}

.filter-tab.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.tab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
}

.tab-icon.added {
    background: var(--success-bg);
    color: var(--success);
}

.tab-icon.removed {
    background: var(--danger-bg);
    color: var(--danger);
}

.tab-icon.modified {
    background: var(--warning-bg);
    color: var(--warning);
}

.tab-icon.unchanged {
    background: var(--gray-100);
    color: var(--gray-500);
}

.tab-count {
    padding: 2px 6px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.filter-tab.active .tab-count {
    background: var(--primary-bg);
    color: var(--primary);
}

/* Results Card */
.results-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
}

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

.results-title h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.results-count {
    font-size: 13px;
    color: var(--text-muted);
}

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

/* Fullscreen Toggle Button */
.btn-fullscreen {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-left: var(--space-2);
    flex-shrink: 0;
}
.btn-fullscreen:hover {
    background: var(--primary-bg);
    color: var(--primary);
    border-color: var(--primary);
}
.btn-fullscreen svg {
    width: 16px;
    height: 16px;
}

/* Fullscreen Mode for Results Card */
.results-card.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
}

.results-card.fullscreen-mode .results-header {
    flex-shrink: 0;
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--border);
}

.results-card.fullscreen-mode .results-table-container {
    flex: 1;
    max-height: none;
    overflow: auto;
}

.results-card.fullscreen-mode .row-limit-note {
    flex-shrink: 0;
}

.results-card.fullscreen-mode .results-context-bar {
    flex-shrink: 0;
}

/* Hide body overflow when fullscreen is active */
body.fullscreen-active {
    overflow: hidden;
}

/* Fullscreen button icon swap */
.btn-fullscreen .icon-expand { display: block; }
.btn-fullscreen .icon-collapse { display: none; }
.results-card.fullscreen-mode .btn-fullscreen .icon-expand { display: none; }
.results-card.fullscreen-mode .btn-fullscreen .icon-collapse { display: block; }

@media (max-width: 768px) {
    .btn-fullscreen {
        width: 32px;
        height: 32px;
    }
    .results-card.fullscreen-mode .results-header {
        flex-wrap: wrap;
        gap: var(--space-2);
    }
    .results-card.fullscreen-mode .results-actions {
        flex-wrap: wrap;
    }
}

/* Results Context Bar */
.results-context-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 20px;
    background: rgba(37, 99, 235, 0.06);
    border-bottom: 1px solid rgba(37, 99, 235, 0.12);
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}
.results-context-bar .context-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.results-context-bar .context-item svg {
    color: var(--primary);
    flex-shrink: 0;
}
.results-context-bar .context-item strong {
    color: var(--primary);
    font-weight: 600;
}
[data-theme="dark"] .results-context-bar {
    background: rgba(59, 130, 246, 0.08);
    border-bottom-color: rgba(59, 130, 246, 0.15);
}

/* Row Limit Note */
.row-limit-note {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    background: var(--warning-bg);
    border-bottom: 1px solid var(--border);
}

.note-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--warning);
}

.note-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
}

.unlock-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.unlock-link:hover {
    text-decoration: underline;
}

/* Results Table */
.results-table-container {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

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

.results-table th {
    position: sticky;
    top: 0;
    background: var(--bg-page);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.results-table td {
    color: var(--text-primary);
}

/* Key Column Highlighting */
.key-column-header {
    background: rgba(37, 99, 235, 0.12) !important;
    color: var(--primary) !important;
    position: relative;
}
.key-column-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}
.key-badge {
    font-size: 11px;
    margin-left: 2px;
    vertical-align: middle;
}
.key-column-cell {
    font-weight: 600;
    color: var(--primary) !important;
    background: rgba(37, 99, 235, 0.04);
    border-right: 2px solid rgba(37, 99, 235, 0.15);
    white-space: nowrap;
}
[data-theme="dark"] .key-column-header {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #60a5fa !important;
}
[data-theme="dark"] .key-column-header::after {
    background: #60a5fa;
}
[data-theme="dark"] .key-column-cell {
    color: #60a5fa !important;
    background: rgba(59, 130, 246, 0.06);
    border-right-color: rgba(59, 130, 246, 0.2);
}

.row-num {
    color: var(--text-muted);
    font-size: 12px;
    width: 50px;
}

/* Source row number column */
.row-num-source {
    white-space: nowrap;
    font-size: 11px;
    min-width: 80px;
}

th.row-num-source {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Source badges (A: / B:) */
.source-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: var(--radius-sm, 4px);
    margin: 0 1px;
    line-height: 1.4;
    letter-spacing: 0.02em;
}
.source-badge.source-a {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}
.source-badge.source-b {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* Context bar arrow */
.context-arrow {
    color: var(--text-muted);
    margin: 0 2px;
}

/* Context hint (File A/B explanation) */
.context-hint {
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.85;
}

/* Restart button */
.btn-restart {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-md, 8px);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-restart:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
}
.btn-restart svg {
    width: 15px;
    height: 15px;
}

/* Divider between restart and exports */
.results-actions-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.status-added, .status-badge.status-added {
    background: var(--success-bg);
    color: var(--success);
}

.status-removed, .status-badge.status-removed {
    background: var(--danger-bg);
    color: var(--danger);
}

.status-modified, .status-badge.status-modified {
    background: var(--warning-bg);
    color: var(--warning);
}

.status-unchanged, .status-badge.status-unchanged {
    background: var(--gray-100);
    color: var(--gray-500);
}

/* Not Compared status */
.status-notcompared, .status-badge.status-notcompared {
    background: #fff7ed;
    color: #9a3412;
}

[data-theme="dark"] .status-notcompared,
[data-theme="dark"] .status-badge.status-notcompared {
    background: rgba(251, 146, 60, 0.12);
    color: #fb923c;
}

.tab-icon.notcompared {
    background: #fff7ed;
    color: #9a3412;
}

[data-theme="dark"] .tab-icon.notcompared {
    background: rgba(251, 146, 60, 0.12);
    color: #fb923c;
}

/* Row Highlighting */
.row-added {
    background: var(--success-bg);
}

.row-removed {
    background: var(--danger-bg);
}

.row-modified {
    background: var(--warning-bg);
}

.row-notcompared {
    background: #fff7ed;
    opacity: 0.75;
}

[data-theme="dark"] .row-notcompared {
    background: rgba(251, 146, 60, 0.06);
}

.cell-changed {
    font-weight: 600;
    color: var(--warning);
    background: rgba(139, 92, 246, 0.08);
}

/* Enhanced Cell Diff Display */
.cell-diff {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.cell-old-value {
    text-decoration: line-through;
    color: var(--danger);
    opacity: 0.75;
    font-size: 12px;
    font-weight: 500;
}

.cell-arrow {
    color: var(--text-muted);
    font-size: 11px;
    flex-shrink: 0;
}

.cell-new-value {
    color: var(--success);
    font-weight: 700;
    font-size: 13px;
}

/* Change Count Badge */
.change-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--warning);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--radius-full);
    margin-left: 4px;
}

/* Expandable Change Detail Row */
.change-detail-row {
    display: none;
}

.change-detail-row.expanded {
    display: table-row;
    animation: slideDown 0.25s ease;
}

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

.change-detail-content {
    padding: var(--space-4) var(--space-5);
    background: linear-gradient(135deg, var(--warning-bg) 0%, var(--bg-card) 100%);
    border-left: 3px solid var(--warning);
    border-radius: 0 0 var(--radius) var(--radius);
}

.change-detail-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    font-size: 13px;
    color: var(--text-secondary);
}

.change-detail-header svg {
    color: var(--warning);
}

.change-detail-header strong {
    color: var(--text-primary);
}

.change-detail-key {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-page);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.change-detail-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.change-detail-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}

.change-col-name {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 120px;
    flex-shrink: 0;
}

.change-values {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
}

.change-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-right: 4px;
}

.change-old {
    color: var(--danger);
    text-decoration: line-through;
    opacity: 0.85;
    padding: 2px 8px;
    background: var(--danger-bg);
    border-radius: var(--radius-sm);
}

.change-arrow-detail {
    color: var(--text-muted);
    font-size: 12px;
}

.change-new {
    color: var(--success);
    font-weight: 600;
    padding: 2px 8px;
    background: var(--success-bg);
    border-radius: var(--radius-sm);
}

/* Modified row pointer indicator */
.row-modified {
    position: relative;
    cursor: pointer;
}

.row-modified:hover {
    background: rgba(139, 92, 246, 0.06) !important;
}

/* Subtle tap-target highlight on touch devices */
@media (hover: none) and (pointer: coarse) {
    .row-modified {
        -webkit-tap-highlight-color: rgba(139, 92, 246, 0.12);
    }
    
    .row-modified:active {
        background: rgba(139, 92, 246, 0.1) !important;
    }
}

.row-modified.detail-open {
    background: rgba(139, 92, 246, 0.08) !important;
    border-bottom-color: transparent;
}

/* Click hint for modified rows */
.row-modified .status-badge.status-modified::after {
    content: ' ▾';
    font-size: 10px;
    opacity: 0.5;
    display: inline-block;
    transition: transform 0.2s ease;
}

.row-modified.detail-open .status-badge.status-modified::after {
    content: ' ▴';
    opacity: 0.8;
}

/* Mobile: add "tap" label to first modified row for discoverability */
@media (hover: none) and (pointer: coarse) {
    .row-modified .status-badge.status-modified {
        position: relative;
    }
    
    .row-modified .status-badge.status-modified::after {
        content: ' ▾ tap';
        font-size: 9px;
        opacity: 0.5;
        letter-spacing: 0.03em;
    }

    .row-modified.detail-open .status-badge.status-modified::after {
        content: ' ▴';
        opacity: 0.8;
    }
}

/* ============================================================================
   Re-run Banner
   ============================================================================ */
.rerun-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: var(--primary-bg);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
}

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

.rerun-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius);
    color: white;
}

.rerun-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rerun-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.rerun-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.rerun-actions {
    display: flex;
    gap: var(--space-2);
}

.rerun-btn {
    padding: var(--space-2) var(--space-4);
}

/* ============================================================================
   Modals
   ============================================================================ */
/* Preview Modal */
.preview-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.preview-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.preview-modal {
    width: 90%;
    max-width: 1000px;
    max-height: 85vh;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95);
    transition: transform var(--transition);
}

.preview-modal-overlay.visible .preview-modal {
    transform: scale(1);
}

.preview-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
}

.preview-modal-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.preview-modal-title h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.file-badge {
    padding: 2px 8px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.preview-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.preview-modal-close:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.preview-modal-body {
    flex: 1;
    overflow: auto;
    padding: 0;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

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

.preview-table th {
    position: sticky;
    top: 0;
    background: var(--bg-page);
    font-weight: 600;
    color: var(--text-secondary);
}

.preview-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--border);
}

.preview-modal-info {
    font-size: 12px;
    color: var(--text-muted);
}

/* License Modal */
.license-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.license-modal {
    width: 90%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease;
}

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

.license-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5);
    border-bottom: 1px solid var(--border);
}

.license-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.license-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.license-modal-close:hover {
    color: var(--text-primary);
}

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

.license-modal-body p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 var(--space-5);
}

.license-btn-buy {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: var(--space-3) var(--space-5);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.license-btn-buy:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.license-divider {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin: var(--space-5) 0;
    color: var(--text-muted);
    font-size: 12px;
}

.license-divider::before,
.license-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.license-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font-mono);
    color: var(--text-primary);
    transition: all var(--transition);
}

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

.license-input.license-input-error {
    border-color: var(--danger);
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.license-error {
    margin-top: var(--space-2);
    font-size: 13px;
    color: var(--danger);
}

.license-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border);
}

.license-btn-secondary {
    padding: var(--space-2) var(--space-4);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.license-btn-secondary:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.license-btn-primary {
    padding: var(--space-2) var(--space-4);
    background: var(--primary);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all var(--transition);
}

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

/* ============================================================================
   Onboarding Modal
   ============================================================================ */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.onboarding-modal {
    width: 90%;
    max-width: 480px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease;
}

.onboarding-header {
    margin-bottom: var(--space-4);
}

.onboarding-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: var(--primary-bg);
    border-radius: var(--radius-lg);
    color: var(--primary);
}

.onboarding-icon svg {
    width: 40px;
    height: 40px;
}

.onboarding-modal h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 var(--space-2);
}

.onboarding-tagline {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 var(--space-6);
}

.onboarding-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    text-align: left;
}

.onboarding-step {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
}

.onboarding-step .step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 700;
    position: static;
    transform: none;
}

.step-content h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 2px;
}

.step-content p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.onboarding-start {
    width: 100%;
    margin-bottom: var(--space-4);
}

.onboarding-remember {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
}

/* ============================================================================
   Toast Notifications
   ============================================================================ */
.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast-notification {
    display: flex;
    align-items: flex-start;
    padding: var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-width: 400px;
    animation: toastSlideIn 0.3s ease;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes toastFadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast-content {
    flex: 1;
}

.toast-content strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.toast-content p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast-info {
    border-left: 4px solid var(--primary);
}

/* ============================================================================
   Loading Overlay
   ============================================================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    margin: 0 auto var(--space-4);
    animation: spin 1s linear infinite;
}

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

.loading-text {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 var(--space-2);
}

.loading-subtext {
    font-size: 14px;
    opacity: 0.8;
    margin: 0;
}

/* ============================================================================
   Trust / Privacy Banner
   ============================================================================ */
.mubsira-trust-banner {
    background-color: #f5f5f7;
    border-top: 1px solid #d4d6dc;
    border-bottom: 1px solid #d4d6dc;
    padding: 16px 24px;
}
.trust-banner-inner {
    max-width: 1040px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 24px;
}
.trust-banner-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #3b4258;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
.trust-banner-item svg {
    color: #1a2b4a;
    flex-shrink: 0;
}
@media (max-width: 640px) {
    .trust-banner-inner { gap: 12px; justify-content: flex-start; }
    .trust-banner-item { font-size: 11px; }
}

/* ============================================================================
   Unified Dark Footer (matches Aynalyx/DataVariance)
   ============================================================================ */
.site-footer {
    background-color: #0f1825;
    padding: 32px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: auto;
}

.footer-inner {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-copy {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
}

.footer-links {
    display: flex;
    gap: 20px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links a {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-links a:hover { color: rgba(255, 255, 255, 0.8); }

@media (max-width: 640px) {
    .footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }
}

/* ============================================================================
   Smart Analysis Panel
   ============================================================================ */
.smart-analysis-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s ease;
}

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

.smart-analysis-panel.smart-status-ready {
    border-color: var(--success);
    background: linear-gradient(135deg, var(--success-bg) 0%, var(--bg-card) 100%);
}

.smart-analysis-panel.smart-status-detected {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--bg-card) 100%);
}

.smart-analysis-panel.smart-status-manual {
    border-color: var(--warning);
    background: linear-gradient(135deg, var(--warning-bg) 0%, var(--bg-card) 100%);
}

.smart-status {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.smart-status-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.smart-status-ready .smart-status-icon {
    background: var(--success);
    color: white;
}

.smart-status-detected .smart-status-icon {
    background: var(--primary);
    color: white;
}

.smart-status-manual .smart-status-icon {
    background: var(--warning);
    color: white;
}

.smart-status-icon svg {
    width: 24px;
    height: 24px;
}

.smart-status-content h3 {
    margin: 0 0 var(--space-1);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.smart-status-content p {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.smart-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.smart-chip {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 13px;
}

.smart-chip svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

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

.chip-value {
    font-weight: 600;
    color: var(--text-primary);
}

.smart-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.smart-btn-primary,
.smart-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    font-family: var(--font-sans);
}

.smart-btn-primary {
    background: var(--primary);
    color: white;
}

.smart-btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.smart-btn-primary.smart-btn-muted {
    background: var(--gray-500);
}

.smart-btn-primary.smart-btn-muted:hover {
    background: var(--gray-600);
}

.smart-btn-secondary {
    background: var(--bg-page);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.smart-btn-secondary:hover {
    background: var(--gray-100);
    border-color: var(--border-strong);
}

.smart-btn-primary svg,
.smart-btn-secondary svg {
    width: 18px;
    height: 18px;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 var(--space-4);
    }
    
    .nav-links {
        display: none;
    }
    
    .nav-links.is-open {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        background-color: rgba(15, 24, 37, 0.97);
        backdrop-filter: blur(16px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        padding: var(--space-4);
        gap: var(--space-2);
        box-shadow: var(--shadow-lg);
    }
    
    .nav-links.is-open .nav-mobile-only {
        display: list-item;
    }
    
    .nav-links.is-open .nav-mobile-controls {
        display: flex;
        gap: var(--space-2);
        padding-top: var(--space-2);
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .hero-section {
        padding: calc(56px + 28px) var(--space-4) 24px;
    }

    .hero-main-proposition {
        margin-bottom: 20px;
    }
    
    .hero-main-title {
        font-size: 28px;
        letter-spacing: -1px;
    }
    
    .hero-main-tagline {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .hero-privacy-block {
        padding: 14px 16px;
        margin-bottom: 24px;
        gap: 12px;
    }

    .privacy-icon-large svg {
        width: 24px;
        height: 24px;
    }

    .privacy-headline {
        font-size: 14px;
    }

    .privacy-detail {
        font-size: 13px;
    }
    
    .hero-cta-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-large {
        width: 100%;
        justify-content: center;
    }
    
    .tool-section {
        padding: var(--space-6) var(--space-4);
    }
    
    .upload-grid {
        grid-template-columns: 1fr;
    }

    /* Compact dropzones on mobile */
    .upload-dropzone {
        padding: 24px 16px;
    }

    .dropzone-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 4px;
    }

    .dropzone-icon svg {
        width: 24px;
        height: 24px;
    }

    .dropzone-title {
        font-size: 15px;
    }

    .dropzone-subtitle {
        font-size: 13px;
    }
    
    .swap-divider {
        flex-direction: row;
        padding: 16px;
        margin: 8px 0;
    }
    
    .swap-divider .swap-icon {
        width: 40px;
        height: 40px;
    }
    
    .swap-divider .swap-icon svg {
        transform: rotate(90deg);
    }
    
    .upload-compare-icon {
        width: 48px;
        height: 48px;
        margin: 0 auto;
    }
    
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* File info — prevent overflow on mobile */
    .file-info {
        gap: var(--space-2);
        padding: var(--space-3);
        flex-wrap: wrap;
    }

    .file-details {
        min-width: 0;
        overflow: hidden;
        flex: 1 1 0%;
    }

    .file-meta {
        min-width: 0;
        overflow: hidden;
    }

    .file-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
        display: block;
        font-size: 13px;
    }

    .file-stats {
        white-space: normal;
        word-break: break-word;
        font-size: 11px;
        display: block;
    }

    .file-icon {
        flex-shrink: 0;
        width: 32px;
        height: 32px;
    }

    .file-actions {
        flex-shrink: 0;
    }
    
    .filter-tabs {
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }
    
    .results-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: var(--space-2);
    }
    
    .results-actions .btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        justify-content: center;
    }
    
    .rerun-banner {
        flex-direction: column;
        gap: var(--space-4);
    }
    
    .rerun-actions {
        width: 100%;
    }
    
    .rerun-btn {
        flex: 1;
    }
    
    .smart-analysis-panel {
        padding: var(--space-4);
    }
    
    .smart-status {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .smart-chips {
        justify-content: center;
    }
    
    .smart-actions {
        flex-direction: column;
        gap: var(--space-3);
    }
    
    .smart-btn-primary,
    .smart-btn-secondary {
        width: 100%;
        justify-content: center;
    }

    /* Make Quick Compare CTA dominant on mobile */
    .smart-btn-primary:not(.smart-btn-muted) {
        padding: 16px var(--space-5);
        font-size: 16px;
        font-weight: 700;
        border-radius: var(--radius-md);
        box-shadow: 0 4px 20px rgba(37, 99, 235, 0.35);
        animation: pulseGlow 2s ease-in-out infinite;
    }

    .smart-btn-secondary {
        padding: 10px var(--space-5);
        font-size: 13px;
        font-weight: 500;
        opacity: 0.8;
    }

    /* --- Context bar: allow text wrapping on mobile --- */
    .results-context-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
        padding: var(--space-3) var(--space-4);
        font-size: 11px;
    }

    .results-context-bar .context-item {
        flex-wrap: wrap;
        word-break: break-word;
    }

    .results-context-bar .context-hint {
        display: none;
    }

    /* --- Filter tabs: subtle hint that they are tappable --- */
    .filter-tab {
        position: relative;
    }

    .filter-tab:not(.active)::after {
        content: '';
        display: inline-block;
        width: 0;
        height: 0;
        border-left: 3px solid transparent;
        border-right: 3px solid transparent;
        border-top: 4px solid var(--text-muted);
        margin-left: 4px;
        opacity: 0.4;
        vertical-align: middle;
    }

    .filter-tab.active::after {
        content: none;
    }

    /* --- Modified rows: add chevron expand indicator --- */
    .row-modified td:first-child {
        position: relative;
    }

    .row-modified td:first-child::before {
        content: '›';
        display: inline-block;
        font-size: 14px;
        font-weight: 700;
        color: var(--warning);
        opacity: 0.6;
        margin-right: 4px;
        transition: transform 0.2s ease;
        transform: rotate(0deg);
    }

    .row-modified.detail-open td:first-child::before {
        transform: rotate(90deg);
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-2);
    }

    .kpi-card {
        padding: var(--space-3);
    }

    .kpi-icon {
        width: 32px;
        height: 32px;
        margin-bottom: var(--space-2);
    }

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

    .kpi-value {
        font-size: 20px;
        margin-bottom: 2px;
    }

    .kpi-label {
        font-size: 11px;
    }

    .kpi-sublabel {
        font-size: 10px;
    }
    
    .onboarding-modal {
        padding: var(--space-6);
    }
    
    .toast-container {
        left: var(--space-4);
        right: var(--space-4);
        bottom: var(--space-4);
    }
    
    .toast-notification {
        min-width: auto;
        max-width: none;
    }
    
    .change-detail-item {
        flex-direction: column;
        align-items: flex-start;
       }
    
    .change-col-name {
        min-width: auto;
    }
    
    .change-values {
        flex-wrap: wrap;
    }
}

/* ============================================================================
   Dark Mode Adjustments
   ============================================================================ */
[data-theme="dark"] .smart-analysis-panel {
    background: var(--bg-card);
}

[data-theme="dark"] .smart-analysis-panel.smart-status-ready {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.1) 0%, var(--bg-card) 100%);
}

[data-theme="dark"] .smart-analysis-panel.smart-status-detected {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, var(--bg-card) 100%);
}

[data-theme="dark"] .smart-analysis-panel.smart-status-manual {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, var(--bg-card) 100%);
}

[data-theme="dark"] .smart-chip {
    background: var(--bg-elevated);
}

[data-theme="dark"] .smart-btn-secondary {
    background: var(--bg-elevated);
}

[data-theme="dark"] .smart-btn-secondary:hover {
    background: var(--gray-700);
}

[data-theme="dark"] .change-detail-content {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, var(--bg-card) 100%);
}

[data-theme="dark"] .change-detail-item {
    background: var(--bg-elevated);
    border-color: var(--border);
}

[data-theme="dark"] .change-old {
    background: rgba(220, 38, 38, 0.15);
}

[data-theme="dark"] .change-new {
    background: rgba(5, 150, 105, 0.15);
}

[data-theme="dark"] .upload-dropzone {
    border-color: var(--border);
}

[data-theme="dark"] .upload-dropzone:hover,
[data-theme="dark"] .upload-dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

[data-theme="dark"] .dropzone-icon {
    background: var(--bg-elevated);
}

[data-theme="dark"] .filter-tabs {
    background: var(--bg-elevated);
}

[data-theme="dark"] .filter-tabs-wrapper::after {
    background: linear-gradient(to left, var(--bg-elevated) 0%, transparent 100%);
}

[data-theme="dark"] .filter-tab.active {
    background: var(--bg-card);
}

/* ============================================================================
   HOW IT WORKS SECTION
   ============================================================================ */
.how-it-works {
    background: var(--bg-page);
    border-top: 1px solid var(--border);
    padding: var(--space-12) var(--space-6);
    scroll-margin-top: 56px;
}

.section-header {
    margin-bottom: 40px;
}

.section-header.centered {
    text-align: center;
}

.section-overline {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--primary);
    margin-bottom: 8px;
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.section-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    position: relative;
    transition: all 0.2s;
}

.step-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.step-card.highlighted {
    border-color: var(--primary);
    background: linear-gradient(180deg, var(--primary-bg) 0%, var(--bg-card) 100%);
}

.step-number {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
    color: white;
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-icon {
    width: 64px;
    height: 64px;
    margin: 8px auto 16px;
    background: var(--primary-bg);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-icon svg {
    width: 32px;
    height: 32px;
    stroke: var(--primary);
}

.step-card h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.step-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Features Highlight */
.features-highlight {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 40px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.features-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.features-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.features-icon svg {
    width: 24px;
    height: 24px;
    stroke: white;
}

.features-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.features-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 4px 0 0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 32px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.feature-check {
    width: 24px;
    height: 24px;
    background: var(--success-bg);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.feature-check svg {
    width: 14px;
    height: 14px;
    stroke: var(--success);
}

.feature-item strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.feature-item span {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* How It Works Responsive */
@media (max-width: 900px) {
    .steps-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .step-card {
        max-width: 400px;
        margin: 0 auto;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .how-it-works {
        padding: var(--space-8) var(--space-4);
    }
    
    .section-title {
        font-size: 24px;
    }
    
    .features-highlight {
        padding: var(--space-5);
    }
    
    .features-header {
        flex-direction: column;
        text-align: center;
    }
}

/* Dark Mode - How It Works */
[data-theme="dark"] .how-it-works {
    background: var(--bg-page);
}

[data-theme="dark"] .step-card {
    background: var(--bg-card);
}

[data-theme="dark"] .step-card.highlighted {
    background: linear-gradient(180deg, var(--primary-bg) 0%, var(--bg-card) 100%);
}

[data-theme="dark"] .step-icon {
    background: var(--primary-bg);
}

[data-theme="dark"] .features-highlight {
    background: var(--bg-card);
}

[data-theme="dark"] .feature-check {
    background: var(--success-bg);
}

/* ============================================================================
   WHAT'S NEXT - Mubsira Workflow Recommendations
   ============================================================================ */
.workflow-card {
    margin-top: 32px;
    padding: 28px 32px;
    border-radius: 16px;
    border: 1.5px solid var(--border);
    background: var(--bg-card);
}

.workflow-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

/* Collapsible toggle header */
.workflow-toggle {
    width: 100%;
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: inherit;
    outline: none;
    margin-bottom: 0;
}

.workflow-toggle[aria-expanded="false"] {
    margin-bottom: 0;
}

.workflow-toggle[aria-expanded="true"] {
    margin-bottom: 20px;
}

.workflow-card-header-text {
    flex: 1;
    min-width: 0;
}

.workflow-chevron {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--text-muted);
    transition: transform 0.3s ease, background 0.25s;
}

.workflow-chevron svg {
    width: 16px;
    height: 16px;
}

.workflow-toggle[aria-expanded="true"] .workflow-chevron {
    transform: rotate(180deg);
    background: var(--primary);
    color: #fff;
}

.workflow-toggle:hover .workflow-chevron {
    background: var(--primary);
    color: #fff;
}

.workflow-header-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--info-bg);
    color: var(--info);
    display: flex;
    align-items: center;
    justify-content: center;
}

.workflow-header-icon svg {
    width: 22px;
    height: 22px;
}

.workflow-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
    margin: 0;
}

.workflow-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}

.workflow-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.3s ease;
    max-height: 2000px;
    opacity: 1;
}

.workflow-grid.workflow-collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

.workflow-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    text-decoration: none;
    color: inherit;
    transition: all 0.25s ease;
}

.workflow-item:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.1);
    transform: translateY(-2px);
}

.workflow-item.workflow-recommended {
    border-color: var(--primary-light);
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--primary-bg) 100%);
}

.workflow-item.workflow-recommended:hover {
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--bg-card) 100%);
}

.workflow-item-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.workflow-item-icon svg {
    width: 22px;
    height: 22px;
}

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

.workflow-item-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 2px;
}

.workflow-item-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.workflow-badge {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 10px;
    border-radius: 99px;
    background: var(--primary);
    color: #fff;
    line-height: 1.5;
}

.workflow-item-reason {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.workflow-item-arrow {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
}

.workflow-item-arrow svg {
    width: 16px;
    height: 16px;
}

.workflow-item:hover .workflow-item-arrow {
    background: var(--primary);
    color: #fff;
    transform: translateX(4px);
}

/* Dark theme overrides */
[data-theme="dark"] .workflow-card {
    background: var(--bg-card);
    border-color: var(--border);
}

[data-theme="dark"] .workflow-item {
    background: var(--bg-card);
    border-color: var(--border);
}

[data-theme="dark"] .workflow-item.workflow-recommended {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--primary-bg) 100%);
}

/* Mobile responsive */
@media (max-width: 640px) {
    .workflow-card {
        padding: 20px 16px;
    }

    .workflow-item {
        padding: 14px 16px;
        gap: 12px;
    }

    .workflow-item-arrow {
        display: none;
    }
}
