/* ═══════════════════════════════════════════════════════════════
   eFacturIA — Design System v2
   Light/Dark mode · WCAG AA · Mobile-first · CSS custom properties
   ═══════════════════════════════════════════════════════════════ */

/* ── Theme: Dark (default) ── */
:root {
  /* Brand */
  --primary: #7B79F7;
  --primary-hover: #6A68E8;
  --primary-dark: #5856D6;
  --primary-glow: rgba(123, 121, 247, 0.25);
  --primary-surface: rgba(123, 121, 247, 0.08);
  --accent: #EC4899;
  --accent-hover: #DB2777;

  /* Semantic */
  --success: #10B981;
  --success-surface: rgba(16, 185, 129, 0.10);
  --danger: #EF4444;
  --danger-surface: rgba(239, 68, 68, 0.10);
  --warning: #F59E0B;
  --warning-surface: rgba(245, 158, 11, 0.10);

  /* Surfaces — Dark */
  --bg: #0B0B0F;
  --bg-raised: #131318;
  --card-bg: #16161D;
  --card-hover: #1E1E27;
  --surface-alt: #0F0F15;

  /* Text — Dark */
  --text: #E8E8EE;
  --text-secondary: #9898AB;
  --text-muted: #5E5E72;
  --text-inverse: #0B0B0F;

  /* Borders */
  --border: #262632;
  --border-hover: #3A3A4C;
  --border-input: #2A2A38;

  /* Gradients */
  --gradient-brand: linear-gradient(135deg, #7B79F7 0%, #9B8EF8 50%, #EC4899 100%);
  --gradient-hero: linear-gradient(135deg, #7B79F7 0%, #9B8EF8 50%, #EC4899 100%);
  --gradient-card: linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, rgba(236, 72, 153, 0.04) 100%);

  /* Misc */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,.45);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.5);
  --shadow-glow: 0 0 40px var(--primary-glow);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
  --font-display: var(--font-sans);

  --transition-fast: 150ms ease;
  --transition: 250ms ease;
  --transition-slow: 350ms ease;
}

/* ── Theme: Light ── */
[data-theme="light"] {
  --primary: #5954E8;
  --primary-hover: #4A46D1;
  --primary-dark: #4338CA;
  --primary-glow: rgba(89, 84, 232, 0.15);
  --primary-surface: rgba(89, 84, 232, 0.06);

  --accent: #DB2777;
  --accent-hover: #BE185D;

  --success: #059669;
  --success-surface: rgba(5, 150, 105, 0.08);
  --danger: #DC2626;
  --danger-surface: rgba(220, 38, 38, 0.08);
  --warning: #D97706;
  --warning-surface: rgba(217, 119, 6, 0.08);

  --bg: #F8F7F5;
  --bg-raised: #F0EFEC;
  --card-bg: #FFFFFF;
  --card-hover: #FAF9F7;
  --surface-alt: #EDEBE8;

  --text: #1A1816;
  --text-secondary: #5C5955;
  --text-muted: #8B8781;
  --text-inverse: #FFFFFF;

  --border: #E5E1DC;
  --border-hover: #CEC8C2;
  --border-input: #D9D4CF;

  --gradient-brand: linear-gradient(135deg, #5954E8 0%, #7C3AED 50%, #DB2777 100%);
  --gradient-hero: linear-gradient(135deg, #5954E8 0%, #7C3AED 50%, #DB2777 100%);
  --gradient-card: linear-gradient(135deg, rgba(89, 84, 232, 0.03) 0%, rgba(219, 39, 119, 0.02) 100%);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.10);
  --shadow-glow: 0 0 40px var(--primary-glow);
}

/* ════════════════════════════════════════════════
   RESET & BASE
   ════════════════════════════════════════════════ */
*, *::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);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition), color var(--transition);
}

