/* ==================================================================
   组件样式
   ================================================================== */

/* ---------- 布局骨架 ---------- */
.app {
  display: grid;
  grid-template-columns: 212px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ---------- 左侧导航 ---------- */
.nav {
  background: var(--nav);
  color: var(--nav-ink);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--nav-line);
  min-width: 0;
}

.nav-brand {
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--nav-line);
}
.nav-brand-mark {
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand-glyph {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: linear-gradient(145deg, #14818B, #0A4F56);
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}
.brand-glyph svg { width: 14px; height: 14px; }
.nav-brand-name {
  font-family: var(--f-display);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.nav-brand-sub {
  font-size: 10.5px;
  color: var(--nav-ink-2);
  margin-top: 2px;
  font-family: var(--f-mono);
  letter-spacing: 0.02em;
}

.nav-property {
  margin: 12px 10px 4px;
  padding: 8px 10px;
  background: var(--nav-2);
  border: 1px solid var(--nav-line);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11.5px;
  color: var(--nav-ink);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease);
}
.nav-property:hover { border-color: rgba(255,255,255,0.16); }
.nav-property-label { color: var(--nav-ink-2); font-size: 10px; }
.nav-property-name { font-weight: 500; }

.nav-section {
  padding: 16px 10px 6px;
}
.nav-section-label {
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #5C737C;
  padding: 0 8px 6px;
  font-weight: 500;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7.5px 9px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  color: #B9CBD1;
  text-align: left;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.045); color: var(--nav-ink); }
.nav-item.active {
  background: rgba(20,129,139,0.18);
  color: #FFFFFF;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 2px; height: 14px;
  border-radius: 2px;
  background: #35B4BF;
}
.nav-item svg { width: 14px; height: 14px; opacity: 0.75; flex-shrink: 0; }
.nav-item.active svg { opacity: 1; }
.nav-count {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  color: var(--nav-ink-2);
  line-height: 1.5;
}
.nav-count.hot { background: rgba(179,65,58,0.28); color: #F3B9B4; }

.nav-spacer { flex: 0 0 auto; }
.nav-channels {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2A3B44 transparent;
}
.nav-channels::-webkit-scrollbar { width: 6px; }
.nav-channels::-webkit-scrollbar-thumb { background: #2A3B44; border-radius: 3px; }

.nav-foot {
  border-top: 1px solid var(--nav-line);
  padding: 10px;
}
.nav-agent {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 6px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
}
.nav-agent:hover { background: rgba(255,255,255,0.045); }
.nav-agent-meta { min-width: 0; }
.nav-agent-name { font-size: 12px; color: var(--nav-ink); font-weight: 500; }
.nav-agent-role { font-size: 10.5px; color: var(--nav-ink-2); }
.avatar {
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--f-display);
  font-weight: 600;
  flex-shrink: 0;
  position: relative;
}
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar.md { width: 30px; height: 30px; font-size: 12px; }
.avatar.lg { width: 38px; height: 38px; font-size: 14px; }
.avatar-dot {
  position: absolute;
  right: -1px; bottom: -1px;
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 2px solid var(--nav);
}
.avatar-dot.on { background: #4FBF8B; }
.avatar-dot.off { background: #6B7F87; }

/* ---------- 主区域 ---------- */
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.topbar {
  height: 52px;
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
}
.topbar-title {
  font-family: var(--f-display);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.topbar-sub {
  font-size: 11.5px;
  color: var(--ink-3);
  padding-left: 14px;
  border-left: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-spacer { flex: 1; }

.chip-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--green);
  background: var(--green-soft);
  padding: 3px 8px;
  border-radius: 5px;
  font-weight: 500;
}
.pulse {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2.2s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid var(--hairline-strong);
  background: var(--surface);
  color: var(--ink);
  transition: all var(--t-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: #B9C9CD; }
.btn:active { transform: translateY(0.5px); }
.btn svg { width: 13px; height: 13px; opacity: 0.7; }
.btn.primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.btn.primary:hover { background: var(--teal-deep); border-color: var(--teal-deep); }
.btn.primary svg { opacity: 1; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn.icon { width: 30px; padding: 0; justify-content: center; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  width: 210px;
  transition: all var(--t-fast) var(--ease);
}
.search:focus-within { border-color: var(--teal); background: #fff; box-shadow: 0 0 0 3px rgba(14,106,115,0.07); }
.search svg { width: 13px; height: 13px; color: var(--ink-4); flex-shrink: 0; }
.search input {
  border: none; background: transparent; width: 100%;
  font-size: 12.5px; color: var(--ink);
}
.search input::placeholder { color: var(--ink-4); }

/* ---------- 工作台三栏 ---------- */
.body { flex: 1; display: flex; min-height: 0; overflow: hidden; }

/* 队列 */
.queue {
  width: 316px;
  flex-shrink: 0;
  border-right: 1px solid var(--hairline);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.queue-head {
  padding: 11px 14px 9px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
}
.queue-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 9px;
}
.qtab {
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 11.5px;
  color: var(--ink-3);
  font-weight: 500;
  transition: all var(--t-fast) var(--ease);
  display: flex; align-items: center; gap: 5px;
}
.qtab:hover { background: var(--surface-3); color: var(--ink-2); }
.qtab.on { background: var(--teal-soft); color: var(--teal-deep); }
.qtab-n {
  font-family: var(--f-mono);
  font-size: 10px;
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(0,0,0,0.045);
  line-height: 1.6;
}
.qtab.on .qtab-n { background: rgba(14,106,115,0.13); }

.queue-list { flex: 1; overflow-y: auto; min-height: 0; }

.conv {
  padding: 11px 14px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
}
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--teal-soft); }
.conv.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--teal);
}
.conv-top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}
.conv-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 128px;
}
.conv-flag { font-family: var(--f-mono); font-size: 9.5px; color: var(--ink-4); letter-spacing: 0.03em; }
.conv-time { margin-left: auto; font-size: 10.5px; color: var(--ink-4); font-family: var(--f-mono); flex-shrink: 0; }
.conv-preview {
  font-size: 11.5px;
  color: var(--ink-2);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.conv-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.badge-ch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 1.5px 4px;
  border-radius: 3px;
  line-height: 1.3;
  flex-shrink: 0;
}

.badge-lv {
  font-family: var(--f-mono);
  font-size: 9px;
  padding: 1.5px 4px;
  border-radius: 3px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.lv-L1 { background: var(--green-soft); color: var(--green); }
.lv-L2 { background: var(--amber-soft); color: var(--amber); }
.lv-L3 { background: var(--red-soft); color: var(--red); }

.badge-topic {
  font-size: 10.5px;
  color: var(--ink-3);
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--surface-3);
  white-space: nowrap;
}

.dot-unread {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--teal);
  flex-shrink: 0;
}
.wait-pill {
  font-family: var(--f-mono);
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--amber-soft);
  color: var(--amber);
  font-weight: 500;
}
.wait-pill.urgent { background: var(--red-soft); color: var(--red); }

