/* ── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #5B5BF8;
  --primary-dark: #4444e0;
  --primary-light: #EEF0FF;
  --blue: #3B82F6;
  --green: #10B981;
  --orange: #F59E0B;
  --red: #EF4444;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --white: #FFFFFF;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.10), 0 4px 12px rgba(0,0,0,.05);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--gray-900);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-sm);
  transition: all .18s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
  padding: 10px 20px;
  box-shadow: 0 2px 8px rgba(91,91,248,.35);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 14px rgba(91,91,248,.45); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  color: var(--gray-700);
  border: 1.5px solid var(--gray-200);
  padding: 8px 16px;
}
.btn-outline:hover { border-color: var(--gray-300); background: var(--gray-50); }

.btn-lg { padding: 14px 28px; font-size: 15px; border-radius: var(--radius-md); }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* ── Navbar ───────────────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  height: 64px;
}

.nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-icon-sm { width: 28px; height: 28px; border-radius: 6px; }

.logo-text { font-size: 17px; font-weight: 700; color: var(--gray-900); }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-link { font-size: 14px; font-weight: 500; color: var(--gray-500); transition: color .15s; }
.nav-link:hover { color: var(--gray-900); }

/* ── Landing Body ─────────────────────────────────────────────────────── */
.landing-body { background: var(--white); }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: 140px 24px 100px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 64px;
  max-width: 1160px;
  margin: 0 auto;
  min-height: 100vh;
}

.hero-bg-shapes { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .12;
}
.shape-1 { width: 500px; height: 500px; background: var(--primary); top: -100px; right: -100px; }
.shape-2 { width: 350px; height: 350px; background: #7C3AED; bottom: 0; left: -100px; }
.shape-3 { width: 250px; height: 250px; background: var(--blue); top: 40%; left: 30%; }

.hero-content { flex: 1; max-width: 560px; position: relative; z-index: 1; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 24px;
}
.badge-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse 2s infinite;
}

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

.hero-title {
  font-size: clamp(36px, 5vw, 54px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  color: var(--gray-900);
  margin-bottom: 20px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 17px;
  color: var(--gray-500);
  line-height: 1.7;
  margin-bottom: 36px;
  max-width: 460px;
}
.hero-subtitle strong { color: var(--gray-700); }

.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 48px; }

.hero-stats {
  display: flex;
  align-items: center;
  gap: 24px;
}
.stat { text-align: center; }
.stat-number { display: block; font-size: 22px; font-weight: 800; color: var(--primary); }
.stat-label { display: block; font-size: 12px; color: var(--gray-400); font-weight: 500; margin-top: 2px; }
.stat-divider { width: 1px; height: 36px; background: var(--gray-200); }

/* ── Hero Visual (Chat Preview) ───────────────────────────────────────── */
.hero-visual { flex: 0 0 380px; position: relative; z-index: 1; }

.chat-preview-card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.preview-dot { width: 11px; height: 11px; border-radius: 50%; }
.preview-dot.red { background: #FF5F57; }
.preview-dot.yellow { background: #FFBD2E; }
.preview-dot.green { background: #28CA41; }
.preview-title { font-size: 12px; font-weight: 600; color: var(--gray-400); margin-left: auto; }

.preview-messages { padding: 16px; display: flex; flex-direction: column; gap: 12px; background: white; }

.preview-msg { display: flex; align-items: flex-end; gap: 8px; }
.preview-msg.user { flex-direction: row-reverse; }

.preview-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  flex-shrink: 0;
}
.bot-avatar { background: linear-gradient(135deg, var(--primary), #7C3AED); color: white; }

.preview-bubble {
  background: var(--gray-100);
  border-radius: 12px 12px 12px 4px;
  padding: 10px 13px;
  font-size: 13px;
  color: var(--gray-700);
  max-width: 220px;
  line-height: 1.5;
}
.user-bubble {
  background: var(--primary);
  color: white;
  border-radius: 12px 12px 4px 12px;
}

.preview-input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--gray-100);
  font-size: 13px;
  color: var(--gray-400);
}
.preview-send-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
}

/* ── Sections ─────────────────────────────────────────────────────────── */
.section-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 80px 24px;
}

.section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 12px;
}

.section-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  line-height: 1.2;
  color: var(--gray-900);
  margin-bottom: 48px;
  letter-spacing: -.5px;
}

