/* ═══════════════════════════════════════════════════════════════
   LexAI — Design System & Full Stylesheet
   Dark Glassmorphism + Indigo/Gold palette
═══════════════════════════════════════════════════════════════ */

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Color palette */
  --bg-base:        #080b14;
  --bg-surface:     #0d1220;
  --bg-elevated:    #111827;
  --bg-card:        rgba(255,255,255,0.04);
  --bg-card-hover:  rgba(255,255,255,0.07);

  --border:         rgba(255,255,255,0.08);
  --border-focus:   rgba(99,102,241,0.6);

  /* Brand */
  --primary:        #6366f1;
  --primary-light:  #818cf8;
  --primary-dim:    rgba(99,102,241,0.15);
  --violet:         #7c3aed;
  --violet-dim:     rgba(124,58,237,0.15);
  --emerald:        #10b981;
  --emerald-dim:    rgba(16,185,129,0.15);
  --amber:          #f59e0b;
  --amber-dim:      rgba(245,158,11,0.15);
  --teal:           #14b8a6;
  --teal-dim:       rgba(20,184,166,0.15);
  --rose:           #f43f5e;
  --rose-dim:       rgba(244,63,94,0.15);

  /* Risk colors */
  --risk-low:       #10b981;
  --risk-med:       #f59e0b;
  --risk-high:      #ef4444;

  /* Text */
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;
  --text-link:      #818cf8;

  /* Sizing */
  --header-h:       64px;
  --sidebar-w:      380px;
  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      18px;
  --radius-xl:      24px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);
  --glow:       0 0 24px rgba(99,102,241,0.3);

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

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ─── App Header ─────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(8,11,20,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 100%;
  padding: 0 20px;
}

/* Logo */
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-icon { display: flex; align-items: center; }
.logo-text { display: flex; flex-direction: column; }
.logo-name { font-size: 1.1rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; line-height: 1; }
.logo-tagline { font-size: 0.62rem; font-weight: 500; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; }

/* ─── Tab Nav — Floating Glass Island & Liquid Pointer Effects ─── */
.tab-nav {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 auto;
  padding: 4px 6px;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  box-shadow: 
    inset 0 1px 1px rgba(255, 255, 255, 0.12),
    inset 0 -1px 2px rgba(0, 0, 0, 0.4),
    0 8px 32px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: visible;
  scrollbar-width: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.tab-nav::-webkit-scrollbar { display: none; }

/* Dynamic liquid spotlight following cursor */
.tab-nav::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: radial-gradient(
    220px circle at var(--nav-mouse-x, -200px) var(--nav-mouse-y, -200px),
    rgba(99, 102, 241, 0.35) 0%,
    rgba(168, 85, 247, 0.2) 35%,
    rgba(56, 189, 248, 0.12) 65%,
    transparent 80%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 0;
}

/* Prismatic liquid glass border highlight */
.tab-nav::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1.5px;
  background: radial-gradient(
    240px circle at var(--nav-mouse-x, -200px) var(--nav-mouse-y, -200px),
    rgba(255, 255, 255, 0.75) 0%,
    rgba(165, 180, 252, 0.45) 30%,
    rgba(192, 132, 252, 0.25) 55%,
    transparent 85%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 2;
}

.tab-nav.is-hovering::before,
.tab-nav.is-hovering::after {
  opacity: 1;
}

/* Individual tab buttons with liquid glass physics */
.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: 99px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.tab-btn i {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.25s ease, filter 0.25s ease;
}

.tab-btn span {
  position: relative;
  z-index: 1;
  transition: color 0.25s ease, text-shadow 0.25s ease;
}

/* Liquid glass sheen overlay on each tab */
.tab-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    circle at var(--btn-mouse-x, 50%) var(--btn-mouse-y, 50%),
    rgba(255, 255, 255, 0.28) 0%,
    rgba(255, 255, 255, 0.08) 45%,
    transparent 80%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* Hover state — liquid swell & glossy refraction */
.tab-btn:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(99, 102, 241, 0.14));
  border-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
  backdrop-filter: blur(20px) saturate(200%);
  -webkit-backdrop-filter: blur(20px) saturate(200%);
  box-shadow: 
    inset 0 1.5px 2px rgba(255, 255, 255, 0.4),
    inset 0 -1px 2px rgba(0, 0, 0, 0.2),
    0 6px 24px rgba(99, 102, 241, 0.3),
    0 0 20px rgba(168, 85, 247, 0.25);
  transform: translateY(-2px);
}