/* 对话区 */
.thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
  border-right: 1px solid var(--hairline);
}

.thread-head {
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  padding: 11px 18px;
  display: flex;
  align-items: center;
  gap: 11px;
}
.thread-title { min-width: 0; }
.thread-name {
  font-family: var(--f-display);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
}
.thread-sub {
  font-size: 11.5px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 1px;
}
.thread-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 8px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.day-sep {
  align-self: center;
  font-size: 10.5px;
  color: var(--ink-4);
  background: var(--surface-3);
  padding: 2px 9px;
  border-radius: 5px;
  margin: 8px 0 10px;
  font-family: var(--f-mono);
}

.msg {
  max-width: 74%;
  margin-bottom: 9px;
  display: flex;
  flex-direction: column;
  animation: msgIn 260ms var(--ease) both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg.guest { align-self: flex-start; }
.msg.ai, .msg.human { align-self: flex-end; align-items: flex-end; }

.msg-bubble {
  padding: 9px 12px;
  border-radius: var(--r-md);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  position: relative;
}
.msg.guest .msg-bubble {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-top-left-radius: 3px;
  color: var(--ink);
}
.msg.ai .msg-bubble {
  background: var(--teal);
  color: #fff;
  border-top-right-radius: 3px;
  box-shadow: 0 1px 2px rgba(10,79,86,0.18);
}
.msg.human .msg-bubble {
  background: #2B3F49;
  color: #F2F7F8;
  border-top-right-radius: 3px;
}
.msg-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 10px;
  color: var(--ink-4);
  font-family: var(--f-mono);
}
.msg-tag {
  font-family: var(--f-body);
  font-size: 10px;
  padding: 0.5px 4px;
  border-radius: 3px;
  background: var(--teal-soft);
  color: var(--teal);
}
.msg-tag.human-tag { background: var(--slate-soft); color: var(--slate); }

