/* 对话订单工作台 */
#view-cs.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 88px);
  min-height: 560px;
}

.cs-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex: 0 0 auto; }
.cs-head .spacer { margin-left: auto; }
.cs-tabs { display: inline-flex; gap: 3px; padding: 3px; background: #0f1620; border: 1px solid #2a3646; border-radius: 8px; }
.cs-tabs button {
  padding: 6px 14px; border: none; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--text-dim); font-size: 12px; font-family: inherit;
}
.cs-tabs button:hover { color: var(--text); }
.cs-tabs button.on { background: #1b2f4d; color: #cfe3ff; }

.cs-body {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 268px minmax(0, 1fr) 336px;
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: 10px; overflow: hidden;
}

/* ---- 左：会话列表 ---- */
.cs-list { border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; min-height: 0; background: #11171f; }
.cs-list-head { padding: 10px; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 8px; }
.cs-list-head input { width: 100%; }
.cs-list-head .switch { font-size: 11px; color: var(--text-mute); }
.cs-convs { overflow: auto; flex: 1; }
.cs-conv {
  display: flex; gap: 9px; padding: 10px 10px; cursor: pointer;
  border-bottom: 1px solid #17202a; position: relative;
}
.cs-conv:hover { background: #16202c; }
.cs-conv.on { background: #16283d; box-shadow: inset 2px 0 0 var(--accent); }
.cs-conv .ava {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px; overflow: hidden;
  background: #24313f; display: grid; place-items: center;
  font-size: 11px; color: #9fb3c8; text-transform: uppercase;
}
.cs-conv .ava img { width: 100%; height: 100%; object-fit: cover; }
.cs-conv-main { min-width: 0; flex: 1; }
.cs-conv-top { display: flex; align-items: center; gap: 6px; }
.cs-conv-name { font-size: 12.5px; color: #e2ebf5; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-conv-time { margin-left: auto; font-size: 10px; color: var(--text-mute); flex: 0 0 auto; }
.cs-conv-last {
  font-size: 11px; color: var(--text-mute); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cs-conv .cnt {
  position: absolute; right: 10px; bottom: 9px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 600;
  min-width: 16px; height: 16px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px;
}
.cs-conv .ended { font-size: 10px; color: var(--text-mute); border: 1px solid #2a3646; border-radius: 4px; padding: 0 4px; }

/* ---- 中：聊天 ---- */
.cs-chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.cs-chat-head {
  padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 10px; flex: 0 0 auto; min-height: 46px;
}
.cs-chat-head .nm { font-size: 13px; font-weight: 600; }
.cs-chat-head .sub { font-size: 10.5px; color: var(--text-mute); margin-top: 2px; }
.cs-chat-head .spacer { margin-left: auto; }
.cs-msgs { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #0f141b; }
.cs-day { align-self: center; font-size: 10px; color: var(--text-mute); background: #161d26; padding: 2px 8px; border-radius: 10px; }
.cs-msg { display: flex; gap: 8px; max-width: 78%; }
.cs-msg .ava {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 26px; overflow: hidden;
  background: #24313f; display: grid; place-items: center; font-size: 10px; color: #9fb3c8;
}
.cs-msg .ava img { width: 100%; height: 100%; object-fit: cover; }
.cs-msg .bubble {
  background: #1b2531; border: 1px solid #24313f; color: #e2ebf5;
  padding: 8px 11px; border-radius: 10px; font-size: 12.5px; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.cs-msg .tm { font-size: 9.5px; color: var(--text-mute); margin-top: 4px; }
.cs-msg.me { margin-left: auto; flex-direction: row-reverse; }
.cs-msg.me .bubble { background: #17375c; border-color: #1f4c7c; color: #dbeafe; }
.cs-msg.me .tm { text-align: right; }
.cs-msg img.pic { max-width: 290px; border-radius: 8px; display: block; margin-top: 4px; border: 1px solid #24313f; background: #0b1119; }
.cs-sys { align-self: center; font-size: 10.5px; color: var(--text-mute); background: #141b23; border: 1px dashed #24313f; padding: 3px 10px; border-radius: 10px; }

.cs-quick { display: flex; gap: 6px; padding: 8px 12px 0; flex-wrap: wrap; flex: 0 0 auto; }
.cs-quick button {
  font-size: 11px; padding: 3px 9px; border-radius: 20px; cursor: pointer;
  background: #16202c; border: 1px solid #26313f; color: var(--text-dim);
}
.cs-quick button:hover { color: #cfe3ff; border-color: #35507a; background: #17273a; }
.cs-composer { display: flex; gap: 8px; padding: 10px 12px 12px; align-items: flex-end; flex: 0 0 auto; }
.cs-composer textarea { height: 64px; font-family: inherit; font-size: 12.5px; }
.cs-composer .btn { height: 34px; }

/* ---- 右：客户 / 订单 ---- */
.cs-side { border-left: 1px solid var(--line-soft); overflow: auto; background: #11171f; }
.cs-side-sec { padding: 12px; border-bottom: 1px solid var(--line-soft); }
.cs-side-sec h4 { margin: 0 0 9px; font-size: 11px; color: var(--text-mute); font-weight: 500; letter-spacing: .4px; }
.cs-cust { display: flex; gap: 10px; align-items: center; }
.cs-cust .ava { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: #24313f; display: grid; place-items: center; font-size: 13px; }
.cs-cust .ava img { width: 100%; height: 100%; object-fit: cover; }
.cs-cust .n { font-size: 13px; font-weight: 600; }
.cs-cust .u { font-size: 10.5px; color: var(--text-mute); margin-top: 2px; word-break: break-all; }

.cs-order {
  border: 1px solid #24313f; border-radius: 9px; padding: 10px; margin-bottom: 9px; background: #141c26;
}
.cs-order .top { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.cs-order .sn { font-size: 10px; color: var(--text-mute); font-family: ui-monospace, Menlo, monospace; }
.cs-order .prod { font-size: 12.5px; color: #e2ebf5; line-height: 1.5; }
.cs-order .prod b { color: #93c5fd; }
.cs-order .meta { font-size: 10.5px; color: var(--text-mute); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.cs-order .ops { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.cs-order .ops .btn { padding: 3px 8px; font-size: 11px; }
.cs-order .note { margin-top: 6px; font-size: 10.5px; color: #fcd34d; background: #2a2208; border: 1px solid #5b4315; padding: 4px 7px; border-radius: 5px; }

/* ---- 订单中心 ---- */
.cs-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden; }
.cs-toolbar { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.cs-toolbar input[type=text] { width: 240px; }
.cs-toolbar select { width: 132px; }
.cs-toolbar .spacer { margin-left: auto; }
.cs-tablewrap { flex: 1; overflow: auto; }
.cs-pane .table-wrap { flex: 1; }

/* ---- 规则 ---- */
.cs-rules { flex: 1; overflow: auto; }
.cs-rules .panel { margin-bottom: 12px; }
.cs-rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.cs-reply {
  border: 1px solid #24313f; border-radius: 8px; padding: 10px; margin-bottom: 8px; background: #141c26;
}
.cs-reply .h { display: flex; align-items: center; gap: 8px; }
.cs-reply .t { font-size: 12px; font-weight: 600; color: #dce7f3; }
.cs-reply .b { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; white-space: pre-wrap; line-height: 1.6; }
.cs-reply .ops { margin-left: auto; display: flex; gap: 6px; }

.cs-empty { display: grid; place-items: center; height: 100%; color: var(--text-mute); font-size: 12px; text-align: center; line-height: 1.9; }

.cs-badge { font-size: 10px; padding: 1px 6px; border-radius: 10px; background: #1b2531; border: 1px solid #2a3646; color: var(--text-dim); }

@media (max-width: 1280px) {
  .cs-body { grid-template-columns: 230px minmax(0, 1fr) 300px; }
}

.cs-msg .picfail {
  display: inline-block; margin-top: 4px; font-size: 11px; color: #93c5fd;
  border: 1px dashed #2f4a6b; border-radius: 6px; padding: 3px 8px; background: #12202f;
  cursor: pointer;
}
