/* =====================================
   AI DEMO SECTION / PREMIUM PRODUCT SHELL
===================================== */

#ai-demo.ai-demo-section {
  --ai-bg: #faf8ff;
  --ai-bg-soft: #f5f0fb;
  --ai-panel: rgba(255, 255, 255, 0.90);
  --ai-panel-soft: #f7f2ff;
  --ai-line: rgba(111, 31, 229, 0.12);
  --ai-line-soft: rgba(111, 31, 229, 0.08);

  --ai-text: #2a0146;
  --ai-text-strong: #160038;
  --ai-muted: #6e7890;
  --ai-title: #160038;
  --ai-white: #ffffff;

  --ai-accent: #6f1fe5;
  --ai-accent-strong: #5a13c7;
  --ai-accent-soft: rgba(111, 31, 229, 0.08);
  --ai-pink: #ff0d96;

  --ai-chip-bg: #f6f1ff;
  --ai-chip-hover: #eee6ff;

  --ai-user: linear-gradient(135deg, #6f1fe5 0%, #5a13c7 100%);
  --ai-user-text: #ffffff;

  --ai-assistant: linear-gradient(180deg, #ffffff 0%, #fbf8ff 100%);
  --ai-assistant-text: #33445d;

  --ai-action-bg: #f7f2ff;
  --ai-action-hover: #efe6ff;

  --ai-shadow:
    0 28px 70px rgba(42, 1, 70, 0.14),
    0 10px 24px rgba(42, 1, 70, 0.06);

  position: relative;
  padding: 68px 0 24px;
  background:
    radial-gradient(circle at 12% 0%, rgba(123, 35, 236, 0.06), transparent 18%),
    radial-gradient(circle at 84% 16%, rgba(255, 13, 150, 0.06), transparent 18%),
    linear-gradient(180deg, #fbf9ff 0%, #f6f4fb 42%, #ffffff 100%);
}

#ai-demo .ai-demo-wrap {
  width: min(100%, 1860px);
  margin: 0 auto;
}

#ai-demo .ai-demo-section-head {
  max-width: 1860px;
  margin: 0 auto 22px;
  text-align: center;
}

#ai-demo .ai-demo-section-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: #6f1fe5;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#ai-demo .ai-demo-section-title {
  margin: 0;
  color: var(--ai-title);
  font-size: clamp(2rem, 3.1vw, 3rem);
  line-height: 1.03;
  letter-spacing: -0.045em;
  font-weight: 780;
  text-wrap: balance;
}

#ai-demo .ai-demo-section-intro {
  margin: 14px auto 0;
  max-width: 68ch;
  color: var(--ai-muted);
  font-size: 1rem;
  line-height: 1.76;
}

#ai-demo .ai-demo-stage {
  position: relative;
  width: min(100%, 1700px);
  margin: 0 auto;
  padding: 18px;
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(111, 31, 229, 0.06) 0%, rgba(255, 13, 150, 0.03) 100%);
}

#ai-demo .ai-demo-stage-glow {
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  filter: blur(54px);
  pointer-events: none;
  opacity: 0.42;
}

#ai-demo .ai-demo-stage-glow-left {
  left: -40px;
  top: 90px;
  background: rgba(111, 31, 229, 0.14);
}

#ai-demo .ai-demo-stage-glow-right {
  right: -30px;
  top: 18px;
  background: rgba(255, 13, 150, 0.11);
}

#ai-demo .ai-demo-inner {
  position: relative;
  display: grid;
  gap: 1rem;
  width: 100%;
  margin: 0 auto;
  padding: 1.35rem;
  border: 1px solid var(--ai-line);
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(123, 35, 236, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(250, 248, 255, 0.98)),
    var(--ai-bg);
  box-shadow: var(--ai-shadow);
  overflow: hidden;
}

#ai-demo .ai-demo-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.48), transparent 34%, transparent 70%, rgba(255, 13, 150, 0.03));
}

#ai-demo .ai-demo-inner > * {
  position: relative;
  z-index: 1;
}

