:root {
  --bg: #070d18;
  --bg-2: #0b1424;
  --panel: #101b2c;
  --panel-2: #16233a;
  --panel-3: #1b2a44;
  --line: rgba(94, 132, 196, 0.20);
  --line-strong: rgba(94, 132, 196, 0.40);
  --text: #e9f0fc;
  --muted: #8ba0c2;
  --dim: #64789a;
  --green: #3fd6a8;
  --blue: #5b8cff;
  --amber: #f0b64a;
  --pink: #ff7a9c;
  --danger: #ff6a6a;
  --violet: #a58bff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 40px rgba(3, 8, 18, 0.55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; overflow-x: hidden; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: 0.2px; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; }
[hidden] { display: none !important; }

/* ---------- 低多边形背景 ---------- */
.bg-shapes { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-shapes .shape { position: absolute; display: block; opacity: 0.5; }
.bg-shapes .s1 {
  width: 520px; height: 520px; top: -230px; right: -130px;
  background: linear-gradient(150deg, rgba(63, 214, 168, 0.15), rgba(91, 140, 255, 0.04));
  clip-path: polygon(50% 0, 100% 38%, 78% 100%, 18% 88%, 0 30%);
}
.bg-shapes .s2 {
  width: 440px; height: 440px; bottom: -190px; left: -150px;
  background: linear-gradient(40deg, rgba(91, 140, 255, 0.16), rgba(63, 214, 168, 0.03));
  clip-path: polygon(20% 0, 90% 12%, 100% 70%, 46% 100%, 0 66%);
}
.bg-shapes .s3 {
  width: 250px; height: 250px; top: 44%; left: 47%;
  background: rgba(240, 182, 74, 0.05);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.app { position: relative; z-index: 1; max-width: 1560px; margin: 0 auto; padding: 16px 20px 26px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px 18px;
  background: linear-gradient(120deg, rgba(22, 35, 58, 0.92), rgba(16, 27, 44, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 260px; }
.logo {
  width: 42px; height: 42px; flex: 0 0 42px;
  display: grid; place-items: center;
  background: rgba(91, 140, 255, 0.10);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}
.logo svg { width: 26px; height: 26px; }
.brand-text h1 { font-size: 16px; }
.brand-text p { font-size: 12px; color: var(--muted); }

.tabs { display: flex; gap: 4px; padding: 3px; background: rgba(7, 13, 24, 0.6); border: 1px solid var(--line); border-radius: 12px; }
.tab {
  padding: 7px 14px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 13px;
  transition: background 0.16s ease, color 0.16s ease;
}
.tab:hover { color: var(--text); background: rgba(91, 140, 255, 0.10); }
.tab.active { color: #071019; background: linear-gradient(135deg, var(--green), #57e8c0); font-weight: 600; }

.top-status { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.badge {
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
  background: rgba(63, 214, 168, 0.14); color: var(--green);
  border: 1px solid rgba(63, 214, 168, 0.34);
  white-space: nowrap;
}
.badge.soft { background: rgba(91, 140, 255, 0.12); color: #9dbbff; border-color: rgba(91, 140, 255, 0.32); }
.badge.warn { background: rgba(240, 182, 74, 0.14); color: var(--amber); border-color: rgba(240, 182, 74, 0.34); }
.clock { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }

/* ---------- 视图容器 ---------- */
.workspace { margin-top: 14px; }
.view { display: none; }
.view.active { display: block; animation: fade 0.22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin: 4px 2px 14px;
}
.view-head h2 { font-size: 18px; }
.view-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }

.pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.pane-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.pane-head h2 { font-size: 14px; }

/* ---------- 工作台三栏 ---------- */
.desk-grid {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: stretch;
  height: calc(100vh - 168px);
  min-height: 560px;
}

/* 会话队列 */
.conv-pane { display: flex; flex-direction: column; min-height: 0; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 12px 6px; }
.filter-chip {
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
  background: rgba(91, 140, 255, 0.08); color: var(--muted);
  border: 1px solid var(--line);
}
.filter-chip:hover { color: var(--text); border-color: var(--line-strong); }
.filter-chip.active { background: rgba(63, 214, 168, 0.16); color: var(--green); border-color: rgba(63, 214, 168, 0.4); }
.filter-chip .n { opacity: 0.75; margin-left: 4px; font-variant-numeric: tabular-nums; }

.search-box { padding: 6px 12px 10px; }
.search-box input {
  width: 100%; padding: 8px 11px; border-radius: var(--radius-sm);
  background: rgba(7, 13, 24, 0.72); border: 1px solid var(--line); color: var(--text);
  outline: none;
}
.search-box input:focus { border-color: rgba(63, 214, 168, 0.5); }

.conv-list { flex: 1; overflow-y: auto; padding: 0 8px 10px; }
.conv-list::-webkit-scrollbar, .chat-body::-webkit-scrollbar, .side-pane::-webkit-scrollbar { width: 6px; }
.conv-list::-webkit-scrollbar-thumb, .chat-body::-webkit-scrollbar-thumb, .side-pane::-webkit-scrollbar-thumb {
  background: rgba(94, 132, 196, 0.3); border-radius: 3px;
}

.conv-item {
  display: grid; grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px; align-items: start;
  padding: 10px 10px; border-radius: 12px; cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.conv-item:hover { background: rgba(91, 140, 255, 0.07); }
.conv-item.active { background: rgba(63, 214, 168, 0.10); border-color: rgba(63, 214, 168, 0.34); }
.conv-avatar {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; font-size: 13px; font-weight: 600;
  color: #0a1420;
}
.conv-main { min-width: 0; }
.conv-name { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.conv-name .vip {
  font-size: 10px; padding: 1px 5px; border-radius: 4px;
  background: rgba(240, 182, 74, 0.18); color: var(--amber); font-weight: 500;
}
.conv-sub {
  font-size: 12px; color: var(--muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.conv-time { font-size: 11px; color: var(--dim); white-space: nowrap; }
.pill {
  font-size: 11px; padding: 1px 7px; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent;
}
.pill.waiting { background: rgba(240, 182, 74, 0.16); color: var(--amber); border-color: rgba(240, 182, 74, 0.3); }
.pill.active { background: rgba(63, 214, 168, 0.14); color: var(--green); border-color: rgba(63, 214, 168, 0.3); }
.pill.closed { background: rgba(139, 160, 194, 0.14); color: var(--muted); border-color: var(--line); }
.pill.ai { background: rgba(91, 140, 255, 0.14); color: #9dbbff; border-color: rgba(91, 140, 255, 0.3); }
.pill.human { background: rgba(165, 139, 255, 0.16); color: var(--violet); border-color: rgba(165, 139, 255, 0.3); }

/* 对话区 */
.chat-pane { display: flex; flex-direction: column; min-height: 0; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, rgba(27, 42, 68, 0.5), transparent);
}
.chat-title h2 { font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-title p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.chat-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }

.msg { display: flex; gap: 7px; max-width: 84%; }
.msg.role-customer { align-self: flex-start; flex-direction: row; }
.msg.role-ai, .msg.role-agent { align-self: flex-end; flex-direction: row-reverse; }
.msg.role-system { align-self: center; max-width: 92%; }

.msg-avatar {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.msg.role-ai .msg-avatar { background: rgba(63, 214, 168, 0.14); color: var(--green); border-color: rgba(63, 214, 168, 0.3); }
.msg.role-agent .msg-avatar { background: rgba(165, 139, 255, 0.16); color: var(--violet); border-color: rgba(165, 139, 255, 0.3); }

.msg-wrap { min-width: 0; }
.msg-bubble {
  padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word;
  background: var(--panel-2); border: 1px solid var(--line);
}
.msg.role-customer .msg-bubble { border-top-left-radius: 4px; }
.msg.role-ai .msg-bubble {
  background: linear-gradient(135deg, rgba(63, 214, 168, 0.14), rgba(91, 140, 255, 0.10));
  border-color: rgba(63, 214, 168, 0.32); border-top-right-radius: 4px;
}
.msg.role-ai .msg-bubble.low { border-color: rgba(240, 182, 74, 0.45); background: rgba(240, 182, 74, 0.10); }
.msg.role-agent .msg-bubble {
  background: rgba(165, 139, 255, 0.12); border-color: rgba(165, 139, 255, 0.3);
  border-top-right-radius: 4px;
}
.msg-system-text {
  font-size: 11.5px; color: var(--dim); background: rgba(7, 13, 24, 0.6);
  border: 1px dashed var(--line); border-radius: 999px; padding: 3px 12px; text-align: center;
}
.msg-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 11px; color: var(--dim); margin-top: 4px;
}
.msg.role-ai .msg-meta, .msg.role-agent .msg-meta { justify-content: flex-end; }
.src-tag {
  padding: 0 6px; border-radius: 5px; font-size: 10.5px;
  background: rgba(91, 140, 255, 0.16); color: #9dbbff;
}
.src-tag.llm { background: rgba(63, 214, 168, 0.16); color: var(--green); }
.src-tag.kb { background: rgba(91, 140, 255, 0.16); color: #9dbbff; }
.src-tag.fallback { background: rgba(240, 182, 74, 0.18); color: var(--amber); }
.src-tag.human { background: rgba(165, 139, 255, 0.16); color: var(--violet); }

/* 建议条 */
.suggest-bar { border-top: 1px solid var(--line); padding: 10px 14px; background: rgba(27, 42, 68, 0.35); }
.suggest-card { display: flex; gap: 10px; align-items: flex-start; }
.suggest-icon {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(63, 214, 168, 0.14); color: var(--green); font-size: 12px;
}
.suggest-body { min-width: 0; flex: 1; }
.suggest-title { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.suggest-text {
  font-size: 12.5px; margin-top: 3px; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* 输入区 */
.composer { border-top: 1px solid var(--line); padding: 10px 14px 12px; }
.composer-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.seg { display: flex; background: rgba(7, 13, 24, 0.7); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span {
  display: block; padding: 4px 11px; border-radius: 7px; font-size: 12px; color: var(--muted);
}
.seg input:checked + span { background: rgba(63, 214, 168, 0.18); color: var(--green); font-weight: 600; }
.composer-meta select {
  padding: 5px 9px; border-radius: 9px; background: rgba(7, 13, 24, 0.7);
  border: 1px solid var(--line); color: var(--text); font-size: 12px; outline: none;
}
.hint-inline { font-size: 11.5px; color: var(--dim); }
.composer-row { display: flex; gap: 9px; align-items: flex-end; }
.composer-row textarea {
  flex: 1; min-height: 40px; max-height: 140px; resize: none;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: rgba(7, 13, 24, 0.72); border: 1px solid var(--line); color: var(--text);
  outline: none; line-height: 1.5;
}
.composer-row textarea:focus { border-color: rgba(63, 214, 168, 0.5); }

/* 右侧栏 */
.side-pane { padding: 0 0 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.side-card { border-bottom: 1px solid var(--line); padding: 12px 14px; }
.side-card:last-child { border-bottom: 0; }
.side-card h3 { font-size: 13px; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-card h3 .hint { font-weight: 400; }
.profile { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.profile-avatar {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 600; color: #0a1420;
}
.profile-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.profile-sub { font-size: 12px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 5px 8px; font-size: 12px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }
.tag-row { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 9px; }
.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 6px;
  background: rgba(91, 140, 255, 0.12); color: #9dbbff; border: 1px solid rgba(91, 140, 255, 0.24);
}
.tag.green { background: rgba(63, 214, 168, 0.12); color: var(--green); border-color: rgba(63, 214, 168, 0.26); }
.tag.amber { background: rgba(240, 182, 74, 0.14); color: var(--amber); border-color: rgba(240, 182, 74, 0.28); }
.tag.red { background: rgba(255, 106, 106, 0.14); color: var(--danger); border-color: rgba(255, 106, 106, 0.3); }
.tag.violet { background: rgba(165, 139, 255, 0.14); color: var(--violet); border-color: rgba(165, 139, 255, 0.28); }

.side-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.side-actions .ghost-btn { width: 100%; justify-content: center; }

.conf-bar { height: 6px; border-radius: 999px; background: rgba(7, 13, 24, 0.8); overflow: hidden; margin-top: 6px; }
.conf-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--amber), var(--green)); }
.conf-text { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: flex; justify-content: space-between; }

.kb-ref { font-size: 12px; color: var(--text); background: rgba(7, 13, 24, 0.5); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 10px; }
.kb-ref strong { display: block; font-size: 12.5px; margin-bottom: 3px; }
.kb-ref p { color: var(--muted); font-size: 11.5px; line-height: 1.6; }

/* ---------- 按钮 ---------- */
.primary-btn {
  padding: 8px 16px; border: 0; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--green), #57e8c0);
  color: #071019; font-weight: 600; font-size: 13px;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.primary-btn:hover { filter: brightness(1.06); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.ghost-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 13px; border-radius: var(--radius-sm);
  background: rgba(91, 140, 255, 0.08); border: 1px solid var(--line);
  color: var(--text); font-size: 12.5px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ghost-btn:hover { background: rgba(91, 140, 255, 0.16); border-color: var(--line-strong); }
.ghost-btn.small { padding: 4px 9px; font-size: 11.5px; }
.ghost-btn.danger { color: var(--danger); border-color: rgba(255, 106, 106, 0.3); background: rgba(255, 106, 106, 0.08); }
.ghost-btn.tiny { padding: 3px 8px; font-size: 11px; }

/* ---------- 通用面板 / 表格 ---------- */
.panel {
  padding: 14px 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-head h3 { font-size: 13.5px; }
.hint { font-size: 11.5px; color: var(--dim); }
.panel-tip { font-size: 12px; color: var(--muted); margin-bottom: 12px; line-height: 1.7; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .filters { padding: 0; }
.toolbar input[type="search"] {
  flex: 1; min-width: 200px; padding: 8px 12px; border-radius: var(--radius-sm);
  background: rgba(7, 13, 24, 0.72); border: 1px solid var(--line); color: var(--text); outline: none;
}
.toolbar input[type="search"]:focus { border-color: rgba(63, 214, 168, 0.5); }

.table-wrap {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: auto; box-shadow: var(--shadow);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th {
  text-align: left; padding: 11px 14px; color: var(--muted); font-weight: 500;
  background: rgba(27, 42, 68, 0.5); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid rgba(94, 132, 196, 0.12); vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: rgba(91, 140, 255, 0.05); }
.data-table .num, .data-table .act { text-align: right; white-space: nowrap; }
.data-table .num { text-align: center; }
.kb-title { font-weight: 600; font-size: 13px; }
.kb-q { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.kb-kw {
  font-size: 11.5px; color: var(--dim); max-width: 210px;
  word-break: break-word; line-height: 1.5;
}
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ---------- 工单 ---------- */
.ticket-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.ticket-card {
  padding: 14px 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 9px;
  border-left: 3px solid var(--line-strong);
}
.ticket-card.urgent { border-left-color: var(--danger); }
.ticket-card.high { border-left-color: var(--amber); }
.ticket-card.normal { border-left-color: var(--blue); }
.ticket-card.low { border-left-color: var(--dim); }
.ticket-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ticket-top h4 { font-size: 13.5px; line-height: 1.5; }
.ticket-body { font-size: 12px; color: var(--muted); line-height: 1.65; }
.ticket-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--dim); }
.ticket-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }

/* ---------- 看板 ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi {
  padding: 14px 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; right: -18px; top: -18px; width: 64px; height: 64px;
  background: rgba(63, 214, 168, 0.07); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-value { font-size: 24px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi-foot { font-size: 11.5px; color: var(--dim); margin-top: 3px; }

.board-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.trend-chart { display: flex; gap: 10px; align-items: flex-end; height: 168px; padding-top: 8px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.trend-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; min-height: 0; }
.trend-bar { display: block; width: 42%; max-width: 16px; border-radius: 4px 4px 0 0; background: rgba(91, 140, 255, 0.5); min-height: 4px; }
.trend-bar.ai { background: linear-gradient(180deg, var(--green), rgba(63, 214, 168, 0.35)); }
.trend-label { font-size: 11px; color: var(--dim); }
.trend-value { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 78px minmax(0, 1fr) 34px; gap: 9px; align-items: center; font-size: 12px; }
.bar-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { display: block; height: 8px; border-radius: 999px; background: rgba(7, 13, 24, 0.8); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--green)); }
.bar-num { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }

.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { width: 132px; height: 132px; border-radius: 50%; flex: 0 0 132px; position: relative; }
.donut::after {
  content: ""; position: absolute; inset: 26px; border-radius: 50%; background: var(--panel);
}
.legend { display: flex; flex-direction: column; gap: 7px; font-size: 12px; min-width: 0; }
.legend li { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.legend i { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 9px; }
.legend b { color: var(--text); font-weight: 600; margin-left: auto; }

.rank-list { display: flex; flex-direction: column; gap: 9px; counter-reset: rank; }
.rank-list li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 9px; align-items: center; font-size: 12.5px; }
.rank-list li::before {
  counter-increment: rank; content: counter(rank);
  width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center;
  font-size: 10.5px; background: rgba(91, 140, 255, 0.14); color: #9dbbff;
}
.rank-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-hits { color: var(--green); font-variant-numeric: tabular-nums; }

.agent-list { display: flex; flex-direction: column; gap: 10px; }
.agent-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.agent-avatar { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #0a1420; }
.agent-name { font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); display: inline-block; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(63, 214, 168, 0.16); }
.agent-sub { font-size: 11px; color: var(--dim); }
.agent-num { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.log-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.log-item { display: grid; grid-template-columns: 44px 42px minmax(0, 1fr); gap: 8px; font-size: 11.5px; align-items: baseline; }
.log-time { color: var(--dim); font-variant-numeric: tabular-nums; }
.log-src { color: #9dbbff; }
.log-text { color: var(--muted); line-height: 1.55; }
.log-item.warn .log-text { color: var(--amber); }

/* ---------- 设置 ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.settings-grid .span2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.field input, .field select, .field textarea {
  padding: 8px 11px; border-radius: var(--radius-sm);
  background: rgba(7, 13, 24, 0.72); border: 1px solid var(--line); color: var(--text);
  outline: none; font-size: 13px; line-height: 1.6;
}
.field textarea { resize: vertical; min-height: 40px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(63, 214, 168, 0.5); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.switch-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text); margin-bottom: 12px; }
.switch-row input { width: 16px; height: 16px; accent-color: var(--green); }
.panel-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- 空状态 ---------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 40px 20px; color: var(--dim); text-align: center; font-size: 12.5px;
}
.empty-state strong { color: var(--text); font-size: 14px; }
.empty-state.small { padding: 20px 14px; }

/* ---------- 弹窗 ---------- */
.modal {
  border: 1px solid var(--line-strong); border-radius: 16px; padding: 0;
  background: var(--panel); color: var(--text); box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6);
  width: min(460px, calc(100vw - 40px)); max-height: calc(100vh - 60px);
}
.modal.wide { width: min(620px, calc(100vw - 40px)); }
.modal::backdrop { background: rgba(4, 8, 16, 0.66); backdrop-filter: blur(2px); }
.modal-body { padding: 18px 20px 16px; overflow-y: auto; max-height: calc(100vh - 62px); }
.modal-body h3 { font-size: 15px; margin-bottom: 4px; }
.modal-tip { font-size: 12px; color: var(--muted); margin-bottom: 14px; line-height: 1.65; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ---------- 页脚 / 提示 ---------- */
.foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 16px; padding: 0 4px; font-size: 11.5px; color: var(--dim);
}

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  padding: 9px 18px; border-radius: 999px; font-size: 12.5px;
  background: rgba(16, 27, 44, 0.96); border: 1px solid var(--line-strong);
  color: var(--text); opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease; z-index: 99;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 106, 106, 0.5); color: #ffb3b3; }

/* ---------- 响应式 ---------- */
@media (max-width: 1360px) {
  .desk-grid { grid-template-columns: 262px minmax(0, 1fr) 288px; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1120px) {
  .desk-grid { grid-template-columns: 250px minmax(0, 1fr); height: auto; }
  .side-pane { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .side-pane .side-card { flex: 1 1 260px; border-bottom: 0; }
  .board-grid, .settings-grid { grid-template-columns: 1fr; }
  .chat-pane { min-height: 520px; }
}
@media (max-width: 760px) {
  .app { padding: 12px 12px 20px; }
  .desk-grid { grid-template-columns: 1fr; }
  .conv-pane { max-height: 300px; }
  .chat-pane { min-height: 460px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tabs { order: 3; width: 100%; }
  .brand { min-width: 0; }
  .top-status { margin-left: 0; }
}

/* ---------- 私有化部署信息 ---------- */
.deploy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.deploy-item { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.02); }
.deploy-item.span2 { grid-column: 1 / -1; }
.deploy-item span { font-size: 11px; color: var(--muted); }
.deploy-item strong { font-size: 13px; color: var(--text); }

/* ---------- 显著版权条 ---------- */
.copyright-bar {
  margin-top: 16px; border-radius: 12px;
  background: linear-gradient(90deg, #d4a72c 0%, #f3d475 48%, #c9991f 100%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}
.copyright-inner { display: flex; align-items: center; gap: 10px; padding: 14px 20px; color: #2b2109; }
.copyright-mark { font-size: 17px; font-weight: 700; }
.copyright-main { font-size: 15px; font-weight: 800; letter-spacing: 1px; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35); }
.copyright-sep { opacity: 0.5; }
.copyright-sub { font-size: 12px; opacity: 0.86; }
.copyright-version { margin-left: auto; font-size: 11px; opacity: 0.75; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .copyright-inner { justify-content: flex-start; padding: 12px 16px; flex-wrap: wrap; }
  .copyright-version { margin-left: 0; }
}
