/* ══════════════════════════════════════════════════════
   Crewlyze — Premium Dark Web UI
   Design: Obsidian + Electric Violet + Cyan Accents
   ══════════════════════════════════════════════════════ */

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

:root {
  /* Palette */
  --bg-base:      #09090b;
  --bg-surface:   #111113;
  --bg-elevated:  #18181b;
  --bg-card:      #1c1c1f;
  --bg-hover:     #27272a;

  --border:       rgba(255,255,255,0.07);
  --border-mid:   rgba(255,255,255,0.12);

  --violet:       #7c3aed;
  --violet-light: #a78bfa;
  --violet-glow:  rgba(124,58,237,0.25);
  --cyan:         #22d3ee;
  --cyan-glow:    rgba(34,211,238,0.18);
  --rose:         #f43f5e;
  --emerald:      #10b981;
  --amber:        #f59e0b;

  --text-primary:   #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted:     #52525b;

  /* Sidebar */
  --sidebar-w: 280px;

  /* Type */
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.7);
  --shadow-violet: 0 0 24px var(--violet-glow);
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  overflow: hidden;
}

/* ── Layout shell ───────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.3s cubic-bezier(0.4,0,0.2,1), transform 0.3s;
  overflow: hidden;
}
.sidebar.collapsed { width: 56px; }
.sidebar.collapsed .sidebar-section,
.sidebar.collapsed .sidebar-footer { opacity: 0; pointer-events: none; }
.sidebar.collapsed .logo-text { display: none; }

.main-area {
  margin-left: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: margin-left 0.3s;
}
.sidebar.collapsed ~ .main-area { margin-left: 56px; }

/* ── Sidebar Header ─────────────────────────────────── */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  min-height: 60px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  font-size: 22px;
  color: var(--violet-light);
  filter: drop-shadow(0 0 8px var(--violet-glow));
}
.logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.logo-accent { color: var(--violet-light); }
.sidebar-toggle {
  background: none;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── Sidebar Sections ───────────────────────────────── */
.sidebar-section {
  padding: 14px 14px 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 2px;
  margin-bottom: 4px;
}

/* Projects list */
.projects-list { display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow-y: auto; }
.projects-empty { font-size: 0.78rem; color: var(--text-muted); text-align: center; padding: 12px 0; line-height: 1.6; }
.project-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.project-item:hover { background: var(--bg-hover); }
.project-item.active { background: var(--violet-glow); border-color: rgba(124,58,237,0.3); }
.project-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.project-dot.completed { background: var(--emerald); }
.project-dot.running   { background: var(--amber); animation: pulse 1.4s infinite; }
.project-dot.failed    { background: var(--rose); }
.project-name { font-size: 0.82rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-del { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; opacity: 0; transition: opacity 0.15s; }
.project-item:hover .project-del { opacity: 1; }
.project-del:hover { color: var(--rose); }

/* Form fields */
.field-label { font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; }
.field-select, .field-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  color: var(--text-primary);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s;
}
.field-select:focus, .field-input:focus { border-color: var(--violet-light); }
.field-select option { background: var(--bg-elevated); }
.field-range {
  width: 100%;
  accent-color: var(--violet-light);
  cursor: pointer;
}
.key-input-wrap { display: flex; gap: 6px; align-items: center; }
.key-input-wrap .field-input { flex: 1; }
.btn-eye { background: none; border: 1px solid var(--border-mid); color: var(--text-secondary); border-radius: var(--r-sm); padding: 6px 8px; cursor: pointer; font-size: 14px; }
.btn-eye:hover { background: var(--bg-hover); }

.connection-status { font-size: 0.75rem; min-height: 18px; }
.connection-status.ok    { color: var(--emerald); }
.connection-status.error { color: var(--rose); }
.connection-status.loading { color: var(--amber); }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  font-size: 0.7rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: rgba(9,9,11,0.8);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.breadcrumb { display: flex; gap: 6px; align-items: center; font-size: 0.85rem; }
.breadcrumb-item { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-primary); font-weight: 500; }
.breadcrumb-sep { color: var(--text-muted); }

.status-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 99px;
  letter-spacing: 0.05em;
}
.status-pill.idle      { background: rgba(82,82,91,0.2);  color: var(--text-muted); }
.status-pill.running   { background: rgba(245,158,11,0.15); color: var(--amber); animation: pulse 1.8s infinite; }
.status-pill.complete  { background: rgba(16,185,129,0.15); color: var(--emerald); }
.status-pill.error     { background: rgba(244,63,94,0.15);  color: var(--rose); }

/* ── Screens ─────────────────────────────────────────── */
.screen { display: none; flex: 1; min-height: 0; overflow-y: auto; padding: 32px 28px 28px; }
.screen.active { display: flex; flex-direction: column; gap: 28px; }

