/* Ivy Quick Chat 51.1.84.10: compact, keyboard-aware mobile sheet */
:root {
  --ivy-qc-ink: #f1f6ff;
  --ivy-qc-muted: #a2b5cf;
  --ivy-qc-line: rgba(145, 185, 246, .23);
  --ivy-qc-green: #42dfa0;
  --ivy-z-quick-chat-launcher: 100050;
  --ivy-z-quick-chat-panel: 100070;
  --ivy-qc-keyboard-inset: 0px;
  --ivy-qc-viewport-height: 100dvh;
}

.ivy-quick-chat,
.ivy-quick-chat * { box-sizing: border-box; }
.ivy-quick-chat {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: var(--ivy-z-quick-chat-launcher);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  max-width: calc(100vw - 24px);
  color: var(--ivy-qc-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  isolation: isolate;
}
.ivy-quick-chat button,
.ivy-quick-chat textarea,
.ivy-quick-chat a { font-family: inherit; }

.ivy-quick-chat__launcher {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  margin: 0;
  padding: 8px 15px 8px 8px;
  border: 1px solid rgba(129, 181, 255, .42);
  border-radius: 999px;
  background: linear-gradient(145deg, rgba(14, 33, 64, .99), rgba(6, 17, 37, .99));
  color: var(--ivy-qc-ink);
  box-shadow: 0 18px 46px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .08);
  cursor: pointer;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  user-select: none;
  transition: opacity .18s ease, visibility .18s ease, transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.ivy-quick-chat__launcher:hover,
.ivy-quick-chat__launcher:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(129, 190, 255, .78);
  box-shadow: 0 22px 58px rgba(0, 0, 0, .5), 0 0 0 4px rgba(91, 157, 255, .1);
  outline: none;
}
.ivy-quick-chat[data-open="1"] .ivy-quick-chat__launcher {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(.96);
  pointer-events: none;
}
.ivy-quick-chat__launcher-avatar,
.ivy-quick-chat__avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(152, 199, 255, .4);
  border-radius: 50%;
  background: #10284d;
  color: #d7e9ff;
}
.ivy-quick-chat__launcher-avatar { width: 42px; height: 42px; flex: 0 0 42px; }
.ivy-quick-chat__avatar { width: 42px; height: 42px; flex: 0 0 42px; }
.ivy-quick-chat__launcher-avatar img,
.ivy-quick-chat__avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ivy-quick-chat__launcher-label { color: #f1f6ff; font-size: 14px; font-weight: 900; line-height: 1; white-space: nowrap; }
.ivy-quick-chat__launcher > i { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--ivy-qc-green); box-shadow: 0 0 12px rgba(66, 223, 160, .72); }

.ivy-quick-chat__panel {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--ivy-qc-keyboard-inset));
  z-index: var(--ivy-z-quick-chat-panel);
  display: flex;
  flex-direction: column;
  width: clamp(360px, 32vw, 430px);
  max-width: calc(100vw - 24px);
  height: auto;
  max-height: min(560px, calc(var(--ivy-qc-viewport-height) - 24px));
  overflow: hidden;
  border: 1px solid var(--ivy-qc-line);
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(10, 23, 45, .995), rgba(4, 10, 23, .995));
  color: var(--ivy-qc-ink);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .055);
  transform-origin: bottom right;
  animation: ivyQcPanelIn .24s cubic-bezier(.22, .78, .2, 1) both;
}
.ivy-quick-chat__panel[hidden] { display: none !important; }
@keyframes ivyQcPanelIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

.ivy-quick-chat__header {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 66px;
  flex: 0 0 auto;
  padding: 11px 13px;
  border-bottom: 1px solid var(--ivy-qc-line);
  background: rgba(8, 18, 36, .94);
}
.ivy-quick-chat__header > div { min-width: 0; flex: 1; }
.ivy-quick-chat__header strong,
.ivy-quick-chat__header small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ivy-quick-chat__header strong { color: #f4f8ff; font-size: 15px; font-weight: 900; }
.ivy-quick-chat__header small { margin-top: 2px; color: var(--ivy-qc-muted); font-size: 12px; line-height: 1.35; }
.ivy-quick-chat__close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 13px;
  background: rgba(255, 255, 255, .05);
  color: #cbd8e9;
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, color .16s ease;
}
.ivy-quick-chat__close:hover,
.ivy-quick-chat__close:focus-visible {
  transform: translateY(-1px);
  background: rgba(117, 173, 250, .13);
  border-color: rgba(117, 173, 250, .54);
  color: #fff;
  outline: 3px solid rgba(117, 173, 250, .12);
  outline-offset: 2px;
}

