#mca-chat-bubble {
  position: fixed;
  right: 22px;
  bottom: 102px;
  z-index: 99980;
  width: 62px;
  height: 62px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--mca-btn, var(--primary-strong, #0b5d46));
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
}
#mca-chat-bubble img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  pointer-events: none;
}
#mca-chat-bubble:hover { filter: brightness(1.08); }
#mca-chat {
  position: fixed;
  right: 22px;
  bottom: 176px;
  z-index: 99981;
  width: min(380px, calc(100vw - 24px));
  height: min(540px, calc(100vh - 200px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#mca-chat[hidden] { display: none !important; }
.mca-chat-head {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
}
#mca-chat-close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
#mca-chat-msgs {
  flex: 1;
  overflow: auto;
  padding: 14px 12px;
  background: #f5f6fa;
}
.mca-chat-msg {
  max-width: 92%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
}
.mca-chat-msg.bot { background: #fff; color: #1b1d21; box-shadow: 0 4px 12px rgba(15,23,42,.06); }
.mca-chat-msg.bot.wait { color: #94a3b8; font-size: 22px; letter-spacing: 2px; }
.mca-chat-msg.bot strong, .mca-chat-msg.bot b { font-weight: 800; }
.mca-chat-msg.user { background: #e85d04; color: #fff; margin-left: auto; }
.mca-chat-items { margin: 0 0 10px; }
.mca-chat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #efe7ff;
  border-radius: 10px;
  padding: 9px 11px;
  margin-bottom: 6px;
  text-decoration: none !important;
  color: #2b1548 !important;
}
.mca-chat-item img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8fafc;
  flex-shrink: 0;
}
.mca-chat-item small { display: block; color: #e85d04; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.mca-chat-item b { display: block; font-size: 14px; }
.mca-chat-item span { display: block; color: #64748b; font-size: 12px; }
#mca-chat-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; background: #f5f6fa; }
.mca-chat-btn {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #2b1548;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none !important;
}
#mca-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #eee;
}
#mca-chat-in {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
}
#mca-chat-form button {
  border: 0;
  background: #e85d04;
  color: #fff;
  font-weight: 800;
  border-radius: 10px;
  padding: 0 14px;
  cursor: pointer;
}

@media (max-width: 700px) {
  #mca-chat-bubble {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    width: 54px;
    height: 54px;
  }
  #mca-chat-bubble img {
    width: 34px;
    height: 34px;
  }
  #mca-chat {
    right: max(8px, env(safe-area-inset-right));
    left: max(8px, env(safe-area-inset-left));
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto;
    height: min(78dvh, calc(100dvh - 16px));
    max-height: calc(100dvh - 16px);
    border-radius: 14px;
  }
  .mca-chat-head {
    padding: 14px 16px;
    font-size: 16px;
  }
  #mca-chat-close {
    min-width: 44px;
    min-height: 44px;
    font-size: 28px;
  }
  .mca-chat-item {
    padding: 12px;
    min-height: 56px;
  }
  #mca-chat-quick {
    gap: 8px;
    padding: 0 10px 12px;
  }
  .mca-chat-btn {
    flex: 1 1 calc(50% - 8px);
    min-height: 44px;
    padding: 10px 12px;
    font-size: 13px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  #mca-chat-form {
    align-items: stretch;
    padding: 10px 10px max(12px, env(safe-area-inset-bottom));
  }
  #mca-chat-in {
    min-height: 44px;
    font-size: 16px;
  }
  #mca-chat-form button {
    min-height: 44px;
    padding: 0 16px;
    font-size: 14px;
  }
}
