/* ──────────────────────────────────────────────────────────────
   EFTA Files — Design System & Styles
   Premium dark theme with amber/gold accents
   ────────────────────────────────────────────────────────────── */

:root {
  /* Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-tertiary: #161620;
  --bg-card: #1a1a26;
  --bg-card-hover: #1f1f2e;
  --bg-elevated: #222233;
  --border: #2a2a3a;
  --border-subtle: #1e1e2e;

  --text-primary: #f0eef5;
  --text-secondary: #9896a8;
  --text-muted: #666680;

  --accent: #d4a853;
  --accent-bright: #ecc46e;
  --accent-dim: #b08a3a;

  --green: #4ade80;
  --green-dim: #166534;
  --red: #f87171;
  --red-dim: #7f1d1d;
  --blue: #60a5fa;
  --blue-dim: #1e3a5f;
  --yellow: #fbbf24;

  --gradient-accent: linear-gradient(135deg, #d4a853 0%, #ecc46e 50%, #d4a853 100%);
  --gradient-dark: linear-gradient(180deg, #0a0a0f 0%, #111118 100%);
  --gradient-card: linear-gradient(135deg, rgba(212,168,83,0.06) 0%, rgba(0,0,0,0) 100%);

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --section-pad: clamp(60px, 8vw, 120px);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input { font-family: inherit; }
code { font-family: var(--font-mono); }
::selection { background: rgba(212,168,83,0.3); color: #fff; }

/* ─── Nav ────────────────────────────────────────────────── */
#main-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(10,10,15,0.8);
  backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  transition: all 0.3s var(--ease);
}
#main-nav.scrolled {
  background: rgba(10,10,15,0.95);
  border-bottom-color: var(--border);
}
.nav-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 0 24px; height: 64px;
  display: flex; align-items: center; gap: 32px;
}
.nav-logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; }
.logo-icon { font-size: 1.3rem; }
.logo-accent { color: var(--accent); }
.nav-links { display: flex; gap: 24px; margin-left: auto; }
.nav-links a {
  font-size: 0.875rem; font-weight: 500; color: var(--text-secondary);
  transition: color 0.2s; position: relative;
}
.nav-links a:hover { color: var(--text-primary); }
.nav-links a::after {
  content: ''; position: absolute; bottom: -4px; left: 0; right: 0;
  height: 2px; background: var(--accent); border-radius: 1px;
  transform: scaleX(0); transition: transform 0.2s var(--ease);
}
.nav-links a:hover::after { transform: scaleX(1); }
.nav-cta {
  font-size: 0.8rem; font-weight: 600; color: var(--bg-primary) !important;
  background: var(--gradient-accent); padding: 8px 18px;
  border-radius: 99px; transition: all 0.2s;
}
.nav-cta:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(212,168,83,0.3); }

.mobile-menu-btn { display: none; flex-direction: column; gap: 5px; padding: 4px; }
.mobile-menu-btn span { display: block; width: 22px; height: 2px; background: var(--text-secondary); border-radius: 1px; transition: all 0.3s; }
.mobile-menu { display: none; }

@media (max-width: 768px) {
  .nav-links, .nav-cta { display: none; }
  .mobile-menu-btn { display: flex; margin-left: auto; }
  .mobile-menu.open {
    display: flex; flex-direction: column; gap: 8px;
    padding: 16px 24px 24px; border-top: 1px solid var(--border-subtle);
  }
  .mobile-menu a { padding: 8px 0; font-size: 0.9rem; color: var(--text-secondary); }
}