.ivy-quick-chat__messages {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 11px;
  min-height: 150px;
  max-height: 310px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 15px;
  scrollbar-width: thin;
  scrollbar-color: rgba(118, 175, 255, .35) transparent;
}
.ivy-quick-chat__messages::-webkit-scrollbar { width: 7px; }
.ivy-quick-chat__messages::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(118, 175, 255, .3); }
.ivy-qc-message { display: flex; align-items: flex-end; gap: 8px; width: 100%; min-width: 0; }
.ivy-qc-message--user { justify-content: flex-end; }
.ivy-qc-message__bubble {
  width: fit-content;
  min-width: 72px;
  max-width: 88%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 15px;
  color: #edf5ff;
  font-size: 14px;
  line-height: 1.55;
  word-break: normal;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}
.ivy-qc-message--assistant .ivy-qc-message__bubble { min-width: 0; background: rgba(255, 255, 255, .065); border-top-left-radius: 6px; }
.ivy-qc-message--user .ivy-qc-message__bubble { background: linear-gradient(145deg, #1b477c, #17365f); border-color: rgba(117, 173, 250, .36); border-bottom-right-radius: 6px; color: #fff; font-weight: 650; }
.ivy-qc-message.is-failed .ivy-qc-message__bubble { border-color: rgba(255, 116, 136, .46); background: rgba(255, 80, 105, .09); color: #ffdce2; }
.ivy-qc-typing { display: inline-flex; align-items: center; gap: 5px; padding: 11px 13px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 6px 15px 15px 15px; background: rgba(255, 255, 255, .06); }
.ivy-qc-typing i { width: 6px; height: 6px; border-radius: 50%; background: #8abdfd; animation: ivyQcDot 1.1s ease-in-out infinite; }
.ivy-qc-typing i:nth-child(2) { animation-delay: .15s; }
.ivy-qc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ivyQcDot { 0%, 70%, 100% { transform: translateY(0); opacity: .45; } 35% { transform: translateY(-4px); opacity: 1; } }
.ivy-quick-chat__error { margin: 0 15px 9px; padding: 9px 11px; border: 1px solid rgba(255, 111, 133, .35); border-radius: 11px; background: rgba(118, 24, 40, .78); color: #ffd7de; font-size: 12px; line-height: 1.45; }

.ivy-quick-chat__composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  align-items: end;
  gap: 8px;
  flex: 0 0 auto;
  width: auto;
  margin: 0 13px 9px;
  padding: 6px;
  border: 1px solid rgba(145, 185, 246, .3);
  border-radius: 18px;
  background: #09182c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.ivy-quick-chat__composer:focus-within { border-color: rgba(121, 185, 255, .8); background: #0a1b31; box-shadow: 0 0 0 4px rgba(91, 157, 255, .13), inset 0 1px 0 rgba(255, 255, 255, .045); }
.ivy-quick-chat__composer textarea {
  display: block !important;
  width: 100% !important;
  height: 48px !important;
  min-height: 48px !important;
  max-height: 120px !important;
  margin: 0 !important;
  padding: 12px 10px !important;
  border: 0 !important;
  border-radius: 12px !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  background: transparent !important;
  color: #f2f7ff !important;
  -webkit-text-fill-color: #f2f7ff !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  vertical-align: middle !important;
  resize: none !important;
  overflow-y: hidden;
  box-shadow: none !important;
  outline: none !important;
}
.ivy-quick-chat__composer textarea::placeholder { color: #93a7c4 !important; -webkit-text-fill-color: #93a7c4 !important; opacity: 1; }
.ivy-quick-chat__composer button {
  display: grid;
  place-items: center;
  align-self: end;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(135deg, #76afff, #8ed0f5);
  color: #071426;
  box-shadow: 0 10px 24px rgba(55, 119, 210, .3);
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}
.ivy-quick-chat__composer button:hover,
.ivy-quick-chat__composer button:focus-visible { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 13px 28px rgba(55, 119, 210, .38); outline: 3px solid rgba(118, 175, 255, .18); outline-offset: 2px; }
.ivy-quick-chat__composer button:disabled { opacity: .48; cursor: wait; transform: none; filter: none; }
.ivy-quick-chat__composer svg { display: block; width: 20px; height: 20px; }

.ivy-quick-chat__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 0 0 auto;
  min-height: 29px;
  padding: 0 14px 11px;
  background: rgba(5, 12, 26, .95);
  color: #9cb0cb;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}
.ivy-quick-chat__footer a { color: #c4dcff !important; text-decoration: none !important; font-weight: 850; }
.ivy-quick-chat__footer a:hover,
.ivy-quick-chat__footer a:focus-visible { text-decoration: underline !important; outline-offset: 2px; }
.ivy-quick-chat__footer small { display: block; width: 100%; font-size: 12px; color: #9cb0cb; }

body.ivy-chat-page .ivy-quick-chat { display: none !important; }
body.ivy-quick-chat-open { overflow: hidden; }

body.ivy-portal-menu-open .ivy-quick-chat,
body.ivy-chat-drawer-open .ivy-quick-chat { opacity:0;visibility:hidden;pointer-events:none; }

@media (max-width: 560px) {
  .ivy-quick-chat {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }
  .ivy-quick-chat__launcher { width: 56px; height: 56px; min-height: 56px; padding: 6px; }
  .ivy-quick-chat__launcher-avatar { width: 42px; height: 42px; flex-basis: 42px; }
  .ivy-quick-chat__launcher-label,
  .ivy-quick-chat__launcher > i { display: none; }
  .ivy-quick-chat__panel {
    right: 12px;
    left: 12px;
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + var(--ivy-qc-keyboard-inset));
    width: auto;
    max-width: none;
    max-height: calc(var(--ivy-qc-viewport-height) - 20px);
    border-radius: 20px;
    transform-origin: bottom center;
  }
  .ivy-quick-chat__header { min-height: 64px; padding: 10px 11px; }
  .ivy-quick-chat__messages { min-height: 130px; max-height: none; padding: 12px; }
  .ivy-qc-message__bubble { max-width: 90%; font-size: 15px; }
  .ivy-quick-chat__composer { margin-inline: 10px; }
  .ivy-quick-chat__composer textarea { font-size: 16px !important; }
  .ivy-quick-chat__footer > span { display: none; }
}

@media (max-width: 380px) {
  .ivy-quick-chat__panel { right: 8px; left: 8px; border-radius: 18px; }
  .ivy-quick-chat__messages { padding: 10px; }
  .ivy-quick-chat__composer { margin-inline: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .ivy-quick-chat * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* 51.1.84.17 public/client presentation: deliberately different from Admin Ivy. */
.ivy-quick-chat__panel{
  border-color:rgba(38,79,116,.18);
  background:#f8fbff;
  color:#17314a;
  box-shadow:0 28px 80px rgba(15,35,58,.28),inset 0 1px rgba(255,255,255,.9);
}
.ivy-quick-chat__header{
  border-bottom-color:rgba(255,255,255,.12);
  background:linear-gradient(135deg,#102d4d,#174f7a);
}
.ivy-quick-chat__header strong{color:#fff}
.ivy-quick-chat__header small{color:#c8ddf1}
.ivy-quick-chat__close{border-color:rgba(255,255,255,.16);background:rgba(255,255,255,.08);color:#e8f3ff}
.ivy-quick-chat__messages{background:linear-gradient(180deg,#f8fbff,#f3f8fc);scrollbar-color:rgba(54,113,164,.38) transparent}
.ivy-qc-message--assistant .ivy-qc-message__bubble{border-color:#dce7f0;background:#fff;color:#233d56;box-shadow:0 8px 22px rgba(32,67,98,.07)}
.ivy-qc-message--user .ivy-qc-message__bubble{background:linear-gradient(145deg,#276fae,#1f5d92);border-color:#3f82bb;color:#fff}
.ivy-qc-typing{border-color:#dce7f0;background:#fff}
.ivy-quick-chat__composer{border-color:#ccdbe8;background:#fff;box-shadow:0 8px 25px rgba(31,67,99,.08)}
.ivy-quick-chat__composer:focus-within{border-color:#4f96cf;background:#fff;box-shadow:0 0 0 4px rgba(67,139,197,.12)}
.ivy-quick-chat__composer textarea{color:#213b54!important;-webkit-text-fill-color:#213b54!important}
.ivy-quick-chat__composer textarea::placeholder{color:#7e91a4!important;-webkit-text-fill-color:#7e91a4!important}
.ivy-quick-chat__composer button{background:linear-gradient(135deg,#286fae,#69b0e2);color:#fff}
.ivy-quick-chat__footer{border-top-color:#e3ebf2;background:#f8fbff;color:#71869a}
.ivy-quick-chat__footer a{color:#24699f!important}
