* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: #ebebeb;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  color: #111;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
textarea, input, .bubble, .oc-name, .sheet-item .nm { user-select: text; }
#shell {
  height: 100%;
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 0;
}
#app {
  width: 100%;
  max-width: 480px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #ededed;
  position: relative;
}
.hide { display: none !important; }

.hd {
  height: 50px;
  background: #fff;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  padding: 0 10px;
  flex-shrink: 0;
  padding-top: env(safe-area-inset-top);
}
.ib {
  width: 36px; height: 36px; border: none; background: transparent;
  color: #222; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.hd-c { flex: 1; min-width: 0; padding-left: 2px; }
.hd-t {
  display: flex; align-items: center; gap: 6px;
  font-size: 16px; font-weight: 700;
}
.badge-off {
  font-size: 10px; font-weight: 600; color: #fff;
  background: #e02e24; border-radius: 2px; padding: 1px 4px; line-height: 1.3;
}
.badge-off.ai {
  background: #1677ff;
}
.hd-human {
  flex-shrink: 0;
  border: none;
  background: #1677ff;
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  padding: 6px 10px;
  border-radius: 16px;
  cursor: pointer;
  margin-right: 4px;
  white-space: nowrap;
}
.hd-human:active { opacity: .85; }
.hd-human:disabled { opacity: .5; cursor: not-allowed; }
.hd-faq {
  font-size: 12px; color: #576b95; text-decoration: none; white-space: nowrap; padding: 0 4px;
}
.row.agent .bubble.ai-bubble {
  background: #fff;
  border: 1px solid #e8f0ff;
}
.row.agent .ai-lab {
  font-size: 10px; color: #1677ff; margin-bottom: 3px; font-weight: 600;
}
.hd-s {
  font-size: 11px; color: #999; margin-top: 1px;
  display: flex; align-items: center; gap: 4px;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: #bbb; display: inline-block; }
.dot.on { background: #07c160; }

.msgs {
  flex: 1; overflow-y: auto; padding: 12px;
  -webkit-overflow-scrolling: touch;
}
.row { display: flex; margin-bottom: 14px; gap: 8px; align-items: flex-start; }
.row.me { flex-direction: row-reverse; }
.row.sys { justify-content: center; }
.av {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  object-fit: cover; background: #ddd; display: block;
}
.av-wrap {
  position: relative; flex-shrink: 0; width: 40px; height: 40px;
}
.av-wrap .av { display: block; }
.av-ai {
  position: absolute; right: -4px; bottom: -2px;
  font-size: 9px; font-weight: 700; line-height: 1;
  color: #fff; background: #1677ff;
  border-radius: 6px; padding: 2px 4px;
  border: 1.5px solid #ededed;
  letter-spacing: .02em;
}
.wrap { max-width: calc(100% - 56px); }
.row.me .wrap { display: flex; flex-direction: column; align-items: flex-end; }
.bubble {
  background: #fff; border-radius: 8px; padding: 10px 12px;
  font-size: 15px; line-height: 1.45; word-break: break-word; white-space: pre-wrap;
  box-shadow: 0 0.5px 0 rgba(0,0,0,.04);
}
.row.me .bubble { background: #f9d7d9; }
.meta { font-size: 11px; color: #b0b0b0; margin-top: 3px; }
.row.me .meta { text-align: right; }
.sys-tip { font-size: 12px; color: #999; padding: 2px 8px; max-width: 90%; text-align: center; line-height: 1.5; }

/* AI 正在输入 … */
.typing-bubble {
  display: inline-flex; align-items: center; gap: 5px;
  min-width: 52px; padding: 12px 14px !important;
}
.typing-bubble i {
  width: 6px; height: 6px; border-radius: 50%; background: #a8b0bc;
  animation: typing-dot 1.2s infinite ease-in-out;
}
.typing-bubble i:nth-child(2) { animation-delay: .15s; }
.typing-bubble i:nth-child(3) { animation-delay: .3s; }
@keyframes typing-dot {
  0%, 80%, 100% { opacity: .28; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.iv {
  margin: 6px 2px 14px; background: #fff; border-radius: 10px;
  overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.iv-top { padding: 14px 14px 8px; }
.iv-brand { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.iv-brand .shield { width: 18px; height: 18px; color: #07c160; }
.iv-brand .name { font-size: 15px; font-weight: 600; color: #07c160; }
.iv-desc { font-size: 13px; color: #666; line-height: 1.55; }
.iv-order {
  margin: 0 14px 10px; padding: 10px 12px; background: #f7f7f7; border-radius: 8px; font-size: 13px;
}
.iv-order .r { display: flex; justify-content: space-between; padding: 3px 0; gap: 10px; }
.iv-order .r span:first-child { color: #999; flex-shrink: 0; }
.iv-order .r span:last-child { text-align: right; color: #222; word-break: break-all; }
.iv-box { margin: 0 14px 14px; padding: 14px 12px; background: #f5f5f5; border-radius: 8px; }
.iv-box .tit { font-size: 16px; font-weight: 700; }
.iv-box .sub { font-size: 12px; color: #999; margin: 4px 0 14px; }
.iv-amt { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.iv-amt .left { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px; }
.iv-amt .lab { font-size: 14px; }
.iv-amt .num { font-size: 28px; font-weight: 700; }
.iv-amt .edit {
  border: none; background: transparent; color: #bbb; cursor: pointer;
  padding: 4px; display: inline-flex; align-items: center;
}
.iv-agree {
  border: none; background: #ff5a6a; color: #fff; font-size: 15px; font-weight: 600;
  border-radius: 6px; padding: 8px 20px; cursor: pointer;
}
.iv-agree:active { background: #e84858; }
.iv-agree.done { background: #07c160; }
.iv-agree:disabled { opacity: .65; }
.iv.credit .iv-brand .name { color: #07c160; }
.iv-tag {
  display: inline-block; background: #07c160; color: #fff;
  font-size: 13px; font-weight: 600; border-radius: 6px; padding: 8px 16px;
}
.iv-bal { margin-top: 12px; font-size: 13px; color: #666; }

.oc {
  width: 260px; max-width: 74vw; background: #fff; border-radius: 8px; padding: 10px;
  box-shadow: 0 0.5px 0 rgba(0,0,0,.04);
}
.oc-row { display: flex; gap: 8px; }
.oc-thumb {
  width: 52px; height: 52px; border-radius: 6px; object-fit: contain;
  background: #f5f7ff; flex-shrink: 0; border: 1px solid #f0f0f0;
}
.oc-name {
  font-size: 13px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.oc-st { font-size: 12px; color: #e02e24; margin-top: 4px; }
.oc-foot {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid #f0f0f0;
  display: flex; justify-content: space-between; font-size: 12px; color: #888;
}
.oc-price { font-size: 14px; font-weight: 700; color: #222; }

.ft {
  background: #f5f5f5; border-top: 1px solid #e8e8e8;
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); flex-shrink: 0;
}
.quick { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; }
.quick::-webkit-scrollbar { display: none; }
.pill {
  flex-shrink: 0; border: none; background: #fff; border-radius: 14px;
  padding: 5px 12px; font-size: 12px; color: #555; cursor: pointer;
  box-shadow: 0 0 0 1px #ececec;
}
.pill.pill-human {
  color: #1677ff; box-shadow: 0 0 0 1px #cfe2ff; background: #f0f7ff; font-weight: 600;
}
.ai-disclaimer {
  margin-top: 6px;
  font-size: 11px;
  color: #b0b6c0;
  text-align: center;
  line-height: 1.4;
  padding: 0 4px 2px;
}
.input-row { display: flex; align-items: flex-end; gap: 6px; }
.circle {
  width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid #333;
  background: transparent; color: #222; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; line-height: 1;
  padding: 0;
}
.circle.active { background: #333; color: #fff; }
.input-wrap {
  flex: 1; background: #fff; border-radius: 18px; padding: 8px 12px; min-height: 34px;
  position: relative;
}
.input-wrap.voice-mode {
  padding: 0; background: transparent;
}
.input-wrap textarea {
  width: 100%; border: none; outline: none; resize: none; font-size: 15px;
  font-family: inherit; line-height: 1.35; max-height: 90px; background: transparent;
}
.hold-btn {
  width: 100%; height: 36px; border: none; border-radius: 6px;
  background: #fff; color: #222; font-size: 15px; font-weight: 500;
  box-shadow: 0 0 0 1px #e0e0e0; cursor: pointer;
  -webkit-user-select: none; user-select: none; touch-action: none;
}
.hold-btn.recording { background: #d8d8d8; }
.send {
  border: none; background: #e02e24; color: #fff; border-radius: 16px;
  height: 34px; padding: 0 14px; font-size: 14px; font-weight: 600; cursor: pointer;
}

.plus-panel {
  display: none; background: #f5f5f5; border-top: 1px solid #eee;
  padding: 16px 12px 12px; flex-shrink: 0;
}
.plus-panel.open { display: block; }
.plus-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.plus-item {
  border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 12px; color: #333;
}
.plus-item .pi {
  width: 56px; height: 56px; border-radius: 12px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.voice-tip {
  position: fixed; inset: 0; z-index: 50; display: flex;
  align-items: center; justify-content: center; pointer-events: none;
  background: rgba(0,0,0,.35);
}
.voice-tip .vt-inner {
  width: 160px; height: 160px; border-radius: 12px; background: rgba(0,0,0,.75);
  color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.vt-wave {
  width: 60px; height: 60px; border-radius: 50%;
  background: radial-gradient(circle, #07c160 0%, transparent 70%);
  animation: pulse 1s ease-in-out infinite;
}
.vt-txt { font-size: 14px; }
@keyframes pulse {
  0%, 100% { transform: scale(.85); opacity: .7; }
  50% { transform: scale(1.1); opacity: 1; }
}

.empty { text-align: center; padding: 60px 24px; color: #888; font-size: 14px; line-height: 1.7; }
.empty .go {
  margin-top: 16px; display: inline-block; background: #e02e24; color: #fff;
  border: none; border-radius: 6px; padding: 10px 22px; font-size: 15px; cursor: pointer;
}

.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: none;
}
.mask.open { display: block; }
.sheet {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 100%; max-width: 480px; max-height: 72%;
  background: #fff; border-radius: 12px 12px 0 0; z-index: 41;
  display: none; flex-direction: column;
}
.sheet.open { display: flex; }
.sheet-hd {
  padding: 12px 14px 8px; display: flex; align-items: flex-start; gap: 8px;
}
.sheet-hd .mascot {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.sheet-hd .ask {
  flex: 1; background: #eef6ff; border-radius: 10px; padding: 8px 12px; font-size: 13px; color: #333;
}
.sheet-hd .x {
  border: none; background: none; color: #999; cursor: pointer;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
}
.sheet-search {
  margin: 0 14px 10px; width: calc(100% - 28px); border: none; background: #f5f5f5;
  border-radius: 16px; padding: 9px 14px; font-size: 13px; outline: none;
}
.sheet-list { flex: 1; overflow-y: auto; padding: 0 12px 20px; }
.sheet-item {
  display: flex; gap: 10px; padding: 12px 4px; border-bottom: 1px solid #f2f2f2; align-items: flex-start;
}
.sheet-item .th {
  width: 56px; height: 56px; border-radius: 6px; object-fit: contain;
  background: #f5f7ff; flex-shrink: 0; border: 1px solid #f0f0f0;
}
.sheet-item .inf { flex: 1; min-width: 0; }
.sheet-item .tm { font-size: 11px; color: #aaa; }
.sheet-item .tag {
  display: inline-block; font-size: 10px; color: #fff; background: #ff7a00;
  border-radius: 2px; padding: 1px 4px; margin-right: 4px; vertical-align: middle;
}
.sheet-item .nm {
  font-size: 13px; font-weight: 600; margin-top: 4px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sheet-item .sp { font-size: 12px; color: #999; margin-top: 3px; }
.sheet-item .st { font-size: 12px; color: #e02e24; margin-top: 4px; }
.sheet-item .rt { text-align: right; flex-shrink: 0; min-width: 70px; }
.sheet-item .pr { font-size: 14px; font-weight: 700; }
.sheet-item .ask-btn {
  margin-top: 8px; border: 1px solid #e02e24; color: #e02e24; background: #fff;
  border-radius: 12px; padding: 2px 12px; font-size: 12px; cursor: pointer;
}

.desk-side { display: none; }
.ds-head {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px; border-bottom: 1px solid #eee; background: #fff;
}
.ds-av { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.ds-head h3 { font-size: 16px; color: #111; margin: 0 0 4px; }
.ds-online { font-size: 12px; color: #07c160; display: flex; align-items: center; gap: 4px; margin: 0; }
.ds-body { padding: 16px 18px; overflow-y: auto; flex: 1; background: #fafafa; }
.ds-block { margin-bottom: 18px; }
.ds-label { font-size: 12px; color: #999; margin-bottom: 8px; font-weight: 600; }
.ds-block p { font-size: 13px; color: #555; line-height: 1.6; margin: 0; }
.ds-btn {
  display: block; width: 100%; text-align: left; margin-bottom: 8px;
  border: 1px solid #e8e8e8; background: #fff; border-radius: 8px;
  padding: 10px 12px; font-size: 13px; color: #333; cursor: pointer;
}
.ds-btn:hover { border-color: #1677ff; color: #1677ff; }
.ds-block.tip {
  background: #f0f7ff; border-radius: 8px; padding: 12px; border: 1px solid #d6e8ff;
}
.ds-block.tip p { color: #3a6ea5; font-size: 12px; }

/* 电脑端：宽屏双栏工作台，不再套手机窄框 */
@media (min-width: 900px) {
  body { background: #e8edf3; }
  #shell {
    max-width: 1080px;
    width: calc(100% - 48px);
    height: calc(100vh - 48px);
    margin: 24px auto;
    padding: 0;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(20, 40, 80, .12);
    align-items: stretch;
    gap: 0;
  }
  #app {
    flex: 1;
    max-width: none;
    width: auto;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    background: #f3f5f8;
  }
  .hd { height: 58px; padding: 0 16px; }
  .hd-t { font-size: 17px; }
  .msgs { padding: 20px 28px; }
  .wrap { max-width: min(560px, 72%); }
  .iv { max-width: 520px; margin-left: auto; margin-right: auto; }
  .bubble { font-size: 14px; padding: 12px 14px; }
  .ft { padding: 10px 16px 14px; background: #fff; }
  .input-wrap { border-radius: 10px; padding: 10px 14px; min-height: 42px; }
  .hold-btn { height: 42px; border-radius: 8px; }
  .circle { width: 38px; height: 38px; }
  .send { height: 38px; border-radius: 10px; padding: 0 18px; }
  .plus-panel { padding: 20px 24px; }
  .plus-grid { max-width: 420px; }

  .desk-side {
    display: flex;
    flex-direction: column;
    width: 300px;
    flex-shrink: 0;
    border-left: 1px solid #e8e8e8;
    height: 100%;
    padding-top: 0;
    background: #fff;
  }

  .mask {
    left: 50%;
    transform: translateX(-50%);
    width: min(1080px, calc(100% - 48px));
    right: auto;
  }
  .sheet {
    left: 50%;
    transform: translateX(-50%);
    width: min(720px, calc(100% - 80px));
    max-width: 720px;
    border-radius: 12px 12px 0 0;
  }
}
@media (min-width: 1200px) {
  #shell { max-width: 1180px; }
  .desk-side { width: 320px; }
  .mask { width: min(1180px, calc(100% - 48px)); }
}

/* 自定义弹窗 */
.dlg-mask{position:fixed;inset:0;background:rgba(0,0,0,.45);display:none;align-items:center;justify-content:center;z-index:2000}
.dlg-mask.open{display:flex}
.dlg-box{width:min(360px,calc(100vw - 40px));background:#fff;border-radius:14px;padding:20px 18px 16px;box-shadow:0 16px 48px rgba(0,0,0,.2)}
.dlg-title{font-size:16px;font-weight:700;color:#111;margin-bottom:8px}
.dlg-body{font-size:14px;color:#555;line-height:1.6;white-space:pre-wrap;word-break:break-word}
.dlg-input{width:100%;margin-top:12px;border:1px solid #ddd;border-radius:8px;padding:10px 12px;font-size:15px;box-sizing:border-box;outline:none}
.dlg-input:focus{border-color:#1677ff}
.dlg-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:18px}
.dlg-btn{border:none;border-radius:8px;padding:8px 18px;font-size:14px;cursor:pointer;font-weight:600}
.dlg-btn.ghost{background:#f5f5f5;color:#333}
.dlg-btn.primary{background:#1677ff;color:#fff}
.dlg-btn.danger{background:#e02e24;color:#fff}

.bubble .msg-img{max-width:200px;max-height:260px;border-radius:8px;display:block}