/* ── Features Section ─────────────────────────────────────────────────── */
.features { background: var(--gray-50); }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.feature-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid var(--gray-200);
  transition: all .2s ease;
}
.feature-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.feature-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.icon-purple { background: linear-gradient(135deg, #6366F1, #8B5CF6); }
.icon-blue   { background: linear-gradient(135deg, #3B82F6, #6366F1); }
.icon-green  { background: linear-gradient(135deg, #10B981, #059669); }
.icon-orange { background: linear-gradient(135deg, #F59E0B, #EF4444); }
.icon-pink   { background: linear-gradient(135deg, #EC4899, #8B5CF6); }
.icon-teal   { background: linear-gradient(135deg, #14B8A6, #3B82F6); }

.feature-title { font-size: 16px; font-weight: 700; color: var(--gray-900); margin-bottom: 8px; }
.feature-desc  { font-size: 14px; color: var(--gray-500); line-height: 1.6; }

/* ── How It Works ─────────────────────────────────────────────────────── */
.steps {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 56px;
  flex-wrap: wrap;
}

.step {
  flex: 1;
  min-width: 220px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.step-number {
  font-size: 13px;
  font-weight: 800;
  color: white;
  background: var(--primary);
  min-width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.step-content h3 { font-size: 16px; font-weight: 700; color: var(--gray-900); margin-bottom: 6px; }
.step-content p  { font-size: 14px; color: var(--gray-500); line-height: 1.6; }

.step-arrow { align-self: center; flex-shrink: 0; margin-top: -8px; }

.cta-center { text-align: center; }

/* ── Footer ───────────────────────────────────────────────────────────── */
.footer {
  background: var(--gray-900);
  padding: 32px 24px;
}
.footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: white;
}
.footer-copy { font-size: 13px; color: var(--gray-400); }

/* ═══════════════════════════════════════════════════════════════════════
   CHAT PAGE
   ═══════════════════════════════════════════════════════════════════════ */

.chat-body {
  background: var(--gray-100);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Chat Topbar ──────────────────────────────────────────────────────── */
.chat-topbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1260px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
}
.status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--gray-300);
  transition: background .3s;
}
.status-dot.online  { background: var(--green); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.status-dot.offline { background: var(--red); }

/* ── Page Header ──────────────────────────────────────────────────────── */
.chat-page-header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 20px;
}
.chat-page-header-inner {
  max-width: 1260px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.page-title {
  font-size: clamp(18px, 2.5vw, 22px);
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 2px;
}
.page-subtitle { font-size: 13px; color: var(--gray-400); font-weight: 400; }

/* Upload Hero Card */
.upload-hero-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  color: white;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  cursor: pointer;
  transition: all .2s;
  min-width: 260px;
  box-shadow: 0 4px 14px rgba(91,91,248,.35);
}
.upload-hero-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(91,91,248,.45); }

.upload-hero-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.upload-hero-text { flex: 1; }
.upload-hero-title { display: block; font-size: 15px; font-weight: 700; }
.upload-hero-sub   { display: block; font-size: 12px; opacity: .8; margin-top: 2px; }
.upload-hero-arrow { opacity: .7; }

/* Upload progress */
.upload-progress-wrap {
  max-width: 1260px;
  margin: 12px auto 0;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #7C3AED);
  border-radius: 2px;
  transition: width .2s ease;
  width: 0%;
}
.upload-status-msg {
  max-width: 1260px;
  margin: 8px auto 0;
  font-size: 13px;
  font-weight: 500;
  padding: 0 4px;
}
.msg-success { color: var(--green); }
.msg-error   { color: var(--red); }
.msg-info    { color: var(--gray-500); }

/* ── Main Layout ──────────────────────────────────────────────────────── */
.chat-main {
  flex: 1;
  display: flex;
  gap: 20px;
  max-width: 1260px;
  margin: 20px auto;
  padding: 0 20px 24px;
  width: 100%;
  align-items: flex-start;
}

/* ── Chat Panel ───────────────────────────────────────────────────────── */
.chat-panel {
  flex: 1 1 0;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 600px;
  max-height: calc(100vh - 200px);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  gap: 12px;
  flex-shrink: 0;
}
.panel-header-left { display: flex; align-items: center; gap: 12px; }

.panel-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-chat { background: linear-gradient(135deg, var(--primary), #7C3AED); }

.panel-title    { font-size: 15px; font-weight: 700; color: var(--gray-900); }
.panel-subtitle { font-size: 12px; color: var(--gray-400); }

/* ── Messages ─────────────────────────────────────────────────────────── */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}
.messages-area::-webkit-scrollbar { width: 4px; }
.messages-area::-webkit-scrollbar-track { background: transparent; }
.messages-area::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 2px; }

.message { display: flex; align-items: flex-end; gap: 10px; }
.user-message { flex-direction: row-reverse; }

.msg-avatar.bot-avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.msg-content { display: flex; flex-direction: column; gap: 4px; max-width: 72%; }
.msg-content-user { align-items: flex-end; }

.msg-bubble {
  background: var(--gray-100);
  border-radius: 16px 16px 16px 4px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--gray-800);
}
.user-message .msg-bubble {
  background: var(--primary);
  color: white;
  border-radius: 16px 16px 4px 16px;
}

.msg-time {
  font-size: 11px;
  color: var(--gray-400);
  padding: 0 4px;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-msg-speak {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color .15s;
}
.btn-msg-speak:hover { color: var(--primary); }
.btn-msg-speak .icon-stop { display: none; }
.btn-msg-speak .icon-load { display: none; }
.btn-msg-speak.active .icon-play { display: none; }
.btn-msg-speak.active .icon-stop { display: inline; }
.btn-msg-speak.active { color: var(--primary); }
.btn-msg-speak.loading .icon-play { display: none; }
.btn-msg-speak.loading .icon-load {
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid rgba(124,58,237,0.25); border-top-color: #7C3AED;
  border-radius: 50%; animation: vm-spin 0.7s linear infinite; vertical-align: middle;
}
.btn-msg-speak.loading { color: var(--primary); pointer-events: none; }

/* Typing indicator */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
}
.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gray-300);
  animation: bounce 1.2s infinite;
}
.dot:nth-child(2) { animation-delay: .2s; }
.dot:nth-child(3) { animation-delay: .4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Sources block */
.sources-block {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-left: 42px;
  font-size: 12px;
}
.sources-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 8px;
}
.source-item {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--gray-200);
  color: var(--gray-600);
  line-height: 1.5;
}
.source-num {
  min-width: 18px; height: 18px;
  border-radius: 4px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Chat Input ───────────────────────────────────────────────────────── */
.chat-input-area {
  border-top: 1px solid var(--gray-100);
  padding: 16px 20px;
  flex-shrink: 0;
  background: white;
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 8px 8px 8px 16px;
  transition: border-color .2s;
}
.chat-input-row:focus-within { border-color: var(--primary); background: white; }

.chat-textarea {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: var(--font);
  color: var(--gray-900);
  resize: none;
  outline: none;
  line-height: 1.5;
  min-height: 24px;
  max-height: 140px;
  padding: 4px 0;
}
.chat-textarea::placeholder { color: var(--gray-400); }

.btn-send {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .18s;
  box-shadow: 0 2px 6px rgba(91,91,248,.3);
}
.btn-send:hover { background: var(--primary-dark); transform: scale(1.05); }
.btn-send:disabled { opacity: .5; transform: none; }

.btn-mic {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--gray-500);
  transition: all .18s;
}
.btn-mic:hover  { background: var(--gray-200); color: var(--gray-700); }
.btn-mic.mic-active {
  background: var(--red);
  color: white;
  animation: micPulse 1.2s infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

.input-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--gray-400);
}
.input-hint kbd {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: monospace;
}

/* ── Right Panel ──────────────────────────────────────────────────────── */
.right-panel {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--gray-100);
}
.card-header-left { display: flex; align-items: center; gap: 8px; }
.card-title { font-size: 14px; font-weight: 700; color: var(--gray-900); }

.link-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  transition: opacity .15s;
}
.link-btn:hover { opacity: .75; }

/* Documents List */
.documents-list {
  max-height: 220px;
  overflow-y: auto;
  transition: max-height .3s ease;
}
.documents-list.docs-expanded { max-height: 480px; }
.documents-list::-webkit-scrollbar { width: 3px; }
.documents-list::-webkit-scrollbar-thumb { background: var(--gray-200); }

.docs-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 16px;
  text-align: center;
}
.docs-empty p { font-size: 12px; color: var(--gray-400); line-height: 1.6; }

.doc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--gray-100);
  transition: background .15s;
}
.doc-item:last-child { border-bottom: none; }
.doc-item:hover { background: var(--gray-50); }

