:root {
  --brand: #1a6fd4;
  --brand-dark: #14559f;
  --brand-light: #eaf2fd;
  --text: #1f2733;
  --text-muted: #6b7684;
  --border: #e3e8ef;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --success: #1e9e6a;
  --danger: #d64545;
  --warning: #c47f17;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 18px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

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

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

h1, h2, h3 { margin: 0; font-weight: 600; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
}

.topbar-nav { display: flex; gap: 4px; margin-left: 8px; }

.topbar-nav a {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 14px;
}

.topbar-nav a.active, .topbar-nav a:hover {
  background: var(--brand-light);
  color: var(--brand);
  text-decoration: none;
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.user-chip strong { color: var(--text); font-weight: 600; }

.page { max-width: 1180px; margin: 0 auto; padding: 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.card-head h2 { font-size: 15px; }

.card-head .sub { color: var(--text-muted); font-size: 13px; }

.card-head .spacer { margin-left: auto; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

label.field { display: block; margin-bottom: 14px; }

label.field > span {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

label.field > span .req { color: var(--danger); }

input[type=text], input[type=password], input[type=search], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 111, 212, .12);
}

input[type=file] {
  width: 100%;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #fbfcfe;
  font-size: 13px;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}

.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn.ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

.btn.ghost:hover { background: #f7f9fc; }

.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b83636; }

.hint {
  font-size: 12.5px;
  color: var(--text-muted);
  background: #f7f9fc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.65;
}

.hint strong { color: var(--text); }

.alert {
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}

.alert.show { display: block; }
.alert.error { background: #fdeceb; color: #b03030; border: 1px solid #f7cfcc; }
.alert.success { background: #e9f7f0; color: #15764f; border: 1px solid #c4ead9; }
.alert.info { background: var(--brand-light); color: var(--brand-dark); border: 1px solid #cfe0f7; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12.5px;
  background: #fafbfd;
  white-space: nowrap;
}

tbody tr:hover { background: #fafcff; }

td.actions { white-space: nowrap; }
td.actions .btn + .btn { margin-left: 6px; }

.empty {
  padding: 34px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  background: var(--brand-light);
  color: var(--brand-dark);
  white-space: nowrap;
}

.tag.gray { background: #eef1f5; color: var(--text-muted); }
.tag.green { background: #e9f7f0; color: var(--success); }
.tag.red { background: #fdeceb; color: var(--danger); }
.tag.amber { background: #fdf4e3; color: var(--warning); }

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.stat .label { font-size: 12.5px; color: var(--text-muted); }
.stat .value { font-size: 24px; font-weight: 600; margin-top: 4px; }
.stat .foot { font-size: 12px; color: var(--text-muted); margin-top: 2px; word-break: break-all; }
.stat .stat-action { margin-top: 10px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar select, .toolbar input[type=search] { width: auto; min-width: 150px; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #eef4fd 0%, #f7f9fc 55%, #eef6f2 100%);
  padding: 24px;
}

.login-card {
  width: 380px;
  max-width: 100%;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(16, 24, 40, .1);
  padding: 30px 30px 26px;
}

.login-card .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-card h1 { font-size: 19px; }
.login-card .login-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 22px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 4px; }
.login-foot { margin-top: 16px; font-size: 12px; color: var(--text-muted); text-align: center; }

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 20px;
}

.modal-mask.show { display: flex; }

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 420px;
  max-width: 100%;
  box-shadow: 0 20px 50px rgba(16, 24, 40, .22);
}

.modal h3 { font-size: 16px; margin-bottom: 6px; }
.modal .modal-sub { color: var(--text-muted); font-size: 13px; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

.progress {
  display: none;
  height: 6px;
  background: #eef1f5;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 12px;
}

.progress.show { display: block; }

.progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width .2s;
}

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }

.tabs button {
  border: none;
  background: none;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.muted { color: var(--text-muted); }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }

input[type=checkbox] {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
  cursor: pointer;
  vertical-align: middle;
}

.check-col { width: 38px; }
th.check-col, td.check-col { text-align: center; padding-left: 10px; padding-right: 0; }

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

@media (max-width: 900px) {
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; gap: 8px; }
  .topbar-nav { display: none; }
  .page { padding: 14px; }
  .card { padding: 16px; }
  table { font-size: 12.5px; }
  th, td { padding: 8px; }
}