.tab-btn:hover::before {
  opacity: 1;
}

.tab-btn:hover i {
  transform: translateY(-1.5px) scale(1.15);
  color: #a5b4fc;
  filter: drop-shadow(0 2px 10px rgba(99, 102, 241, 0.9));
}

.tab-btn:hover span {
  text-shadow: 0 0 14px rgba(165, 180, 252, 0.7);
}

/* Active tab state — deep glowing liquid capsule */
.tab-btn.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.32), rgba(139, 92, 246, 0.24));
  border: 1px solid rgba(165, 180, 252, 0.38);
  color: #ffffff;
  font-weight: 600;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 
    inset 0 1px 2px rgba(255, 255, 255, 0.4),
    0 4px 20px rgba(99, 102, 241, 0.36),
    0 0 24px rgba(139, 92, 246, 0.22);
}

.tab-btn.active i {
  color: #818cf8;
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.8));
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 3px;
  background: linear-gradient(90deg, #818cf8, #c084fc);
  border-radius: 99px;
  box-shadow: 0 0 10px #818cf8, 0 0 18px rgba(192, 132, 252, 0.8);
}

/* Header Actions */
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.icon-btn:hover { background: var(--bg-card); color: var(--text-primary); border-color: rgba(255,255,255,0.15); }
.icon-btn i { width: 16px; height: 16px; }

/* ─── Main ───────────────────────────────────────────────────── */
.app-main {
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* ─── Hero Banner ────────────────────────────────────────────── */
.hero-banner {
  position: relative;
  overflow: hidden;
  padding: 80px 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: calc(100vh - var(--header-h));
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99,102,241,0.12) 0%, transparent 70%);
}
.hero-banner.hidden { display: none !important; }

.hero-dismiss-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  z-index: 10;
}
.hero-dismiss-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}
.hero-dismiss-btn i { width: 18px; height: 18px; }

/* Particles */
.hero-particles { position: absolute; inset: 0; pointer-events: none; }
.particle {
  position: absolute;
  border-radius: 50%;
  animation: float 8s ease-in-out infinite;
}
.p1 { width: 300px; height: 300px; background: radial-gradient(circle, rgba(99,102,241,0.08), transparent); top: 10%; left: 5%; animation-delay: 0s; }
.p2 { width: 200px; height: 200px; background: radial-gradient(circle, rgba(124,58,237,0.06), transparent); top: 60%; right: 10%; animation-delay: 2s; }
.p3 { width: 150px; height: 150px; background: radial-gradient(circle, rgba(245,158,11,0.06), transparent); bottom: 20%; left: 30%; animation-delay: 4s; }
.p4 { width: 100px; height: 100px; background: radial-gradient(circle, rgba(16,185,129,0.06), transparent); top: 30%; right: 25%; animation-delay: 1s; }
.p5 { width: 80px; height: 80px; background: radial-gradient(circle, rgba(244,63,94,0.05), transparent); top: 70%; left: 15%; animation-delay: 3s; }
.p6 { width: 250px; height: 250px; background: radial-gradient(circle, rgba(99,102,241,0.05), transparent); bottom: 10%; right: 20%; animation-delay: 5s; }

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.05); }
}

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

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: var(--primary-dim);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary-light);
  margin-bottom: 28px;
  letter-spacing: 0.04em;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary-light), var(--amber), var(--primary-light));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s ease infinite;
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 36px;
  line-height: 1.7;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  border: none;
  border-radius: var(--radius-lg);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 24px rgba(99,102,241,0.4);
}
.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(99,102,241,0.5);
}
.cta-btn i { width: 20px; height: 20px; }

.hero-disclaimer {
  margin-top: 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ─── Tab Panels ─────────────────────────────────────────────── */
.tab-panels { display: block; }

.tab-panel {
  display: none;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}
.tab-panel.active { display: flex; flex-direction: column; }

/* ─── Panel Layout ───────────────────────────────────────────── */
.panel-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100%;
  overflow: hidden;
}

.panel-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 18px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--bg-surface);
}

.panel-output {
  overflow-y: auto;
  padding: 24px;
  background: var(--bg-base);
}

