/* ============================================================
   AIMFINITE Design System
   Clean, professional, AI-first automation platform
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --brand-900: #312e81;
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --gray-950: #020617;
  --surface-bg:       #0a0e1a;
  --surface-card:     #0f1629;
  --surface-elevated: #151d35;
  --surface-border:   #1e2d4a;
  --surface-hover:    #1a2540;
  --text-primary:   #f0f4ff;
  --text-secondary: #8892b0;
  --text-muted:     #4a5568;
  --accent-purple: #6366f1;
  --accent-blue:   #3b82f6;
  --accent-cyan:   #06b6d4;
  --accent-green:  #10b981;
  --accent-orange: #f59e0b;
  --accent-red:    #ef4444;
  --glow-purple: 0 0 40px rgba(99,102,241,0.25);
  --glow-blue:   0 0 40px rgba(59,130,246,0.2);
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background-color: var(--surface-bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-400); text-decoration: none; transition: color .2s; }
a:hover { color: var(--brand-300); }
img, svg { display: block; max-width: 100%; }

/* Typography */
.display-1 { font-size: clamp(2.8rem, 6vw, 5rem);   font-weight: 800; line-height: 1.1;  letter-spacing: -0.03em; }
.display-2 { font-size: clamp(2.2rem, 4vw, 3.5rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.025em; }
h1 { font-size: clamp(1.8rem, 3vw, 2.5rem);   font-weight: 700; line-height: 1.2; }
h2 { font-size: clamp(1.5rem, 2.5vw, 2rem);   font-weight: 700; line-height: 1.25; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem);   font-weight: 600; line-height: 1.3; }
h4 { font-size: 1.1rem; font-weight: 600; }
p  { color: var(--text-secondary); }

.text-gradient {
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 40%, #a78bfa 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.text-gradient-cyan {
  background: linear-gradient(135deg, #06b6d4, #6366f1);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.text-primary-color   { color: var(--text-primary); }
.text-secondary-color { color: var(--text-secondary); }
.text-muted-color     { color: var(--text-muted); }
.text-brand  { color: var(--brand-400); }
.text-green  { color: var(--accent-green); }
.text-red    { color: var(--accent-red); }
.text-orange { color: var(--accent-orange); }
.text-cyan   { color: var(--accent-cyan); }
.text-center { text-align: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .625rem 1.25rem; border-radius: var(--radius-md);
  font-family: var(--font-sans); font-size: .9rem; font-weight: 600; line-height: 1;
  border: 1.5px solid transparent; cursor: pointer;
  transition: all .2s ease; white-space: nowrap; text-decoration: none;
}
.btn:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 2px; }
.btn-primary  { background: var(--brand-500); color: #fff; border-color: var(--brand-500); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; box-shadow: var(--glow-purple); transform: translateY(-1px); }
.btn-secondary { background: var(--surface-elevated); color: var(--text-primary); border-color: var(--surface-border); }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--brand-400); color: var(--text-primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text-primary); }
.btn-outline { background: transparent; color: var(--brand-400); border-color: var(--brand-400); }
.btn-outline:hover { background: rgba(99,102,241,.12); color: var(--brand-300); }
.btn-danger { background: var(--accent-red); color: #fff; border-color: var(--accent-red); }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-sm { padding: .4rem .875rem; font-size: .8rem; }
.btn-lg { padding: .875rem 1.75rem; font-size: 1rem; }
.btn-xl { padding: 1rem 2rem; font-size: 1.05rem; border-radius: var(--radius-lg); }
.btn-icon { padding: .5rem; border-radius: var(--radius-sm); aspect-ratio: 1; justify-content: center; display: inline-flex; align-items: center; }

/* Cards */
.card { background: var(--surface-card); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); padding: 1.5rem; transition: border-color .2s, box-shadow .2s; }
.card:hover { border-color: rgba(99,102,241,.35); }
.card-elevated { background: var(--surface-elevated); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); padding: 1.5rem; }
.card-glow:hover { box-shadow: var(--glow-purple); }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.25rem; }
.form-label { font-size: .85rem; font-weight: 500; color: var(--text-secondary); }
.form-control {
  width: 100%; background: var(--surface-elevated); border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-md); padding: .65rem 1rem;
  font-family: var(--font-sans); font-size: .9rem; color: var(--text-primary);
  transition: border-color .2s, box-shadow .2s; outline: none;
}
.form-control:focus { border-color: var(--brand-400); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { opacity: .5; cursor: not-allowed; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .6rem; border-radius: var(--radius-full);
  font-size: .72rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
}
.badge-brand  { background: rgba(99,102,241,.15);  color: var(--brand-400);  border: 1px solid rgba(99,102,241,.25); }
.badge-green  { background: rgba(16,185,129,.12);  color: var(--accent-green);  border: 1px solid rgba(16,185,129,.2); }
.badge-orange { background: rgba(245,158,11,.12);  color: var(--accent-orange); border: 1px solid rgba(245,158,11,.2); }
.badge-red    { background: rgba(239,68,68,.12);   color: var(--accent-red);    border: 1px solid rgba(239,68,68,.2); }
.badge-cyan   { background: rgba(6,182,212,.12);   color: var(--accent-cyan);   border: 1px solid rgba(6,182,212,.2); }
.badge-gray   { background: rgba(148,163,184,.1);  color: var(--text-secondary); border: 1px solid rgba(148,163,184,.15); }

/* Icon boxes */
.icon-box    { display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: var(--radius-md); flex-shrink: 0; }
.icon-box-lg { width: 3.5rem; height: 3.5rem; border-radius: var(--radius-lg); }
.icon-box-sm { width: 2rem;   height: 2rem;   border-radius: var(--radius-sm); }
.icon-box-brand  { background: rgba(99,102,241,.15); color: var(--brand-400); }
.icon-box-green  { background: rgba(16,185,129,.12); color: var(--accent-green); }
.icon-box-orange { background: rgba(245,158,11,.12); color: var(--accent-orange); }
.icon-box-red    { background: rgba(239,68,68,.12);  color: var(--accent-red); }
.icon-box-cyan   { background: rgba(6,182,212,.12);  color: var(--accent-cyan); }
.icon-box-blue   { background: rgba(59,130,246,.12); color: var(--accent-blue); }

/* Dividers */
.divider { height: 1px; background: var(--surface-border); border: none; margin: 1.5rem 0; }
.divider-text { display: flex; align-items: center; gap: 1rem; color: var(--text-muted); font-size: .85rem; margin: 1.5rem 0; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--surface-border); }