/* window chrome */

#ai-demo .ai-demo-windowbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 50px;
  padding: 0 6px 6px;
  border-bottom: 1px solid rgba(111, 31, 229, 0.08);
}

#ai-demo .ai-demo-windowdots {
  display: inline-flex;
  gap: 7px;
}

#ai-demo .ai-demo-windowdots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(111, 31, 229, 0.18);
}

#ai-demo .ai-demo-windowdots span:nth-child(1) {
  background: rgba(255, 13, 150, 0.42);
}

#ai-demo .ai-demo-windowdots span:nth-child(2) {
  background: rgba(111, 31, 229, 0.32);
}

#ai-demo .ai-demo-windowdots span:nth-child(3) {
  background: rgba(90, 19, 199, 0.22);
}

#ai-demo .ai-demo-windowtitle {
  color: #5f6f84;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

#ai-demo .ai-demo-windowmeta {
  display: flex;
  justify-content: flex-end;
}

#ai-demo .ai-demo-windowbadge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(111, 31, 229, 0.08), rgba(255, 13, 150, 0.08));
  border: 1px solid rgba(111, 31, 229, 0.12);
  color: #4f0fb8;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* topbar */

#ai-demo .ai-demo-topbar {
  display: grid;
  gap: 0.9rem;
}

#ai-demo .ai-demo-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

#ai-demo .ai-demo-status-note {
  color: var(--ai-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

#ai-demo [data-ai-demo-status] {
  display: inline-flex;
  align-items: center;
  gap: 0.54rem;
  width: fit-content;
  max-width: 100%;
  min-height: 38px;
  padding: 0 0.92rem;
  border: 1px solid var(--ai-line-soft);
  border-radius: 999px;
  background: #ffffff;
  color: #5a13c7;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(42, 1, 70, 0.05);
}

#ai-demo [data-ai-demo-status]::before {
  content: "";
  width: 0.56rem;
  height: 0.56rem;
  border-radius: 50%;
  flex: 0 0 auto;
}

#ai-demo [data-status="local"]::before {
  background: #8eb7a3;
  box-shadow: 0 0 0 5px rgba(142, 183, 163, 0.14);
}

#ai-demo [data-status="openrouter"]::before {
  background: #7b23ec;
  box-shadow: 0 0 0 5px rgba(123, 35, 236, 0.14);
}

#ai-demo [data-status="openai"]::before {
  background: #6f1fe5;
  box-shadow: 0 0 0 5px rgba(111, 31, 229, 0.14);
}

#ai-demo [data-status="error"]::before {
  background: #cf8d8d;
  box-shadow: 0 0 0 5px rgba(207, 141, 141, 0.14);
}

#ai-demo .ai-demo-tools {
  display: flex;
  justify-content: flex-start;
}

#ai-demo .ai-demo-toggle {
  appearance: none;
  border: 1px solid rgba(111, 31, 229, 0.14);
  border-radius: 999px;
  background: var(--ai-chip-bg);
  color: #4f0fb8;
  padding: 0.68rem 1rem;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

#ai-demo .ai-demo-toggle:hover,
#ai-demo .ai-demo-toggle:focus-visible {
  background: var(--ai-chip-hover);
  border-color: rgba(111, 31, 229, 0.20);
  color: #2a0146;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(90, 19, 199, 0.08);
  outline: none;
}

/* chips */

#ai-demo [data-ai-demo-chips] {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

#ai-demo .ai-demo-chip {
  appearance: none;
  border: 1px solid rgba(111, 31, 229, 0.12);
  border-radius: 999px;
  background: var(--ai-chip-bg);
  color: #5f6f84;
  padding: 0.7rem 0.96rem;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

#ai-demo .ai-demo-chip:hover,
#ai-demo .ai-demo-chip:focus-visible {
  background: var(--ai-chip-hover);
  border-color: rgba(111, 31, 229, 0.18);
  color: #2a0146;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(90, 19, 199, 0.08);
  outline: none;
}