.trans-toggle {
  font-size: 10.5px;
  color: var(--ink-3);
  text-decoration: underline;
  text-decoration-color: var(--hairline-strong);
  text-underline-offset: 2px;
  margin-top: 3px;
  align-self: flex-start;
}
.msg.ai .trans-toggle { align-self: flex-end; }
.trans-toggle:hover { color: var(--teal); }
.translation {
  margin-top: 5px;
  padding: 7px 9px;
  background: var(--surface-2);
  border-left: 2px solid var(--teal-line);
  border-radius: 3px;
  font-size: 11.5px;
  color: var(--ink-2);
  line-height: 1.55;
  white-space: pre-wrap;
  max-width: 100%;
}

/* AI 拟稿卡片 */
.draft {
  margin: 4px 0 10px;
  background: var(--surface);
  border: 1px solid var(--teal-line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-2);
  animation: msgIn 300ms var(--ease) both;
}
.draft-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(180deg, #F2F9FA, #EDF5F6);
  border-bottom: 1px solid var(--teal-line);
}
.draft-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--teal-deep);
  display: flex;
  align-items: center;
  gap: 6px;
}
.draft-title svg { width: 12px; height: 12px; }
.draft-mode {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: 9.5px;
  padding: 1.5px 5px;
  border-radius: 3px;
  background: #fff;
  border: 1px solid var(--teal-line);
  color: var(--teal);
}
.draft-body { padding: 12px 13px; }
.draft-text {
  font-size: 13px;
  line-height: 1.62;
  color: var(--ink);
  white-space: pre-wrap;
  outline: none;
  border-radius: 4px;
  transition: box-shadow var(--t-fast);
}
.draft-text:focus { box-shadow: 0 0 0 2px rgba(14,106,115,0.13); background: #FBFDFD; }
.draft-text[contenteditable="true"] { cursor: text; }

.gates {
  display: flex;
  gap: 5px;
  margin-top: 11px;
  flex-wrap: wrap;
}
.gate {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  padding: 2.5px 7px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--ink-3);
  cursor: help;
  position: relative;
}
.gate.pass { background: var(--green-soft); color: var(--green); }
.gate.fail { background: var(--red-soft); color: var(--red); }
.gate svg { width: 9px; height: 9px; }
.gate:hover .gate-tip { opacity: 1; visibility: visible; transform: translateY(0); }
.gate-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  width: 230px;
  background: #14242C;
  color: #D9E6E9;
  font-size: 11px;
  line-height: 1.5;
  padding: 7px 9px;
  border-radius: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(3px);
  transition: all var(--t-fast) var(--ease);
  z-index: 30;
  box-shadow: var(--shadow-pop);
  font-family: var(--f-body);
  pointer-events: none;
}

.draft-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-top: 1px solid var(--hairline);
  background: var(--surface-2);
}
.draft-foot .meta {
  font-size: 10.5px;
  color: var(--ink-4);
  font-family: var(--f-mono);
  display: flex;
  align-items: center;
  gap: 8px;
}
.draft-foot .spacer { flex: 1; }

.sources {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px dashed var(--hairline-strong);
}
.sources-label {
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.04em;
  margin-bottom: 5px;
  text-transform: uppercase;
}
.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--ink-2);
  background: var(--surface-3);
  padding: 2px 6px;
  border-radius: 4px;
  margin: 0 4px 4px 0;
}
.source-chip svg { width: 9px; height: 9px; color: var(--ink-4); }

