:root {
  --brand: #1f4e79;
  --brand-2: #2f6fb0;
  --ink: #12212f;
  --muted: #6b7a8d;
  --line: #e4e9f0;
  --bg: #f4f6fa;
  --card: #ffffff;
  --ok: #17915f;
  --warn: #d98200;
  --danger: #d64545;
  --radius: 12px;
  --shadow: 0 6px 20px rgba(19, 42, 70, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
}

h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 600; }
a { color: var(--brand-2); text-decoration: none; }

/* 保证 JS 里的 hidden 属性能真正隐藏元素（避免被下方 display 规则覆盖） */
[hidden] { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #12314f, #1f4e79 45%, #2f6fb0);
}
.login-card {
  width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 32px 30px;
  box-shadow: 0 20px 50px rgba(8, 24, 43, .35);
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 22px; }
.login-brand .logo-img { height: 64px; }
.login-brand p { margin: 0; color: var(--muted); font-size: 13px; }
.login-tip { min-height: 20px; color: var(--danger); font-size: 13px; margin: 10px 0 0; }
.logo-img { width: auto; object-fit: contain; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: #0f2b46;
  color: #d7e3f0;
  display: flex;
  flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #2f6fb0, #6aa6dd);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px;
}
.logo-side {
  height: 42px; padding: 4px; box-sizing: border-box;
  background: #fff; border-radius: 8px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { color: #fff; font-size: 16px; }
.brand-text span { font-size: 12px; color: #8ea9c6; }
.sidebar nav { flex: 1; overflow: auto; padding: 6px 10px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 4px; border-radius: 10px;
  color: #c8d8e8; cursor: pointer; font-size: 14px; user-select: none;
}
.nav-item:hover { background: rgba(255, 255, 255, .08); }
.nav-item.active { background: linear-gradient(90deg, #2f6fb0, #3978bd); color: #fff; }
.nav-item .ico { width: 18px; text-align: center; opacity: .9; }
.nav-group { padding: 14px 12px 6px; font-size: 12px; color: #6f8ba8; letter-spacing: .5px; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .08); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 16px 24px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar h2 { font-size: 18px; margin: 0; }
.topbar p { margin: 0; color: var(--muted); font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); font-size: 13px; }
.view { padding: 22px 24px 40px; }

/* ---------- 组件 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.card-head h3 { font-size: 15px; margin: 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1180px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }

.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 24px; font-weight: 600; margin-top: 6px; color: var(--brand); }
.stat .sub { color: #93a1b3; font-size: 12px; margin-top: 4px; }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
  transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--brand-2); color: var(--brand-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #f2c9c9; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 13px; background: #fafbfd; position: sticky; top: 0; }
tbody tr:hover { background: #f8fafc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { max-height: 62vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; background: #eef2f7; color: #4a5b70; }
.badge.ok { background: #e6f6ee; color: var(--ok); }
.badge.warn { background: #fdf2e2; color: var(--warn); }
.badge.danger { background: #fdecec; color: var(--danger); }
.badge.info { background: #e8f1fb; color: var(--brand-2); }
.chip { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; background: rgba(255, 255, 255, .12); color: #cfe0f0; }
.chip.ok { background: #1d6f4d; color: #d7f5e6; }
.chip.danger { background: #8c2c2c; color: #ffe3e3; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; color: #41505f; font-size: 13px; }
.field small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; color: var(--ink); background: #fff; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(47, 111, 176, .12); }
textarea { min-height: 84px; resize: vertical; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; min-width: 160px; flex: 1; }

.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.empty { padding: 34px; text-align: center; color: var(--muted); }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.timeline { border-left: 2px solid var(--line); padding-left: 14px; }
.timeline-item { position: relative; padding-bottom: 14px; }
.timeline-item::before {
  content: ""; position: absolute; left: -21px; top: 6px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--brand-2);
}
.progress { height: 8px; background: #eef2f7; border-radius: 8px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #2f6fb0, #6aa6dd); }

/* ---------- 弹窗 / 提示 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(14, 30, 48, .48);
  display: grid; place-items: start center; padding: 40px 16px; overflow: auto; z-index: 50;
}
.modal {
  width: 640px; max-width: 100%; background: #fff; border-radius: 14px;
  box-shadow: 0 24px 60px rgba(12, 30, 50, .3); overflow: hidden;
}
.modal.wide { width: 900px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 18px; max-height: 70vh; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fafbfd; }
.close-x { border: none; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); }

.toast-root { position: fixed; top: 18px; right: 18px; z-index: 99; display: flex; flex-direction: column; gap: 8px; }
.toast {
  min-width: 200px; padding: 10px 14px; border-radius: 10px; color: #fff;
  background: #243b53; box-shadow: 0 8px 24px rgba(20, 40, 66, .25); font-size: 13px;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
.toast.warn { background: var(--warn); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.loading { padding: 30px; text-align: center; color: var(--muted); }
