/* ═══════════════════════════════════════════════════════════
   RayBot DESIGN SYSTEM
   ═══════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  /* Brand gradient (same in both themes) */
  --grad: linear-gradient(135deg, #5B47F0 0%, #00C2CB 100%);
  --grad-r: linear-gradient(135deg, #00C2CB 0%, #5B47F0 100%);
  --grad-subtle: linear-gradient(135deg, rgba(91,71,240,.08) 0%, rgba(0,194,203,.08) 100%);

  /* Light theme */
  --bg: #F4F6FF;
  --bg2: #ECEFFE;
  --surface: #FFFFFF;
  --surface2: #F8F9FF;
  --surface3: #F0F2FF;
  --border: #E2E6F5;
  --border2: #CDD2EE;

  --text: #0A0F1E;
  --text2: #3D4A66;
  --text3: #7888A4;

  --primary: #5B47F0;
  --primary-h: #4A38DC;
  --primary-rgb: 91,71,240;
  --primary-faded: rgba(91,71,240,.10);
  --primary-faded2: rgba(91,71,240,.18);

  --accent: #00C2CB;
  --accent-h: #00A8B0;
  --accent-faded: rgba(0,194,203,.10);

  --success: #10B981;
  --success-faded: rgba(16,185,129,.10);
  --warning: #F59E0B;
  --warning-faded: rgba(245,158,11,.10);
  --danger: #EF4444;
  --danger-faded: rgba(239,68,68,.10);

  --shadow-xs: 0 1px 3px rgba(10,15,30,.06);
  --shadow-sm: 0 2px 8px rgba(10,15,30,.08);
  --shadow: 0 4px 20px rgba(10,15,30,.10);
  --shadow-lg: 0 8px 40px rgba(10,15,30,.14);
  --shadow-primary: 0 8px 28px rgba(91,71,240,.28);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --sidebar-w: 256px;
  --sidebar-collapsed: 72px;
  --header-h: 64px;

  --ease: cubic-bezier(.4,0,.2,1);
  --t: .2s var(--ease);
  --t-slow: .4s var(--ease);
}

[data-theme="dark"] {
  --bg: #070B14;
  --bg2: #0D1221;
  --surface: #111827;
  --surface2: #1A2235;
  --surface3: #1E2840;
  --border: #1E2D42;
  --border2: #253347;

  --text: #E8F0FE;
  --text2: #8CA5C5;
  --text3: #4D6A8A;

  --primary: #7C6CF6;
  --primary-h: #9180F8;
  --primary-rgb: 124,108,246;
  --primary-faded: rgba(124,108,246,.14);
  --primary-faded2: rgba(124,108,246,.24);

  --accent: #22D3EE;
  --accent-h: #38DEF7;
  --accent-faded: rgba(34,211,238,.12);

  --success: #34D399;
  --success-faded: rgba(52,211,153,.12);
  --warning: #FBBF24;
  --warning-faded: rgba(251,191,36,.12);
  --danger: #F87171;
  --danger-faded: rgba(248,113,113,.12);

  --shadow-xs: 0 1px 3px rgba(0,0,0,.3);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
  --shadow: 0 4px 20px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.6);
  --shadow-primary: 0 8px 28px rgba(124,108,246,.32);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--t-slow), color var(--t-slow);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, textarea, select { font-family: inherit; outline: none; }
img, svg { display: block; }
ul { list-style: none; }

/* ── Loader ──────────────────────────────────────────────── */
.app-loader {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity .4s ease;
}
.app-loader.hidden { opacity: 0; pointer-events: none; }
.loader-inner { position: relative; width: 48px; height: 48px; }
.loader-ring {
  position: absolute; inset: -10px;
  border: 3px solid transparent;
  border-top-color: var(--primary);
  border-right-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════
   LANDING PAGE
══════════════════════════════════════════════════════════ */
.landing {
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Landing Nav ─────────────────────────────────────────── */
.land-nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 0 48px;
  height: 68px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(7,11,20,.8);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: all var(--t);
}
[data-theme="light"] .land-nav {
  background: rgba(244,246,255,.85);
}
.land-nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em;
}
.land-nav-logo svg { flex-shrink: 0; }
.land-nav-logo span { background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.land-nav-links { display: flex; align-items: center; gap: 32px; }
.land-nav-links a {
  font-size: .9rem; font-weight: 500; color: var(--text2);
  transition: color var(--t);
}
.land-nav-links a:hover { color: var(--text); }
.land-nav-actions { display: flex; align-items: center; gap: 12px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 20px;
  font-size: .875rem; font-weight: 600; line-height: 1;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  transition: all var(--t);
  white-space: nowrap;
}
.btn-primary {
  background: var(--grad); color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(var(--primary-rgb),.4); }
.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent; color: var(--text);
  border-color: var(--border2);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-faded); }

.btn-ghost {
  background: transparent; color: var(--text2);
  border-color: transparent; padding: 8px 14px;
}
.btn-ghost:hover { color: var(--text); background: var(--surface3); }

.btn-danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn-danger:hover { opacity: .88; }

.btn-sm { padding: 7px 14px; font-size: .8rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ── Landing base (light, warm, editorial) ───────────────── */
.landing { background: var(--bg); }
[data-theme="light"] .landing {
  background:
    radial-gradient(1200px 620px at 82% -8%, rgba(91,71,240,.07), transparent 60%),
    radial-gradient(1000px 560px at 8% 6%, rgba(0,194,203,.06), transparent 58%),
    linear-gradient(180deg, #FBFAFF 0%, #F5F6FE 100%);
}

/* ── Hero (light, product-led, two-column) ───────────────── */
.hero {
  padding: 148px 40px 96px;
  position: relative;
  overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.hero-grid {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(var(--primary-rgb),.16) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: .55;
  -webkit-mask-image: radial-gradient(ellipse 78% 62% at 60% 32%, black 2%, transparent 72%);
  mask-image: radial-gradient(ellipse 78% 62% at 60% 32%, black 2%, transparent 72%);
}
.hero-inner {
  position: relative; z-index: 1;
  max-width: 1180px; margin: 0 auto;
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center;
}
.hero-copy { max-width: 560px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 15px; border-radius: 100px;
  background: var(--surface); border: 1px solid var(--border2);
  box-shadow: var(--shadow-xs);
  font-size: .8rem; font-weight: 600; color: var(--text2);
  margin-bottom: 24px;
  animation: fade-up .6s ease both;
}
.hero-badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); animation: pulse 2s ease infinite; }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.6;transform:scale(.85)} }
.hero-title {
  font-size: clamp(2.3rem, 4.6vw, 3.7rem);
  font-weight: 850; line-height: 1.08; letter-spacing: -.035em;
  color: var(--text);
  margin-bottom: 22px;
  animation: fade-up .6s ease .1s both;
}
.hero-title .grad-text {
  background: var(--grad);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  position: relative;
}
.hero-subtitle {
  font-size: 1.12rem; color: var(--text2); max-width: 520px; margin: 0 0 32px;
  line-height: 1.7; font-weight: 400;
  animation: fade-up .6s ease .2s both;
}
.hero-cta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  animation: fade-up .6s ease .3s both;
}
.hero-trust {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  margin-top: 26px;
  animation: fade-up .6s ease .4s both;
}
.hero-trust span { display: inline-flex; align-items: center; gap: 7px; font-size: .84rem; font-weight: 500; color: var(--text3); }
.hero-trust svg { width: 16px; height: 16px; color: var(--success); flex-shrink: 0; }

/* Hero product demo — a mini website with the live launcher + greeting nudge */
.hero-demo {
  position: relative;
  animation: fade-up .8s ease .35s both;
}
.hd-window {
  background: #ffffff;
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 34px 80px rgba(30,27,75,.20), 0 10px 28px rgba(30,27,75,.08);
  border: 1px solid rgba(15,23,42,.07);
  transform: perspective(1600px) rotateY(-4deg) rotateX(3deg);
  transition: transform .5s var(--ease);
}
.hero-demo:hover .hd-window { transform: perspective(1600px) rotateY(0deg) rotateX(0deg); }
.hd-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 15px; background: #F4F4F9; border-bottom: 1px solid #ececf2;
}
.hd-dot { width: 11px; height: 11px; border-radius: 50%; }
.hd-dot.r { background: #ff5f57; } .hd-dot.y { background: #ffbd2e; } .hd-dot.g { background: #28c840; }
.hd-url {
  flex: 1; margin-left: 8px; background: #fff; border: 1px solid #ececf2;
  border-radius: 7px; padding: 5px 12px; font-size: .72rem; color: #9aa3b8; text-align: center;
}
.hd-canvas {
  position: relative; padding: 26px 26px 96px; min-height: 340px;
  background: linear-gradient(180deg, #ffffff 0%, #FAFAFE 100%);
}
.hd-eyebrow {
  display: inline-block; font-size: .62rem; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--primary);
  background: var(--primary-faded); border-radius: 100px; padding: 4px 10px; margin-bottom: 14px;
}
.hd-h1 { height: 15px; width: 78%; border-radius: 6px; background: #e7e9f3; margin-bottom: 10px; }
.hd-h1.sm { width: 54%; }
.hd-line { height: 9px; border-radius: 5px; background: #eef0f7; margin-bottom: 8px; }
.hd-line.w1 { width: 92%; } .hd-line.w2 { width: 84%; } .hd-line.w3 { width: 64%; }
.hd-btn {
  margin-top: 16px; width: 116px; height: 32px; border-radius: 9px;
  background: var(--grad); box-shadow: 0 8px 18px rgba(var(--primary-rgb),.28);
}
.hd-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 24px; }
.hd-card { height: 58px; border-radius: 11px; background: #f3f4fb; border: 1px solid #ececf4; }
/* launcher + greeting nudge, pinned to the corner of the demo site */
.hd-launcher { position: absolute; right: 22px; bottom: 22px; width: 56px; height: 56px; }
.hd-bubble {
  position: relative; width: 56px; height: 56px; border-radius: 50%;
  background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 26px rgba(var(--primary-rgb),.42);
  animation: hd-float 3.4s ease-in-out infinite;
}
@keyframes hd-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.hd-bubble-ring {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(var(--primary-rgb),.35);
  animation: hd-ring 2.5s ease-out infinite;
}
@keyframes hd-ring { 0%{transform:scale(1);opacity:.6} 70%{transform:scale(1.55);opacity:0} 100%{opacity:0} }
/* curved greeting text hugging the demo launcher (matches the live widget) */
.hd-nudge {
  position: absolute; left: 28px; top: 28px;
  width: 150px; height: 150px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: hd-nudge-in .5s cubic-bezier(.2,.8,.2,1) .9s both;
}
.hd-nudge.gone { animation: hd-nudge-out .3s ease forwards; }
@keyframes hd-nudge-in {
  from { opacity: 0; transform: translate(-50%,-50%) scale(.9); }
  to   { opacity: 1; transform: translate(-50%,-50%) scale(1); }
}
@keyframes hd-nudge-out { to { opacity: 0; transform: translate(-50%,-50%) scale(.9); } }
.hd-nudge-ring {
  width: 100%; height: 100%; overflow: visible; display: block;
  transform: rotate(-8deg); transform-origin: center;
}
.hd-nudge-arc-text {
  font-weight: 800; font-size: 11.5px; letter-spacing: .2px;
  fill: var(--primary);
  paint-order: stroke; stroke: #fff; stroke-width: 2.6px; stroke-linejoin: round;
}
.hd-nudge-wave {
  position: absolute; left: 22px; bottom: 68px; font-size: 18px; line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.18));
  transform-origin: 70% 80%; animation: hd-wave 2.4s ease infinite;
}
@keyframes hd-wave {
  0%,60%,100% { transform: rotate(0deg); }
  10% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); }
  30% { transform: rotate(14deg); } 40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); }
}

