/* ==========================================================================
   智能客服平台 · 交互原型样式
   设计基调：租车调度台。深墨导航 + 高密度信息面 + 「号牌」作为唯一记忆点。
   号牌 = 订单号 / 车牌，等宽字体、深底浅字，贯穿列表、会话头、订单面板。
   ========================================================================== */

:root {
  /* 底色：冷调墨黑，与纸面形成硬边界 */
  --ink: #0f1c24;
  --ink-2: #1a2e38;
  --ink-3: #27404c;
  --paper: #f5f5f3;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --line: #e3e5e4;
  --line-strong: #cfd3d2;
  --text: #17211f;
  --muted: #6c7774;
  --muted-2: #9aa3a1;

  /* 语义信号色：只用四种，每种都有唯一含义 */
  --go: #1e7a4c;      /* 正常 / 已完成 */
  --go-soft: #e6f1ec;
  --hold: #b07a16;    /* 等待 / 待补充 */
  --hold-soft: #f7f0e0;
  --stop: #b42318;    /* 超时 / 投诉 / 拦截 */
  --stop-soft: #f8e9e7;
  --info: #2e6da4;    /* AI / 系统 */
  --info-soft: #e8eff6;

  --ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono",
    "Courier New", monospace;

  --rail-w: 56px;
  --topbar-h: 56px;
  --list-w: 320px;
  --side-w: 340px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--ui);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

input,
textarea,
select {
  font: inherit;
  color: inherit;
}

svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 1px;
}

/* ---------- 应用骨架 ---------- */

.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "rail topbar"
    "rail main";
  height: 100vh;
  overflow: hidden;
}

/* ---------- 左侧功能轨 ---------- */

.rail {
  grid-area: rail;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 0 12px;
  border-right: 1px solid #07131a;
}

.rail-mark {
  width: 30px;
  height: 30px;
  border-radius: 3px;
  background: var(--ink-3);
  color: #cfe3e2;
  font-size: 14px;
  font-weight: 600;
  display: grid;
  place-items: center;
  letter-spacing: 0;
  margin-bottom: 12px;
}

.rail-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 3px;
  color: #7d919c;
  transition: background 0.12s, color 0.12s;
}

.rail-btn:hover {
  background: var(--ink-2);
  color: #c3d3d6;
}

.rail-btn.is-active {
  background: var(--ink-3);
  color: #eaf3f2;
}

.rail-btn.is-active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 9px;
  bottom: 9px;
  width: 2px;
  background: #6fb2a4;
  border-radius: 0 2px 2px 0;
}

.rail-foot {
  margin-top: auto;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 3px;
  background: #2f4a57;
  color: #d6e6e5;
  font-size: 12px;
  display: grid;
  place-items: center;
}

/* ---------- 顶栏 ---------- */

.topbar {
  grid-area: topbar;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
}

.tenant-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  padding: 4px 6px 4px 0;
}

.tenant-switch svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.tenant-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.topbar-search {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 10px;
  height: 30px;
}

.topbar-search svg {
  width: 15px;
  height: 15px;
  color: var(--muted-2);
}

.topbar-search input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 12.5px;
}

.topbar-search input::placeholder {
  color: var(--muted-2);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.signal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.signal i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--go);
}

/* ---------- 通用控件 ---------- */

.btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 3px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s, border-color 0.12s;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--muted-2);
}

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #eaf3f2;
}

.btn-primary:hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--paper);
  border-color: var(--line);
}

.btn-danger {
  color: var(--stop);
  border-color: #e2c4c0;
  background: var(--surface);
}

.btn-danger:hover {
  background: var(--stop-soft);
}

.btn-sm {
  height: 26px;
  padding: 0 9px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn:disabled:hover {
  background: var(--surface);
  border-color: var(--line-strong);
}

.icon-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
}

.icon-btn:hover {
  background: var(--paper);
  color: var(--text);
}

.input {
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface);
  padding: 0 10px;
  font-size: 12.5px;
  width: 100%;
}

.input:focus {
  outline: none;
  border-color: var(--info);
}

select.input {
  padding-right: 4px;
}

