:root {
  --blue-50: #e6f1fb;
  --blue-100: #b5d4f4;
  --blue-400: #378add;
  --blue-600: #185fa5;
  --blue-800: #0c447c;
  --blue-900: #042c53;
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e3e8ef;
  --text: #1d2939;
  --text-2: #667085;
  --text-3: #98a2b3;
  --red: #d92d20;
  --red-bg: #fef3f2;
  --amber: #b54708;
  --amber-bg: #fffaeb;
  --green: #067647;
  --green-bg: #ecfdf3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  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.55;
  -webkit-text-size-adjust: 100%;
}

button, input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #0c447c 0%, #185fa5 55%, #378add 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: 14px;
  padding: 32px 28px; box-shadow: 0 12px 40px rgba(4, 44, 83, .28);
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; color: var(--blue-800); font-weight: 600; }
.login-card p.sub { margin: 0 0 24px; color: var(--text-2); font-size: 13px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; margin-top: 8px; }
.login-err { color: var(--red); font-size: 13px; min-height: 20px; margin-top: 8px; }

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

.side {
  width: 210px; flex: 0 0 210px; background: var(--blue-900); color: #fff;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side .brand {
  padding: 18px 18px 14px; font-size: 15px; font-weight: 600; letter-spacing: .5px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.side .brand small { display: block; font-weight: 400; font-size: 11px; color: #9cc3e8; margin-top: 3px; letter-spacing: 0; }
.nav { flex: 1; overflow-y: auto; padding: 8px 0 20px; }
.nav a {
  display: flex; align-items: center; gap: 9px; padding: 9px 18px; color: #cfe3f7;
  text-decoration: none; font-size: 13.5px; border-left: 3px solid transparent;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.on { background: rgba(55,138,221,.28); border-left-color: #85b7eb; color: #fff; font-weight: 500; }
.nav a .ico { width: 16px; text-align: center; opacity: .9; font-size: 13px; }
.nav .grp { padding: 14px 18px 4px; font-size: 11px; color: #6f9ac4; letter-spacing: 1px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 16px; margin: 0; font-weight: 600; color: var(--blue-800); }
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--blue-50); color: var(--blue-600);
  display: grid; place-items: center; font-size: 13px; font-weight: 600;
}

.content { padding: 18px 20px 60px; flex: 1; }

/* ---------- 卡片 / 统计 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .k { font-size: 12px; color: var(--text-2); }
.stat .v { font-size: 26px; font-weight: 600; color: var(--blue-800); line-height: 1.25; margin-top: 2px; }
.stat .v small { font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 3px; }
.stat.warn .v { color: var(--red); }
.stat.mid .v { color: var(--amber); }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden;
}
.panel-h {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.panel-h h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--blue-800); }
.panel-b { padding: 14px 16px; }
.panel-b.p0 { padding: 0; }
.panel-h .tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th {
  background: #f8fafc; text-align: left; padding: 10px 12px; font-weight: 600;
  color: var(--text-2); border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12.5px;
}
table.tb td { padding: 10px 12px; border-bottom: 1px solid #f1f4f8; vertical-align: middle; }
table.tb tbody tr:hover { background: #f8fbfe; }
table.tb td.ops { white-space: nowrap; }
.empty { padding: 40px 16px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 14px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; color: var(--text); cursor: pointer; font-size: 13px;
  transition: .15s; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--blue-100); color: var(--blue-600); background: #fafcff; }
.btn.primary { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.btn.primary:hover { background: var(--blue-800); color: #fff; }
.btn.danger { color: var(--red); border-color: #f4c3bf; }
.btn.danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--blue-600); }
.btn.ghost:hover { background: var(--blue-50); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; }
.field label .req { color: var(--red); margin-left: 2px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #d0d7e2; border-radius: 7px;
  background: #fff; color: var(--text); outline: none; transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue-400); box-shadow: 0 0 0 3px rgba(55,138,221,.13); }
textarea { resize: vertical; min-height: 72px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px;
  line-height: 1.6; white-space: nowrap;
}
.tag.red { background: var(--red-bg); color: var(--red); }
.tag.amber { background: var(--amber-bg); color: var(--amber); }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.blue { background: var(--blue-50); color: var(--blue-600); }
.tag.gray { background: #f2f4f7; color: var(--text-2); }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 620px;
  max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(4,44,83,.3);
}
.modal-h {
  padding: 15px 20px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-h h3 { margin: 0; font-size: 15px; color: var(--blue-800); }
.modal-b { padding: 18px 20px; overflow-y: auto; }
.modal-f {
  padding: 12px 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px;
}
.x { background: none; border: 0; font-size: 20px; color: var(--text-3); cursor: pointer; line-height: 1; padding: 4px; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; top: 22px; transform: translateX(-50%);
  background: var(--blue-900); color: #fff; padding: 9px 18px; border-radius: 8px;
  font-size: 13px; z-index: 300; box-shadow: 0 6px 20px rgba(4,44,83,.3);
  opacity: 0; transition: .2s; pointer-events: none; max-width: 90vw;
}
.toast.on { opacity: 1; }
.toast.err { background: #b42318; }

/* ---------- 评分 / 进度 ---------- */
.bar { height: 6px; background: #eef2f7; border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue-600); }

/* ---------- 页脚备案 ---------- */
.foot {
  padding: 12px 20px 16px; text-align: center; font-size: 12px; color: var(--text-3);
  display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap;
}
.foot a { color: var(--text-3); text-decoration: none; }
.foot a:hover { color: var(--blue-600); text-decoration: underline; }
.foot a.ga { display: inline-flex; align-items: center; gap: 3px; }

/* ---------- 响应式 ---------- */
.mobile-only { display: none; }

@media (max-width: 860px) {
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 90;
    transform: translateX(-100%); transition: .22s; width: 220px; flex-basis: 220px;
  }
  .side.open { transform: translateX(0); }
  .sidebar-mask { position: fixed; inset: 0; background: rgba(16,24,40,.4); z-index: 80; }
  .mobile-only { display: inline-flex; }
  .content { padding: 12px 12px 40px; }
  .topbar { padding: 0 12px; }
  .topbar h2 { font-size: 15px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .stat .v { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .panel-h { padding: 10px 12px; }
  .panel-b { padding: 12px; }
  table.tb th, table.tb td { padding: 8px 9px; }
  .modal { max-height: 92vh; }
  .modal-b { padding: 14px; }
}

@media print {
  .side, .topbar, .no-print { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
}