/* Utilities */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }   .gap-6 { gap: 1.5rem; } .gap-8 { gap: 2rem; }
.w-full { width: 100%; } .h-full { height: 100%; } .flex-1 { flex: 1; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; } .absolute { position: absolute; }
.inset-0 { inset: 0; } .z-10 { z-index: 10; }
.pointer { cursor: pointer; } .select-none { user-select: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-1{margin-top:.25rem;} .mt-2{margin-top:.5rem;} .mt-3{margin-top:.75rem;}
.mt-4{margin-top:1rem;}   .mt-6{margin-top:1.5rem;} .mt-8{margin-top:2rem;}
.mb-2{margin-bottom:.5rem;} .mb-4{margin-bottom:1rem;} .mb-6{margin-bottom:1.5rem;} .mb-8{margin-bottom:2rem;}
.ml-auto{margin-left:auto;} .mr-auto{margin-right:auto;}
.p-2{padding:.5rem;} .p-3{padding:.75rem;} .p-4{padding:1rem;} .p-6{padding:1.5rem;}
.px-3{padding-left:.75rem;padding-right:.75rem;} .px-4{padding-left:1rem;padding-right:1rem;}
.py-2{padding-top:.5rem;padding-bottom:.5rem;} .py-3{padding-top:.75rem;padding-bottom:.75rem;}
.rounded-sm{border-radius:var(--radius-sm);} .rounded{border-radius:var(--radius-md);}
.rounded-lg{border-radius:var(--radius-lg);} .rounded-full{border-radius:var(--radius-full);}
.shadow-sm{box-shadow:0 1px 3px rgba(0,0,0,.3);} .shadow{box-shadow:0 4px 16px rgba(0,0,0,.4);}
.opacity-50{opacity:.5;} .opacity-75{opacity:.75;}
.font-bold{font-weight:700;} .font-semibold{font-weight:600;}

/* Layout */
.section{padding:5rem 0;} .section-sm{padding:3rem 0;} .section-lg{padding:7rem 0;}
.container{ width:100%; max-width:1200px; margin:0 auto; padding:0 1.5rem; }
.container-narrow{ width:100%; max-width:800px; margin:0 auto; padding:0 1.5rem; }
.grid-2{ display:grid; grid-template-columns:repeat(2,1fr); gap:1.5rem; }
.grid-3{ display:grid; grid-template-columns:repeat(3,1fr); gap:1.5rem; }
.grid-4{ display:grid; grid-template-columns:repeat(4,1fr); gap:1.5rem; }
@media(max-width:1024px){ .grid-4{ grid-template-columns:repeat(2,1fr); } }
@media(max-width:768px){
  .grid-2,.grid-3,.grid-4{ grid-template-columns:1fr; }
  .section{ padding:3.5rem 0; }
}

/* ── Marketing Nav ─────────────────────────────────────────── */
.marketing-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 1rem 2rem; display: flex; align-items: center; justify-content: space-between;
  transition: background .3s, backdrop-filter .3s;
}
.marketing-nav.scrolled {
  background: rgba(10,14,26,.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--surface-border);
}
.marketing-nav .logo {
  display: flex; align-items: center; gap: .6rem;
  font-size: 1.3rem; font-weight: 800; color: var(--text-primary);
  text-decoration: none; letter-spacing: -0.02em;
}
.logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-cyan));
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.nav-links { display: flex; align-items: center; gap: .25rem; list-style: none; }
.nav-links a {
  padding: .5rem .9rem; color: var(--text-secondary);
  font-size: .9rem; font-weight: 500; border-radius: var(--radius-md);
  transition: color .2s, background .2s;
}
.nav-links a:hover { color: var(--text-primary); background: var(--surface-hover); }
.nav-actions { display: flex; align-items: center; gap: .75rem; }

