* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #222;
  background: #f4f5f7;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 28px 0 10px; }
.muted { color: #888; font-weight: normal; font-size: 13px; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 180px;
  flex-shrink: 0;
  background: #1e293b;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
}
.brand { padding: 18px 16px; font-weight: bold; color: #fff; border-bottom: 1px solid #334155; }
.sidebar nav { flex: 1; padding: 8px 0; }
.sidebar nav a {
  display: block;
  padding: 10px 16px;
  color: #cbd5e1;
}
.sidebar nav a:hover { background: #334155; text-decoration: none; }
.sidebar nav a.active { background: #2563eb; color: #fff; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid #334155; font-size: 13px; }
.sidebar-foot a { color: #94a3b8; }
.tester-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
}
.tester-toggle.on { color: #fbbf24; }
.tester-toggle input { cursor: pointer; }
.readonly-tag {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 6px;
  border: 1px solid #475569;
  border-radius: 3px;
  font-size: 12px;
  color: #94a3b8;
}
.content { flex: 1; padding: 24px 28px; min-width: 0; }

/* 卡片 */
.cards { display: flex; flex-wrap: wrap; gap: 14px; }
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px 20px;
  min-width: 180px;
}
.card-title { color: #666; font-size: 13px; }
.card-value { font-size: 28px; font-weight: bold; margin-top: 6px; }
.card-sub { color: #2563eb; font-size: 12px; margin-top: 4px; }

/* 筛选 */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.filters input[type="text"], .filters input[type="date"], .filters select {
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  font-size: 13px;
}
.filters button {
  padding: 6px 16px;
  border: none;
  border-radius: 5px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}

/* 表格 */
.tbl {
  width: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}
.tbl.narrow { width: auto; min-width: 320px; }
.tbl th, .tbl td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
}
.tbl thead th { background: #f8fafc; color: #555; font-weight: 600; white-space: nowrap; }
.tbl tbody tr:hover { background: #f8fafc; }
.tbl .empty { text-align: center; color: #999; padding: 24px; }
.task-list div { margin: 1px 0; }

/* 徽标 */
.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 9px;
  font-size: 12px;
  background: #e5e7eb;
  color: #444;
}
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.warn { background: #fef3c7; color: #b45309; }
.badge.bad { background: #fee2e2; color: #b91c1c; }

.token-btn {
  padding: 1px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #f8fafc;
  color: #444;
  font-size: 12px;
  cursor: pointer;
}
.token-btn:hover { background: #eef2f7; }
.token-value { margin-left: 6px; word-break: break-all; }

/* 健康指标数字按档位上色：正常黑、偏高橙、危险红 */
.metric.ok { color: #222; font-weight: bold; }
.metric.warn { color: #b45309; font-weight: bold; }
.metric.crit { color: #b91c1c; font-weight: bold; }
.metric.na { color: #999; }

/* 统计 chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  padding: 3px 10px;
  border-radius: 12px;
  background: #e5e7eb;
  font-size: 12px;
  color: #444;
}
.chip.active { background: #2563eb; color: #fff; }

/* 奖励星盘 */
.constellation { max-width: 720px; }
.dim-row { margin-bottom: 14px; }
.dim-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.dim-score { margin-left: auto; font-weight: bold; font-size: 16px; color: #2563eb; }
.bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}
.bar-fill { height: 100%; border-radius: 4px; background: #2563eb; }

/* 分页 */
.pager { margin: 14px 0; display: flex; gap: 14px; align-items: center; color: #666; }

/* JSON 展示 */
pre.json {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 13px;
}
/* 系统日志通常很长，给一个滚动上限免得撑爆页面 */
pre.json.log {
  max-height: 480px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Bug 反馈截图墙 */
.shots {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.shot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 220px;
}
.shot img {
  max-width: 220px;
  max-height: 220px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}
.shot-fallback {
  width: 220px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #999;
  font-size: 13px;
}
.shot-key {
  font-size: 11px;
  color: #64748b;
  word-break: break-all;
}

/* 后台写路由的表单通用样式（Bug 工单回复 / 待处理事项发送等，见 src/database.py
   里各个 get_*_session 的注释——每个写口子独立但表单外观统一走这个类） */
.bug-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 560px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
}
.bug-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #475569;
}
.bug-form select,
.bug-form input,
.bug-form textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}
.bug-form textarea { resize: vertical; }
.bug-form fieldset {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 12px;
  margin: 0;
}
.bug-form legend {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  padding: 0 4px;
}
.bug-form button {
  align-self: flex-start;
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
}
.bug-form button:hover { background: #1d4ed8; }
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.checkbox-group label {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #334155;
}

/* 登录页 */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #1e293b;
}
.login-box {
  background: #fff;
  border-radius: 10px;
  padding: 32px 36px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-box h1 { font-size: 18px; text-align: center; margin: 0 0 6px; }
.login-box label { display: flex; flex-direction: column; gap: 5px; color: #555; font-size: 13px; }
.login-box input {
  padding: 9px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}
.login-box button {
  margin-top: 6px;
  padding: 10px;
  border: none;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.login-error {
  background: #fee2e2;
  color: #b91c1c;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}

/* ── Git 看板 ── */
.git-host { margin-bottom: 22px; }
.git-host > h2 { font-size: 16px; margin: 0 0 4px; }
.git-host .git-meta { color: #888; font-size: 12px; margin-bottom: 10px; }
.git-proj {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #fff;
}
.git-proj-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.git-proj-name { font-weight: 600; font-size: 15px; }
.git-head-msg { color: #444; font-size: 13px; }
.git-branch { margin-top: 8px; border-top: 1px dashed #eee; padding-top: 8px; }
.git-branch > summary {
  cursor: pointer; list-style: none; display: flex;
  align-items: center; gap: 8px; font-size: 13px;
}
.git-branch > summary::-webkit-details-marker { display: none; }
.git-branch > summary::before { content: "▸"; color: #9ca3af; }
.git-branch[open] > summary::before { content: "▾"; }
.git-commits { margin: 6px 0 2px 18px; padding: 0; list-style: none; }
.git-commits li { font-size: 12.5px; color: #444; padding: 2px 0; display: flex; gap: 8px; }
.git-sha { font-family: ui-monospace, Menlo, monospace; color: #2563eb; flex: none; }
.git-ctime { color: #999; flex: none; }
.git-cmsg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge.branch { background: #e0e7ff; color: #3730a3; }
.badge.remote { background: #f1f5f9; color: #64748b; }

/* ── Git 看板：提交图（SVG 画线 + 右侧每行文字）── */
.git-proj-block {
  border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 16px;
  background: #fff; margin-bottom: 14px;
}
.git-proj-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.git-proj-name { font-weight: 700; font-size: 15px; color: #111; }
.git-head-msg { color: #555; font-size: 13px; }

.gg-legend-head { color: #16a34a; font-weight: bold; }
.gg-legend-branch { color: #2563eb; font-weight: bold; }
.gg-legend-merge { color: #a855f7; font-weight: bold; }
.gg-sha { font-family: ui-monospace, Menlo, monospace; color: #1d4ed8; background: #eff6ff; padding: 1px 6px; border-radius: 4px; }
.badge.running { background: #16a34a; color: #fff; }

/* ── Git 看板：横向 git 图（全局时间列 + 分支泳道） ── */
.sw-scroll { overflow-x: auto; padding: 4px 0; }
.sw { position: relative; }
.sw-lines { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 0; }
.sw-link { stroke: #94a3b8; stroke-width: 2; }
.sw-link.sw-merge { stroke: #a855f7; stroke-dasharray: 5 3; }
.sw-node { fill: #2563eb; stroke: #fff; stroke-width: 1.5; }
.sw-node-head { fill: #16a34a; stroke: #bbf7d0; stroke-width: 3; }

.sw-lane-label { position: absolute; left: 0; z-index: 3; white-space: nowrap; }
.sw-lane-label .badge { box-shadow: 0 0 0 3px #fff; }
.sw-ab { margin-left: 4px; font-size: 12px; font-weight: 700; background: #fff; padding: 0 3px; border-radius: 4px; }
.sw-ahead { color: #16a34a; }
.sw-behind { color: #d97706; margin-left: 3px; }

.sw-cnode { position: absolute; width: 90px; text-align: center; z-index: 1; overflow: hidden; white-space: nowrap; }
.sw-sha { font-family: ui-monospace, Menlo, monospace; font-size: 10px; color: #64748b; }
.sw-sha-head { color: #16a34a; font-weight: 700; }
.sw-cnode .badge.running { display: block; margin-top: 1px; font-size: 10px; }

/* ── OAuth 授权同意页 ── */
.oauth-consent { width: 420px; }
.login-hint {
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}
.oauth-warn {
  background: #fef3c7;
  color: #92400e;
  border-radius: 6px;
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.5;
}
.oauth-facts { margin: 0; font-size: 13px; }
.oauth-facts dt { color: #6b7280; margin-top: 10px; }
.oauth-facts dt:first-child { margin-top: 0; }
.oauth-facts dd { margin: 3px 0 0; color: #111827; }
/* 回调地址可能很长，强制折行——它是核对客户端真伪的关键，不能被截断 */
.oauth-uri { word-break: break-all; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.oauth-cancel { text-align: center; color: #6b7280; font-size: 13px; text-decoration: none; }
