/* Kilimall 数据看板样式 */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 14px;
  color: #2c3e50;
  background: #f4f6f9;
}
a { text-decoration: none; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1b2a4a 0%, #2a6ee8 100%);
}
.login-card {
  width: 360px;
  background: #fff;
  border-radius: 10px;
  padding: 32px 30px 26px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.login-card h1 { margin: 0 0 6px; font-size: 20px; }
.login-card .sub { color: #8a94a6; font-size: 12px; margin-bottom: 20px; }
.login-card label { display: block; margin: 12px 0 5px; font-size: 13px; }
.login-card input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #d5dae2;
  border-radius: 5px;
  font-size: 14px;
}
.login-card input:focus { outline: none; border-color: #2a6ee8; }
.login-card button {
  width: 100%;
  margin-top: 20px;
  padding: 10px 0;
  border: none;
  border-radius: 5px;
  background: #2a6ee8;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.login-card button:hover { background: #1f5fd0; }
.login-err { margin-top: 12px; color: #d03050; font-size: 13px; min-height: 18px; }

/* ---------- 布局 ---------- */
.layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 190px;
  flex: none;
  background: #1b2a4a;
  color: #cfd8e8;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.brand { padding: 20px 16px; font-size: 16px; font-weight: 600; color: #fff; line-height: 1.4; }
.sidebar nav { flex: 1; padding: 4px 8px; }
.nav-item {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  color: #cfd8e8;
  margin-bottom: 2px;
  font-size: 13.5px;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-item.active { background: #2a6ee8; color: #fff; }
.sidebar-footer { padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, 0.12); font-size: 12.5px; }
.sidebar-footer .user { margin-bottom: 6px; color: #fff; }
.sidebar-footer a { color: #8fa3c8; font-size: 12px; }
.sidebar-footer a:hover { color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; overflow: hidden; }
.topbar {
  background: #fff;
  border-bottom: 1px solid #e6e9ef;
  padding: 0 24px;
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
}
.topbar h1 { margin: 0; font-size: 17px; }
.content { padding: 20px 24px; flex: 1; overflow-y: auto; }

/* ---------- 通用组件 ---------- */
.card {
  background: #fff;
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(20, 40, 80, 0.08);
}
.card h2 { margin: 0 0 14px; font-size: 15px; }
.cards-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-card {
  flex: 1;
  min-width: 160px;
  background: #fff;
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(20, 40, 80, 0.08);
}
.stat-card .num { font-size: 26px; font-weight: 700; color: #1b2a4a; margin-top: 4px; }
.stat-card .lbl { color: #8a94a6; font-size: 12.5px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input[type="text"], .toolbar select {
  padding: 8px 10px;
  border: 1px solid #d5dae2;
  border-radius: 5px;
  font-size: 13.5px;
}
.toolbar input[type="text"] { width: 240px; }
.btn {
  padding: 8px 16px;
  border: 1px solid #2a6ee8;
  background: #2a6ee8;
  color: #fff;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13.5px;
}
.btn:hover { background: #1f5fd0; }
.btn.ghost { background: #fff; color: #2a6ee8; }
.btn.ghost:hover { background: #eef4ff; }
.btn.ghost.active { background: #2a6ee8; color: #fff; border-color: #2a6ee8; }
.btn.ghost.active:hover { background: #1f5fd0; }

table.tbl { width: 100%; border-collapse: collapse; background: #fff; }
table.tbl th, table.tbl td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #eef1f6;
  font-size: 13.5px;
}
table.tbl th { background: #f8fafd; color: #6b7a90; font-weight: 600; white-space: nowrap; }
table.tbl tr.clickable { cursor: pointer; }
table.tbl tr.clickable:hover td { background: #f2f7ff; }
.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin-top: 12px; color: #6b7a90; font-size: 13px; }
.pager button {
  padding: 5px 14px;
  border: 1px solid #d5dae2;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}
.pager button:disabled { opacity: 0.45; cursor: not-allowed; }

.empty { text-align: center; color: #9aa6b8; padding: 40px 0; }
.loading { text-align: center; color: #9aa6b8; padding: 40px 0; }
.muted { color: #9aa6b8; font-size: 12px; }
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 12px;
  background: #eef4ff;
  color: #2a6ee8;
}
.tag.warn { background: #fff6e6; color: #c77700; }
.tag.ok { background: #e8f7ee; color: #18a058; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-row .name { width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { flex: 1; background: #eef1f6; border-radius: 4px; height: 16px; overflow: hidden; }
.bar-row .fill { height: 100%; background: linear-gradient(90deg, #4c8df0, #2a6ee8); }
.bar-row .val { width: 90px; text-align: right; color: #6b7a90; font-size: 12.5px; }

/* ---------- 图表 ---------- */
.chart-box { width: 100%; }
svg text.axis { font-size: 10px; fill: #8a94a6; }
.chart-grid line.grid { stroke: #eef1f6; }
.chart-line { fill: none; stroke: #2a6ee8; stroke-width: 2; }
.chart-area { fill: rgba(42, 110, 232, 0.1); }
.chart-dots circle { fill: #2a6ee8; }
.chart-empty { color: #9aa6b8; text-align: center; padding: 60px 0; }
.two-charts { display: flex; gap: 20px; flex-wrap: wrap; }
.two-charts > div { flex: 1; min-width: 300px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 45, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal {
  background: #fff;
  border-radius: 8px;
  width: min(860px, 92vw);
  max-height: 88vh;
  overflow: auto;
  padding: 20px 22px;
}
.modal h2 { margin: 0 0 14px; font-size: 16px; }
.modal-close {
  float: right;
  border: none;
  background: #f0f2f6;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: #18a058;
  color: #fff;
  padding: 9px 20px;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  z-index: 100;
  font-size: 13.5px;
}
.toast.err { background: #d03050; }
.toast.hidden { display: none; }

.form-row { margin-bottom: 12px; }
.form-row label { display: block; margin-bottom: 4px; font-size: 13px; color: #6b7a90; }
.form-row input, .form-row select {
  width: 220px;
  padding: 8px 10px;
  border: 1px solid #d5dae2;
  border-radius: 5px;
}
@media (max-width: 760px) {
  .sidebar { width: 56px; }
  .brand { font-size: 0; padding: 16px 8px; }
  .brand::first-letter { font-size: 18px; }
  .nav-item { padding: 10px 8px; text-align: center; }
  .sidebar-footer .user { display: none; }
}
