/* THS AI Widget (minimal, clean) */
#ths-ai-bubble {
  position: fixed;
  right: 18px;
  bottom: 78px;
  z-index: 999999;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0,0,0,.18);
  background: #031d79;
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#ths-ai-panel {
  position: fixed;
  right: 18px;
  bottom: 86px;
  z-index: 999999;
  width: 340px;
  max-width: calc(100vw - 36px);
  height: 520px;
  max-height: calc(100vh - 140px);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(0,0,0,.22);
  overflow: hidden;
  display: none;
  border: 1px solid rgba(0,0,0,.08);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

#ths-ai-panel.open { display: flex; flex-direction: column; }

#ths-ai-header {
  background: #031d79;
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#ths-ai-header .title {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
}
#ths-ai-header .sub {
  font-size: 12px;
  opacity: .9;
}

#ths-ai-close {
  background: rgba(255,255,255,.16);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
}

#ths-ai-messages {
  padding: 12px;
  overflow: auto;
  flex: 1;
  background: #f7f8fb;
}

.ths-msg {
  margin: 8px 0;
  display: flex;
}
.ths-msg.user { justify-content: flex-end; }
.ths-msg .bubble {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}
.ths-msg.user .bubble {
  background: #031d79;
  color: #fff;
  border-bottom-right-radius: 6px;
}
.ths-msg.bot .bubble {
  background: #fff;
  color: #111;
  border: 1px solid rgba(0,0,0,.08);
  border-bottom-left-radius: 6px;
}

#ths-ai-typing {
  display: none;
  padding: 0 12px 8px 12px;
  color: #666;
  font-size: 12px;
}

#ths-ai-footer {
  padding: 10px;
  border-top: 1px solid rgba(0,0,0,.08);
  background: #fff;
}

#ths-ai-input-row {
  display: flex;
  gap: 8px;
}
#ths-ai-input {
  flex: 1;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
#ths-ai-send {
  border: none;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  background: #031d79;
  color: #fff;
  font-weight: 700;
}

#ths-ai-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ths-chip {
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

/* Callback panel – compact + scrollable */
#ths-ai-callback {
  display: none;
  margin-top: 10px;
  padding: 10px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);

  max-height: 220px;          /* KEY */
  overflow-y: auto;           /* KEY */
}

/* Grid layout */
#ths-ai-callback .grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Inputs */
#ths-ai-callback input {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.14);
}

/* Full-width inputs */
#ths-cb-name,
#ths-cb-time {
  grid-column: span 2;
}

/* Consent */
#ths-ai-callback .consent {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  color: #333;
  margin: 8px 0;
}

/* Button */
#ths-cb-submit {
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  font-weight: 700;
  background: #031d79;
  color: #fff;
  border: none;
  cursor: pointer;
}

/* Small note */
#ths-ai-small {
  font-size: 11.5px;
  color: #666;
  margin-top: 6px;
  text-align: center;
}