/* ─── Hero ───────────────────────────────────────────────── */
#hero {
  position: relative; min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 100px 24px 60px; overflow: hidden;
}
.hero-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(212,168,83,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212,168,83,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 30%, transparent 100%);
}
.hero-glow {
  position: absolute; border-radius: 50%;
  filter: blur(120px); opacity: 0.15; pointer-events: none;
}
.hero-glow-1 { width: 600px; height: 600px; background: var(--accent); top: -200px; right: -100px; }
.hero-glow-2 { width: 500px; height: 500px; background: #6366f1; bottom: -150px; left: -100px; opacity: 0.08; }

.hero-content { text-align: center; max-width: 720px; position: relative; z-index: 1; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px; border-radius: 99px;
  background: rgba(212,168,83,0.1); border: 1px solid rgba(212,168,83,0.2);
  font-size: 0.8rem; font-weight: 500; color: var(--accent-bright);
  margin-bottom: 24px;
  animation: fadeInDown 0.6s var(--ease);
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

#hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900; line-height: 1.1; letter-spacing: -0.03em;
  margin-bottom: 20px;
  animation: fadeInUp 0.7s var(--ease) 0.15s both;
}
.hero-accent {
  background: var(--gradient-accent);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub {
  font-size: 1.1rem; color: var(--text-secondary); max-width: 560px; margin: 0 auto 32px;
  animation: fadeInUp 0.7s var(--ease) 0.3s both;
}
.hero-sub strong { color: var(--text-primary); }

.hero-actions {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  animation: fadeInUp 0.7s var(--ease) 0.45s both;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.9rem;
  transition: all 0.25s var(--ease);
}
.btn-primary {
  background: var(--gradient-accent); color: var(--bg-primary);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(212,168,83,0.25); }
.btn-ghost {
  background: rgba(255,255,255,0.05); color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); border-color: var(--text-muted); }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; }
.btn-icon { padding: 10px 14px; }

/* Terminal */
.hero-terminal {
  margin-top: 48px; max-width: 600px; width: 100%;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: fadeInUp 0.8s var(--ease) 0.6s both;
}
.terminal-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; background: var(--bg-tertiary); border-bottom: 1px solid var(--border-subtle);
}
.terminal-dot { width: 12px; height: 12px; border-radius: 50%; }
.terminal-dot.red { background: #ff5f57; }
.terminal-dot.yellow { background: #febc2e; }
.terminal-dot.green { background: #28c840; }
.terminal-title { margin-left: 8px; font-size: 0.75rem; color: var(--text-muted); font-family: var(--font-mono); }

.terminal-body { padding: 16px; font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.8; }
.terminal-line { opacity: 0; animation: termLine 0.4s var(--ease) forwards; display: flex; gap: 8px; }
.terminal-line[data-delay="0"] { animation-delay: 0.8s; }
.terminal-line[data-delay="600"] { animation-delay: 1.4s; }
.terminal-line[data-delay="1200"] { animation-delay: 2.0s; }
.terminal-line[data-delay="1800"] { animation-delay: 2.6s; }
.terminal-line[data-delay="2400"] { animation-delay: 3.2s; }
.terminal-line[data-delay="3000"] { animation-delay: 3.8s; }
.terminal-line[data-delay="3600"] { animation-delay: 4.4s; }
.terminal-line[data-delay="4200"] { animation-delay: 5.0s; }
.terminal-line[data-delay="4800"] { animation-delay: 5.6s; }
.terminal-line[data-delay="5400"] { animation-delay: 6.2s; }

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

.t-prompt { color: var(--green); }
.t-cmd { color: var(--text-primary); }
.t-info { color: var(--blue); }
.t-success { color: var(--green); }
.t-text { color: var(--text-secondary); }
.t-text strong { color: var(--accent-bright); }
.t-cursor { color: var(--accent); animation: blink 1s infinite; }
@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }

/* ─── Stats Bar ──────────────────────────────────────────── */
#stats-bar {
  background: var(--bg-secondary); border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}
.stats-inner {
  max-width: 1280px; margin: 0 auto; padding: 32px 24px;
  display: flex; align-items: center; justify-content: center; gap: 40px; flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-number { display: block; font-size: 2rem; font-weight: 800; color: var(--accent-bright); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.stat-divider { width: 1px; height: 40px; background: var(--border); }
@media (max-width: 600px) { .stat-divider { display: none; } .stats-inner { gap: 24px; } }

/* ─── Sections ───────────────────────────────────────────── */
.section { padding: var(--section-pad) 24px; }
.section-dark { background: var(--bg-secondary); }
.section-inner { max-width: 1280px; margin: 0 auto; }
.section-header { text-align: center; margin-bottom: 56px; }
.section-tag {
  display: inline-block; padding: 4px 14px; border-radius: 99px;
  background: rgba(212,168,83,0.1); border: 1px solid rgba(212,168,83,0.15);
  font-size: 0.75rem; font-weight: 600; color: var(--accent); text-transform: uppercase;
  letter-spacing: 0.1em; margin-bottom: 16px;
}
.section-header h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; letter-spacing: -0.02em; }
.section-desc { color: var(--text-secondary); max-width: 600px; margin: 12px auto 0; font-size: 1.05rem; }

/* ─── Feature Cards ──────────────────────────────────────── */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.feature-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); padding: 28px;
  transition: all 0.3s var(--ease); position: relative; overflow: hidden;
}
.feature-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--gradient-accent); opacity: 0; transition: opacity 0.3s;
}
.feature-card:hover { transform: translateY(-4px); border-color: var(--border); background: var(--bg-card-hover); }
.feature-card:hover::before { opacity: 1; }

