/* Yoonix Support — Intercom-style messenger */
:root {
  --yx-s-ink: #0b1220;
  --yx-s-muted: #64748b;
  --yx-s-faint: #94a3b8;
  --yx-s-line: rgba(15, 23, 42, 0.08);
  --yx-s-soft: #f5f7fb;
  --yx-s-blue: #2f6bff;
  --yx-s-blue-deep: #1d4ed8;
  --yx-s-ok: #10b981;
  --yx-s-radius: 22px;
}

.yx-support-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(8, 15, 30, 0.28);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.yx-support-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.yx-support-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 12001;
  width: min(400px, calc(100vw - 24px));
  height: min(680px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--yx-s-radius);
  background: #fff;
  color: var(--yx-s-ink);
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.06),
    0 24px 64px rgba(15, 23, 42, 0.22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  transform: translateY(18px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transform-origin: 100% 100%;
  transition:
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.22s ease;
}
.yx-support-widget.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* —— Hero header —— */
.yx-support-hero {
  position: relative;
  flex: 0 0 auto;
  padding: 18px 16px 16px;
  color: #fff;
  background: linear-gradient(145deg, #4f7dff 0%, #2a56ef 48%, #1e3fcf 100%);
  overflow: hidden;
}
.yx-support-hero__glow {
  position: absolute;
  inset: -40% -20% auto auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.28), transparent 68%);
  pointer-events: none;
}
.yx-support-hero__row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.yx-support-hero__text {
  flex: 1;
  min-width: 0;
}
.yx-support-hero__text h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.yx-support-hero__text p {
  margin: 3px 0 0;
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yx-support-online {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5eead4;
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.28);
  flex: 0 0 auto;
  animation: yx-pulse 2s ease infinite;
}
@keyframes yx-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.28); }
  50% { box-shadow: 0 0 0 5px rgba(94, 234, 212, 0.12); }
}

.yx-support-hero__mark {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
}
.yx-support-hero__mark svg { width: 18px; height: 18px; }

.yx-support-hero__actions {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
}
.yx-support-iconbtn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease;
  padding: 0;
}
.yx-support-iconbtn svg { width: 16px; height: 16px; }
.yx-support-iconbtn:hover,
.yx-support-iconbtn.is-on { background: rgba(255, 255, 255, 0.24); }
.yx-support-back[hidden] { display: none !important; }

.yx-support-menu {
  position: absolute;
  top: calc(100% - 6px);
  right: 12px;
  z-index: 5;
  min-width: 190px;
  padding: 6px;
  border-radius: 14px;
  background: #fff;
  color: var(--yx-s-ink);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  border: 1px solid var(--yx-s-line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.yx-support-menu[hidden] { display: none !important; }
.yx-support-menu button,
.yx-support-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.yx-support-menu button:hover,
.yx-support-menu a:hover { background: var(--yx-s-soft); }
.yx-support-menu svg { width: 15px; height: 15px; color: var(--yx-s-muted); }

/* —— Body —— */
.yx-support-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f3f6fb;
}

.yx-support-loading {
  margin: auto;
  display: flex;
  gap: 6px;
}
.yx-support-loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #93c5fd;
  animation: yx-bounce 1s ease infinite;
}
.yx-support-loading span:nth-child(2) { animation-delay: 0.12s; }
.yx-support-loading span:nth-child(3) { animation-delay: 0.24s; }
@keyframes yx-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-5px); opacity: 1; }
}

/* —— Home / welcome —— */
.yx-support-home,
.yx-support-chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.yx-support-welcome {
  flex: 1;
  overflow: auto;
  padding: 18px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.yx-support-welcome__card {
  background: #fff;
  border-radius: 18px;
  padding: 18px 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  border: 1px solid var(--yx-s-line);
}
.yx-support-welcome__card h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.yx-support-welcome__card p {
  margin: 0;
  color: var(--yx-s-muted);
  font-size: 13.5px;
  line-height: 1.5;
}

/* —— Thread —— */
.yx-support-thread {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}
.yx-support-daychip {
  align-self: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--yx-s-muted);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--yx-s-line);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 4px;
}

