/* =====================================
   AI DEMO SECTION — FINAL SAAS CHAT WINDOW
   Chat launcher + same-section fixed modal
   Scroll-safe / no text overflow over modal
===================================== */

#ai-demo.ai-demo-section {
  --ai-bg: #fbf9ff;
  --ai-panel: #ffffff;
  --ai-panel-soft: #fbf9ff;
  --ai-line: rgba(111, 31, 229, 0.14);
  --ai-line-soft: rgba(111, 31, 229, 0.10);

  --ai-text: #160038;
  --ai-text-strong: #0b1020;
  --ai-muted: #667187;
  --ai-white: #ffffff;

  --ai-purple: #6f1fe5;
  --ai-purple-deep: #4f0fb8;
  --ai-pink: #ff0d96;
  --ai-blue: #2563eb;
  --ai-cyan: #00c0f3;
  --ai-gold: #f4c76b;

  --ai-shadow:
    0 24px 60px rgba(42, 1, 70, 0.14),
    0 8px 22px rgba(42, 1, 70, 0.07);

  position: relative;
  z-index: 1;
  isolation: isolate;
  overflow: hidden;
  padding: 68px 0 48px;

  background:
    radial-gradient(circle at 12% 0%, rgba(111, 31, 229, 0.10), transparent 30%),
    radial-gradient(circle at 90% 10%, rgba(0, 192, 243, 0.08), transparent 26%),
    linear-gradient(180deg, #fbf9ff 0%, #f8fbff 100%);

  border-top: 1px solid rgba(111, 31, 229, 0.12);
  border-bottom: 1px solid rgba(111, 31, 229, 0.12);
}

#ai-demo.ai-demo-section::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.78) 0%,
      rgba(248, 244, 255, 0.68) 52%,
      rgba(238, 251, 255, 0.72) 100%
    );
}

#ai-demo,
#ai-demo *,
#ai-demo *::before,
#ai-demo *::after {
  box-sizing: border-box;
}

#ai-demo .ai-demo-wrap {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

/* ================= SECTION HEAD ================= */

#ai-demo .ai-demo-section-head {
  max-width: 860px;
  margin: 0 auto 24px;
  text-align: center;
}

#ai-demo .ai-demo-section-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  padding: 6px 11px;

  border-radius: 999px;
  background: rgba(111, 31, 229, 0.08);
  border: 1px solid rgba(111, 31, 229, 0.14);

  color: var(--ai-purple);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#ai-demo .ai-demo-section-title {
  margin: 0;
  color: var(--ai-text);
  font-size: clamp(2rem, 3.1vw, 3rem);
  line-height: 1.03;
  letter-spacing: -0.045em;
  font-weight: 850;
  text-wrap: balance;
}

#ai-demo .ai-demo-section-intro {
  margin: 14px auto 0;
  max-width: 70ch;
  color: var(--ai-muted);
  font-size: 1rem;
  line-height: 1.76;
}

/* ================= CHAT LAUNCHER ================= */

#ai-demo .ai-demo-launch-card {
  display: grid;
  grid-template-columns: minmax(360px, 0.96fr) minmax(0, 1.04fr);
  gap: 24px;
  align-items: center;

  max-width: 1050px;
  margin: 0 auto;
  padding: 28px;

  border-radius: 30px;
  border: 1px solid rgba(111, 31, 229, 0.16);
  background:
    radial-gradient(circle at 0% 0%, rgba(111, 31, 229, 0.10), transparent 34%),
    radial-gradient(circle at 100% 0%, rgba(0, 192, 243, 0.10), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);

  box-shadow:
    0 24px 60px rgba(42, 1, 70, 0.13),
    inset 0 1px 0 #ffffff;
}

#ai-demo .ai-demo-launch-window {
  position: relative;
  overflow: hidden;
  min-height: 330px;
  padding: 18px;

  border-radius: 26px;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 13, 150, 0.18), transparent 34%),
    radial-gradient(circle at 0% 0%, rgba(111, 31, 229, 0.22), transparent 34%),
    linear-gradient(180deg, #160038 0%, #0b1020 100%);

  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 22px 48px rgba(11, 16, 32, 0.26);
}

#ai-demo .ai-demo-launch-windowbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

#ai-demo .ai-demo-preview-top {
  display: inline-flex;
  gap: 7px;
}

#ai-demo .ai-demo-preview-top span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

#ai-demo .ai-demo-preview-top span:nth-child(1) { background: var(--ai-pink); }
#ai-demo .ai-demo-preview-top span:nth-child(2) { background: var(--ai-purple); }
#ai-demo .ai-demo-preview-top span:nth-child(3) { background: var(--ai-cyan); }

#ai-demo .ai-demo-launch-windowbar strong {
  min-width: 0;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 850;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ai-demo .ai-demo-launch-windowbar em {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;

  color: #ffffff;
  background: rgba(255, 13, 150, 0.22);
  border: 1px solid rgba(255, 13, 150, 0.34);

  font-size: 0.68rem;
  font-style: normal;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

#ai-demo .ai-demo-launch-chat {
  display: grid;
  gap: 16px;
  padding-top: 20px;
}