.feature-icon {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  background: rgba(212,168,83,0.1); display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; color: var(--accent);
}
.feature-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6; }

/* ─── Pipeline ───────────────────────────────────────────── */
.pipeline-flow { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; justify-content: center; margin-bottom: 48px; }
.pipeline-stage {
  flex: 1; min-width: 200px; display: flex; align-items: center; gap: 0;
}
.pipeline-stage .stage-content {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); padding: 24px; flex: 1;
  transition: all 0.3s var(--ease);
}
.pipeline-stage:hover .stage-content { border-color: var(--accent-dim); transform: translateY(-2px); }
.stage-num {
  font-size: 2.5rem; font-weight: 900; color: rgba(212,168,83,0.1);
  position: absolute; top: -8px; right: 12px; font-family: var(--font-mono);
}
.pipeline-stage .stage-content { position: relative; }
.stage-content h3 { font-size: 1rem; font-weight: 700; color: var(--accent-bright); margin-bottom: 6px; }
.stage-content p { font-size: 0.82rem; color: var(--text-secondary); }
.stage-detail { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.stage-detail code {
  font-size: 0.72rem; color: var(--text-muted); background: rgba(255,255,255,0.03);
  padding: 2px 8px; border-radius: 4px;
}
.stage-arrow { display: flex; align-items: center; padding: 0 8px; color: var(--text-muted); }
@media (max-width: 900px) {
  .pipeline-flow { flex-direction: column; gap: 8px; }
  .stage-arrow { transform: rotate(90deg); justify-content: center; }
}

/* Output Tree */
.output-tree {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); overflow: hidden;
}
.output-tree h3 {
  display: flex; align-items: center; gap: 8px; padding: 16px 20px;
  font-size: 0.9rem; border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.tree-code { padding: 20px; margin: 0; font-size: 0.78rem; line-height: 1.8; overflow-x: auto; }
.tree-code code { color: var(--text-secondary); }
.tree-comment { color: var(--text-muted); }

/* ─── Table ──────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border-subtle); }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--bg-tertiary); }
th { padding: 14px 20px; text-align: left; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
td { padding: 14px 20px; font-size: 0.88rem; border-top: 1px solid var(--border-subtle); }
tbody tr { transition: background 0.2s; }
tbody tr:hover { background: rgba(212,168,83,0.04); }
td code { font-size: 0.8rem; color: var(--accent-bright); background: rgba(212,168,83,0.08); padding: 2px 8px; border-radius: 4px; }

.ds-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; border-radius: 8px;
  background: rgba(212,168,83,0.1); color: var(--accent); font-weight: 700; font-size: 0.85rem;
  padding: 0 8px;
}
.ds-badge-lg { background: rgba(212,168,83,0.2); border: 1px solid rgba(212,168,83,0.3); }

/* ─── Entity Cards ───────────────────────────────────────── */
.entities-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.entity-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); padding: 20px; text-align: center;
  transition: all 0.25s var(--ease);
}
.entity-card:hover { transform: translateY(-3px); border-color: var(--border); }
.entity-icon { font-size: 1.6rem; margin-bottom: 8px; }
.entity-card h4 { font-size: 0.9rem; margin-bottom: 4px; }
.entity-card p { font-size: 0.78rem; color: var(--text-muted); }