/* ── Hero ──────────────────────────────────────────────────── */
.hero { min-height: 100vh; display: flex; align-items: center; position: relative; overflow: hidden; padding-top: 5rem; }
.hero-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.hero-bg-gradient {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(99,102,241,.18) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 30%, rgba(6,182,212,.1) 0%, transparent 50%),
    radial-gradient(ellipse 40% 50% at 10% 70%, rgba(139,92,246,.08) 0%, transparent 50%);
}
.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(99,102,241,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,.04) 1px, transparent 1px);
  background-size: 60px 60px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, black, transparent);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, black, transparent);
}
.hero-content {
  position: relative; z-index: 1; text-align: center;
  max-width: 900px; margin: 0 auto; padding: 2rem 1.5rem;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: .5rem; padding: .4rem 1rem;
  background: rgba(99,102,241,.1); border: 1px solid rgba(99,102,241,.25);
  border-radius: var(--radius-full); font-size: .8rem; font-weight: 600;
  color: var(--brand-400); margin-bottom: 1.75rem; text-transform: uppercase; letter-spacing: .05em;
}
.hero h1 { margin-bottom: 1.25rem; }
.hero p.lead { font-size: clamp(1rem,2vw,1.2rem); max-width: 640px; margin: 0 auto 2.5rem; color: var(--text-secondary); }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.hero-social-proof { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 3rem; color: var(--text-muted); font-size: .85rem; flex-wrap: wrap; }
.avatars { display: flex; }
.avatars .avatar {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--surface-bg);
  background: linear-gradient(135deg, var(--brand-500), var(--accent-cyan));
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: white; margin-left: -8px;
}
.avatars .avatar:first-child { margin-left: 0; }

/* Canvas preview */
.hero-canvas-preview {
  max-width: 900px; margin: 3.5rem auto 0;
  background: var(--surface-card); border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl); overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.6), var(--glow-purple);
}
.canvas-preview-header {
  display: flex; align-items: center; gap: .75rem; padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--surface-border); background: var(--surface-elevated);
}
.canvas-dot { width: 12px; height: 12px; border-radius: 50%; }
.canvas-dot.red    { background: #ff5f56; }
.canvas-dot.yellow { background: #ffbd2e; }
.canvas-dot.green  { background: #27c93f; }
.canvas-preview-title { margin-left: .5rem; font-size: .8rem; color: var(--text-muted); font-weight: 500; }
.canvas-preview-body {
  padding: 2rem; min-height: 280px;
  background:
    radial-gradient(ellipse 60% 40% at 50% 50%, rgba(99,102,241,.05) 0%, transparent 70%),
    linear-gradient(rgba(99,102,241,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,.025) 1px, transparent 1px);
  background-size: auto, 40px 40px, 40px 40px;
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 0; row-gap: 1rem;
}
.preview-node {
  background: var(--surface-elevated); border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-md); padding: .75rem 1rem; min-width: 130px;
  text-align: center; flex-shrink: 0; transition: border-color .2s;
}
.preview-node.active { border-color: var(--brand-400); box-shadow: 0 0 16px rgba(99,102,241,.3); }
.preview-node-icon  { font-size: 1.5rem; margin-bottom: .3rem; }
.preview-node-label { font-size: .75rem; font-weight: 600; color: var(--text-primary); }
.preview-node-type  { font-size: .65rem; color: var(--text-muted); margin-top: .15rem; }
.preview-connector {
  width: 50px; height: 2px; flex-shrink: 0; position: relative;
  background: linear-gradient(90deg, var(--surface-border), var(--brand-400), var(--surface-border));
}
.preview-connector::after {
  content: ''; position: absolute; right: -4px; top: -4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand-400); box-shadow: 0 0 8px var(--brand-400);
}

/* Stats bar */
.stats-bar { border-top: 1px solid var(--surface-border); border-bottom: 1px solid var(--surface-border); background: var(--surface-card); }
.stats-bar-inner { display: flex; }
.stat-item { flex: 1; padding: 2rem 1.5rem; text-align: center; border-right: 1px solid var(--surface-border); }
.stat-item:last-child { border-right: none; }
.stat-value { font-size: clamp(1.8rem,3vw,2.5rem); font-weight: 800; color: var(--text-primary); letter-spacing: -0.03em; }
.stat-label { font-size: .85rem; color: var(--text-muted); margin-top: .25rem; }

/* Section labels */
.section-label { display: inline-flex; align-items: center; gap: .4rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand-400); margin-bottom: .875rem; }
.section-title    { margin-bottom: .875rem; color: var(--text-primary); }
.section-subtitle { font-size: 1.05rem; color: var(--text-secondary); max-width: 580px; }
.section-header   { margin-bottom: 3.5rem; }
.section-header.centered { text-align: center; }
.section-header.centered .section-subtitle { margin: 0 auto; }

