.ai-support {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2200;
  font-family: Inter, Arial, sans-serif;
  color: #071225;
}

.ai-support * {
  box-sizing: border-box;
}

.ai-support-fab {
  min-width: 142px;
  height: 54px;
  border: 1px solid rgba(21, 92, 255, .22);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 14px 0 10px;
  color: #071225;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.ai-support-fab:hover {
  transform: translateY(-2px);
  border-color: rgba(21, 92, 255, .5);
  box-shadow: 0 18px 42px rgba(15, 23, 42, .2);
}

.ai-fab-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  color: #fff;
  background: #155cff;
}

.ai-fab-icon i {
  font-size: 20px;
}

.ai-fab-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.08;
}

.ai-fab-copy b {
  color: #071225;
  font-size: 13px;
  font-weight: 900;
}

.ai-fab-copy small {
  margin-top: 4px;
  color: #10b981;
  font-size: 11px;
  font-weight: 900;
}

.ai-support-panel {
  position: absolute;
  right: 0;
  bottom: 68px;
  width: min(408px, calc(100vw - 28px));
  height: min(612px, calc(100vh - 108px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 74px rgba(15, 23, 42, .23);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity .16s ease, transform .16s ease;
}

.ai-support.open .ai-support-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.ai-support-head {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid #e7edf5;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
}

.ai-support-id {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-support-logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid #e5eaf2;
  border-radius: 8px;
  background: #fff;
}

.ai-support-logo img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.ai-support-id b,
.ai-support-id small {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-support-id b {
  color: #071225;
  font-size: 15px;
  font-weight: 950;
}

.ai-support-id small {
  margin-top: 5px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.ai-support-id small i {
  color: #10b981;
  font-size: 8px;
}

.ai-support-close {
  width: 36px;
  height: 36px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #fff;
  color: #64748b;
  cursor: pointer;
}

.ai-support-close:hover {
  color: #071225;
  border-color: #cbd5e1;
}

.ai-support-quick {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #edf2f7;
  background: #fff;
}

.ai-support-quick button {
  min-width: 0;
  min-height: 54px;
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 4px;
  background: #f8fafc;
  color: #334155;
  font: inherit;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease;
}

.ai-support-quick button:hover {
  border-color: #155cff;
  background: #fff;
  color: #155cff;
}

.ai-support-quick i {
  font-size: 18px;
}

.ai-support-quick span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 900;
}

.ai-support-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px;
  background: #f8fafc;
}

.ai-msg {
  max-width: 88%;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-msg.user {
  margin-left: auto;
  align-items: flex-end;
}

.ai-msg.assistant {
  margin-right: auto;
  align-items: flex-start;
}

.ai-bubble {
  width: fit-content;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.48;
  font-size: 14px;
  font-weight: 650;
}

.ai-msg.user .ai-bubble {
  color: #fff;
  background: #155cff;
  box-shadow: 0 8px 18px rgba(21, 92, 255, .16);
}

.ai-msg.assistant .ai-bubble {
  color: #0f172a;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.ai-meta {
  padding-left: 2px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 850;
}

.ai-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
}

.ai-link-row a {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  padding: 0 10px;
  color: #155cff;
  background: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
}

.ai-typing {
  width: 48px;
  display: inline-flex;
  justify-content: center;
  gap: 4px;
}

.ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: aiTyping 1s infinite ease-in-out;
}

.ai-typing span:nth-child(2) { animation-delay: .12s; }
.ai-typing span:nth-child(3) { animation-delay: .24s; }

@keyframes aiTyping {
  0%, 80%, 100% { opacity: .35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-4px); }
}

.ai-support-form {
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid #e5eaf2;
  background: #fff;
}

.ai-support-form textarea {
  width: 100%;
  max-height: 112px;
  resize: none;
  border: 1px solid #d7deea;
  border-radius: 8px;
  padding: 12px;
  color: #0f172a;
  background: #fff;
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  outline: none;
}

.ai-support-form textarea:focus {
  border-color: #155cff;
  box-shadow: 0 0 0 3px rgba(21, 92, 255, .1);
}

.ai-support-form button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #155cff;
  cursor: pointer;
}

.ai-support-form button:disabled {
  opacity: .58;
  cursor: wait;
}

.ai-support-form button i {
  font-size: 20px;
}

@media (max-width: 560px) {
  .ai-support {
    right: 12px;
    bottom: 12px;
  }

  .ai-support-fab {
    min-width: 54px;
    width: 54px;
    height: 54px;
    padding: 0;
  }

  .ai-fab-copy {
    display: none;
  }

  .ai-support-panel {
    right: 0;
    bottom: 64px;
    width: calc(100vw - 24px);
    height: min(568px, calc(100vh - 92px));
  }

  .ai-support-quick {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-support-quick button {
    min-height: 44px;
    flex-direction: row;
  }
}