/* ─── Quick Start ────────────────────────────────────────── */
.quickstart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.qs-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); padding: 28px; position: relative;
}
.qs-step {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(212,168,83,0.1); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; font-family: var(--font-mono);
}
.qs-card h3 { font-size: 1rem; margin-bottom: 16px; }

.code-block { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-subtle); }
.code-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; background: var(--bg-tertiary);
  font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em;
}
.copy-btn {
  color: var(--text-muted); padding: 4px; border-radius: 4px;
  transition: all 0.2s;
}
.copy-btn:hover { color: var(--accent); background: rgba(212,168,83,0.1); }
.copy-btn.copied { color: var(--green); }

.code-block pre {
  margin: 0; padding: 16px; overflow-x: auto;
  font-size: 0.8rem; line-height: 1.7; background: var(--bg-card);
}
.code-comment { color: var(--text-muted); }

/* ─── Notes ──────────────────────────────────────────────── */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.note-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); padding: 24px; display: flex; gap: 16px;
  transition: all 0.25s var(--ease);
}
.note-card:hover { border-color: var(--border); }
.note-icon { font-size: 1.4rem; flex-shrink: 0; }
.note-card h4 { font-size: 0.9rem; margin-bottom: 4px; }
.note-card p { font-size: 0.82rem; color: var(--text-secondary); }
.note-card code { font-size: 0.75rem; background: rgba(212,168,83,0.08); color: var(--accent); padding: 1px 6px; border-radius: 3px; }

/* ─── Resources ──────────────────────────────────────────── */
.resources-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.resource-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); padding: 24px;
  transition: all 0.3s var(--ease); display: block;
}
.resource-card:hover { transform: translateY(-4px); border-color: var(--accent-dim); background: var(--bg-card-hover); }
.resource-icon { color: var(--accent); margin-bottom: 12px; }
.resource-card h4 { font-size: 1rem; margin-bottom: 4px; }
.resource-card p { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 12px; }
.resource-link { font-size: 0.78rem; color: var(--accent); font-weight: 500; }

/* ─── Footer ─────────────────────────────────────────────── */
#footer { background: var(--bg-primary); border-top: 1px solid var(--border-subtle); padding: 60px 24px 32px; }
.footer-inner { max-width: 1280px; margin: 0 auto; }
.footer-top { display: flex; justify-content: space-between; gap: 48px; flex-wrap: wrap; margin-bottom: 48px; }
.footer-brand { max-width: 300px; }
.footer-brand p { margin-top: 12px; font-size: 0.85rem; color: var(--text-muted); }
.footer-links { display: flex; gap: 64px; }
.footer-col h5 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 16px; }
.footer-col a { display: block; font-size: 0.85rem; color: var(--text-secondary); padding: 4px 0; transition: color 0.2s; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--border-subtle); padding-top: 24px; }
.footer-bottom p { font-size: 0.78rem; color: var(--text-muted); }

/* ─── AI TOOLS SECTION ───────────────────────────────────── */