/* conversation shell */

#ai-demo .ai-demo-shell {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid var(--ai-line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(250, 248, 255, 0.88));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.65),
    0 8px 18px rgba(42, 1, 70, 0.04);
}

#ai-demo [data-ai-demo-messages] {
  display: grid;
  gap: 0.8rem;
  min-height: 300px;
  max-height: 410px;
  overflow-y: auto;
  padding-right: 0.2rem;
  scroll-behavior: smooth;
}

#ai-demo [data-ai-demo-messages]::-webkit-scrollbar {
  width: 8px;
}

#ai-demo [data-ai-demo-messages]::-webkit-scrollbar-track {
  background: transparent;
}

#ai-demo [data-ai-demo-messages]::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(111, 31, 229, 0.22);
}

#ai-demo .ai-demo-message {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-width: 72%;
}

#ai-demo .ai-demo-message--assistant {
  align-self: flex-start;
}

#ai-demo .ai-demo-message--user {
  align-self: flex-end;
}

#ai-demo .ai-demo-bubble {
  position: relative;
  padding: 0.88rem 0.96rem;
  border-radius: 18px;
  font-size: 0.93rem;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
  border: 1px solid transparent;
}

#ai-demo .ai-demo-message--assistant .ai-demo-bubble {
  background: var(--ai-assistant);
  color: var(--ai-assistant-text);
  border-color: rgba(111, 31, 229, 0.10);
  border-top-left-radius: 10px;
  box-shadow: 0 6px 14px rgba(42, 1, 70, 0.04);
}

#ai-demo .ai-demo-message--user .ai-demo-bubble {
  background: var(--ai-user);
  color: var(--ai-user-text);
  border-color: transparent;
  border-top-right-radius: 10px;
  box-shadow: 0 12px 24px rgba(90, 19, 199, 0.16);
}

#ai-demo .ai-demo-message--typing .ai-demo-bubble {
  color: #6d7c92;
  font-style: italic;
}

#ai-demo .ai-demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

#ai-demo .ai-demo-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0.58rem 0.84rem;
  border: 1px solid rgba(111, 31, 229, 0.12);
  border-radius: 999px;
  background: var(--ai-action-bg);
  color: #4f0fb8;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease,
    color 0.2s ease;
}

#ai-demo .ai-demo-action:hover,
#ai-demo .ai-demo-action:focus-visible {
  background: var(--ai-action-hover);
  border-color: rgba(111, 31, 229, 0.18);
  color: #2a0146;
  transform: translateY(-1px);
  outline: none;
}

/* form */

#ai-demo [data-ai-demo-form] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.72rem;
  align-items: center;
}

#ai-demo [data-ai-demo-input] {
  width: 100%;
  min-width: 0;
  min-height: 3.1rem;
  padding: 0 1rem;
  border: 1px solid rgba(111, 31, 229, 0.12);
  border-radius: 16px;
  background: #ffffff;
  color: var(--ai-text);
  font: inherit;
  font-size: 0.93rem;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}

#ai-demo [data-ai-demo-input]::placeholder {
  color: #8a98ae;
}

#ai-demo [data-ai-demo-input]:focus {
  outline: none;
  border-color: rgba(111, 31, 229, 0.26);
  box-shadow: 0 0 0 4px rgba(111, 31, 229, 0.10);
  background: #ffffff;
}

#ai-demo [data-ai-demo-send] {
  appearance: none;
  min-height: 3.1rem;
  padding: 0 1.08rem;
  border: 1px solid transparent;
  border-radius: 16px;
  background: linear-gradient(135deg, #6f1fe5 0%, #5a13c7 100%);
  color: #ffffff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background-color 0.2s ease;
  box-shadow: 0 10px 22px rgba(90, 19, 199, 0.18);
}

#ai-demo [data-ai-demo-send]:hover,
#ai-demo [data-ai-demo-send]:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(90, 19, 199, 0.22);
  outline: none;
}