/* ── Landing ─────────────────────────────────────────── */
.landing-hero {
  position: relative;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 60px 24px 44px;
  background: radial-gradient(circle at top, rgba(124, 58, 237, 0.12) 0%, transparent 65%),
              rgba(18, 18, 22, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--r-xl);
  margin-bottom: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.landing-hero::before {
  content: "";
  position: absolute;
  top: -10%; left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 450px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.22) 0%, rgba(34, 211, 238, 0.08) 45%, rgba(9, 9, 11, 0) 75%);
  filter: blur(80px);
  z-index: -1;
  pointer-events: none;
}
.landing-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: center;
  mask-image: radial-gradient(circle, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(circle, black 30%, transparent 75%);
  z-index: -1;
  pointer-events: none;
}
.hero-badge {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 6px 16px;
  border-radius: 99px;
  border: 1px solid rgba(124, 58, 237, 0.35);
  color: var(--text-primary);
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.12) 0%, rgba(34, 211, 238, 0.08) 100%);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.06);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: default;
}
.hero-badge:hover {
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 4px 20px rgba(34, 211, 238, 0.15);
  transform: translateY(-1px);
}
.hero-title {
  font-size: clamp(2.4rem, 5.5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -1.5px;
  color: #ffffff;
  text-shadow: 0 0 40px rgba(124, 58, 237, 0.1);
  margin-top: 4px;
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.gradient-text {
  background: linear-gradient(135deg, #a78bfa 0%, #22d3ee 35%, #f43f5e 70%, #a78bfa 100%);
  background-size: 300% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 6s ease infinite;
}
.hero-subtitle {
  font-size: 1.08rem;
  color: #94a3b8;
  max-width: 580px;
  line-height: 1.7;
  margin-bottom: 16px;
}

/* Upload zone */
.upload-zone {
  width: 100%;
  max-width: 520px;
  border: 2px dashed rgba(124,58,237,0.35);
  border-radius: var(--r-xl);
  padding: 40px 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  background: rgba(124,58,237,0.04);
  position: relative;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--violet-light);
  background: rgba(124,58,237,0.1);
  box-shadow: var(--shadow-violet);
}
.upload-icon { font-size: 2.5rem; margin-bottom: 10px; }
.upload-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 6px; }
.upload-hint { font-size: 0.85rem; color: var(--text-secondary); }
.upload-link { color: var(--violet-light); cursor: pointer; text-decoration: underline; }
.upload-meta { margin-top: 14px; font-size: 0.82rem; color: var(--emerald); }
.upload-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 30px;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px 22px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.feature-card:hover {
  border-color: var(--border-mid);
  background: var(--bg-elevated);
  transform: translateY(-4px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}
.feature-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.feature-step-num {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}
.feature-step-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.feature-step-badge.clean { background: rgba(16, 185, 129, 0.12); color: var(--emerald); }
.feature-step-badge.relations { background: rgba(34, 211, 238, 0.12); color: var(--cyan); }
.feature-step-badge.insights { background: rgba(245, 158, 11, 0.12); color: var(--amber); }
.feature-step-badge.visualize { background: rgba(167, 139, 250, 0.12); color: var(--violet-light); }
.feature-step-badge.output { background: rgba(244, 63, 94, 0.12); color: var(--rose); }

.feature-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}
.feature-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.feature-bullet-list {
  list-style: none;
  padding: 0;
  margin: 4px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,0.03);
  padding-top: 12px;
}
.feature-bullet-list li {
  font-size: 0.78rem;
  color: var(--text-secondary);
  position: relative;
  padding-left: 14px;
  line-height: 1.45;
}
.feature-bullet-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--violet-light);
  font-weight: bold;
}
.feature-bullet-list li strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ── Modal ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 680px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.05rem; font-weight: 700; }
.modal-body { padding: 20px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.modal-hint { font-size: 0.82rem; color: var(--text-secondary); }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* Task cards */
.task-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.task-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.task-card input[type=checkbox] { display: none; }
.task-card:hover { border-color: var(--violet-light); background: var(--bg-hover); }
.task-card.checked { border-color: var(--violet-light); background: rgba(124,58,237,0.1); }
.task-card.disabled { opacity: 0.4; pointer-events: none; }
.task-card-icon { font-size: 1.5rem; flex-shrink: 0; }
.task-card-body { flex: 1; }
.task-card-title { font-size: 0.88rem; font-weight: 600; }
.task-card-desc  { font-size: 0.73rem; color: var(--text-secondary); margin-top: 2px; line-height: 1.4; }
.task-card-desc em { color: var(--amber); font-style: normal; }
.task-card-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-mid);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  color: transparent;
  background: transparent;
  transition: all 0.2s;
  flex-shrink: 0;
}
.task-card.checked .task-card-check {
  background: var(--violet-light);
  border-color: var(--violet-light);
  color: white;
}

/* Depth selector */
.depth-selector { display: flex; flex-direction: column; gap: 8px; }
.depth-label { font-size: 0.78rem; color: var(--text-secondary); font-weight: 500; }
.depth-options { display: flex; gap: 10px; }
.depth-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-mid);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.depth-option input { display: none; }
.depth-option:hover  { border-color: var(--violet-light); background: var(--bg-hover); }
.depth-option.active { border-color: var(--violet-light); background: rgba(124,58,237,0.1); }
.depth-icon { font-size: 1.4rem; }
.depth-name { font-size: 0.85rem; font-weight: 600; }
.depth-desc { font-size: 0.72rem; color: var(--text-secondary); }

.field-group { display: flex; flex-direction: column; gap: 6px; }