/* Panel Header */
.panel-header { display: flex; align-items: flex-start; gap: 14px; }
.panel-icon {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}
.panel-icon i { width: 22px; height: 22px; }
.panel-icon.indigo  { background: var(--primary-dim); color: var(--primary-light); }
.panel-icon.violet  { background: var(--violet-dim); color: #a78bfa; }
.panel-icon.emerald { background: var(--emerald-dim); color: var(--emerald); }
.panel-icon.amber   { background: var(--amber-dim); color: var(--amber); }
.panel-icon.teal    { background: var(--teal-dim); color: var(--teal); }
.panel-icon.rose    { background: var(--rose-dim); color: var(--rose); }

.panel-title { font-size: 1rem; font-weight: 700; margin-bottom: 2px; }
.panel-desc { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.4; }

/* ─── Upload Zone ────────────────────────────────────────────── */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-card);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-dim);
}
.upload-zone.loaded {
  border-color: var(--emerald);
  background: var(--emerald-dim);
}
.upload-zone i { width: 28px; height: 28px; color: var(--text-muted); }
.upload-zone.loaded i { color: var(--emerald); }
.upload-zone p { font-size: 0.82rem; color: var(--text-secondary); }
.upload-zone.loaded p { color: var(--emerald); font-weight: 600; }
.upload-hint { font-size: 0.72rem; color: var(--text-muted); }
.upload-link { color: var(--primary-light); cursor: pointer; text-decoration: underline; }

.upload-zone.mini { padding: 16px; }
.upload-zone.mini i { width: 20px; height: 20px; }

/* ─── Divider ────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Text Inputs ────────────────────────────────────────────── */
.text-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: inherit;
  line-height: 1.5;
  padding: 10px 12px;
  min-height: 80px;
  max-height: 140px;
  resize: vertical;
  transition: border-color var(--transition);
}
.text-input:focus { outline: none; border-color: var(--border-focus); }
.text-input::placeholder { color: var(--text-muted); }
.text-input.small { min-height: 60px; max-height: 100px; }

/* ─── Pill Group ─────────────────────────────────────────────── */
.option-group { display: flex; flex-direction: column; gap: 8px; }
.option-label { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.06em; text-transform: uppercase; }

.pill-group { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.pill:hover { border-color: var(--primary); color: var(--primary-light); }
.pill.active { background: var(--primary-dim); border-color: var(--primary); color: var(--primary-light); }

/* ─── Action Buttons ─────────────────────────────────────────── */
.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(99,102,241,0.3);
  margin-top: auto;
}
.action-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(99,102,241,0.45); }
.action-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.action-btn i { width: 18px; height: 18px; }

