/* ── Ailo Chat Widget — Design System v3 ────────────────────── */

/* ═══════════════════════════════════════════════════════════════
   1. DESIGN TOKENS
   ═══════════════════════════════════════════════════════════════ */

#ailo-chat-root {
  /* Brand (overridden by wp_add_inline_style) */
  --ailo-brand: #FF2D87;
  --ailo-brand-dark: #CC1166;
  --ailo-brand-text: #FFFFFF;
  --ailo-brand-rgb: 255, 45, 135; /* keep in sync with --ailo-brand */

  /* Chat window dimensions (overridden by wp_add_inline_style) */
  --ailo-chat-width: 420px;
  --ailo-chat-height: 100vh;

  /* Typography */
  --ailo-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ailo-text-xs: 11px;
  --ailo-text-sm: 13px;
  --ailo-text-base: 15px;
  --ailo-text-md: 16px;
  --ailo-text-lg: 18px;
  --ailo-leading-tight: 1.3;
  --ailo-leading-normal: 1.5;

  /* Radius */
  --ailo-r-sm: 8px;
  --ailo-r-md: 12px;
  --ailo-r-lg: 16px;
  --ailo-r-xl: 20px;
  --ailo-r-full: 9999px;

  /* Shadows */
  --ailo-shadow-sm: 0 1px 4px rgba(0,0,0,.08);
  --ailo-shadow-md: 0 4px 16px rgba(0,0,0,.12);
  --ailo-shadow-lg: 0 8px 32px rgba(0,0,0,.18);
  --ailo-shadow-fab: 0 4px 20px rgba(0,0,0,.22);

  /* Transitions */
  --ailo-ease: cubic-bezier(.32,.72,0,1);
  --ailo-dur-fast: 180ms;
  --ailo-dur-normal: 300ms;
  --ailo-dur-slow: 420ms;

  /* Z-layers — launcher < backdrop < window */
  --ailo-z-backdrop: 9998;
  --ailo-z-window: 9999;
  --ailo-z-fab: 9997;
}

/* ── Light theme ─────────────────────────────────────────────── */
#ailo-chat-root[data-theme="light"],
#ailo-chat-root:not([data-theme]) {
  --ailo-bg: #FFFFFF;
  --ailo-surface: #FFFFFF;
  --ailo-surface-2: #F0F0F3;
  --ailo-surface-3: #E8E8ED;
  --ailo-border: rgba(0,0,0,.08);
  --ailo-border-strong: rgba(0,0,0,.15);

  --ailo-text-1: #1D1D1F;
  --ailo-text-2: #48484A;
  --ailo-text-3: #6E6E73;
  --ailo-text-inv: #FFFFFF;

  --ailo-header-bg: var(--ailo-brand);
  --ailo-header-text: #FFFFFF;

  --ailo-bubble-bot-bg: #FFFFFF;
  --ailo-bubble-bot-text: #1D1D1F;
  --ailo-bubble-user-bg: var(--ailo-brand);
  --ailo-bubble-user-text: #FFFFFF;

  --ailo-input-bg: #F5F5F7;
  --ailo-input-border: transparent;
  --ailo-input-focus: var(--ailo-brand);

  --ailo-chip-bg: #FFFFFF;
  --ailo-chip-border: rgba(0,0,0,.10);
  --ailo-chip-text: #1D1D1F;
  --ailo-chip-hover-bg: #F0F0F3;
  --ailo-chip-hover-text: #1D1D1F;

  --ailo-card-bg: #FFFFFF;
  --ailo-card-border: rgba(0,0,0,.06);
  --ailo-card-shadow: 0 2px 8px rgba(0,0,0,.07);

  --ailo-overlay: rgba(0,0,0,.4);
  --ailo-skeleton: linear-gradient(90deg,#E8E8ED 25%,#F5F5F7 50%,#E8E8ED 75%);
}