/* ── Running Screen ──────────────────────────────────── */
.running-header {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
}
.running-spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--border-mid);
  border-top-color: var(--violet-light);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex-shrink: 0;
}
.running-header h2 { font-size: 1.05rem; font-weight: 700; }
.running-sub { font-size: 0.82rem; color: var(--text-secondary); margin-top: 4px; }

.stages-track {
  display: flex;
  align-items: center;
  gap: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  border-radius: 0;
  padding: 24px 0 32px 0; /* Increase bottom padding to accommodate labels */
  overflow: visible;      /* Allow labels to be shown fully without vertical clipping */
  box-shadow: none;
}
.stage-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex: 1;
  position: relative;
  min-width: 90px;
}
.stage-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 11px;
  left: calc(50% + 18px);
  right: calc(-50% + 18px);
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  z-index: 0;
  border-radius: 99px;
  transition: all 0.4s ease;
}
.stage-item.done:not(:last-child)::after  {
  background: var(--emerald);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}
.stage-item.active:not(:last-child)::after {
  background: linear-gradient(90deg, var(--violet-light) 0%, rgba(255, 255, 255, 0.05) 100%);
}
.stage-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2.5px solid var(--border-mid);
  z-index: 1;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.2);
}
.stage-item.done .stage-dot {
  background: var(--emerald);
  border-color: var(--emerald);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.5);
  transform: scale(1.0);
}
.stage-item.active .stage-dot {
  background: var(--violet-light);
  border-color: var(--violet-light);
  transform: scale(1.15); /* Scale active dot to stand out */
  box-shadow: 0 0 18px rgba(167, 139, 250, 0.6);
  animation: stageDotActivePulse 1.4s infinite alternate;
}
.stage-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.3s;
  white-space: nowrap;
}
.stage-item.done .stage-label {
  color: var(--emerald);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}
.stage-item.active .stage-label {
  color: var(--violet-light);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(167, 139, 250, 0.4);
}

@keyframes stageDotActivePulse {
  0% {
    box-shadow: 0 0 0 0px rgba(167, 139, 250, 0.6), 0 0 12px rgba(167, 139, 250, 0.4);
  }
  100% {
    box-shadow: 0 0 0 8px rgba(167, 139, 250, 0.0), 0 0 20px rgba(167, 139, 250, 0.8);
  }
}
/* ── Stage POV Panel ────────────────────────────────── */
.stage-pov-panel {
  background: rgba(22, 22, 25, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--r-lg);
  padding: 24px;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.3s ease;
  min-height: 250px;
}

.pov-initial-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 180px;
  color: var(--text-muted);
  gap: 12px;
}

.pov-pulse-ring {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--violet-light);
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

.pov-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pov-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pov-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.pov-content {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 180px;
  border-radius: var(--r-md);
  background: rgba(13, 13, 15, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.03);
  overflow: hidden;
  position: relative;
}

/* Cleaning Simulator */
.pov-scanner-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 18px 24px;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #10b981;
  position: relative;
}
.pov-scanner-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, #10b981, transparent);
  box-shadow: 0 0 8px #10b981;
  animation: scanline 2.5s ease-in-out infinite;
  z-index: 5;
}
.pov-scanner-row {
  display: flex;
  justify-content: space-between;
  opacity: 0.85;
}
.pov-scanner-row.active {
  color: #ffffff;
  text-shadow: 0 0 4px #10b981;
}

/* Correlation Chord Simulator */
.pov-chords-svg {
  width: 240px;
  height: 150px;
  overflow: visible;
}
.pov-chords-rotate {
  transform-origin: 80px 50px;
  animation: rotateChords 25s linear infinite;
}
.pov-node {
  fill: rgba(15, 15, 18, 0.9);
  stroke: var(--violet-light);
  stroke-width: 1.5px;
  transition: all 0.3s;
  animation: nodePulse 2.4s ease-in-out infinite alternate;
}
.pov-node:nth-child(even) {
  animation-delay: 1.2s;
}
.pov-node:hover {
  stroke: var(--cyan);
  fill: var(--cyan);
}
.pov-chord-line {
  stroke: var(--violet-light);
  stroke-width: 1px;
  opacity: 0.15;
  stroke-dasharray: 4, 4;
  animation: dash 15s linear infinite;
}
.pov-chord-line.active {
  stroke: var(--cyan);
  stroke-width: 1.5px;
  opacity: 0.7;
  stroke-dasharray: none;
  animation: pulseGlow 1.5s infinite;
}

/* Insights Pulse */
.pov-insight-bulb {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 32px;
  width: 100%;
  height: 100%;
}
.pov-bulb-icon {
  width: 64px;
  height: 64px;
  color: #f59e0b;
  filter: drop-shadow(0 0 12px rgba(245,158,11,0.5));
  animation: bounceSlow 2s ease-in-out infinite;
}
.pov-insight-bullets {
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
}
.pov-bullet-text {
  opacity: 0;
  transform: translateX(-5px);
  animation: slideInText 4s forwards infinite;
}
.pov-bullet-text:nth-child(1) { animation-delay: 0.2s; }
.pov-bullet-text:nth-child(2) { animation-delay: 1.2s; }
.pov-bullet-text:nth-child(3) { animation-delay: 2.2s; }