@media (max-width: 940px) {
  .hero { padding: 128px 24px 72px; }
  .hero-inner { grid-template-columns: 1fr; gap: 48px; }
  .hero-copy { max-width: none; text-align: center; margin: 0 auto; }
  .hero-subtitle { margin-left: auto; margin-right: auto; }
  .hero-cta, .hero-trust { justify-content: center; }
  .hero-demo { max-width: 480px; margin: 0 auto; }
  .hd-window { transform: none; }
}
@media (max-width: 480px) {
  .hero { padding: 112px 16px 56px; }
  .hd-cards { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .hd-bubble, .hd-bubble-ring, .hd-nudge, .hd-nudge-wave { animation: none; }
}

/* ── Hero demo — live content + animations ─────────────────── */
/* mini site chrome */
.hdx-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.hdx-brand { display: flex; align-items: center; gap: 7px; font-size: .74rem; font-weight: 800; color: #3b3663; letter-spacing: .01em; }
.hdx-brand-dot { width: 16px; height: 16px; border-radius: 6px; background: var(--grad); box-shadow: 0 3px 8px rgba(var(--primary-rgb), .35); }
.hdx-nav { display: flex; gap: 6px; align-items: center; }
.hdx-nav i { width: 26px; height: 7px; border-radius: 5px; background: #e9ebf5; display: block; }
.hdx-nav i:last-child { width: 16px; background: var(--primary-faded); }
.hdx-title { font-size: 1.02rem; font-weight: 800; line-height: 1.25; color: #2c2952; margin-bottom: 12px; letter-spacing: -.01em; }
.hdx-title span { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* shimmer sweep on the skeleton copy lines */
.hd-line, .hdx-tt { position: relative; overflow: hidden; }
.hd-line::after, .hdx-tt::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.8) 50%, transparent 80%);
  transform: translateX(-100%); animation: hdx-shimmer 2.6s ease-in-out infinite;
}
.hd-line.w2::after { animation-delay: .35s; }
@keyframes hdx-shimmer { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }

/* CTA button — label + moving shine */
.hd-btn { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.hdx-cta-label { position: relative; z-index: 1; font-size: .72rem; font-weight: 700; color: #fff; letter-spacing: .02em; }
.hd-btn::after {
  content: ''; position: absolute; top: 0; left: -60%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent);
  transform: skewX(-18deg); animation: hdx-shine 3.4s ease-in-out infinite;
}
@keyframes hdx-shine { 0% { left: -60%; } 55%, 100% { left: 130%; } }

/* product cards with real content — staggered fade-in + gentle bob */
.hd-card {
  height: auto; min-height: 66px; padding: 10px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 7px;
  opacity: 0; animation: hdx-fade .5s ease both, hdx-bob 4.5s ease-in-out infinite;
}
.hd-card:nth-child(1) { animation-delay: .5s, 1.0s; }
.hd-card:nth-child(2) { animation-delay: .66s, 1.4s; }
.hd-card:nth-child(3) { animation-delay: .82s, 1.8s; }
.hdx-ico { width: 24px; height: 24px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; background: #eef1fb; }
.hdx-tt { height: 7px; width: 78%; border-radius: 4px; background: #e7e9f3; }
.hdx-price { font-size: .72rem; font-weight: 800; color: #2c2952; }
@keyframes hdx-fade { to { opacity: 1; } }
@keyframes hdx-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

/* live chat window (the widget, open) */
.hdx-chat {
  position: absolute; right: 18px; bottom: 84px; width: 214px; z-index: 3;
  background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: 0 18px 40px rgba(30,27,75,.22), 0 4px 12px rgba(30,27,75,.08);
  border: 1px solid rgba(15,23,42,.06);
  animation: hdx-win-in .55s var(--ease) 1.1s both;
}
@keyframes hdx-win-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
.hdx-chat-head { display: flex; align-items: center; gap: 8px; padding: 9px 11px; background: var(--grad); color: #fff; }
.hdx-chat-ava { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.hdx-chat-name { font-size: .76rem; font-weight: 700; line-height: 1.15; }
.hdx-chat-status { font-size: .6rem; opacity: .92; display: flex; align-items: center; gap: 4px; }
.hdx-chat-status i { width: 5px; height: 5px; border-radius: 50%; background: #4ade80; display: block; box-shadow: 0 0 0 1.5px rgba(255,255,255,.5); }
.hdx-chat-body { padding: 11px; display: flex; flex-direction: column; gap: 8px; background: #f7f8fc; min-height: 104px; }
.hdx-row { display: flex; }
.hdx-row.u { justify-content: flex-end; }
.hdx-msg { max-width: 82%; font-size: .72rem; line-height: 1.35; padding: 7px 10px; border-radius: 12px; animation: hdx-pop .3s var(--ease); }
.hdx-row.u .hdx-msg { background: var(--grad); color: #fff; border-bottom-right-radius: 4px; }
.hdx-row.b .hdx-msg { background: #fff; color: #2c2952; border: 1px solid #e9ebf5; border-bottom-left-radius: 4px; }
@keyframes hdx-pop { from { opacity: 0; transform: translateY(6px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
.hdx-typing { display: flex; gap: 3px; align-items: center; padding: 9px 10px; background: #fff; border: 1px solid #e9ebf5; border-radius: 12px; border-bottom-left-radius: 4px; width: max-content; }
.hdx-typing span { width: 5px; height: 5px; border-radius: 50%; background: #b7bdd0; display: block; animation: hdx-bounce 1.3s ease infinite; }
.hdx-typing span:nth-child(2) { animation-delay: .15s; }
.hdx-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes hdx-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }

@media (max-width: 480px) {
  .hdx-chat { width: 196px; right: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .hd-line::after, .hd-btn::after, .hd-card, .hdx-typing span, .hdx-chat { animation: none; opacity: 1; }
}

/* ── Features ────────────────────────────────────────────── */
.features { padding: 100px 48px; }
.section-label {
  text-align: center;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--primary); margin-bottom: 16px;
  background: var(--primary-faded); border-radius: 100px;
  padding: 5px 14px;
}
.section-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800; letter-spacing: -.03em;
  margin-bottom: 16px; text-align: center;
}
.section-sub { color: var(--text2); text-align: center; max-width: 520px; margin: 0 auto 64px; font-size: 1.05rem; }
.section-header { display: flex; flex-direction: column; align-items: center; }
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  max-width: 1100px; margin: 0 auto;
}
.feat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative; overflow: hidden;
  transition: all var(--t);
  cursor: default;
}
.feat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--grad); opacity: 0; transition: opacity var(--t);
}
.feat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary-faded2); }
.feat-card:hover::before { opacity: 1; }
.feat-icon {
  width: 52px; height: 52px; border-radius: var(--radius-sm);
  background: var(--grad-subtle); border: 1px solid rgba(var(--primary-rgb),.15);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px; color: var(--primary);
  transition: all var(--t);
}
.feat-card:hover .feat-icon { background: var(--grad); color: white; border-color: transparent; }
.feat-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; }
.feat-desc { color: var(--text2); font-size: .9rem; line-height: 1.65; }

/* ── Stats Strip ─────────────────────────────────────────── */
/* ── How it works ────────────────────────────────────────── */
.how-it-works { padding: 100px 48px; }
.steps { display: flex; gap: 0; max-width: 900px; margin: 0 auto; position: relative; }
.steps::before {
  content: ''; position: absolute;
  top: 28px; left: calc(16.5% + 28px); right: calc(16.5% + 28px);
  height: 2px; background: var(--grad);
  z-index: 0;
}
.step {
  flex: 1; text-align: center; padding: 0 20px; position: relative; z-index: 1;
}
.step-num {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--grad); color: white;
  font-size: 1.3rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px; box-shadow: var(--shadow-primary);
}
.step-title { font-size: 1rem; font-weight: 700; margin-bottom: 10px; }
.step-desc { font-size: .875rem; color: var(--text2); line-height: 1.65; }

/* ── CTA Section ─────────────────────────────────────────── */
.cta-section {
  padding: 100px 48px;
  text-align: center;
  position: relative; overflow: hidden;
}
.cta-bg {
  position: absolute; inset: 0;
  background: var(--grad-subtle);
  border-top: 1px solid rgba(var(--primary-rgb),.15);
  border-bottom: 1px solid rgba(var(--primary-rgb),.15);
}
.cta-content { position: relative; z-index: 1; max-width: 600px; margin: 0 auto; }
.cta-title { font-size: clamp(1.8rem,4vw,2.6rem); font-weight: 800; letter-spacing: -.03em; margin-bottom: 16px; }
.cta-sub { color: var(--text2); font-size: 1.05rem; margin-bottom: 36px; }

/* ── FAQ accordion ───────────────────────────────────────── */
.faq-section { padding: 96px 40px; }
.faq-list { max-width: 780px; margin: 52px auto 0; display: flex; flex-direction: column; gap: 12px; }
.faq-item {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); overflow: hidden;
  transition: border-color var(--t), box-shadow var(--t);
}
.faq-item:hover { border-color: var(--border2); }
.faq-item.open { border-color: var(--primary-faded2); box-shadow: var(--shadow); }
.faq-q {
  width: 100%; text-align: left; background: none; color: var(--text);
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 19px 22px; font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em;
  transition: color var(--t);
}
.faq-q:hover { color: var(--primary); }
.faq-icon {
  flex-shrink: 0; width: 27px; height: 27px; border-radius: 50%;
  background: var(--primary-faded); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--t), background var(--t), color var(--t);
}
.faq-item.open .faq-icon { transform: rotate(45deg); background: var(--grad); color: #fff; }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .35s var(--ease); }
.faq-a-inner { padding: 0 22px 20px; color: var(--text2); font-size: .94rem; line-height: 1.72; }
.faq-a-inner a { color: var(--primary); font-weight: 600; }
@media (max-width: 640px) {
  .faq-section { padding: 60px 18px; }
  .faq-q { font-size: .96rem; padding: 16px 18px; }
}

/* ── Landing section rhythm (light, editorial) ───────────── */
[data-theme="light"] .land-nav { background: rgba(255,255,255,.82); border-bottom-color: rgba(15,23,42,.07); }
[data-theme="light"] .feat-showcase-section { background: #fff; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

/* ── Footer ──────────────────────────────────────────────── */
.land-footer { border-top: 1px solid var(--border); background: var(--surface2); }
.footer-inner {
  max-width: 1280px; margin: 0 auto; padding: 44px 56px 28px;
  display: grid; grid-template-columns: 1.5fr 1fr 1.6fr; gap: 40px 64px; align-items: start;
}
.footer-brand { max-width: 380px; }
.footer-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; }
.footer-logo span { background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.footer-tagline { margin: 12px 0 16px; font-size: .85rem; color: var(--text2); line-height: 1.6; }
.footer-contacts { display: flex; flex-direction: column; gap: 8px; }
.footer-contacts a, .footer-contacts span {
  display: flex; align-items: center; gap: 9px;
  font-size: .85rem; color: var(--text2); transition: color var(--t);
}
.footer-contacts a:hover { color: var(--primary); }
.footer-contacts svg { width: 15px; height: 15px; color: var(--primary); flex-shrink: 0; }
.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-inner h4 {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text); margin-bottom: 12px;
}
.footer-nav a { font-size: .85rem; color: var(--text2); transition: color var(--t); }
.footer-nav a:hover { color: var(--primary); }

/* Contact form */
.footer-form { display: flex; flex-direction: column; gap: 9px; }
.ff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.ff-input {
  width: 100%; box-sizing: border-box;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font-size: .875rem; font-family: inherit;
  outline: none; transition: border-color var(--t), box-shadow var(--t);
}
.ff-input::placeholder { color: var(--text3); }
.ff-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12); }
.ff-textarea { resize: none; height: 92px; overflow-y: auto; line-height: 1.5; }
.ff-btn { align-self: flex-start; margin-top: 2px; }
/* Honeypot — kept in the DOM for bots but invisible/unfocusable for humans. */
.ff-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.footer-bottom {
  max-width: 1280px; margin: 0 auto; padding: 18px 56px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.footer-copy { font-size: .8rem; color: var(--text3); }
.footer-bottom-links { display: flex; gap: 20px; }
.footer-bottom-links a { font-size: .8rem; color: var(--text3); transition: color var(--t); }
.footer-bottom-links a:hover { color: var(--text2); }
@media (max-width: 900px) {
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 30px 32px; padding: 36px 24px 24px; }
  .footer-form-wrap { grid-column: 1 / -1; max-width: 480px; }
  .footer-bottom { padding: 16px 24px; }
}
@media (max-width: 560px) {
  .footer-inner { grid-template-columns: 1fr; gap: 28px; }
  .footer-brand { max-width: none; }
}

/* ══════════════════════════════════════════════════════════
   AUTH PAGE
══════════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  display: grid; grid-template-columns: 1fr 1fr;
}
@media (max-width: 768px) { .auth-page { grid-template-columns: 1fr; } }

.auth-left {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
@media (max-width: 768px) { .auth-left { display: none; } }
.auth-left-blob {
  position: absolute; border-radius: 50%; filter: blur(70px);
  opacity: .25;
}
.auth-left-blob-1 { width: 400px; height: 400px; background: var(--primary); bottom: -100px; right: -100px; }
.auth-left-blob-2 { width: 300px; height: 300px; background: var(--accent); top: 100px; left: -80px; }
.auth-left-logo { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; }
.auth-left-logo span { background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.auth-left-hero { position: relative; z-index: 1; }
.auth-left-title { font-size: 2.2rem; font-weight: 800; line-height: 1.2; letter-spacing: -.04em; margin-bottom: 20px; }
.auth-left-title .grad-text { background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.auth-left-desc { color: var(--text2); font-size: .95rem; line-height: 1.7; margin-bottom: 32px; }
.auth-feature-list { display: flex; flex-direction: column; gap: 14px; }
.auth-feature { display: flex; align-items: center; gap: 12px; font-size: .9rem; }
.auth-feature-icon {
  width: 32px; height: 32px; border-radius: var(--radius-xs);
  background: var(--primary-faded); color: var(--primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.auth-left-quote { position: relative; z-index: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.auth-left-quote p { font-size: .9rem; color: var(--text2); line-height: 1.65; font-style: italic; margin-bottom: 12px; }
.auth-left-quote-author { font-size: .8rem; font-weight: 600; color: var(--text); }

.auth-right {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 48px;
  background: var(--bg);
}
.auth-box { width: 100%; max-width: 400px; }
.auth-toggle-row {
  display: flex; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px; gap: 4px; margin-bottom: 32px;
}
.auth-toggle-btn {
  flex: 1; padding: 9px; font-size: .875rem; font-weight: 600;
  border-radius: var(--radius-xs); color: var(--text2);
  background: transparent; border: none; transition: all var(--t);
}
.auth-toggle-btn.active {
  background: var(--surface); color: var(--primary);
  box-shadow: var(--shadow-xs);
}
.auth-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: 6px; }
.auth-sub { color: var(--text2); font-size: .9rem; margin-bottom: 28px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
/* min-width:0 lets fields/inputs shrink inside grid/flex columns instead of
   overflowing their card (inputs have an intrinsic ~200px minimum otherwise). */
.form-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-label { font-size: .8rem; font-weight: 600; color: var(--text2); }
.form-input {
  min-width: 0;
  padding: 11px 14px; font-size: .9rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color var(--t), box-shadow var(--t);
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-faded); }
.form-input::placeholder { color: var(--text3); }
.form-input-wrap { position: relative; }
.form-input-wrap .form-input { width: 100%; padding-right: 44px; }
.form-eye {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text3); cursor: pointer; transition: color var(--t);
  display: flex; align-items: center;
}
.form-eye:hover { color: var(--text2); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.auth-submit { margin-top: 6px; }
.auth-error {
  background: var(--danger-faded); border: 1px solid var(--danger);
  color: var(--danger); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: .85rem; display: none;
}
.auth-error.visible { display: block; }
.auth-footer-link { text-align: center; font-size: .85rem; color: var(--text2); margin-top: 20px; }
.auth-footer-link a { color: var(--primary); font-weight: 600; }

/* ── Enhanced / interactive auth form ── */
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .form-input { width: 100%; }
.input-icon {
  position: absolute; left: 13px; width: 16px; height: 16px;
  color: var(--text3); pointer-events: none; transition: color var(--t), transform var(--t);
}
.input-wrap:focus-within .input-icon { color: var(--primary); transform: scale(1.08); }
.form-input.has-icon { padding-left: 40px; }
.form-input.has-eye { padding-right: 42px; }
.form-input.has-status { padding-right: 40px; }
.form-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; padding: 6px; color: var(--text3);
  cursor: pointer; display: flex; align-items: center; transition: color var(--t);
}
.form-eye:hover { color: var(--primary); }
.field-status { position: absolute; right: 13px; display: flex; align-items: center; pointer-events: none; }
.field-status.ok { color: var(--success); }
.field-status.bad { color: var(--danger); }
.field-hint { font-size: .72rem; color: var(--text3); margin-top: 5px; }

.pwd-meter { display: flex; gap: 5px; margin-top: 9px; }
.pwd-meter span {
  height: 4px; flex: 1; border-radius: 4px; background: var(--surface3);
  transition: background .35s ease, transform .35s ease; transform-origin: center;
}
.pwd-meter span.on { transform: scaleY(1.4); }
.pwd-meter.lvl-1 span.on { background: #ef4444; }
.pwd-meter.lvl-2 span.on { background: #f59e0b; }
.pwd-meter.lvl-3 span.on { background: #3b82f6; }
.pwd-meter.lvl-4 span.on { background: #22c55e; }
.pwd-meter-label { font-size: .72rem; font-weight: 700; margin-top: 6px; letter-spacing: .02em; min-height: 12px; }
.pwd-meter-label.lvl-1 { color: #ef4444; }
.pwd-meter-label.lvl-2 { color: #f59e0b; }
.pwd-meter-label.lvl-3 { color: #3b82f6; }
.pwd-meter-label.lvl-4 { color: #22c55e; }

.pwd-reqs { display: flex; flex-wrap: wrap; gap: 7px 14px; margin-top: 10px; }
.pwd-req { display: flex; align-items: center; gap: 5px; font-size: .72rem; color: var(--text3); transition: color .25s ease; }
.pwd-req.met { color: var(--success); }
.pwd-req i { flex-shrink: 0; transition: transform .25s ease; }
.pwd-req.met i { transform: scale(1.12); }

.caps-hint { display: none; align-items: center; gap: 5px; font-size: .72rem; color: #f59e0b; font-weight: 600; margin-top: 8px; }
.caps-hint.show { display: flex; }
.match-hint { display: flex; align-items: center; gap: 5px; font-size: .72rem; margin-top: 7px; min-height: 14px; }
.match-hint.ok { color: var(--success); }
.match-hint.bad { color: var(--danger); }

.auth-submit { transition: opacity var(--t), transform var(--t), filter var(--t); }
.auth-submit:disabled, .auth-submit.is-disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.25); }
.auth-submit:not(:disabled):hover { transform: translateY(-1px); }

/* Staggered field entrance + error shake */
.anim-field { opacity: 0; transform: translateY(9px); animation: authFieldIn .45s cubic-bezier(.2,.7,.3,1) forwards; animation-delay: calc(var(--d, 0) * 70ms); }
@keyframes authFieldIn { to { opacity: 1; transform: translateY(0); } }
@keyframes authShake {
  10%,90% { transform: translateX(-1px); }
  20%,80% { transform: translateX(2px); }
  30%,50%,70% { transform: translateX(-5px); }
  40%,60% { transform: translateX(5px); }
}
.auth-box.shake { animation: authShake .5s cubic-bezier(.36,.07,.19,.97); }

/* ── Auth card + 3D bot mascot ── */
.auth-page { height: 100vh; min-height: 0; }
.auth-right { padding: 24px; overflow-y: auto; }
.auth-box { max-width: 432px; }

.auth-card {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 16px 26px 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,.13), 0 2px 10px rgba(0,0,0,.05);
  animation: authCardIn .5s cubic-bezier(.2,.7,.3,1);
}
.auth-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--grad); }
@keyframes authCardIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* compact spacing so the whole form fits without scrolling */
.auth-card .auth-toggle-row { margin-bottom: 16px; }
.auth-card .auth-form { gap: 11px; }
.auth-card .form-field { gap: 5px; }
.auth-card .auth-footer-link { margin-top: 14px; }
.auth-card .auth-submit { margin-top: 4px; padding: 12px; }
.label-row { display: flex; align-items: center; justify-content: space-between; }
.auth-link-sm { font-size: .76rem; color: var(--primary); font-weight: 600; }
.auth-link-sm:hover { text-decoration: underline; }
.auth-remember { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--text2); cursor: pointer; -webkit-user-select: none; user-select: none; margin-top: 2px; }
.auth-remember input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.pwd-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 7px; }
.pwd-row .pwd-meter-label { margin-top: 0; }
.pwd-row .pwd-reqs { margin-top: 0; gap: 5px 10px; }

.auth-success {
  background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.4);
  color: var(--success); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: .85rem; line-height: 1.5; margin-bottom: 8px;
}

/* mascot */
.auth-bot { display: flex; justify-content: center; margin: 0 0 6px; perspective: 620px; }
.bot-svg { overflow: visible; filter: drop-shadow(0 10px 18px rgba(0,0,0,.20)); animation: botFloat 4s ease-in-out infinite; }
@keyframes botFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
#botHead { transform-box: fill-box; transform-origin: center; transition: transform .18s ease-out; }
#botAntenna { animation: botBlink 3.4s ease-in-out infinite; }
@keyframes botBlink { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
#botPupilL, #botPupilR { transition: transform .12s ease-out; }
#botPaws { transform: translateY(46px); opacity: 0; transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .2s ease; }
#botPaws.cover { transform: translateY(0); opacity: 1; }

/* shrink the mascot on shorter screens to guarantee no scroll */
@media (max-height: 760px) {
  .auth-bot { margin-bottom: 2px; }
  .bot-svg { width: 92px; height: 84px; }
  .auth-card { padding-top: 12px; }
  .auth-card .auth-toggle-row { margin-bottom: 12px; }
}

/* ── Settings layout + live widget preview ── */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) 450px; gap: 20px; align-items: stretch; max-width: 1180px; }
/* inline-size container: the paired fields/cards inside stack based on the column's
   actual width (which depends on sidebar + preview state), not the viewport width. */
.settings-forms { display: flex; flex-direction: column; gap: 20px; min-width: 0; container-type: inline-size; }
.settings-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-sub-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
/* Save bar spans both columns so the preview stretches to the cards' height, not the button's. */
.settings-save-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
/* Let the preview card fill the full row height (aligns its base with Appearance / Bot Avatar). */
.settings-preview { display: flex; min-width: 0; }
.settings-preview > .card { width: 100%; padding: 14px 10px; display: flex; flex-direction: column; }
@container (max-width: 500px) { .settings-2col { grid-template-columns: 1fr; } }
@container (max-width: 580px) { .settings-sub-row { grid-template-columns: 1fr; } }
@media (max-width: 1080px) { .settings-grid { grid-template-columns: 1fr; } }
/* Fallback if container queries are unsupported */
@media (max-width: 640px) { .settings-sub-row, .settings-2col { grid-template-columns: 1fr; } }

/* Color picker swatch (flex-shrink:0 stops it collapsing into a thin bar) */
.color-swatch {
  width: 44px; height: 44px; flex-shrink: 0; margin: 0; padding: 0; cursor: pointer;
  border: 2px solid var(--border); border-radius: 10px; background: none;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
}
.color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.color-swatch::-webkit-color-swatch { border: none; border-radius: 9px; }
.color-swatch::-moz-color-swatch { border: none; border-radius: 9px; }

.pv-root { display: flex; flex-direction: column; align-items: center; gap: 40px; flex: 1; }
.pv-window {
  width: 100%; max-width: 360px;
  flex: 1 1 auto;
  border-radius: 18px; overflow: hidden;
  background: #fff; border: 1px solid rgba(0,0,0,.07);
  box-shadow: 0 18px 44px rgba(0,0,0,.16);
  display: flex; flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.pv-header {
  background: linear-gradient(135deg, var(--pv) 0%, rgba(var(--pv-rgb), .82) 100%);
  padding: 13px 14px; display: flex; align-items: center; gap: 10px; color: var(--pv-fg, #fff);
}
.pv-avatar { width: 38px; height: 38px; border-radius: 50%; background: rgba(var(--pv-fg-rgb, 255,255,255), .2); border: 2px solid rgba(var(--pv-fg-rgb, 255,255,255), .35); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.pv-avatar img, .pv-mav img { width: 100%; height: 100%; object-fit: cover; }
.pv-head-info { flex: 1; min-width: 0; }
.pv-name { font-size: 14px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-status { font-size: 11.5px; opacity: .9; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.pv-status span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Ring in the auto-contrast ink keeps the dot visible on green/teal headers. */
.pv-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; flex-shrink: 0; box-shadow: 0 0 0 1.5px var(--pv-fg, #fff); }
.pv-x { opacity: .85; flex-shrink: 0; display: flex; }
.pv-body { background: #f8fafc; padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 140px; overflow-y: auto; }
.pv-row { display: flex; gap: 7px; align-items: flex-start; max-width: 86%; }
.pv-row.bot { align-self: flex-start; }
.pv-row.user { align-self: flex-end; flex-direction: row-reverse; }
.pv-mav { width: 24px; height: 24px; border-radius: 50%; background: var(--pv); color: var(--pv-fg, #fff); display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.pv-bubble { padding: 9px 12px; border-radius: 14px; font-size: 13px; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.pv-bubble.bot { background: #fff; color: #1e293b; border: 1px solid #e8ecf0; border-bottom-left-radius: 4px; }
.pv-bubble.user { background: var(--pv); color: var(--pv-fg, #fff); border-bottom-right-radius: 4px; }
.pv-input { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid #e8ecf0; background: #fff; }
.pv-field { flex: 1; padding: 9px 12px; border: 1.5px solid #e2e8f0; border-radius: 20px; font-size: 12.5px; color: #94a3b8; background: #f8fafc; }
.pv-send { width: 36px; height: 36px; border-radius: 50%; background: var(--pv); color: var(--pv-fg, #fff); display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1px solid rgba(0,0,0,.06); }
.pv-launcher-wrap { position: relative; align-self: flex-end; }
.pv-launcher { position: relative; width: 52px; height: 52px; border-radius: 50%; background: var(--pv); color: var(--pv-fg, #fff); display: flex; align-items: center; justify-content: center; border: 1px solid rgba(0,0,0,.06); box-shadow: 0 6px 18px rgba(var(--pv-rgb), .45), 0 3px 10px rgba(0,0,0,.14); transition: transform .2s ease; }
.pv-launcher:hover { transform: scale(1.06); }
.pv-launcher-ring {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(var(--pv-rgb), .35);
  animation: pv-pulse 2.5s ease-out infinite; pointer-events: none;
}
@keyframes pv-pulse { 0% { transform: scale(1); opacity: .6; } 70%, 100% { transform: scale(1.6); opacity: 0; } }

/* Greeting nudge — same curved "Chat with us" + wave as the real widget */
.pv-nudge {
  position: absolute; left: 50%; top: 50%; width: 150px; height: 150px;
  transform: translate(-50%, -50%); pointer-events: none;
}
.pv-nudge-ring { width: 100%; height: 100%; overflow: visible; display: block; transform: rotate(-8deg); transform-origin: center; }
.pv-nudge-arc-text {
  font-weight: 800; font-size: 13px; letter-spacing: .2px;
  fill: var(--pv-ink, var(--pv));
  paint-order: stroke; stroke: #fff; stroke-width: 3.2px; stroke-linejoin: round;
}
.pv-nudge-wave {
  position: absolute; left: 22px; bottom: 68px; font-size: 19px; line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.22));
  transform-origin: 70% 80%; animation: pv-wave 2.4s ease infinite;
}
@keyframes pv-wave {
  0%, 60%, 100% { transform: rotate(0deg); }
  10% { transform: rotate(16deg); } 20% { transform: rotate(-8deg); }
  30% { transform: rotate(16deg); } 40% { transform: rotate(-4deg); }
  50% { transform: rotate(12deg); }
}
@media (prefers-reduced-motion: reduce) { .pv-nudge-wave, .pv-launcher-ring { animation: none; } }

/* ── Inbox notifications: sidebar badge, unseen rows, new-messages pill ── */
.nav-badge {
  position: absolute; right: 10px; top: 50
  %; transform: translateY(-50%);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700;
  display: none; align-items: center; justify-content: center; line-height: 1;
  box-shadow: 0 0 0 2px var(--surface);
}
.sidebar.collapsed .nav-badge { right: 7px; top: 7px; transform: none; }

.inbox-row-unseen td { background: var(--primary-faded); }
.inbox-row-unseen td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.inbox-unread-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-right: 8px;
  border-radius: 9px; background: var(--primary); color: #fff;
  font-size: .68rem; font-weight: 700; vertical-align: middle;
}
/* "New messages" divider inside an open chat */
.msg-unread-divider {
  display: flex; align-items: center; gap: 10px; margin: 6px 2px;
  color: var(--primary); font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; transition: opacity .4s ease;
}
.msg-unread-divider::before, .msg-unread-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--primary); opacity: .35;
}
.msg-unread-divider.read { opacity: .45; }

.new-msgs-pill {
  position: sticky; bottom: 10px; z-index: 5;
  margin: 4px auto 0; width: max-content;
  display: flex; align-items: center; gap: 6px;
  background: var(--primary); color: #fff; border: none;
  border-radius: 20px; padding: 7px 14px; font-size: .8rem; font-weight: 600;
  cursor: pointer; box-shadow: 0 6px 16px rgba(0,0,0,.22);
  transition: transform .15s ease, opacity .2s ease;
}
.new-msgs-pill:hover { transform: translateY(-1px); }
.auth-back {
  position: absolute; top: 24px; left: 24px;
  display: flex; align-items: center; gap: 6px;
  font-size: .85rem; font-weight: 500; color: var(--text2);
  transition: color var(--t); cursor: pointer;
}
.auth-back:hover { color: var(--text); }

/* ══════════════════════════════════════════════════════════
   DASHBOARD SHELL
══════════════════════════════════════════════════════════ */
.dash-shell {
  display: flex; min-height: 100vh;
  overflow-x: hidden; max-width: 100vw;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: width var(--t-slow), transform var(--t-slow);
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar-header {
  padding: 20px 16px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  min-height: 68px;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.05rem; letter-spacing: -.03em;
  white-space: nowrap; overflow: hidden;
  transition: opacity var(--t);
}
.sidebar-logo-icon {
  /* The mark supplies its own gradient tile (same icon as the navbar), so the
     container is just a fixed, transparent slot — no second gradient behind it. */
  width: 36px; height: 36px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-logo-icon svg { display: block; }
.sidebar-logo-text { overflow: hidden; transition: opacity .2s, max-width .3s; }
.sidebar-logo-text span { background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sidebar.collapsed .sidebar-logo-text { opacity: 0; max-width: 0; }
.sidebar-collapse-btn {
  width: 32px; height: 32px; border-radius: var(--radius-xs);
  background: transparent; color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t); flex-shrink: 0;
}
.sidebar-collapse-btn:hover { background: var(--surface3); color: var(--text); }

/* Collapsed: stack the header vertically so the logo stays visible and the
   toggle button sits beneath it instead of overlapping it. */
.sidebar.collapsed .sidebar-header {
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 16px 8px;
}
.sidebar.collapsed .sidebar-logo { gap: 0; }

.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text2); font-size: .875rem; font-weight: 500;
  transition: all var(--t); position: relative; cursor: pointer;
  white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: var(--surface3); color: var(--text); }
.nav-item.active {
  background: var(--primary-faded); color: var(--primary);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--primary);
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-label { transition: opacity .2s, max-width .3s; overflow: hidden; }
.sidebar.collapsed .nav-label { opacity: 0; max-width: 0; }
.nav-tooltip {
  position: absolute; left: calc(100% + 10px);
  background: var(--text); color: var(--bg);
  font-size: .75rem; font-weight: 600;
  padding: 5px 10px; border-radius: var(--radius-xs);
  white-space: nowrap; pointer-events: none;
  opacity: 0; transform: translateX(-4px); transition: all .15s;
  z-index: 999;
}
.sidebar.collapsed .nav-item:hover .nav-tooltip { opacity: 1; transform: translateX(0); }

.sidebar-divider { height: 1px; background: var(--border); margin: 8px 16px; }

.sidebar-bottom { padding: 12px 8px 16px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface2); overflow: hidden;
}
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: white;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-user-name { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: .72rem; color: var(--text3); }
.sidebar.collapsed .sidebar-user-info { display: none; }

/* ── Dash Content ────────────────────────────────────────── */
.dash-content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left var(--t-slow);
}
.dash-content.sidebar-collapsed { margin-left: var(--sidebar-collapsed); }

.dash-header {
  height: var(--header-h);
  position: sticky; top: 0; z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.dash-page-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -.02em; }
.dash-header-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: transparent; color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t);
}
.icon-btn:hover { background: var(--surface3); color: var(--text); }
.dash-main { flex: 1; padding: 28px; overflow-y: auto; overflow-x: hidden; min-width: 0; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: box-shadow var(--t);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-title { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.card-sub { font-size: .85rem; color: var(--text2); margin-bottom: 20px; }

/* ── Stat Cards ──────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex; align-items: flex-start; gap: 14px;
  transition: all var(--t);
  position: relative; overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--grad); opacity: 0; transition: opacity var(--t);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-card:hover::after { opacity: 1; }
.stat-icon-box {
  width: 46px; height: 46px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon-box.primary { background: var(--primary-faded); color: var(--primary); }
.stat-icon-box.accent { background: var(--accent-faded); color: var(--accent); }
.stat-icon-box.success { background: var(--success-faded); color: var(--success); }
.stat-icon-box.warning { background: var(--warning-faded); color: var(--warning); }
.stat-icon-box.danger { background: var(--danger-faded); color: var(--danger); }
.stat-info { flex: 1; min-width: 0; }
.stat-val { font-size: 1.65rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; margin-bottom: 4px; }
.stat-name { font-size: .78rem; color: var(--text2); font-weight: 500; }
.stat-delta { font-size: .75rem; font-weight: 600; display: flex; align-items: center; gap: 3px; margin-top: 5px; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }

/* ── Charts ──────────────────────────────────────────────── */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
@media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; }
.chart-card-title { font-size: .9rem; font-weight: 700; margin-bottom: 16px; }
.chart-wrap { position: relative; height: 200px; width: 100%; min-width: 0; overflow: hidden; }
.chart-wrap canvas { max-width: 100%; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.table-toolbar {
  padding: 14px 18px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.search-input {
  flex: 1; min-width: 200px;
  padding: 8px 12px 8px 36px;
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: .875rem;
  transition: border-color var(--t), box-shadow var(--t);
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-faded); }
.search-input::placeholder { color: var(--text3); }
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text3); pointer-events: none; }
.filter-select {
  padding: 8px 12px; font-size: .875rem;
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  transition: border-color var(--t);
}
.filter-select:focus { border-color: var(--primary); outline: none; }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface2); }
th {
  padding: 11px 16px; text-align: left;
  font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text3); white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 16px; font-size: .875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--t); }
tbody tr:hover { background: var(--surface2); }
.table-empty { text-align: center; color: var(--text3); padding: 48px; }
.table-empty svg { margin: 0 auto 12px; opacity: .4; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 100px;
  font-size: .72rem; font-weight: 700; white-space: nowrap;
}
.badge-primary { background: var(--primary-faded); color: var(--primary); }
.badge-success { background: var(--success-faded); color: var(--success); }
.badge-warning { background: var(--warning-faded); color: var(--warning); }
.badge-danger { background: var(--danger-faded); color: var(--danger); }
.badge-neutral { background: var(--surface3); color: var(--text2); }

/* ── Toggle ──────────────────────────────────────────────── */
.toggle { position: relative; display: inline-block; width: 42px; height: 24px; }
.toggle input { display: none; }
.toggle-slider {
  position: absolute; inset: 0; border-radius: 100px;
  background: var(--border2); cursor: pointer; transition: all var(--t);
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  background: white; left: 3px; top: 3px;
  transition: transform var(--t);
  box-shadow: var(--shadow-xs);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Modals ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; animation: fade-in .2s ease;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 640px; max-height: 85vh;
  display: flex; flex-direction: column;
  animation: slide-up .3s ease;
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: var(--radius-xs);
  background: transparent; color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t);
}
.modal-close:hover { background: var(--danger-faded); color: var(--danger); }
.modal-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Inbox ───────────────────────────────────────────────── */
.chat-messages { display: flex; flex-direction: column; gap: 12px; }
.msg-row { display: flex; gap: 10px; }
.msg-row.user { flex-direction: row-reverse; }
.msg-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700;
}
.msg-avatar.user-av { background: var(--primary-faded); color: var(--primary); }
.msg-avatar.bot-av { background: var(--grad); color: white; }
.msg-bubble {
  max-width: 72%; padding: 10px 14px; border-radius: var(--radius);
  font-size: .875rem; line-height: 1.65;
}
.msg-row.assistant .msg-bubble { background: var(--surface2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-row.user .msg-bubble { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.msg-time { font-size: .7rem; color: var(--text3); margin-top: 4px; }
.msg-sources { margin-top: 8px; }
.msg-source-tag { display: inline-block; padding: 2px 8px; background: var(--accent-faded); color: var(--accent); border-radius: 100px; font-size: .7rem; margin: 2px; }

/* ── Inbox & Widget shared markdown styles ───────────────── */
.msg-bubble .md-h2, .wg-bubble-text .md-h2 {
  display: block; font-size: .9rem; font-weight: 700;
  margin: 8px 0 3px; padding-left: 8px;
  border-left: 3px solid currentColor; opacity: .95;
}
.msg-bubble .md-h3, .wg-bubble-text .md-h3 {
  display: block; font-size: .85rem; font-weight: 600;
  margin: 6px 0 2px; opacity: .9;
}
.msg-bubble .md-p, .wg-bubble-text .md-p { display: block; margin: 2px 0; }
.msg-bubble .md-gap, .wg-bubble-text .md-gap { display: block; height: 6px; }
.msg-bubble .md-list, .wg-bubble-text .md-list {
  margin: 6px 0; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 5px;
}
.msg-bubble .md-list li, .wg-bubble-text .md-list li {
  position: relative; padding-left: 16px; line-height: 1.55;
}
.msg-bubble .md-list li::before, .wg-bubble-text .md-list li::before {
  content: ''; position: absolute; left: 2px; top: .6em;
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.5;
}
/* Links — assistant bubble */
.msg-row.assistant .md-link, .msg-row.assistant .md-link:visited {
  color: var(--primary); text-decoration: none;
  border-bottom: 1.5px solid var(--primary-faded2);
  overflow-wrap: break-word; word-break: break-word;
}
.msg-row.assistant .md-link:hover { border-bottom-color: var(--primary); }
/* Links — user bubble (white text) */
.msg-row.user .md-link, .msg-row.user .md-link:visited {
  color: rgba(255,255,255,.92); border-bottom: 1.5px solid rgba(255,255,255,.4);
  overflow-wrap: break-word; word-break: break-word;
}
.msg-row.user .md-link:hover { border-bottom-color: white; }
/* Email & phone icons */
.md-email::before { content: '\2709\00a0'; font-size: .7rem; }
.md-phone::before { content: '\260E\00a0'; font-size: .7rem; }
/* Label: value list item layout */
.msg-bubble .md-li-label, .wg-bubble-text .md-li-label {
  font-weight: 600; white-space: nowrap; display: block; font-size: .85rem; margin-bottom: 1px;
}
.msg-bubble .md-li-value, .wg-bubble-text .md-li-value {
  display: block; overflow-wrap: break-word; word-break: break-word;
}

.chat-input-row {
  display: flex; gap: 8px; padding: 12px 0 0;
  border-top: 1px solid var(--border);
}
.chat-send-input {
  flex: 1; padding: 10px 14px; font-size: .9rem;
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  transition: border-color var(--t);
}
.chat-send-input:focus { border-color: var(--primary); outline: none; }

/* ── Knowledgebase ───────────────────────────────────────── */
.kb-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.kb-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; font-size: .875rem; font-weight: 600; color: var(--text2);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all var(--t); cursor: pointer; background: none; border-top: none; border-left: none; border-right: none;
}
.kb-tab:hover { color: var(--text); }
.kb-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.kb-tab-btn { /* alias */ display: flex; align-items: center; gap: 8px; padding: 10px 18px; font-size: .875rem; font-weight: 600; color: var(--text2); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all var(--t); cursor: pointer; background: none; border-top: none; border-left: none; border-right: none; }
.kb-tab-btn:hover { color: var(--text); }
.kb-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.drop-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius-lg);
  padding: 40px 24px; text-align: center;
  transition: all var(--t); cursor: pointer;
  background: var(--surface2);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-faded);
}
.drop-zone-icon { display: flex; justify-content: center; color: var(--text3); margin-bottom: 12px; }
.drop-zone:hover .drop-zone-icon { color: var(--primary); }
.drop-zone-text { font-size: .9rem; color: var(--text2); margin-bottom: 12px; }
.drop-zone-sub { font-size: .8rem; color: var(--text3); }

.api-add-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; margin-bottom: 18px;
}
.api-add-title { font-size: .95rem; font-weight: 700; margin-bottom: 14px; }
.api-fields { display: flex; gap: 10px; margin-bottom: 10px; }
.api-fields .form-input { flex: 1; }
.api-actions { display: flex; align-items: center; gap: 10px; }
.api-status { font-size: .85rem; color: var(--text2); }

/* ── Settings ────────────────────────────────────────────── */
/* NOTE: .settings-grid layout is defined above (wide forms + 290px preview).
   The old `1fr 1fr` rule here was overriding it and is intentionally removed. */
.settings-section { display: flex; flex-direction: column; gap: 16px; }
.color-preview { width: 38px; height: 38px; border-radius: var(--radius-xs); border: 2px solid var(--border); cursor: pointer; flex-shrink: 0; }
.avatar-preview { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.avatar-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ── Integration ─────────────────────────────────────────── */
.code-block {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  font-family: 'Courier New', monospace; font-size: .82rem;
  line-height: 1.7; color: var(--text2); overflow-x: auto;
  position: relative;
}
.copy-btn {
  position: absolute; top: 10px; right: 10px;
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  font-size: .75rem; font-weight: 600; color: var(--text2);
  transition: all var(--t); cursor: pointer;
}
.copy-btn:hover { color: var(--primary); border-color: var(--primary); }

/* ── Theme Toggle ────────────────────────────────────────── */
.theme-toggle {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text2); transition: all var(--t);
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-faded); }

/* ── Progress Bar ────────────────────────────────────────── */
.progress-bar { height: 6px; background: var(--border); border-radius: 100px; overflow: hidden; margin: 8px 0; }
.progress-fill { height: 100%; background: var(--grad); border-radius: 100px; transition: width .4s ease; }

/* ── Page-level utilities ────────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-title { font-size: 1.4rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: 4px; }
.page-sub { color: var(--text2); font-size: .9rem; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.text-muted { color: var(--text3); }
.text-2 { color: var(--text2); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Animations ──────────────────────────────────────────── */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slide-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slide-in-right { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes count-up { from { opacity: 0; } to { opacity: 1; } }

.anim-fade-up { animation: fade-up .5s ease both; }
.anim-fade-in { animation: fade-in .3s ease both; }
[data-delay="1"] { animation-delay: .1s; }
[data-delay="2"] { animation-delay: .2s; }
[data-delay="3"] { animation-delay: .3s; }
[data-delay="4"] { animation-delay: .4s; }
[data-delay="5"] { animation-delay: .5s; }

/* ── Toast Notification ──────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); font-size: .875rem; min-width: 280px;
  animation: slide-in-right .3s ease;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }
.toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.info .toast-icon { color: var(--primary); }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .land-nav { padding: 0 24px; }
  .features { padding: 60px 24px; }
  .how-it-works { padding: 60px 24px; }
  .cta-section { padding: 60px 24px; }
}
@media (max-width: 640px) {
  .land-nav-links { display: none; }
  .hero { padding: 100px 20px 60px; }
  .steps { flex-direction: column; gap: 32px; }
  .steps::before { display: none; }
  .dash-main { padding: 16px; }
  .dash-header { padding: 0 16px; }
}

/* ── Hide browser-native password reveal button ──────────── */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear { display: none; }
input[type="password"]::-webkit-credentials-auto-fill-button { visibility: hidden; }

/* ── Notification badge on bell ──────────────────────────── */
.nav-notif-wrap { position: relative; }
.nav-notif-badge {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--surface);
  pointer-events: none;
}
.sidebar.collapsed .nav-notif-badge { top: 3px; right: 3px; }

/* ── Sidebar user as clickable profile link ──────────────── */
.sidebar-user {
  cursor: pointer; transition: background var(--t), border-color var(--t);
  border: 1.5px solid transparent;
}
.sidebar-user:hover { background: var(--primary-faded); border-color: var(--primary-faded2); }
.sidebar-user.active { background: var(--primary-faded); border-color: var(--primary); }

/* ── Profile page avatar ─────────────────────────────────── */
.profile-avatar-circle {
  width: 88px; height: 88px; border-radius: 50%; flex-shrink: 0;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 800; color: white;
  position: relative;
}
.profile-avatar-circle img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  position: absolute; inset: 0;
}
.profile-cam-btn {
  position: absolute; bottom: 0; right: 0;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: background var(--t);
}
.profile-cam-btn:hover { background: var(--primary-h); }