/* API Config */
.api-config {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); padding: 24px; margin-bottom: 24px;
}
.api-config-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px; color: var(--text-secondary);
}
.api-config-header h3 { font-size: 0.95rem; flex: 1; }
.api-status {
  font-size: 0.75rem; padding: 4px 12px; border-radius: 99px;
  background: rgba(248,113,113,0.1); color: var(--red); font-weight: 500;
}
.api-status.connected { background: rgba(74,222,128,0.1); color: var(--green); }
.api-fields { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.api-field { flex: 1; min-width: 200px; }
.api-field label {
  display: block; font-size: 0.75rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; font-family: var(--font-mono);
}
.api-field input {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--bg-tertiary); border: 1px solid var(--border-subtle);
  color: var(--text-primary); font-size: 0.85rem;
  transition: border-color 0.2s;
}
.api-field input:focus { outline: none; border-color: var(--accent-dim); }
.api-field-hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; display: block; }

/* Tabs */
.ai-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); margin-bottom: 0;
}
.ai-tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 6px;
  font-size: 0.85rem; font-weight: 600; color: var(--text-muted);
  transition: all 0.2s var(--ease);
}
.ai-tab:hover { color: var(--text-secondary); background: rgba(255,255,255,0.03); }
.ai-tab.active { color: var(--accent-bright); background: rgba(212,168,83,0.1); }

/* Panels */
.ai-panel { display: none; }
.ai-panel.active { display: block; }

/* ─── Document Chat Panel ────────────────────────────────── */
.doc-chat-layout {
  display: grid; grid-template-columns: 320px 1fr; gap: 0;
  border: 1px solid var(--border-subtle); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden; min-height: 520px;
}
@media (max-width: 800px) {
  .doc-chat-layout { grid-template-columns: 1fr; min-height: auto; }
}

.doc-upload-area {
  padding: 24px; background: var(--bg-card);
  border-right: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; gap: 16px;
}

.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-sm);
  padding: 32px 20px; text-align: center;
  cursor: pointer; transition: all 0.2s;
  color: var(--text-muted);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent-dim); background: rgba(212,168,83,0.03);
}
.upload-zone svg { margin-bottom: 8px; }
.upload-zone p { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.upload-zone span { font-size: 0.72rem; }
.upload-zone.has-file { border-color: var(--green); border-style: solid; background: rgba(74,222,128,0.04); }
.upload-zone.has-file svg { color: var(--green); }

.upload-or { text-align: center; font-size: 0.75rem; color: var(--text-muted); }

.url-input-group { display: flex; gap: 8px; }
.url-input-group input {
  flex: 1; padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--bg-tertiary); border: 1px solid var(--border-subtle);
  color: var(--text-primary); font-size: 0.82rem;
}
.url-input-group input:focus { outline: none; border-color: var(--accent-dim); }

.doc-status { font-size: 0.78rem; color: var(--text-muted); }
.doc-status.success { color: var(--green); }
.doc-status.error { color: var(--red); }
.doc-status.loading { color: var(--accent); }

/* Chat Area */
.chat-area {
  display: flex; flex-direction: column; background: var(--bg-tertiary);
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 24px;
  max-height: 460px; min-height: 300px;
}

.chat-welcome { text-align: center; padding: 40px 20px; }
.chat-welcome-icon { font-size: 2.5rem; margin-bottom: 12px; }
.chat-welcome h4 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text-primary); }
.chat-welcome p { font-size: 0.85rem; color: var(--text-secondary); max-width: 400px; margin: 0 auto 20px; }

.chat-suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.suggestion-chip {
  padding: 8px 14px; border-radius: 99px;
  background: rgba(212,168,83,0.08); border: 1px solid rgba(212,168,83,0.15);
  font-size: 0.78rem; color: var(--accent-bright); cursor: pointer;
  transition: all 0.2s;
}
.suggestion-chip:hover {
  background: rgba(212,168,83,0.15); transform: translateY(-1px);
}

