/* Base */
.ms-ai-chat { font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial; }
.ms-ai-chat__card {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.06);
}

.ms-ai-chat__header {
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(14, 116, 144, 0.10), rgba(14, 116, 144, 0.00));
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.ms-ai-chat__title { font-weight: 700; font-size: 15px; color: #0f172a; }
.ms-ai-chat__subtitle { font-size: 12px; color: rgba(15,23,42,0.65); margin-top: 2px; }

.ms-ai-chat__header-actions{
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}
.ms-ai-chat__appt{
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #fff;
  color: #0f172a;
  font-weight: 700;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
}
.ms-ai-chat__appt:hover{
  background: rgba(15,23,42,0.04);
}

.ms-ai-chat__body {
  height: 340px;
  overflow-y: auto;
  padding: 14px;
  background: #fbfdff;
}

.ms-ai-chat__msg { display: flex; margin: 10px 0; }
.ms-ai-chat__msg--user { justify-content: flex-end; }
.ms-ai-chat__msg--bot { justify-content: flex-start; }

.ms-ai-chat__bubble {
  max-width: 84%;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}
.ms-ai-chat__msg--user .ms-ai-chat__bubble {
  background: #0ea5b5;
  border-color: rgba(14, 165, 181, 0.25);
  color: #fff;
}
.ms-ai-chat__msg--bot .ms-ai-chat__bubble {
  background: #fff;
  color: #0f172a;
}

.ms-ai-chat__meta {
  font-size: 11px;
  opacity: 0.75;
  margin-bottom: 6px;
}
.ms-ai-chat__text { font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; }

.ms-ai-chat__footer {
  padding: 12px 12px 14px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  background: #ffffff;
}
.ms-ai-chat__hint { font-size: 11px; color: rgba(15,23,42,0.55); margin-bottom: 10px; }

.ms-ai-chat__row { display: flex; gap: 10px; }
.ms-ai-chat__input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  outline: none;
  font-size: 14px;
}
.ms-ai-chat__input:focus { border-color: rgba(14, 165, 181, 0.55); box-shadow: 0 0 0 4px rgba(14,165,181,0.12); }

.ms-ai-chat__btn {
  padding: 10px 14px;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  border: 0;
  cursor: pointer;
  font-weight: 600;
}
.ms-ai-chat__btn:disabled { opacity: 0.6; cursor: not-allowed; }

.ms-ai-chat__typing { display: flex; gap: 6px; padding: 6px 2px; }
.ms-ai-chat__typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(15, 23, 42, 0.35);
  animation: msTyping 1s infinite ease-in-out;
}
.ms-ai-chat__typing span:nth-child(2){ animation-delay: 0.15s; }
.ms-ai-chat__typing span:nth-child(3){ animation-delay: 0.3s; }
@keyframes msTyping {
  0%, 100% { transform: translateY(0); opacity: 0.45; }
  50% { transform: translateY(-4px); opacity: 1; }
}

/* Floating sticky button */
.ms-ai-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99999;
}
.ms-ai-fab__btn{
  border: 0;
  cursor: pointer;
  padding: 12px 14px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 12px 30px rgba(2,6,23,0.18);
}
.ms-ai-fab__dot{
  width: 10px; height: 10px; border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}

/* Floating widget */
.ms-ai-chat--floating{
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99999;
  width: 380px;
  max-width: calc(100vw - 36px);
}

.ms-ai-chat__close{
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: rgba(15,23,42,0.7);
  padding: 6px 10px;
  border-radius: 10px;
}
.ms-ai-chat__close:hover{
  background: rgba(15,23,42,0.06);
}

/* Lead Modal */
.ms-ai-modal{ position: fixed; inset: 0; z-index: 100000; }
.ms-ai-modal__backdrop{ position:absolute; inset:0; background: rgba(2,6,23,0.55); }
.ms-ai-modal__panel{
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 420px;
  max-width: calc(100vw - 36px);
  background:#fff;
  border-radius: 16px;
  overflow:hidden;
  box-shadow: 0 20px 60px rgba(2,6,23,0.28);
  border: 1px solid rgba(15,23,42,0.10);
}
.ms-ai-modal__head{
  padding: 12px 14px;
  border-bottom: 1px solid rgba(15,23,42,0.08);
  display:flex;
  align-items:center;
  gap: 10px;
  background: #fbfdff;
}
.ms-ai-modal__title{ font-weight: 800; color:#0f172a; font-size: 14px; }
.ms-ai-modal__x{
  margin-left:auto;
  border:0;
  background:transparent;
  font-size:22px;
  cursor:pointer;
  color: rgba(15,23,42,0.7);
  padding: 4px 10px;
  border-radius: 10px;
}
.ms-ai-modal__x:hover{ background: rgba(15,23,42,0.06); }
.ms-ai-modal__body{ padding: 14px; }

.ms-ai-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ms-ai-label{ display:block; font-size: 12px; font-weight: 700; color: rgba(15,23,42,0.75); margin-bottom: 6px; }
.ms-ai-field{
  width: 100%;
  border: 1px solid rgba(15,23,42,0.12);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  font-size: 13.5px;
}
.ms-ai-field:focus{ border-color: rgba(14, 165, 181, 0.55); box-shadow: 0 0 0 4px rgba(14,165,181,0.12); }

.ms-ai-modal__actions{
  display:flex;
  gap: 10px;
  justify-content:flex-end;
  margin-top: 12px;
}
.ms-ai-primary{
  border:0;
  background:#0f172a;
  color:#fff;
  font-weight:800;
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
}
.ms-ai-secondary{
  border: 1px solid rgba(15,23,42,0.14);
  background:#fff;
  color:#0f172a;
  font-weight:800;
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
}
.ms-ai-modal__note{
  margin-top: 10px;
  font-size: 11px;
  color: rgba(15,23,42,0.6);
}

@media (max-width: 480px){
  .ms-ai-chat--floating{
    right: 12px; left: 12px; width: auto; max-width: none;
  }
  .ms-ai-chat__body{ height: 50vh; }
  .ms-ai-modal__panel{
    right: 12px; left: 12px; width: auto;
  }
  .ms-ai-grid{ grid-template-columns: 1fr; }
}