.doc-icon {
  width: 34px; height: 34px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
  letter-spacing: .3px;
}
.doc-info { flex: 1; min-width: 0; }
.doc-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-meta { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

.doc-delete {
  color: var(--gray-400);
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.doc-delete:hover { background: #FEE2E2; color: #DC2626; }

/* Quick Actions Grid */
.quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--gray-100);
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: white;
  transition: background .15s;
  text-align: left;
}
.quick-action:hover { background: var(--gray-50); }
.quick-action.qa-active { background: var(--primary-light); }

.qa-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform .15s;
}
.quick-action:hover .qa-icon { transform: scale(1.08); }

.qa-purple { background: var(--primary-light); color: var(--primary); }
.qa-green  { background: #D1FAE5; color: #059669; }
.qa-orange { background: #FEF3C7; color: #D97706; }
.qa-gray   { background: var(--gray-100); color: var(--gray-500); }

.quick-action.qa-active .qa-purple { background: var(--primary); color: white; }
.quick-action.qa-active .qa-green  { background: var(--green); color: white; }

.qa-text { display: flex; flex-direction: column; gap: 2px; }
.qa-label { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.qa-hint  { font-size: 11px; color: var(--gray-400); }

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

.modal {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  margin: 20px;
  overflow: hidden;
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from { transform: scale(.95) translateY(8px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);   opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-100);
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  color: var(--gray-400);
  transition: all .15s;
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }

.modal-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 20px; }

.setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.setting-label { font-size: 13px; font-weight: 600; color: var(--gray-700); min-width: 90px; }

.setting-range {
  flex: 1;
  accent-color: var(--primary);
  cursor: pointer;
}
.setting-val { font-size: 13px; font-weight: 600; color: var(--primary); min-width: 40px; text-align: right; }

.setting-select {
  flex: 1;
  padding: 7px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font);
  color: var(--gray-800);
  outline: none;
  background: white;
  cursor: pointer;
}
.setting-select:focus { border-color: var(--primary); }

/* ── Voice Controls ───────────────────────────────────────────────────── */

/* Textarea while live ASR interim text is showing */
.chat-textarea.interim {
  color: var(--gray-400);
  font-style: italic;
}

/* Stop-speaking button — shown inline when TTS is active */
.btn-speak {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  border: 1.5px solid var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .18s;
  animation: speakPulse 1.6s ease infinite;
}
.btn-speak:hover { background: var(--primary); color: white; }

@keyframes speakPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(91,91,248,.4); }
  55% { box-shadow: 0 0 0 7px rgba(91,91,248,0); }
}