/* 转人工卡片 */
.handoff-card {
  margin: 4px 0 10px;
  background: var(--surface);
  border: 1px solid #E8C9C6;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-2);
}
.handoff-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  background: var(--red-soft);
  border-bottom: 1px solid #EFD7D4;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--red);
}
.handoff-head svg { width: 12px; height: 12px; }
.handoff-body { padding: 11px 13px; }
.handoff-reason { font-size: 12.5px; color: var(--ink); line-height: 1.55; margin-bottom: 8px; }
.handoff-triggers { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.trigger-chip {
  font-family: var(--f-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #fff;
  border: 1px solid #E8C9C6;
  color: var(--red);
}
.handoff-advice {
  padding: 9px 10px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  font-size: 11.5px;
  color: var(--ink-2);
  line-height: 1.6;
  border-left: 2px solid var(--amber);
}
.handoff-advice b { color: var(--ink); font-weight: 600; }

/* 输入区 */
.composer {
  flex-shrink: 0;
  background: var(--surface);
  border-top: 1px solid var(--hairline);
  padding: 10px 14px 11px;
}
.composer-box {
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  transition: all var(--t-fast) var(--ease);
  background: var(--surface);
}
.composer-box:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14,106,115,0.07); }
.composer textarea {
  width: 100%;
  border: none;
  resize: none;
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.6;
  min-height: 62px;
  max-height: 160px;
  background: transparent;
  color: var(--ink);
}
.composer textarea::placeholder { color: var(--ink-4); }
.composer-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 7px;
  border-top: 1px solid var(--hairline);
}
.composer-bar .spacer { flex: 1; }
.kbd {
  font-family: var(--f-mono);
  font-size: 9.5px;
  color: var(--ink-4);
  border: 1px solid var(--hairline);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 0 3px;
  line-height: 1.6;
  background: var(--surface-2);
}
.lang-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--ink-3);
  background: var(--surface-3);
  padding: 2px 7px;
  border-radius: 4px;
}
.lang-hint b { color: var(--teal); font-weight: 600; }

/* ---------- 右侧上下文 ---------- */
.context {
  width: 288px;
  flex-shrink: 0;
  background: var(--surface);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.ctx-block {
  padding: 13px 15px;
  border-bottom: 1px solid var(--hairline);
}
.ctx-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  font-weight: 500;
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.ctx-label svg { width: 11px; height: 11px; }

.kv {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 3.5px 0;
  font-size: 12px;
}
.kv-k { color: var(--ink-3); flex-shrink: 0; }
.kv-v { color: var(--ink); text-align: right; font-weight: 500; }
.kv-v.mono { font-family: var(--f-mono); font-size: 11.5px; }

.order-card {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 10px 11px;
}
.order-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.order-id { font-family: var(--f-mono); font-size: 11px; color: var(--ink-2); font-weight: 500; }
.order-amount {
  margin-left: auto;
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.order-amount small { font-size: 10px; color: var(--ink-3); font-weight: 500; margin-left: 2px; }

.room-mini {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 8px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
}
.room-thumb {
  width: 40px; height: 40px;
  border-radius: 5px;
  background: repeating-linear-gradient(45deg, #E8EFF0, #E8EFF0 4px, #F2F7F8 4px, #F2F7F8 8px);
  display: grid; place-items: center;
  font-family: var(--f-mono);
  font-size: 8px;
  color: var(--ink-4);
  flex-shrink: 0;
  border: 1px solid var(--hairline);
}
.room-mini-name { font-size: 12px; font-weight: 600; }
.room-mini-sub { font-size: 10.5px; color: var(--ink-3); }

.risk-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  font-size: 11.5px;
  margin-bottom: 5px;
}
.risk-row.high { background: var(--red-soft); color: var(--red); }
.risk-row.medium { background: var(--amber-soft); color: var(--amber); }
.risk-row.low { background: var(--green-soft); color: var(--green); }
.risk-row b { font-weight: 600; }
.risk-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.conf-bar {
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 3px;
}
.conf-fill { height: 100%; border-radius: 2px; transition: width 600ms var(--ease); }

.agent-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 12px;
}
.agent-row .meta { min-width: 0; }
.agent-row .name { font-weight: 500; }
.agent-row .role { font-size: 10.5px; color: var(--ink-3); }

/* ---------- 视图切换 ---------- */
.view { display: none; height: 100%; overflow: hidden; }
.view.on { display: flex; }
.view.on.col { flex-direction: column; }

/* ---------- 知识库视图 ---------- */
.kb-wrap { display: flex; height: 100%; min-height: 0; }
.kb-main { flex: 1; overflow-y: auto; padding: 18px 22px 40px; min-width: 0; }

.kb-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.kb-cat {
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--ink-2);
  border: 1px solid var(--hairline);
  background: var(--surface);
  transition: all var(--t-fast) var(--ease);
}
.kb-cat:hover { border-color: var(--hairline-strong); background: var(--surface-2); }
.kb-cat.on { background: var(--teal); color: #fff; border-color: var(--teal); }
.kb-cat .n { font-family: var(--f-mono); font-size: 10px; opacity: 0.65; margin-left: 4px; }

.kb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}
.kb-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 12px 13px;
  transition: all var(--t-fast) var(--ease);
  cursor: pointer;
  position: relative;
}
.kb-card:hover {
  border-color: var(--teal-line);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}
