:root {
  --navy-900: #071a3d;
  --navy-800: #0b2a5e;
  --navy-700: #123c8f;
  --blue-600: #1d5fd0;
  --blue-500: #2f7bEA;
  --blue-400: #4f97f5;
  --ink-900: #0e1526;
  --ink-700: #26324a;
  --ink-500: #5a6883;
  --ink-300: #94a2bb;
  --line: #e3e8f2;
  --bg: #f4f6fb;
  --card: #ffffff;
  --ok: #17936b;
  --warn: #d78a1a;
  --danger: #d2445c;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,32,64,.06), 0 8px 24px rgba(16,32,64,.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--ink-900); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue-600); text-decoration: none; }
button { font-family: inherit; }

/* ---------- 登录 ---------- */
.login-wrap { display: flex; min-height: 100vh; }
.login-hero {
  flex: 1; background: linear-gradient(140deg, var(--navy-900) 0%, var(--navy-700) 55%, var(--blue-600) 100%);
  color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 64px;
  position: relative; overflow: hidden;
}
.login-hero::after {
  content: ""; position: absolute; right: -140px; bottom: -160px; width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(255,255,255,.14), transparent 65%);
}
.login-hero .brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.login-hero h1 { font-size: 30px; margin: 0 0 10px; letter-spacing: 1px; }
.login-hero p { color: rgba(255,255,255,.72); max-width: 460px; margin: 0 0 26px; }
.login-hero ul { color: rgba(255,255,255,.8); padding-left: 18px; margin: 0; line-height: 2; }
.login-panel { width: 420px; background: var(--card); display: flex; align-items: center; padding: 48px; }
.login-panel h2 { margin: 0 0 6px; font-size: 20px; }
.login-panel .sub { color: var(--ink-500); margin: 0 0 26px; font-size: 13px; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; background: var(--navy-900); color: #c9d6ee; display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; z-index: 20;
}
.sidebar .brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand img { width: 34px; height: 34px; border-radius: 9px; }
.sidebar .brand .t1 { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .5px; }
.sidebar .brand .t2 { font-size: 11px; color: #7f93b8; }
.nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav .group { font-size: 11px; color: #64789c; padding: 14px 10px 6px; letter-spacing: 1px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  color: #b9c8e2; font-size: 13.5px; margin-bottom: 2px;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: var(--blue-600); color: #fff; font-weight: 600; }
.nav a .ico { width: 18px; text-align: center; opacity: .9; }
.sidebar .foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #7f93b8; }

.main { flex: 1; margin-left: 232px; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 26px;
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; }
.topbar .who { display: flex; align-items: center; gap: 14px; color: var(--ink-500); font-size: 13px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--blue-600); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.content { padding: 24px 26px 60px; }

/* ---------- 组件 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card .hd { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.card .hd h3 { margin: 0; font-size: 15px; font-weight: 650; }
.card .hd .desc { color: var(--ink-500); font-size: 12.5px; margin-top: 2px; }
.card .bd { padding: 18px 20px; }
.card .bd.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid.g4 { grid-template-columns: repeat(4, 1fr); }
.grid.g3 { grid-template-columns: repeat(3, 1fr); }
.grid.g2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1180px) { .grid.g4 { grid-template-columns: repeat(2, 1fr);} .grid.g3, .grid.g2 { grid-template-columns: 1fr; } }

.kpi { padding: 18px 20px; }
.kpi .label { color: var(--ink-500); font-size: 12.5px; }
.kpi .value { font-size: 27px; font-weight: 700; margin-top: 4px; letter-spacing: -.5px; }
.kpi .foot { font-size: 12px; color: var(--ink-300); margin-top: 4px; }
.kpi.accent { background: linear-gradient(135deg, var(--navy-700), var(--blue-500)); color: #fff; }
.kpi.accent .label, .kpi.accent .foot { color: rgba(255,255,255,.78); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f8fafd; color: var(--ink-500); font-weight: 600; font-size: 12.5px; }
tbody tr:hover { background: #fafcff; }
tbody tr:last-child td { border-bottom: none; }
td.num { font-variant-numeric: tabular-nums; }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; background: #eef2f9; color: var(--ink-700); white-space: nowrap; }
.tag.ok { background: #e4f5ee; color: var(--ok); }
.tag.warn { background: #fdf1de; color: var(--warn); }
.tag.danger { background: #fdeaee; color: var(--danger); }
.tag.info { background: #e8f0fe; color: var(--blue-600); }
.tag.mute { background: #f0f2f6; color: var(--ink-500); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-700); cursor: pointer; font-size: 13px; }
.btn:hover { border-color: #c9d5ea; }
.btn.primary { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.btn.primary:hover { background: var(--blue-500); }
.btn.danger { color: var(--danger); border-color: #f0c6ce; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px;
  font-family: inherit; background: #fff; color: var(--ink-900);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue-400); box-shadow: 0 0 0 3px rgba(47,123,234,.12); }
label.fld { display: block; margin-bottom: 14px; }
label.fld > span { display: block; font-size: 12.5px; color: var(--ink-500); margin-bottom: 5px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.spacer { flex: 1; }
.empty { padding: 44px; text-align: center; color: var(--ink-300); }
.mono { font-family: "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.hash { font-family: "Cascadia Mono", Consolas, monospace; font-size: 11.5px; color: var(--ink-500); }
.trunc { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }

/* 模态 */
.modal-bg { position: fixed; inset: 0; background: rgba(8,20,45,.45); display: flex; align-items: center;
  justify-content: center; z-index: 100; padding: 24px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; max-height: 88vh; overflow: auto;
  box-shadow: 0 24px 60px rgba(8,20,45,.3); }
.modal .hd { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal .hd h3 { margin: 0; font-size: 16px; }
.modal .bd { padding: 20px 22px; }
.modal .ft { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.x { cursor: pointer; color: var(--ink-300); font-size: 20px; line-height: 1; }

/* 提示 */
.toast { position: fixed; right: 24px; bottom: 24px; background: var(--ink-900); color: #fff;
  padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 200; font-size: 13.5px; max-width: 420px; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

.bar { height: 6px; background: #edf1f8; border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--blue-500); border-radius: 4px; }
.bar > i.warn { background: var(--warn); }
.bar > i.danger { background: var(--danger); }

.login-tip { margin-top: 18px; padding: 12px 14px; background: #f5f8fe; border: 1px dashed #cfdcf5;
  border-radius: 10px; font-size: 12.5px; color: var(--ink-500); }
.login-tip b { color: var(--ink-700); }