#ai-demo .ai-demo-launch-bubble {
  padding: 14px 15px;
  border-radius: 18px;
  font-size: 0.9rem;
  line-height: 1.55;
}

#ai-demo .ai-demo-launch-bubble-ai {
  max-width: 86%;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom-left-radius: 6px;
}

#ai-demo .ai-demo-launch-bubble-user {
  max-width: 80%;
  margin-left: auto;
  background: #ffffff;
  color: var(--ai-text);
  border-bottom-right-radius: 6px;
}

#ai-demo .ai-demo-launch-prompt-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

#ai-demo .ai-demo-launch-prompt-row span {
  display: grid;
  place-items: center;
  min-height: 54px;
  padding: 10px;
  border-radius: 16px;

  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.10);

  color: rgba(255, 255, 255, 0.76);
  font-size: 0.74rem;
  font-weight: 750;
  text-align: center;
}

#ai-demo .ai-demo-launch-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;

  min-height: 48px;
  padding: 5px 5px 5px 16px;
  border-radius: 999px;

  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
}

#ai-demo .ai-demo-launch-input span {
  min-width: 0;
  color: #8a94a6;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ai-demo .ai-demo-launch-input strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;

  background: linear-gradient(135deg, var(--ai-purple) 0%, var(--ai-blue) 100%);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 850;
}

/* ================= LAUNCH COPY ================= */

#ai-demo .ai-demo-launch-copy {
  min-width: 0;
}

#ai-demo .ai-demo-launch-kicker {
  display: inline-flex;
  align-items: center;
  margin-bottom: 12px;
  padding: 6px 10px;

  border-radius: 999px;
  background: rgba(255, 13, 150, 0.10);
  border: 1px solid rgba(255, 13, 150, 0.18);

  color: #d41486;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#ai-demo .ai-demo-launch-copy h3 {
  max-width: 18ch;
  margin: 0;
  color: var(--ai-text);
  font-size: clamp(2rem, 3vw, 3.1rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
  font-weight: 900;
  text-wrap: balance;
}

#ai-demo .ai-demo-launch-copy p {
  margin: 14px 0 0;
  color: var(--ai-muted);
  line-height: 1.72;
  max-width: 64ch;
}

#ai-demo .ai-demo-launch-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}

#ai-demo .ai-demo-launch-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;

  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(111, 31, 229, 0.13);

  color: #4b5870;
  font-size: 0.8rem;
  font-weight: 750;

  box-shadow: 0 8px 18px rgba(42, 1, 70, 0.05);
}

#ai-demo .ai-demo-launch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

#ai-demo .ai-demo-open-btn {
  appearance: none;
  min-height: 66px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0 28px;
  border-radius: 999px;

  border: 1px solid rgba(111, 31, 229, 0.18);
  background: linear-gradient(135deg, #6f1fe5 0%, #ff0d96 100%);
  color: #ffffff;

  font: inherit;
  font-size: 1.2rem;
  font-weight: 780;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;

  box-shadow:
    0 18px 34px rgba(255, 13, 150, 0.22),
    0 10px 20px rgba(90, 19, 199, 0.18);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

#ai-demo .ai-demo-open-btn:hover,
#ai-demo .ai-demo-open-btn:focus-visible {
  transform: translateY(-2px) scale(1.01);
  background: linear-gradient(135deg, #5a13c7 0%, #e20b85 100%);
  box-shadow:
    0 22px 42px rgba(255, 13, 150, 0.30),
    0 14px 28px rgba(90, 19, 199, 0.24);
  outline: none;
}

/* ================= MODAL — SAME SECTION / SCROLL SAFE ================= */

#ai-demo .ai-demo-modal[hidden] {
  display: none !important;
}

body.ai-demo-modal-open {
  overflow: hidden;
}

/* Lift the demo section above every following section while modal is open */
body.ai-demo-modal-open #ai-demo.ai-demo-section,
#ai-demo.ai-demo-section.is-demo-open {
  position: relative;
  z-index: 2147482000;
  overflow: visible;
  isolation: isolate;
}

/* Avoid the wrapper trapping the fixed modal below later sections */
body.ai-demo-modal-open #ai-demo .ai-demo-wrap,
#ai-demo.ai-demo-section.is-demo-open .ai-demo-wrap {
  z-index: auto;
}

/* Modal remains inside same HTML place but behaves like global viewport overlay */
#ai-demo .ai-demo-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483000;

  display: grid;
  place-items: center;

  width: 100vw;
  height: 100vh;
  padding: 24px;

  isolation: isolate;
  pointer-events: auto;
}