/* Chat messages */
.chat-msg {
  margin-bottom: 16px; display: flex; gap: 12px;
  animation: fadeInUp 0.3s var(--ease);
}
.chat-msg.user { justify-content: flex-end; }
.chat-msg-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
}
.chat-msg.user .chat-msg-avatar { background: rgba(212,168,83,0.2); color: var(--accent); }
.chat-msg.ai .chat-msg-avatar { background: rgba(99,102,241,0.2); color: #818cf8; }
.chat-msg-bubble {
  max-width: 80%; padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 0.88rem; line-height: 1.7;
}
.chat-msg.user .chat-msg-bubble {
  background: rgba(212,168,83,0.12); color: var(--text-primary);
  border-bottom-right-radius: 2px;
}
.chat-msg.ai .chat-msg-bubble {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  color: var(--text-secondary); border-bottom-left-radius: 2px;
}
.chat-msg.ai .chat-msg-bubble strong { color: var(--text-primary); }
.chat-msg.ai .chat-msg-bubble h1,
.chat-msg.ai .chat-msg-bubble h2,
.chat-msg.ai .chat-msg-bubble h3,
.chat-msg.ai .chat-msg-bubble h4 { color: var(--accent-bright); margin: 12px 0 6px; font-size: 0.95rem; }
.chat-msg.ai .chat-msg-bubble ul,
.chat-msg.ai .chat-msg-bubble ol { padding-left: 20px; margin: 8px 0; }
.chat-msg.ai .chat-msg-bubble li { margin: 4px 0; }
.chat-msg.ai .chat-msg-bubble code { background: rgba(212,168,83,0.08); padding: 1px 5px; border-radius: 3px; font-size: 0.82rem; }

.chat-msg-loading {
  display: flex; gap: 6px; padding: 8px 0;
}
.chat-msg-loading span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted);
  animation: loadDot 1.4s ease-in-out infinite;
}
.chat-msg-loading span:nth-child(2) { animation-delay: 0.2s; }
.chat-msg-loading span:nth-child(3) { animation-delay: 0.4s; }
@keyframes loadDot { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

.chat-input-area {
  display: flex; gap: 8px; padding: 16px 24px;
  border-top: 1px solid var(--border-subtle); background: var(--bg-card);
}
.chat-input-area input {
  flex: 1; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--bg-tertiary); border: 1px solid var(--border-subtle);
  color: var(--text-primary); font-size: 0.88rem;
}
.chat-input-area input:focus { outline: none; border-color: var(--accent-dim); }
.chat-input-area input::placeholder { color: var(--text-muted); }

/* ─── Search Panels ──────────────────────────────────────── */
.search-layout {
  border: 1px solid var(--border-subtle); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden; background: var(--bg-tertiary);
}
.search-bar-group {
  display: flex; gap: 12px; padding: 20px 24px;
  background: var(--bg-card); border-bottom: 1px solid var(--border-subtle);
}
.search-input-wrap {
  flex: 1; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; background: var(--bg-tertiary); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); transition: border-color 0.2s;
}
.search-input-wrap:focus-within { border-color: var(--accent-dim); }
.search-input-wrap svg { color: var(--text-muted); flex-shrink: 0; }
.search-input-wrap input {
  flex: 1; padding: 12px 0; border: none; background: transparent;
  color: var(--text-primary); font-size: 0.9rem; outline: none;
}
.search-input-wrap input::placeholder { color: var(--text-muted); }

.search-filters {
  display: flex; gap: 16px; flex-wrap: wrap; padding: 12px 24px;
  background: var(--bg-card); border-bottom: 1px solid var(--border-subtle);
}
.search-filters label { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-muted); }
.search-filters input {
  padding: 6px 10px; border-radius: 6px; background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle); color: var(--text-primary); font-size: 0.8rem;
}
.search-filters input:focus { outline: none; border-color: var(--accent-dim); }
.date-range { display: flex; align-items: center; gap: 8px; }
.date-range input[type="date"] { padding: 5px 8px; }
.date-range span { color: var(--text-muted); font-size: 0.78rem; }