/* Visual compiler coordinates */
.pov-compiler-svg {
  width: 250px;
  height: 150px;
  overflow: visible;
}
.pov-axis {
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 1.5px;
}
.pov-compiler-path {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 2px;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: drawPath 3.5s ease-in-out forwards infinite;
}
.pov-dot {
  fill: #ec4899;
  opacity: 0;
  animation: showDot 3.5s ease-in-out infinite;
}

/* Plotly Skeleton Dashboard */
.pov-plotly-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  padding: 14px;
}
.pov-skeleton-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  height: 140px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.pov-skeleton-card::after {
  content: '';
  position: absolute;
  top: 0; left: -150%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  animation: shimmer 1.5s infinite;
}
.pov-skeleton-header {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  width: 60%;
}
.pov-skeleton-body {
  height: 80px;
  border-radius: 4px;
  border: 1.5px dashed rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 6px;
}
.pov-skeleton-bar {
  width: 6px;
  border-radius: 2px;
  background: var(--violet-light);
  opacity: 0.4;
  height: 40%;
  animation: skeletonBarGrow 1.8s ease-in-out infinite alternate;
}
.pov-skeleton-bar:nth-child(2) { height: 70%; animation-delay: 0.3s; background: var(--cyan); }
.pov-skeleton-bar:nth-child(3) { height: 50%; animation-delay: 0.6s; background: #ec4899; }

/* Keyframes */
@keyframes scanline {
  0% { top: 0%; }
  50% { top: 100%; }
  100% { top: 0%; }
}
@keyframes dash {
  to { stroke-dashoffset: -1000; }
}
@keyframes pulseGlow {
  0%, 100% { filter: drop-shadow(0 0 1px var(--cyan)); opacity: 0.6; }
  50% { filter: drop-shadow(0 0 6px var(--cyan)); opacity: 0.9; }
}
@keyframes bounceSlow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes slideInText {
  0% { opacity: 0; transform: translateX(-6px); }
  10%, 40% { opacity: 1; transform: translateX(0); }
  50%, 100% { opacity: 0; transform: translateX(6px); }
}
@keyframes drawPath {
  0% { stroke-dashoffset: 200; }
  45%, 100% { stroke-dashoffset: 0; }
}
@keyframes showDot {
  0%, 30% { opacity: 0; transform: scale(0.3); }
  45%, 85% { opacity: 1; transform: scale(1); }
  95%, 100% { opacity: 0; }
}
@keyframes shimmer {
  to { left: 150%; }
}
@keyframes skeletonBarGrow {
  0% { height: 20%; }
  100% { height: 85%; }
}
@keyframes stageDotActivePulse {
  0% { transform: scale(0.95); box-shadow: 0 0 6px var(--violet-light); }
  100% { transform: scale(1.15); box-shadow: 0 0 16px var(--violet-light), 0 0 4px var(--violet-light); }
}
@keyframes rotateChords {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes nodePulse {
  0% { r: 3.5px; fill: rgba(124, 58, 237, 0.5); filter: drop-shadow(0 0 1px var(--violet-light)); }
  100% { r: 5.5px; fill: var(--cyan); filter: drop-shadow(0 0 5px var(--cyan)); }
}

.log-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  max-height: 400px;
}
.log-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.log-output {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
}
.log-output .log-line { padding: 1px 0; }
.log-output .log-line.thought  { color: #c084fc; }
.log-output .log-line.action   { color: var(--cyan); }
.log-output .log-line.response { color: var(--emerald); }
.log-output .log-line.error    { color: var(--rose); }
.log-output .log-line.warning  { color: var(--amber); }
.log-output .log-line.done     { color: var(--emerald); font-weight: 600; }

/* ── Stats Row ───────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  flex-shrink: 0;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--border-mid); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--violet-light), var(--cyan));
}
.stat-val { font-size: 1.9rem; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.stat-lbl { font-size: 0.72rem; color: var(--text-muted); margin-top: 6px; font-weight: 500; letter-spacing: 0.04em; }

/* ── Tabs ─────────────────────────────────────────────── */
.tabs-bar {
  display: flex;
  gap: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 4px;
  flex-shrink: 0;
  overflow-x: auto;
}
.tab-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 7px 16px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: var(--font-body);
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
}
.tab-btn:hover  { background: var(--bg-hover); color: var(--text-primary); }
.tab-btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 20%; right: 20%;
  height: 2px;
  background: linear-gradient(90deg, var(--violet-light), var(--cyan));
  border-radius: 2px;
  box-shadow: 0 0 8px var(--violet-glow);
}

