/* ============================================================
   AIDE Dashboard — v6 Design System
   Navy-900 + Teal Accent | Glass Morphism | Gradient Orbs
   Ultra-premium spacing, generous padding, breathing room
   ============================================================ */

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

:root {
  --navy-950: #0c1e35;
  --navy-900: #102a4a;
  --navy-800: #153560;
  --navy-700: #1a4175;
  --navy-600: #204d8a;
  --teal-500: #1b84f3;
  --teal-400: #00a8fa;
  --teal-300: #8af0fc;
  --teal-dim: rgba(27, 132, 243, 0.1);
  --teal-glow: rgba(27, 132, 243, 0.08);
  --green: #34D399;
  --red: #F87171;
  --amber: #FBBF24;
  --blue: #60A5FA;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;

  --space-card: clamp(20px, 3vw, 32px);
  --space-card-lg: clamp(24px, 3.5vw, 40px);
  --radius-card: 1.25rem;
  --radius-card-lg: 1.5rem;
}

body {
  font-family: var(--font-sans);
  background: var(--navy-900);
  color: rgba(255,255,255,0.9);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='wave' x='0' y='0' width='200' height='200' patternUnits='userSpaceOnUse'%3E%3Cpath d='M0 50 Q50 0 100 50 T200 50' fill='none' stroke='rgba(27,132,243,0.04)' stroke-width='1'/%3E%3Cpath d='M0 100 Q50 50 100 100 T200 100' fill='none' stroke='rgba(27,132,243,0.025)' stroke-width='1'/%3E%3Cpath d='M0 150 Q50 100 100 150 T200 150' fill='none' stroke='rgba(27,132,243,0.015)' stroke-width='1'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='url(%23wave)'/%3E%3C/svg%3E");
}

body > *, #app-shell { position: relative; z-index: 1; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--navy-900); }
::-webkit-scrollbar-thumb { background: var(--teal-500); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--teal-400); }
* { scrollbar-width: thin; scrollbar-color: var(--teal-500) var(--navy-900); }

/* ── Skip to Content ───────────────────────────────────────── */
.skip-to-content {
  position: absolute; top: -100%; left: 16px; z-index: 9999;
  padding: 8px 16px; background: var(--teal-500); color: #fff;
  font-weight: 600; font-size: 14px; border-radius: 0 0 12px 12px;
  text-decoration: none; transition: top 0.2s ease;
}
.skip-to-content:focus { top: 0; }
:focus-visible { outline: 2px solid rgba(27,132,243,0.5); outline-offset: 2px; border-radius: 8px; }

/* ============================================================
   GLASS CARD SYSTEM — v6
   Generous padding, overflow protection, premium depth
   ============================================================ */

.card {
  background: rgba(16, 42, 74, 0.65);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(27, 132, 243, 0.08);
  border-radius: var(--radius-card-lg);
  box-shadow:
    0 4px 24px rgba(0,0,0,0.12),
    0 1px 0 rgba(255,255,255,0.03) inset;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}
.card:hover {
  border-color: rgba(27, 132, 243, 0.2);
  box-shadow:
    0 8px 40px rgba(0,0,0,0.18),
    0 0 20px rgba(27,132,243,0.04),
    0 1px 0 rgba(255,255,255,0.04) inset;
  transform: translateY(-2px);
}

.card-raised {
  background: rgba(16, 42, 74, 0.8);
  border-color: rgba(27, 132, 243, 0.12);
  box-shadow:
    0 8px 40px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.04);
}
.card-raised:hover {
  border-color: rgba(27, 132, 243, 0.25);
  box-shadow:
    0 12px 48px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 0 24px rgba(27,132,243,0.05);
}

.card-teal {
  background: linear-gradient(135deg, rgba(27,132,243,0.1) 0%, rgba(16,42,74,0.65) 100%);
  border-color: rgba(27, 132, 243, 0.15);
}
.card-teal:hover { border-color: rgba(27, 132, 243, 0.35); }

.card-solid {
  background: var(--navy-800);
  backdrop-filter: none;
  border-color: rgba(255,255,255,0.05);
}