.search-results { padding: 24px; min-height: 350px; max-height: 500px; overflow-y: auto; }

.search-welcome { text-align: center; padding: 40px 20px; }
.search-welcome svg { color: var(--text-muted); margin-bottom: 12px; opacity: 0.5; }
.search-welcome h4 { font-size: 1.1rem; margin-bottom: 8px; }
.search-welcome p { font-size: 0.85rem; color: var(--text-secondary); max-width: 420px; margin: 0 auto 20px; }
.search-welcome code { background: rgba(212,168,83,0.08); color: var(--accent); padding: 1px 6px; border-radius: 3px; font-size: 0.82rem; }

/* Search result items */
.search-result-item {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); padding: 20px; margin-bottom: 12px;
  animation: fadeInUp 0.3s var(--ease);
}
.search-result-item .result-text {
  font-size: 0.88rem; color: var(--text-secondary); line-height: 1.7;
  white-space: pre-wrap;
}
.search-result-item .result-text strong { color: var(--text-primary); }
.search-result-item .result-text h1,
.search-result-item .result-text h2,
.search-result-item .result-text h3 { color: var(--accent-bright); margin: 12px 0 6px; font-size: 0.95rem; }
.search-result-item .result-text ul,
.search-result-item .result-text ol { padding-left: 20px; margin: 8px 0; }
.search-result-item .result-text li { margin: 4px 0; }

.result-citations {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-subtle);
  display: flex; flex-wrap: wrap; gap: 8px;
}
.citation-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 99px;
  background: rgba(96,165,250,0.1); color: var(--blue); font-size: 0.72rem;
  transition: all 0.2s;
}
.citation-link:hover { background: rgba(96,165,250,0.2); }

/* Loading spinner for search */
.search-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; gap: 12px; color: var(--text-muted);
}
.search-loading .spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .section { padding: 48px 16px; }
  .features-grid { grid-template-columns: 1fr; }
  .quickstart-grid { grid-template-columns: 1fr; }
  .entities-grid { grid-template-columns: repeat(2, 1fr); }
  .notes-grid { grid-template-columns: 1fr; }
  .resources-grid { grid-template-columns: 1fr; }
  .footer-top { flex-direction: column; }
  .footer-links { gap: 32px; }
  .api-fields { flex-direction: column; }
  .ai-tabs { flex-direction: column; }
  .search-bar-group { flex-direction: column; }
  .search-filters { flex-direction: column; }
}

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