.action-btn.violet  { background: linear-gradient(135deg, var(--violet), #6d28d9); box-shadow: 0 4px 16px rgba(124,58,237,0.3); }
.action-btn.amber   { background: linear-gradient(135deg, var(--amber), #d97706); box-shadow: 0 4px 16px rgba(245,158,11,0.3); }
.action-btn.teal    { background: linear-gradient(135deg, var(--teal), #0d9488); box-shadow: 0 4px 16px rgba(20,184,166,0.3); }
.action-btn.rose    { background: linear-gradient(135deg, var(--rose), #e11d48); box-shadow: 0 4px 16px rgba(244,63,94,0.3); }

.action-btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
}
.action-btn-ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: rgba(255,255,255,0.15); }
.action-btn-ghost i { width: 16px; height: 16px; }

/* ─── Output Area ────────────────────────────────────────────── */
.output-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
}
.output-placeholder i { width: 48px; height: 48px; opacity: 0.3; }
.output-placeholder p { font-size: 0.88rem; max-width: 240px; line-height: 1.5; }

/* Output content styles */
.output-section {
  animation: fadeInUp 0.4s ease;
}

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

.output-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.output-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  transition: background var(--transition);
}
.output-card:hover { background: var(--bg-card-hover); }

.prose {
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text-secondary);
}
.prose h1, .prose h2, .prose h3 {
  color: var(--text-primary);
  font-weight: 700;
  margin: 20px 0 10px;
}
.prose h2 { font-size: 1rem; }
.prose h3 { font-size: 0.9rem; }
.prose p { margin-bottom: 12px; }
.prose ul, .prose ol { margin: 10px 0 12px 20px; }
.prose li { margin-bottom: 6px; }
.prose strong { color: var(--text-primary); font-weight: 600; }
.prose em { color: var(--primary-light); }
.prose code { font-family: 'JetBrains Mono', monospace; background: rgba(99,102,241,0.1); padding: 2px 6px; border-radius: 4px; font-size: 0.82rem; color: var(--primary-light); }
.prose blockquote { border-left: 3px solid var(--primary); padding-left: 14px; color: var(--text-secondary); margin: 12px 0; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton-line { height: 14px; margin-bottom: 10px; }
.skeleton-line.w-full { width: 100%; }
.skeleton-line.w-3\/4 { width: 75%; }
.skeleton-line.w-1\/2 { width: 50%; }
.skeleton-title { height: 22px; width: 60%; margin-bottom: 20px; }

/* ─── Compare Layout ─────────────────────────────────────────── */
.compare-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.compare-input-group { display: flex; flex-direction: column; gap: 8px; }
.compare-label { font-size: 0.75rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }
.compare-vs {
  display: flex; align-items: center; justify-content: center;
  padding: 6px;
}
.compare-vs span {
  padding: 4px 14px;
  background: var(--primary-dim);
  border: 1px solid var(--primary);
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary-light);
  letter-spacing: 0.08em;
}

/* Compare output cards */
.diff-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  border-left: 3px solid var(--border);
}
.diff-item.added    { border-left-color: var(--emerald); background: rgba(16,185,129,0.05); }
.diff-item.removed  { border-left-color: var(--rose); background: rgba(244,63,94,0.05); }
.diff-item.modified { border-left-color: var(--amber); background: rgba(245,158,11,0.05); }
.diff-item.risk     { border-left-color: var(--rose); background: rgba(244,63,94,0.05); }
.diff-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.diff-tag.added    { background: rgba(16,185,129,0.15); color: var(--emerald); }
.diff-tag.removed  { background: rgba(244,63,94,0.15); color: var(--rose); }
.diff-tag.modified { background: rgba(245,158,11,0.15); color: var(--amber); }
.diff-tag.neutral  { background: var(--bg-card); color: var(--text-muted); }

/* Diff-item accordion interaction */
.diff-item {
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
}
.diff-item:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}
.diff-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color var(--transition);
  flex-shrink: 0;
}
.diff-item.expanded .diff-chevron {
  transform: rotate(180deg);
  color: var(--text-primary);
}
.diff-details {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}
.diff-item.expanded .diff-details {
  max-height: 600px;
  opacity: 1;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.diff-item.expanded.added    { box-shadow: 0 0 16px rgba(16,185,129,0.1); }
.diff-item.expanded.removed  { box-shadow: 0 0 16px rgba(244,63,94,0.1); }
.diff-item.expanded.modified { box-shadow: 0 0 16px rgba(245,158,11,0.1); }

/* ─── Q&A Chat Layout ────────────────────────────────────────── */
.qa-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: 100%;
  overflow: hidden;
}

.qa-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 16px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--bg-surface);
}

.qa-chat-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
}

/* Doc status */
.doc-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--emerald-dim);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--emerald);
}
.doc-status i { width: 14px; height: 14px; flex-shrink: 0; }
.doc-status span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-status.hidden { display: none; }
.icon-btn-sm {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  background: transparent; border: none;
  color: var(--emerald); cursor: pointer; opacity: 0.7;
}
.icon-btn-sm:hover { opacity: 1; }
.icon-btn-sm i { width: 14px; height: 14px; }

/* Suggestions */
.suggestions-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.qa-suggestions { display: flex; flex-direction: column; gap: 6px; }
.suggestion-chip {
  display: flex; align-items: center;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
}
.suggestion-chip:hover { background: var(--primary-dim); border-color: var(--primary); color: var(--primary-light); }

/* Chat messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 40px;
  text-align: center;
  color: var(--text-secondary);
  flex: 1;
}
.welcome-icon {
  display: flex; align-items: center; justify-content: center;
  width: 60px; height: 60px;
  background: var(--primary-dim);
  border-radius: 50%;
  margin-bottom: 8px;
}
.welcome-icon i { width: 28px; height: 28px; color: var(--primary-light); }
.chat-welcome h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.chat-welcome p { font-size: 0.85rem; max-width: 360px; line-height: 1.6; }

/* Message bubbles */
.msg {
  display: flex;
  gap: 12px;
  animation: fadeInUp 0.3s ease;
  max-width: 85%;
}
.msg.user { flex-direction: row-reverse; align-self: flex-end; }
.msg.ai   { flex-direction: row; align-self: flex-start; }