#ai-demo [data-ai-demo-send]:disabled,
#ai-demo [data-ai-demo-input]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* trust row */

#ai-demo .ai-demo-trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

#ai-demo .ai-demo-trust-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(111, 31, 229, 0.10);
  background: rgba(255, 255, 255, 0.7);
  color: #5f6f84;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
}

/* footnote */

#ai-demo .ai-demo-footnote {
  color: var(--ai-muted);
  font-size: 0.8rem;
  line-height: 1.58;
}

#ai-demo .ai-demo-footnote a {
  color: #5a13c7;
  text-decoration: none;
}

#ai-demo .ai-demo-footnote a:hover,
#ai-demo .ai-demo-footnote a:focus-visible {
  text-decoration: underline;
  outline: none;
}

#ai-demo .is-hidden {
  display: none;
}

#ai-demo .ai-demo-bubble--typing {
  display: inline-flex;
  align-items: center;
  min-width: 4rem;
}

#ai-demo .ai-demo-typing {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  min-height: 1rem;
}

#ai-demo .ai-demo-typing span {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: rgba(111, 31, 229, 0.45);
  opacity: 0.45;
  animation: aiDemoTypingBounce 1.1s infinite ease-in-out;
}

#ai-demo .ai-demo-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

#ai-demo .ai-demo-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes aiDemoTypingBounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* =====================================
   ACCESSIBILITY
===================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =====================================
   RESPONSIVE
===================================== */

@media (max-width: 860px) {
  #ai-demo.ai-demo-section {
    padding: 52px 0 14px;
  }

  #ai-demo .ai-demo-wrap {
    width: 100%;
  }

  #ai-demo .ai-demo-stage {
    padding: 10px;
    border-radius: 22px;
  }

  #ai-demo .ai-demo-inner {
    width: 100%;
    padding: 1.05rem;
    border-radius: 20px;
  }

  #ai-demo .ai-demo-windowbar {
    grid-template-columns: auto 1fr;
  }

  #ai-demo .ai-demo-windowmeta {
    display: none;
  }

  #ai-demo .ai-demo-shell {
    padding: 0.8rem;
    border-radius: 18px;
  }

  #ai-demo [data-ai-demo-messages] {
    min-height: 250px;
    max-height: 360px;
  }

  #ai-demo .ai-demo-message {
    max-width: 86%;
  }

  #ai-demo [data-ai-demo-form] {
    grid-template-columns: 1fr;
  }

  #ai-demo [data-ai-demo-send] {
    width: 100%;
  }
}

@media (max-width: 560px) {
  #ai-demo.ai-demo-section {
    padding: 44px 0 12px;
  }

  #ai-demo .ai-demo-section-title {
    font-size: 1.55rem;
  }

  #ai-demo .ai-demo-section-intro {
    font-size: 0.92rem;
  }

  #ai-demo .ai-demo-stage {
    padding: 0;
    background: transparent;
  }

  #ai-demo .ai-demo-inner {
    padding: 0.92rem;
    border-radius: 16px;
  }

  #ai-demo [data-ai-demo-chips] {
    gap: 0.55rem;
  }

  #ai-demo .ai-demo-chip {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  #ai-demo [data-ai-demo-messages] {
    min-height: 220px;
    max-height: 320px;
  }

  #ai-demo .ai-demo-bubble {
    padding: 0.76rem 0.82rem;
    font-size: 0.89rem;
  }

  #ai-demo .ai-demo-actions {
    gap: 0.5rem;
  }

  #ai-demo .ai-demo-action,
  #ai-demo .ai-demo-trust-pill {
    width: 100%;
    justify-content: center;
  }

  #ai-demo .ai-demo-status-row {
    align-items: flex-start;
  }
}

/* ================= KNOWLEDGE ACCESS ================= */