.tab-panels { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.tab-panel { display: none; flex: 1; overflow-y: auto; padding: 20px 0; flex-direction: column; gap: 16px; }
.tab-panel.active { display: flex; }

.panel-title { font-size: 1rem; font-weight: 700; }
.panel-toolbar { display: flex; align-items: center; justify-content: space-between; }

/* ── Data Table ─────────────────────────────────────── */
.table-wrap { overflow: auto; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--bg-card); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.data-table th {
  background: var(--bg-elevated);
  padding: 9px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.data-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table tr:hover td { background: var(--bg-hover); }
.data-table-container { max-height: 500px; overflow: auto; }

/* Minimized preview */
.preview-minimized {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 20px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ── Cleaning list ───────────────────────────────────── */
.cleaning-list { display: flex; flex-direction: column; gap: 10px; }
.cleaning-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  border-left: 3px solid var(--emerald);
}
.cleaning-check { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.cleaning-text { font-size: 0.84rem; color: var(--text-primary); line-height: 1.5; }

/* ── Relations grid ──────────────────────────────────── */
.relations-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.relation-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  border-left: 3px solid var(--cyan);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.relation-cols { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 600; }
.relation-col { background: rgba(34,211,238,0.1); color: var(--cyan); padding: 2px 8px; border-radius: 4px; }
.relation-arrow { color: var(--text-muted); }
.relation-type { font-size: 0.72rem; color: var(--text-muted); background: var(--bg-elevated); padding: 2px 8px; border-radius: 4px; display: inline-block; }

/* ── Insights ────────────────────────────────────────── */
.insights-list { display: flex; flex-direction: column; gap: 16px; }
.insight-card {
  background: rgba(22, 22, 25, 0.4);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  position: relative;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.insight-card:hover {
  transform: translateY(-2px);
  border-color: rgba(167, 139, 250, 0.3);
  background: rgba(28, 28, 33, 0.65);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3), 0 0 15px rgba(167, 139, 250, 0.08);
}
.insight-num-pill {
  width: 28px;
  height: 28px;
  background: var(--violet-glow);
  color: var(--violet-light);
  border: 1px solid rgba(167, 139, 250, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.2);
}
.insight-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.insight-section { display: flex; flex-direction: column; gap: 6px; }
.insight-section-label {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.insight-section-label.obs   { color: var(--cyan); }
.insight-section-label.impl  { color: var(--amber); }
.insight-section-label.strat { color: var(--violet-light); }
.insight-section-text { font-size: 0.88rem; color: var(--text-primary); line-height: 1.6; }
.insight-bullet { font-size: 0.86rem; color: var(--text-secondary); line-height: 1.5; margin-left: 12px; }

/* Icon SVG vertical alignment */
.icon-svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Charts ─────────────────────────────────────────── */
.charts-grid { display: flex; flex-direction: column; gap: 20px; }
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.chart-card-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chart-card-title { font-size: 0.88rem; font-weight: 600; }
.chart-card-type { font-size: 0.7rem; color: var(--text-muted); background: var(--bg-elevated); padding: 2px 8px; border-radius: 4px; }
.chart-card-body { padding: 4px; }
.chart-card-error { padding: 20px; color: var(--rose); font-size: 0.82rem; }

.png-charts-wrap { display: flex; flex-direction: column; gap: 12px; }
.png-grid { display: flex; flex-direction: column; gap: 20px; }
.png-chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.png-chart-card img { width: 100%; display: block; }
.png-chart-label { padding: 8px 14px; font-size: 0.75rem; color: var(--text-muted); }

.viz-code-details {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.viz-code-details summary {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  list-style: none;
  user-select: none;
}
.viz-code-details summary:hover { color: var(--text-primary); }
.viz-code-details[open] summary { border-bottom: 1px solid var(--border); color: var(--text-primary); }
.code-block {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.65;
  color: var(--cyan);
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
  max-height: 400px;
}

/* ── Chat ────────────────────────────────────────────── */
.chat-layout { display: flex; flex-direction: column; flex: 1; gap: 16px; }
.chat-main { display: flex; flex-direction: column; flex: 1; gap: 12px; }
.chat-header { display: flex; align-items: center; justify-content: space-between; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0;
  min-height: 280px;
  max-height: 440px;
}
.chat-msg { display: flex; gap: 10px; }
.chat-msg.user { flex-direction: row-reverse; }

.chat-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.chat-msg.user .chat-avatar { background: var(--violet-glow); color: var(--violet-light); }
.chat-msg.assistant .chat-avatar { background: rgba(34,211,238,0.15); color: var(--cyan); }

.chat-bubble {
  max-width: 75%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 0.84rem;
  line-height: 1.6;
}
.chat-msg.user .chat-bubble {
  background: rgba(124,58,237,0.15);
  border-color: rgba(124,58,237,0.25);
  border-radius: var(--r-md) 4px var(--r-md) var(--r-md);
}
.chat-msg.assistant .chat-bubble {
  border-radius: 4px var(--r-md) var(--r-md) var(--r-md);
}
.chat-bubble pre {
  background: var(--bg-surface);
  border-radius: var(--r-sm);
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  overflow-x: auto;
  margin: 8px 0;
  color: var(--cyan);
}
.chat-bubble img { max-width: 100%; border-radius: var(--r-md); margin-top: 8px; }

.chat-input-area { display: flex; flex-direction: column; gap: 8px; position: relative; }
.col-picker-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 72px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: var(--shadow-md);
}
.col-picker-dropdown.hidden { display: none; }
.col-picker-item {
  padding: 8px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}
.col-picker-item:hover { background: var(--bg-hover); }
.col-picker-item-type { font-size: 0.68rem; color: var(--text-muted); background: var(--bg-surface); padding: 1px 6px; border-radius: 3px; }
.col-picker-header { padding: 6px 14px; font-size: 0.65rem; letter-spacing: 0.08em; color: var(--text-muted); border-bottom: 1px solid var(--border); }

.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-textarea {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 10px 14px;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.5;
}
.chat-textarea:focus { border-color: var(--violet-light); }
.btn-send {
  padding: 10px 16px;
  align-self: flex-end;
  border-radius: var(--r-md);
  height: fit-content;
}

.chat-hints { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-hint-chip {
  font-size: 0.72rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
  white-space: nowrap;
}
.chat-hint-chip:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-mid); }

.export-bar {
  display: none !important;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn-primary {
  background: var(--violet);
  color: white;
  border: none;
  border-radius: var(--r-md);
  padding: 9px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary:hover { background: #6d28d9; box-shadow: var(--shadow-violet); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary.btn-lg { padding: 13px 30px; font-size: 0.95rem; border-radius: var(--r-lg); }
.btn-primary.btn-sm { padding: 6px 14px; font-size: 0.78rem; }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  padding: 9px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-mid); }
.btn-secondary.btn-sm { padding: 6px 12px; font-size: 0.78rem; }

.btn-ghost {
  background: none;
  color: var(--text-secondary);
  border: none;
  border-radius: var(--r-md);
  padding: 9px 16px;
  font-size: 0.85rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: all 0.15s;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon-lg { font-size: 18px; width: 34px; height: 34px; background: none; border: none; color: var(--text-secondary); cursor: pointer; border-radius: var(--r-sm); display: none; }

.btn-xs {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.7rem;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.15s;
}
.btn-xs:hover { border-color: var(--border-mid); color: var(--text-secondary); }

/* ── Sub titles ──────────────────────────────────────── */
.sub-title { font-size: 0.88rem; font-weight: 600; color: var(--text-secondary); }

/* ── Toast ───────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  padding: 12px 18px;
  font-size: 0.82rem;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.3s ease;
  max-width: 360px;
}
.toast.success { border-left: 3px solid var(--emerald); }
.toast.error   { border-left: 3px solid var(--rose); }
.toast.info    { border-left: 3px solid var(--violet-light); }
.toast.warning { border-left: 3px solid var(--amber); }

/* ── Utilities ───────────────────────────────────────── */
.hidden { display: none !important; }
.mt-8   { margin-top: 8px; }

/* ── Animations ─────────────────────────────────────── */
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes slideUp {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

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

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-area { margin-left: 0 !important; }
  .btn-icon-lg { display: flex; }
  .task-grid { grid-template-columns: 1fr; }
}

/* ── Dashboard Projects Grid ─────────────────────────── */
.dashboard-projects-section {
  margin-top: 32px;
  background: rgba(18, 18, 22, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: var(--r-xl);
  padding: 32px;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.section-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 20px;
}
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.projects-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}
.dashboard-project-card {
  background: rgba(22, 22, 25, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  cursor: pointer;
  position: relative;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 250px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
}
.dashboard-project-card:hover {
  transform: translateY(-5px);
  border-color: rgba(139, 92, 246, 0.4);
  background: rgba(28, 28, 33, 0.6);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), 0 0 25px rgba(124, 58, 237, 0.12);
}
.dashboard-project-card.active {
  border-color: var(--cyan);
  background: rgba(28, 28, 33, 0.8);
  box-shadow: 0 0 30px rgba(34, 211, 238, 0.15), 0 0 1px rgba(34, 211, 238, 0.5);
}

.db-project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 4px;
}
.db-project-date {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.db-project-status-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 6px;
  text-transform: uppercase;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.dashboard-project-card:hover .db-project-status-badge {
  opacity: 0;
  transform: translateY(-2px);
  pointer-events: none;
}
.db-project-status-badge.completed {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.db-project-status-badge.running {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.25);
  animation: pulse 1.6s infinite;
}
.db-project-status-badge.failed {
  background: rgba(244, 63, 94, 0.12);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.25);
}
.db-project-status-badge.idle {
  background: rgba(161, 161, 170, 0.12);
  color: #a1a1aa;
  border: 1px solid rgba(161, 161, 170, 0.2);
}

/* Project Thumbnail Preview Styling */
.db-project-preview-wrap {
  position: relative;
  width: 100%;
  height: 125px;
  border-radius: var(--r-md);
  overflow: hidden;
  margin: 10px 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #0d0d0f;
}
.db-project-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  filter: brightness(0.8) contrast(1.05);
}
.dashboard-project-card:hover .db-project-preview-img {
  transform: scale(1.06);
  filter: brightness(0.9) contrast(1.1);
}
.db-project-preview-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(13, 13, 15, 0.1) 0%, rgba(13, 13, 15, 0.5) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}
.dashboard-project-card:hover .db-project-preview-overlay {
  background: linear-gradient(180deg, rgba(13, 13, 15, 0) 0%, rgba(13, 13, 15, 0.65) 100%);
}

.db-project-folder-icon {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 15, 18, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.folder-svg {
  width: 20px;
  height: 20px;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.db-project-folder-icon.completed {
  color: #10b981;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.3);
}
.db-project-folder-icon.running {
  color: #f59e0b;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.3);
  animation: pulse-border 1.6s infinite;
}
.db-project-folder-icon.failed {
  color: #f43f5e;
  box-shadow: 0 4px 15px rgba(244, 63, 94, 0.2);
  border-color: rgba(244, 63, 94, 0.3);
}
.db-project-folder-icon.idle {
  color: var(--violet-light);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.2);
  border-color: rgba(124, 58, 237, 0.3);
}
.dashboard-project-card:hover .db-project-folder-icon {
  transform: scale(1.1);
  background: rgba(15, 15, 18, 0.9);
  border-color: currentColor;
}
.dashboard-project-card:hover .folder-svg {
  transform: scale(1.05);
}

.db-project-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #ffffff;
  text-align: left;
  letter-spacing: 0.2px;
  margin: 6px 0 10px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  transition: color 0.3s ease;
}
.dashboard-project-card:hover .db-project-card-title {
  color: var(--cyan);
}

.db-project-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 10px;
}
.db-project-filename {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.db-project-btn-del {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
  opacity: 0;
  transform: translateY(2px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  line-height: 1;
}
.dashboard-project-card:hover .db-project-btn-del {
  opacity: 1;
  transform: translateY(0);
}
.db-project-btn-del:hover {
  color: #ff3366;
  background: rgba(255, 51, 102, 0.15);
  border-color: rgba(255, 51, 102, 0.3);
  transform: scale(1.05);
}

.projects-empty-card {
  grid-column: 1 / -1;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 48px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 200px;
}
.empty-card-icon {
  font-size: 2.2rem;
}
.empty-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}
.empty-card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  max-width: 320px;
  line-height: 1.5;
}

/* ── Glowing API Highlight ──────────────────────────── */
@keyframes glowPulse {
  0% {
    box-shadow: 0 0 4px var(--violet-light);
    border-color: var(--violet-light);
  }
  50% {
    box-shadow: 0 0 16px var(--violet);
    border-color: var(--violet);
  }
  100% {
    box-shadow: 0 0 4px var(--violet-light);
    border-color: var(--violet-light);
  }
}
.highlight-glowing {
  animation: glowPulse 1.5s infinite ease-in-out;
  border-color: var(--violet-light) !important;
}

/* ── Interactive Wizard UI ──────────────────────────── */
.wizard-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#wizardStep1.active, #wizardStep2.active {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.wizard-step {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.wizard-step.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}
.wizard-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 12px var(--violet-glow));
}
.wizard-step-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}
.wizard-step-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  max-width: 400px;
  line-height: 1.5;
}
.btn-back {
  position: absolute;
  top: 20px;
  left: 20px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 10px 16px;
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}
.btn-back:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-mid);
}
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.text-center { text-align: center; }

