:root {
  --bg: #f5f6f8; --panel: #fff; --top: #1b2a3a; --text: #1c2230; --muted: #6b7384; --border: #e3e6ec;
  --primary: #1f6feb; --primary-text: #fff; --danger: #c4262e; --ok: #1f9d55; --warn: #d98a00;
  --sel: #e8f0fe; --guest: #f0f1f4; --hotel: #dcebff; --ai: #e5f6ea; --manual: #fff3d6; --staff: #ece6fa;
  --log-bg: #12151c; --log-text: #d6dbe6; --topbar-h: 48px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11161d; --panel: #1a212b; --top: #0c1118; --text: #e6e9f0; --muted: #8d96a8; --border: #2b3240;
    --sel: #1f3350; --guest: #252d3a; --hotel: #1d3557; --ai: #1c3a2a; --manual: #4a3b17; --staff: #33284f; --log-bg: #0b0d12; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
h1, h2, h3 { margin: 0; } h3 { font-size: 15px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .ok { color: var(--ok); }
.error { color: var(--danger); margin: 0; min-height: 1.2em; }
b { font-weight: 600; }

input, textarea, select { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); font: inherit; }
textarea { resize: vertical; } textarea.big { min-height: 320px; line-height: 1.6; }
select.mini { width: auto; max-width: 100%; padding: 4px 8px; font-size: 13px; }
input:disabled, textarea:disabled { opacity: .65; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
input[type="checkbox"], input[type="radio"] { width: auto; }
label { display: block; margin-bottom: 12px; font-weight: 500; }
label input, label textarea { margin-top: 4px; font-weight: 400; }
label.inline { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 0 14px; font-weight: 400; color: var(--muted); }
label.filter { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 400; color: var(--muted); }
fieldset { border: 1px solid var(--border); border-radius: 8px; margin: 0 0 12px; padding: 8px 12px; } legend { padding: 0 6px; font-weight: 500; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 18px; } .checks label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.row { display: flex; gap: 8px; } .row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.btn { padding: 7px 14px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--text); font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.small { padding: 3px 10px; font-size: 12px; }
.link-btn { background: none; border: 0; color: #c5d0dc; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.card.narrow { max-width: 860px; }
.badge { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--border); color: var(--muted); white-space: nowrap; }
.badge.running, .badge.ok { background: rgba(31,157,85,.15); color: var(--ok); }
.badge.error, .badge.paused { background: rgba(196,38,46,.15); color: var(--danger); }
.badge.warn { background: rgba(217,138,0,.15); color: var(--warn); }
.empty { color: var(--muted); text-align: center; padding: 60px 16px; }
.banner { background: rgba(196,38,46,.1); border: 1px solid rgba(196,38,46,.3); border-radius: 8px; padding: 10px 12px; }

/* 登录 */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); padding: 28px; } .login-card h1 { font-size: 22px; } .login-card p.muted { margin: 4px 0 20px; }
.login-card .btn { width: 100%; margin-top: 4px; }