.ai-knowledge-grid {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.ai-knowledge-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ai-knowledge-card {
  padding: 22px;
  border: 1px solid rgba(111, 31, 229, 0.10);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  box-shadow: 0 10px 26px rgba(42, 1, 70, 0.05);
}

.ai-knowledge-tag {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(111, 31, 229, 0.08);
  color: #5a13c7;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ai-knowledge-card h3 {
  margin: 0 0 10px;
  font-size: 1.08rem;
  line-height: 1.35;
  color: #160038;
}

.ai-knowledge-card p {
  margin: 0;
  color: #667187;
  line-height: 1.7;
}

.ai-knowledge-layers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.ai-knowledge-layer {
  padding: 22px;
  border: 1px solid rgba(111, 31, 229, 0.10);
  border-radius: 18px;
  background: linear-gradient(180deg, #faf7ff 0%, #f5f0fb 100%);
  box-shadow: 0 8px 22px rgba(42, 1, 70, 0.04);
}

.ai-knowledge-layer h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: #160038;
}

.ai-knowledge-layer ul {
  margin: 0;
  padding-left: 18px;
}

.ai-knowledge-layer li {
  margin-bottom: 8px;
  color: #667187;
  line-height: 1.6;
}

.ai-knowledge-note {
  margin-top: 20px;
  padding: 18px 20px;
  border-left: 4px solid #6f1fe5;
  background: linear-gradient(135deg, #faf7ff 0%, #f4ecff 100%);
  border-radius: 12px;
}

.ai-knowledge-note p {
  margin: 0;
  color: #5f6f84;
  line-height: 1.7;
}

.ai-knowledge-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

@media (max-width: 1100px) {
  .ai-knowledge-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .ai-knowledge-grid-4,
  .ai-knowledge-layers {
    grid-template-columns: 1fr;
  }

  .ai-knowledge-card,
  .ai-knowledge-layer {
    padding: 18px;
  }
}

/* ================= OPERATIONAL FLOW STACK ================= */

.ai-flow-stack {
  margin-top: 26px;
  border: 1px solid #dbe5f1;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(18, 40, 70, 0.04);
  overflow: hidden;
}

.ai-flow-stack-toggle {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  cursor: pointer;
  user-select: none;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f8ff 100%);
}

.ai-flow-stack-toggle::-webkit-details-marker {
  display: none;
}

.ai-flow-stack-toggle-text {
  font-size: 1rem;
  font-weight: 700;
  color: #17324d;
}

.ai-flow-stack-toggle-icon {
  font-size: 1.1rem;
  color: #2f6fed;
  transition: transform 0.22s ease;
}

.ai-flow-stack[open] .ai-flow-stack-toggle-icon {
  transform: rotate(180deg);
}

.ai-flow-stack-panel {
  position: relative;
  padding: 24px 22px 22px;
  border-top: 1px solid #dbe5f1;
}

.ai-flow-stack-line {
  position: absolute;
  left: 40px;
  top: 24px;
  bottom: 120px;
  width: 2px;
  background: linear-gradient(180deg, #d8e5f5 0%, #c7d9ef 100%);
  border-radius: 999px;
}

.ai-flow-stack-step {
  position: relative;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 18px;
  align-items: start;
}

.ai-flow-stack-step + .ai-flow-stack-step {
  margin-top: 18px;
}

.ai-flow-stack-marker {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  background: #ffffff;
  border: 2px solid #d9e5f4;
  color: #17324d;
  box-shadow: 0 6px 16px rgba(18, 40, 70, 0.05);
}

.ai-flow-stack-card {
  padding: 20px 20px 18px;
  border: 1px solid #dbe5f1;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(18, 40, 70, 0.04);
}

.ai-flow-stack-tag {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.step-1 .ai-flow-stack-tag {
  background: #eef4ff;
  color: #2f6fed;
}
.step-2 .ai-flow-stack-tag {
  background: #eefcf4;
  color: #159947;
}
.step-3 .ai-flow-stack-tag {
  background: #f7f0ff;
  color: #8e44ad;
}
.step-4 .ai-flow-stack-tag {
  background: #fff4e8;
  color: #d97706;
}

.step-1 .ai-flow-stack-marker {
  border-color: #b9d1ff;
  color: #2f6fed;
}
.step-2 .ai-flow-stack-marker {
  border-color: #bfe7cf;
  color: #159947;
}
.step-3 .ai-flow-stack-marker {
  border-color: #d9c3f2;
  color: #8e44ad;
}
.step-4 .ai-flow-stack-marker {
  border-color: #ffd6b0;
  color: #d97706;
}

.ai-flow-stack-card h3 {
  margin: 0 0 10px;
  font-size: 1.04rem;
  line-height: 1.35;
  color: #17324d;
}

.ai-flow-stack-card p {
  margin: 0;
  color: #5f7387;
  line-height: 1.68;
}

.ai-flow-stack-note {
  margin-top: 22px;
  margin-left: 54px;
  padding: 18px 20px;
  border-left: 4px solid #2f6fed;
  background: #f5f9ff;
  border-radius: 12px;
}

.ai-flow-stack-note h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #17324d;
}

.ai-flow-stack-note p {
  margin: 0;
  color: #486176;
  line-height: 1.68;
}

@media (max-width: 760px) {
  .ai-flow-stack-toggle {
    padding: 16px 18px;
  }

  .ai-flow-stack-panel {
    padding: 18px 16px 18px;
  }

  .ai-flow-stack-line {
    left: 34px;
    top: 18px;
    bottom: 112px;
  }

  .ai-flow-stack-step {
    grid-template-columns: 30px 1fr;
    gap: 14px;
  }

  .ai-flow-stack-marker {
    width: 30px;
    height: 30px;
    font-size: 0.72rem;
  }

  .ai-flow-stack-card {
    padding: 16px;
  }

  .ai-flow-stack-note {
    margin-left: 44px;
    padding: 16px;
  }
}

/* =========================================================
   IMPORTANT SCOPE & USAGE POPUP V6
   Premium notice modal — AI page purple/lavender glass theme
========================================================= */

/* ================= INLINE HELP LINK ================= */

.ai-help-inline {
  margin-top: 14px;
}

.ai-help-inline-center {
  text-align: center;
}

.ai-help-link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;

  color: #5a13c7;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;

  cursor: pointer;
  opacity: 1;

  font-weight: 800;

  transition:
    color 0.2s ease,
    opacity 0.2s ease,
    text-decoration-color 0.2s ease;
}

.ai-help-link:hover,
.ai-help-link:focus-visible {
  color: #160038;
  text-decoration-color: #ff0d96;
  outline: none;
}

/* ================= POPUP ROOT ================= */

.ai-help-popup {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
}

.ai-help-popup.is-open {
  display: block;
}

/* ================= OVERLAY ================= */

.ai-help-popup-overlay {
  position: absolute;
  inset: 0;

  background:
    radial-gradient(circle at 18% 0%, rgba(111, 31, 229, 0.26), transparent 34%),
    radial-gradient(circle at 86% 18%, rgba(255, 13, 150, 0.18), transparent 32%),
    rgba(22, 0, 56, 0.58);

  backdrop-filter: blur(9px) saturate(125%);
  -webkit-backdrop-filter: blur(9px) saturate(125%);

  opacity: 0;
  transition: opacity 0.28s ease;
}

/* ================= PANEL ================= */

.ai-help-popup-panel {
  position: relative;

  width: min(960px, calc(100% - 28px));
  max-height: calc(100vh - 40px);
  margin: 20px auto;

  color: #160038;

  border-radius: 30px;
  overflow: hidden;

  background:
    radial-gradient(circle at 14% 0%, rgba(111, 31, 229, 0.13), transparent 36%),
    radial-gradient(circle at 92% 8%, rgba(255, 13, 150, 0.10), transparent 32%),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.96) 0%,
      rgba(251, 249, 255, 0.95) 48%,
      rgba(247, 242, 255, 0.94) 100%
    );

  border: 1px solid rgba(111, 31, 229, 0.18);

  box-shadow:
    0 36px 110px rgba(42, 1, 70, 0.34),
    0 18px 42px rgba(90, 19, 199, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.84);

  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);

  opacity: 0;
  transform: translateY(18px) scale(0.985);

  transition:
    opacity 0.28s ease,
    transform 0.28s ease;
}

