.crm-ai-wrap {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483000;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.crm-ai-toggle {
  display: grid;
  width: 60px;
  height: 60px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent-bright, #635bff), var(--accent-deep, #3d22d7));
  color: #fff;
  font-size: 28px;
  box-shadow: 0 12px 28px rgba(58, 42, 205, .35);
  cursor: pointer;
}

.crm-ai-toggle:hover { transform: translateY(-2px); }

.crm-ai-panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  display: grid;
  width: min(360px, calc(100vw - 28px));
  height: min(520px, calc(100dvh - 105px));
  overflow: hidden;
  grid-template-rows: auto 1fr auto auto;
  border: 1px solid var(--line, #dce4f2);
  border-radius: 18px;
  background: var(--white, #fff);
  box-shadow: 0 18px 50px rgba(23, 33, 60, .2);
}

.crm-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--accent-bright, #635bff), var(--accent-deep, #3d22d7));
  color: #fff;
}

.crm-ai-header div { display: grid; gap: 2px; }
.crm-ai-header strong { font-size: 1rem; }
.crm-ai-header span { font-size: .76rem; opacity: .84; }
.crm-ai-header button { border: 0; background: transparent; color: inherit; font-size: 1.6rem; cursor: pointer; }

.crm-ai-messages { display: grid; align-content: start; gap: 10px; overflow-y: auto; padding: 14px; background: var(--soft, #f7f9ff); }
.crm-ai-message { display: flex; max-width: 92%; }
.crm-ai-message.user { justify-content: flex-end; margin-left: auto; }
.crm-ai-bubble { padding: 10px 12px; border-radius: 14px; background: var(--white, #fff); color: var(--ink, #17213c); line-height: 1.4; white-space: pre-wrap; }
.crm-ai-message.user .crm-ai-bubble { background: var(--accent, #5234f3); color: #fff; }

.crm-ai-chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px; border-top: 1px solid var(--line, #dce4f2); }
.crm-ai-chips button { flex: 0 0 auto; padding: 7px 10px; border: 1px solid var(--line, #dce4f2); border-radius: 999px; background: var(--white, #fff); color: var(--ink, #17213c); font-size: .76rem; cursor: pointer; }

.crm-ai-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px; border-top: 1px solid var(--line, #dce4f2); background: var(--white, #fff); }
.crm-ai-form input { min-width: 0; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line, #dce4f2); border-radius: 10px; background: var(--white, #fff); color: var(--ink, #17213c); }
.crm-ai-form button { min-width: 62px; border: 0; border-radius: 10px; background: var(--accent, #5234f3); color: #fff; font-weight: 800; cursor: pointer; }
.crm-ai-form button:disabled { opacity: .65; cursor: wait; }

@media (max-width: 600px) {
  .crm-ai-wrap { right: 14px; bottom: 14px; }
  .crm-ai-toggle { width: 54px; height: 54px; border-radius: 17px; font-size: 25px; }
  .crm-ai-panel { right: 0; bottom: 66px; width: min(360px, calc(100vw - 20px)); height: min(560px, calc(100dvh - 92px)); }
}
