/* yus chat dock — bottom-right AI-ish assistant (inspired by ETL Erleah popup pattern) */
.yus-chat-root {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 1200;
  font-family: var(--font-body, system-ui, sans-serif);
  color: var(--ink, #0c0f11);
}

.yus-chat-launch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  cursor: pointer;
  padding: 12px 14px 12px 12px;
  border-radius: 999px;
  background: var(--ink, #0c0f11);
  color: var(--bg, #fff);
  box-shadow:
    0 10px 30px rgba(12, 15, 17, 0.18),
    0 0 0 1px color-mix(in srgb, var(--accent, #e91e5c) 35%, transparent);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.yus-chat-launch:hover {
  transform: translateY(-2px);
  box-shadow:
    0 14px 34px rgba(12, 15, 17, 0.22),
    0 0 0 1px var(--accent, #e91e5c);
}
.yus-chat-launch:focus-visible {
  outline: 2px solid var(--focus, #1858e0);
  outline-offset: 3px;
}
:root[data-theme="dark"] .yus-chat-launch {
  background: var(--surface, #17191c);
  color: var(--ink, #f2f3f4);
}

.yus-chat-launch-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--accent, #e91e5c) 70%, #fff), var(--accent, #e91e5c));
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
}
.yus-chat-launch-avatar::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #e91e5c) 40%, transparent);
}
.yus-chat-launch-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  text-align: left;
  padding-right: 4px;
}
.yus-chat-launch-copy strong {
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.yus-chat-launch-copy span {
  font-size: 11px;
  opacity: 0.72;
  font-weight: 600;
}
.yus-chat-launch-rec {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent, #e91e5c);
  margin-left: 2px;
}
.yus-chat-launch-rec i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, #e91e5c);
  display: block;
  animation: yus-chat-rec 1s ease-in-out infinite;
}
@keyframes yus-chat-rec {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.yus-chat-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: min(360px, calc(100vw - 28px));
  max-height: min(520px, calc(100vh - 120px));
  display: none;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg, #fff);
  border: 1px solid var(--line, #e8eaed);
  box-shadow:
    0 18px 50px rgba(12, 15, 17, 0.16),
    0 0 0 1px color-mix(in srgb, var(--accent, #e91e5c) 12%, transparent);
}
.yus-chat-root.is-open .yus-chat-panel {
  display: flex;
}
.yus-chat-root.is-open .yus-chat-launch-copy span::before {
  content: "Close · ";
}

.yus-chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  border-bottom: 1px solid var(--line, #e8eaed);
  background: var(--surface, #f7f7f8);
}
.yus-chat-head-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--accent, #e91e5c) 65%, #fff), var(--accent, #e91e5c));
  flex-shrink: 0;
}
.yus-chat-head-meta {
  flex: 1;
  min-width: 0;
}
.yus-chat-head-meta strong {
  display: block;
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.yus-chat-head-meta span {
  font-size: 11px;
  color: var(--muted, #5c6570);
  font-weight: 600;
}
.yus-chat-head-rec {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent, #e91e5c);
}
.yus-chat-head-rec i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, #e91e5c);
  animation: yus-chat-rec 1s ease-in-out infinite;
}
.yus-chat-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--line, #e8eaed);
  background: transparent;
  color: var(--ink, #0c0f11);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.yus-chat-log {
  flex: 1 1 auto;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg, #fff);
}

.yus-chat-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.yus-chat-msg.bot {
  align-self: flex-start;
  background: var(--surface, #f7f7f8);
  border: 1px solid var(--line, #e8eaed);
  border-bottom-left-radius: 4px;
}
.yus-chat-msg.user {
  align-self: flex-end;
  background: var(--ink, #0c0f11);
  color: var(--bg, #fff);
  border-bottom-right-radius: 4px;
}
:root[data-theme="dark"] .yus-chat-msg.user {
  background: var(--accent, #ff3b6b);
  color: #fff;
}

.yus-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.yus-chat-chip {
  border: 1px solid var(--line, #e8eaed);
  background: var(--bg, #fff);
  color: var(--ink, #0c0f11);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.yus-chat-chip:hover {
  border-color: var(--accent, #e91e5c);
  color: var(--accent, #e91e5c);
}

.yus-chat-compose {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line, #e8eaed);
  background: var(--surface, #f7f7f8);
}
.yus-chat-compose input {
  flex: 1;
  border: 1px solid var(--line, #e8eaed);
  border-radius: 999px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  background: var(--bg, #fff);
  color: var(--ink, #0c0f11);
}
.yus-chat-compose button {
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--accent, #e91e5c);
  color: #fff;
  cursor: pointer;
}
.yus-chat-compose button:hover {
  filter: brightness(1.05);
}

@media (prefers-reduced-motion: reduce) {
  .yus-chat-launch-rec i,
  .yus-chat-head-rec i {
    animation: none;
  }
}
