.iqc, .iqc * { box-sizing: border-box; }
.iqc {
  --iqc-color: #1f6feb;
  --iqc-bg: #ffffff;
  --iqc-text: #1c2230;
  --iqc-muted: #6b7385;
  --iqc-line: #e3e7ee;
  --iqc-bot: #f1f3f8;
  --iqc-on: #ffffff;
  --iqc-head: var(--iqc-color);
  --iqc-head-on: #ffffff;
  --iqc-input: #ffffff;
  --iqc-bot-on: #1c2230;
  --iqc-r-panel: 18px; --iqc-r-bubble: 16px; --iqc-r-tail: 5px; --iqc-r-input: 14px; --iqc-r-chip: 999px; --iqc-r-send: 50%; --iqc-r-teaser: 14px;
  position: fixed; bottom: 20px; z-index: 999999;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--iqc-text);
}
.iqc-right { right: 20px; } .iqc-left { left: 20px; }
.iqc button, .iqc textarea { font: inherit; color: inherit; }
.iqc .iqc-launcher, .iqc .iqc-send { color: var(--iqc-on); }
.iqc .iqc-close { color: var(--iqc-head-on); }
.iqc .iqc-chip { color: var(--iqc-text); }
.iqc .iqc-chip:hover { color: var(--iqc-on); }

/* Colors are set from the admin; this only softens the green notice on dark windows */
.iqc-dark .iqc-note { color: #7be0a8; background: #1f3a2d; }

/* Corner styles (set from the admin) */
.iqc-corners-soft { --iqc-r-panel: 10px; --iqc-r-bubble: 10px; --iqc-r-tail: 4px; --iqc-r-input: 8px; --iqc-r-chip: 8px; --iqc-r-send: 8px; --iqc-r-teaser: 8px; }
.iqc-corners-square { --iqc-r-panel: 3px; --iqc-r-bubble: 3px; --iqc-r-tail: 3px; --iqc-r-input: 3px; --iqc-r-chip: 3px; --iqc-r-send: 3px; --iqc-r-teaser: 3px; }

/* Launcher */
.iqc-launcher {
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--iqc-color); color: var(--iqc-on); display: grid; place-items: center;
  box-shadow: 0 6px 22px rgba(0,0,0,.28); transition: transform .18s ease, box-shadow .18s ease;
  margin-left: auto; position: relative;
}
.iqc-left .iqc-launcher { margin-left: 0; margin-right: auto; }
.iqc-launcher:hover { transform: scale(1.06); }
.iqc-launcher:focus-visible, .iqc-chip:focus-visible, .iqc-send:focus-visible, .iqc-close:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px var(--iqc-color); }
.iqc-ic-close { display: none; }
.iqc-open .iqc-ic-chat { display: none; } .iqc-open .iqc-ic-close { display: block; }

/* Teaser bubble */
.iqc-teaser {
  position: absolute; bottom: 74px; right: 0; display: flex; align-items: center; gap: 2px;
  background: var(--iqc-bg); border-radius: var(--iqc-r-teaser); box-shadow: 0 6px 22px rgba(0,0,0,.2);
  padding: 4px 4px 4px 4px; animation: iqc-pop .35s ease both; white-space: nowrap;
}
.iqc-left .iqc-teaser { right: auto; left: 0; }
.iqc-teaser[hidden] { display: none; }
.iqc-teaser-text { background: none; border: 0; cursor: pointer; padding: 8px 6px 8px 12px; font-weight: 600; color: var(--iqc-text); }
.iqc-teaser-x { background: none; border: 0; cursor: pointer; color: var(--iqc-muted); font-size: 20px; line-height: 1; padding: 6px 10px; }

/* Panel */
.iqc-panel {
  position: absolute; bottom: 76px; right: 0; width: 380px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 120px);
  background: var(--iqc-bg); border-radius: var(--iqc-r-panel); overflow: hidden;
  box-shadow: 0 14px 48px rgba(0,0,0,.3); display: flex; flex-direction: column;
  animation: iqc-pop .25s ease both; transform-origin: bottom right;
}
.iqc-left .iqc-panel { right: auto; left: 0; transform-origin: bottom left; }
.iqc-panel[hidden] { display: none; }