/* ── Dark theme ──────────────────────────────────────────────── */
#ailo-chat-root[data-theme="dark"] {
  --ailo-bg: #1A1612;
  --ailo-surface: #231F1A;
  --ailo-surface-2: #2E2922;
  --ailo-surface-3: #38332D;
  --ailo-border: rgba(255,240,220,.07);
  --ailo-border-strong: rgba(255,240,220,.14);

  --ailo-text-1: #F5EFE6;
  --ailo-text-2: #C9BFB4;
  --ailo-text-3: #8C7E72;
  --ailo-text-inv: #1A1612;

  --ailo-header-bg: #231F1A;
  --ailo-header-text: #F5EFE6;

  --ailo-bubble-bot-bg: #2C2722;
  --ailo-bubble-bot-text: #F5EFE6;
  --ailo-bubble-user-bg: var(--ailo-brand);
  --ailo-bubble-user-text: #FFFFFF;

  --ailo-input-bg: #2C2722;
  --ailo-input-border: rgba(255,240,220,.10);
  --ailo-input-focus: var(--ailo-brand);

  --ailo-chip-bg: #2C2722;
  --ailo-chip-border: rgba(255,240,220,.10);
  --ailo-chip-text: #F5EFE6;
  --ailo-chip-hover-bg: #38332D;
  --ailo-chip-hover-text: #F5EFE6;

  --ailo-card-bg: #2C2722;
  --ailo-card-border: rgba(255,255,255,.06);
  --ailo-card-shadow: 0 2px 8px rgba(0,0,0,.28);

  --ailo-overlay: rgba(0,0,0,.65);
  --ailo-skeleton: linear-gradient(90deg,#2C2722 25%,#38332D 50%,#2C2722 75%);
}


/* ═══════════════════════════════════════════════════════════════
   2. RESET & ROOT
   ═══════════════════════════════════════════════════════════════ */

#ailo-chat-root *,
#ailo-chat-root *::before,
#ailo-chat-root *::after {
  box-sizing: border-box;
}

#ailo-chat-root {
  font-family: var(--ailo-font);
  font-size: var(--ailo-text-base);
  line-height: var(--ailo-leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* ═══════════════════════════════════════════════════════════════
   3. BACKDROP
   ═══════════════════════════════════════════════════════════════ */

.ailo-backdrop {
  /* No display:none — opacity+pointer-events handle visibility so CSS transition fires */
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: var(--ailo-z-backdrop);
  background: rgba(0,0,0,.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out;
}

.ailo-backdrop--visible {
  opacity: 1;
  pointer-events: auto;
}

/* Backdrop not needed on mobile — drawer is fullscreen */
@media (max-width: 767px) {
  .ailo-backdrop {
    display: none !important;
  }
}


/* ═══════════════════════════════════════════════════════════════
   4. FAB LAUNCHER
   ═══════════════════════════════════════════════════════════════ */

#ailo-chat-root .ailo-fab {
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  left: auto !important;
  top: auto !important;
  margin: 0 !important;
  z-index: var(--ailo-z-fab) !important;
  cursor: pointer !important;
}

/* Circle variant */
.ailo-fab--circle {
  width: 56px;
  height: 56px;
  position: relative;
}

.ailo-fab--circle .ailo-fab__btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ailo-color, var(--ailo-brand));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  box-shadow: var(--ailo-shadow-fab);
  transition: transform var(--ailo-dur-fast) var(--ailo-ease),
              box-shadow var(--ailo-dur-fast) var(--ailo-ease);
}

.ailo-fab--circle .ailo-fab__btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0,0,0,.28);
}

.ailo-fab--circle .ailo-fab__pulse,
.ailo-fab--circle .ailo-fab__pulse-2 {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  border-radius: 50%;
  background: var(--ailo-color, var(--ailo-brand));
  opacity: 0.3;
  animation: ailo-pulse 2.5s ease-out infinite;
  z-index: 1;
}

.ailo-fab--circle .ailo-fab__pulse-2 {
  animation-delay: 0.6s;
}

.ailo-fab--circle .ailo-fab__icon {
  width: 28px;
  height: 28px;
  fill: none;
  color: #fff;
  position: relative;
  z-index: 2;
}

/* Text+icon variant */
.ailo-fab--text {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--ailo-r-full);
  background: var(--ailo-color, var(--ailo-brand));
  color: #fff;
  font-size: var(--ailo-text-sm);
  font-weight: 600;
  box-shadow: var(--ailo-shadow-fab);
  transition: transform var(--ailo-dur-fast) var(--ailo-ease),
              box-shadow var(--ailo-dur-fast) var(--ailo-ease);
  white-space: nowrap;
}

.ailo-fab--text:hover {
  transform: scale(1.04);
}

.ailo-fab--text .ailo-fab__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

