:root {
  --primary: #2f54eb;
  --primary-dark: #1d39c4;
  --text: #303133;
  --text-light: #606266;
  --text-muted: #909399;
  --border: #ebeef5;
  --bg: #f0f2f5;
  --sidebar-1: #2b41c8;
  --sidebar-2: #1a2b8f;
  --ok: #67c23a;
  --warn: #e6a23c;
  --bad: #f56c6c;
}

* { box-sizing: border-box; }

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

/* ---------------------------------------------------------------- 登录 */
.login-wrap {
  position: fixed; inset: 0; display: flex; background: #eef1f6;
}
.login-left {
  flex: 1;
  background: linear-gradient(135deg, #1c2b6b, #2b41c8 60%, #4a63e0);
  color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 0 8%;
}
.login-left h1 { font-size: 30px; margin: 0 0 14px; letter-spacing: 2px; }
.login-left p { margin: 4px 0; opacity: .78; font-size: 13px; line-height: 1.9; }
.login-right {
  width: 460px; background: #fff; display: flex; flex-direction: column; justify-content: center; padding: 0 64px;
}
.login-right h2 { font-weight: 500; font-size: 20px; margin: 0 0 28px; letter-spacing: 1px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.field input {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid #dcdfe6; border-radius: 3px;
  font-size: 13px; outline: none; transition: border-color .2s;
}
.field input:focus { border-color: var(--primary); }
.btn-primary {
  width: 100%; height: 38px; border: 0; border-radius: 3px; background: var(--primary);
  color: #fff; font-size: 14px; letter-spacing: 4px; cursor: pointer;
}
.btn-primary:hover { background: var(--primary-dark); }
.login-err { color: var(--bad); font-size: 12px; min-height: 18px; margin-bottom: 6px; }

/* ---------------------------------------------------------------- 框架 */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px; flex: 0 0 200px; background: linear-gradient(180deg, var(--sidebar-1), var(--sidebar-2));
  color: #e8ecff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.logo {
  height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 16px;
  font-size: 14px; font-weight: 600; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08);
}
.logo .dot { width: 8px; height: 8px; border-radius: 50%; background: #6ee7ff; }
.menu { padding: 10px 0; flex: 1; overflow: auto; }
.menu a {
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px;
  color: #d3d9ff; text-decoration: none; font-size: 13px; border-left: 3px solid transparent;
}
.menu a:hover { background: rgba(255,255,255,.06); color: #fff; }
.menu a.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: #6ee7ff; }
.menu .icon { width: 16px; text-align: center; opacity: .9; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 12px;
}
.topbar .title { font-size: 15px; font-weight: 500; }
.topbar .spacer { flex: 1; }
.topbar .user { font-size: 12px; color: var(--text-light); }
.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; font-size: 12px; }
.content { padding: 16px; }

.card { background: #fff; border-radius: 4px; padding: 16px; margin-bottom: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.filters .item { display: flex; align-items: center; gap: 8px; }
.filters label { font-size: 12px; color: var(--text-light); white-space: nowrap; }
.filters input, .filters select {
  height: 32px; padding: 0 10px; border: 1px solid #dcdfe6; border-radius: 3px;
  font-size: 12px; outline: none; background: #fff; min-width: 150px;
}
.filters input:focus, .filters select:focus { border-color: var(--primary); }

.btn {
  height: 32px; padding: 0 16px; border-radius: 3px; border: 1px solid #dcdfe6;
  background: #fff; color: var(--text); font-size: 12px; cursor: pointer;
}
.btn:hover { color: var(--primary); border-color: #b3c0f5; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.mini { height: 26px; padding: 0 10px; font-size: 12px; }
.btn.ghost { border-color: transparent; color: var(--primary); }

table.grid { width: 100%; border-collapse: collapse; font-size: 12px; }
table.grid th {
  text-align: left; font-weight: 500; color: var(--text-light);
  background: #fafafa; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
table.grid tr:hover td { background: #f7f9ff; }
table.grid td.wrap { max-width: 420px; }
.ellipsis { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; line-height: 18px;
  background: #eef2ff; color: var(--primary);
}
.tag.ok { background: #f0f9eb; color: var(--ok); }
.tag.warn { background: #fdf6ec; color: var(--warn); }
.tag.bad { background: #fef0f0; color: var(--bad); }
.tag.grey { background: #f4f4f5; color: var(--text-muted); }

.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.pager .info { color: var(--text-muted); font-size: 12px; margin-right: auto; }
.pager button { min-width: 30px; height: 28px; border: 1px solid #dcdfe6; background: #fff; border-radius: 3px; cursor: pointer; font-size: 12px; }
.pager button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager button:disabled { color: #c0c4cc; cursor: not-allowed; }

/* 统计卡片 */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi { background: #fff; border-radius: 4px; padding: 16px; }
.kpi .label { font-size: 12px; color: var(--text-muted); }
.kpi .value { font-size: 26px; font-weight: 600; margin-top: 8px; letter-spacing: -.5px; }
.kpi .sub { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 60px; gap: 10px; align-items: center; font-size: 12px; }
.bar-track { height: 10px; background: #f0f2f5; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #5b7cfa, #2f54eb); }
.bar-fill.pos { background: linear-gradient(90deg, #7ed321, #67c23a); }
.bar-fill.neg { background: linear-gradient(90deg, #ff9a9a, #f56c6c); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-start;
  justify-content: center; padding-top: 8vh; z-index: 50;
}
.modal {
  background: #fff; border-radius: 4px; width: 860px; max-width: 92vw; max-height: 80vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal header { padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 500; display: flex; }
.modal header .close { margin-left: auto; cursor: pointer; color: var(--text-muted); }
.modal .body { padding: 16px 18px; overflow: auto; }
.modal footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 12px; margin-bottom: 14px; }
.kv .k { color: var(--text-muted); }
.empty { text-align: center; color: var(--text-muted); padding: 36px 0; font-size: 12px; }
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  background: #303133; color: #fff; padding: 9px 18px; border-radius: 3px; font-size: 12px; z-index: 99;
}