.msg-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
}
.msg.user .msg-avatar { background: var(--primary); color: white; }
.msg.ai   .msg-avatar { background: var(--bg-elevated); border: 1px solid var(--border); color: var(--primary-light); }
.msg-avatar i { width: 16px; height: 16px; }

.msg-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.7;
  max-width: 100%;
}
.msg.user .msg-bubble {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}
.msg.ai .msg-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}
.msg.ai .msg-bubble .prose { font-size: 0.85rem; color: var(--text-primary); }

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 8px 0;
}
.typing-dot {
  width: 6px; height: 6px;
  background: var(--primary);
  border-radius: 50%;
  animation: typing 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.3; } 30% { transform: translateY(-6px); opacity: 1; } }

/* Chat input bar */
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}
.chat-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: inherit;
  line-height: 1.5;
  padding: 10px 14px;
  resize: none;
  max-height: 120px;
  transition: border-color var(--transition);
  overflow-y: auto;
}
.chat-input:focus { outline: none; border-color: var(--border-focus); }
.chat-input::placeholder { color: var(--text-muted); }

.send-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.send-btn:hover { background: var(--primary-light); transform: scale(1.05); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.send-btn i { width: 18px; height: 18px; }

/* ─── Risk Clause Cards ──────────────────────────────────────── */
.risk-summary-bar,
.risk-stats-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.risk-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  flex: 1;
  min-width: 100px;
}
.risk-stat-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.risk-stat-dot.low  { background: var(--risk-low); box-shadow: 0 0 8px var(--risk-low); }
.risk-stat-dot.med  { background: var(--risk-med); box-shadow: 0 0 8px var(--risk-med); }
.risk-stat-dot.high { background: var(--risk-high); box-shadow: 0 0 8px var(--risk-high); }
.risk-stat-info { display: flex; flex-direction: column; }
.risk-stat-count { font-size: 1.2rem; font-weight: 800; }
.risk-stat-label { font-size: 0.7rem; color: var(--text-muted); }

/* Hidden file input styling for 100% reliable programmatic clicking */
.file-input-hidden {
  position: absolute !important;
  width: 0.1px !important;
  height: 0.1px !important;
  opacity: 0 !important;
  overflow: hidden !important;
  z-index: -10 !important;
  pointer-events: none !important;
}

.clause-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 4px solid transparent;
  user-select: none;
}
.clause-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.16);
}
.clause-card.low  { border-left-color: var(--risk-low); }
.clause-card.med,
.clause-card.medium  { border-left-color: var(--risk-med); }
.clause-card.high { border-left-color: var(--risk-high); }
.clause-card.expanded.high {
  box-shadow: 0 0 18px rgba(239,68,68,0.15);
  background: rgba(239,68,68,0.04);
}
.clause-card.expanded.med,
.clause-card.expanded.medium {
  box-shadow: 0 0 18px rgba(245,158,11,0.12);
}
.clause-card.expanded.low {
  box-shadow: 0 0 18px rgba(16,185,129,0.12);
}

.clause-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.clause-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  flex-wrap: wrap;
}
.clause-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color var(--transition);
  flex-shrink: 0;
}
.clause-card.expanded .clause-chevron {
  transform: rotate(180deg);
  color: var(--text-primary);
}

.clause-risk-badge {
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.clause-risk-badge.low  { background: rgba(16,185,129,0.15); color: var(--risk-low); }
.clause-risk-badge.med,
.clause-risk-badge.medium  { background: rgba(245,158,11,0.15); color: var(--risk-med); }
.clause-risk-badge.high { background: rgba(239,68,68,0.15); color: var(--risk-high); }
.clause-title { font-size: 0.88rem; font-weight: 700; }
.clause-text { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.6; }

.clause-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}
.clause-card.expanded .clause-body {
  max-height: 1200px;
  opacity: 1;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.clause-explanation { font-size: 0.78rem; color: var(--text-muted); line-height: 1.6; }

/* ─── Checklist Items ────────────────────────────────────────── */
.checklist-group { margin-bottom: 24px; }
.checklist-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.checklist-group-title i { width: 16px; height: 16px; }

.checklist-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  align-items: flex-start;
  transition: background var(--transition);
  cursor: pointer;
}
.checklist-item:hover { background: var(--bg-card-hover); }
.checklist-item.done { opacity: 0.65; }
.checklist-item.done .checklist-action { text-decoration: line-through; text-decoration-color: var(--text-muted); }
.checklist-item.done .checklist-priority { opacity: 0.4; }