/* ---------- 状态与徽章 ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 19px;
  padding: 0 6px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.chip::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.chip-go { color: var(--go); background: var(--go-soft); }
.chip-hold { color: var(--hold); background: var(--hold-soft); }
.chip-stop { color: var(--stop); background: var(--stop-soft); }
.chip-info { color: var(--info); background: var(--info-soft); }
.chip-mute { color: var(--muted); background: var(--paper); }

.tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 11px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--muted);
}

/* 号牌：订单号用实底深色，车牌用描边，模拟两种真实牌照 */
.plate {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  border-radius: 2px;
  padding: 2px 6px;
  line-height: 1.4;
  white-space: nowrap;
}

.plate-order {
  background: var(--ink);
  color: #d7e6e4;
  box-shadow: inset 0 0 0 1px #2b4753;
}

.plate-car {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  letter-spacing: 0.08em;
}

.plate-sm {
  font-size: 10.5px;
  padding: 1px 5px;
}

.plate-muted {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
  letter-spacing: 0.08em;
}

/* ---------- 主区与屏幕切换 ---------- */

.main {
  grid-area: main;
  overflow: hidden;
  position: relative;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  overflow: auto;
}

.screen.is-active {
  display: block;
}

.page {
  padding: 22px 26px 40px;
  max-width: 1440px;
}

.page-head {
  margin-bottom: 18px;
}

.page-head h1 {
  font-size: 19px;
  margin-bottom: 4px;
}

.page-head p {
  font-size: 12.5px;
  color: var(--muted);
  max-width: 78ch;
}

.muted-sm {
  font-size: 11.5px;
  color: var(--muted);
}

.meta-sep {
  display: inline-block;
  width: 1px;
  height: 10px;
  background: var(--line-strong);
  vertical-align: -1px;
  margin: 0 8px;
}

/* ---------- 工作台三栏 ---------- */

.wb {
  display: grid;
  grid-template-columns: var(--list-w) minmax(0, 1fr) var(--side-w);
  height: 100%;
  overflow: hidden;
}

/* 会话列表 */

.conv-list {
  border-right: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.conv-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.seg {
  display: flex;
  gap: 2px;
  background: var(--paper);
  padding: 2px;
  border-radius: 3px;
  flex: 1;
}

.seg-btn {
  flex: 1;
  height: 24px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  font-size: 12px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.seg-btn b {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted-2);
}

.seg-btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--line);
}

.seg-btn.is-active b {
  color: var(--info);
}

.conv-items {
  flex: 1;
  overflow-y: auto;
}

.conv-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 12px 11px;
  position: relative;
}

.conv-item:hover {
  background: var(--surface-2);
}

.conv-item.is-active {
  background: var(--info-soft);
}

.conv-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--info);
}

.conv-row1 {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.conv-subject {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-time {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted-2);
  flex: none;
}

.conv-row2 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 7px;
  flex-wrap: wrap;
}

.conv-row3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.conv-who {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-unread {
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--stop);
  color: #fff;
  font-family: var(--mono);
  font-size: 10px;
  display: grid;
  place-items: center;
}

/* 对话区 */

.thread {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--paper);
}

.thread-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.thread-title {
  flex: 1;
  min-width: 0;
}

.thread-title h2 {
  font-size: 15px;
  margin-bottom: 5px;
}

.thread-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
}

.thread-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.scope-badge {
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 2px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.scope-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--info);
}

.scope-badge[data-scope="L0_PUBLIC"]::before { background: var(--go); }
.scope-badge[data-scope="L1_TENANT_SHARED"]::before { background: #1f8a7a; }
.scope-badge[data-scope="L2_TENANT_INTERNAL"]::before { background: var(--info); }
.scope-badge[data-scope="L3_USER_ONLY"]::before { background: var(--muted); }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 620px;
  font-size: 13px;
  line-height: 1.6;
}

.msg-in {
  align-self: flex-start;
}

.msg-out {
  align-self: flex-end;
  background: var(--ink);
  color: #e4eeed;
  padding: 8px 11px;
  border-radius: 3px;
  max-width: 480px;
}

.msg-sys {
  align-self: center;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 3px 10px;
}

.msg-bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 11px;
}

.msg-meta {
  font-size: 10.5px;
  color: var(--muted-2);
  margin-top: 4px;
  font-family: var(--mono);
}

.msg-out .msg-meta {
  color: #7f969b;
  text-align: right;
}

.msg-day {
  align-self: center;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted-2);
  letter-spacing: 0.06em;
}