@keyframes ailo-pulse {
  0%   { transform: scale(1);   opacity: .35; }
  70%  { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}


/* ═══════════════════════════════════════════════════════════════
   5. CHAT WINDOW (DRAWER)
   ═══════════════════════════════════════════════════════════════ */

.ailo-window {
  position: fixed;
  /* Explicit props instead of inset shorthand — Safari < 14.5 doesn't support inset */
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9999;
  background: var(--ailo-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Off-screen and non-interactive by default */
  transform: translateY(100%);
  pointer-events: none;
  /* visibility hides at end of close animation, shows instantly on open */
  visibility: hidden;
  transition: transform var(--ailo-dur-slow) var(--ailo-ease),
              visibility 0ms var(--ailo-dur-slow);
  will-change: transform;
}

.ailo-window--open {
  transform: translateY(0) !important;
  pointer-events: auto !important;
  visibility: visible !important;
  transition: transform var(--ailo-dur-slow) var(--ailo-ease),
              visibility 0ms 0ms !important;
}

/* Desktop: right-side drawer */
@media (min-width: 768px) {
  .ailo-window {
    /* Explicit props instead of inset shorthand */
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: var(--ailo-chat-width, 420px);
    height: 100vh;
    border-radius: var(--ailo-r-lg) 0 0 var(--ailo-r-lg);
    box-shadow: var(--ailo-shadow-lg);
    transform: translateX(100%);
    transition: transform var(--ailo-dur-slow) var(--ailo-ease),
                visibility 0ms var(--ailo-dur-slow);
  }

  .ailo-window--open {
    transform: translateX(0) !important;
  }
}


/* ═══════════════════════════════════════════════════════════════
   6. HEADER
   ═══════════════════════════════════════════════════════════════ */

.ailo-header {
  background: var(--ailo-header-bg);
  color: var(--ailo-header-text);
  height: 64px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.ailo-header__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  border: 1.5px solid rgba(255,255,255,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.ailo-header__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.ailo-header__avatar svg {
  width: 24px;
  height: 24px;
  color: rgba(255,255,255,.9);
}

.ailo-header__info {
  flex: 1;
  min-width: 0;
}

.ailo-header__name {
  font-size: 15px;
  font-weight: 600;
  line-height: var(--ailo-leading-tight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ailo-header__status {
  font-size: var(--ailo-text-xs);
  opacity: .8;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}

.ailo-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(255,255,255,.25);
}

#ailo-chat-root[data-theme="dark"] .ailo-status-dot {
  background: #4ADE80;
  box-shadow: 0 0 0 2px rgba(74,222,128,.2);
}

.ailo-header__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Force white — theme may override color on buttons */
  color: rgba(255,255,255,.9) !important;
  flex-shrink: 0;
  transition: background var(--ailo-dur-fast);
  -webkit-tap-highlight-color: transparent;
}

.ailo-header__close:hover {
  background: rgba(255,255,255,.28);
}

.ailo-header__close svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
  stroke: rgba(255,255,255,.9) !important;
  stroke-width: 2.5 !important;
  stroke-linecap: round !important;
  fill: none !important;
  pointer-events: none;
}


/* ═══════════════════════════════════════════════════════════════
   7. MESSAGES AREA
   ═══════════════════════════════════════════════════════════════ */

.ailo-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.ailo-messages::-webkit-scrollbar {
  width: 4px;
}

.ailo-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ailo-messages::-webkit-scrollbar-thumb {
  background: var(--ailo-surface-3);
  border-radius: var(--ailo-r-full);
}

/* Message rows */
.ailo-msg {
  display: flex;
  gap: 8px;
  max-width: 100%;
  animation: ailo-msg-in var(--ailo-dur-normal) var(--ailo-ease) both;
}

@keyframes ailo-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ailo-msg--user {
  flex-direction: row-reverse;
}

.ailo-msg--bot .ailo-msg__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ailo-brand) 10%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--ailo-brand) 20%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
  overflow: hidden;
}

.ailo-msg--bot .ailo-msg__avatar svg {
  width: 15px;
  height: 15px;
  color: var(--ailo-brand);
}

.ailo-msg__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: calc(100% - 44px);
}

.ailo-msg--user .ailo-msg__body {
  align-items: flex-end;
  max-width: 75%;
}