.checklist-check {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-radius: 6px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  margin-top: 2px;
}
.checklist-item.done .checklist-check { background: var(--teal); border-color: var(--teal); }
.checklist-item.done .checklist-check::after { content: '✓'; color: white; font-size: 12px; font-weight: 700; }

.checklist-content { flex: 1; }
.checklist-action { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.checklist-why { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }
.checklist-priority {
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
  margin-top: 2px;
}
.checklist-priority.urgent { background: rgba(239,68,68,0.15); color: #ef4444; }
.checklist-priority.soon   { background: rgba(245,158,11,0.15); color: var(--amber); }
.checklist-priority.normal { background: rgba(99,102,241,0.15); color: var(--primary-light); }

/* ─── Lawyer Prep Questions ──────────────────────────────────── */
.question-category,
.question-cat {
  margin-bottom: 24px;
}
.question-category-title,
.question-cat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.question-category-title i,
.question-cat-header i { width: 16px; height: 16px; color: var(--rose); }

/* Checklist Progress Bar */
.checklist-progress-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.checklist-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.checklist-progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.checklist-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), #2dd4bf);
  border-radius: 99px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.question-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
  user-select: none;
}
.question-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(244,63,94,0.3);
  transform: translateY(-1px);
}
.question-item.expanded {
  border-color: rgba(244,63,94,0.45);
  background: rgba(244,63,94,0.04);
  box-shadow: 0 0 16px rgba(244,63,94,0.1);
}
.question-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--rose);
  background: var(--rose-dim);
  border: 1px solid rgba(244,63,94,0.25);
  padding: 2px 8px;
  border-radius: 99px;
  flex-shrink: 0;
  margin-top: 1px;
}
.question-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.question-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.question-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.45;
}
.question-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color var(--transition);
  flex-shrink: 0;
}
.question-item.expanded .question-chevron {
  transform: rotate(180deg);
  color: var(--rose);
}

.question-details {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}
.question-item.expanded .question-details {
  max-height: 500px;
  opacity: 1;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(244,63,94,0.2);
}

.question-why {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.question-good-ans {
  margin-top: 6px;
  font-size: 0.76rem;
  color: var(--emerald);
  font-weight: 500;
  line-height: 1.4;
}

/* Copy button */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.copy-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.copy-btn i { width: 13px; height: 13px; }

/* ─── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  display: flex; align-items: center; gap: 8px;
  font-size: 1rem; font-weight: 700;
}
.modal-header h3 i { width: 18px; height: 18px; color: var(--primary); }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.modal-footer .action-btn { width: auto; margin-top: 0; }
.modal-footer .action-btn-ghost { width: auto; }

/* Form elements */
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.api-key-row { display: flex; align-items: center; gap: 8px; }
.form-input, .form-select {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color var(--transition);
}
.form-input:focus, .form-select:focus { outline: none; border-color: var(--border-focus); }
.form-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 36px; }
.form-select option { background: var(--bg-elevated); color: var(--text-primary); }
.form-hint { font-size: 0.75rem; color: var(--text-muted); line-height: 1.5; }
.form-hint a { color: var(--text-link); }

.api-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background var(--transition);
}
.status-dot.ok { background: var(--emerald); box-shadow: 0 0 6px var(--emerald); }
.status-dot.error { background: var(--rose); box-shadow: 0 0 6px var(--rose); }

/* ─── Toast Notifications ────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 300;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease;
  max-width: 320px;
}
.toast.success { border-color: rgba(16,185,129,0.4); }
.toast.error   { border-color: rgba(244,63,94,0.4); }
.toast.info    { border-color: rgba(99,102,241,0.4); }
.toast i { width: 16px; height: 16px; flex-shrink: 0; }
.toast.success i { color: var(--emerald); }
.toast.error   i { color: var(--rose); }
.toast.info    i { color: var(--primary-light); }

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

/* ─── Loading Spinner ────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Disclaimer Banner ──────────────────────────────────────── */
.disclaimer-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.disclaimer-banner i { width: 16px; height: 16px; color: var(--amber); flex-shrink: 0; margin-top: 1px; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 320px; }
  .tab-btn span { display: none; }
  .logo-tagline { display: none; }
}