.ai-help-popup.is-visible .ai-help-popup-overlay {
  opacity: 1;
}

.ai-help-popup.is-visible .ai-help-popup-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ================= CONTENT ================= */

.ai-help-popup-content {
  padding: 34px 32px 30px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(111, 31, 229, 0.42) rgba(42, 1, 70, 0.08);
}

.ai-help-popup-content::-webkit-scrollbar {
  width: 10px;
}

.ai-help-popup-content::-webkit-scrollbar-track {
  background: rgba(42, 1, 70, 0.06);
}

.ai-help-popup-content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(111, 31, 229, 0.52), rgba(255, 13, 150, 0.42));
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.82);
}

/* ================= CLOSE BUTTON ================= */

.ai-help-popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;

  width: 44px;
  height: 44px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(111, 31, 229, 0.16);
  border-radius: 50%;

  background: rgba(255, 255, 255, 0.78);
  color: #4f0fb8;

  font-size: 28px;
  line-height: 1;
  cursor: pointer;

  box-shadow:
    0 10px 24px rgba(90, 19, 199, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);

  transition:
    background 0.2s ease,
    transform 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.ai-help-popup-close:hover,
.ai-help-popup-close:focus-visible {
  background: rgba(247, 242, 255, 0.96);
  border-color: rgba(111, 31, 229, 0.34);
  color: #160038;
  transform: scale(1.03);
  box-shadow:
    0 14px 30px rgba(90, 19, 199, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.80);
  outline: none;
}