/* Bubbles */
.ailo-msg__bubble {
  padding: 11px 15px;
  border-radius: var(--ailo-r-lg);
  font-size: 14px;
  line-height: var(--ailo-leading-normal);
  word-break: break-word;
}

.ailo-msg--bot .ailo-msg__bubble {
  background: var(--ailo-bubble-bot-bg);
  color: var(--ailo-bubble-bot-text);
  border-radius: 4px 18px 18px 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.ailo-msg--user .ailo-msg__bubble {
  background: var(--ailo-bubble-user-bg);
  color: var(--ailo-bubble-user-text);
  border-radius: 18px 4px 18px 18px;
}

/* Timestamp */
.ailo-msg__time {
  font-size: var(--ailo-text-xs);
  color: var(--ailo-text-3);
  padding: 0 4px;
}

/* Typing indicator */
.ailo-typing {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ailo-typing__dots {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--ailo-bubble-bot-bg);
  padding: 10px 14px;
  border-radius: 4px 14px 14px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.ailo-typing__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ailo-text-3);
  animation: ailo-bounce 1.4s ease-in-out infinite;
}

.ailo-typing__dot:nth-child(1) { animation-delay: 0s; }
.ailo-typing__dot:nth-child(2) { animation-delay: .2s; }
.ailo-typing__dot:nth-child(3) { animation-delay: .4s; }

@keyframes ailo-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-6px); }
}


/* ═══════════════════════════════════════════════════════════════
   8. WELCOME / MOTIVE SCREEN
   ═══════════════════════════════════════════════════════════════ */

.ailo-welcome {
  flex: 0 0 auto;
  padding: 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ailo-welcome__title {
  font-size: var(--ailo-text-lg);
  font-weight: 600;
  color: var(--ailo-text-1);
  line-height: var(--ailo-leading-tight);
}

.ailo-welcome__subtitle {
  font-size: var(--ailo-text-sm);
  color: var(--ailo-text-3);
}

/* Section label (uppercase preheader above each welcome section) */
.ailo-section-header {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ailo-text-3);
  padding: 0 16px;
  margin-top: 6px;
}

/* Empty promo anchor takes no space in flex column */
.ailo-promo-anchor:empty {
  display: none;
}

#ailo-chat-root[data-theme="dark"] .ailo-motive-tile {
  box-shadow: none;
}

/* ── Motives grid 2×2 ────────────────────────────────────────────── */
.ailo-motive-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 16px 12px;
  flex-shrink: 0;
}

.ailo-motive-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 14px;
  background: var(--ailo-card-bg);
  border: 1px solid var(--ailo-card-border);
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--ailo-shadow-sm);
  transition: background var(--ailo-dur-fast),
              border-color var(--ailo-dur-fast),
              box-shadow var(--ailo-dur-fast);
}

.ailo-motive-tile:hover {
  background: var(--ailo-chip-hover-bg);
  border-color: var(--ailo-brand);
  box-shadow: var(--ailo-shadow-md);
}

.ailo-motive-tile__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(var(--ailo-brand-rgb), 0.10);
  border: 1px solid rgba(var(--ailo-brand-rgb), 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.ailo-motive-tile__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ailo-text-1);
  line-height: 1.3;
}

/* USP / trust badges — separated visually from main chips */
.ailo-trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 16px 0;
  margin-top: 16px;
}


/* ═══════════════════════════════════════════════════════════════
   9. CHIPS
   ═══════════════════════════════════════════════════════════════ */

.ailo-chips {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
  padding: 4px 0;
}

.ailo-chip-btn {
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--ailo-chip-border);
  background: var(--ailo-chip-bg);
  color: var(--ailo-chip-text);
  font-size: var(--ailo-text-sm);
  font-weight: 500;
  text-transform: none;
  cursor: pointer;
  box-shadow: var(--ailo-shadow-sm);
  transition: background var(--ailo-dur-fast),
              color var(--ailo-dur-fast),
              box-shadow var(--ailo-dur-fast);
  white-space: normal;
  text-align: left;
}

.ailo-chip-btn:hover,
.ailo-chip-btn:focus-visible {
  background: var(--ailo-chip-hover-bg);
  color: var(--ailo-chip-hover-text);
  box-shadow: var(--ailo-shadow-md);
  outline: none;
}


/* ── In-chat context / clarification chips (suggested questions) ───────────
   Different from welcome-screen motive buttons: 12px radius, full-width,
   column stack, chevron arrow — matches design spec "предложенные вопросы" */