/* Card padding utility classes */
.card-pad { padding: var(--space-card); }
.card-pad-lg { padding: var(--space-card-lg); }

/* ── Gradient Text ─────────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, #1b84f3 0%, #00a8fa 50%, #1b84f3 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient 4s ease infinite;
}

/* ── Cursor Glow ───────────────────────────────────────────── */
.cursor-glow {
  position: fixed;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(27, 132, 243, 0.08) 0%, transparent 70%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 0;
  transition: opacity 0.3s ease;
}

/* ── Gradient Orbs ─────────────────────────────────────────── */
.orb {
  position: absolute; border-radius: 50%; pointer-events: none; filter: blur(80px);
}
.orb-teal { background: rgba(27,132,243,0.08); }
.orb-teal-dim { background: rgba(0,168,250,0.04); }

/* ── Status Dots ───────────────────────────────────────────── */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: var(--green); box-shadow: 0 0 8px rgba(52,211,153,0.5); }
.dot-amber { background: var(--amber); box-shadow: 0 0 8px rgba(251,191,36,0.5); }
.dot-red { background: var(--red); box-shadow: 0 0 8px rgba(248,113,113,0.5); }
.dot-teal { background: var(--teal-400); box-shadow: 0 0 8px rgba(0,168,250,0.5); }
.dot-dim { background: rgba(255,255,255,0.2); }
.dot-pulse { animation: pulse 2s ease-out infinite; }

/* ── Badge ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 14px; border-radius: 9999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em; line-height: 1.4; white-space: nowrap;
}
.badge-teal { background: rgba(27,132,243,0.15); color: var(--teal-400); }
.badge-green { background: rgba(52,211,153,0.12); color: var(--green); }
.badge-red { background: rgba(248,113,113,0.12); color: var(--red); }
.badge-amber { background: rgba(251,191,36,0.12); color: var(--amber); }
.badge-blue { background: rgba(96,165,250,0.12); color: var(--blue); }
.badge-muted { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.5); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: 9999px; font-size: 14px; font-weight: 600;
  font-family: var(--font-sans); cursor: pointer; border: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); text-decoration: none; white-space: nowrap;
}
.btn-teal {
  background: var(--teal-500); color: #fff;
  box-shadow: 0 4px 20px rgba(27,132,243,0.3);
}
.btn-teal:hover { background: var(--teal-400); transform: translateY(-2px); box-shadow: 0 8px 30px rgba(27,132,243,0.4); }
.btn-outline {
  background: transparent; color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.15);
}
.btn-outline:hover { border-color: rgba(27,132,243,0.4); background: rgba(27,132,243,0.05); color: #fff; }
.btn-ghost {
  background: transparent; color: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.1);
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: #fff; border-color: rgba(255,255,255,0.2); }

/* ── Chip ──────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 9999px; font-size: 12px; font-weight: 500;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6); cursor: pointer; transition: all 0.3s ease;
}
.chip:hover { background: rgba(27,132,243,0.08); color: rgba(255,255,255,0.8); border-color: rgba(27,132,243,0.2); }
.chip.active { background: rgba(27,132,243,0.15); border-color: rgba(27,132,243,0.3); color: var(--teal-400); }

/* ── Toggle ────────────────────────────────────────────────── */
.toggle {
  position: relative; width: 44px; height: 24px; border-radius: 12px;
  background: rgba(255,255,255,0.1); cursor: pointer; transition: all 0.3s ease; border: none; padding: 0;
}
.toggle.active { background: var(--teal-500); }
.toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; transition: all 0.3s cubic-bezier(0.16,1,0.3,1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.toggle.active::after { transform: translateX(20px); }

/* ── Score Bar ─────────────────────────────────────────────── */
.score-bar { width: 60px; height: 5px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden; display: inline-block; vertical-align: middle; }
.score-bar-fill { height: 100%; border-radius: 3px; transition: width 1s cubic-bezier(0.16,1,0.3,1); }

/* ── Reveal ────────────────────────────────────────────────── */
.reveal {
  opacity: 0; transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--delay, 0ms);
}
.reveal.revealed { opacity: 1; transform: translateY(0); }