/* AI 建议卡 */

.ai-card {
  align-self: flex-start;
  width: 100%;
  max-width: 620px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--info);
  border-radius: 3px;
}

.ai-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--line);
  background: var(--info-soft);
}

.ai-card-head strong {
  font-size: 12px;
  color: var(--info);
}

.ai-card-head .ai-ref {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  margin-left: auto;
}

.ai-card-body {
  padding: 10px 11px;
  font-size: 13px;
  line-height: 1.62;
  color: var(--text);
}

.ai-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.ai-card-foot .muted-sm {
  margin-right: auto;
}

/* 输入区 */

.composer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 9px 18px 12px;
}

.quick-replies {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.quick-reply {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 2px;
  font-size: 11.5px;
  padding: 3px 8px;
  color: var(--muted);
}

.quick-reply:hover {
  border-color: var(--info);
  color: var(--info);
}

.composer-box {
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--surface);
}

.composer-box:focus-within {
  border-color: var(--info);
}

.composer-box textarea {
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  padding: 9px 11px 4px;
  font-size: 13px;
  line-height: 1.55;
  background: transparent;
  display: block;
}

.composer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 7px 6px;
}

.composer-hint {
  font-size: 11px;
  color: var(--muted);
  margin-right: auto;
}

.composer-hint.is-blocked {
  color: var(--stop);
  font-weight: 500;
}

/* 右侧面板 */

.side {
  border-left: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.side-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 6px;
}

.side-tab {
  border: 0;
  background: transparent;
  padding: 10px 10px 9px;
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.side-tab:hover {
  color: var(--text);
}

.side-tab.is-active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--ink);
}

.side-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.side-section {
  margin-bottom: 18px;
}

.side-section > h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  margin-bottom: 8px;
  font-weight: 600;
}

.kv {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

.kv:last-child {
  border-bottom: 0;
}

.kv dt {
  color: var(--muted);
  width: 72px;
  flex: none;
  font-size: 12px;
}

.kv dd {
  margin: 0;
  flex: 1;
  min-width: 0;
}

.kv dd .mono {
  font-family: var(--mono);
  font-size: 11.5px;
}

.order-card {
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.order-card-top {
  background: var(--ink);
  color: #dce9e8;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-card-top .plate {
  background: rgba(255, 255, 255, 0.1);
  color: #eaf3f2;
}

.order-card-top .order-status {
  margin-left: auto;
  font-size: 11px;
  color: #a9c4c2;
}

.order-card-body {
  padding: 4px 11px 8px;
}

.timeline {
  border-left: 1px solid var(--line-strong);
  padding-left: 12px;
  margin-left: 4px;
}

.tl-item {
  position: relative;
  padding: 0 0 11px;
}

.tl-item:last-child {
  padding-bottom: 0;
}

.tl-item::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
}

.tl-item.is-done::before {
  background: var(--go);
  border-color: var(--go);
}

.tl-item.is-now::before {
  background: var(--info);
  border-color: var(--info);
}

.tl-time {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted-2);
}

.tl-text {
  font-size: 12.5px;
}

/* 可见性面板 */

.scope-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.scope-opt {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 10px;
  background: var(--surface);
}

.scope-opt.is-current {
  border-color: var(--ink);
  background: var(--surface-2);
}

.scope-opt.is-locked {
  background: var(--paper);
}

.scope-radio {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  margin-top: 2px;
  flex: none;
  position: relative;
}

.scope-opt.is-current .scope-radio {
  border-color: var(--ink);
}

.scope-opt.is-current .scope-radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--ink);
}