.kb-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
}
.kb-pri {
  font-family: var(--f-mono);
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
}
.pri-P0 { background: var(--red-soft); color: var(--red); }
.pri-P1 { background: var(--amber-soft); color: var(--amber); }
.kb-locale {
  font-family: var(--f-mono);
  font-size: 9px;
  color: var(--ink-4);
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--surface-3);
}
.kb-status {
  margin-left: auto;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.st-live { background: var(--green-soft); color: var(--green); }
.st-draft { background: var(--slate-soft); color: var(--slate); }
.st-gap { background: var(--red-soft); color: var(--red); }
.kb-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 5px;
  line-height: 1.4;
}
.kb-body {
  font-size: 11.5px;
  color: var(--ink-2);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kb-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--hairline);
  font-size: 10.5px;
  color: var(--ink-4);
  font-family: var(--f-mono);
}
.kb-foot .hits { margin-left: auto; }

.kb-side {
  width: 320px;
  flex-shrink: 0;
  border-left: 1px solid var(--hairline);
  background: var(--surface);
  padding: 18px 16px;
  overflow-y: auto;
}
.gap-item {
  padding: 9px 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  margin-bottom: 7px;
  background: var(--surface-2);
}
.gap-q { font-size: 12px; font-weight: 500; line-height: 1.45; margin-bottom: 5px; }
.gap-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--ink-3);
}
.gap-cnt {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--red);
  background: var(--red-soft);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ---------- 看板视图 ---------- */
.dash {
  overflow-y: auto;
  padding: 18px 22px 40px;
  height: 100%;
}
.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 11px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 14px 15px;
}
.card.span-3 { grid-column: span 3; }
.card.span-4 { grid-column: span 4; }
.card.span-5 { grid-column: span 5; }
.card.span-6 { grid-column: span 6; }
.card.span-7 { grid-column: span 7; }
.card.span-8 { grid-column: span 8; }
.card.span-12 { grid-column: span 12; }

.card-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-4);
  font-weight: 500;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 兜底：所有卡片标题内嵌 SVG 图标统一定尺寸，防止无宽高导致撑满容器 */
.card-title svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.metric-big {
  font-family: var(--f-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--ink);
}
.metric-big small { font-size: 14px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.metric-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  margin-top: 6px;
  font-family: var(--f-mono);
}
.metric-delta.up { color: var(--green); }
.metric-delta.down { color: var(--red); }
.metric-delta.flat { color: var(--ink-4); }
.metric-sub { font-size: 11px; color: var(--ink-3); margin-top: 5px; }

.spark { width: 100%; height: 34px; display: block; margin-top: 8px; }

.bar-ch {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5.5px 0;
  font-size: 12px;
}
.bar-ch-label { width: 78px; color: var(--ink-2); flex-shrink: 0; }
.bar-track {
  flex: 1;
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
}
.bar-fill { height: 100%; background: var(--teal); border-radius: 3px 0 0 3px; transition: width 500ms var(--ease); }
.bar-fill.alt { background: #9DC3C7; border-radius: 0 3px 3px 0; }
.bar-num {
  width: 52px;
  text-align: right;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-3);
  flex-shrink: 0;
}

.intent-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px dashed var(--hairline);
}
.intent-row:last-child { border-bottom: none; }
.intent-rank {
  font-family: var(--f-mono);
  font-size: 9.5px;
  color: var(--ink-4);
  width: 14px;
  flex-shrink: 0;
}
.intent-name { flex: 1; color: var(--ink); }
.intent-bar {
  width: 80px;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.intent-bar i { display: block; height: 100%; background: var(--teal); border-radius: 2px; }
.intent-n {
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  width: 30px;
  text-align: right;
  flex-shrink: 0;
}

.watch-item {
  display: flex;
  gap: 8px;
  padding: 7px 0;
  font-size: 11.5px;
  border-bottom: 1px solid var(--hairline);
}
.watch-item:last-child { border-bottom: none; }
.watch-ico {
  width: 16px; height: 16px;
  border-radius: 4px;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-family: var(--f-mono);
  font-size: 9px;
  font-weight: 700;
  margin-top: 1px;
}
.watch-ico.warn { background: var(--amber-soft); color: var(--amber); }
.watch-ico.info { background: var(--slate-soft); color: var(--slate); }
.watch-ico.err { background: var(--red-soft); color: var(--red); }
.watch-label { font-weight: 500; }
.watch-detail { color: var(--ink-3); font-size: 10.5px; margin-top: 1px; line-height: 1.45; }
.watch-val { margin-left: auto; font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-2); flex-shrink: 0; }