.ailo-context-chip-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0 4px 36px;
}

.ailo-context-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--ailo-chip-border);
  background: var(--ailo-chip-bg);
  color: var(--ailo-chip-text);
  font-size: var(--ailo-text-sm);
  font-weight: 400;
  text-align: left;
  white-space: normal;
  text-transform: none;
  cursor: pointer;
  box-shadow: var(--ailo-shadow-sm);
  transition: background var(--ailo-dur-fast),
              color var(--ailo-dur-fast),
              box-shadow var(--ailo-dur-fast);
}

.ailo-context-chip:hover,
.ailo-context-chip:focus-visible {
  background: var(--ailo-chip-hover-bg);
  color: var(--ailo-chip-hover-text);
  border-color: var(--ailo-brand);
  box-shadow: var(--ailo-shadow-md);
  outline: none;
}

.ailo-context-chip__chevron {
  width: 12px;
  height: 12px;
  opacity: 0.35;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
}

/* ═══════════════════════════════════════════════════════════════
   10. INPUT BAR
   ═══════════════════════════════════════════════════════════════ */

.ailo-input-bar {
  padding: 10px 12px;
  background: var(--ailo-surface);
  border-top: 1px solid rgba(0,0,0,.06);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.ailo-input-bar__field {
  flex: 1;
  background: var(--ailo-input-bg);
  border: 1.5px solid var(--ailo-input-border);
  border-radius: 100px;
  padding: 10px 16px;
  font-family: var(--ailo-font);
  font-size: var(--ailo-text-base);
  color: var(--ailo-text-1);
  outline: none;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color var(--ailo-dur-fast);
  line-height: var(--ailo-leading-normal);
}

.ailo-input-bar__field::placeholder {
  color: var(--ailo-text-3);
}

.ailo-input-bar__field:focus {
  border-color: var(--ailo-input-focus);
}

#ailo-chat-root[data-theme="dark"] .ailo-input-bar__field {
  background: #2E2922 !important;
  color: #F5EFE6;
  border-color: rgba(255,240,220,.10);
}

#ailo-chat-root[data-theme="dark"] .ailo-input-bar__field::placeholder {
  color: #8C7E72;
}

#ailo-chat-root[data-theme="dark"] .ailo-input-bar__field:focus {
  background: #2E2922 !important;
  color: #F5EFE6;
  border-color: rgba(255,45,135,.4);
  box-shadow: 0 0 0 2px rgba(255,45,135,.15);
  outline: none;
}

.ailo-input-bar__send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--ailo-brand);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--ailo-brand) 35%, transparent);
  transition: background var(--ailo-dur-fast),
              transform var(--ailo-dur-fast);
}

.ailo-input-bar__send:hover {
  background: var(--ailo-brand-dark);
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(var(--ailo-brand-rgb), .45);
}

.ailo-input-bar__send:disabled {
  opacity: .45;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.ailo-input-bar__send svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
  fill: none !important;
  stroke: #fff !important;
  stroke-width: 2.2 !important;
}


/* ═══════════════════════════════════════════════════════════════
   11. PRODUCT CARDS
   ═══════════════════════════════════════════════════════════════ */

.ailo-products {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.ailo-product-card {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--ailo-card-bg);
  border: 1px solid var(--ailo-card-border);
  border-radius: var(--ailo-r-md);
  box-shadow: var(--ailo-card-shadow);
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--ailo-dur-fast),
              transform var(--ailo-dur-fast);
}

.ailo-product-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.13);
  transform: translateY(-1px);
}

.ailo-product-card__img {
  width: 56px;
  height: 56px;
  border-radius: var(--ailo-r-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--ailo-surface-2);
}