/* Feature cards */
.feature-card {
  background: var(--surface-card); border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg); padding: 1.75rem; transition: all .25s; position: relative; overflow: hidden;
}
.feature-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--brand-500), transparent);
  opacity: 0; transition: opacity .3s;
}
.feature-card:hover::before { opacity: 1; }
.feature-card:hover { border-color: rgba(99,102,241,.3); transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.feature-icon { width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; margin-bottom: 1.25rem; font-size: 1.3rem; }
.feature-card h3 { font-size: 1.05rem; margin-bottom: .5rem; color: var(--text-primary); }
.feature-card p  { font-size: .9rem; color: var(--text-secondary); line-height: 1.6; }

/* Integrations marquee */
.integration-pill {
  display: inline-flex; align-items: center; gap: .6rem; padding: .6rem 1.1rem;
  background: var(--surface-card); border: 1px solid var(--surface-border);
  border-radius: var(--radius-full); font-size: .85rem; font-weight: 500;
  color: var(--text-secondary); transition: all .2s; white-space: nowrap;
}
.integration-pill:hover { border-color: rgba(99,102,241,.35); color: var(--text-primary); }
.integration-pill .pill-icon { font-size: 1.1rem; }
.integrations-marquee { overflow: hidden; padding: 1rem 0; position: relative; }
.integrations-marquee::before,
.integrations-marquee::after { content: ''; position: absolute; top: 0; bottom: 0; width: 120px; z-index: 2; pointer-events: none; }
.integrations-marquee::before { left: 0; background: linear-gradient(90deg, var(--surface-bg), transparent); }
.integrations-marquee::after  { right: 0; background: linear-gradient(270deg, var(--surface-bg), transparent); }
.marquee-track { display: flex; gap: 1rem; width: max-content; animation: marquee 30s linear infinite; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* Pricing */
.pricing-card {
  background: var(--surface-card); border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl); padding: 2rem; position: relative; transition: all .25s;
}
.pricing-card.featured {
  border-color: var(--brand-500);
  background: linear-gradient(180deg, rgba(99,102,241,.08) 0%, var(--surface-card) 40%);
  box-shadow: var(--glow-purple);
}
.pricing-card:hover { transform: translateY(-4px); }
.pricing-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--brand-500); color: white; font-size: .72rem; font-weight: 700;
  padding: .25rem .875rem; border-radius: var(--radius-full);
  text-transform: uppercase; letter-spacing: .06em;
}
.pricing-plan  { font-size: .85rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .5rem; }
.pricing-price { display: flex; align-items: baseline; gap: .25rem; margin: 1rem 0; }
.pricing-price .amount   { font-size: 3rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.03em; line-height: 1; }
.pricing-price .currency { font-size: 1.3rem; font-weight: 700; color: var(--text-secondary); }
.pricing-price .period   { font-size: .9rem; color: var(--text-muted); }
.pricing-features { list-style: none; margin: 1.5rem 0; display: flex; flex-direction: column; gap: .6rem; }
.pricing-features li { display: flex; align-items: center; gap: .6rem; font-size: .9rem; color: var(--text-secondary); }
.pricing-features li .check { color: var(--accent-green); flex-shrink: 0; }
.pricing-features li .x     { color: var(--text-muted); flex-shrink: 0; }