#ai-demo .ai-demo-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;

  background: rgba(11, 16, 32, 0.74);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#ai-demo .ai-demo-modal-panel {
  position: relative;
  z-index: 1;

  width: min(960px, calc(100vw - 32px));
  max-height: min(780px, calc(100vh - 48px));
  overflow: hidden;

  display: grid;
  grid-template-rows: auto minmax(0, 1fr);

  border-radius: 28px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.44);
}

#ai-demo .ai-demo-modal-head {
  position: relative;
  z-index: 2;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;

  background:
    radial-gradient(circle at 100% 0%, rgba(255, 13, 150, 0.28), transparent 32%),
    linear-gradient(135deg, #160038 0%, #2a0146 100%);
  color: #ffffff;
}

#ai-demo .ai-demo-modal-kicker {
  display: block;
  margin-bottom: 5px;

  color: rgba(255, 255, 255, 0.68);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#ai-demo .ai-demo-modal-head h3 {
  margin: 0;
  color: #ffffff;
  font-size: 1.16rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 850;
}

#ai-demo .ai-demo-close-btn {
  appearance: none;

  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;

  border: 1px solid rgba(255, 13, 150, 0.42);
  background: #ff0d96;
  color: #ffffff;

  font: inherit;
  font-size: 0.8rem;
  font-weight: 850;
  cursor: pointer;

  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

#ai-demo .ai-demo-close-btn:hover,
#ai-demo .ai-demo-close-btn:focus-visible {
  transform: translateY(-1px);
  background: #e20b85;
  box-shadow: 0 12px 24px rgba(255, 13, 150, 0.24);
  outline: none;
}

/* Stage scrolls inside modal, not page */
#ai-demo .ai-demo-modal .ai-demo-stage {
  position: relative;
  z-index: 1;

  min-height: 0;
  width: 100%;
  padding: 16px;

  background: #f8fbff;
  overflow: auto;
  overscroll-behavior: contain;
}

#ai-demo .ai-demo-stage-glow {
  display: none;
}

/* ================= FULL DEMO WINDOW ================= */

#ai-demo .ai-demo-inner {
  position: relative;
  display: grid;
  gap: 1rem;
  width: 100%;
  margin: 0 auto;
  padding: 1.1rem;

  border: 1px solid var(--ai-line);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: none;
  overflow: hidden;
}

#ai-demo .ai-demo-inner > * {
  position: relative;
  z-index: 1;
}

/* window chrome */

#ai-demo .ai-demo-windowbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;

  min-height: 46px;
  padding: 0 6px 6px;

  border-bottom: 1px solid rgba(111, 31, 229, 0.11);
}

#ai-demo .ai-demo-windowdots {
  display: inline-flex;
  gap: 7px;
}

#ai-demo .ai-demo-windowdots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

#ai-demo .ai-demo-windowdots span:nth-child(1) { background: var(--ai-pink); }
#ai-demo .ai-demo-windowdots span:nth-child(2) { background: var(--ai-purple); }
#ai-demo .ai-demo-windowdots span:nth-child(3) { background: var(--ai-cyan); }

#ai-demo .ai-demo-windowtitle {
  min-width: 0;
  color: var(--ai-text);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ai-demo .ai-demo-windowmeta {
  display: flex;
  justify-content: flex-end;
}

#ai-demo .ai-demo-windowbadge {
  display: inline-flex;
  align-items: center;

  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;

  background: rgba(111, 31, 229, 0.08);
  border: 1px solid rgba(111, 31, 229, 0.14);

  color: var(--ai-purple);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* 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: 36px;
  padding: 0 0.92rem;

  border: 1px solid rgba(111, 31, 229, 0.12);
  border-radius: 999px;
  background: #ffffff;

  color: var(--ai-purple);
  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: #139b62;
  box-shadow: 0 0 0 5px rgba(19, 155, 98, 0.12);
}

#ai-demo [data-status="openrouter"]::before {
  background: var(--ai-purple);
  box-shadow: 0 0 0 5px rgba(111, 31, 229, 0.12);
}

#ai-demo [data-status="openai"]::before {
  background: var(--ai-blue);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.12);
}

#ai-demo [data-status="error"]::before {
  background: #b42318;
  box-shadow: 0 0 0 5px rgba(180, 35, 24, 0.12);
}

#ai-demo .ai-demo-tools {
  display: flex;
  justify-content: flex-start;
}

#ai-demo .ai-demo-toggle,
#ai-demo .ai-demo-chip,
#ai-demo .ai-demo-action {
  appearance: none;

  border: 1px solid rgba(111, 31, 229, 0.14);
  border-radius: 999px;
  background: #ffffff;

  color: #4f0fb8;
  font: inherit;
  cursor: pointer;

  transition:
    background 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 {
  padding: 0.68rem 1rem;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1;
}

#ai-demo .ai-demo-toggle:hover,
#ai-demo .ai-demo-toggle:focus-visible,
#ai-demo .ai-demo-chip:hover,
#ai-demo .ai-demo-chip:focus-visible,
#ai-demo .ai-demo-action:hover,
#ai-demo .ai-demo-action:focus-visible {
  background: #f7f1ff;
  border-color: rgba(111, 31, 229, 0.30);
  color: var(--ai-text);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(42, 1, 70, 0.08);
  outline: none;
}