.reveal-scale {
  opacity: 0; transform: scale(0.95);
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--delay, 0ms);
}
.reveal-scale.revealed { opacity: 1; transform: scale(1); }

.typing-cursor::after { content: "▋"; color: var(--teal-400); animation: blink 1s step-end infinite; margin-left: 2px; }

/* ============================================================
   TOP NAV — glass style
   ============================================================ */
.topnav {
  position: sticky; top: 0; z-index: 40;
  padding: 0 32px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(16, 42, 74, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(27, 132, 243, 0.08);
  transition: all 0.5s ease;
}

.topnav-logo {
  font-family: var(--font-mono); font-size: 18px; font-weight: 700;
  color: var(--teal-400); letter-spacing: -0.02em; text-decoration: none;
}

.topnav-tabs {
  display: flex; align-items: center; gap: 2px;
  background: rgba(255,255,255,0.04); border-radius: 12px; padding: 3px;
  border: 1px solid rgba(255,255,255,0.06);
}
.topnav-tab {
  padding: 7px 16px; border-radius: 9px; font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.5); cursor: pointer; transition: all 0.3s ease;
  text-decoration: none; white-space: nowrap; border: none; background: none;
  font-family: var(--font-sans);
}
.topnav-tab:hover { color: rgba(255,255,255,0.8); }
.topnav-tab.active {
  background: rgba(27, 132, 243, 0.15); color: var(--teal-400);
}

.topnav-actions { display: flex; align-items: center; gap: 6px; }
.topnav-icon-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: transparent; border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.4); cursor: pointer; transition: all 0.3s ease;
}
.topnav-icon-btn:hover { background: rgba(27,132,243,0.1); color: var(--teal-400); border-color: rgba(27,132,243,0.2); }
.topnav-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-400));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff; cursor: pointer;
}

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
  max-width: 1360px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}
@media (min-width: 1024px) {
  .main-content { padding: 48px 48px 100px; }
}
@media (min-width: 1280px) {
  .main-content { padding: 56px 56px 100px; }
}

/* ── Notification Dropdown ─────────────────────────────────── */
.notif-dropdown {
  position: absolute; top: 48px; right: 0; width: 340px; max-height: 380px;
  overflow-y: auto; display: none; animation: fadeInDown 0.2s ease;
}
.notif-dropdown.open { display: block; }
.notif-item {
  display: flex; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05); transition: background 0.2s ease;
}
.notif-item:hover { background: rgba(27,132,243,0.05); }

/* ── Command Palette ───────────────────────────────────────── */
.cmd-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px); z-index: 100; display: none;
  align-items: flex-start; justify-content: center; padding-top: 120px;
}
.cmd-overlay.open { display: flex; }
.cmd-palette { width: 520px; max-height: 400px; overflow: hidden; display: flex; flex-direction: column; }
.cmd-input {
  width: 100%; padding: 16px 20px; background: transparent; border: none;
  color: rgba(255,255,255,0.9); font-size: 15px; font-family: var(--font-sans); outline: none;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.cmd-input::placeholder { color: rgba(255,255,255,0.3); }
.cmd-results { overflow-y: auto; padding: 8px; }
.cmd-group-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.3); padding: 10px 12px 6px; }
.cmd-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 10px; color: rgba(255,255,255,0.5); cursor: pointer; transition: all 0.15s ease;
  text-decoration: none;
}
.cmd-item:hover { background: rgba(27,132,243,0.1); color: var(--teal-400); }

/* ── Mobile ────────────────────────────────────────────────── */
.mobile-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 35; display: none; opacity: 0; transition: opacity 0.3s ease; }
.mobile-overlay.open { display: block; opacity: 1; }
.hamburger { display: none; width: 36px; height: 36px; align-items: center; justify-content: center; background: transparent; border: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.5); cursor: pointer; border-radius: 10px; }
.mobile-nav { position: fixed; top: 0; left: -280px; width: 260px; height: 100vh; background: var(--navy-800); z-index: 50; padding: 24px 16px; border-right: 1px solid rgba(27,132,243,0.1); transition: left 0.3s cubic-bezier(0.16,1,0.3,1); display: flex; flex-direction: column; gap: 2px; }
.mobile-nav.open { left: 0; }
.mobile-nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; color: rgba(255,255,255,0.5); text-decoration: none; font-size: 13px; font-weight: 500; transition: all 0.2s ease; }
.mobile-nav-item:hover { background: rgba(27,132,243,0.08); color: rgba(255,255,255,0.8); }
.mobile-nav-item.active { background: rgba(27,132,243,0.15); color: var(--teal-400); }