/* ── App Shell ─────────────────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; background: var(--surface-bg); }

.sidebar {
  width: 240px; flex-shrink: 0; background: var(--surface-card);
  border-right: 1px solid var(--surface-border);
  display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-header {
  padding: 1.25rem 1rem; display: flex; align-items: center; gap: .6rem;
  border-bottom: 1px solid var(--surface-border);
}
.sidebar-logo-icon {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-cyan));
  border-radius: 7px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-logo-text { font-size: 1rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; }
.sidebar-nav { flex: 1; padding: .75rem .5rem; }
.sidebar-section-label {
  font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted); padding: .75rem .75rem .25rem; margin-top: .5rem;
}
.sidebar-nav-item {
  display: flex; align-items: center; gap: .65rem; padding: .6rem .75rem;
  border-radius: var(--radius-md); font-size: .875rem; font-weight: 500;
  color: var(--text-secondary); cursor: pointer; transition: all .15s;
  text-decoration: none; margin-bottom: .125rem;
}
.sidebar-nav-item:hover  { background: var(--surface-hover); color: var(--text-primary); }
.sidebar-nav-item.active { background: rgba(99,102,241,.12); color: var(--brand-400); font-weight: 600; }
.sidebar-nav-item .nav-icon { opacity: .7; flex-shrink: 0; }
.sidebar-nav-item.active .nav-icon { opacity: 1; }
.sidebar-nav-item .nav-badge {
  margin-left: auto; background: var(--brand-500); color: white;
  font-size: .65rem; font-weight: 700; padding: .1rem .4rem; border-radius: var(--radius-full);
}
.sidebar-footer { padding: .75rem .5rem; border-top: 1px solid var(--surface-border); }
.sidebar-user { display: flex; align-items: center; gap: .65rem; padding: .6rem .75rem; border-radius: var(--radius-md); cursor: pointer; transition: background .15s; }
.sidebar-user:hover { background: var(--surface-hover); }
.sidebar-avatar {
  width: 30px; height: 30px; border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--brand-500), var(--accent-cyan));
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: white; flex-shrink: 0;
}
.sidebar-user-name { font-size: .825rem; font-weight: 600; color: var(--text-primary); }
.sidebar-user-plan { font-size: .7rem; color: var(--text-muted); }

.app-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.app-topbar {
  height: 56px; flex-shrink: 0; display: flex; align-items: center;
  padding: 0 1.5rem; border-bottom: 1px solid var(--surface-border);
  background: var(--surface-card); gap: 1rem;
}
.app-topbar-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.app-topbar-search { flex: 1; max-width: 320px; position: relative; }
.app-topbar-search .search-icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.app-topbar-search input {
  width: 100%; background: var(--surface-elevated); border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-md); padding: .45rem .75rem .45rem 2.25rem;
  font-size: .85rem; color: var(--text-primary); font-family: var(--font-sans); outline: none; transition: border-color .2s;
}
.app-topbar-search input:focus { border-color: var(--brand-400); }
.app-topbar-search input::placeholder { color: var(--text-muted); }
.app-content { flex: 1; overflow-y: auto; padding: 1.75rem; }

/* Dashboard stat cards */
.stat-card {
  background: var(--surface-card); border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg); padding: 1.25rem 1.5rem;
  display: flex; flex-direction: column; gap: .5rem; transition: border-color .2s;
}
.stat-card:hover { border-color: rgba(99,102,241,.3); }
.stat-card-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.stat-card-value { font-size: 2rem; font-weight: 800; color: var(--text-primary); line-height: 1; letter-spacing: -0.03em; }
.stat-card-change { font-size: .8rem; display: flex; align-items: center; gap: .25rem; }
.stat-card-change.up   { color: var(--accent-green); }
.stat-card-change.down { color: var(--accent-red); }
.dashboard-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-bottom: 1.75rem; }
@media(max-width:1200px) { .dashboard-grid { grid-template-columns: repeat(2,1fr); } }
@media(max-width:640px)  { .dashboard-grid { grid-template-columns: 1fr; } }