/* chips */

#ai-demo [data-ai-demo-chips] {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

#ai-demo .ai-demo-chip {
  padding: 0.7rem 0.96rem;
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.2;
}

/* conversation shell */

#ai-demo .ai-demo-shell {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;

  border: 1px solid var(--ai-line);
  border-radius: 18px;
  background: #ffffff;

  box-shadow:
    inset 0 1px 0 #ffffff,
    0 8px 18px rgba(42, 1, 70, 0.05);
}

#ai-demo [data-ai-demo-messages] {
  display: grid;
  gap: 0.8rem;

  min-height: 260px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 0.2rem;

  background: #ffffff;
  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.20);
}

#ai-demo .ai-demo-message {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-width: 74%;
}

#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: 16px;

  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: #ffffff;
  color: #26324a;
  border-color: rgba(111, 31, 229, 0.12);
  border-top-left-radius: 8px;
  box-shadow: 0 6px 14px rgba(42, 1, 70, 0.06);
}

#ai-demo .ai-demo-message--user .ai-demo-bubble {
  background:
    linear-gradient(135deg, var(--ai-purple) 0%, var(--ai-blue) 100%);
  color: #ffffff;
  border-color: rgba(111, 31, 229, 0.24);
  border-top-right-radius: 8px;
  box-shadow: 0 10px 22px rgba(90, 19, 199, 0.20);
}

#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 {
  min-height: 2.25rem;
  padding: 0.58rem 0.84rem;

  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.2;
  text-decoration: 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.16);
  border-radius: 999px;
  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: #8a94a6;
}

#ai-demo [data-ai-demo-input]:focus {
  outline: none;
  border-color: rgba(111, 31, 229, 0.34);
  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-radius: 999px;

  border: 1px solid rgba(111, 31, 229, 0.24);
  background:
    linear-gradient(135deg, var(--ai-purple) 0%, var(--ai-blue) 100%);

  color: #ffffff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;

  box-shadow: 0 10px 22px rgba(90, 19, 199, 0.20);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

#ai-demo [data-ai-demo-send]:hover,
#ai-demo [data-ai-demo-send]:focus-visible {
  background:
    linear-gradient(135deg, #5a13c7 0%, #1d4ed8 100%);
  border-color: rgba(111, 31, 229, 0.34);
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(90, 19, 199, 0.28);
  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.12);
  background: #ffffff;

  color: #667187;
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1;
}

/* footnote */

#ai-demo .ai-demo-footnote {
  margin: 0;
  color: var(--ai-muted);
  font-size: 0.8rem;
  line-height: 1.58;
}

#ai-demo .ai-demo-footnote a {
  color: var(--ai-purple);
  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 !important;
}

/* typing */

#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: var(--ai-purple);
  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: 940px) {
  #ai-demo .ai-demo-launch-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  #ai-demo.ai-demo-section {
    padding: 52px 0 34px;
  }

  #ai-demo .ai-demo-wrap {
    width: calc(100% - 22px);
  }

  #ai-demo .ai-demo-modal {
    padding: 12px;
  }

  #ai-demo .ai-demo-modal-panel {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    border-radius: 22px;
  }

  #ai-demo .ai-demo-modal .ai-demo-stage {
    padding: 10px;
  }

  #ai-demo .ai-demo-inner {
    width: 100%;
    padding: 1.05rem;
    border-radius: 18px;
  }

  #ai-demo .ai-demo-windowbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  #ai-demo .ai-demo-windowmeta {
    display: none;
  }

  #ai-demo .ai-demo-shell {
    padding: 0.8rem;
    border-radius: 16px;
  }

  #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 28px;
  }

  #ai-demo .ai-demo-section-title {
    font-size: 1.55rem;
  }

  #ai-demo .ai-demo-section-intro {
    font-size: 0.92rem;
  }

  #ai-demo .ai-demo-launch-card {
    padding: 20px 16px;
    border-radius: 24px;
  }

  #ai-demo .ai-demo-launch-window {
    min-height: auto;
    padding: 15px;
    border-radius: 22px;
  }

  #ai-demo .ai-demo-launch-windowbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  #ai-demo .ai-demo-launch-windowbar em {
    display: none;
  }

  #ai-demo .ai-demo-launch-prompt-row {
    grid-template-columns: 1fr;
  }

  #ai-demo .ai-demo-open-btn {
    width: 100%;
  }

  #ai-demo .ai-demo-modal-head {
    align-items: flex-start;
  }

  #ai-demo .ai-demo-modal-head h3 {
    font-size: 1rem;
  }

  #ai-demo .ai-demo-modal .ai-demo-stage {
    padding: 0;
    background: #ffffff;
  }

  #ai-demo .ai-demo-inner {
    padding: 0.92rem;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  #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;
  }
}

