:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #e3e8ef;
  --text: #1f2733;
  --muted: #6b7684;
  --brand: #2563eb;
  --brand-soft: #eef3ff;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --radius: 8px;
}

* { box-sizing: border-box; }

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

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

/* 登录页 */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  flex-direction: column;
  gap: 16px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 26px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, .06);
}

.login-card h1 { font-size: 19px; margin: 0 0 4px; }
.login-card .sub { color: var(--muted); margin: 0 0 22px; font-size: 13px; }

/* 布局 */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 208px;
  flex: 0 0 208px;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; letter-spacing: .5px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 14px; }
.brand-text span { color: var(--muted); font-size: 11px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.sidebar-foot .who { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; padding: 26px 30px 60px; min-width: 0; max-width: 1180px; }

/* 通用块 */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head h1 { font-size: 20px; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card h2 { font-size: 15px; margin: 0 0 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 22px; font-weight: 650; margin-top: 6px; word-break: break-all; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; margin-bottom: 5px; color: #39424f; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=password], input[type=file], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  color: var(--text);
  background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { resize: vertical; min-height: 90px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 180px; }

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  font: inherit;
  cursor: pointer;
}
.btn:hover { background: #1d4ed8; text-decoration: none; }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: #fff; color: var(--danger); border-color: #f3c6c2; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.inline-form { display: inline; }

/* 表格 */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }
td.mono, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; line-height: 1.7; }
.badge-on { background: var(--ok-soft); color: var(--ok); }
.badge-off { background: var(--bg); color: var(--muted); }
.badge-beta { background: var(--warn-soft); color: var(--warn); }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.alert-success { background: var(--ok-soft); color: var(--ok); border: 1px solid #abefc6; }
.alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecdca; }
.alert-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid #fedf89; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { padding: 24px; text-align: center; color: var(--muted); }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; flex: none; height: auto; position: static; }
  .main { padding: 18px 16px 40px; }
}