/* Flow cards */
.flow-card {
  background: var(--surface-card); border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg); padding: 1.25rem; cursor: pointer;
  transition: all .2s; text-decoration: none; display: flex; flex-direction: column; gap: .75rem;
}
.flow-card:hover { border-color: rgba(99,102,241,.35); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.flow-card-header { display: flex; align-items: flex-start; justify-content: space-between; }
.flow-card-icon { width: 40px; height: 40px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.flow-card-name { font-size: .95rem; font-weight: 700; color: var(--text-primary); }
.flow-card-desc { font-size: .82rem; color: var(--text-muted); }
.flow-card-meta { display: flex; align-items: center; gap: .75rem; }
.flow-card-meta span { font-size: .75rem; color: var(--text-muted); display: flex; align-items: center; gap: .25rem; }

/* ── Flow Builder ──────────────────────────────────────────── */
.builder-shell { display: flex; flex-direction: column; height: 100vh; overflow: hidden; background: var(--surface-bg); }
.builder-topbar {
  height: 56px; display: flex; align-items: center; padding: 0 1.25rem;
  border-bottom: 1px solid var(--surface-border); background: var(--surface-card);
  gap: .75rem; flex-shrink: 0; z-index: 20;
}
.flow-name-input {
  background: transparent; border: 1.5px solid transparent; border-radius: var(--radius-md);
  padding: .3rem .6rem; font-size: .95rem; font-weight: 700; color: var(--text-primary);
  font-family: var(--font-sans); outline: none; min-width: 180px; transition: border-color .2s;
}
.flow-name-input:hover { border-color: var(--surface-border); }
.flow-name-input:focus { border-color: var(--brand-400); }
.builder-body { flex: 1; display: flex; overflow: hidden; }

/* Node panel */
.node-panel {
  width: 260px; flex-shrink: 0; background: var(--surface-card);
  border-right: 1px solid var(--surface-border); display: flex; flex-direction: column; overflow: hidden;
}
.node-panel-header { padding: 1rem; border-bottom: 1px solid var(--surface-border); }
.node-panel-header h3 { font-size: .85rem; font-weight: 700; color: var(--text-primary); margin-bottom: .75rem; }
.node-search { position: relative; }
.node-search input {
  width: 100%; background: var(--surface-elevated); border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-md); padding: .45rem .75rem .45rem 2rem;
  font-size: .82rem; color: var(--text-primary); font-family: var(--font-sans); outline: none; transition: border-color .2s;
}
.node-search input:focus { border-color: var(--brand-400); }
.node-search .search-icon { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.node-panel-list { flex: 1; overflow-y: auto; padding: .75rem; }
.node-category-label { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); padding: .5rem .25rem .25rem; margin-top: .25rem; }
.node-type-item { display: flex; align-items: center; gap: .65rem; padding: .55rem .65rem; border-radius: var(--radius-md); cursor: grab; transition: background .15s; user-select: none; }
.node-type-item:hover { background: var(--surface-hover); }
.node-type-item:active { cursor: grabbing; }
.node-type-icon { width: 30px; height: 30px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: .9rem; flex-shrink: 0; }
.node-type-name { font-size: .8rem; font-weight: 600; color: var(--text-primary); }
.node-type-desc { font-size: .7rem; color: var(--text-muted); }

/* Canvas */
.canvas-wrapper {
  flex: 1; position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse 50% 50% at 50% 50%, rgba(99,102,241,.04) 0%, transparent 60%),
    linear-gradient(rgba(99,102,241,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,.025) 1px, transparent 1px);
  background-size: auto, 40px 40px, 40px 40px;
}
.canvas-drop-hint { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; opacity: 1; transition: opacity .3s; }
.canvas-drop-hint.hidden { opacity: 0; }
.canvas-drop-hint-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .3; }
.canvas-drop-hint p { color: var(--text-muted); font-size: .95rem; }
.canvas-drop-hint small { color: var(--text-muted); font-size: .8rem; opacity: .6; }
#flow-canvas { position: absolute; inset: 0; overflow: hidden; }
#canvas-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }

