:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e4e7ec;
  --text: #111827;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: #e8f0fe;
  --ok: #067647;
  --ok-soft: #e7f6ec;
  --warn: #b54708;
  --warn-soft: #fef4e6;
  --err: #b42318;
  --err-soft: #fdeceb;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161b;
    --surface: #1c1f26;
    --surface-2: #22262e;
    --border: #2c313a;
    --text: #e6e8ec;
    --muted: #9aa1ad;
    --accent: #6f9dff;
    --accent-soft: #1d2b45;
    --ok: #6ce9a6;
    --ok-soft: #16301f;
    --warn: #fdb022;
    --warn-soft: #33260c;
    --err: #fda29b;
    --err-soft: #3a1a18;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
code.block { display: block; padding: 10px 12px; word-break: break-all; line-height: 1.6; }
code.code-strong {
  background: var(--accent-soft); color: var(--accent);
  font-weight: 600; letter-spacing: .08em; padding: 3px 8px; font-size: 13px;
}

.shell { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 208px;
  flex: 0 0 208px;
  background: #12151c;
  color: #cfd4de;
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500; color: #fff;
  padding: 4px 10px 18px;
  letter-spacing: .02em;
}
.brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .15);
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: block; padding: 8px 10px; border-radius: 7px;
  color: #b6bdc9; font-size: 13.5px;
}
.nav-item:hover { background: #1b202a; color: #fff; text-decoration: none; }
.nav-item.active { background: #24303f; color: #fff; }
.sidebar-foot {
  margin-top: auto; padding: 12px 10px 4px;
  border-top: 1px solid #232833; font-size: 12.5px;
}
.sidebar-foot .who { color: #e5e7eb; margin-bottom: 4px; }
.link-muted { color: #8b93a1; }
.link-muted:hover { color: #fff; }

/* ---------- 主区域 ---------- */
.main { flex: 1; padding: 26px 30px 60px; max-width: 1180px; }
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 19px; font-weight: 500; margin: 0 0 6px; }
.page-head .muted { font-size: 12.5px; }
.muted { color: var(--muted); }
.tiny { font-size: 11.5px; }
.strong { font-weight: 500; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.card-head h2 { font-size: 14px; font-weight: 500; margin: 0; }
.card-head .link { font-size: 12.5px; }
.note-card h3 { font-size: 13px; font-weight: 500; margin: 0 0 8px; }
.empty { color: var(--muted); font-size: 13px; margin: 6px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- 统计 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat-num { font-size: 24px; font-weight: 500; letter-spacing: -.02em; }
.stat-sub { font-size: 13px; color: var(--muted); font-weight: 400; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 500; color: var(--muted);
  font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-2); }
.detail-row td { background: var(--surface-2) !important; padding: 8px 10px 12px; }
.detail-row .kv { display: flex; gap: 10px; font-size: 12px; padding: 2px 0; }
.detail-row .kv .muted { min-width: 84px; }
.kv-table th { width: 120px; }
.kv-table td { color: var(--muted); }

/* ---------- 徽标 ---------- */
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; line-height: 1.6; white-space: nowrap;
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-off { background: var(--surface-2); color: var(--muted); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-info { background: var(--accent-soft); color: var(--accent); }

/* ---------- 表单 ---------- */
label { display: block; font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; margin-top: 5px;
  padding: 8px 10px; font-size: 13px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 7px; outline: none;
  font-family: inherit;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { display: block; margin-top: 4px; font-size: 11.5px; color: var(--muted); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: span 1; } }

.form-inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-inline input, .form-inline select { width: auto; min-width: 160px; margin-top: 0; }
.mini-form { display: flex; gap: 6px; align-items: center; }
.mini-form input { width: 84px; margin-top: 0; padding: 5px 8px; font-size: 12px; }
.input-sm { width: 100px; padding: 5px 8px; font-size: 12px; margin-top: 0; }
.inline { display: inline; }
.users-pick { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin: 0; }
.users-pick legend { font-size: 12px; color: var(--muted); padding: 0 6px; }
.check { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; color: var(--text); font-size: 13px; }
.check input { margin: 0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block; padding: 7px 14px; font-size: 13px;
  border-radius: 7px; border: 1px solid transparent; cursor: pointer;
  font-family: inherit; line-height: 1.4; text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; border-color: var(--border); color: var(--err); }
.btn-danger:hover { background: var(--err-soft); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; margin-top: 6px; }

/* ---------- 提示 ---------- */
.flash {
  padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px;
  background: var(--ok-soft); color: var(--ok);
}
.flash-err { background: var(--err-soft); color: var(--err); }
.flash-float { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); }

/* ---------- 时间线 ---------- */
.timeline { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.timeline li {
  display: flex; gap: 8px; padding: 6px 0;
  border-bottom: 1px dashed var(--border); align-items: baseline;
}
.timeline li:last-child { border-bottom: none; }

.steps { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.steps li { margin: 6px 0; }

/* ---------- 下载页（未登录时无侧边栏，自己撑一屏） ---------- */
.dl-wrap {
  max-width: 860px; margin: 0 auto; padding: 34px 22px 70px;
}
.dl-wrap .page-head { margin-bottom: 22px; }
.dl-wrap .page-head h1 { font-size: 21px; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--bg);
}
.login-card {
  width: 340px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 26px 24px 22px;
}
.login-card h1 { font-size: 17px; font-weight: 500; margin: 0 0 4px; }
.login-card .muted { font-size: 12.5px; margin: 0 0 18px; }
.login-card label { margin-bottom: 12px; }
.login-card .btn { margin-top: 8px; }