/* ── Slide Panel ───────────────────────────────────────────── */
.slide-panel { position: fixed; top: 0; right: -460px; width: 440px; height: 100vh; background: var(--navy-800); z-index: 50; overflow-y: auto; padding: 28px; border-left: 1px solid rgba(27,132,243,0.1); transition: right 0.35s cubic-bezier(0.16,1,0.3,1); }
.slide-panel.open { right: 0; }
.slide-panel-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 45; display: none; opacity: 0; transition: opacity 0.3s ease; }
.slide-panel-overlay.open { display: block; opacity: 1; }

/* ── Data Table ────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.data-table thead th { position: sticky; top: 0; background: var(--navy-700); padding: 12px 18px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(255,255,255,0.35); border-bottom: 1px solid rgba(255,255,255,0.06); cursor: pointer; user-select: none; white-space: nowrap; }
.data-table thead th:hover { color: rgba(255,255,255,0.5); }
.data-table tbody tr { transition: background 0.15s ease; cursor: pointer; }
.data-table tbody tr:hover { background: rgba(27,132,243,0.05); }
.data-table tbody td { padding: 12px 18px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }

/* ── Tab Bar ───────────────────────────────────────────────── */
.tab-bar { display: flex; gap: 2px; background: rgba(255,255,255,0.04); border-radius: 12px; padding: 3px; width: fit-content; border: 1px solid rgba(255,255,255,0.06); }
.tab-item { padding: 8px 18px; font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.5); cursor: pointer; transition: all 0.3s ease; background: none; border: none; font-family: var(--font-sans); border-radius: 9px; }
.tab-item:hover { color: rgba(255,255,255,0.8); }
.tab-item.active { background: rgba(27,132,243,0.15); color: var(--teal-400); }

/* ── Range Slider ──────────────────────────────────────────── */
input[type="range"] { -webkit-appearance: none; width: 100%; height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--teal-500); cursor: pointer; box-shadow: 0 2px 8px rgba(27,132,243,0.3); }

/* ── Toast ─────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 22px; border-radius: 9999px; font-size: 13px; font-weight: 500; z-index: 200; background: var(--navy-700); color: #fff; border: 1px solid rgba(27,132,243,0.15); box-shadow: 0 8px 32px rgba(0,0,0,0.3); animation: fadeInUp 0.3s ease, fadeOutDown 0.3s ease 2.7s forwards; pointer-events: none; }

/* ── Dialog ────────────────────────────────────────────────── */
dialog {
  background: var(--navy-800, #153560);
  border: 1px solid rgba(27,132,243,0.15);
  border-radius: var(--radius-card-lg, 20px);
  padding: 0;
  max-width: 460px;
  width: 90%;
  max-height: 85vh;
  color: #fff;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5), 0 0 40px rgba(27,132,243,0.05);
}
dialog::backdrop {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
dialog .dialog-content {
  padding: 28px;
  overflow-y: auto;
  max-height: 85vh;
}

/* ============================================================
   SECTION DIVIDERS
   ============================================================ */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(27,132,243,0.15), transparent);
  margin: 8px 0;
}