@media (max-width: 700px) {
  .panel-layout, .qa-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .panel-sidebar, .qa-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 45vh;
    overflow-y: auto;
  }
  .panel-output, .qa-chat-area { min-height: 40vh; }
  .tab-panel { height: auto; min-height: calc(100vh - var(--header-h)); overflow: visible; }
  .app-main { overflow-y: auto; }
  .hero-banner { padding: 40px 20px; min-height: auto; }
  .hero-title { font-size: 2rem; }
  .hero-subtitle { font-size: 0.9rem; }
  .compare-inputs .compare-input-group .text-input.small { rows: 3; }
}

/* ─── Misc Utilities ─────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.mt-2 { margin-top: 8px; }
.text-muted { color: var(--text-muted); font-size: 0.78rem; }

/* Input section */
.input-section { display: flex; flex-direction: column; gap: 12px; }

/* ─── Sample Bar & Pills ─────────────────────────────────────── */
.sample-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
  margin-bottom: 6px;
}
.sample-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sample-pill {
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 500;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 99px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sample-pill:hover {
  background: var(--primary-dim);
  border-color: var(--primary-light);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.sample-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ─── Header Status Chip ─────────────────────────────────────── */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.status-chip:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.25);
  color: var(--text-primary);
}
.status-chip.live {
  border-color: rgba(16,185,129,0.4);
  background: rgba(16,185,129,0.12);
  color: #34d399;
}
.status-chip.demo {
  border-color: rgba(124,58,237,0.4);
  background: rgba(124,58,237,0.15);
  color: #c084fc;
}
.status-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
}
.status-chip.live .status-pulse {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}
.status-chip.demo .status-pulse {
  background: #a855f7;
  box-shadow: 0 0 8px #a855f7;
}

/* ─── Hero CTA Secondary ─────────────────────────────────────── */
.cta-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all var(--transition);
}
.cta-btn-secondary:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.35);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* ─── Print Styles ───────────────────────────────────────────── */
@media print {
  .app-header, .panel-sidebar, .qa-sidebar, .toast-container, .modal-backdrop, .copy-btn, .action-btn, .action-btn-ghost, .sample-bar {
    display: none !important;
  }
  body, .app-main, .tab-panel, .panel-output {
    background: white !important;
    color: black !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .output-card {
    border: 1px solid #ccc !important;
    background: white !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .prose {
    color: #111 !important;
  }
}

/* ─── Accessibility: Focus Visible ───────────────────────────── */
:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}
.tab-btn:focus-visible,
.action-btn:focus-visible,
.cta-btn:focus-visible { outline-offset: 3px; }

/* ─── Selection Color ────────────────────────────────────────── */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: var(--text-primary);
}

/* ─── Status Pulse Animation ─────────────────────────────────── */
.status-chip.live .status-pulse,
.status-chip.demo .status-pulse {
  animation: statusPulse 2s ease-in-out infinite;
}
@keyframes statusPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ─── Enhanced Output Card Entrance ──────────────────────────── */
.output-card {
  animation: cardFadeIn 0.35s ease backwards;
}
.output-card:nth-child(2) { animation-delay: 0.05s; }
.output-card:nth-child(3) { animation-delay: 0.1s; }
.output-card:nth-child(4) { animation-delay: 0.15s; }
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Chat Message Smooth Scroll Anchor ──────────────────────── */
.chat-messages { scroll-behavior: smooth; }

/* ─── Enhanced Clause Card Hover Glow ────────────────────────── */
.clause-card.high:hover { box-shadow: 0 0 12px rgba(239,68,68,0.12); }
.clause-card.medium:hover { box-shadow: 0 0 12px rgba(245,158,11,0.12); }
.clause-card.low:hover { box-shadow: 0 0 12px rgba(16,185,129,0.12); }

/* ─── Better Upload Zone Transition ──────────────────────────── */
.upload-zone {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.upload-zone:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.12);
}

/* ─── Sample Pill Active Feedback ────────────────────────────── */
.sample-pill:active {
  transform: scale(0.96);
}

/* ─── Action Button Press Effect ─────────────────────────────── */
.action-btn:active:not(:disabled) {
  transform: scale(0.98);
}

/* ─── Smooth Tab Panel Transitions ───────────────────────────── */
.tab-panel.active {
  animation: panelFadeIn 0.3s ease;
}
@keyframes panelFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ─── Toast Improvements ─────────────────────────────────────── */
.toast {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ─── Improved CTA Secondary Button ──────────────────────────── */
.cta-btn-secondary {
  font-family: inherit;
}
.cta-btn-secondary i { width: 18px; height: 18px; }
