:root {
  --green: #1a9e3f;
  --green-dark: #12802f;
  --green-light: #e8f7ec;
  --text: #1f2d24;
  --muted: #8a9190;
  --line: #eef1ef;
  --bg: #f4f6f5;
  --warn: #e39111;
  --err: #e54545;
  --ok: #1a9e3f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
h2, h3, h4, h5 { margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.sm { font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- 按钮 / 表单 ---------- */
.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { border-color: var(--green); color: var(--green); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); color: #fff; }
.btn.ok { color: var(--ok); border-color: #bfe6cb; }
.btn.warn { color: var(--warn); border-color: #f0dcb4; }
.btn.err { color: var(--err); border-color: #f3c6c6; }
.btn.block { width: 100%; padding: 10px; font-size: 15px; margin-top: 8px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus { border-color: var(--green); }
textarea { width: 100%; resize: vertical; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  width: 380px; background: #fff; border-radius: 12px;
  padding: 36px 32px; box-shadow: 0 8px 30px rgba(0, 0, 0, .06); text-align: center;
}
.login-logo {
  width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 12px;
  background: var(--green); color: #fff; font-size: 32px;
  display: flex; align-items: center; justify-content: center;
}
.login-card h2 { margin-bottom: 4px; }
.field { display: flex; align-items: center; gap: 8px; margin: 12px 0; text-align: left; }
.field label { width: 90px; color: var(--muted); flex-shrink: 0; }
.field input, .field select, .field textarea { flex: 1; }
.tip { color: var(--muted); font-size: 12px; margin-top: 16px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px; background: #fff; border-right: 1px solid var(--line);
  padding: 16px 0; position: fixed; left: 0; top: 0; bottom: 0; overflow-y: auto;
}
.brand { font-size: 17px; font-weight: 700; padding: 8px 20px 18px; color: var(--green); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; color: var(--text); text-decoration: none; font-size: 14px;
}
.nav-item:hover { background: var(--green-light); }
.nav-item.on { background: var(--green-light); color: var(--green); font-weight: 600; }
.nav-badge {
  margin-left: auto; background: var(--err); color: #fff;
  font-size: 11px; padding: 1px 7px; border-radius: 10px;
}
.sync-tip {
  position: absolute; bottom: 14px; left: 20px; right: 20px;
  font-size: 11px; color: var(--muted); line-height: 1.6;
  border-top: 1px solid var(--line); padding-top: 10px;
}
.main { flex: 1; margin-left: 200px; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.content { padding: 20px 24px 60px; }

/* ---------- 卡片 / 面板 ---------- */
.grid-4 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-card {
  background: #fff; border-radius: 10px; padding: 18px 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .03);
}
.stat-card.warn .stat-value { color: var(--warn); }
.stat-card.err .stat-value { color: var(--err); }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 28px; font-weight: 700; margin-top: 4px; }

.panel { background: #fff; border-radius: 10px; padding: 18px 20px; box-shadow: 0 2px 10px rgba(0, 0, 0, .03); margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h3 { font-size: 16px; }
.panel-head .tabs, .panel-head .search { margin-left: auto; }
.tabs { display: flex; gap: 6px; }
.tab { border: 1px solid var(--line); background: #fff; padding: 5px 12px; border-radius: 16px; cursor: pointer; font-size: 12px; }
.tab.on { background: var(--green); border-color: var(--green); color: #fff; }
.search { display: flex; gap: 6px; }
.search input { width: 180px; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { color: var(--muted); font-weight: 500; background: #fafbfa; }
.table tr:hover td { background: #fbfdfb; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 11px; background: var(--green-light); color: var(--green-dark); margin-right: 4px; }
.tag-ok { background: #e8f7ec; color: var(--green-dark); }
.tag-warn { background: #fff4e0; color: #a06a00; }
.tag-err { background: #ffe9e6; color: var(--err); }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 16px; }
.pager-info { color: var(--muted); font-size: 12px; }
.bulk { display: flex; gap: 8px; margin-bottom: 12px; }

/* ---------- 趋势图 ---------- */
.trend { display: flex; align-items: flex-end; gap: 18px; height: 200px; padding: 10px 0; }
.trend-col { flex: 1; text-align: center; }
.bars { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 150px; }
.bar { width: 14px; border-radius: 3px 3px 0 0; min-height: 2px; }
.bar.u { background: var(--green); }
.bar.p { background: #2f80ed; }
.bar.c { background: var(--warn); }
.bar.a { background: #9b59b6; }
.trend-date { font-size: 11px; color: var(--muted); margin-top: 6px; }
.trend-num { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 16px; justify-content: center; color: var(--muted); font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }
.legend i.u { background: var(--green); }
.legend i.p { background: #2f80ed; }
.legend i.c { background: var(--warn); }
.legend i.a { background: #9b59b6; }

/* ---------- 排行榜 ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rank-list { list-style: none; }
.rank-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.rank-list li:last-child { border-bottom: none; }
.rank { display: inline-block; width: 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 5px; background: #eef1f0; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.rank.hot { background: var(--green); color: #fff; }
.rank-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.rank-list .empty { color: var(--muted); text-align: center; padding: 20px 0; }

/* ---------- 分类 ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.cat-col h4 { margin-bottom: 10px; }
.cat-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 40px; }
.cat-item { background: var(--green-light); color: var(--green-dark); padding: 4px 10px; border-radius: 14px; font-size: 12px; }
.cat-item b { margin-left: 6px; cursor: pointer; color: var(--err); }
.cat-add { display: flex; gap: 6px; margin-top: 12px; }
.cat-add input { flex: 1; }

/* 设置页：单选组与说明 */
.radio-group { display: flex; flex-wrap: wrap; gap: 16px; }
.radio-group label { display: flex; align-items: center; gap: 4px; color: var(--text); }
.tips {
  background: #f7faf8; border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; color: var(--muted); font-size: 12px; line-height: 1.8;
}
.tips code { background: #eef3ef; padding: 1px 4px; border-radius: 3px; color: var(--green-dark); }

/* 等级与签到 */
input.mini { width: 120px; padding: 4px 8px; font-size: 13px; }
input.mini.num { width: 80px; }
label.perm { display: inline-flex; align-items: center; gap: 3px; margin-right: 10px; font-size: 12px; color: #555; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.progress { display: inline-block; width: 120px; height: 8px; background: #eef1ef; border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.progress i { display: block; height: 100%; background: var(--green); }
.form.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.form.inline .field { margin: 0; }
.field.inline { display: inline-flex; align-items: center; }
.field.inline label { width: auto; margin-right: 6px; }
.field.inline input[type="number"] { width: 70px; }
@media (max-width: 1024px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ---------- 弹窗 ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; }
.modal-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .4); }
.modal {
  position: relative; width: 560px; max-width: 92vw; max-height: 80vh; overflow: auto;
  margin: 8vh auto; background: #fff; border-radius: 12px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.modal-x { cursor: pointer; font-size: 20px; color: var(--muted); }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); }
.detail-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.detail h5 { margin: 16px 0 8px; }
.detail-list div { padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 13px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: 60px; transform: translateX(-50%);
  background: rgba(0, 0, 0, .78); color: #fff; padding: 8px 18px;
  border-radius: 20px; font-size: 13px; z-index: 200;
}

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: 1fr; }
}