.flow-node {
  position: absolute; min-width: 160px; background: var(--surface-elevated);
  border: 1.5px solid var(--surface-border); border-radius: var(--radius-md);
  cursor: move; user-select: none; z-index: 10;
  transition: border-color .15s, box-shadow .15s; box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.flow-node:hover, .flow-node.selected {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 2px rgba(99,102,241,.2), 0 4px 20px rgba(0,0,0,.5);
}
.flow-node-header { display: flex; align-items: center; gap: .5rem; padding: .6rem .75rem; border-bottom: 1px solid var(--surface-border); }
.flow-node-icon  { font-size: 1rem; }
.flow-node-title { font-size: .78rem; font-weight: 700; color: var(--text-primary); flex: 1; }
.flow-node-delete { opacity: 0; cursor: pointer; color: var(--text-muted); font-size: .75rem; padding: .1rem .25rem; border-radius: 3px; transition: all .15s; border: none; background: none; }
.flow-node:hover .flow-node-delete { opacity: 1; }
.flow-node-delete:hover { color: var(--accent-red); background: rgba(239,68,68,.1); }
.flow-node-body  { padding: .5rem .75rem; }
.flow-node-label { font-size: .72rem; color: var(--text-muted); }

.node-port {
  position: absolute; width: 12px; height: 12px;
  background: var(--surface-card); border: 2px solid var(--surface-border);
  border-radius: 50%; cursor: crosshair; transition: all .15s; z-index: 11;
}
.node-port:hover { border-color: var(--brand-400); background: var(--brand-400); }
.node-port.input  { left: -6px;  top: 50%; transform: translateY(-50%); }
.node-port.output { right: -6px; top: 50%; transform: translateY(-50%); }
.node-port.input:hover  { transform: translateY(-50%) scale(1.3); }
.node-port.output:hover { transform: translateY(-50%) scale(1.3); }

.canvas-toolbar {
  position: absolute; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: var(--surface-card); border: 1px solid var(--surface-border);
  border-radius: var(--radius-full); padding: .4rem .5rem;
  display: flex; align-items: center; gap: .25rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.5); z-index: 20;
}
.canvas-toolbar .toolbar-divider { width: 1px; height: 20px; background: var(--surface-border); margin: 0 .25rem; }

/* Properties panel */
.properties-panel {
  width: 280px; flex-shrink: 0; background: var(--surface-card);
  border-left: 1px solid var(--surface-border); display: flex; flex-direction: column;
  overflow: hidden; transition: width .25s;
}
.properties-panel.collapsed { width: 0; overflow: hidden; }
.properties-panel-header {
  padding: 1rem; border-bottom: 1px solid var(--surface-border);
  display: flex; align-items: center; justify-content: space-between;
}
.properties-panel-header h3 { font-size: .85rem; font-weight: 700; color: var(--text-primary); }
.properties-panel-body { flex: 1; overflow-y: auto; padding: 1rem; }
.prop-group { margin-bottom: 1rem; }
.prop-group-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: .5rem; }

/* Template cards */
.template-card {
  background: var(--surface-card); border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg); overflow: hidden; cursor: pointer;
  transition: all .2s; text-decoration: none; display: flex; flex-direction: column;
}
.template-card:hover { border-color: rgba(99,102,241,.35); transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0,0,0,.35); }
.template-card-preview {
  height: 140px; background: var(--surface-elevated); display: flex;
  align-items: center; justify-content: center; font-size: 2.5rem;
  border-bottom: 1px solid var(--surface-border); position: relative; overflow: hidden;
}
.template-card-preview::before {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(rgba(99,102,241,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99,102,241,.03) 1px, transparent 1px);
  background-size: 24px 24px;
}
.template-card-body { padding: 1.1rem; flex: 1; }
.template-card-name { font-size: .92rem; font-weight: 700; color: var(--text-primary); margin-bottom: .35rem; }
.template-card-desc { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }
.template-card-footer { padding: .75rem 1.1rem; border-top: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; }

/* Integration catalog */
.integration-card {
  background: var(--surface-card); border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  display: flex; flex-direction: column; gap: .75rem; transition: all .2s; cursor: pointer;
}
.integration-card:hover { border-color: rgba(99,102,241,.3); transform: translateY(-2px); }
.integration-card-logo { width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; background: var(--surface-elevated); border: 1px solid var(--surface-border); }
.integration-card-name { font-size: .92rem; font-weight: 700; color: var(--text-primary); }
.integration-card-desc { font-size: .8rem; color: var(--text-muted); }
.integration-card-status { font-size: .75rem; font-weight: 600; }
.integration-card-status.connected { color: var(--accent-green); }
.integration-card-status.available { color: var(--text-muted); }

