:root {
  --bg: #f5f7fa; --surface: #ffffff; --line: #e3e8ef;
  --text: #1f2937; --muted: #6b7280; --primary: #1f4e79; --primary-soft: #eaf2fa;
  --danger: #b42318; --blue: #185fa5; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.6; }
button, input, select { font-family: inherit; font-size: 14px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 12px;
  background: #f1f5f9; padding: 1px 5px; border-radius: 4px; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 390px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: 34px 30px; }
.brand { font-size: 24px; font-weight: 600; color: var(--primary); letter-spacing: 1px; }
.brand-sub { color: var(--muted); margin-bottom: 26px; font-size: 13px; }
label { display: block; margin-bottom: 14px; color: #374151; }
input, select { width: 100%; margin-top: 6px; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--text); outline: none; }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.btn { padding: 9px 18px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; cursor: pointer; color: var(--text); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); width: 100%; }
.btn.primary:hover { opacity: .92; }
.link { border: 0; background: none; color: var(--primary); cursor: pointer; padding: 0 4px; }
.link.danger { color: var(--danger); }
.divider { margin: 22px 0 14px; padding-top: 16px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; margin: 18px 0 0; }
.alert { background: #fef3f2; color: var(--danger); border: 1px solid #fecdca;
  padding: 9px 12px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* 布局 */
#app { display: flex; min-height: 100vh; }
.side { width: 210px; flex: 0 0 210px; background: #12304a; color: #dbe7f2; padding: 22px 14px;
  display: flex; flex-direction: column; }
.side-brand { font-size: 17px; font-weight: 600; color: #fff; padding: 0 10px 22px; }
.side-brand span { display: block; font-size: 11px; font-weight: 400; color: #9fb6ca; margin-top: 2px; }
.side nav a { display: block; padding: 10px 12px; border-radius: 8px; cursor: pointer; margin-bottom: 4px; }
.side nav a:hover { background: #1b4266; }
.side nav a.on { background: var(--primary); color: #fff; }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid #24435f;
  font-size: 11px; color: #8fa9bf; line-height: 1.8; }
.main { flex: 1; min-width: 0; }
.top { height: 58px; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.top b { font-size: 15px; margin-right: 12px; }
.top span { color: var(--muted); font-size: 12px; }
.who { color: var(--muted); font-size: 13px; }
.content { padding: 22px 24px 40px; max-width: 1180px; }
.loading { color: var(--muted); padding: 30px 0; }

/* 内容块 */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card .k { color: var(--muted); font-size: 12px; }
.card .v { font-size: 22px; font-weight: 600; margin-top: 4px; color: var(--primary); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.panel p { margin: 6px 0; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 16px; }
.grid-form .form-actions, .form-actions { grid-column: 1 / -1; margin-top: 4px; }
.form-actions .btn { width: auto; min-width: 160px; }
label.check { display: flex; align-items: center; gap: 8px; margin-top: 24px; }
label.check input { width: auto; margin: 0; }
.block-label { margin-top: 16px; }
.block-label .btn { width: auto; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap; font-size: 13px; }
th { color: var(--muted); font-weight: 500; background: #fafbfc; }
tbody tr:hover { background: #fafbfc; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 20px; background: #eef2f6;
  color: #475467; font-size: 12px; }
.tag.blue { background: #e6f1fb; color: var(--blue); }

/* 规则 */
.rule-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.rule { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.rule.admin { border-color: #b5d4f4; background: #f7fbff; }
.rule-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.rule-head b { font-weight: 500; }
.rule-head .muted { margin-left: auto; font-size: 12px; }
.rule input { margin-top: 0; }
.rule .small { margin-top: 6px; }

/* 提示 */
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; max-width: 380px;
  background: #12304a; color: #fff; padding: 11px 16px; border-radius: 8px; font-size: 13px; }
.toast:empty { display: none; }
.toast.bad { background: var(--danger); }

@media (max-width: 760px) {
  #app { flex-direction: column; }
  .side { width: 100%; flex: none; padding: 12px; }
  .side-brand { padding-bottom: 10px; }
  .side nav { display: flex; overflow-x: auto; gap: 4px; }
  .side nav a { white-space: nowrap; }
  .side-foot { display: none; }
  .top { padding: 0 14px; }
  .content { padding: 14px; }
  .top span { display: none; }
}