.ailo-product-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ailo-product-card__name {
  font-size: var(--ailo-text-sm);
  font-weight: 600;
  color: var(--ailo-text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ailo-product-card__price {
  font-size: var(--ailo-text-sm);
  color: var(--ailo-brand);
  font-weight: 700;
}

.ailo-product-card__desc {
  font-size: var(--ailo-text-xs);
  color: var(--ailo-text-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Horizontal scroll variant (carousel) */
.ailo-products--row {
  flex-direction: row;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  gap: 10px;
}

.ailo-products--row::-webkit-scrollbar { display: none; }

.ailo-products--row .ailo-product-card {
  flex-direction: column;
  min-width: 140px;
  max-width: 160px;
  scroll-snap-align: start;
  flex-shrink: 0;
}

.ailo-products--row .ailo-product-card__img {
  width: 100%;
  height: 100px;
}


/* ═══════════════════════════════════════════════════════════════
   12. OPERATOR SHEET
   ═══════════════════════════════════════════════════════════════ */

.ailo-sheet {
  background: var(--ailo-surface);
  border-top: 1px solid var(--ailo-border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

.ailo-sheet__title {
  font-size: var(--ailo-text-md);
  font-weight: 600;
  color: var(--ailo-text-1);
}

.ailo-sheet__operators {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ailo-operator-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--ailo-surface-2);
  border-radius: var(--ailo-r-md);
  transition: background var(--ailo-dur-fast);
}

.ailo-operator-row:hover {
  background: var(--ailo-surface-3);
}

.ailo-operator-row__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--ailo-surface-3);
}

.ailo-operator-row__info {
  flex: 1;
  min-width: 0;
}

.ailo-operator-row__name {
  font-size: var(--ailo-text-sm);
  font-weight: 600;
  color: var(--ailo-text-1);
}

.ailo-operator-row__role {
  font-size: var(--ailo-text-xs);
  color: var(--ailo-text-3);
}

.ailo-operator-row__wa {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #25D366;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
  transition: background var(--ailo-dur-fast), transform var(--ailo-dur-fast);
}

.ailo-operator-row__wa:hover {
  background: #128C7E;
  transform: scale(1.08);
}

.ailo-operator-row__wa svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}


/* ═══════════════════════════════════════════════════════════════
   13. CONTACT FORM
   ═══════════════════════════════════════════════════════════════ */

.ailo-contact-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
  width: 100%;
}

.ailo-contact-form__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ailo-contact-form__label {
  font-size: var(--ailo-text-xs);
  font-weight: 600;
  color: var(--ailo-text-1);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.ailo-contact-form__input {
  padding: 10px 14px;
  background: var(--ailo-input-bg);
  border: 1.5px solid var(--ailo-input-border);
  border-radius: var(--ailo-r-md);
  font-family: var(--ailo-font);
  font-size: var(--ailo-text-base);
  color: var(--ailo-text-1);
  outline: none;
  transition: border-color var(--ailo-dur-fast);
}

.ailo-contact-form__input:focus {
  border-color: var(--ailo-input-focus);
}

#ailo-chat-root[data-theme="dark"] .ailo-contact-form__input {
  background: #2E2922;
  border-color: rgba(255,240,220,.10);
  color: #F5EFE6;
}

#ailo-chat-root[data-theme="dark"] .ailo-contact-form__input::placeholder {
  color: #8C7E72;
}

#ailo-chat-root[data-theme="dark"] .ailo-contact-form__input:focus {
  border-color: rgba(255,45,135,.4);
  box-shadow: 0 0 0 2px rgba(255,45,135,.15);
}

.ailo-contact-form__submit {
  padding: 12px 20px;
  background: var(--ailo-brand);
  color: #fff;
  border: none;
  border-radius: var(--ailo-r-md);
  font-family: var(--ailo-font);
  font-size: var(--ailo-text-base);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ailo-dur-fast), transform var(--ailo-dur-fast);
}

.ailo-contact-form__submit:hover {
  background: var(--ailo-brand-dark);
  transform: scale(1.02);
}


/* ═══════════════════════════════════════════════════════════════
   14. FLOATING WHATSAPP BUTTON (inside window)
   ═══════════════════════════════════════════════════════════════ */

.ailo-floating-wa {
  position: absolute;
  bottom: 68px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px 9px 10px;
  background: #25D366;
  color: #fff;
  border-radius: 100px;
  text-decoration: none;
  font-size: var(--ailo-text-sm);
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(37,211,102,.40);
  transition: background var(--ailo-dur-fast),
              transform var(--ailo-dur-fast),
              box-shadow var(--ailo-dur-fast);
  z-index: 2;
}

.ailo-floating-wa:hover {
  background: #128C7E;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(37,211,102,.45);
  color: #fff;
}

.ailo-floating-wa svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: block;
  fill: currentColor;
}

/* Header-inline WA variant — no absolute positioning, sits as flex child in header */
.ailo-header-wa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 9px;
  background: #25D366;
  color: #fff;
  border-radius: 100px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--ailo-dur-fast), transform var(--ailo-dur-fast);
}