/* Agents */
.agent-card {
  background: var(--surface-card); border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg); padding: 1.5rem; transition: all .2s;
  cursor: pointer; text-decoration: none; display: flex; flex-direction: column; gap: .875rem;
}
.agent-card:hover { border-color: rgba(99,102,241,.35); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.agent-card-header { display: flex; align-items: flex-start; justify-content: space-between; }
.agent-avatar { width: 44px; height: 44px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.agent-card-name  { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.agent-card-model { font-size: .75rem; color: var(--text-muted); }
.agent-card-desc  { font-size: .85rem; color: var(--text-secondary); line-height: 1.5; }
.agent-card-footer { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }

/* Empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem 2rem; text-align: center; }
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .4; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-primary); margin-bottom: .5rem; }
.empty-state p  { font-size: .9rem; color: var(--text-muted); max-width: 340px; margin-bottom: 1.5rem; }

/* Auth */
.auth-page { min-height: 100vh; display: flex; align-items: stretch; }
.auth-aside {
  width: 45%; background: var(--surface-card); border-right: 1px solid var(--surface-border);
  display: flex; flex-direction: column; padding: 3rem; position: relative; overflow: hidden;
}
.auth-aside-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 30% 30%, rgba(99,102,241,.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(6,182,212,.08) 0%, transparent 50%);
  pointer-events: none;
}
.auth-aside-content { position: relative; z-index: 1; }
.auth-form-area { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-form-card { width: 100%; max-width: 420px; }
.auth-logo { display: flex; align-items: center; gap: .6rem; font-size: 1.25rem; font-weight: 800; color: var(--text-primary); text-decoration: none; letter-spacing: -0.02em; margin-bottom: 2rem; }
@media(max-width:768px) { .auth-aside { display: none; } .auth-form-area { padding: 1.5rem; } }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-600); }

/* Tooltip */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--gray-800); color: var(--text-primary); font-size: .72rem; padding: .3rem .6rem;
  border-radius: var(--radius-sm); white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 50;
}
[data-tooltip]:hover::after { opacity: 1; }

/* Toasts */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; }
.toast {
  background: var(--surface-elevated); border: 1px solid var(--surface-border);
  border-radius: var(--radius-md); padding: .75rem 1rem; display: flex; align-items: center; gap: .65rem;
  min-width: 280px; box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: slideInRight .25s ease;
}
@keyframes slideInRight { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-icon { font-size: 1rem; }
.toast-msg  { font-size: .85rem; color: var(--text-primary); }
.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error   { border-left: 3px solid var(--accent-red); }
.toast.info    { border-left: 3px solid var(--brand-400); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn .4s ease both; }
.fade-in-delay-1 { animation-delay: .1s; }
.fade-in-delay-2 { animation-delay: .2s; }
.fade-in-delay-3 { animation-delay: .3s; }
.fade-in-delay-4 { animation-delay: .4s; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.pulse { animation: pulse 2s infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

.run-indicator { display: inline-flex; align-items: center; gap: .4rem; font-size: .75rem; font-weight: 600; color: var(--accent-green); }
.run-indicator .dot { width: 7px; height: 7px; background: var(--accent-green); border-radius: 50%; animation: pulse 1.5s infinite; }

/* SVG connection */
.connection-path { stroke: var(--brand-400); stroke-width: 2; fill: none; }
.temp-connection-path { stroke: var(--brand-400); stroke-width: 2; fill: none; stroke-dasharray: 6 4; }

/* Tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--surface-border); margin-bottom: 1.5rem; }
.tab-btn {
  padding: .6rem 1rem; font-size: .85rem; font-weight: 500; color: var(--text-secondary);
  background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; transition: all .2s; font-family: var(--font-sans); margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--brand-400); border-bottom-color: var(--brand-400); font-weight: 600; }

/* Dropdown */
.dropdown { position: relative; display: inline-flex; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 180px;
  background: var(--surface-elevated); border: 1px solid var(--surface-border);
  border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(0,0,0,.5);
  z-index: 50; display: none; flex-direction: column; padding: .375rem;
}
.dropdown-menu.open { display: flex; }
.dropdown-item {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem;
  border-radius: var(--radius-sm); font-size: .85rem; color: var(--text-secondary);
  cursor: pointer; transition: all .15s; text-decoration: none;
  border: none; background: none; font-family: var(--font-sans); width: 100%; text-align: left;
}
.dropdown-item:hover { background: var(--surface-hover); color: var(--text-primary); }
.dropdown-item.danger:hover { background: rgba(239,68,68,.1); color: var(--accent-red); }
.dropdown-divider { height: 1px; background: var(--surface-border); margin: .375rem 0; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.hidden { display: none; }
.modal { background: var(--surface-card); border: 1px solid var(--surface-border); border-radius: var(--radius-xl); width: 100%; max-width: 520px; box-shadow: 0 24px 64px rgba(0,0,0,.6); animation: fadeIn .2s ease; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--surface-border); }
.modal-title  { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.modal-body   { padding: 1.5rem; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: .75rem; padding: 1rem 1.5rem; border-top: 1px solid var(--surface-border); }

/* Responsive */
@media(max-width:768px) { .sidebar { display: none; } .hide-mobile { display: none !important; } }
@media(min-width:769px) { .show-mobile { display: none !important; } }