.iqc-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--iqc-head); color: var(--iqc-head-on); }
.iqc-avatar { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center; font-weight: 700; font-size: 17px; flex: none; }
.iqc-avatar { overflow: hidden; }
.iqc-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.iqc-row.iqc-bot { align-items: flex-end; gap: 8px; }
.iqc-avatar-msg { width: 28px; height: 28px; font-size: 13px; background: var(--iqc-color); color: var(--iqc-on); }
.iqc-titles { flex: 1; min-width: 0; }
.iqc-title { font-weight: 700; font-size: 16px; line-height: 1.2; }
.iqc-sub { font-size: 12.5px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iqc-close { background: none; border: 0; color: var(--iqc-head-on); font-size: 28px; line-height: 1; cursor: pointer; padding: 2px 6px; opacity: .9; }
.iqc-close:hover { opacity: 1; }

.iqc-log { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; }
.iqc-row { display: flex; }
.iqc-row.iqc-user { justify-content: flex-end; }
.iqc-bubble { max-width: 84%; padding: 9px 13px; border-radius: var(--iqc-r-bubble); overflow-wrap: anywhere; }
.iqc-bot .iqc-bubble { background: var(--iqc-bot); color: var(--iqc-bot-on); border-bottom-left-radius: var(--iqc-r-tail); }
.iqc-user .iqc-bubble { background: var(--iqc-color); color: var(--iqc-on); border-bottom-right-radius: var(--iqc-r-tail); white-space: pre-wrap; }
.iqc-bubble p { margin: 0; } .iqc-bubble p + p { margin-top: 6px; }
.iqc-bubble ul { margin: 4px 0 2px; padding-left: 18px; } .iqc-bubble li { margin: 2px 0; }
.iqc-bubble a { color: inherit; text-decoration: underline; }
.iqc-note { align-self: center; font-size: 12.5px; color: #1a7f4b; background: #e7f6ee; padding: 4px 12px; border-radius: 999px; }

.iqc-typing .iqc-bubble { display: flex; gap: 4px; padding: 13px 14px; }
.iqc-typing .iqc-bubble span { width: 7px; height: 7px; border-radius: 50%; background: #98a1b5; animation: iqc-dot 1.1s infinite ease-in-out; }
.iqc-typing .iqc-bubble span:nth-child(2) { animation-delay: .15s; } .iqc-typing .iqc-bubble span:nth-child(3) { animation-delay: .3s; }

.iqc-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 14px 10px; }
.iqc-chip { background: var(--iqc-bg); color: var(--iqc-text); border: 1.5px solid var(--iqc-color); border-radius: var(--iqc-r-chip); padding: 6px 13px; cursor: pointer; font-weight: 600; font-size: 14px; }
.iqc-chip:hover { background: var(--iqc-color); color: var(--iqc-on); }

.iqc .iqc-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; margin: 0; border: 0; border-top: 1px solid var(--iqc-line); border-radius: 0; background: transparent; box-shadow: none; max-width: none; }
.iqc .iqc-input { flex: 1; resize: none; margin: 0; width: auto; box-shadow: none; border: 1.5px solid var(--iqc-line); border-radius: var(--iqc-r-input); padding: 9px 12px; max-height: 110px; min-height: 40px; background: var(--iqc-input); color: var(--iqc-text); outline: none; line-height: 1.35; overflow-y: hidden; }
.iqc .iqc-input:focus { border-color: var(--iqc-color); box-shadow: none; outline: none; }
.iqc-send { width: 40px; height: 40px; border-radius: var(--iqc-r-send); border: 0; background: var(--iqc-color); color: var(--iqc-on); cursor: pointer; display: grid; place-items: center; flex: none; }
.iqc-send:disabled, .iqc-input:disabled { opacity: .55; cursor: default; }
.iqc-foot { text-align: center; font-size: 11.5px; color: var(--iqc-muted); padding: 0 12px 9px; }

@keyframes iqc-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes iqc-dot { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

@media (max-width: 520px) {
  .iqc { bottom: 14px; } .iqc-right { right: 14px; } .iqc-left { left: 14px; }
  .iqc-panel { position: fixed; inset: 0; width: 100vw; max-width: none; height: 100%; max-height: none; border-radius: 0; }
  .iqc-open .iqc-launcher { display: none; }
  .iqc-input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .iqc *, .iqc-panel, .iqc-teaser { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
