:root {
  --ink: #0f172a;
  --muted: #6b7a90;
  --line: #e4e9f2;
  --bg: #f4f6fb;
  --side: #101a2b;
  --side-ink: #9fb0c9;
  --primary: #2f6fed;
  --green: #16a34a;
  --orange: #f59e0b;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
}

a { text-decoration: none; }

/* ---------------- 布局 ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.side {
  width: 216px;
  flex: 0 0 216px;
  background: var(--side);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 18px;
  color: #fff;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2f6fed, #6f9bff);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex: 0 0 36px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; letter-spacing: .5px; }
.brand-text small { color: var(--side-ink); font-size: 11px; }

.side-nav { flex: 1; overflow-y: auto; }

.nav-label {
  font-size: 11px;
  letter-spacing: 1px;
  color: #5b6d88;
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--side-ink);
  font-size: 13.5px;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
}

.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item i { font-size: 15px; }

.side-foot {
  border-top: 1px solid rgba(255, 255, 255, .08);
  padding: 12px 8px 2px;
  font-size: 12px;
  color: #7f92ad;
  display: flex;
  align-items: center;
  gap: 7px;
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #64748b; }
.status-dot.ok { background: #22c55e; }
.status-dot.mock { background: #f59e0b; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 58px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-title { font-size: 16px; font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.who { color: var(--muted); font-size: 13px; }

.content { padding: 20px 22px 40px; }

/* ---------------- 通用卡片 ---------------- */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
  padding: 0;
  overflow: hidden;
}

.panel > form { padding: 16px 18px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 { font-size: 14px; font-weight: 600; margin: 0; }

.panel .table { font-size: 13.5px; }
.panel .table > :not(caption) > * > * { padding: .7rem .9rem; }
.panel .table thead th {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: #fafbfe;
  white-space: nowrap;
}

.empty-note { color: var(--muted); padding: 22px 18px; margin: 0; text-align: center; }

.link-sm { font-size: 12.5px; color: var(--primary); }
.link-sm:hover { text-decoration: underline; }

.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------------- 看板 ---------------- */
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
}

.stat-icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.stat-icon.blue { background: #e8f0ff; color: #2f6fed; }
.stat-icon.slate { background: #eef2f7; color: #475569; }
.stat-icon.green { background: #e7f7ee; color: #16a34a; }
.stat-icon.orange { background: #fdf1dd; color: #d97706; }
.stat-icon.teal { background: #e3f6f5; color: #0d9488; }
.stat-icon.purple { background: #f0ebfe; color: #7c3aed; }

.stat-num { font-size: 21px; font-weight: 700; line-height: 1.15; }
.stat-num small { font-size: 12px; font-weight: 500; color: var(--muted); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.legend { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-left: 8px; }
.legend .lg-a { background: #2f6fed; }
.legend .lg-b { background: #9ec1ff; }

.trend {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  height: 208px;
  padding: 22px 20px 12px;
}

.trend-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }

.trend-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 100%;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}

.trend-bar { width: 16px; border-radius: 4px 4px 0 0; min-height: 2px; transition: height .3s; }
.trend-bar.a { background: #2f6fed; }
.trend-bar.b { background: #9ec1ff; }

.trend-label { text-align: center; font-size: 11px; color: var(--muted); padding-top: 6px; }

.source-row { padding: 10px 18px; }
.source-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.progress.thin { height: 6px; border-radius: 4px; background: #eef2f8; }
.progress.thin .progress-bar { background: #2f6fed; border-radius: 4px; }

/* ---------------- 表格 ---------------- */
.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.kw-cell { color: var(--muted); font-size: 12.5px; }
.answer-cell {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #334155;
}
.row-disabled { opacity: .55; }

/* ---------------- 会话详情 ---------------- */
.chat-log {
  padding: 18px;
  max-height: 640px;
  overflow-y: auto;
  background: #fafbfe;
}

.bubble-row { display: flex; margin-bottom: 12px; }
.bubble-row.out { justify-content: flex-end; }

.bubble {
  max-width: 72%;
  padding: 9px 13px;
  border-radius: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13.5px;
}

.bubble.in { background: #fff; border: 1px solid var(--line); border-top-left-radius: 3px; }
.bubble.out { background: #e8f0ff; color: #143a80; border-top-right-radius: 3px; }

.bubble-meta { font-size: 11px; color: #94a3b8; margin-top: 4px; }

.sys-line {
  text-align: center;
  font-size: 11.5px;
  color: #8a97a8;
  margin: 10px 0;
  background: rgba(148, 163, 184, .1);
  border-radius: 20px;
  padding: 4px 12px;
  display: inline-block;
}

.chat-log > .sys-line { display: block; width: fit-content; margin-left: auto; margin-right: auto; }

.info-list { padding: 6px 18px 14px; }
.info-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.info-list > div:last-child { border-bottom: 0; }
.info-list span { color: var(--muted); }
.info-list strong { font-weight: 500; text-align: right; word-break: break-all; }

.transfer-item { padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
.transfer-item:last-child { border-bottom: 0; }

/* ---------------- 模拟器 ---------------- */
.sim-panel { max-width: 860px; }
.sim-log {
  padding: 18px;
  height: 460px;
  overflow-y: auto;
  background: #fafbfe;
}
.sim-input { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
.sim-input .form-control { flex: 1; }
.sim-asset { margin-top: 6px; }
.sim-asset img { max-width: 220px; border-radius: 8px; border: 1px solid var(--line); display: block; }
.sim-asset a { display: inline-block; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; }
.sim-tag { font-size: 11px; color: #94a3b8; margin-top: 4px; }

/* ---------------- 登录 ---------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #e8f0ff 0, #f4f6fb 45%, #eef2f8 100%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px 28px 24px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .08);
}

.login-head { text-align: center; margin-bottom: 22px; }
.login-head .brand-mark { margin: 0 auto 12px; }
.login-head h1 { font-size: 19px; font-weight: 700; margin: 0 0 4px; }
.login-head p { font-size: 12.5px; color: var(--muted); margin: 0; }
.login-tip { font-size: 11.5px; color: #94a3b8; text-align: center; margin: 14px 0 0; }

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

/* ---------------- 小屏 ---------------- */
@media (max-width: 991.98px) {
  .app-shell { flex-direction: column; }
  .side { width: auto; flex: none; height: auto; position: static; padding: 12px; }
  .brand { padding-bottom: 10px; }
  .side-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav-label, .side-foot { display: none; }
  .nav-item { margin: 0; padding: 7px 10px; }
  .content { padding: 14px; }
  .trend { height: 160px; }
}