/* ============================================================
   KEYFRAMES
   ============================================================ */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeOutDown { from { opacity: 1; } to { opacity: 0; transform: translateY(16px); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(2.5); opacity: 0; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes gradient { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1023px) {
  .topnav-tabs { display: none; }
  .hamburger { display: flex !important; }
  .main-content { padding: 32px 20px 60px; }
}
@media (max-width: 639px) {
  .main-content { padding: 24px 16px 48px; }
  .topnav { padding: 0 16px; }
  .slide-panel { width: 100%; right: -100%; }
}

/* ============================================================
   PIPELINE VISUALIZATION
   ============================================================ */
.pipeline-container {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: 8px 0;
  -webkit-overflow-scrolling: touch;
}

.pipeline-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 90px;
  padding: 16px 12px;
  border-radius: var(--radius-card);
  background: rgba(16, 42, 74, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(27, 132, 243, 0.08);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}
.pipeline-node:hover {
  border-color: rgba(27, 132, 243, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15), 0 0 12px rgba(27,132,243,0.06);
}

.pipeline-node-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pipeline-node-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.4);
  white-space: nowrap;
}

.pipeline-node-metric {
  font-size: 16px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
}

.pipeline-connector {
  width: 32px;
  height: 2px;
  background: linear-gradient(90deg, rgba(27,132,243,0.15), rgba(27,132,243,0.3), rgba(27,132,243,0.15));
  position: relative;
  flex-shrink: 0;
}

.pipeline-pulse {
  position: absolute;
  top: -3px;
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal-400);
  box-shadow: 0 0 8px rgba(0,168,250,0.6);
  animation: pipelinePulseMove 2.5s ease-in-out infinite;
}

@keyframes pipelinePulseMove {
  0% { left: -4px; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { left: calc(100% - 4px); opacity: 0; }
}

/* ============================================================
   AI ACTIVITY TICKER
   ============================================================ */
.ai-ticker {
  overflow: hidden;
  border-radius: 12px;
  background: rgba(16, 42, 74, 0.5);
  border: 1px solid rgba(27, 132, 243, 0.06);
  padding: 10px 0;
}

.ai-ticker-track {
  display: flex;
  gap: 48px;
  white-space: nowrap;
  animation: tickerScroll 40s linear infinite;
  width: max-content;
}

.ai-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.01em;
}

@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ============================================================
   ENGINE PROGRESS BAR
   ============================================================ */
.engine-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.04);
  overflow: hidden;
}
.engine-progress-bar::after {
  content: "";
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--teal-400), transparent);
  animation: engineProgressSlide 2.5s ease-in-out infinite;
}

@keyframes engineProgressSlide {
  0% { left: -40%; }
  100% { left: 100%; }
}

/* ============================================================
   GUIDED TOUR SYSTEM
   ============================================================ */
.guide-intro-banner {
  background: rgba(27, 132, 243, 0.08);
  border: 1px solid rgba(27, 132, 243, 0.2);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  margin-bottom: 24px;
  animation: fadeInDown 0.4s ease;
}

.guide-intro-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--teal-500);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.guide-dismiss-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s ease;
}
.guide-dismiss-btn:hover { color: rgba(255,255,255,0.8); }

.guide-highlight {
  outline: 1px dashed rgba(27, 132, 243, 0.35) !important;
  outline-offset: 4px;
  border-radius: 12px;
}

.guide-tooltip {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 280px;
  padding: 10px 14px;
  background: rgba(12, 30, 53, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(27, 132, 243, 0.25);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: fadeIn 0.4s ease;
  pointer-events: none;
}

.guide-tooltip-number {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--teal-500);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.guide-tooltip-text {
  font-size: 11px;
  line-height: 1.55;
  color: rgba(255,255,255,0.7);
  font-weight: 400;
}

.guide-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  user-select: none;
}
.guide-toggle-wrap:hover {
  background: rgba(27,132,243,0.08);
  border-color: rgba(27,132,243,0.2);
  color: rgba(255,255,255,0.8);
}
.guide-toggle-wrap.guide-active {
  background: rgba(27,132,243,0.12);
  border-color: rgba(27,132,243,0.3);
  color: var(--teal-400);
}

/* ============================================================
   CAMPAIGN PIPELINE DIAGRAM MODAL
   ============================================================ */
.pipe-modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(12, 30, 53, 0.92);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  display: none; opacity: 0;
  transition: opacity 0.35s ease;
  overflow-y: auto;
}
.pipe-modal-overlay.open { display: block; opacity: 1; }

.pipe-modal {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 24px 60px;
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.pipe-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 0 20px; position: sticky; top: 0; z-index: 2;
  background: rgba(12, 30, 53, 0.85); backdrop-filter: blur(12px);
}