/* ── Dashed Create Project Card (From User Image) ─────── */
.create-project-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(124, 58, 237, 0.35);
  border-radius: var(--r-xl);
  padding: 30px 24px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(18, 18, 22, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  min-height: 180px;
  width: 260px;
  max-width: 280px;
  margin: 0;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}
.create-project-card:hover {
  border-color: var(--cyan);
  background: rgba(124, 58, 237, 0.08);
  box-shadow: 0 0 30px rgba(124, 58, 237, 0.15), 0 0 1px rgba(34, 211, 238, 0.5);
  transform: translateY(-4px) scale(1.01);
}
.create-project-plus {
  font-size: 2.5rem;
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255, 255, 255, 0.02);
  line-height: 1;
}
.create-project-card:hover .create-project-plus {
  color: #ffffff;
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
  box-shadow: 0 0 15px rgba(34, 211, 238, 0.3);
  transform: rotate(90deg);
}
.create-project-text {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  text-transform: uppercase;
  transition: color 0.3s;
}
.create-project-card:hover .create-project-text {
  color: #ffffff;
}

/* ── Settings Row ───────────────────────────────────── */
.setting-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.setting-row .key-input-wrap {
  position: relative;
}

/* ── Custom Dialog Modal ──────────────────────────────── */
#customDialogModal .modal-box {
  border: 1px solid rgba(124, 58, 237, 0.35);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), var(--shadow-violet);
  background: rgba(18, 18, 22, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalScaleIn {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

#customDialogModal .modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
}

#customDialogInput {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  color: var(--text-primary);
  transition: all 0.25s ease;
}