/* ── Mobile Hamburger & Sidebar Overlay ──────────────────── */
.mobile-hamburger {
  display: none;
  position: fixed; top: 14px; left: 14px; z-index: 250;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1.5px solid var(--border);
  align-items: center; justify-content: center;
  color: var(--text); cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--t);
}
.mobile-hamburger:hover { border-color: var(--primary); color: var(--primary); }

.sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 199;
  background: rgba(0,0,0,.5);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ── Remove header now ───────────────────────────────────── */
.dash-header { display: none !important; }
.dash-main { padding-top: 20px; }

/* ── Prevent any grid/flex child from overflowing ────────── */
.stats-grid > *, .charts-grid > *, .charts-grid-3 > *,
.dash-quick-actions > *, .card, .chart-card { min-width: 0; }
.page-header { min-width: 0; overflow: hidden; }

/* ── Full responsive for all screen sizes ────────────────── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
  .dash-quick-actions { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  /* Show hamburger, hide sidebar by default */
  .mobile-hamburger { display: flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 200;
    transform: translateX(-100%);
    width: var(--sidebar-w) !important;
    transition: transform .3s ease;
    box-shadow: var(--shadow-lg);
  }
  /* On mobile: collapsed state just means closed, not icon-only */
  .sidebar.collapsed { width: var(--sidebar-w) !important; transform: translateX(-100%) !important; }
  .sidebar.mobile-open, .sidebar.collapsed.mobile-open { transform: translateX(0) !important; }

  /* Collapse btn becomes a close (X) button on mobile */
  .sidebar-collapse-btn { background: var(--surface3) !important; }
  /* Remove icon-only nav-label hide on mobile — sidebar is always full-width when open */
  .sidebar.collapsed .nav-label { opacity: 1; max-width: unset; }
  .sidebar.collapsed .sidebar-logo-text { opacity: 1; max-width: unset; }

  /* Content takes full width — clamp to viewport */
  .dash-content { margin-left: 0 !important; width: 100%; max-width: 100vw; }
  .dash-main { padding: 64px 16px 24px; width: 100%; max-width: 100%; box-sizing: border-box; }

  /* Auth page — single column */
  .auth-page { grid-template-columns: 1fr; min-height: 100vh; }
  .auth-left { display: none; }
  .auth-right { padding: 32px 20px; min-height: 100vh; justify-content: center; }
  .auth-card { max-width: 100%; }

  /* Tables scroll horizontally */
  .table-wrap { overflow-x: auto; }
  table { min-width: 560px; }

  /* Toolbar wraps */
  .table-toolbar { flex-wrap: wrap; gap: 8px; }
  .search-wrap { min-width: 100%; }

  /* KB API fields stack */
  .api-fields { flex-direction: column; }
  .api-actions { flex-wrap: wrap; }

  /* Charts single column */
  .charts-grid { grid-template-columns: 1fr; }

  /* Profile cards — single column */
  .profile-grid-2col { grid-template-columns: 1fr !important; }

  /* Page header */
  .page-header { margin-bottom: 16px; }
  .page-title { font-size: 1.2rem; }

  /* Modals full-width on mobile */
  .modal-backdrop { padding: 12px; align-items: flex-end; }
  .modal { max-height: 95vh; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }

  /* Cards */
  .card { padding: 18px; }
  .stat-card { padding: 16px; }
}

