/* ============================================================
   DDR AI — Enterprise Design System
   Premium dark theme · Glassmorphism · AI SaaS Aesthetic
   ============================================================ */

/* ── 1. DESIGN TOKENS ─────────────────────────────────────── */
:root {
    /* Surfaces */
    --bg-base:        #080A0F;
    --bg-surface:     #0E1117;
    --bg-elevated:    #141822;
    --bg-overlay:     #1A1F2E;
    --bg-glass:       rgba(20, 24, 34, 0.7);
    --bg-glass-strong: rgba(20, 24, 34, 0.9);
  
    /* Borders */
    --border-subtle:  rgba(255,255,255,0.04);
    --border-default: rgba(255,255,255,0.08);
    --border-strong:  rgba(255,255,255,0.14);
    --border-accent:  rgba(99,102,241,0.4);
  
    /* Accents */
    --accent-primary:   #6366F1;
    --accent-secondary: #818CF8;
    --accent-teal:      #06B6D4;
    --accent-amber:     #F59E0B;
    --accent-emerald:   #10B981;
    --accent-rose:      #F43F5E;
  
    /* Gradients */
    --grad-primary:    linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    --grad-primary-hover: linear-gradient(135deg, #818CF8 0%, #A78BFA 100%);
    --grad-teal:       linear-gradient(135deg, #06B6D4 0%, #0EA5E9 100%);
    --grad-amber:      linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
    --grad-glass:      linear-gradient(135deg, rgba(99,102,241,0.1) 0%, rgba(139,92,246,0.05) 100%);
    --grad-radial:     radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99,102,241,0.15), transparent);
    --grad-radial-secondary: radial-gradient(ellipse 60% 50% at 80% 80%, rgba(6,182,212,0.05), transparent);
  
    /* Text */
    --text-primary:    #F1F5F9;
    --text-secondary:  #94A3B8;
    --text-tertiary:   #475569;
    --text-accent:     #818CF8;
    --text-inverse:    #080A0F;
  
    /* Severity Colors */
    --sev-critical:   #F43F5E;
    --sev-high:       #F97316;
    --sev-medium:     #F59E0B;
    --sev-low:        #10B981;
    --sev-info:       #06B6D4;
  
    /* Shadows */
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:   0 4px 16px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.3);
    --shadow-lg:   0 8px 32px rgba(0,0,0,0.6), 0 4px 12px rgba(0,0,0,0.4);
    --shadow-xl:   0 20px 60px rgba(0,0,0,0.7), 0 8px 24px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 40px rgba(99,102,241,0.2), 0 0 80px rgba(99,102,241,0.08);
    --shadow-btn:  0 4px 20px rgba(99,102,241,0.4), 0 1px 4px rgba(99,102,241,0.2);
  
    /* Radius */
    --radius-sm:   6px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-xl:   20px;
    --radius-2xl:  24px;
    --radius-full: 9999px;
  
    /* 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;
    --space-16: 64px;
    --space-20: 80px;
  
    /* Typography */
    --font-sans: 'Space Grotesk', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
    /* Motion */
    --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --dur-fast:    150ms;
    --dur-base:    250ms;
    --dur-slow:    400ms;
    --dur-xl:      600ms;
  }
  
  /* ── 2. RESET ───────────────────────────────────────────────── */
  *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
  }
  
  body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  
  /* Ambient background effects */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--grad-radial);
    pointer-events: none;
    z-index: 0;
  }
  
  body::after {
    content: '';
    position: fixed;
    bottom: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: var(--grad-radial-secondary);
    pointer-events: none;
    z-index: 0;
  }
  
  /* ── 3. UTILITY ────────────────────────────────────────────── */
  [hidden] { display: none !important; }
  
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  
  @keyframes fade-in-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  
  @keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  
  @keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.7); }
  }
  
  @keyframes spin {
    to { transform: rotate(360deg); }
  }
  
  @keyframes shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
  }
  
  @keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(99,102,241,0.1); }
    50%       { box-shadow: 0 0 40px rgba(99,102,241,0.3); }
  }
  
  @keyframes ring-pulse {
    0% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 0.2; transform: scale(1.5); }
    100% { opacity: 0.6; transform: scale(1); }
  }
  
  /* ── 4. NAVIGATION ──────────────────────────────────────────── */
  .nav {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(8, 10, 15, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
  }
  
  .nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
  }
  
  .nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
    transition: opacity var(--dur-base) var(--ease-out);
  }
  
  .nav-logo:hover { opacity: 0.8; }
  
  .logo-mark {
    font-size: 20px;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 8px rgba(99,102,241,0.5));
  }
  
  .logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
  }
  
  .logo-accent {
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  
  .nav-center {
    display: flex;
    align-items: center;
    gap: var(--space-3);
  }
  
  .nav-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
    font-family: var(--font-mono);
  }
  
  .nav-badge-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-emerald);
    animation: pulse-dot 2s ease-in-out infinite;
  }
  
  .nav-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    transition: all var(--dur-base) var(--ease-out);
  }
  
  .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
  }
  
  .status-dot--idle    { background: var(--text-tertiary); }
  .status-dot--ready   { background: var(--accent-emerald); box-shadow: 0 0 6px var(--accent-emerald); }
  .status-dot--working { background: var(--accent-primary); animation: pulse-dot 1.2s ease-in-out infinite; }
  .status-dot--done    { background: var(--accent-emerald); box-shadow: 0 0 8px var(--accent-emerald); }
  .status-dot--error   { background: var(--accent-rose); box-shadow: 0 0 6px var(--accent-rose); }
  
  .status-text {
    font-size: 12px;
    font-weight: 500;
  }
  
  .status-metrics {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    margin-left: var(--space-1);
  }
  
  /* ── 5. MAIN ────────────────────────────────────────────────── */
  .main {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-12) var(--space-6) var(--space-20);
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
  }
  
  /* ── 6. HERO ─────────────────────────────────────────────────── */
  .hero {
    text-align: center;
    padding: var(--space-4) 0 var(--space-6);
  }
  
  .hero-content {
    max-width: 720px;
    margin: 0 auto;
  }
  
  .hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: rgba(99,102,241,0.08);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-accent);
    margin-bottom: var(--space-4);
    position: relative;
  }
  
  .hero-badge-pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-primary);
    animation: pulse-dot 1.5s ease-in-out infinite;
    position: relative;
  }
  
  .hero-badge-pulse::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--accent-primary);
    opacity: 0;
    animation: ring-pulse 2s ease-in-out infinite;
  }
  
  .hero-title {
    font-size: clamp(36px, 6vw, 56px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
  }
  
  .hero-title-accent {
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  
  .hero-sub {
    font-size: 17px;
    color: var(--text-secondary);
    max-width: 540px;
    margin: 0 auto var(--space-8);
    line-height: 1.7;
  }
  
  .hero-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-8);
    padding: var(--space-5);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    margin: 0 auto;
    max-width: 480px;
  }
  
  .hero-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
  }
  
  .hero-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    font-feature-settings: "tnum";
  }
  
  .hero-stat-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  
  /* ── 7. SECTION HEADERS ────────────────────────────────────── */
  .section-heading {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
  }
  
  .section-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--space-6);
    max-width: 500px;
  }
  
  /* ── 8. UPLOAD ───────────────────────────────────────────────── */
  .upload-section {
    padding: var(--space-6) 0;
  }
  
  .upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
  }
  
  .upload-card {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: transform var(--dur-slow) var(--ease-out);
  }
  
  .upload-card:hover { transform: translateY(-2px); }
  
  .upload-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
  }
  
  .upload-icon {
    font-size: 16px;
    line-height: 1;
  }
  
  .upload-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
  }
  
  .upload-zone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-10) var(--space-6);
    min-height: 220px;
    background: var(--bg-elevated);
    border: 1.5px dashed var(--border-default);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    cursor: pointer;
    text-align: center;
    transition: all var(--dur-base) var(--ease-out);
    outline: none;
    background-image: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(99,102,241,0.04), transparent);
  }
  
  .upload-zone:hover,
  .upload-zone:focus-visible {
    border-color: var(--accent-primary);
    background-color: var(--bg-overlay);
    background-image: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(99,102,241,0.1), transparent);
    box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255,255,255,0.04);
  }
  
  .upload-zone:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
  }
  
  .upload-zone.drag-over {
    border-color: var(--accent-primary);
    border-style: solid;
    background-color: rgba(99,102,241,0.08);
    background-image: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99,102,241,0.15), transparent);
    box-shadow: var(--shadow-glow);
    transform: scale(1.01);
  }
  
  .upload-zone.has-file {
    border-color: rgba(16,185,129,0.4);
    border-style: solid;
    background-color: rgba(16,185,129,0.04);
    background-image: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(16,185,129,0.06), transparent);
  }
  
  .upload-zone.has-error {
    border-color: rgba(244,63,94,0.5);
    border-style: solid;
    background-color: rgba(244,63,94,0.04);
  }
  
  .upload-zone-icon {
    width: 44px;
    height: 44px;
    color: var(--accent-primary);
    transition: transform var(--dur-slow) var(--ease-spring);
    filter: drop-shadow(0 0 12px rgba(99,102,241,0.35));
  }
  
  .upload-zone-icon--amber {
    color: var(--accent-amber);
    filter: drop-shadow(0 0 12px rgba(245,158,11,0.35));
  }
  
  .upload-zone:hover .upload-zone-icon,
  .upload-zone.drag-over .upload-zone-icon {
    transform: scale(1.12) translateY(-2px);
  }
  
  .upload-zone-text {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
  }
  
  .upload-zone-primary {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
  }
  
  .upload-zone-secondary {
    font-size: 13px;
    color: var(--text-secondary);
  }
  
  .upload-link {
    color: var(--text-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
  }
  
  .upload-constraints {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
  }
  
  .upload-constraint {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    background: var(--bg-surface);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    letter-spacing: 0.04em;
  }
  
  .upload-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
  }
  
  /* File Info */
  .file-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    margin-top: var(--space-2);
    background: rgba(16,185,129,0.06);
    border: 1px solid rgba(16,185,129,0.2);
    border-radius: var(--radius-lg);
    animation: fade-in-up var(--dur-slow) var(--ease-out);
  }
  
  .file-info-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
  }
  
  .file-info-details {
    flex: 1;
    min-width: 0;
  }
  
  .file-info-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
  }
  
  .file-info-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: 1px;
  }
  
  .file-info-size {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
  }
  
  .file-info-status {
    font-size: 10px;
    font-weight: 500;
    color: var(--accent-emerald);
  }
  
  .file-info-remove {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(244,63,94,0.1);
    border: 1px solid rgba(244,63,94,0.15);
    border-radius: var(--radius-sm);
    color: var(--sev-critical);
    font-size: 10px;
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease-out);
    flex-shrink: 0;
  }
  
  .file-info-remove:hover {
    background: rgba(244,63,94,0.2);
    border-color: rgba(244,63,94,0.35);
    transform: scale(1.08);
  }
  
  /* ── 9. GENERATE ────────────────────────────────────────────── */
  .generate-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) 0;
  }
  
  .btn-generate {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-8);
    background: var(--grad-primary);
    border: none;
    border-radius: var(--radius-full);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    letter-spacing: -0.01em;
    transition: all var(--dur-base) var(--ease-out);
    box-shadow: var(--shadow-btn);
    overflow: hidden;
  }
  
  .btn-generate::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--dur-base) var(--ease-out);
  }
  
  .btn-generate:hover:not(:disabled)::before { opacity: 1; }
  
  .btn-generate:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 30px rgba(99,102,241,0.5), 0 2px 8px rgba(99,102,241,0.3);
    background: var(--grad-primary-hover);
  }
  
  .btn-generate:active:not(:disabled) {
    transform: translateY(0) scale(0.99);
  }
  
  .btn-generate:focus-visible {
    outline: 2px solid var(--accent-secondary);
    outline-offset: 3px;
  }
  
  .btn-generate:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
  }
  
  .btn-generate-icon {
    font-size: 16px;
    transition: transform var(--dur-slow) var(--ease-spring);
  }
  
  .btn-generate:hover:not(:disabled) .btn-generate-icon {
    transform: rotate(15deg) scale(1.2);
  }
  
  .btn-generate-label { position: relative; z-index: 1; }
  
  .btn-generate-shortcut {
    font-size: 11px;
    font-family: var(--font-mono);
    color: rgba(255,255,255,0.5);
    padding: var(--space-1) var(--space-2);
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
  }
  
  .generate-note {
    font-size: 12px;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
  }
  
  /* ── 10. PROCESSING ─────────────────────────────────────────── */
  .processing-panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    animation: fade-in-up var(--dur-slow) var(--ease-out);
    position: relative;
    overflow: hidden;
  }
  
  .processing-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
      90deg,
      transparent,
      rgba(99,102,241,0.03),
      transparent
    );
    animation: shimmer 2.5s linear infinite;
    pointer-events: none;
  }
  
  .processing-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
  }
  
  .processing-spinner {
    position: relative;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }
  
  .processing-spinner-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
  }
  
  .processing-spinner-ring:nth-child(1) {
    border-top-color: var(--accent-primary);
    border-right-color: var(--accent-primary);
    animation: spin 1s linear infinite;
  }
  
  .processing-spinner-ring:nth-child(2) {
    inset: 6px;
    border-bottom-color: var(--accent-teal);
    border-left-color: var(--accent-teal);
    animation: spin 1.5s linear infinite reverse;
  }
  
  .processing-spinner-ring:nth-child(3) {
    inset: 12px;
    border-top-color: var(--accent-amber);
    border-right-color: var(--accent-amber);
    animation: spin 0.8s linear infinite;
  }
  
  .processing-info {
    flex: 1;
    min-width: 0;
  }
  
  .processing-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
  }
  
  .processing-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    display: block;
    margin-top: 2px;
  }
  
  .processing-metrics {
    display: flex;
    gap: var(--space-3);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-tertiary);
  }
  
  .processing-metric {
    display: flex;
    align-items: center;
    gap: var(--space-1);
  }
  
  .progress-track {
    height: 4px;
    background: var(--bg-overlay);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-6);
    overflow: hidden;
    position: relative;
  }
  
  .progress-bar {
    height: 100%;
    width: 0%;
    background: var(--grad-primary);
    border-radius: var(--radius-full);
    transition: width 0.8s var(--ease-out);
    position: relative;
  }
  
  .progress-bar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-secondary);
    box-shadow: 0 0 8px var(--accent-primary);
  }
  
  .processing-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }
  
  .ps-step {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    background: transparent;
    transition: all var(--dur-base) var(--ease-out);
    opacity: 0.4;
  }
  
  .ps-step.active {
    background: rgba(99,102,241,0.06);
    opacity: 1;
  }
  
  .ps-step.done {
    opacity: 0.7;
  }
  
  .ps-step.done .ps-dot {
    background: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
  }
  
  .ps-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-tertiary);
    flex-shrink: 0;
    transition: all var(--dur-base) var(--ease-out);
  }
  
  .ps-step.active .ps-dot {
    background: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-primary);
    animation: pulse-dot 1.2s ease-in-out infinite;
  }
  
  .ps-content {
    flex: 1;
    min-width: 0;
  }
  
  .ps-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    display: block;
    transition: color var(--dur-base) var(--ease-out);
  }
  
  .ps-step.active .ps-label { color: var(--text-primary); }
  .ps-step.done .ps-label   { color: var(--accent-emerald); }
  
  .ps-description {
    font-size: 11px;
    color: var(--text-tertiary);
    display: block;
  }
  
  .ps-status {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    min-width: 40px;
    text-align: right;
  }
  
  .ps-step.active .ps-status { color: var(--accent-primary); }
  .ps-step.done .ps-status   { color: var(--accent-emerald); }
  
  /* ── 11. ERROR ───────────────────────────────────────────────── */
  .error-panel {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
    background: rgba(244,63,94,0.06);
    border: 1px solid rgba(244,63,94,0.25);
    border-radius: var(--radius-xl);
    animation: fade-in-up var(--dur-slow) var(--ease-out);
  }
  
  .error-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
    color: var(--sev-critical);
    margin-top: 2px;
  }
  
  .error-content { flex: 1; }
  
  .error-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--sev-critical);
    margin-bottom: var(--space-1);
  }
  
  .error-message {
    font-size: 13px;
    color: var(--text-secondary);
  }
  
  .error-details {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    margin-top: var(--space-2);
    padding: var(--space-2);
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    overflow: auto;
    max-height: 120px;
  }
  
  .error-retry {
    padding: var(--space-2) var(--space-4);
    background: rgba(244,63,94,0.12);
    border: 1px solid rgba(244,63,94,0.3);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    color: var(--sev-critical);
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease-out);
    flex-shrink: 0;
    white-space: nowrap;
  }
  
  .error-retry:hover {
    background: rgba(244,63,94,0.2);
    border-color: rgba(244,63,94,0.5);
  }
  
  .error-retry:focus-visible {
    outline: 2px solid var(--sev-critical);
    outline-offset: 2px;
  }
  
  /* ── 12. RESULTS ────────────────────────────────────────────── */
  .results-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    animation: fade-in-up var(--dur-xl) var(--ease-out);
  }
  
  /* Dashboard Header */
  .dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    flex-wrap: wrap;
    gap: var(--space-3);
  }
  
  .dashboard-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
  }
  
  .dashboard-heading {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
  }
  
  .dashboard-badge {
    font-size: 11px;
    font-weight: 500;
    color: var(--accent-emerald);
    background: rgba(16,185,129,0.1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    border: 1px solid rgba(16,185,129,0.2);
  }
  
  .dashboard-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
  }
  
  /* Summary Bar */
  .summary-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
  }
  
  .summary-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-5) var(--space-4);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    text-align: center;
    transition: all var(--dur-base) var(--ease-out);
    cursor: default;
  }
  
  .summary-metric:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
  }
  
  .sm-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1;
    font-feature-settings: "tnum";
  }
  
  .sm-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  
  .summary-metric--confidence {
    position: relative;
  }
  
  .confidence-ring {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  .confidence-ring svg {
    transform: rotate(-90deg);
  }
  
  .confidence-ring .ring-bg {
    fill: none;
    stroke: var(--bg-overlay);
    stroke-width: 3;
  }
  
  .confidence-ring .ring-fill {
    fill: none;
    stroke: url(#confGrad);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s var(--ease-out);
  }
  
  .confidence-ring .ring-label {
    position: absolute;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    pointer-events: none;
    font-feature-settings: "tnum";
  }
  
  /* Result Sections */
  .result-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: box-shadow var(--dur-base) var(--ease-out);
  }
  
  .result-section:hover {
    box-shadow: var(--shadow-sm);
  }
  
  .result-section--conflicts {
    border-color: rgba(244,63,94,0.3);
    background: rgba(244,63,94,0.02);
  }
  
  .result-section--missing {
    border-color: rgba(245,158,11,0.2);
    background: rgba(245,158,11,0.02);
  }
  
  .rs-header {
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(255,255,255,0.01);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  
  .rs-header--conflict {
    background: rgba(244,63,94,0.04);
    border-bottom-color: rgba(244,63,94,0.15);
  }
  
  .rs-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-tertiary);
  }
  
  .rs-badge {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-accent);
    background: rgba(99,102,241,0.08);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
  }
  
  .rs-count {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
  }
  
  .rs-body {
    padding: var(--space-5) var(--space-6);
    font-size: 14px;
    line-height: 1.75;
    color: var(--text-secondary);
  }
  
  .rs-summary-text,
  .rs-root-cause-text {
    margin: 0;
  }
  
  /* Analytics Grid */
  .analytics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
    padding: var(--space-4);
  }
  
  .analytics-card {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
  }
  
  .analytics-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    display: block;
    margin-bottom: var(--space-1);
  }
  
  .analytics-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    font-feature-settings: "tnum";
    margin-bottom: var(--space-2);
  }
  
  .analytics-bar {
    height: 3px;
    background: var(--bg-overlay);
    border-radius: var(--radius-full);
    overflow: hidden;
  }
  
  .analytics-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 1s var(--ease-out);
  }
  
  /* Observations */
  .observations-list {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }
  
  .obs-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: all var(--dur-fast) var(--ease-out);
  }
  
  .obs-card:hover {
    border-color: var(--border-default);
    background: var(--bg-overlay);
    transform: translateX(2px);
  }
  
  .obs-severity {
    flex-shrink: 0;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 1px;
  }
  
  .obs-severity--critical {
    background: rgba(244,63,94,0.15);
    color: var(--sev-critical);
    border: 1px solid rgba(244,63,94,0.25);
  }
  
  .obs-severity--high {
    background: rgba(249,115,22,0.15);
    color: var(--sev-high);
    border: 1px solid rgba(249,115,22,0.25);
  }
  
  .obs-severity--medium {
    background: rgba(245,158,11,0.15);
    color: var(--sev-medium);
    border: 1px solid rgba(245,158,11,0.25);
  }
  
  .obs-severity--low {
    background: rgba(16,185,129,0.12);
    color: var(--sev-low);
    border: 1px solid rgba(16,185,129,0.2);
  }
  
  .obs-severity--info {
    background: rgba(6,182,212,0.12);
    color: var(--sev-info);
    border: 1px solid rgba(6,182,212,0.2);
  }
  
  .obs-content { flex: 1; min-width: 0; }
  
  .obs-area {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
  }
  
  .obs-description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-top: 2px;
  }
  
  .obs-evidence {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
    padding: var(--space-2);
    background: var(--bg-base);
    border-radius: var(--radius-sm);
    border-left: 2px solid var(--border-accent);
  }
  
  /* Recommendations */
  .recommendations-container {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }
  
  .recommendations-group {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
  }
  
  .rec-group-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-4);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    margin: 0;
  }
  
  .recommendations-list {
    padding: var(--space-3) var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    list-style: none;
    counter-reset: rec-counter;
    margin: 0;
  }
  
  .rec-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    transition: all var(--dur-fast) var(--ease-out);
    counter-increment: rec-counter;
  }
  
  .rec-item:hover {
    border-color: rgba(99,102,241,0.2);
    background: rgba(99,102,241,0.04);
    color: var(--text-primary);
  }
  
  .rec-item::before {
    content: counter(rec-counter, decimal-leading-zero);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-accent);
    flex-shrink: 0;
    padding-top: 1px;
    min-width: 24px;
  }
  
  /* Conflicts */
  .conflicts-list {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }
  
  .conflict-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: rgba(244,63,94,0.04);
    border: 1px solid rgba(244,63,94,0.12);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.55;
  }
  
  .conflict-item::before {
    content: '⚡';
    flex-shrink: 0;
    font-size: 13px;
    line-height: 1.55;
  }
  
  .conflict-severity {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  
  .conflict-severity--high {
    background: rgba(244,63,94,0.15);
    color: var(--sev-critical);
  }
  
  .conflict-severity--medium {
    background: rgba(249,115,22,0.15);
    color: var(--sev-high);
  }
  
  /* Missing */
  .missing-list {
    padding: var(--space-4) var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    list-style: none;
    margin: 0;
  }
  
  .missing-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 13px;
    color: var(--text-secondary);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-subtle);
  }
  
  .missing-item:last-child { border-bottom: none; }
  
  .missing-item::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-tertiary);
    flex-shrink: 0;
  }
  
  /* ── 13. DOWNLOAD ────────────────────────────────────────────── */
  .download-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-6);
    background: var(--bg-elevated);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-glow);
    flex-wrap: wrap;
  }
  
  .download-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
  }
  
  .download-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16,185,129,0.12);
    border-radius: 50%;
    color: var(--accent-emerald);
    font-size: 14px;
  }
  
  .download-details {
    display: flex;
    flex-direction: column;
  }
  
  .download-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
  }
  
  .download-meta {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
  }
  
  .download-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
  }
  
  .btn-download {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--dur-fast) var(--ease-out);
    border: 1px solid transparent;
  }
  
  .btn-download svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }
  
  .btn-download--primary {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: 0 2px 12px rgba(99,102,241,0.3);
  }
  
  .btn-download--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(99,102,241,0.45);
  }
  
  .btn-download--primary:focus-visible {
    outline: 2px solid var(--accent-secondary);
    outline-offset: 2px;
  }
  
  .btn-download--secondary {
    background: var(--bg-overlay);
    border-color: var(--border-default);
    color: var(--text-secondary);
  }
  
  .btn-download--secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
    color: var(--text-primary);
  }
  
  .btn-download--ghost {
    background: transparent;
    border-color: var(--border-subtle);
    color: var(--text-tertiary);
  }
  
  .btn-download--ghost:hover {
    background: var(--bg-overlay);
    border-color: var(--border-default);
    color: var(--text-secondary);
  }
  
  .btn-download--ghost:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
  }
  
  /* ── 14. FOOTER ───────────────────────────────────────────────── */
  .footer {
    border-top: 1px solid var(--border-subtle);
    background: rgba(8, 10, 15, 0.5);
    backdrop-filter: blur(10px);
  }
  
  .footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-6);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
  }
  
  .footer-text {
    font-size: 12px;
    color: var(--text-tertiary);
  }
  
  .footer-version {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-tertiary);
  }
  
  .footer-status {
    color: var(--accent-emerald);
  }
  
  /* ── 15. SCROLLBAR ───────────────────────────────────────────── */
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: var(--bg-base); }
  ::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px;
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }
  
  /* ── 16. RESPONSIVE ──────────────────────────────────────────── */
  @media (max-width: 900px) {
    .main { padding: var(--space-8) var(--space-4) var(--space-16); }
    
    .hero-title { font-size: clamp(28px, 5vw, 40px); }
    .hero-stats { max-width: 100%; }
    
    .summary-bar { grid-template-columns: repeat(2, 1fr); }
    .analytics-grid { grid-template-columns: repeat(2, 1fr); }
  }
  
  @media (max-width: 640px) {
    .nav-inner { padding: var(--space-3) var(--space-4); }
    .nav-center { display: none; }
    
    .upload-grid { grid-template-columns: 1fr; }
    
    .hero-stats {
      flex-direction: column;
      gap: var(--space-3);
      padding: var(--space-4);
    }
    
    .hero-stat-value { font-size: 18px; }
    
    .summary-bar { grid-template-columns: 1fr 1fr; }
    .analytics-grid { grid-template-columns: 1fr 1fr; }
    
    .dashboard-header {
      flex-direction: column;
      align-items: flex-start;
    }
    
    .download-bar {
      flex-direction: column;
      align-items: flex-start;
    }
    
    .download-actions {
      width: 100%;
    }
    
    .btn-download {
      flex: 1;
      justify-content: center;
    }
    
    .processing-panel { padding: var(--space-5); }
    
    .rs-header,
    .rs-body {
      padding-left: var(--space-4);
      padding-right: var(--space-4);
    }
    
    .footer-inner {
      flex-direction: column;
      align-items: center;
      text-align: center;
    }
  }
  
  @media (max-width: 380px) {
    .summary-bar {
      grid-template-columns: 1fr 1fr;
      gap: var(--space-2);
    }
    
    .sm-value { font-size: 22px; }
  }
  
  /* ── 17. REDUCED MOTION ─────────────────────────────────────── */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      transition-duration: 0.01ms !important;
    }
  }
  
  /* ── 18. LARGE SCREENS ──────────────────────────────────────── */
  @media (min-width: 1400px) {
    .main { max-width: 1320px; }
  }