#customDialogInput:focus {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.04);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.15);
  outline: none;
}


/* ── Custom Platform Enhancements ─────────────────────── */
.hidden {
  display: none !important;
}

.section-area {
  display: block;
}
.section-area.hidden {
  display: none !important;
}

.sections-switch {
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.section-switch-btn {
  font-family: var(--font-body);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-switch-btn.active {
  background: var(--violet) !important;
  color: #ffffff !important;
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.4);
}

/* Relation Schema Mapper Styling */
.relation-mapper-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
  width: 100%;
}

.relation-card {
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  width: 100%;
}

.relation-card:hover {
  transform: translateY(-2px);
  border-color: var(--violet-light);
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.15);
}

.relation-node {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-low);
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 150px;
  text-align: center;
}

.relation-node-type {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.relation-connector {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 120px;
}

.relation-line {
  height: 2px;
  background: linear-gradient(90deg, var(--violet) 0%, var(--cyan) 100%);
  width: 100%;
  border-radius: 1px;
  position: relative;
}

.relation-line::after {
  content: '';
  position: absolute;
  right: 0;
  top: -4px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid var(--cyan);
}

.relation-info {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-top: 6px;
  text-align: center;
  line-height: 1.4;
  padding: 0 8px;
}

/* Structured Insights Styling */
.insight-header-card {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.08) 0%, rgba(34, 211, 238, 0.04) 100%);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 24px;
}