/* 顶栏 */
.app { display: flex; flex-direction: column; height: 100%; }
.topbar { height: var(--topbar-h); flex: none; background: var(--top); color: #fff; display: flex; align-items: center; gap: 24px; padding: 0 16px; }
.topbar .brand { display: flex; flex-direction: column; justify-content: center; line-height: 1.15; }
.topbar .brand-name { font-weight: 700; font-size: 16px; letter-spacing: .5px; }
.topbar .brand-sub { font-size: 10px; font-weight: 400; letter-spacing: .4px; opacity: .65; }
.login-by { margin: -6px 0 12px; }
.mainnav { display: flex; gap: 4px; flex: 1; }
.navbtn { background: none; border: 0; color: #c5d0dc; padding: 6px 14px; border-radius: 6px; font: inherit; cursor: pointer; }
.navbtn:hover { background: rgba(255,255,255,.08); } .navbtn.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 14px; } .top-right .muted { color: #9fb0c3; }
.send-banner { background: rgba(217,138,0,.25); color: #ffd98a; border: 1px solid rgba(217,138,0,.5); padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.view { flex: 1; min-height: 0; }

/* 客户对话：3 列 */
.chat-view { display: grid; grid-template-columns: 190px 430px 1fr; }
.col { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: var(--panel); }
.col:last-child { border-right: 0; }
.col-title { padding: 10px 12px; font-weight: 600; border-bottom: 1px solid var(--border); flex: none; }
.col-list { flex: 1; overflow-y: auto; }
.item { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: inherit; font: inherit; cursor: pointer; }
.item:hover { background: var(--bg); } .item.active { background: var(--sel); }
.item .line1 { display: flex; align-items: center; gap: 8px; } .item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.item .line2 { margin-top: 2px; font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #9aa3b2; flex: none; } .dot.running { background: var(--ok); } .dot.error { background: var(--danger); }
.tag { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: 11px; line-height: 18px; background: var(--border); color: var(--muted); white-space: nowrap; }
.tag.script { background: rgba(31,111,235,.15); color: var(--primary); } .tag.ai { background: rgba(31,157,85,.15); color: var(--ok); }
.tag.fallback, .tag.skipped, .tag.simulated { background: rgba(217,138,0,.15); color: var(--warn); }
.tag.failed, .tag.paused { background: rgba(196,38,46,.15); color: var(--danger); } .tag.sent { background: rgba(31,157,85,.15); color: var(--ok); }
.more { margin: 8px 12px; }

.col-messages { background: var(--bg); }
.chat-detail { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--border); flex: none; }
.ai-box { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.orders { flex: none; max-height: 190px; overflow-y: auto; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--border); font-size: 13px; }
.order { padding: 6px 0; border-bottom: 1px dashed var(--border); } .order:last-child { border: 0; }
.order .kv { display: flex; flex-wrap: wrap; gap: 2px 16px; color: var(--muted); font-size: 12px; margin-top: 2px; } .order .kv b { color: var(--text); font-weight: 500; }
.messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 12px; white-space: pre-wrap; word-break: break-word; }
.bubble-wrap { display: flex; flex-direction: column; } .bubble-wrap.guest { align-items: flex-start; } .bubble-wrap.hotel { align-items: flex-end; }
.bubble.guest { background: var(--guest); border-top-left-radius: 4px; }
.bubble.ai { background: var(--ai); border-top-right-radius: 4px; } .bubble.manual { background: var(--manual); border-top-right-radius: 4px; }
.bubble.staff, .bubble.system { background: var(--staff); border-top-right-radius: 4px; }
.bubble.simulated { border: 1px dashed var(--warn); }
.bubble a { color: var(--primary); }
.bmeta { font-size: 11px; color: var(--muted); margin: 0 4px 2px; display: flex; gap: 6px; align-items: center; }
.composer { flex: none; padding: 10px 14px; background: var(--panel); border-top: 1px solid var(--border); }
.composer textarea { resize: vertical; min-height: 52px; max-height: 60vh; }
.composer-grip { height: 10px; margin: -10px -14px 4px; cursor: ns-resize; position: relative; touch-action: none; } .composer-grip::after { content: ""; position: absolute; left: 50%; top: 3px; width: 44px; height: 4px; margin-left: -22px; border-radius: 2px; background: var(--border); } .composer-grip:hover::after { background: var(--muted); } .composer-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }

/* 配置 */
.config-view { display: flex; flex-direction: column; overflow: hidden; }
.subnav { display: flex; gap: 4px; padding: 8px 16px 0; background: var(--panel); border-bottom: 1px solid var(--border); flex: none; overflow-x: auto; }
.subbtn { flex: none; white-space: nowrap; padding: 9px 18px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.subbtn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.cfgpane { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }
.cfgpane.split { display: grid; grid-template-columns: 280px 1fr; gap: 16px; overflow: hidden; }
.list-pane, .detail-pane { min-height: 0; overflow-y: auto; }
.list-pane { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.plain-list .item { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; }
.placeholders { margin-bottom: 10px; } .chip { display: inline-block; margin: 2px 4px 2px 0; padding: 1px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); font: 12px ui-monospace, Menlo, Consolas, monospace; cursor: pointer; color: var(--text); }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; } .chips .chip { font-family: inherit; font-size: 13px; padding: 3px 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; } .panel-head h2 { font-size: 20px; word-break: break-all; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tab { padding: 8px 16px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.filters { display: flex; gap: 20px; flex-wrap: wrap; }

.faq-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.faq { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; } .faq.off { opacity: .55; }
.faq-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; } .faq-head .q { font-weight: 600; flex: 1; min-width: 0; }
.faq .kw { color: var(--muted); font-size: 12px; margin-bottom: 4px; word-break: break-all; } .faq .a { white-space: pre-wrap; word-break: break-word; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.att { position: relative; border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 12px; display: flex; align-items: center; gap: 6px; }
.att img { height: 48px; border-radius: 4px; display: block; }
.att button { border: 0; background: none; color: var(--danger); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
.rt-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.rt { border: 1px solid var(--border); border-radius: 8px; padding: 12px; } .rt.stale { opacity: .6; }
.rt-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; } .rt-head .n { font-weight: 600; }

.preview-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; } .preview-bar label.inline { margin: 0; }
.preview-result { border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; }
.pv { border-bottom: 1px solid var(--border); padding-bottom: 8px; } .pv:last-child { border: 0; padding-bottom: 0; }
.pv-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.pv-q, .pv-a { white-space: pre-wrap; word-break: break-word; } .pv-a { color: var(--primary); margin-top: 2px; }
.table-wrap { overflow-x: auto; } table.replies { width: 100%; border-collapse: collapse; font-size: 13px; }
.replies th, .replies td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; } .replies th { color: var(--muted); font-weight: 500; white-space: nowrap; }
.replies td.msg { max-width: 280px; white-space: pre-wrap; word-break: break-word; }
.logs-head { display: flex; align-items: center; margin-bottom: 10px; } .logs-head h3 { margin: 0 auto 0 0; }
.log-box { background: var(--log-bg); color: var(--log-text); border-radius: 8px; padding: 10px 12px; height: 420px; overflow: auto; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.log-line { white-space: pre-wrap; word-break: break-all; } .log-line .ts { color: #7d8799; margin-right: 8px; }
.log-line.ERROR { color: #ff7b84; } .log-line.WARNING { color: #f0b34a; } .log-empty { color: #7d8799; }

dialog { border: 1px solid var(--border); border-radius: 12px; padding: 0; background: var(--panel); color: var(--text); width: min(520px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.45); }
.dialog-form { padding: 20px; max-height: 85vh; overflow-y: auto; } .dialog-form h3 { margin-bottom: 14px; font-size: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1f2430; color: #fff; padding: 9px 16px; border-radius: 8px; z-index: 10; max-width: 90vw; }

@media (max-width: 900px) {
  .chat-view { grid-template-columns: 1fr; grid-auto-rows: minmax(0, 1fr); overflow-y: auto; } .col { min-height: 260px; }
  .cfgpane.split { grid-template-columns: 1fr; overflow-y: auto; } .grid2 { grid-template-columns: 1fr; }
  .topbar { gap: 10px; flex-wrap: wrap; height: auto; padding: 8px 12px; } .send-banner { display: none; }
}

.mt6 { margin-top: 6px; }

/* 会话列表里每一行的订单重点信息 */
.item.thread { padding: 9px 12px 10px; }
.item .line1 .small { flex: none; }
.item.thread .line2 { margin: 3px 0 4px; }
.sumline { font-size: 12px; line-height: 1.55; color: var(--muted); word-break: break-word; }
.sumline .k { color: var(--muted); } .sumline .v { color: var(--text); }
.tag.hotel { background: rgba(31,111,235,.12); color: var(--primary); }
.tag.warn { background: rgba(217,138,0,.15); color: var(--warn); margin-left: 6px; }

/* 搜索框 */
.searchbox { padding: 8px 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; flex: none; }
.searchbox input { padding: 6px 10px; font-size: 13px; }
mark { background: rgba(255, 200, 0, .45); color: inherit; border-radius: 2px; padding: 0 1px; }
.snippet { margin-top: 4px; padding: 4px 8px; font-size: 12px; background: var(--bg); border-radius: 6px; color: var(--text); word-break: break-word; }
.snippet .who { color: var(--muted); margin-right: 4px; }

/* 知识库：附件选择 */
.picker .drop { border: 1.5px dashed var(--border); border-radius: 8px; padding: 12px; text-align: center; color: var(--muted); cursor: pointer; font-size: 13px; }
.picker .drop:hover, .picker .drop.over { border-color: var(--primary); color: var(--primary); background: var(--sel); }
.picker .plist { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.picker .prow { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; }
.picker .prow .pn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker .prow img { height: 28px; border-radius: 3px; }
.picker .prow.removed .pn { text-decoration: line-through; opacity: .5; }
.picker .prow button { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; color: var(--danger); }
.picker .perr { color: var(--danger); font-size: 12px; margin-top: 6px; min-height: 1em; }
.ftabpane { display: block; }

/* 会话行：渠道标签 + 订单一句话 / 设施 label + 房间 / 入住退房人数 */
.item.thread .line2 { flex-wrap: wrap; row-gap: 2px; }
.item .sumtext { color: var(--text); font-size: 12px; word-break: break-word; flex: 1 1 200px; min-width: 0; }
.sumline { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.sumline .sumroom { color: var(--text); }
.tag.facility { background: rgba(124, 58, 237, .12); color: #7c3aed; border: 1px solid rgba(124, 58, 237, .35); }
@media (prefers-color-scheme: dark) { .tag.facility { color: #b794f6; } }

/* 测试：模拟对话 */
.test-view { display: grid; grid-template-columns: 300px 1fr; }
.test-side { padding: 14px; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--border); }
.test-side h3 { margin-bottom: 6px; }
.test-context { margin: 10px 0; padding: 8px 10px; background: var(--bg); border-radius: 8px; line-height: 1.7; }
.test-context:empty { display: none; }
.test-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.test-chat .messages { flex: 1; }
.bubble.system-error { background: rgba(196, 38, 46, .12); color: var(--danger); }
.sim-img { max-width: 260px; max-height: 200px; border-radius: 8px; display: block; }
.sim-warn { align-self: flex-end; white-space: normal; line-height: 1.5; padding: 3px 10px; }
.promptbox { margin: 4px 0 0 auto; max-width: 78%; width: 100%; font-size: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); padding: 6px 10px; }
.promptbox summary { cursor: pointer; color: var(--muted); }
.prompt-msg { margin-top: 8px; } .prompt-role { font: 600 11px ui-monospace, Menlo, monospace; color: var(--primary); text-transform: uppercase; }
.prompt-msg pre { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--bg); padding: 8px; border-radius: 6px; max-height: 320px; overflow: auto; }
.bubble-wrap.hotel .bmeta { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 900px) { .test-view { grid-template-columns: 1fr; grid-auto-rows: minmax(0, auto); overflow-y: auto; } }

.fpicker { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow: auto; }
.fpicker .grp { display: flex; flex-direction: column; gap: 4px; } .fpicker .grp > .muted { font-size: 12px; }
.fpicker-tools { display: flex; gap: 8px; margin-bottom: 4px; }
.faq-fac { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 4px; }

.chat-detail { display: grid; grid-template-columns: minmax(0, 1fr) 270px; }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; height: 100%; }
.chat-notes { border-left: 1px solid var(--border); background: var(--panel); padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.notes-body { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.6; }
.notes-body.stale { opacity: .6; }
@media (max-width: 1280px) { .chat-detail { grid-template-columns: minmax(0, 1fr) 220px; } }
@media (max-width: 900px) { .chat-detail { display: flex; flex-direction: column; } .chat-notes { border-left: 0; border-top: 1px solid var(--border); max-height: 180px; } }
.item .line1 .namegrp { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; } .item .line1 .namegrp .name { flex: 0 1 auto; }

.demands-view { display: flex; flex-direction: column; padding: 12px 18px; overflow: hidden; }
.dm-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; } .dm-date { display: flex; align-items: center; gap: 6px; }
.dm-tabs { flex: none; } .dm-count { margin-left: 6px; font-size: 12px; background: var(--border); border-radius: 10px; padding: 0 7px; color: var(--text); }
.dm-list { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px; align-content: start; padding-bottom: 12px; }
.dm-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.dm-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } .dm-room { font-size: 13px; } .dm-remark { font-size: 13px; }
.dm-needs { border-top: 1px dashed var(--border); padding-top: 6px; display: flex; flex-direction: column; gap: 8px; }
.dm-who { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } .dm-sum { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.6; margin-top: 2px; }

.navbtn .dm-count { margin-left: 6px; background: #d33; color: #fff; }
.tk-list { grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); }
.tk-done { opacity: .75; } .tk-actions { display: flex; gap: 6px; }
.tk-note { font-size: 13px; white-space: pre-wrap; word-break: break-word; } .tk-status, .tk-ai { color: var(--muted); }

.hint-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 0 6px; font-size: 12px; }
.hint-bar .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-bar { gap: 8px; } .composer-bar #reply-hint { flex: 1; }

.bubble-row { display: flex; align-items: flex-end; gap: 6px; max-width: 100%; } .bubble-row .bubble { max-width: calc(100% - 28px); }
.trans-btn { flex: none; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; font-size: 13px; line-height: 22px; opacity: .45; } .trans-btn:hover, .trans-btn.on { opacity: 1; background: var(--border); }
.bubble.trans { margin-top: 2px; background: transparent; border: 1px dashed var(--border); border-top-left-radius: 4px; font-size: 13px; padding: 5px 10px; } .bubble.trans-error { color: var(--danger); }

.rich-red { color: #d33; font-weight: 600; } .rich-orange { color: #d98a00; font-weight: 600; } .rich-green { color: #1f9d55; } .rich-blue { color: #1f6feb; } .rich-gray { color: var(--muted); }
mark { background: rgba(255, 213, 0, .35); color: inherit; padding: 0 2px; border-radius: 2px; }

.rich-help { margin: 8px 0 12px; } .rich-help ul { margin: 4px 0 6px; padding-left: 20px; } .rich-help code { background: var(--border); padding: 0 4px; border-radius: 3px; }

/* 知识审核 */
.kb-list { grid-template-columns: repeat(auto-fill, minmax(560px, 1fr)); }
.kb-list.wide { grid-template-columns: 1fr; }
.kb-card label { font-size: 13px; }
.kb-old { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.6; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; max-height: 420px; overflow-y: auto; }
.kb-info textarea { min-height: 420px; line-height: 1.6; font-size: 13px; }
.kb-src summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.kb-src-item { font-size: 12px; color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.kb-src-item:hover, .kb-src-item:focus-visible { background: var(--bg); color: var(--text); }
.kb-pop { position: fixed; z-index: 50; width: min(420px, calc(100vw - 16px)); max-height: 360px; overflow: hidden; display: flex; flex-direction: column; gap: 8px;
  padding: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.18); pointer-events: none; }
.kb-pop .bubble { max-width: 100%; font-size: 13px; max-height: 140px; overflow: hidden; }
.kb-pop-foot { border-top: 1px solid var(--border); padding-top: 6px; }
dialog.kb-conv { width: min(720px, calc(100% - 32px)); }
.kb-conv-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.kb-conv-head h3 { font-size: 16px; }
.kb-conv-body { display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; max-height: 72vh; overflow-y: auto; }
.kb-hit .bubble { outline: 2px solid var(--warn); outline-offset: 1px; }
.kb-note { font-size: 12px; color: var(--warn); }
.kb-runs td, .kb-runs th { padding: 4px 8px; font-size: 13px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }

.bo-result { max-height: 420px; overflow: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 12px; white-space: pre-wrap; word-break: break-all; margin-top: 8px; }
.mt16 { margin-top: 16px; }

.cl-list { grid-template-columns: repeat(auto-fill, minmax(620px, 1fr)); }
.cl-table { width: 100%; border-collapse: collapse; font-size: 13px; } .cl-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.cl-table td { padding: 5px 6px; border-bottom: 1px dashed var(--border); } .cl-cancelled td { opacity: .5; text-decoration: line-through; }

.dm-pass { font-size: 13px; } .dm-pass-detail { margin-top: 6px; padding: 6px 8px; background: var(--bg); border-radius: 6px; } .dm-pass-g { margin-top: 4px; }

.cl-notify { margin: 4px 0 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; } .cn-log { width: 100%; } .bubble.clean { background: var(--ai); border-top-right-radius: 4px; }

.cl-notify { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); margin: 4px 0 8px; }
.cn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; } .cn-row + .cn-row { margin-top: 6px; }
.cl-notify input[type=number] { width: 60px; flex: none; display: inline-block; padding: 3px 6px; }
.ms { position: relative; display: inline-block; } .ms > summary { cursor: pointer; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); padding: 4px 10px; list-style: none; font-size: 13px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms > summary::after { content: " ▾"; color: var(--muted); }
.ms-list { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 160px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.15); padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.ms-list label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; white-space: nowrap; font-size: 13px; } .ms-list input { width: auto; flex: none; }
.ms-list .ms-tools { display: flex; gap: 8px; border-bottom: 1px solid var(--border); padding-bottom: 4px; margin-bottom: 2px; }
.dm-bar div.filter { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }

.bo-acct { padding: 6px 0; border-bottom: 1px dashed var(--border); } .bo-acct:last-child { border: 0; }

.dm-group-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.dm-group-h { grid-column: 1 / -1; margin: 6px 0 0; font-size: 14px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.wide-dialog { width: min(900px, calc(100% - 32px)); }
.pd-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; } .pd-head h3 { margin: 0; font-size: 16px; }
.pd-guest { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.pd-photos { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.pd-photos img { height: 150px; max-width: 260px; object-fit: contain; border: 1px solid var(--border); border-radius: 6px; cursor: zoom-in; background: var(--bg); }
.pd-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.pd-table { width: 100%; border-collapse: collapse; font-size: 13px; } .pd-table th { text-align: left; font-weight: 400; color: var(--muted); width: 42%; padding: 2px 8px 2px 0; vertical-align: top; } .pd-table td { padding: 2px 0; word-break: break-all; }
.pd-sub { font-size: 12px; color: var(--muted); margin: 6px 0 2px; }

.side-filters { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border); }
.side-filters select { width: 100%; margin-top: 2px; }

.conv-messages { max-height: 65vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: 8px; }

/* ---- 配置 → 清扫日历 ---- */
.gcal-step { padding: 16px 0; border-top: 1px solid var(--border); } .gcal-step:first-of-type { border-top: 0; padding-top: 4px; }
.gcal-step h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 15px; }
.gcal-no { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--primary); color: var(--primary-text); font-size: 12px; font-weight: 600; }
.gcal-help { margin: 0 0 10px; }
.gcal-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.gcal-form > select, .gcal-form > input[type="email"] { flex: 1 1 200px; width: auto; min-width: 0; }
.gcal-form > input.gcal-time { width: 120px; flex: 0 0 auto; }
.gcal-lab { color: var(--muted); font-size: 13px; }
.gcal-check { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-weight: 400; }
.gcal-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.gcal-item-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.gcal-item-head .gcal-actions { margin-left: auto; display: flex; gap: 6px; }
.gcal-link { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--muted); min-width: 0; }
.gcal-link > span { flex: none; white-space: nowrap; }
#gcal-managers > .gcal-link { margin: 0 0 10px; }
.gcal-link a { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcal-empty { margin: 0 0 8px; }
.gcal-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.gcal-foot .small { margin: 0; }
#conv-dialog { height: min(80vh, 760px); }   /* 固定高度：加载中和加载完弹窗一样大，不会先小后大 */
#conv-dialog .dialog-form { height: 100%; display: flex; flex-direction: column; }
#conv-dialog .conv-messages { flex: 1; max-height: none; min-height: 0; }

.tk-link { color: inherit; text-decoration: none; } .tk-link:hover { text-decoration: underline; }
.tk-card.tk-focus { outline: 2px solid var(--primary); outline-offset: 2px; transition: outline-color .3s; }
.notes-sub { margin-top: 8px; }
.offscreen { position: fixed; opacity: 0; pointer-events: none; }

/* ---- 停车场 ---- */
.pk-month { display: flex; align-items: center; gap: 8px; } .pk-month b { min-width: 80px; text-align: center; }
.pk-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr); gap: 12px; align-items: start; padding-bottom: 12px; }
.pk-main, .pk-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pk-main .card, .pk-side .card { margin: 0; }
.pk-weekdays, .pk-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.pk-weekdays span { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 4px; }
.pk-day { min-height: 64px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); text-align: left; font: inherit; color: var(--text); cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.pk-day:hover { border-color: var(--muted); } .pk-day.out { opacity: .35; } .pk-day.today .pk-num { color: var(--primary); font-weight: 700; }
.pk-day.sel { border-color: var(--primary); background: var(--sel); } .pk-day.has-pending { border-style: dashed; }
.pk-num { font-size: 12px; } .pk-use { font-size: 12px; font-weight: 600; }
.pk-day.pk-free .pk-use { color: var(--ok); } .pk-day.pk-part .pk-use { color: var(--warn); } .pk-day.pk-full .pk-use { color: var(--danger); }
.pk-bar { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; margin-top: auto; } .pk-bar i { display: block; height: 100%; background: var(--ok); }
.pk-day.pk-part .pk-bar i { background: var(--warn); } .pk-day.pk-full .pk-bar i { background: var(--danger); }
.pk-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; } .pk-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; background: var(--ok); }
.pk-dot.pk-part { background: var(--warn); } .pk-dot.pk-full { background: var(--danger); }
.pk-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; margin-top: 8px; }
.pk-form-foot { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.pk-item { padding: 8px 0; border-bottom: 1px dashed var(--border); display: flex; flex-direction: column; gap: 4px; } .pk-item:last-child { border: 0; }
.pk-item-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; } .pk-item-head .pk-actions { margin-left: auto; display: flex; gap: 6px; }
.pk-item.pk-cancelled, .pk-item.pk-rejected { opacity: .65; }
.inline-field { display: block; margin-bottom: 10px; } .inline-field input { width: 120px; display: block; }
@media (max-width: 1000px) { .pk-body { grid-template-columns: minmax(0, 1fr); } .pk-day { min-height: 52px; padding: 3px 4px; } .pk-form { grid-template-columns: minmax(0, 1fr); } }
.pk-side .tabs { flex-wrap: wrap; } .pk-side .tab { padding: 6px 10px; white-space: nowrap; }
.pk-gcal { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin: 0 0 8px; } .pk-gcal .gcal-link { margin: 0; flex: 1 1 360px; }
.cl-export { margin-left: auto; }
.export-scope { width: 100%; }
.rt-score-box { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; } .rt-score { width: 72px; }