/* Voice status bar — appears between input row and hint line */
.voice-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  min-height: 22px;
}
.voice-status-bar.hidden { display: none; }

.voice-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--gray-300);
}
.voice-status-dot.recording   { background: var(--red);    animation: micPulse .9s infinite; }
.voice-status-dot.transcribing{ background: var(--orange); animation: pulse .8s infinite; }
.voice-status-dot.speaking    { background: var(--primary); animation: pulse 1.1s infinite; }

/* Bot avatar speaking animation — wave-like pulse on active TTS */
.msg-avatar.bot-avatar-sm.speaking {
  animation: speakingAvatar .55s ease-in-out infinite alternate;
  outline: 2px solid rgba(91,91,248,.5);
  outline-offset: 2px;
}
@keyframes speakingAvatar {
  from { transform: scale(1);    box-shadow: 0 0 0 0   rgba(91,91,248,.45); }
  to   { transform: scale(1.12); box-shadow: 0 0 0 7px rgba(91,91,248,0);   }
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero { flex-direction: column; padding-top: 100px; text-align: center; min-height: auto; }
  .hero-content { max-width: 100%; }
  .hero-cta { justify-content: center; }
  .hero-stats { justify-content: center; }
  .hero-visual { width: 100%; max-width: 380px; }
  .hero-subtitle { margin: 0 auto 36px; }

  .chat-main { flex-direction: column; }
  .right-panel { flex: none; width: 100%; }
  .chat-panel { max-height: 55vh; }
  .quick-actions-grid { grid-template-columns: repeat(4, 1fr); }

  .steps { flex-direction: column; }
  .step-arrow { display: none; }
}

@media (max-width: 600px) {
  .chat-page-header-inner { flex-direction: column; align-items: flex-start; }
  .upload-hero-card { width: 100%; min-width: unset; }
  .quick-actions-grid { grid-template-columns: 1fr 1fr; }
  .nav-links .nav-link { display: none; }
  .topbar-inner { gap: 10px; }
  .topbar-status { font-size: 12px; }
}
