:root {
  --brand: #1e40af;
  --brand-light: #eff4ff;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #059669;
  --text: #18202f;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f5f7fb;
  --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

button, input, select, textarea { font: inherit; color: inherit; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 17px; color: var(--brand); white-space: nowrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.tab {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 6px 12px; cursor: pointer; color: var(--muted); white-space: nowrap;
}
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.topright { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 14px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.card h3 { margin: 0 0 12px; font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }

/* 统计块 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--brand-light); border-radius: 10px; padding: 12px 14px; }
.stat .num { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat.danger { background: #fef2f2; }
.stat.danger .num { color: var(--danger); }
.stat.warn { background: #fffbeb; }
.stat.warn .num { color: var(--warn); }

/* 列表 */
.row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px dashed var(--line);
}
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.row .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.badge.red { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
.badge.amber { background: #fffbeb; border-color: #fde68a; color: var(--warn); }
.badge.green { background: #ecfdf5; border-color: #a7f3d0; color: var(--ok); }
.badge.blue { background: var(--brand-light); border-color: #c7d7fe; color: var(--brand); }

/* 表单 */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; color: var(--muted); }
input, select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d7fe; border-color: var(--brand); }

.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  padding: 9px 14px; cursor: pointer; white-space: nowrap;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.ghost { color: var(--brand); border-color: #c7d7fe; background: var(--brand-light); }
.btn.danger { color: var(--danger); border-color: #fecaca; background: #fef2f2; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* 表格：手机自动变卡片 */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.scroll { overflow-x: auto; }

/* 登录 */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; background: #fff; border-radius: 16px; padding: 26px 22px; box-shadow: 0 10px 30px #1e40af14; }
.login-card h1 { font-size: 20px; margin: 0 0 6px; color: var(--brand); }
.login-card p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.login-card .field { margin-bottom: 12px; }
.login-card .btn { width: 100%; }

/* 提示条 */
.alert { border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.alert.info { background: var(--brand-light); color: #1e3a8a; }
.alert.warn { background: #fffbeb; color: #92400e; }
.alert.err { background: #fef2f2; color: #991b1b; }
.alert.ok { background: #ecfdf5; color: #065f46; }

.detail { background: #fafbfe; border: 1px dashed var(--line); border-radius: 10px; padding: 12px; margin-top: 8px; font-size: 14px; }
.detail dt { font-weight: 600; margin-top: 8px; }
.detail dd { margin: 2px 0 0; color: #374151; }

@media (max-width: 640px) {
  .topbar { padding: 8px 10px; }
  .brand { font-size: 15px; }
  .tab { padding: 5px 9px; font-size: 13px; }
  .wrap { padding: 10px; }
  .card { padding: 13px; }
  .table thead { display: none; }
  .table tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .table td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 4px 0; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: 13px; }
}