@media (prefers-reduced-motion: reduce) {
  #ai-demo *,
  #ai-demo *::before,
  #ai-demo *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ================= KNOWLEDGE ACCESS — SAAS AI STYLE ================= */

.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 {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 1px solid rgba(111, 31, 229, 0.14);
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0%, rgba(111, 31, 229, 0.07), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  box-shadow: 0 12px 28px rgba(42, 1, 70, 0.08);
}

.ai-knowledge-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #6f1fe5 0%, #2563eb 100%);
}

.ai-knowledge-card:nth-child(2) {
  background:
    radial-gradient(circle at 100% 0%, rgba(0, 192, 243, 0.12), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #eefbff 100%);
  border-color: rgba(0, 192, 243, 0.24);
}

.ai-knowledge-card:nth-child(2)::before {
  background: linear-gradient(180deg, #2563eb 0%, #00c0f3 100%);
}

.ai-knowledge-card:nth-child(3) {
  background:
    radial-gradient(circle at 100% 0%, rgba(244, 199, 107, 0.20), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #fffaf0 100%);
  border-color: rgba(244, 199, 107, 0.42);
}

.ai-knowledge-card:nth-child(3)::before {
  background: linear-gradient(180deg, #92400e 0%, #f4c76b 100%);
}

.ai-knowledge-card:nth-child(4) {
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 13, 150, 0.10), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f7f1ff 100%);
  border-color: rgba(111, 31, 229, 0.18);
}

.ai-knowledge-card:nth-child(4)::before {
  background: linear-gradient(180deg, #6f1fe5 0%, #ff0d96 100%);
}

.ai-knowledge-tag {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(111, 31, 229, 0.08);
  border: 1px solid rgba(111, 31, 229, 0.14);
  color: #6f1fe5;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ai-knowledge-card:nth-child(2) .ai-knowledge-tag {
  background: rgba(0, 192, 243, 0.12);
  border-color: rgba(0, 192, 243, 0.22);
  color: #0369a1;
}

.ai-knowledge-card:nth-child(3) .ai-knowledge-tag {
  background: rgba(244, 199, 107, 0.18);
  border-color: rgba(244, 199, 107, 0.38);
  color: #92400e;
}

.ai-knowledge-card:nth-child(4) .ai-knowledge-tag {
  background: rgba(111, 31, 229, 0.10);
  border-color: rgba(255, 13, 150, 0.18);
  color: #d41486;
}

.ai-knowledge-card h3 {
  margin: 0 0 10px;
  font-size: 1.08rem;
  line-height: 1.35;
  color: #160038;
  font-weight: 850;
  letter-spacing: -0.015em;
}

.ai-knowledge-card p {
  margin: 0;
  color: #667187;
  line-height: 1.7;
}

/* ================= KNOWLEDGE LAYERS ================= */

.ai-knowledge-layers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.ai-knowledge-layer {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 1px solid rgba(111, 31, 229, 0.14);
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0%, rgba(111, 31, 229, 0.08), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  box-shadow: 0 10px 24px rgba(42, 1, 70, 0.07);
}

.ai-knowledge-layer:nth-child(2) {
  background:
    radial-gradient(circle at 100% 0%, rgba(244, 199, 107, 0.20), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #fffaf0 100%);
  border-color: rgba(244, 199, 107, 0.42);
  box-shadow: 0 10px 24px rgba(146, 64, 14, 0.08);
}

.ai-knowledge-layer::before {
  content: "Knowledge Layer";
  display: inline-flex;
  margin-bottom: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(111, 31, 229, 0.08);
  border: 1px solid rgba(111, 31, 229, 0.14);
  color: #6f1fe5;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ai-knowledge-layer:nth-child(2)::before {
  content: "Control Layer";
  background: rgba(244, 199, 107, 0.18);
  border-color: rgba(244, 199, 107, 0.38);
  color: #92400e;
}

.ai-knowledge-layer h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: #160038;
  font-weight: 850;
  letter-spacing: -0.01em;
}

.ai-knowledge-layer ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.ai-knowledge-layer li {
  position: relative;
  margin: 0;
  padding-left: 22px;
  color: #667187;
  line-height: 1.6;
}

.ai-knowledge-layer li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #6f1fe5;
  box-shadow: 0 0 0 4px rgba(111, 31, 229, 0.10);
}

.ai-knowledge-layer:nth-child(2) li::before {
  background: #92400e;
  box-shadow: 0 0 0 4px rgba(244, 199, 107, 0.20);
}

/* ================= KNOWLEDGE NOTE ================= */

.ai-knowledge-note {
  margin-top: 20px;
  padding: 18px 20px 18px 22px;
  border-left: 4px solid #6f1fe5;
  background:
    radial-gradient(circle at 100% 0%, rgba(0, 192, 243, 0.08), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  border-radius: 14px;
  border-top: 1px solid rgba(111, 31, 229, 0.13);
  border-right: 1px solid rgba(111, 31, 229, 0.13);
  border-bottom: 1px solid rgba(111, 31, 229, 0.13);
  box-shadow: 0 10px 24px rgba(42, 1, 70, 0.07);
}

.ai-knowledge-note p {
  margin: 0;
  color: #667187;
  line-height: 1.7;
}

/* ================= ACTIONS ================= */

.ai-knowledge-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

/* ================= RESPONSIVE ================= */

@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;
  }

  .ai-knowledge-note {
    padding: 16px 16px 16px 18px;
  }
}

/* ================= OPERATIONAL FLOW STACK — SAAS AI ================= */

.ai-flow-stack {
  margin-top: 26px;
  border: 1px solid rgba(111, 31, 229, 0.14);
  border-radius: 22px;
  background:
    radial-gradient(circle at 100% 0%, rgba(0, 192, 243, 0.07), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  box-shadow: 0 14px 34px rgba(42, 1, 70, 0.08);
  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:
    radial-gradient(circle at 100% 0%, rgba(111, 31, 229, 0.08), transparent 32%),
    linear-gradient(180deg, #ffffff 0%, #f7f1ff 100%);
}

.ai-flow-stack-toggle::-webkit-details-marker {
  display: none;
}

.ai-flow-stack-toggle-text {
  font-size: 1rem;
  font-weight: 850;
  color: #160038;
}

.ai-flow-stack-toggle-icon {
  font-size: 1.1rem;
  color: #6f1fe5;
  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 rgba(111, 31, 229, 0.12);
}

.ai-flow-stack-line {
  position: absolute;
  left: 40px;
  top: 24px;
  bottom: 120px;
  width: 2px;
  background:
    linear-gradient(
      180deg,
      rgba(111, 31, 229, 0.28) 0%,
      rgba(37, 99, 235, 0.24) 45%,
      rgba(0, 192, 243, 0.22) 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: 900;

  background: #ffffff;
  border: 2px solid rgba(111, 31, 229, 0.20);
  color: #6f1fe5;

  box-shadow: 0 8px 18px rgba(42, 1, 70, 0.08);
}

.ai-flow-stack-card {
  padding: 20px 20px 18px;
  border: 1px solid rgba(111, 31, 229, 0.13);
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0%, rgba(111, 31, 229, 0.06), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  box-shadow: 0 10px 24px rgba(42, 1, 70, 0.07);
}

.ai-flow-stack-tag {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;

  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Step colors */
.step-1 .ai-flow-stack-tag {
  background: rgba(111, 31, 229, 0.08);
  border: 1px solid rgba(111, 31, 229, 0.14);
  color: #6f1fe5;
}

.step-2 .ai-flow-stack-tag {
  background: rgba(0, 192, 243, 0.12);
  border: 1px solid rgba(0, 192, 243, 0.22);
  color: #0369a1;
}

.step-3 .ai-flow-stack-tag {
  background: rgba(255, 13, 150, 0.08);
  border: 1px solid rgba(255, 13, 150, 0.18);
  color: #d41486;
}

.step-4 .ai-flow-stack-tag {
  background: rgba(244, 199, 107, 0.18);
  border: 1px solid rgba(244, 199, 107, 0.38);
  color: #92400e;
}

.step-1 .ai-flow-stack-marker {
  border-color: rgba(111, 31, 229, 0.28);
  color: #6f1fe5;
  box-shadow: 0 0 0 5px rgba(111, 31, 229, 0.08);
}

.step-2 .ai-flow-stack-marker {
  border-color: rgba(0, 192, 243, 0.30);
  color: #0369a1;
  box-shadow: 0 0 0 5px rgba(0, 192, 243, 0.10);
}

.step-3 .ai-flow-stack-marker {
  border-color: rgba(255, 13, 150, 0.24);
  color: #d41486;
  box-shadow: 0 0 0 5px rgba(255, 13, 150, 0.08);
}

.step-4 .ai-flow-stack-marker {
  border-color: rgba(244, 199, 107, 0.46);
  color: #92400e;
  box-shadow: 0 0 0 5px rgba(244, 199, 107, 0.16);
}

.ai-flow-stack-card h3 {
  margin: 0 0 10px;
  font-size: 1.04rem;
  line-height: 1.35;
  color: #160038;
  font-weight: 850;
}

.ai-flow-stack-card p {
  margin: 0;
  color: #667187;
  line-height: 1.68;
}

.ai-flow-stack-note {
  margin-top: 22px;
  margin-left: 54px;
  padding: 18px 20px;

  border-left: 4px solid #6f1fe5;
  background:
    radial-gradient(circle at 100% 0%, rgba(0, 192, 243, 0.08), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  border-radius: 14px;

  border-top: 1px solid rgba(111, 31, 229, 0.13);
  border-right: 1px solid rgba(111, 31, 229, 0.13);
  border-bottom: 1px solid rgba(111, 31, 229, 0.13);

  box-shadow: 0 10px 24px rgba(42, 1, 70, 0.07);
}

.ai-flow-stack-note h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #160038;
  font-weight: 850;
}

.ai-flow-stack-note p {
  margin: 0;
  color: #667187;
  line-height: 1.68;
}

@media (max-width: 760px) {
  .ai-flow-stack {
    border-radius: 18px;
  }

  .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 V8
   SaaS AI notice modal — white / purple / pink controlled system
========================================================= */

/* ================= 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: #6f1fe5;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1.4px;

  cursor: pointer;
  opacity: 1;
  font-weight: 850;

  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: 2147482500;
  display: none;

  background:
    radial-gradient(circle at 12% 0%, rgba(111, 31, 229, 0.13), transparent 30%),
    radial-gradient(circle at 88% 10%, rgba(255, 13, 150, 0.08), transparent 26%),
    radial-gradient(circle at 80% 92%, rgba(0, 192, 243, 0.08), transparent 24%),
    linear-gradient(180deg, #fbf9ff 0%, #f8fbff 100%);
}

.ai-help-popup.is-open {
  display: block;
}

/* ================= OVERLAY ================= */

.ai-help-popup-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.74) 0%,
      rgba(248, 244, 255, 0.70) 52%,
      rgba(238, 251, 255, 0.72) 100%
    );
  opacity: 1;
}

/* ================= PANEL ================= */

.ai-help-popup-panel {
  position: relative;
  z-index: 1;

  width: min(1040px, calc(100% - 32px));
  max-height: calc(100vh - 40px);
  margin: 20px auto;

  color: #160038;

  border-radius: 24px;
  overflow: hidden;

  background:
    radial-gradient(circle at 0% 0%, rgba(111, 31, 229, 0.08), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  border: 1px solid rgba(111, 31, 229, 0.16);

  box-shadow:
    0 30px 86px rgba(42, 1, 70, 0.20),
    0 10px 28px rgba(42, 1, 70, 0.09),
    inset 0 1px 0 #ffffff;

  opacity: 0;
  transform: translateY(14px);

  transition:
    opacity 0.24s ease,
    transform 0.24s ease;
}

.ai-help-popup.is-visible .ai-help-popup-panel {
  opacity: 1;
  transform: translateY(0);
}

/* ================= CONTENT ================= */

.ai-help-popup-content {
  padding: 34px 34px 30px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;

  scrollbar-width: thin;
  scrollbar-color: rgba(111, 31, 229, 0.36) rgba(111, 31, 229, 0.08);
}

.ai-help-popup-content::-webkit-scrollbar {
  width: 10px;
}

.ai-help-popup-content::-webkit-scrollbar-track {
  background: rgba(111, 31, 229, 0.08);
}

.ai-help-popup-content::-webkit-scrollbar-thumb {
  background: rgba(111, 31, 229, 0.36);
  border-radius: 999px;
  border: 2px solid rgba(111, 31, 229, 0.08);
}

/* ================= CLOSE BUTTON ================= */

.ai-help-popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;

  width: 42px;
  height: 42px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(255, 13, 150, 0.42);
  border-radius: 50%;

  background: #ff0d96;
  color: #ffffff;

  font-size: 26px;
  line-height: 1;
  cursor: pointer;

  box-shadow: 0 12px 26px rgba(255, 13, 150, 0.24);

  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: #e20b85;
  border-color: #e20b85;
  color: #ffffff;
  transform: scale(1.04);
  box-shadow: 0 16px 34px rgba(255, 13, 150, 0.34);
  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);

  color: #6f1fe5;
  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 0 4px rgba(255, 13, 150, 0.12);
}

.ai-help-popup h3 {
  margin: 0 56px 14px 0;
  max-width: 860px;

  color: #160038;
  font-size: clamp(1.55rem, 2.2vw, 2.25rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 900;
  text-wrap: balance;
}

.ai-help-popup-intro {
  margin: 0 0 22px;
  max-width: 880px;

  color: #667187;
  font-size: 1rem;
  line-height: 1.72;
}

/* ================= NOTICE SECTIONS ================= */

.ai-help-popup-section {
  position: relative;
  overflow: hidden;

  padding: 20px 20px 19px;
  border-radius: 18px;

  background:
    radial-gradient(circle at 100% 0%, rgba(111, 31, 229, 0.06), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  border: 1px solid rgba(111, 31, 229, 0.13);

  box-shadow: 0 12px 28px rgba(42, 1, 70, 0.07);
}

.ai-help-popup-section + .ai-help-popup-section {
  margin-top: 14px;
}

.ai-help-popup-section::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;

  width: 4px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, #6f1fe5 0%, #2563eb 100%);
}

.ai-help-popup-section:nth-of-type(2)::before {
  background:
    linear-gradient(180deg, #2563eb 0%, #00c0f3 100%);
}

.ai-help-popup-section:nth-of-type(3)::before {
  background:
    linear-gradient(180deg, #92400e 0%, #f4c76b 100%);
}

.ai-help-popup-section:nth-of-type(4)::before {
  background:
    linear-gradient(180deg, #6f1fe5 0%, #ff0d96 100%);
}

.ai-help-popup-section h4 {
  margin: 0 0 10px;
  padding-left: 2px;

  color: #160038;
  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: #667187;
  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: #667187;
  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);
}

/* ================= SAAS TABLES ================= */

.ai-help-popup-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 14px 0 18px;

  border: 1px solid rgba(111, 31, 229, 0.14);
  border-radius: 16px;
  background: #ffffff;

  box-shadow: 0 10px 24px rgba(42, 1, 70, 0.07);
}

.ai-help-popup-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.45;
}

.ai-help-popup-table th,
.ai-help-popup-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(111, 31, 229, 0.10);
}

.ai-help-popup-table th {
  font-weight: 900;
  color: #160038;
  background: #f7f1ff;
  white-space: nowrap;
}

.ai-help-popup-table td {
  color: #667187;
  background: #ffffff;
}

.ai-help-popup-table tr:nth-child(even) td {
  background: #fbf9ff;
}

.ai-help-popup-table tr:last-child td {
  border-bottom: 0;
}

.ai-help-popup-table td:first-child {
  font-weight: 850;
  color: #160038;
}

.ai-help-popup-table strong {
  color: #160038;
  font-weight: 900;
}

.ai-help-popup-table .is-money,
.ai-help-popup-table .is-number,
.ai-help-popup-table .is-center {
  white-space: nowrap;
}

.ai-help-popup-table .is-center {
  text-align: center;
}

.ai-help-popup-table .is-right {
  text-align: right;
}

/* ================= TABLE STATUS BADGES ================= */

.ai-help-popup-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 24px;
  padding: 3px 9px;

  border-radius: 999px;
  background: rgba(111, 31, 229, 0.08);
  border: 1px solid rgba(111, 31, 229, 0.14);

  color: #6f1fe5;
  font-size: 0.78rem;
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
}

.ai-help-popup-badge.is-warning {
  background: rgba(244, 199, 107, 0.18);
  border-color: rgba(244, 199, 107, 0.38);
  color: #92400e;
}

.ai-help-popup-badge.is-success {
  background: rgba(19, 155, 98, 0.10);
  border-color: rgba(19, 155, 98, 0.24);
  color: #137347;
}

.ai-help-popup-badge.is-danger {
  background: rgba(255, 13, 150, 0.08);
  border-color: rgba(255, 13, 150, 0.18);
  color: #b80f68;
}

/* ================= LINKS INSIDE POPUP ================= */

.ai-help-popup a {
  color: #6f1fe5;
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1.3px;

  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;
}

/* Primary action style */
.ai-help-popup-actions button,
.ai-help-popup-actions .btn {
  border: 1px solid rgba(111, 31, 229, 0.24);
  background:
    linear-gradient(135deg, #6f1fe5 0%, #2563eb 58%, #00c0f3 100%);
  color: #ffffff;

  box-shadow: 0 14px 30px 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,
    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, #5a13c7 0%, #1d4ed8 58%, #0891b2 100%);
  border-color: rgba(111, 31, 229, 0.34);
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(90, 19, 199, 0.30);
  outline: none;
}

/* Secondary plain action 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.16);
  background: #ffffff;

  color: #4f0fb8;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(42, 1, 70, 0.07);

  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: #f7f1ff;
  border-color: rgba(111, 31, 229, 0.30);
  color: #160038;
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(42, 1, 70, 0.11);
  outline: none;
}

/* ================= BODY LOCK ================= */

body.popup-open {
  overflow: hidden;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 760px) {
  .ai-help-popup {
    background:
      linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  }

  .ai-help-popup-overlay {
    background:
      linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
  }

  .ai-help-popup-panel {
    width: 100%;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }

  .ai-help-popup-content {
    padding: 24px 16px 18px;
    max-height: 100vh;
  }

  .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.35rem, 7vw, 1.9rem);
    line-height: 1.1;
  }

  .ai-help-popup-intro {
    font-size: 0.94rem;
    line-height: 1.65;
  }

  .ai-help-popup-section {
    padding: 18px 16px 17px;
    border-radius: 14px;
  }

  .ai-help-popup-table {
    min-width: 720px;
    font-size: 0.88rem;
  }

  .ai-help-popup-table th,
  .ai-help-popup-table td {
    padding: 11px 12px;
  }

  .ai-help-popup-actions {
    flex-direction: column;
  }

  .ai-help-popup-actions .btn,
  .ai-help-popup-actions a,
  .ai-help-popup-actions button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .ai-help-popup-content {
    padding-left: 12px;
    padding-right: 12px;
  }

  .ai-help-popup-section {
    padding-left: 14px;
    padding-right: 14px;
  }

  .ai-help-popup-table {
    min-width: 680px;
  }
}