/* ─── Markdown rendering in AI responses ─────────────────── */
.result-text p, .chat-msg-bubble p { margin: 8px 0; }
.result-text a { color: var(--blue); text-decoration: underline; }
.result-text blockquote {
  border-left: 3px solid var(--accent-dim); padding-left: 12px;
  margin: 8px 0; color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════
   DATA EXPLORER
   ═══════════════════════════════════════════════════════════ */

/* Dashboard Stats */
.explorer-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--ease);
}
.dash-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-accent);
  opacity: 0.6;
}
.dash-card:hover {
  transform: translateY(-3px);
  border-color: var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.dash-icon { font-size: 1.5rem; margin-bottom: 8px; }
.dash-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-bright);
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.dash-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Entity Charts Row */
.explorer-entities-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.entity-chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 24px;
}
.entity-chart-card h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* Entity Bars */
.entity-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.entity-bar-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.entity-bar-name {
  width: 120px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.entity-bar-track {
  flex: 1;
  height: 24px;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.entity-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s var(--ease);
  display: flex;
  align-items: center;
  padding-left: 8px;
}
.entity-bar-fill.people { background: linear-gradient(90deg, rgba(212,168,83,0.4), rgba(212,168,83,0.6)); }
.entity-bar-fill.orgs { background: linear-gradient(90deg, rgba(96,165,250,0.4), rgba(96,165,250,0.6)); }
.entity-bar-fill.locations { background: linear-gradient(90deg, rgba(74,222,128,0.4), rgba(74,222,128,0.6)); }
.entity-bar-count {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* Document Type Chips */
.doc-type-row {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 32px;
}
.doc-type-row h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.doc-type-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.doc-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 99px;
  background: rgba(212,168,83,0.08);
  border: 1px solid rgba(212,168,83,0.15);
  font-size: 0.78rem;
  color: var(--accent-bright);
  cursor: pointer;
  transition: all 0.2s;
}
.doc-type-chip:hover {
  background: rgba(212,168,83,0.15);
  transform: translateY(-1px);
}
.doc-type-chip .chip-count {
  background: rgba(212,168,83,0.2);
  padding: 1px 8px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

/* Explorer Search */
.explorer-search {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}
.explorer-search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.explorer-search-bar svg {
  color: var(--text-muted);
  flex-shrink: 0;
}
.explorer-search-bar input {
  flex: 1;
  padding: 10px 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
}
.explorer-search-bar input::placeholder { color: var(--text-muted); }

.explorer-filters {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  flex-wrap: wrap;
}
.explorer-filters select {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: var(--font-body);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239896a8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  min-width: 130px;
}
.explorer-filters select:focus { outline: none; border-color: var(--accent-dim); }

/* Explorer Results */
.explorer-results {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
}
.explorer-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
}
.explorer-results-header span {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}
.results-pagination {
  display: flex;
  gap: 4px;
}
.results-pagination button {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s;
}
.results-pagination button:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent-dim);
}
.results-pagination button.active {
  color: var(--bg-primary);
  background: var(--accent);
  border-color: var(--accent);
}
.results-pagination button:disabled {
  opacity: 0.3;
  cursor: default;
}

.explorer-results-list {
  padding: 16px;
  max-height: 600px;
  overflow-y: auto;
}
.explorer-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
  color: var(--text-muted);
}
.explorer-loading .spinner {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.explorer-loading p { font-size: 0.85rem; }

/* Individual Document Result Card */
.doc-result-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 8px;
  transition: all 0.2s var(--ease);
  cursor: default;
}
.doc-result-card:hover {
  border-color: var(--border);
  background: var(--bg-elevated);
}
.doc-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 12px;
}
.doc-result-id {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-bright);
}
.doc-result-meta {
  display: flex;
  gap: 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.doc-result-meta span { display: inline-flex; align-items: center; gap: 4px; }
.doc-result-preview {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.doc-result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.doc-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 500;
}
.doc-tag.tag-person { background: rgba(212,168,83,0.1); color: var(--accent-bright); }
.doc-tag.tag-org { background: rgba(96,165,250,0.1); color: var(--blue); }
.doc-tag.tag-location { background: rgba(74,222,128,0.1); color: var(--green); }
.doc-tag.tag-type { background: rgba(168,85,247,0.1); color: #a855f7; }
.doc-tag.tag-redacted { background: rgba(248,113,113,0.1); color: var(--red); }
.doc-tag.tag-dollar { background: rgba(251,191,36,0.1); color: var(--yellow); }

.doc-result-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}
.doc-result-actions a {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(212,168,83,0.06);
  border: 1px solid rgba(212,168,83,0.12);
  transition: all 0.2s;
}
.doc-result-actions a:hover {
  background: rgba(212,168,83,0.15);
}

/* No results */
.no-results {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.no-results svg {
  margin-bottom: 12px;
  opacity: 0.3;
}
.no-results p { font-size: 0.9rem; margin-bottom: 4px; }
.no-results small { font-size: 0.78rem; }

@media (max-width: 600px) {
  .explorer-dashboard { grid-template-columns: repeat(2, 1fr); }
  .explorer-entities-row { grid-template-columns: 1fr; }
  .explorer-search-bar { flex-direction: column; }
  .explorer-filters { flex-direction: column; }
  .doc-result-header { flex-direction: column; align-items: flex-start; }
}