.ailo-header-wa:hover {
  background: #128C7E;
  transform: scale(1.04);
  color: #fff;
}

.ailo-header-wa svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}


/* ═══════════════════════════════════════════════════════════════
   15. MISC: DIVIDERS, DATES, BADGES
   ═══════════════════════════════════════════════════════════════ */

.ailo-date-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.ailo-date-divider::before,
.ailo-date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ailo-border);
}

.ailo-date-divider__text {
  font-size: var(--ailo-text-xs);
  color: var(--ailo-text-3);
  white-space: nowrap;
}

.ailo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--ailo-r-full);
  background: #FF3B30;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

/* Unread dot on FAB */
.ailo-fab__unread {
  position: absolute;
  top: 0;
  right: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #FF3B30;
  border: 2px solid #fff;
}


/* ═══════════════════════════════════════════════════════════════
   16. ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════ */

.ailo-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  #ailo-chat-root *,
  #ailo-chat-root *::before,
  #ailo-chat-root *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* Focus rings */
#ailo-chat-root :focus-visible {
  outline: 2px solid var(--ailo-brand);
  outline-offset: 2px;
}


/* ═══════════════════════════════════════════════════════════════
   17. MOBILE OVERRIDES (max-width: 480px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  .ailo-fab {
    bottom: 16px !important;
    right: 16px !important;
  }

  .ailo-header {
    padding: 0 14px;
  }

  .ailo-messages {
    padding: 12px 10px 6px;
  }

  .ailo-motive-grid {
    padding: 6px 12px 10px;
    gap: 6px;
  }

  .ailo-motive-tile {
    padding: 12px 10px;
    gap: 8px;
  }

  .ailo-welcome {
    padding: 0 0 6px;
  }

  .ailo-input-bar {
    padding: 8px 10px;
  }

  .ailo-floating-wa {
    bottom: 62px;
    right: 10px;
    padding: 8px 12px 8px 9px;
  }
}


/* ═══════════════════════════════════════════════════════════════
   18. OPERATOR BOTTOM SHEET MODAL
   ═══════════════════════════════════════════════════════════════ */

/* Overlay container — appended inside #ailo-window (position:fixed), so absolute anchors to drawer bounds */
#ailo-operator-sheet {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: stretch;
}

#ailo-operator-sheet.active {
  display: flex;
}

/* Semi-transparent overlay (click to close) */
#ailo-operator-sheet .ailo-sheet-overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0,0,0,.45);
}

/* Slide-up content panel */
#ailo-operator-sheet .ailo-sheet-content {
  position: relative;
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--ailo-surface);
  border-radius: 16px 16px 0 0;
  padding: 8px 16px 24px;
  z-index: 1;
  box-shadow: 0 -4px 24px rgba(0,0,0,.18);
}

/* Drag handle */
#ailo-operator-sheet .ailo-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--ailo-surface-3);
  margin: 8px auto 14px;
}

/* Sheet title */
#ailo-operator-sheet .ailo-sheet-header {
  font-size: var(--ailo-text-md);
  font-weight: 600;
  color: var(--ailo-text-1);
  margin-bottom: 12px;
}

/* Operator list */
#ailo-operator-sheet .ailo-operators {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Single operator row */
#ailo-operator-sheet .ailo-operator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--ailo-surface-2);
  border-radius: var(--ailo-r-md);
  text-decoration: none;
  color: var(--ailo-text-1);
  transition: background var(--ailo-dur-fast);
}

#ailo-operator-sheet .ailo-operator:hover {
  background: var(--ailo-surface-3);
}

#ailo-operator-sheet .ailo-operator-meta {
  flex: 1;
  min-width: 0;
}

#ailo-operator-sheet .ailo-op-name {
  font-size: var(--ailo-text-sm);
  font-weight: 600;
  color: var(--ailo-text-1);
}

#ailo-operator-sheet .ailo-op-sub {
  font-size: var(--ailo-text-xs);
  color: var(--ailo-text-3);
  margin-top: 2px;
}

#ailo-operator-sheet .ailo-op-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ADE80;
  flex-shrink: 0;
}

/* Operator avatar initials fallback */
#ailo-operator-sheet .eai-wa-op-initials-sheet {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ailo-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
}