/* ================= HEADER TEXT ================= */

.ai-help-popup-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  margin: 0 0 12px;
  padding: 7px 11px;

  border-radius: 999px;
  background: rgba(111, 31, 229, 0.08);
  border: 1px solid rgba(111, 31, 229, 0.14);
  box-shadow: 0 10px 24px rgba(90, 19, 199, 0.04);

  color: #5a13c7;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ai-help-popup-kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff0d96;
  box-shadow:
    0 0 14px rgba(255, 13, 150, 0.64),
    0 0 22px rgba(111, 31, 229, 0.20);
}

.ai-help-popup h3 {
  margin: 0 52px 14px 0;
  max-width: 820px;

  color: #160038;
  font-size: clamp(1.65rem, 2.4vw, 2.45rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
  font-weight: 900;
  text-wrap: balance;
}

.ai-help-popup-intro {
  margin: 0 0 22px;
  max-width: 820px;

  color: #4c5872;
  font-size: 1rem;
  line-height: 1.72;
}

/* ================= NOTICE SECTIONS ================= */

.ai-help-popup-section {
  position: relative;

  padding: 20px 20px 19px;
  border-radius: 22px;

  background:
    radial-gradient(circle at 96% 0%, rgba(255, 13, 150, 0.045), transparent 32%),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.78) 0%,
      rgba(247, 242, 255, 0.66) 100%
    );

  border: 1px solid rgba(111, 31, 229, 0.12);

  box-shadow:
    0 14px 34px rgba(90, 19, 199, 0.055),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.ai-help-popup-section + .ai-help-popup-section {
  margin-top: 14px;
}

.ai-help-popup-section::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20px;
  bottom: 20px;

  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #6f1fe5 0%, #ff0d96 100%);
  box-shadow: 0 10px 22px rgba(90, 19, 199, 0.16);
}

.ai-help-popup-section h4 {
  margin: 0 0 10px;
  padding-left: 2px;

  color: #2a0146;
  font-size: 1.04rem;
  line-height: 1.3;
  font-weight: 900;
  letter-spacing: -0.015em;
}

.ai-help-popup-section p {
  margin: 0 0 12px;
  color: #4c5872;
  font-size: 0.95rem;
  line-height: 1.68;
}

.ai-help-popup-section p:last-child {
  margin-bottom: 0;
}