.scope-name {
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.scope-desc {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}

.notice {
  border-radius: 3px;
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.55;
  border: 1px solid;
  margin-bottom: 10px;
}

.notice strong {
  display: block;
  margin-bottom: 2px;
}

.notice-warn {
  background: var(--hold-soft);
  border-color: #e6d5ae;
  color: #6d4a08;
}

.notice-stop {
  background: var(--stop-soft);
  border-color: #e5c4bf;
  color: #7d1a12;
}

.notice-info {
  background: var(--info-soft);
  border-color: #c9dcec;
  color: #22527d;
}

.notice-go {
  background: var(--go-soft);
  border-color: #c6e0d4;
  color: #14603a;
}

/* ---------- 页面级容器 ---------- */

.panel {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  padding: 16px;
  margin-bottom: 18px;
}

.panel > h3 {
  font-size: 13.5px;
  margin-bottom: 12px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  text-transform: uppercase;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

.table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.table .mono {
  font-family: var(--mono);
  font-size: 11.5px;
}

/* ---------- 知识库 ---------- */

.kb-grid {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: start;
}

.kb-tree,
.kb-gap {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  padding: 12px;
}

.kb-tree h3,
.kb-gap h3 {
  font-size: 12.5px;
  margin-bottom: 4px;
}

.kb-tree > p,
.kb-gap > p {
  margin-bottom: 10px;
}

.tree-node {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 5px 7px;
  border-radius: 2px;
  font-size: 12.5px;
}

.tree-node:hover {
  background: var(--paper);
}

.tree-node.is-active {
  background: var(--ink);
  color: #eaf3f2;
}

.tree-node.is-active .tree-count {
  color: #9fc0bd;
}

.tree-node .tree-label {
  flex: 1;
  min-width: 0;
}

.tree-count {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted-2);
}

.tree-children {
  margin-left: 10px;
  border-left: 1px solid var(--line);
  padding-left: 6px;
}

.kb-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.kb-toolbar .input {
  max-width: 280px;
}

.kb-main {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  padding: 14px;
  min-width: 0;
}

.gap-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gap-item {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 9px;
  background: var(--surface-2);
}

.gap-q {
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 5px;
}

.gap-count {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
}

.gap-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

/* ---------- 看板 ---------- */

.tiles {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  margin-bottom: 18px;
  overflow: hidden;
}

.tile {
  flex: 1;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.tile:last-child {
  border-right: 0;
}

.tile-label {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 5px;
}

.tile-value {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.tile-delta {
  font-size: 11.5px;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.delta-up { color: var(--go); }
.delta-down { color: var(--stop); }
.delta-flat { color: var(--muted); }

.chart {
  height: 190px;
}

.chart svg {
  width: 100%;
  height: 100%;
  stroke: none;
  overflow: visible;
}

.chart .bar-human { fill: var(--info); }
.chart .bar-ai { fill: #9dc3e0; }
.chart .axis-line { stroke: var(--line-strong); stroke-width: 1; }
.chart .axis-text {
  fill: var(--muted-2);
  font-family: var(--mono);
  font-size: 9.5px;
}

.legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--muted);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sw {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
}

.sw-go { background: var(--info); }
.sw-info { background: #9dc3e0; }

.funnel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.funnel-row {
  display: grid;
  grid-template-columns: 96px 1fr 68px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}

.funnel-bar {
  display: block;
  height: 22px;
  background: var(--paper);
  border-radius: 2px;
  overflow: hidden;
}

.funnel-fill {
  display: block;
  height: 100%;
  background: var(--info);
  border-radius: 2px;
}

.funnel-row:last-child .funnel-fill {
  background: var(--go);
}

.funnel-num {
  font-family: var(--mono);
  font-size: 11.5px;
  text-align: right;
  color: var(--muted);
}

.hot-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
}

.hot-row {
  display: grid;
  grid-template-columns: 20px 1fr 92px 46px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}

.hot-rank {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted-2);
}

.hot-bar {
  display: block;
  height: 6px;
  background: var(--paper);
  border-radius: 2px;
  overflow: hidden;
}

.hot-fill {
  display: block;
  height: 100%;
  background: var(--ink-3);
}

.hot-num {
  font-family: var(--mono);
  font-size: 11.5px;
  text-align: right;
  color: var(--muted);
}

/* ---------- 公开化审核 ---------- */

.pub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.pub-card {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  padding: 14px;
  display: flex;
  flex-direction: column;
}

.pub-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.pub-card-head .pub-title {
  font-size: 12.5px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pub-quote {
  border-left: 2px solid var(--line-strong);
  padding: 2px 0 2px 10px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 10px;
}

.pub-arrow {
  font-size: 11px;
  color: var(--muted-2);
  margin: 0 0 6px;
}

.pub-masked {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 10px;
  font-size: 12.5px;
  line-height: 1.6;
}

.pub-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.pub-foot .muted-sm {
  margin-right: auto;
}

/* ---------- 租户设置 ---------- */

.form-row {
  display: grid;
  grid-template-columns: 168px 1fr;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.form-row:last-child {
  border-bottom: 0;
}

.form-label {
  font-size: 12.5px;
}

.form-desc {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.switch {
  width: 34px;
  height: 19px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  position: relative;
  padding: 0;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--muted-2);
  transition: transform 0.14s, background 0.14s;
}

.switch.is-on {
  background: var(--ink);
  border-color: var(--ink);
}

.switch.is-on::after {
  transform: translateX(15px);
  background: #cfe3e2;
}

.matrix td.cell {
  text-align: center;
  font-size: 11.5px;
}

.matrix td.cell span {
  display: inline-block;
  min-width: 48px;
  padding: 1px 6px;
  border-radius: 2px;
}

.cell-view { color: var(--info); background: var(--info-soft); }
.cell-reply { color: var(--go); background: var(--go-soft); }
.cell-none { color: var(--muted-2); background: var(--paper); }

/* ---------- 客户端视角 ---------- */

.client-grid {
  display: grid;
  grid-template-columns: auto auto minmax(260px, 1fr);
  gap: 40px;
  align-items: start;
}

.phone-block {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.phone-caption {
  min-height: 88px;
}

.phone-caption h3 {
  font-size: 13.5px;
  margin-bottom: 4px;
}

.phone-caption p {
  font-size: 11.5px;
  color: var(--muted);
  max-width: 30ch;
}

.phone {
  width: 300px;
  height: 592px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 0 rgba(15, 28, 36, 0.04);
}

.phone.is-mini {
  width: 268px;
  height: 552px;
}

.phone-notch {
  height: 34px;
  background: var(--ink);
  color: #cfdfdd;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 11.5px;
  flex: none;
}

.phone-notch .mini-tag {
  font-size: 10px;
  border: 1px solid #3d5a66;
  border-radius: 2px;
  padding: 0 4px;
  color: #9db6b4;
}

.phone-head {
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.phone-head strong {
  font-size: 13px;
}

.phone-head p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.phone-list {
  flex: 1;
  overflow-y: auto;
}

.phone-item {
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
}

.phone-item .pi-icon {
  width: 30px;
  height: 30px;
  border-radius: 3px;
  background: var(--paper);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--muted);
  flex: none;
}

.phone-item .pi-main {
  flex: 1;
  min-width: 0;
}

.pi-title {
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pi-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone-input {
  border-top: 1px solid var(--line);
  padding: 8px 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex: none;
}

.phone-input span {
  flex: 1;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  padding: 0 9px;
  font-size: 11.5px;
  color: var(--muted-2);
}

.phone-input button {
  height: 30px;
  padding: 0 11px;
  border-radius: 3px;
  border: 0;
  background: var(--ink);
  color: #eaf3f2;
  font-size: 12px;
}

/* ---------- Toast ---------- */

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: #eaf3f2;
  border-radius: 3px;
  padding: 9px 14px;
  font-size: 12.5px;
  box-shadow: 0 4px 14px rgba(15, 28, 36, 0.22);
  animation: toast-in 0.16s ease-out;
  max-width: 460px;
}

.toast.is-stop {
  background: var(--stop);
}

.toast.is-go {
  background: var(--go);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- 响应式 ---------- */

@media (max-width: 1280px) {
  .wb {
    grid-template-columns: var(--list-w) minmax(0, 1fr);
  }

  .side {
    display: none;
  }

  .kb-grid {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .kb-gap {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .wb {
    grid-template-columns: minmax(0, 1fr);
  }

  .conv-list {
    display: none;
  }

  .grid-2,
  .hot-list {
    grid-template-columns: 1fr;
  }

  .tiles {
    flex-wrap: wrap;
  }

  .tile {
    flex: 1 1 40%;
    border-bottom: 1px solid var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* 客户端可见性规则：与工作台可见性面板形成对照 */
.client-rules {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  padding: 16px;
  align-self: stretch;
}

.client-rules h3 {
  font-size: 13.5px;
  margin-bottom: 12px;
}

.client-rules .kv dt {
  width: 96px;
}

@media (max-width: 1320px) {
  .client-grid {
    grid-template-columns: auto auto;
  }

  .client-rules {
    grid-column: 1 / -1;
  }
}