.insight-header-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--violet-light);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.insight-header-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.insight-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.insight-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  padding: 16px;
  text-align: center;
  transition: all 0.25s ease;
}

.insight-stat-card:hover {
  border-color: var(--cyan);
  box-shadow: 0 4px 15px rgba(34, 211, 238, 0.1);
}

.insight-stat-val {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 4px;
}

.insight-stat-lbl {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.insight-warning-card {
  background: rgba(244, 63, 94, 0.03);
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: var(--r-md);
  padding: 16px;
  margin-top: 24px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.insight-warning-card-icon {
  font-size: 1.4rem;
  color: var(--rose);
  line-height: 1;
}

.insight-warning-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.insight-warning-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ff8b9e;
}

.insight-warning-card-text {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* ── ChatGPT Interface Layout Overrides ── */
#resultsScreen.ai-chat-mode {
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow: hidden !important;
  padding-bottom: 12px !important;
  gap: 12px !important;
}

#resultsScreen.ai-chat-mode #statsRow {
  display: none !important;
}

#resultsScreen.ai-chat-mode .export-bar {
  display: none !important;
}

#resultsScreen.ai-chat-mode #datasetExplorerCard {
  display: none !important;
}

#resultsScreen.ai-chat-mode #areaChat {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 0 !important;
}

#resultsScreen.ai-chat-mode #areaChat > div {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 0 !important;
  gap: 0 !important;
}

#resultsScreen.ai-chat-mode #chatContainerCard {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  margin-bottom: 0 !important;
}

#resultsScreen.ai-chat-mode #chatMessages {
  flex: 1 !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-y: auto !important;
}

/* ── Sidebar Action Buttons styling ── */
.sidebar-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.8rem;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-action-btn.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  color: var(--text-primary);
}

.sidebar-action-btn.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--violet-light);
  transform: translateY(-1px);
}

.sidebar-action-btn.btn-primary {
  background: var(--violet);
  border: 1px solid var(--violet);
  color: #fff;
}

.sidebar-action-btn.btn-primary:hover {
  background: #6d28d9;
  border-color: #6d28d9;
  transform: translateY(-1px);
}

.sidebar-action-btn.btn-ghost {
  background: transparent;
  border: 1px dashed var(--border-mid);
  color: var(--text-secondary);
}

.sidebar-action-btn.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--violet-light);
  color: var(--text-primary);
  transform: translateY(-1px);
}




/* --- Markdown Body Styles (AI Chat Tables & Lists) --- */
.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9em;
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px var(--border-color);
}
.markdown-body th, .markdown-body td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.markdown-body th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--text-primary);
}
.markdown-body tr:last-child td {
    border-bottom: none;
}
.markdown-body tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}
.markdown-body ul, .markdown-body ol {
    margin: 0.8rem 0;
    padding-left: 1.5rem;
}
.markdown-body li {
    margin-bottom: 0.4rem;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
    margin-top: 1.2rem;
    margin-bottom: 0.6rem;
    font-weight: 600;
    color: var(--text-primary);
}
.markdown-body h3 { font-size: 1.1em; }
.markdown-body p { margin-bottom: 0.8rem; }
.markdown-body p:last-child { margin-bottom: 0; }
.markdown-body code {
    background: var(--bg-surface);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: var(--accent-color);
}
.markdown-body pre {
    background: var(--bg-surface);
    padding: 12px;
    border-radius: var(--r-md);
    overflow-x: auto;
    margin: 1rem 0;
    border: 1px solid var(--border-color);
}
.markdown-body pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}


/* --- ChatGPT-style Full Screen AI Chat Mode --- */
#resultsScreen.ai-chat-mode .stats-row,
#resultsScreen.ai-chat-mode .sections-switch,
#resultsScreen.ai-chat-mode .export-bar,
#resultsScreen.ai-chat-mode #datasetExplorerCard {
    display: none !important;
}

#resultsScreen.ai-chat-mode {
    padding: 10px 20px !important;
}

#resultsScreen.ai-chat-mode #areaChat {
    margin: 0 !important;
}

#resultsScreen.ai-chat-mode #chatContainerCard {
    border: none !important;
    background: transparent !important;
    padding: 0 10px !important;
    box-shadow: none !important;
}

#resultsScreen.ai-chat-mode #chatMessages {
    max-height: none !important;
    height: 100% !important;
}

/* Fix text squishing inside chat bubbles */
.chat-msg {
    align-items: flex-start;
}
.chat-bubble {
    width: fit-content;
    min-width: 0; /* Prevents extreme flex collapse in some browsers */
    word-break: break-word; /* Ensures long words wrap instead of breaking layout */
}