/* ── Dashboard Quick Actions ─────────────────────────────── */
.dash-quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.quick-action-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  cursor: pointer; text-align: center; transition: all var(--t);
  text-decoration: none; color: inherit;
}
.quick-action-card:hover { border-color: var(--primary); background: var(--primary-faded); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.quick-action-card:hover .qa-icon { background: var(--primary); color: white; }
.qa-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; transition: all var(--t); }
.qa-label { font-size: .8rem; font-weight: 600; color: var(--text2); }

/* ── Dashboard section title ─────────────────────────────── */
.dash-section-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text3); margin-bottom: 12px; margin-top: 4px; }

/* ── Charts 3-col layout ─────────────────────────────────── */
.charts-grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 24px; }
@media (max-width: 900px) { .charts-grid-3 { grid-template-columns: 1fr; } .dash-quick-actions { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .dash-quick-actions { grid-template-columns: repeat(2, 1fr); }
  .hero-cta { flex-direction: column; gap: 10px; align-items: center; }
  .land-nav-actions { gap: 6px; }
  .btn-lg { padding: 11px 20px; font-size: .9rem; }
  .features-grid { grid-template-columns: 1fr; }
  .how-grid { grid-template-columns: 1fr; }
  .hero { padding: 90px 16px 40px; }
  .hero-title { font-size: clamp(1.8rem, 8vw, 3rem); }
  .hero-sub { font-size: .9rem; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }

  /* Toast at bottom center on mobile */
  .toast-container { bottom: 16px; right: 12px; left: 12px; align-items: center; }
  .toast { min-width: unset; width: 100%; }

  /* Drop zone compact */
  .drop-zone { padding: 24px 16px; }

  /* Modal full screen */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 92vh; }
}

