/* 美中育才 · 管理后台 样式
   设计口径:浅色、低饱和、信息密度优先;不使用外部字体与图标库(服务器带宽 5Mbps) */

:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #e5e8ec;
  --line-strong: #d4d9df;
  --text: #1f2733;
  --text-sub: #6b7683;
  --text-mute: #98a2ae;
  --brand: #2f5f8f;
  --brand-dark: #24486c;
  --brand-soft: #eaf1f8;
  --danger: #b4423a;
  --danger-soft: #fbeceb;
  --ok: #2f7d5d;
  --ok-soft: #e9f5ef;
  --warn: #9a6b16;
  --warn-soft: #fdf3e2;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #eef3f8 0%, #f7f9fb 55%, #eef2f6 100%);
  padding: 24px;
}
.login-card {
  width: 380px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 32px 30px 26px; box-shadow: 0 8px 28px rgba(16, 24, 40, .07);
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand h1 { font-size: 19px; margin: 0 0 6px; letter-spacing: .5px; }
.login-brand p { margin: 0; font-size: 12.5px; color: var(--text-mute); }
.login-field { margin-bottom: 14px; }
.login-field label { display: block; font-size: 12.5px; color: var(--text-sub); margin-bottom: 6px; }
.login-card .btn-primary { width: 100%; margin-top: 6px; padding: 10px; }
.login-err {
  margin-top: 12px; padding: 8px 10px; border-radius: 6px; font-size: 12.5px;
  background: var(--danger-soft); color: var(--danger);
}

/* ---------------- 布局 ---------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex: 0 0 216px; background: var(--panel);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sb-brand { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.sb-brand b { display: block; font-size: 14.5px; letter-spacing: .3px; }
.sb-brand span { font-size: 11.5px; color: var(--text-mute); }
.sb-nav { padding: 10px 8px; overflow-y: auto; flex: 1; }
.sb-group { font-size: 11px; color: var(--text-mute); padding: 12px 10px 6px; letter-spacing: .6px; }
.sb-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--text-sub);
  font-size: 13.5px; margin-bottom: 1px; user-select: none;
}
.sb-item:hover { background: #f5f7f9; color: var(--text); }
.sb-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.sb-item .pill { font-size: 11px; background: var(--warn-soft); color: var(--warn); padding: 1px 6px; border-radius: 9px; }
.sb-foot { padding: 10px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-mute); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 54px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 15px; margin: 0; font-weight: 600; }
.topbar .who { font-size: 12.5px; color: var(--text-sub); display: flex; align-items: center; gap: 12px; }
.content { padding: 18px 22px 40px; }

/* ---------------- 通用组件 ---------------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.card-hd h3 { margin: 0; font-size: 13.5px; font-weight: 600; }
.card-hd .sub { font-size: 12px; color: var(--text-mute); font-weight: 400; margin-left: 8px; }
.card-bd { padding: 14px 16px; }
.card-bd.flush { padding: 0; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.input, .select {
  height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: #fff; outline: none; min-width: 120px;
}
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 95, 143, .1); }
.input.wide { min-width: 200px; }
textarea.input { height: auto; padding: 8px 10px; min-height: 74px; resize: vertical; width: 100%; }

.btn {
  height: 32px; padding: 0 13px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: #fff; cursor: pointer; white-space: nowrap; font-size: 13px;
}
.btn:hover { border-color: #b9c1ca; background: #fafbfc; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-sm { height: 27px; padding: 0 9px; font-size: 12.5px; border-radius: 5px; }
.btn-link { border: none; background: none; color: var(--brand); padding: 0 6px; cursor: pointer; font-size: 12.5px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }
.btn-link.mute { color: var(--text-mute); }

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th, table.grid td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid th {
  font-weight: 600; font-size: 12px; color: var(--text-sub); background: #fafbfc;
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
table.grid tbody tr:hover { background: #fafbfc; }
table.grid td.num { font-variant-numeric: tabular-nums; }
table.grid .actions { white-space: nowrap; text-align: right; }
.empty { padding: 42px 16px; text-align: center; color: var(--text-mute); font-size: 13px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; line-height: 18px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.off { background: #eef0f2; color: var(--text-mute); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--danger-soft); color: var(--danger); }
.badge.role { background: var(--brand-soft); color: var(--brand-dark); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k { font-size: 12px; color: var(--text-sub); margin-bottom: 6px; }
.kpi .v { font-size: 25px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.kpi .x { font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 980px) { .split { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* ---------------- 弹层 ---------------- */
.mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .42); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; overflow-y: auto;
}
.modal { width: 520px; max-width: 100%; background: #fff; border-radius: 10px; box-shadow: 0 16px 48px rgba(16,24,40,.2); }
.modal.hd-wide { width: 680px; }
.modal-hd { padding: 15px 18px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.modal-bd { padding: 16px 18px; }
.modal-ft { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.form-row { margin-bottom: 13px; }
.form-row label { display: block; font-size: 12.5px; color: var(--text-sub); margin-bottom: 5px; }
.form-row .input, .form-row .select { width: 100%; }
.form-row .hint { font-size: 11.5px; color: var(--text-mute); margin-top: 4px; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 9px 16px; border-radius: 8px; font-size: 13px; color: #fff; background: #2a3442;
  box-shadow: 0 6px 20px rgba(16,24,40,.22); animation: tin .16s ease-out;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.loading { padding: 34px; text-align: center; color: var(--text-mute); font-size: 13px; }