/* ===================== reply_bot 新增 ===================== */
.mt8 { margin-top: 8px; }
.tag.ok { background: rgba(31,157,85,.15); color: var(--ok); }
.tag + .tag { margin-left: 4px; }
.dot.starting { background: var(--warn); }
.badge.starting { background: rgba(217,138,0,.15); color: var(--warn); }
.dm-count.warn-count { background: var(--danger); color: #fff; }
/* 线索标签：1 跟进中 2 留客资 3 高潜成交 4 已成单 5 无意向 */
.tag.lead-tag { background: rgba(31,111,235,.12); color: var(--primary); }
.tag.lead-2, .tag.lead-3 { background: rgba(217,138,0,.15); color: var(--warn); }
.tag.lead-4 { background: rgba(31,157,85,.15); color: var(--ok); }
.tag.lead-5 { background: var(--border); color: var(--muted); }
/* 侧边栏：线索卡片 / 工单 */
.lead-body { margin: 6px 0 4px; display: flex; flex-direction: column; gap: 6px; }
.lead-card { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; background: var(--panel); }
.lead-card summary { cursor: pointer; list-style: none; }
.lead-card summary::-webkit-details-marker { display: none; }
.lead-card .kv { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; word-break: break-all; }
.lead-plans { margin-top: 6px; border-top: 1px dashed var(--border); padding-top: 4px; }
.notes-h { margin-top: 14px; }
.tk-mini { padding: 3px 0; border-bottom: 1px dashed var(--border); }
/* 消息里的图片、系统提示 */
.msg-img { max-width: 220px; max-height: 260px; border-radius: 6px; display: block; }
.sys-line { text-align: center; margin: 6px 0; }
.snippet.muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 私信通登录态 */
.tok { font-weight: 600; }
.tok-ok { color: var(--ok); } .tok-expired { color: var(--danger); } .tok-unknown { color: var(--warn); } .tok-none, .tok- { color: var(--muted); }
#view-login .cfgpane { display: grid; }
#xl-info { display: flex; flex-direction: column; gap: 2px; }
/* 配置 → 账号：左侧最下面的「全部问答」 */
.faq-all { margin-top: 10px; border-top: 1px solid var(--border); }
#faq-filter, #faq-all-filter { margin: 6px 0 10px; }
#faq-all-panel .row-between input { flex: 1; }
/* 接口监控 */
#monitor-panel { max-width: 1100px; display: flex; flex-direction: column; gap: 16px; }
a.btn { text-decoration: none; display: inline-block; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 8px; }
.stat { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.stat .num { font-size: 22px; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 12px; }
table.changes { width: 100%; border-collapse: collapse; font-size: 13px; }
table.changes th, table.changes td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.changes th { color: var(--muted); font-weight: 600; white-space: nowrap; }
table.changes td.nowrap { white-space: nowrap; }
table.changes td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }
.chg { font-weight: 600; white-space: nowrap; }
.chg.added { color: var(--ok); } .chg.removed { color: var(--danger); } .chg.changed { color: var(--warn); }
.table-empty { color: var(--muted); text-align: center; padding: 20px; }
.banner.info { background: transparent; }
/* 知识审核 */
.kb-list { grid-template-columns: repeat(auto-fill, minmax(560px, 1fr)); }
.kb-list.wide { grid-template-columns: 1fr; }
.kb-card label { font-size: 13px; }
.kb-old { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.6; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; max-height: 420px; overflow-y: auto; }
.kb-info textarea { min-height: 420px; line-height: 1.6; font-size: 13px; }
.kb-src summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.kb-src-row { display: flex; align-items: center; gap: 8px; }
.kb-src-item { font-size: 12px; color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.kb-src-item:hover, .kb-src-item:focus-visible { background: var(--bg); color: var(--text); }
.kb-pop { position: fixed; z-index: 50; width: min(420px, calc(100vw - 16px)); max-height: 360px; overflow: hidden; display: flex; flex-direction: column; gap: 8px;
  padding: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.18); pointer-events: none; }
.kb-pop .bubble { max-width: 100%; font-size: 13px; max-height: 140px; overflow: hidden; }
.kb-pop-foot { border-top: 1px solid var(--border); padding-top: 6px; }
dialog.kb-conv { width: min(720px, calc(100% - 32px)); }
.kb-conv-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.kb-conv-head h3 { font-size: 16px; }
.kb-conv-body { display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; max-height: 72vh; overflow-y: auto; }
.kb-hit .bubble { outline: 2px solid var(--warn); outline-offset: 1px; }
.kb-note { font-size: 12px; color: var(--warn); }
.kb-runs td, .kb-runs th { padding: 4px 8px; font-size: 13px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.tag.account { background: rgba(124, 58, 237, .12); color: #7c3aed; border: 1px solid rgba(124, 58, 237, .35); }
@media (prefers-color-scheme: dark) { .tag.account { color: #b794f6; } }
.xl-sep { margin: 12px 0 4px; }
#xl-common-btn { width: 100%; }
/* 配置 → 账号 → 运行设置 */
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 12px 12px; }
.mode-opt { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-weight: 400; }
.mode-opt input { margin-top: 3px; flex: none; }
.mode-opt > span { display: flex; flex-direction: column; gap: 2px; }
.mode-opt:has(input:checked) { border-color: var(--primary); background: var(--sel); }
.self-only { padding: 8px 12px 0; }
.self-only.inactive label { opacity: .55; }
@media (max-width: 900px) { .mode-pick { grid-template-columns: 1fr; } }
/* 企微配置 */
.wc-table tr.wc-on td { background: var(--sel); }
.wc-ops { white-space: nowrap; text-align: right; }
.wc-ops .btn + .btn { margin-left: 4px; }
.wc-help { margin: 6px 0 0; padding-left: 18px; line-height: 1.8; }
#view-wecom .cfgpane { display: grid; }
.cooldown-input { max-width: 160px; }
/* 会话侧边栏（线索 / 客户需求 / 工单） */
.chat-notes { gap: 0; padding: 0; }
.side-sec { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.side-sec:last-child { border-bottom: 0; }
.side-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.side-h strong { font-size: 13px; }
.lead-body { margin: 0; gap: 8px; }
.lead-card { padding: 0; border-radius: 8px; overflow: hidden; }
.lead-card[open] .lead-head { border-bottom: 1px solid var(--border); }
.lead-head { padding: 8px 10px; background: var(--bg); display: flex; flex-direction: column; gap: 3px; }
.lead-tags { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.lead-tags .tag + .tag { margin-left: 0; }
.lead-time { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }
.lead-receiver { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lf-group { padding: 6px 10px 8px; }
.lf-group + .lf-group { border-top: 1px dashed var(--border); }
.lf-title { font-size: 11px; color: var(--muted); letter-spacing: .05em; margin-bottom: 2px; }
.lf { display: grid; grid-template-columns: 4.6em 1fr; gap: 8px; font-size: 12px; line-height: 1.7; }
.lf-k { color: var(--muted); }
.lf-v { word-break: break-word; min-width: 0; }
.lead-plan { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; line-height: 1.8; }
.notes-body { white-space: normal; }
.notes-list { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 4px; }
.notes-list li { line-height: 1.6; }
.notes-list li::marker { color: var(--muted); }
#notes-meta { margin-top: 6px; }
