/* ===== 基础 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #1677ff;
  --primary-hover: #4096ff;
  --success: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --bg: #f5f7fa;
  --card: #fff;
  --text: #1f2937;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --border: #e5e7eb;
  --sider: #001529;
  --sider-hover: #1f3a5f;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
.hidden { display: none !important; }
a { color: var(--primary); text-decoration: none; }

/* ===== 登录 ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #001529 0%, #0a3d62 60%, #1677ff 140%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 14px;
  padding: 36px 32px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.28);
}
.login-logo, .brand-mark {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1677ff, #0a3d62);
  color: #fff; font-weight: 700; font-size: 20px;
  border-radius: 10px;
}
.login-card h1 { font-size: 20px; margin: 16px 0 4px; }
.login-sub { color: var(--text-3); font-size: 13px; margin-bottom: 24px; }
.login-card label { display: block; font-size: 13px; color: var(--text-2); margin: 14px 0 6px; }
.login-card input {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; outline: none; transition: border-color .15s;
}
.login-card input:focus { border-color: var(--primary); }
.login-err { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 10px; }

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }
.sider {
  width: 220px; flex: 0 0 220px;
  background: var(--sider);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-name { font-weight: 600; font-size: 15px; }
.nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; margin-bottom: 2px;
  color: rgba(255,255,255,.72); border-radius: var(--radius);
  font-size: 14px; transition: all .15s;
}
.nav a:hover { background: var(--sider-hover); color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }
.nav a i { font-style: normal; font-size: 15px; }
.sider-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.sider-foot .btn { color: rgba(255,255,255,.7); border-color: rgba(255,255,255,.18); }
.sider-foot .btn:hover { background: rgba(255,255,255,.08); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 10;
}
.topbar h2 { font-size: 17px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.pill {
  font-size: 12px; padding: 3px 10px; border-radius: 20px;
  background: #eef2ff; color: #4338ca; font-weight: 500;
}
.who { font-size: 13px; color: var(--text-2); }
.content { padding: 20px 24px 40px; flex: 1; }

/* ===== 卡片 / 统计 ===== */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px;
}
.card-title {
  font-size: 15px; font-weight: 600; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card-title .sub { font-size: 12px; color: var(--text-3); font-weight: 400; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; right: -20px; top: -20px;
  width: 80px; height: 80px; border-radius: 50%; background: rgba(22,119,255,.06);
}
.stat .label { font-size: 13px; color: var(--text-2); }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; }
.stat .value.small { font-size: 20px; }
.stat .foot { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.stat.blue .value { color: var(--primary); }
.stat.green .value { color: var(--success); }
.stat.orange .value { color: var(--warn); }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-weight: 600; color: var(--text-2);
  background: #fafbfc; padding: 11px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
td { padding: 11px 12px; border-bottom: 1px solid #f2f4f7; white-space: nowrap; }
tbody tr:hover { background: #fafcff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--text-3); padding: 40px 0; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 34px; padding: 0 14px; border-radius: 6px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  font-size: 13.5px; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-danger { color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; border-color: var(--danger); color: var(--danger); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 表单 ===== */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.field { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
input[type=text], input[type=number], input[type=date], select {
  height: 34px; padding: 0 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13.5px; outline: none; background: #fff;
  color: var(--text); transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--primary); }
input[type=number] { width: 110px; }
.form-row { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: center; margin-bottom: 12px; }
.form-row label { font-size: 13px; color: var(--text-2); text-align: right; }
.form-row input, .form-row select { width: 100%; }

/* ===== 标签 ===== */
.tag {
  display: inline-block; padding: 1px 9px; border-radius: 20px;
  font-size: 12px; line-height: 20px; font-weight: 500;
}
.tag-green { background: #dcfce7; color: #15803d; }
.tag-red { background: #fee2e2; color: #b91c1c; }
.tag-orange { background: #fef3c7; color: #b45309; }
.tag-blue { background: #dbeafe; color: #1d4ed8; }
.tag-gray { background: #f3f4f6; color: #4b5563; }

/* ===== 分页 ===== */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 14px; font-size: 13px; color: var(--text-2); }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-close { border: 0; background: none; font-size: 22px; color: var(--text-3); cursor: pointer; line-height: 1; }
.modal-body { padding: 20px; max-height: 60vh; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ===== 提示 ===== */
.toast {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%);
  background: #1f2937; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 14px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.toast.ok { background: var(--success); }
.toast.err { background: var(--danger); }

/* ===== 其他 ===== */
.muted { color: var(--text-3); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--text-2); }
.kv dd { color: var(--text); word-break: break-all; }
.notice {
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 14px;
}
.notice.danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.code-list {
  background: #0d1117; color: #c9d1d9; border-radius: var(--radius);
  padding: 14px; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.9; max-height: 320px; overflow-y: auto;
}
.code-list span { display: block; }
@media (max-width: 860px) {
  .sider { width: 64px; flex: 0 0 64px; }
  .brand-name, .nav a span { display: none; }
  .nav a { justify-content: center; }
  .content { padding: 14px; }
}
