/* 后台 AI 助手：只在电脑端显示（样式沿用发票抽奖反馈系统的 AI 助手） */
.ai-assist-ball {
  position: fixed; right: 22px; bottom: 104px; z-index: 61;
  width: 114px; height: 114px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  transition: transform .18s ease;
  filter: drop-shadow(0 6px 14px rgba(58,109,240,.32));
}
.ai-assist-ball-img { width: 110px; height: 110px; object-fit: contain; display: block; pointer-events: none; }
.ai-assist-ball-word {
  position: absolute; top: -14px; font-size: 11px; font-weight: 600; color: #2c58cc; background: #fff; border-radius: 8px; padding: 1px 7px;
  box-shadow: 0 2px 6px rgba(31,42,62,.14); opacity: 0; transform: translateY(4px); transition: opacity .18s, transform .18s; pointer-events: none; white-space: nowrap;
}
.ai-assist-ball:hover { transform: scale(1.08); }
.ai-assist-ball:hover .ai-assist-ball-word { opacity: 1; transform: translateY(0); }
.ai-assist-ball:active { transform: scale(.95); }
.ai-assist-ball.is-open { opacity: 0; pointer-events: none; }
.ai-assist-ball.is-tucked { display: none; }
.ai-assist-peek {
  position: fixed; right: 0; bottom: 138px; z-index: 61; width: 26px; height: 46px; padding: 0; border: 0; border-radius: 24px 0 0 24px;
  background: #3a6df0; color: #fff; display: none; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: -2px 4px 12px rgba(58,109,240,.35); transition: width .15s, background .15s;
}
.ai-assist-peek.is-show { display: flex; }
.ai-assist-peek:hover { width: 31px; background: #2c58cc; }

/* 面板压在弹窗（.mask 为 100）之下：确认调整的弹窗要盖在它上面 */
.ai-assist-pane {
  position: fixed; right: -520px; bottom: 24px; z-index: 90; width: 420px; max-width: calc(100vw - 24px); height: 82vh; max-height: 740px;
  background: #fff; border-radius: 16px; box-shadow: 0 18px 48px rgba(31,42,62,.2);
  display: flex; flex-direction: column; overflow: hidden; opacity: 0; pointer-events: none; transition: right .28s ease, opacity .2s ease;
}
.ai-assist-pane.is-show { right: 24px; opacity: 1; pointer-events: auto; }
.ai-assist-hd { display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px 18px; background: #fff; border-bottom: 1px solid #f0f3f8; }
.ai-assist-hd-av { width: 40px; height: 40px; flex: 0 0 auto; object-fit: contain; }
html.no-ai .ai-assist-ball, html.no-ai .ai-assist-peek, html.no-ai .ai-assist-pane { display: none !important; }
.ai-assist-hd-txt { flex: 1 1 auto; min-width: 0; }
.ai-assist-hd-t { margin: 0; font-size: 18px; font-weight: 700; color: #14181f; line-height: 1.2; }
.ai-assist-hd-s { display: block; margin-top: 3px; font-size: 12px; color: #6b7280; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-assist-new {
  flex: 0 0 auto; height: 30px; padding: 0 12px 0 10px; border: 0; border-radius: 15px; background: #3a6df0; color: #fff;
  font-size: 13px; font-weight: 600; white-space: nowrap; display: none; align-items: center; gap: 4px; cursor: pointer;
  box-shadow: 0 3px 10px rgba(58,109,240,.3); transition: background .15s, transform .15s;
}
.ai-assist-new svg { width: 17px; height: 17px; }
.ai-assist-pane.has-chat .ai-assist-new { display: inline-flex; }
.ai-assist-new:hover { background: #2c58cc; transform: translateY(-1px); }
.ai-assist-close {
  flex: 0 0 auto; width: 30px; height: 30px; line-height: 1; font-size: 18px; color: #fff; background: #3a6df0; border: 0; border-radius: 50%;
  cursor: pointer; transition: background .15s, transform .15s;
}
.ai-assist-close:hover { background: #2c58cc; transform: scale(1.05); }

.ai-assist-chat {
  flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 8px 18px 12px; background: #fff;
  display: flex; flex-direction: column; gap: 12px;
}
.aim-intro { display: flex; flex-direction: column; margin: auto 0; padding: 12px 2px 8px; }
.aim-hello-bot { display: block; height: 76px; width: auto; margin: 0 0 18px; align-self: center; }
.aim-hi { margin: 0 0 16px; font-size: 22px; font-weight: 600; line-height: 1.4; color: #14181f; }
.aim-hello { margin-bottom: 18px; font-size: 13px; line-height: 1.8; color: #6b7280; }
.aim-hello b { color: #3a6df0; font-weight: 500; }
.aim-row { display: flex; gap: 8px; align-items: flex-start; }
.aim-row.is-me { flex-direction: row-reverse; }
.aim-avatar { width: 36px; height: 36px; flex: 0 0 auto; object-fit: contain; }
img.aim-avatar { width: 50px; height: 50px; margin-top: -6px; }
.aim-avatar-me {
  width: 30px; height: 30px; border-radius: 50%; background: #3a6df0; color: #fff; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.aim-bub {
  max-width: 300px; padding: 10px 13px; border-radius: 12px; border-top-left-radius: 4px; background: #f4f7fb; border: 1px solid #e9eef7;
  font-size: 13.5px; line-height: 1.8; color: #1f2a3e; white-space: pre-wrap; word-break: break-word;
}
.aim-row.is-me .aim-bub { background: #3a6df0; border-color: #3a6df0; color: #fff; border-top-left-radius: 12px; border-top-right-radius: 4px; }
.aim-bub.is-err { background: #fff5f4; border-color: #f3cdc8; color: #b3261e; }
.aim-bub.is-ok { background: #effaf3; border-color: #c5ead2; color: #1b7a3d; }
.aim-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; white-space: normal; }
.aim-ch { opacity: 0; animation: aimCh .45s ease-out forwards; }
@keyframes aimCh { to { opacity: 1; } }
.aim-bub .aim-act, .aim-bub .aim-foot { transition: opacity .3s; }
.aim-bub.is-typing .aim-act, .aim-bub.is-typing .aim-foot { opacity: 0; pointer-events: none; }
.aim-model { font-size: 11px; color: #b6bdca; }
.aim-copy {
  margin-left: auto; flex: 0 0 auto; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: #9aa3b2;
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s, color .15s, transform .12s;
}
.aim-copy:hover { background: #eef2fb; color: #3a6df0; }
.aim-copy:active { transform: scale(.94); }
.aim-divider { align-self: center; font-size: 12px; color: #9aa3b2; background: #f4f6fa; border-radius: 10px; padding: 2px 12px; }

/* 增减票数：气泡里的调整清单 */
.aim-act { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: #fff; border: 1px dashed #b9cdfb; white-space: normal; }
.aim-act-li { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; line-height: 1.9; }
.aim-act-li span { white-space: nowrap; }
.aim-act-li em { font-style: normal; font-weight: 700; }
.aim-vip { display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 6px; background: #fff3dc; color: #b7791f; font-size: 11px; font-style: normal; line-height: 1.6; }
.aim-act-li em.up { color: #1b7a3d; }
.aim-act-li em.down { color: #d9534f; }
.aim-act-err { font-size: 12px; line-height: 1.7; color: #b3261e; }
.aim-act-btn {
  display: block; width: 100%; margin-top: 6px; height: 32px; border: 0; border-radius: 8px; background: #3a6df0; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
}
.aim-act-btn:hover { background: #2c58cc; }
.aim-act-btn:disabled { background: #c9d3e6; cursor: default; }

.aim-row-loading .aim-load { display: flex; align-items: center; height: 76px; padding: 0 30px; }
.aim-chips { display: flex; flex-direction: column; gap: 2px; }
.aim-chip {
  display: flex; align-items: center; gap: 12px; width: calc(100% + 16px); margin: 0 -8px; padding: 10px 8px; border: 0; border-radius: 10px;
  background: transparent; color: #1f2937; font-size: 14.5px; text-align: left; cursor: pointer; transition: background .15s, color .15s;
}
.aim-chip:hover { background: #f3f6fc; color: #3a6df0; }
.aim-chip-ico { flex: 0 0 auto; width: 20px; height: 20px; color: #374151; display: flex; align-items: center; justify-content: center; }
.aim-chip-ico svg { width: 19px; height: 19px; }
.aim-chip:hover .aim-chip-ico { color: #3a6df0; }
.aim-chip-t { flex: 1 1 auto; min-width: 0; line-height: 1.45; }

.ai-assist-foot { padding: 4px 16px 10px; background: #fff; }
.ai-assist-box { position: relative; border: 1px solid #dbe1ea; border-radius: 16px; background: #fff; padding: 12px 14px 50px; transition: border-color .15s, box-shadow .15s; }
.ai-assist-box:focus-within { border-color: #3a6df0; box-shadow: 0 0 0 3px rgba(58,109,240,.1); }
.ai-assist-box textarea {
  display: block; width: 100%; height: 130px; min-height: 130px; max-height: 260px; resize: none; border: 0; outline: none; padding: 0;
  font-size: 14px; line-height: 1.7; font-family: inherit; color: #1f2a3e; background: transparent; box-shadow: none;
}
.ai-assist-box textarea::placeholder { color: #b0b7c3; }
.ai-assist-left { position: absolute; left: 14px; bottom: 19px; font-size: 11.5px; color: #b0b7c3; }
.ai-assist-send {
  position: absolute; right: 12px; bottom: 12px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: #3a6df0; color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s, transform .15s;
}
.ai-assist-send:hover { background: #2c58cc; transform: scale(1.05); }
.ai-assist-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.ai-assist-note { margin: 8px 0 0; text-align: center; font-size: 11.5px; color: #b0b7c3; line-height: 1.5; }

.aim-loader { width: 44.8px; height: 44.8px; color: #3a6df0; position: relative; flex: 0 0 auto; background: radial-gradient(11.2px, currentColor 94%, #0000); }
.aim-loader::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(10.08px at bottom right, #0000 94%, currentColor) top left,
    radial-gradient(10.08px at bottom left, #0000 94%, currentColor) top right,
    radial-gradient(10.08px at top right, #0000 94%, currentColor) bottom left,
    radial-gradient(10.08px at top left, #0000 94%, currentColor) bottom right;
  background-size: 22.4px 22.4px; background-repeat: no-repeat; animation: aimLoader 1.5s infinite cubic-bezier(0.3, 1, 0, 1);
}
@keyframes aimLoader { 33% { inset: -11.2px; transform: rotate(0deg); } 66% { inset: -11.2px; transform: rotate(90deg); } 100% { inset: 0; transform: rotate(90deg); } }

/* 确认调整弹窗 */
.asst-dlg { width: 560px; max-width: calc(100vw - 32px); }
.asst-dlg .asst-tip { margin: 0 0 10px; font-size: 14px; color: #5a6578; }
.asst-tbl-wrap { max-height: 46vh; overflow: auto; border: 1px solid var(--line, #e9edf3); border-radius: 10px; }
.asst-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.asst-tbl th, .asst-tbl td { padding: 8px 10px; text-align: center; border-bottom: 1px solid var(--line, #e9edf3); white-space: nowrap; }
.asst-tbl th { background: #f6f8fc; color: #5a6578; font-weight: 600; position: sticky; top: 0; }
.asst-tbl tr:last-child td { border-bottom: 0; }
.asst-tbl .up { color: #1b7a3d; font-weight: 700; }
.asst-tbl .down { color: #d9534f; font-weight: 700; }
.asst-tbl .vip { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 8px; background: #fff3dc; color: #b7791f; font-size: 12px; }
.asst-tbl .off { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 8px; background: #f1f3f6; color: #8a94a6; font-size: 12px; }

@media (max-height: 820px) { .aim-hello-bot { height: 64px; margin-bottom: 12px; } .aim-hi { font-size: 20px; } }
@media (max-height: 700px) { .ai-assist-pane { bottom: 12px; height: calc(100vh - 24px); } .aim-hello-bot { height: 52px; margin-bottom: 8px; } .aim-hello { margin-bottom: 10px; } .aim-chip { padding: 8px; } .ai-assist-box textarea { height: 64px; min-height: 64px; max-height: 150px; } }
/* 只在电脑端显示 */
@media (max-width: 768px) { .ai-assist-ball, .ai-assist-peek, .ai-assist-pane { display: none !important; } }

html.dark .ai-assist-pane, html.dark .ai-assist-hd, html.dark .ai-assist-chat, html.dark .ai-assist-foot, html.dark .ai-assist-box { background: #1b2230; }
html.dark .ai-assist-hd { border-bottom-color: #283244; }
html.dark .ai-assist-hd-t { color: #e6ebf3; }
html.dark .ai-assist-hd-s, html.dark .aim-hello { color: #aab4c3; }
html.dark .aim-bub { background: #242d3d; border-color: #2f3a4e; color: #dbe2ec; }
html.dark .aim-bub.is-err { background: #3a2427; border-color: #5a3036; color: #ff9b93; }
html.dark .aim-bub.is-ok { background: #1f3a2a; border-color: #2c5a3c; color: #7fd69c; }
html.dark .aim-act { background: #1b2230; border-color: #3a5a9e; }
html.dark .aim-hi { color: #e6ebf3; }
html.dark .aim-chip { background: transparent; color: #dbe2ec; }
html.dark .aim-chip:hover { background: #222b3a; color: #7fa2ff; }
html.dark .aim-chip-ico { color: #aab4c3; }
html.dark .aim-chip:hover .aim-chip-ico { color: #7fa2ff; }
html.dark .ai-assist-box { border-color: #344054; }
html.dark .ai-assist-box textarea { color: #e6ebf3; }
html.dark .aim-divider { background: #242d3d; color: #8a94a6; }
html.dark .aim-copy:hover { background: #26324a; }
html.dark .asst-tbl th { background: #222b3a; color: #aab4c3; }
html.dark .asst-dlg .asst-tip { color: #aab4c3; }
