/* 软件统计系统后台样式（自绘，无外部依赖） */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e4e9f0;
  --text: #1f2937;
  --muted: #8a94a6;
  --blue: #2563eb;
  --green: #16a34a;
  --red: #dc2626;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin-bottom: 14px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; margin-bottom: 12px; }
.muted { color: var(--muted); font-weight: normal; }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-in {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 52px;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-dot { width: 12px; height: 12px; border-radius: 3px; background: linear-gradient(135deg, var(--blue), var(--green)); display: inline-block; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  padding: 6px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
}
.topbar nav a:hover { color: var(--text); text-decoration: none; background: #f1f4f9; }
.topbar nav a.active { color: var(--blue); background: #eef2ff; }

/* ---------- 布局 ---------- */
.container { max-width: 1080px; margin: 20px auto 40px; padding: 0 16px; }
.container.narrow { max-width: 460px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 32px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.metric-grid.six { grid-template-columns: repeat(6, 1fr); }
.metric { text-align: center; padding: 16px 10px; margin-bottom: 0; }
.metric-num { display: block; font-size: 26px; font-weight: 700; color: var(--blue); font-variant-numeric: tabular-nums; }
.metric-grid.six .metric-num { font-size: 22px; }
.metric-label { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 12px; }

/* ---------- 项目卡片 ---------- */
.proj-card { padding-bottom: 14px; }
.proj-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.proj-head h3 { margin: 0; font-size: 16px; }
.proj-head .btn { margin-left: auto; }
.proj-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.proj-stats div { background: #f8fafc; border-radius: 8px; padding: 10px 12px; text-align: center; }
.proj-stats b { display: block; font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }
.proj-stats span { font-size: 12px; color: var(--muted); }
.empty-card { text-align: center; color: var(--muted); padding: 34px 20px; }

.inline-card { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-card input[type="text"] { flex: 1; min-width: 180px; }

/* ---------- 表单 ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input[type="text"], input[type="password"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #fff;
}
input[type="text"]:focus, input[type="password"]:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.stack-form button { margin-top: 16px; }
.grid-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.grid-form > div { flex: 1; min-width: 160px; }
.grid-form button { margin-bottom: 1px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
  background: #eef1f6;
  color: var(--text);
  font-weight: 500;
}
.btn:hover { filter: brightness(.97); text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-danger { background: #fff; color: var(--red); border-color: #f3c1c1; }
.btn-danger:hover { background: #fef2f2; }
.btn-ghost { background: transparent; border-color: #cfd8e3; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { display: block; width: 100%; text-align: center; margin-top: 14px; }
.btn-row { display: flex; gap: 10px; margin-top: 4px; }
.inline-form { display: inline-block; }

/* ---------- 提示框 ---------- */
.ok-box, .err-box, .warn-box {
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}
.ok-box { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.err-box { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.warn-box { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ---------- 信息块 ---------- */
.info-block { background: #f8fafc; border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }
.info-block p { margin: 6px 0; word-break: break-all; }
code {
  background: #eef2f7;
  border-radius: 5px;
  padding: 2px 6px;
  font: 12px/1.6 Consolas, Menlo, monospace;
  word-break: break-all;
}
code.key { color: var(--blue); font-weight: 700; letter-spacing: .5px; }

/* ---------- 条形图 ---------- */
.bar-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.bar-label { flex: 0 0 150px; text-align: right; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.bar-track { flex: 1; height: 16px; background: #f1f4f9; border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--blue), #60a5fa); border-radius: 5px; min-width: 2px; }
.bar-val { flex: 0 0 90px; font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 600; background: #f8fafc; white-space: nowrap; }
tr:hover td { background: #f8fafc; }
td.ua { color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- SVG 折线图 ---------- */
.trend { width: 100%; height: auto; display: block; }
.trend .gridline { stroke: #edf1f7; stroke-width: 1; }
.trend .tick { fill: var(--muted); font-size: 11px; }
.trend .legend { fill: var(--muted); font-size: 12px; }
.trend .line-blue { fill: none; stroke: var(--blue); stroke-width: 2; }
.trend .line-green { fill: none; stroke: var(--green); stroke-width: 2; }
.trend .dot-blue { fill: var(--blue); }
.trend .dot-green { fill: var(--green); }
.trend .lg-blue { fill: var(--blue); }
.trend .lg-green { fill: var(--green); }

/* ---------- 登录 / 安装页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px 28px;
  box-shadow: 0 10px 30px rgba(31, 41, 55, .08);
}
.login-card h1 { text-align: center; margin-bottom: 18px; }
.login-card .btn-block { margin-top: 18px; }

.proj-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .metric-grid, .metric-grid.six { grid-template-columns: repeat(3, 1fr); }
  .proj-stats { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .bar-label { flex-basis: 110px; }
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid2 .card { margin-bottom: 0; }
.grid2 + .card { margin-top: 16px; }
