/* ============================================================
   久事法律助手浮窗（客服式） —— 暖橙主题，浅色，零外部依赖
   仅作用于浮窗自身，不污染官网其它样式（均加 .js-widget 前缀）
   ============================================================ */
.js-widget,
.js-widget * {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

/* 启动按钮：蜷缩成一团的橘色卡通小猫 */
.js-widget__launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99998;
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 50%;
  background: #fff7f1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 8px 22px rgba(217, 87, 30, 0.28);
  transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.5, 1), box-shadow 0.2s ease, opacity 0.2s ease;
}
.js-widget__launcher:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 28px rgba(217, 87, 30, 0.34);
}
.js-widget__launcher svg {
  width: 48px;
  height: 48px;
  display: block;
  transform-origin: 50% 82%;
  animation: js-widget-cat-breathe 3.4s ease-in-out infinite;
}
.js-widget__launcher:hover svg {
  animation-play-state: paused;
}
@keyframes js-widget-cat-breathe {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.06) translateY(-1.5px); }
}
.js-widget__launcher.is-hidden {
  opacity: 0;
  transform: scale(0.2) translateY(6px);
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.js-widget__launcher .js-widget__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--gold-500, #d9571e);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

/* 站立小猫：身体+尾巴在面板后方，头+前爪在面板前方；头搭在界面上方，尾巴从底部自然垂下 */
.js-widget__cat {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: 372px;
  height: 600px;
  pointer-events: none;
  opacity: 0;
  transform-origin: bottom right;
  transform: translateY(42px) scale(0.5) rotate(4deg);
  transition: opacity 0.3s ease, transform 0.46s cubic-bezier(0.34, 1.56, 0.64, 1) 0.06s;
}
.js-widget__cat--back { z-index: 99998; }
.js-widget__cat--front { z-index: 100000; }
.js-widget__cat.is-open {
  opacity: 1;
  transform: translateY(0) scale(1) rotate(0deg);
}
.js-widget__cat--back svg,
.js-widget__cat-head {
  position: absolute;
  right: 94px;
  display: block;
}
.js-widget__cat--back svg {
  top: 0;
  right: 8px;
  width: 184px;
  height: 720px;
}
.js-widget__cat-head {
  top: -90px;
  right: 8px;
  width: 184px;
  height: 150px;
  transform: scale(0.85);
  transform-origin: bottom right;
  filter: drop-shadow(0 6px 10px rgba(26, 26, 26, 0.14));
}
.js-widget__cat-head svg {
  width: 100%;
  height: 100%;
  display: block;
}
.js-widget__cat-fold {
  position: absolute;
  right: 20px;
  top: -90px;
  width: 124px;
  height: 56px;
  transform: scale(0.85);
  transform-origin: bottom right;
  cursor: pointer;
  border-radius: 50% 50% 40% 40%;
  pointer-events: auto;
}
.js-widget__cat-fold::after {
  content: "−";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 50%;
  background: rgba(217, 87, 30, 0.12);
  color: #d9571e;
  font-size: 18px;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.js-widget__cat--front:hover .js-widget__cat-fold::after {
  opacity: 1;
  transform: scale(1);
}
.js-widget__cat .cat-tail-group {
  transform-origin: 92px 560px;
  animation: js-widget-tail-idle 2.8s ease-in-out infinite;
}
.js-widget__cat.is-wagging .cat-tail-group {
  animation: js-widget-tail-wag 0.55s ease-in-out infinite;
}
@keyframes js-widget-tail-idle {
  0%, 100% { transform: rotate(-7deg); }
  50% { transform: rotate(7deg); }
}
@keyframes js-widget-tail-wag {
  0%, 100% { transform: rotate(-18deg); }
  50% { transform: rotate(18deg); }
}

/* 面板 */
.js-widget__panel {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 99999;
  width: 372px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 130px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(26, 26, 26, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: translateY(10px) scale(0.92);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.26s ease;
}
.js-widget__panel.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* 头部 */
.js-widget__header {
  background: var(--gold-500, #d9571e);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.js-widget__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.js-widget__avatar svg {
  width: 22px;
  height: 22px;
}
.js-widget__titlebox {
  flex: 1;
  min-width: 0;
}
.js-widget__title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.js-widget__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6ee7a8;
  box-shadow: 0 0 0 3px rgba(110, 231, 168, 0.3);
}
.js-widget__sub {
  font-size: 11.5px;
  opacity: 0.85;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.js-widget__close {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  display: flex;
  opacity: 0.9;
}
.js-widget__close:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* 消息区 */
.js-widget__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  background: #fbf8f4;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.js-widget__msg {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.js-widget__msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #efe7dc;
  color: #2b2b2b;
  border-bottom-left-radius: 4px;
}
.js-widget__msg--user {
  align-self: flex-end;
  background: var(--gold-500, #d9571e);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.js-widget__msg--err {
  align-self: flex-start;
  background: #fff3ee;
  border: 1px solid #f3c9b6;
  color: #b3431a;
}
.js-widget__typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #efe7dc;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.js-widget__typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c9bdb0;
  animation: js-widget-blink 1.2s infinite ease-in-out;
}
.js-widget__typing span:nth-child(2) { animation-delay: 0.2s; }
.js-widget__typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes js-widget-blink {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* 加载更多历史消息（置顶按钮 + 历史区 + 分隔符） */
.js-widget__loadmore {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 8px 12px;
  font: inherit;
  font-size: 12.5px;
  color: var(--gold-600, #b8531f);
  background: #f7f1e8;
  border: 1px solid #e7dccd;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.js-widget__loadmore:hover,
.js-widget__loadmore:focus-visible {
  background: #efe6d8;
  color: var(--gold-700, #974311);
}
.js-widget__history {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}
.js-widget__history-divider {
  align-self: center;
  font-size: 11px;
  color: #a99a88;
  letter-spacing: 0.04em;
  padding: 2px 10px;
  background: #f3ece2;
  border-radius: 999px;
}

/* 免责提示条 */
.js-widget__disclaimer {
  padding: 8px 14px;
  font-size: 11px;
  line-height: 1.5;
  color: #8a7d6e;
  background: #f3ece2;
  border-top: 1px solid #ece2d4;
  text-align: center;
}

/* 输入区 */
.js-widget__input {
  border-top: 1px solid #ece2d4;
  background: #fff;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.js-widget__textarea {
  flex: 1;
  resize: none;
  border: 1px solid #e0d6c8;
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.5;
  max-height: 96px;
  outline: none;
  color: #2b2b2b;
  background: #fff;
}
.js-widget__textarea:focus {
  border-color: var(--gold-500, #d9571e);
}
.js-widget__send {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 12px;
  background: var(--gold-500, #d9571e);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.js-widget__send:hover { background: var(--gold-600, #c04a16); }
.js-widget__send:disabled { opacity: 0.5; cursor: not-allowed; }
.js-widget__send svg { width: 19px; height: 19px; }

/* 底部 CTA */
.js-widget__cta {
  display: block;
  text-align: center;
  font-size: 12px;
  color: var(--gold-600, #c04a16);
  text-decoration: none;
  padding: 9px;
  background: #fff;
  border-top: 1px solid #ece2d4;
  font-weight: 500;
}
.js-widget__cta:hover { background: #fdf6f0; }
.js-widget__privacy {
  font-size: 10px;
  line-height: 1.4;
  color: #9b8f80;
  text-align: center;
  padding: 6px 10px 8px;
  background: #fff;
}

@media (max-width: 480px) {
  .js-widget__panel {
    right: 12px;
    bottom: 88px;
    width: calc(100vw - 24px);
  }
  .js-widget__launcher { right: 16px; bottom: 16px; }
  .js-widget__cat {
    right: 12px;
    bottom: 88px;
    width: calc(100vw - 24px);
  }
  .js-widget__cat--back svg,
  .js-widget__cat-head { right: calc(50% - 92px); }
  .js-widget__cat-fold { right: calc(50% - 62px); }
}

/* 系统提示气泡（转接/状态） */
.js-widget__msg--sys {
  align-self: center;
  max-width: 92%;
  background: #fff7f1;
  border: 1px dashed #e9c3ad;
  color: #9a5326;
  font-size: 12.5px;
  text-align: center;
  border-radius: 10px;
}

/* 转接人工：选填联系信息 */
.js-widget__transfer {
  align-self: stretch;
  background: #fff;
  border: 1px solid #efd9c8;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.js-widget__transfer-note {
  font-size: 12px;
  color: #8a7d6e;
  line-height: 1.5;
}
.js-widget__ti {
  width: 100%;
  border: 1px solid #e0d6c8;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
  color: #2b2b2b;
}
.js-widget__ti:focus { border-color: var(--gold-500, #d9571e); }
.js-widget__transfer-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.js-widget__transfer-btn {
  flex: 1;
  width: auto;
  height: 34px;
  font-size: 13px;
}
.js-widget__transfer-skip {
  background: transparent;
  border: none;
  color: var(--gold-600, #c04a16);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

/* 人工模式静默追问：快捷操作按钮 */
.js-widget__nudge {
  align-self: center;
  display: flex;
  gap: 8px;
  margin-top: -4px;
}
.js-widget__nudge-btn {
  border: 1px solid var(--gold-500, #d9571e);
  background: #fff;
  color: var(--gold-600, #c04a16);
  border-radius: 18px;
  padding: 6px 14px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.js-widget__nudge-btn:hover { background: var(--gold-100, #fbe9df); }
.js-widget__nudge-btn.primary {
  background: var(--gold-500, #d9571e);
  color: #fff;
  border-color: var(--gold-500, #d9571e);
}
.js-widget__nudge-btn.primary:hover { background: var(--gold-600, #c04a16); }

/* 转人工后「等待律师接入」横幅 */
.js-widget__waiting {
  align-self: center;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 92%;
  padding: 10px 14px;
  background: #fff7f1;
  border: 1px solid #efd9c8;
  border-radius: 12px;
  color: #9a5326;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}
.js-widget__waiting--urgent {
  background: #fff1e8;
  border-color: #f0b48f;
  border-style: dashed;
  color: #b3431a;
}
.js-widget__waiting-hint {
  flex-basis: 100%;
  font-size: 12px;
  color: #b87a4f;
  opacity: 0.95;
}
.js-widget__waiting-spin {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(154, 83, 38, 0.3);
  border-top-color: #9a5326;
  border-radius: 50%;
  flex-shrink: 0;
  animation: js-widget-spin 0.9s linear infinite;
}
.js-widget__waiting--urgent .js-widget__waiting-spin {
  display: none; /* 已超时则不再转圈，改为感叹号式静态提示 */
}
@keyframes js-widget-spin {
  to { transform: rotate(360deg); }
}

/* 刷新后「是否继续上一段人工咨询」提示卡片 */
.js-widget__resume {
  align-self: stretch;
  margin: 4px 2px 2px;
  padding: 12px 14px;
  background: #fff7f1;
  border: 1px solid #efd9c8;
  border-radius: 12px;
  color: #9a5326;
  font-size: 13px;
  line-height: 1.5;
}
.js-widget__resume-text {
  margin-bottom: 10px;
}
.js-widget__resume-row {
  display: flex;
  gap: 8px;
}
.js-widget__resume-btn {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #e3b79a;
  border-radius: 8px;
  background: #fff;
  color: #9a5326;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.js-widget__resume-btn:hover {
  background: #fdeee3;
}
.js-widget__resume-btn.primary {
  background: #d9571e;
  border-color: #d9571e;
  color: #fff;
}
.js-widget__resume-btn.primary:hover {
  background: #c44c16;
}

/* AI 建议转人工时弹出的可点击按钮卡片 */
.js-widget__transfer-suggest {
  align-self: flex-start;
  display: flex;
  gap: 10px;
  max-width: 92%;
  margin: 4px 0 2px;
  padding: 12px 13px;
  background: #fff;
  border: 1px solid #efe7dc;
  border-left: 3px solid var(--gold-500, #d9571e);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  color: #2b2b2b;
  box-shadow: 0 2px 8px rgba(26, 26, 26, 0.04);
}
.js-widget__transfer-suggest-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff7f1;
  color: var(--gold-500, #d9571e);
  display: flex;
  align-items: center;
  justify-content: center;
}
.js-widget__transfer-suggest-icon svg {
  width: 16px;
  height: 16px;
}
.js-widget__transfer-suggest-main {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}
.js-widget__transfer-suggest-tip {
  font-size: 13px;
  line-height: 1.55;
  color: #5c4f42;
}
.js-widget__transfer-suggest-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 16px;
  border: none;
  border-radius: 17px;
  background: var(--gold-500, #d9571e);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.1s ease;
}
.js-widget__transfer-suggest-btn:hover {
  background: var(--gold-600, #c04a16);
}
.js-widget__transfer-suggest-btn:active {
  transform: scale(0.98);
}

/* ============================================================
   对话标签抽屉（多对话 / 续聊）
   ============================================================ */
.js-widget__conv-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  display: flex;
  opacity: 0.9;
}
.js-widget__conv-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}
.js-widget__conv-btn svg {
  width: 20px;
  height: 20px;
}
.js-widget__conv-drawer {
  background: #fff;
  border-top: 1px solid #f0e8dc;
  border-bottom: 1px solid #efe7dc;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.22s ease;
  display: flex;
  flex-direction: column;
}
.js-widget__conv-drawer.is-open {
  max-height: 340px;
  overflow-y: auto;
}
.js-widget__conv-new {
  margin: 8px 10px 4px;
  padding: 8px 10px;
  border: 1px dashed var(--gold-500, #d9571e);
  background: #fff7f1;
  color: var(--gold-500, #d9571e);
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.js-widget__conv-new:hover {
  background: #ffeede;
}
.js-widget__conv-empty {
  padding: 14px;
  color: #9a9286;
  font-size: 12.5px;
  text-align: center;
}
.js-widget__conv-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  margin: 0 10px;
  padding: 9px 10px;
  border: none;
  border-bottom: 1px solid #f3ece1;
  background: transparent;
  cursor: pointer;
  text-align: left;
  border-radius: 8px;
}
.js-widget__conv-item:last-child {
  border-bottom: none;
  margin-bottom: 8px;
}
.js-widget__conv-item:hover {
  background: #fbf4ec;
}
.js-widget__conv-item.is-active {
  background: #fff1e6;
  box-shadow: inset 3px 0 0 var(--gold-500, #d9571e);
}
.js-widget__conv-title {
  font-size: 13px;
  color: #2b2b2b;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.js-widget__conv-time {
  font-size: 11px;
  color: #a59c8f;
}
.js-widget__conv-divider {
  align-self: center;
  font-size: 11.5px;
  color: #b0a896;
  background: #f3ece1;
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 2px;
}