img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--primary-hover); }
button { font-family: inherit; cursor: pointer; }
code, pre { font-family: var(--font-mono); }
::selection { background: var(--primary); color: white; }

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ════════════════════════════════════════════════
   THEME TOGGLE
   ════════════════════════════════════════════════ */
.theme-toggle {
  background: var(--card-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-surface);
}
.theme-toggle:active { transform: scale(0.95); }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  transition: transform var(--transition), opacity var(--transition);
}
.theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(180deg) scale(0.5);
}
.theme-toggle .icon-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}
/* In light mode: show sun, hide moon */
[data-theme="light"] .theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}
[data-theme="light"] .theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(-180deg) scale(0.5);
}

/* ════════════════════════════════════════════════
   HEADER
   ════════════════════════════════════════════════ */
.header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition), border-color var(--transition);
}

@media (max-width: 768px) {
  .header {
    padding: 0 16px;
    height: 52px;
  }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  transition: opacity var(--transition-fast);
}
.header-brand:hover { opacity: 0.85; color: var(--text); }
.header-brand .brand-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  object-fit: contain;
  flex-shrink: 0;
}
.header-brand .brand-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-nav a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.header-nav a:hover,
.header-nav a.active {
  color: var(--primary);
  background: var(--primary-surface);
}

.header-nav a.nav-cta {
  background: var(--primary);
  color: white;
  font-weight: 600;
  padding: 6px 16px;
}
.header-nav a.nav-cta:hover {
  background: var(--primary-hover);
  color: white;
}

.header-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--surface-alt);
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 500;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.header-counter .count {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
}

/* Mobile nav */
@media (max-width: 768px) {
  .header-nav {
    gap: 1px;
  }
  .header-nav a {
    font-size: 0.78rem;
    padding: 5px 8px;
  }
  .header-counter {
    font-size: 0.72rem;
    padding: 4px 10px;
  }
  .header-brand { font-size: 1.1rem; }
  .header-brand .brand-logo { width: 28px; height: 28px; }
}

@media (max-width: 480px) {
  .header-nav a.nav-cta { padding: 4px 10px; font-size: 0.75rem; }
  .header-counter { display: none; }
}

/* ════════════════════════════════════════════════
   HAMBURGER MENU (mobile)
   ════════════════════════════════════════════════ */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.hamburger:hover { border-color: var(--primary); }

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

/* Hamburger open animation */
.hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .header-right {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--card-bg);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 16px;
    transform: translateX(100%);
    transition: transform var(--transition);
    z-index: 99;
    overflow-y: auto;
  }

  .header-right.open {
    transform: translateX(0);
  }

  .header-right .header-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }

  .header-right .header-nav a {
    padding: 12px 16px;
    font-size: 1rem;
    border-radius: var(--radius-sm);
  }

  .header-right .header-counter {
    margin: 12px 0;
    align-self: center;
  }

  .header-right .theme-toggle {
    align-self: center;
    margin-top: 8px;
  }
}

@media (max-width: 480px) {
  .header-right {
    top: 52px;
  }
}

/* ════════════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════════════ */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 24px;
}

.container-wide { max-width: 1100px; }
.container-narrow { max-width: 700px; }

@media (max-width: 768px) {
  .container { padding: 32px 16px; }
}

/* ════════════════════════════════════════════════
   HERO
   ════════════════════════════════════════════════ */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  padding: 40px 0 56px;
  text-align: left;
}

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

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-surface);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 16px;
  max-width: 700px;
}

.hero h1 .gradient-text {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.7;
  max-width: 640px;
  margin-bottom: 28px;
}