.legend {
  display: flex;
  gap: 12px;
  font-size: 10.5px;
  color: var(--ink-3);
  margin-top: 8px;
}
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 7px; height: 7px; border-radius: 2px; }

/* ---------- Toast ---------- */
.toasts {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 7px;
  z-index: 999;
  align-items: center;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #14242C;
  color: #E8F1F3;
  font-size: 12.5px;
  padding: 9px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow-pop);
  animation: toastIn 280ms var(--ease) both;
  max-width: 440px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.out { animation: toastOut 200ms var(--ease) both; }
@keyframes toastOut {
  to { opacity: 0; transform: translateY(6px) scale(0.98); }
}
.toast-ico {
  width: 16px; height: 16px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
}
.toast-ico.ok { background: rgba(79,191,139,0.2); color: #6ED9A4; }
.toast-ico.warn { background: rgba(201,152,58,0.22); color: #E3BA6A; }
.toast-ico.info { background: rgba(255,255,255,0.12); color: #C7D9DD; }

/* ---------- Tweaks ---------- */
.tweaks-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--nav);
  color: var(--nav-ink);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-pop);
  z-index: 900;
  transition: transform var(--t-fast) var(--ease);
}
.tweaks-btn:hover { transform: rotate(45deg); }
.tweaks-btn svg { width: 15px; height: 15px; }

.tweaks {
  position: fixed;
  right: 16px;
  bottom: 58px;
  width: 258px;
  background: #14242C;
  color: #DCE9EC;
  border-radius: var(--r-md);
  padding: 14px;
  z-index: 901;
  box-shadow: var(--shadow-pop);
  border: 1px solid rgba(255,255,255,0.08);
  animation: toastIn 240ms var(--ease) both;
}
.tweaks h4 {
  font-family: var(--f-display);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 11px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tweak-row { margin-bottom: 11px; }
.tweak-row label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #93AAB2;
  margin-bottom: 4px;
}
.tweak-row label b { color: #DCE9EC; font-family: var(--f-mono); font-size: 10.5px; }
.tweak-row input[type="range"] {
  width: 100%;
  height: 3px;
  -webkit-appearance: none;
  background: rgba(255,255,255,0.14);
  border-radius: 2px;
  outline: none;
}
.tweak-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #35B4BF;
  cursor: pointer;
  border: 2px solid #14242C;
}
.tweak-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  padding: 4px 0;
  cursor: pointer;
}
.sw {
  width: 28px; height: 15px;
  border-radius: 8px;
  background: rgba(255,255,255,0.16);
  position: relative;
  transition: background var(--t-fast);
  flex-shrink: 0;
}
.sw::after {
  content: '';
  position: absolute;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #fff;
  top: 2px; left: 2px;
  transition: transform var(--t-fast) var(--ease);
}
.sw.on { background: #1E8B95; }
.sw.on::after { transform: translateX(13px); }

/* ---------- 空状态 ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  color: var(--ink-4);
  font-size: 12.5px;
  padding: 40px;
  text-align: center;
}
.empty-mark {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--surface-3);
  display: grid; place-items: center;
  margin-bottom: 4px;
}
.empty-mark svg { width: 18px; height: 18px; color: var(--ink-4); }

/* ---------- 响应式 ---------- */
@media (max-width: 1400px) {
  .context { width: 264px; }
  .queue { width: 292px; }
}
@media (max-width: 1240px) {
  .context { display: none; }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 60px 1fr; }
  .nav-brand-name, .nav-brand-sub, .nav-section-label, .nav-item span,
  .nav-count, .nav-agent-meta, .nav-property-label { display: none; }
  .nav-item { justify-content: center; padding: 9px; }
  .queue { width: 268px; }
  .card.span-3, .card.span-4 { grid-column: span 6; }
  .card.span-5, .card.span-7 { grid-column: span 12; }
}