/* ── Diagram Flow Layout ── */
.pipe-diagram {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
  position: relative;
}

.pipe-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  width: 100%;
  position: relative;
}

.pipe-flow-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 8px 0;
  position: relative;
}
.pipe-flow-arrow-line {
  width: 2px;
  height: 28px;
  background: linear-gradient(180deg, rgba(27,132,243,0.4), rgba(27,132,243,0.15));
  position: relative;
}
.pipe-flow-arrow-line::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(27,132,243,0.4);
}
.pipe-flow-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(27,132,243,0.5);
  padding: 4px 12px;
  border-radius: 9999px;
  background: rgba(27,132,243,0.06);
  border: 1px solid rgba(27,132,243,0.1);
  white-space: nowrap;
}

/* ── ICP Node (top of diagram) ── */
.pipe-icp-node {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 28px;
  border-radius: var(--radius-card-lg);
  background: linear-gradient(135deg, rgba(27,132,243,0.12) 0%, rgba(16,42,74,0.8) 100%);
  border: 1px solid rgba(27,132,243,0.2);
  box-shadow: 0 0 30px rgba(27,132,243,0.06);
  max-width: 600px;
  width: 100%;
}

/* ── Channel Node ── */
.pipe-channel-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 14px;
  border-radius: var(--radius-card);
  background: rgba(16, 42, 74, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.06);
  min-width: 110px;
  max-width: 140px;
  flex: 1;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: default;
  position: relative;
  overflow: visible;
}
.pipe-channel-node:hover {
  border-color: rgba(27,132,243,0.25);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.2), 0 0 16px rgba(27,132,243,0.06);
}
.pipe-channel-node::before {
  content: "";
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 14px;
  background: linear-gradient(180deg, rgba(27,132,243,0.3), rgba(27,132,243,0.08));
}

.pipe-ch-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}

.pipe-ch-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
  text-align: center;
}

.pipe-ch-metric {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
}

.pipe-ch-sub {
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.3);
}

/* ── Funnel Stage Row ── */
.pipe-funnel-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  max-width: 900px;
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid rgba(27,132,243,0.08);
}

.pipe-funnel-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 18px 8px;
  position: relative;
  transition: background 0.3s ease;
}
.pipe-funnel-stage:hover { background: rgba(27,132,243,0.04); }
.pipe-funnel-stage + .pipe-funnel-stage { border-left: 1px solid rgba(27,132,243,0.06); }

.pipe-funnel-stage-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
}
.pipe-funnel-stage-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
}
.pipe-funnel-stage-pct {
  font-size: 10px;
  font-weight: 500;
  color: rgba(255,255,255,0.35);
}

/* ── Delivery Node (bottom) ── */
.pipe-delivery-node {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 32px;
  border-radius: var(--radius-card-lg);
  background: linear-gradient(135deg, rgba(27,132,243,0.15) 0%, rgba(16,42,74,0.8) 100%);
  border: 1px solid rgba(27,132,243,0.25);
  box-shadow: 0 0 40px rgba(27,132,243,0.08);
  max-width: 500px;
  width: 100%;
}

/* ── Source Detail Expandable ── */
.pipe-source-detail {
  width: 100%;
  max-width: 900px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.pipe-source-card {
  padding: 16px;
  border-radius: var(--radius-card);
  background: rgba(16, 42, 74, 0.6);
  border: 1px solid rgba(255,255,255,0.05);
  transition: all 0.3s ease;
}
.pipe-source-card:hover {
  border-color: rgba(27,132,243,0.15);
  background: rgba(16, 42, 74, 0.75);
}

/* ── Animated pulse on connectors ── */
@keyframes pipeDotDrop {
  0% { top: 0; opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { top: calc(100% - 4px); opacity: 0; }
}
.pipe-flow-arrow-line .pipe-dot {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--teal-400);
  box-shadow: 0 0 8px rgba(0,168,250,0.6);
  left: 50%; transform: translateX(-50%);
  animation: pipeDotDrop 2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal, .reveal-scale { opacity: 1 !important; transform: none !important; }
}