.hero p strong {
  color: var(--text);
  font-weight: 600;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Hero mascot */
.hero-mascot {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mascot-img {
  width: 260px;
  height: 260px;
  object-fit: contain;
  opacity: 0.9;
  filter: drop-shadow(0 0 40px var(--primary-glow));
  transition: transform var(--transition-slow), filter var(--transition-slow);
}

.mascot-img:hover {
  transform: scale(1.05) rotate(-3deg);
  filter: drop-shadow(0 0 60px var(--primary-glow));
  opacity: 1;
}

@media (max-width: 768px) {
  .hero {
    flex-direction: column;
    text-align: center;
    padding: 24px 0 40px;
    gap: 24px;
  }
  .hero h1 {
    font-size: 1.6rem;
    max-width: 100%;
  }
  .hero p { font-size: 0.95rem; max-width: 100%; }
  .hero-actions { justify-content: center; }
  .hero-badge { margin-left: auto; margin-right: auto; }

  .hero-mascot {
    order: -1;
  }
  .mascot-img {
    width: 170px;
    height: 170px;
  }
}

@media (max-width: 480px) {
  .mascot-img {
    width: 140px;
    height: 140px;
  }
}

/* ════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px var(--primary-glow);
}
.btn-primary:hover {
  background: var(--primary-hover);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--primary-glow);
}
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-surface);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--card-hover);
  color: var(--text);
}

.btn-success {
  background: var(--success);
  color: white;
}
.btn-success:hover { filter: brightness(1.1); }

.btn-lg {
  padding: 15px 32px;
  font-size: 1.05rem;
  border-radius: var(--radius);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ════════════════════════════════════════════════
   CARDS
   ════════════════════════════════════════════════ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all var(--transition-fast);
}
.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.card-padded { padding: 24px; }
.card-glow {
  box-shadow: var(--shadow-glow);
  border-color: var(--primary);
}

/* ════════════════════════════════════════════════
   UPLOAD ZONE
   ════════════════════════════════════════════════ */
.upload-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  max-width: 700px;
  margin: 0 auto 60px;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  margin: 20px 20px 0;
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface-alt);
  position: relative;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-surface);
  box-shadow: inset 0 0 40px var(--primary-glow);
}

.upload-zone .upload-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  opacity: 0.8;
}

.upload-zone .upload-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.upload-zone .upload-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.upload-zone .upload-formats {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 10px;
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* File info bar */
.file-info {
  display: none;
  padding: 14px 20px;
  margin: 0 20px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: 12px;
}
.file-info.visible { display: flex; }

.file-info .file-icon { font-size: 1.4rem; flex-shrink: 0; }
.file-info .file-name {
  flex: 1;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-info .file-size {
  color: var(--text-muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}
.file-info .file-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.file-info .file-remove:hover {
  color: var(--danger);
  background: var(--danger-surface);
}

/* Parse button */
.parse-btn-wrap {
  padding: 20px;
  text-align: center;
}

.parse-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 36px;
  background: var(--gradient-brand);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 16px var(--primary-glow);
}
.parse-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35);
}
.parse-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Results ── */
.results {
  display: none;
  padding: 24px;
  border-top: 1px solid var(--border);
}
.results.visible { display: block; }

.result-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-weight: 600;
  font-size: 0.95rem;
}
.result-summary.success {
  background: var(--success-surface);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.result-summary.error {
  background: var(--danger-surface);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 600px) { .result-grid { grid-template-columns: 1fr; } }

.result-col h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 700;
}

.result-field {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.result-field:last-child { border-bottom: none; }
.result-field .field-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
  font-weight: 600;
}
.result-field .field-value {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 500;
  word-break: break-word;
}
.result-field .field-value.empty {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
}

/* Line Items */
.line-items-section {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.line-items-section h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 700;
}
.line-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.line-items-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border);
}
.line-items-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.line-items-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Factur-X */
.facturx-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.facturx-section h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 700;
}
.facturx-code {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
  max-height: 300px;
  overflow-y: auto;
}
.facturx-download {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--surface-alt);
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
}
.facturx-download:hover {
  border-color: var(--primary);
  background: var(--primary-surface);
  color: var(--primary);
}

/* Meta */
.result-meta {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.result-meta span { display: flex; align-items: center; gap: 4px; }
.result-meta .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--primary-surface);
  color: var(--primary);
}