.yx-support-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  align-items: flex-end;
  animation: yx-msg-in 0.22s ease;
}
@keyframes yx-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.yx-support-msg--customer {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.yx-support-msg--platform { align-self: flex-start; }
.yx-support-msg__av {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #4f7dff, #2a56ef);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}
.yx-support-msg__av svg { width: 13px; height: 13px; display: block; }

.yx-support-bubble {
  position: relative;
  padding: 10px 12px 8px;
  border-radius: 16px;
  max-width: 100%;
}
.yx-support-bubble__text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.45;
}
.yx-support-bubble time {
  display: block;
  margin-top: 4px;
  font-size: 10.5px;
  opacity: 0.7;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.yx-support-bubble--customer {
  color: #fff;
  background: linear-gradient(145deg, #4f7dff, #2a56ef);
  border-bottom-right-radius: 5px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.22);
}
.yx-support-bubble--platform {
  background: #fff;
  border: 1px solid var(--yx-s-line);
  border-bottom-left-radius: 5px;
  color: var(--yx-s-ink);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

/* —— Composer —— */
.yx-support-composer {
  flex: 0 0 auto;
  padding: 10px 12px 14px;
  background: linear-gradient(180deg, transparent, #f3f6fb 28%);
  position: relative;
}
.yx-support-composer__box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--yx-s-line);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.yx-support-composer textarea {
  flex: 1;
  border: 0;
  resize: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 14.5px;
  line-height: 1.4;
  min-height: 28px;
  max-height: 120px;
  padding: 8px 0;
  color: var(--yx-s-ink);
}
.yx-support-composer textarea::placeholder { color: var(--yx-s-faint); }
.yx-support-send {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #4f7dff, #2a56ef);
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.28);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.yx-support-send svg { width: 16px; height: 16px; margin-left: 1px; }
.yx-support-send:hover { transform: scale(1.04); }
.yx-support-send:disabled { opacity: 0.55; cursor: wait; transform: none; }
.yx-support-err {
  margin: 6px 4px 0;
  color: #dc2626;
  font-size: 12px;
  font-weight: 600;
}

/* —— History —— */
.yx-support-history {
  flex: 1;
  overflow: auto;
  padding: 10px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.yx-support-hitem {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 1px solid var(--yx-s-line);
  background: #fff;
  border-radius: 16px;
  padding: 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.yx-support-hitem:hover {
  border-color: #bfdbfe;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.08);
}
.yx-support-hitem__av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #eff6ff;
  color: var(--yx-s-blue-deep);
  flex: 0 0 auto;
}
.yx-support-hitem__av svg { width: 20px; height: 20px; }
.yx-support-hitem__av.is-done { background: #ecfdf5; color: var(--yx-s-ok); }
.yx-support-hitem__main { flex: 1; min-width: 0; }
.yx-support-hitem__top {
  display: flex;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
}
.yx-support-hitem__top strong {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yx-support-hitem__top time {
  font-size: 11px;
  color: var(--yx-s-faint);
  flex: 0 0 auto;
}
.yx-support-hitem__preview {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--yx-s-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.yx-support-empty {
  margin: auto;
  text-align: center;
  color: var(--yx-s-muted);
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.yx-support-pillbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, #4f7dff, #2a56ef);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
}
.yx-support-pillbtn svg { width: 16px; height: 16px; }
.yx-support-pillbtn--ghost {
  background: #fff;
  color: var(--yx-s-blue-deep);
  border: 1px solid #dbeafe;
  box-shadow: none;
  margin-top: 6px;
  align-self: center;
}

/* Dark cabinets */
body:not(.platform-app--light):not(.workspace-hrm) .yx-support-widget {
  background: #0b1220;
  color: #e2e8f0;
  box-shadow:
    0 0 0 1px rgba(148, 163, 184, 0.12),
    0 24px 64px rgba(0, 0, 0, 0.5);
}
body:not(.platform-app--light):not(.workspace-hrm) .yx-support-body {
  background: #0a101c;
}
body:not(.platform-app--light):not(.workspace-hrm) .yx-support-welcome__card,
body:not(.platform-app--light):not(.workspace-hrm) .yx-support-bubble--platform,
body:not(.platform-app--light):not(.workspace-hrm) .yx-support-composer__box,
body:not(.platform-app--light):not(.workspace-hrm) .yx-support-hitem,
body:not(.platform-app--light):not(.workspace-hrm) .yx-support-daychip,
body:not(.platform-app--light):not(.workspace-hrm) .yx-support-menu,
body:not(.platform-app--light):not(.workspace-hrm) .yx-support-pillbtn--ghost {
  background: #111827;
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.14);
}
body:not(.platform-app--light):not(.workspace-hrm) .yx-support-composer textarea,
body:not(.platform-app--light):not(.workspace-hrm) .yx-support-welcome__card p,
body:not(.platform-app--light):not(.workspace-hrm) .yx-support-hitem__preview {
  color: #94a3b8;
}
body:not(.platform-app--light):not(.workspace-hrm) .yx-support-composer textarea {
  color: #e2e8f0;
}

@media (max-width: 520px) {
  .yx-support-widget {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
}