/* ═══════════════════════════════════════════════════════
   FEATURES SHOWCASE V2
   ═══════════════════════════════════════════════════════ */
.feat-showcase-section { padding: 100px 48px; }
.feat-showcase {
  display: grid; grid-template-columns: 1fr 1fr; gap: 32px;
  max-width: 1200px; margin: 60px auto 0; align-items: start;
}
.feat-tab-list { display: flex; flex-direction: column; gap: 4px; }
.feat-tab {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 18px; border-radius: var(--radius-lg);
  border: 1.5px solid transparent; background: none;
  cursor: pointer; text-align: left; color: inherit;
  transition: background var(--t), border-color var(--t);
  position: relative; overflow: hidden;
}
.feat-tab-progress {
  position: absolute; bottom: 0; left: 0; height: 2px;
  background: var(--grad); width: 0; transition: none;
}
.feat-tab.active .feat-tab-progress {
  width: 100%; transition: width 4s linear;
}
.feat-tab:hover { background: var(--surface2); }
.feat-tab.active {
  background: var(--primary-faded); border-color: var(--primary-faded2);
}
.feat-tab-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--surface3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--text2);
  transition: background var(--t), color var(--t), border-color var(--t);
}
.feat-tab.active .feat-tab-icon { background: var(--grad); color: white; border-color: transparent; }
.feat-tab-body { flex: 1; }
.feat-tab-title { font-size: .9rem; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.feat-tab-desc { font-size: .8rem; color: var(--text3); line-height: 1.5; }
.feat-tab.active .feat-tab-title { color: var(--primary); }

/* Panel container */
.feat-panel-wrap {
  position: sticky; top: 80px;
  border-radius: var(--radius-xl); overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  background: var(--surface2);
  min-height: 380px;
}
.feat-panel {
  display: none; flex-direction: column;
  height: 100%; width: 100%;
  animation: feat-panel-in .35s ease both;
}
.feat-panel.active { display: flex; }
@keyframes feat-panel-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Panel chrome */
.fp-header {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 16px; background: var(--surface3);
  border-bottom: 1px solid var(--border);
}
.fp-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.fp-dot.r { background: #ff5f57; }
.fp-dot.y { background: #ffbd2e; }
.fp-dot.g { background: #28ca42; }
.fp-title { font-size: .75rem; font-weight: 700; color: var(--text3); margin-left: 6px; letter-spacing: .04em; }
.fp-body { padding: 20px; flex: 1; display: flex; flex-direction: column; gap: 12px; }

/* KB panel */
.fp-upload-zone {
  border: 2px dashed var(--border2); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column;
  align-items: center; gap: 8px; color: var(--text3);
  font-size: .8rem;
}
.fp-upload-icon { color: var(--primary); }
.fp-upload-text { font-weight: 600; color: var(--text2); }
.fp-file-list { display: flex; flex-direction: column; gap: 8px; }
.fp-file-row { display: flex; align-items: center; gap: 10px; }
.fp-file-icon {
  font-size: .6rem; font-weight: 800; letter-spacing: .02em;
  background: var(--primary-faded); color: var(--primary);
  border-radius: 4px; padding: 3px 5px; flex-shrink: 0;
}
.fp-file-info { flex: 1; min-width: 0; }
.fp-file-name { font-size: .78rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-file-size { font-size: .7rem; color: var(--text3); }
.fp-file-bar { width: 56px; height: 4px; background: var(--border); border-radius: 100px; flex-shrink: 0; overflow: hidden; }
.fp-file-fill { height: 100%; background: var(--grad); border-radius: 100px; }
.fp-indexed-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: .75rem; font-weight: 600; color: var(--success);
  background: var(--success-faded); padding: 6px 12px; border-radius: 100px;
  align-self: flex-start; margin-top: 4px;
}

/* Search panel */
.fp-search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: .85rem; color: var(--text);
  box-shadow: 0 0 0 3px var(--primary-faded);
}
.fp-search-icon { font-size: 1.1rem; color: var(--text3); }
.fp-search-results { display: flex; flex-direction: column; gap: 8px; }
.fp-result {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
  transition: border-color var(--t);
}
.fp-result:hover { border-color: var(--primary-faded2); }
.fp-result-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.fp-result-title { font-size: .82rem; font-weight: 700; color: var(--text); }
.fp-result-score {
  font-size: .7rem; font-weight: 800;
  color: var(--primary); background: var(--primary-faded);
  padding: 2px 7px; border-radius: 100px;
}
.fp-result-snip { font-size: .75rem; color: var(--text3); line-height: 1.5; }

/* Chat panel */
.fp-chat-msgs { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.fp-msg {
  max-width: 85%; padding: 9px 13px; border-radius: 14px;
  font-size: .8rem; line-height: 1.55;
}
.fp-msg.user {
  background: var(--grad); color: white;
  align-self: flex-end; border-bottom-right-radius: 4px;
}
.fp-msg.ai {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); align-self: flex-start; border-bottom-left-radius: 4px;
}
.fp-typing-dots { display: flex; align-items: center; gap: 4px; padding: 12px 14px; }
.fp-typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text3); animation: fp-bounce .9s ease infinite;
}
.fp-typing-dots span:nth-child(2) { animation-delay: .15s; }
.fp-typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes fp-bounce { 0%,80%,100%{transform:translateY(0)} 40%{transform:translateY(-6px)} }
.fp-takeover-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--surface3);
  border-radius: var(--radius); font-size: .78rem;
}
.fp-ai-badge { display: flex; align-items: center; gap: 6px; color: var(--text2); font-weight: 600; }
.fp-takeover-btn {
  background: var(--grad); color: white; border: none;
  padding: 5px 14px; border-radius: 100px;
  font-size: .75rem; font-weight: 700; cursor: pointer;
  transition: opacity var(--t);
}
.fp-takeover-btn:hover { opacity: .85; }