.confidence-bar {
  display: inline-block;
  width: 60px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
  margin: 0 6px;
}
.confidence-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.confidence-fill.high { background: var(--success); }
.confidence-fill.medium { background: var(--warning); }
.confidence-fill.low { background: var(--danger); }

/* ── Error message ── */
.error-msg {
  display: none;
  padding: 12px 16px;
  background: var(--danger-surface);
  color: var(--danger);
  border-radius: var(--radius-sm);
  margin: 0 20px;
  font-size: 0.9rem;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.error-msg.visible { display: block; }

/* ════════════════════════════════════════════════
   PRICING
   ════════════════════════════════════════════════ */
.pricing-section {
  margin-top: 40px;
  text-align: center;
}

.pricing-section h2 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.pricing-section .subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 32px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 540px) {
  .pricing-grid { grid-template-columns: 1fr; }
}

.pricing-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 22px;
  text-align: center;
  transition: all var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
}

.pricing-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.pricing-card.featured {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  background: var(--gradient-card);
}

.pricing-card.featured::before {
  content: '✨ Populaire';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 20px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pricing-card .tier-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.pricing-card .tier-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.pricing-card .tier-parses {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}
.pricing-card .tier-parses span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-top: 2px;
}

.pricing-card .tier-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 14px 0;
  flex: 1;
  min-height: 40px;
}

.pricing-card .tier-price {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
}
.pricing-card .price-period {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.pricing-card .tier-features {
  list-style: none;
  text-align: left;
  margin: 0 0 18px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.pricing-card .tier-features li {
  padding: 5px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pricing-card .tier-features li::before {
  content: '✓';
  color: var(--success);
  font-weight: 700;
  font-size: 0.9rem;
}

.pricing-card .tier-btn {
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  width: 100%;
  margin-top: auto;
}
.pricing-card .tier-btn:hover {
  border-color: var(--primary);
  background: var(--primary-surface);
  color: var(--primary);
}
.pricing-card .tier-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pricing-card.featured .tier-btn {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.pricing-card.featured .tier-btn:hover {
  background: var(--primary-hover);
}

/* Features comparison table */
.features-comparison { margin-top: 40px; }
.features-comparison h2 {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text);
}

.features-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.features-table th {
  text-align: left;
  padding: 10px 14px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--border);
}
.features-table th:not(:first-child) { text-align: center; }
.features-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.features-table td:first-child { font-weight: 500; color: var(--text); }
.features-table td:not(:first-child) { text-align: center; }

/* ════════════════════════════════════════════════
   FEATURES STRIP
   ════════════════════════════════════════════════ */
.features-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 64px;
  margin-bottom: 40px;
}

.feature-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition-fast);
}
.feature-item:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.feature-item .feature-icon {
  font-size: 1.6rem;
  margin-bottom: 12px;
  display: block;
}
.feature-item h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.feature-item p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ════════════════════════════════════════════════
   SOCIAL PROOF
   ════════════════════════════════════════════════ */
.social-proof {
  text-align: center;
  padding: 48px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 48px 0;
}
.social-proof h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
}
.social-proof-grid {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}
.social-proof-stat {
  text-align: center;
}
.social-proof-stat .stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
}
.social-proof-stat .stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ════════════════════════════════════════════════
   AUTH PAGES
   ════════════════════════════════════════════════ */
.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow-md);
  max-width: 460px;
  margin: 0 auto;
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  color: var(--text);
}

.auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.auth-error {
  background: var(--danger-surface);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.auth-success {
  background: var(--success-surface);
  color: var(--success);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.auth-warning {
  background: var(--warning-surface);
  color: var(--warning);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 10px;
}

.auth-input {
  padding: 11px 14px;
  background: var(--surface-alt);
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: all var(--transition-fast);
  font-family: inherit;
  width: 100%;
}
.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.auth-input::placeholder { color: var(--text-muted); }
textarea.auth-input { resize: vertical; min-height: 100px; }

.auth-btn {
  margin-top: 18px;
  padding: 13px 24px;
  background: var(--gradient-brand);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 16px var(--primary-glow);
}
.auth-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35);
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.auth-footer a { color: var(--primary); font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

/* ════════════════════════════════════════════════
   FAQ
   ════════════════════════════════════════════════ */
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 24px 0;
}
.faq-item:first-child { padding-top: 0; }
.faq-question {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  cursor: default;
  margin-bottom: 12px;
}
.faq-answer { color: var(--text-secondary); line-height: 1.7; }
.faq-answer p { margin-bottom: 12px; }
.faq-answer ul, .faq-answer ol { margin: 8px 0 16px 20px; }
.faq-answer li { margin-bottom: 4px; }
.faq-answer a { color: var(--primary); text-decoration: underline; }

/* ════════════════════════════════════════════════
   LEGAL PAGES
   ════════════════════════════════════════════════ */
.legal-page { max-width: 780px; }
.legal-page h1 {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.legal-date { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 36px; }
.legal-page section { margin-bottom: 28px; }
.legal-page h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.legal-page p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 10px;
}
.legal-page ul {
  list-style: disc;
  padding-left: 24px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 10px;
}
.legal-page ul li { margin-bottom: 4px; }
.legal-page a { color: var(--primary); }
.legal-page a:hover { text-decoration: underline; }

.legal-info-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  line-height: 1.8;
}
.legal-info-box p { margin-bottom: 4px; }

/* ════════════════════════════════════════════════
   ACCOUNT DASHBOARD
   ════════════════════════════════════════════════ */
.account-dashboard h1 {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 28px;
}

.account-banner {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-weight: 600;
  font-size: 0.95rem;
}
.account-banner.success {
  background: var(--success-surface);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.account-banner.pending {
  background: var(--warning-surface);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.account-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}
.account-section h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.info-item {
  padding: 12px 14px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.info-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  font-weight: 600;
}
.info-value { font-size: 0.95rem; font-weight: 600; color: var(--text); }

.subscription-active { display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.subscription-badge {
  display: inline-block;
  padding: 6px 16px;
  background: var(--primary-surface);
  color: var(--primary);
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  border: 1px solid rgba(99, 102, 241, 0.2);
}
.subscription-details { display: flex; gap: 18px; flex-wrap: wrap; }
.subscription-empty { color: var(--text-secondary); }
.subscription-empty p { margin-bottom: 10px; }

.subscription-cancelled {
  padding: 16px;
  background: var(--warning-surface);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm);
  color: var(--warning);
  font-weight: 500;
}
.subscription-cancelled p { margin-bottom: 10px; }

.status-active {
  color: var(--success) !important;
  font-weight: 700;
}

/* ---- Stats grid ---- */
.account-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 6px;
}

.stat-card {
  padding: 16px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}
.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}
.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 4px;
}

.usage-bar-wrap { padding: 6px 0; }
.usage-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.usage-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.usage-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.history-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border);
}
.history-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.status-badge { font-size: 1rem; }
.status-badge.success { color: var(--success); }
.status-badge.error { color: var(--danger); }

/* ════════════════════════════════════════════════
   API DOCS
   ════════════════════════════════════════════════ */
.api-section { margin-bottom: 28px; }
.api-section h3 { color: var(--primary); margin-bottom: 8px; font-size: 1.1rem; font-weight: 700; }
.api-endpoint {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 14px;
}
.api-method {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-right: 8px;
}
.method-post { background: rgba(16, 185, 129, 0.18); color: var(--success); }
.method-get { background: var(--primary-surface); color: var(--primary); }
.api-url {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text);
}
.api-desc { color: var(--text-secondary); font-size: 0.9rem; margin: 8px 0; }
.api-code {
  background: var(--surface-alt);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: pre;
  margin-top: 8px;
  border: 1px solid var(--border);
  line-height: 1.6;
}
.api-code .key { color: var(--primary); }
.api-code .str { color: var(--success); }
.api-code .num { color: var(--accent); }
.api-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
.api-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border);
}
.api-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text);
}
.api-table td:first-child { font-family: var(--font-mono); color: var(--primary); font-size: 0.85rem; }