.ai-help-popup-section ul {
  margin: 0;
  padding: 0;
  list-style: none;

  display: grid;
  gap: 8px;
}

.ai-help-popup-section li {
  position: relative;

  margin: 0;
  padding-left: 22px;

  color: #4c5872;
  font-size: 0.95rem;
  line-height: 1.6;
}

.ai-help-popup-section li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.58em;

  width: 8px;
  height: 8px;
  border-radius: 50%;

  background: #6f1fe5;
  box-shadow: 0 0 0 4px rgba(111, 31, 229, 0.10);
}

/* ================= LINKS INSIDE POPUP ================= */

.ai-help-popup a {
  color: #5a13c7;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1.4px;

  transition:
    color 0.2s ease,
    text-decoration-color 0.2s ease;
}

.ai-help-popup a:hover,
.ai-help-popup a:focus-visible {
  color: #160038;
  text-decoration-color: #ff0d96;
  outline: none;
}

/* ================= ACTIONS ================= */

.ai-help-popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;

  margin-top: 20px;
  padding-top: 20px;

  border-top: 1px solid rgba(111, 31, 229, 0.12);
}

.ai-help-popup-actions .btn,
.ai-help-popup-actions a,
.ai-help-popup-actions button {
  min-height: 48px;
  border-radius: 999px;
  font-weight: 850;
}

/* Optional: makes plain action buttons match AI theme */
.ai-help-popup-actions button,
.ai-help-popup-actions .btn {
  border: 1px solid transparent;
  background: linear-gradient(135deg, #6f1fe5 0%, #5a13c7 100%);
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(90, 19, 199, 0.22);
  cursor: pointer;

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.ai-help-popup-actions button:hover,
.ai-help-popup-actions button:focus-visible,
.ai-help-popup-actions .btn:hover,
.ai-help-popup-actions .btn:focus-visible {
  background: linear-gradient(135deg, #7b23ec 0%, #5a13c7 100%);
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(90, 19, 199, 0.26);
  outline: none;
}

/* If action links are used as secondary links */
.ai-help-popup-actions a:not(.btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 18px;
  min-height: 48px;

  border-radius: 999px;
  border: 1px solid rgba(111, 31, 229, 0.14);
  background: rgba(255, 255, 255, 0.78);

  color: #4f0fb8;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(90, 19, 199, 0.06);

  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.ai-help-popup-actions a:not(.btn):hover,
.ai-help-popup-actions a:not(.btn):focus-visible {
  background: #ffffff;
  border-color: rgba(111, 31, 229, 0.24);
  color: #5a13c7;
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(90, 19, 199, 0.10);
  outline: none;
}

/* ================= BODY LOCK ================= */

body.popup-open {
  overflow: hidden;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 640px) {
  .ai-help-popup-panel {
    width: calc(100% - 16px);
    max-height: calc(100vh - 16px);
    margin: 8px auto;
    border-radius: 22px;
  }

  .ai-help-popup-content {
    padding: 24px 16px 18px;
    max-height: calc(100vh - 16px);
  }

  .ai-help-popup-close {
    top: 10px;
    right: 10px;

    width: 38px;
    height: 38px;

    font-size: 24px;
  }

  .ai-help-popup-kicker {
    max-width: calc(100% - 48px);
    font-size: 0.68rem;
    line-height: 1.25;
    white-space: normal;
  }

  .ai-help-popup h3 {
    margin-right: 44px;
    font-size: clamp(1.42rem, 8vw, 2rem);
    line-height: 1.08;
  }

  .ai-help-popup-intro {
    font-size: 0.94rem;
    line-height: 1.65;
  }

  .ai-help-popup-section {
    padding: 18px 16px 17px;
    border-radius: 18px;
  }

  .ai-help-popup-actions {
    flex-direction: column;
  }

  .ai-help-popup-actions .btn,
  .ai-help-popup-actions a,
  .ai-help-popup-actions button {
    width: 100%;
  }
}