/* Analytics panel */
.fp-stats-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.fp-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px; text-align: center;
}
.fp-stat-val { font-size: 1.15rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.fp-stat-label { font-size: .68rem; color: var(--text3); margin-top: 2px; }
.fp-stat-delta { font-size: .68rem; color: var(--success); font-weight: 700; margin-top: 2px; }
.fp-chart-area { flex: 1; display: flex; align-items: flex-end; padding: 8px 0 0; }
.fp-bars { display: flex; align-items: flex-end; gap: 3px; width: 100%; height: 100px; }
.fp-bar {
  flex: 1; border-radius: 3px 3px 0 0;
  background: var(--grad);
  transform-origin: bottom;
  animation: fp-bar-grow .6s ease both;
}
@keyframes fp-bar-grow { from { transform: scaleY(0); } }

/* Code panel */
.fp-code-label { font-size: .75rem; font-weight: 700; color: var(--text3); letter-spacing: .04em; text-transform: uppercase; }
.fp-code-block {
  background: #0D1117; border-radius: var(--radius); padding: 16px 18px;
  font-family: 'Courier New', monospace; font-size: .78rem; line-height: 2;
  border: 1px solid #30363d; flex: 1;
}
.fp-code-line { display: block; }
.fp-code-indent { padding-left: 16px; }
.fp-code-tag { color: #7ee787; }
.fp-code-attr { color: #79c0ff; }
.fp-code-str { color: #a5d6ff; }
.fp-live-badge {
  display: flex; align-items: center; gap: 10px;
  font-size: .8rem; font-weight: 700; color: var(--success);
  background: var(--success-faded); padding: 8px 16px;
  border-radius: 100px; align-self: flex-start;
}
.fp-pulse-ring {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--success); flex-shrink: 0;
  animation: fp-pulse 1.5s ease-in-out infinite;
}
@keyframes fp-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,.5); }
  50% { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}

/* Brand panel */
.fp-brand-row { display: flex; gap: 16px; align-items: flex-start; flex: 1; }
.fp-brand-preview {
  flex: 1; background: #f4f4f8; border-radius: var(--radius);
  overflow: hidden; min-height: 200px; border: 1px solid var(--border);
}
.fp-brand-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--primary); color: white;
  transition: background .3s ease;
}
.fp-brand-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.25); display: flex;
  align-items: center; justify-content: center;
  font-weight: 800; font-size: .9rem;
}
.fp-brand-name { font-size: .85rem; font-weight: 700; }
.fp-brand-msg {
  margin: 14px; padding: 10px 13px; background: white;
  border-radius: 12px; border-bottom-left-radius: 3px;
  font-size: .78rem; color: #333; box-shadow: 0 2px 8px rgba(0,0,0,.08);
  max-width: 80%;
}
.fp-brand-controls { flex: 1; display: flex; flex-direction: column; }
.fp-brand-label { font-size: .7rem; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.fp-brand-field {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px;
  font-size: .82rem; font-weight: 600; color: var(--text);
}
.fp-color-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.fp-swatch {
  width: 26px; height: 26px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
  transition: transform var(--t), border-color var(--t);
}
.fp-swatch:hover { transform: scale(1.15); }
.fp-swatch.active { border-color: var(--text); transform: scale(1.15); }

/* Typing animation for search — clip-path avoids layout reflow */
.fp-typing {
  white-space: nowrap;
  animation: fp-type 2.5s steps(28,end) both infinite;
}
@keyframes fp-type {
  0%,100% { clip-path: inset(0 100% 0 0); }
  20%,80% { clip-path: inset(0 0% 0 0); }
}

/* Responsive */
@media (max-width: 900px) {
  .feat-showcase { grid-template-columns: 1fr; }
  .feat-panel-wrap { position: static; min-height: 320px; }
  .feat-showcase-section { padding: 60px 24px; }
}
@media (max-width: 640px) {
  .feat-showcase-section { padding: 50px 16px; }
  .fp-stats-row { grid-template-columns: 1fr; }
  .fp-brand-row { flex-direction: column; }
}

/* ═══════════════════════════════════════════════════════
   HOW IT WORKS V2 — Animated Pipeline
   ═══════════════════════════════════════════════════════ */
.hiw-section { padding: 100px 48px; position: relative; }
/* ── Neural pipeline graphic (live, self-running) ── */
.np { max-width: 1060px; margin: 52px auto 0; }
.np-stage { display: flex; align-items: center; gap: 6px; }
.np-diagram { flex: 1 1 auto; min-width: 0; width: 100%; height: auto; display: block; overflow: visible; font-family: inherit; }

.np-card { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; }
.np-card-title { fill: var(--text); font-weight: 800; font-size: 14px; }
.np-card-sub { fill: var(--text3); font-weight: 500; font-size: 10.5px; }
.np-glyph { font-weight: 800; font-size: 15px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.np-link { stroke: url(#npFlow); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 7 9; opacity: .6; animation: npFlow 1s linear infinite; }
.np-link-out { opacity: .85; }
@keyframes npFlow { to { stroke-dashoffset: -16; } }

.np-dot { filter: drop-shadow(0 0 5px rgba(0,194,203,.85)); }

.np-ring { fill: none; stroke: #5B47F0; stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.np-ring-1 { animation: npPulse 3s ease-out infinite; }
.np-ring-2 { animation: npPulse 3s ease-out infinite 1.2s; }
@keyframes npPulse { 0% { transform: scale(.7); opacity: .55; } 100% { transform: scale(1.2); opacity: 0; } }
.np-orbit { fill: none; stroke: url(#npFlow); stroke-width: 1.5; stroke-dasharray: 3 11; opacity: .55; transform-box: fill-box; transform-origin: center; animation: npSpin 16s linear infinite; }
@keyframes npSpin { to { transform: rotate(360deg); } }

.np-core-wrap { transform-box: fill-box; transform-origin: center; animation: npBob 5s ease-in-out infinite; }
@keyframes npBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.np-node { animation: npTwinkle 2.2s ease-in-out infinite; }
.np-node-2 { animation-delay: .5s; }
.np-node-3 { animation-delay: 1s; }
@keyframes npTwinkle { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.np-brain-label { fill: var(--text2); font-weight: 700; font-size: 13px; text-anchor: middle; }

/* Live chatbot preview (mirrors the real widget) */
.np-chatcard {
  flex: 0 0 296px; width: 296px; align-self: center;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: 0 22px 54px rgba(15,23,42,.16), 0 4px 14px rgba(15,23,42,.06);
  overflow: hidden;
}
.npc-head { display: flex; align-items: center; gap: 10px; padding: 13px 15px; background: var(--grad); color: #fff; }
.npc-ava {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: rgba(255,255,255,.18); border: 1.5px solid rgba(255,255,255,.35);
  display: flex; align-items: center; justify-content: center;
}
.npc-name { font-size: .9rem; font-weight: 700; line-height: 1.1; }
.npc-status { font-size: .72rem; opacity: .92; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.npc-live { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; animation: npcLive 2s ease infinite; }
@keyframes npcLive { 0% { box-shadow: 0 0 0 0 rgba(74,222,128,.6); } 70% { box-shadow: 0 0 0 6px rgba(74,222,128,0); } 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); } }
.npc-body { padding: 15px 13px; background: var(--surface2); display: flex; flex-direction: column; gap: 9px; min-height: 148px; flex: 1 1 auto; }
.npc-row { display: flex; }
.npc-row-user { justify-content: flex-end; }
.npc-row-bot { justify-content: flex-start; }
.npc-bubble { max-width: 84%; padding: 9px 13px; border-radius: 14px; font-size: .84rem; line-height: 1.45; }
.npc-user { background: var(--grad); color: #fff; border-bottom-right-radius: 5px; box-shadow: 0 3px 10px rgba(var(--primary-rgb), .3); }
.npc-bot { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.npc-typing { display: inline-flex; gap: 4px; align-items: center; padding: 3px 2px; }
.npc-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text3); display: inline-block; animation: npcBounce 1.4s ease infinite; }
.npc-typing i:nth-child(2) { animation-delay: .2s; }
.npc-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes npcBounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }
.np-hidden { display: none; }
.npc-pop { animation: npcPop .34s cubic-bezier(.2,.8,.2,1); }
@keyframes npcPop { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

.np-caps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; max-width: 900px; margin: 44px auto 0; }
.np-cap { text-align: left; padding-left: 16px; border-left: 2px solid var(--border); }
.np-cap-num { font-size: .72rem; font-weight: 800; letter-spacing: .1em; color: var(--primary); }
.np-cap b { display: block; font-size: 1rem; font-weight: 800; color: var(--text); margin: 5px 0 6px; }
.np-cap p { font-size: .85rem; color: var(--text2); line-height: 1.6; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .np-link, .np-ring, .np-orbit, .np-core-wrap, .np-node, .npc-typing i, .npc-live { animation: none; }
  .np-ring { opacity: .22; }
}
@media (max-width: 860px) {
  .np-stage { flex-direction: column; gap: 28px; }
  .np-chatcard { flex-basis: auto; width: 100%; max-width: 320px; }
}
@media (max-width: 768px) {
  .hiw-section { padding: 60px 24px; }
}
@media (max-width: 640px) {
  .hiw-section { padding: 50px 16px; }
  .np-caps { grid-template-columns: 1fr; gap: 16px; }
}