/* ════════════════════════════════════════════════
   CONTACT
   ════════════════════════════════════════════════ */
.contact-info {
  text-align: center;
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.contact-info a { color: var(--primary); }

/* ════════════════════════════════════════════════
   LOADER / SPINNER
   ════════════════════════════════════════════════ */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(128, 128, 160, 0.3);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════════════ */
.footer {
  text-align: center;
  padding: 36px 24px;
  color: var(--text-muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  margin-top: 48px;
  line-height: 1.8;
}
.footer a { color: var(--text-secondary); transition: color var(--transition-fast); }
.footer a:hover { color: var(--primary); text-decoration: none; }

.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.footer-cross-promo {
  font-size: 0.82rem;
  margin-bottom: 12px;
  color: var(--text-muted);
}
.footer-cross-promo span { opacity: 0.6; }
.footer-cross-promo a { color: var(--text-secondary); }
.footer-cross-promo a:hover { color: var(--primary); }

/* ════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .container { padding: 24px 14px; }
  .hero { padding: 12px 0 24px; }
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: 0.9rem; }

  .upload-zone { margin: 14px 14px 0; padding: 32px 14px; }
  .upload-zone .upload-icon { font-size: 2.2rem; }
  .upload-zone .upload-title { font-size: 1.05rem; }
  .upload-zone .upload-subtitle { font-size: 0.85rem; }

  .pricing-grid { grid-template-columns: 1fr; }
  .pricing-card { padding: 22px 16px; }

  .features-strip { grid-template-columns: 1fr; }

  .auth-card { padding: 28px 18px; max-width: 100%; }

  .footer { padding: 24px 14px; font-size: 0.78rem; }
  .footer-links { gap: 10px; }

  .result-grid { grid-template-columns: 1fr; }
  .line-items-table { font-size: 0.75rem; }

  .subscription-active { flex-direction: column; }
  .features-table { font-size: 0.8rem; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 400px) {
  .header-brand { font-size: 1rem; }
  .header-nav a { font-size: 0.7rem; padding: 4px 6px; }
  .hero h1 { font-size: 1.3rem; }
  .pricing-grid { grid-template-columns: 1fr; }
  .btn { padding: 10px 18px; font-size: 0.9rem; }
}

/* ════════════════════════════════════════════════
   ACCESSIBILITY: Reduced motion
   ════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ════════════════════════════════════════════════
   PRINT
   ════════════════════════════════════════════════ */
@media print {
  .header, .footer, .theme-toggle, .header-counter { display: none; }
  body { background: white; color: black; }
  .container { max-width: 100%; padding: 0; }
}

/* Hero mascot theme switching */
.mascot-dark { display: block; }
.mascot-light { display: none; }
[data-theme="light"] .mascot-dark { display: block; }
[data-theme="light"] .mascot-light { display: none; }
[data-theme="dark"] .mascot-dark { display: none; }
[data-theme="dark"] .mascot-light { display: block; }

/* Logo theme switching */
.logo-dark { display: block; }
.logo-light { display: none; }
[data-theme="light"] .logo-dark { display: block; }
[data-theme="light"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: block; }

/* Hero mascot theme switching */
.mascot-dark { display: block; }
.mascot-light { display: none; }
[data-theme="light"] .mascot-dark { display: block; }
[data-theme="light"] .mascot-light { display: none; }
[data-theme="dark"] .mascot-dark { display: none; }
[data-theme="dark"] .mascot-light { display: block; }
