* { box-sizing: border-box; }
:root {
  --brand: #4C8DFF;
  --brand-dark: #2F6FE0;
  --brand-soft: #EAF1FF;
  --bg: #F4F6FA;
  --card: #FFFFFF;
  --text: #101828;
  --text-2: #475467;
  --muted: #98A2B3;
  --line: #E7EAF0;
  --sidebar: #0E1729;
  --sidebar-2: #16223A;
  --ok: #12B76A;
  --ok-soft: #E7F8F0;
  --warn: #F79009;
  --warn-soft: #FEF4E6;
  --danger: #F04438;
  --danger-soft: #FEECEB;
  --purple: #7A5AF8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .12);
}
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
img { max-width: 100%; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: 0 0 236px; background: var(--sidebar); color: #C7D2E3;
  position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40;
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #2A3A57; border-radius: 3px; }
.brand {
  display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px;
  font-size: 16px; font-weight: 700; color: #fff; letter-spacing: .3px;
}
.brand .logo {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #4C8DFF, #7A5AF8); font-size: 16px;
  box-shadow: 0 6px 16px -6px rgba(76, 141, 255, .8);
}
.brand small { display: block; font-size: 11px; font-weight: 400; color: #6C7FA3; letter-spacing: .6px; }
.nav { padding: 6px 10px 24px; }
.nav-title {
  font-size: 11px; color: #5A6C8C; text-transform: uppercase; letter-spacing: 1px;
  padding: 16px 10px 7px; font-weight: 600;
}
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; margin-bottom: 2px;
  border-radius: 9px; color: #B7C4D8; font-size: 13.5px; transition: .16s;
}
.nav a svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .82; }
.nav a:hover { background: var(--sidebar-2); color: #fff; }
.nav a.active {
  background: linear-gradient(90deg, rgba(76, 141, 255, .22), rgba(76, 141, 255, .06));
  color: #fff; font-weight: 600; box-shadow: inset 2px 0 0 var(--brand);
}
.nav a.active svg { opacity: 1; color: #6FA6FF; }
.nav a .count {
  margin-left: auto; background: #24334F; color: #9FB2CE; font-size: 11px;
  padding: 0 7px; border-radius: 20px; line-height: 17px;
}

.main { flex: 1; min-width: 0; margin-left: 236px; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: rgba(255, 255, 255, .88); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
}
.topbar h1 { font-size: 16px; font-weight: 650; margin: 0; letter-spacing: .2px; }
.topbar .crumb { color: var(--muted); font-size: 12.5px; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; font-size: 12px;
}
.burger { display: none; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.content { padding: 22px; flex: 1; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: .2px; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; gap: 10px; padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 650; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-head .right { margin-left: auto; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-6-4 { grid-template-columns: 1.55fr 1fr; }

/* KPI */
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi .label { color: var(--text-2); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 25px; font-weight: 700; letter-spacing: -.4px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .val small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi .foot { margin-top: 4px; font-size: 12px; color: var(--muted); }
.kpi .ico {
  position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand);
}
.kpi .ico svg { width: 17px; height: 17px; }
.kpi.ok .ico { background: var(--ok-soft); color: var(--ok); }
.kpi.warn .ico { background: var(--warn-soft); color: var(--warn); }
.kpi.danger .ico { background: var(--danger-soft); color: var(--danger); }
.kpi.purple .ico { background: #F1EEFE; color: var(--purple); }
.up { color: var(--ok); font-weight: 600; }
.down { color: var(--danger); font-weight: 600; }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-weight: 600; color: var(--text-2); background: #FAFBFD;
  padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12.5px;
}
table.tbl td { padding: 12px 14px; border-bottom: 1px solid #F1F3F7; vertical-align: middle; }
table.tbl tbody tr:hover { background: #FBFCFE; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .nowrap { white-space: nowrap; }
table.tbl .sub { color: var(--muted); font-size: 12px; }
.t-main { font-weight: 600; color: var(--text); }
.t-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600;
  padding: 2px 9px; border-radius: 20px; background: #F2F4F7; color: var(--text-2); line-height: 19px;
}
.badge.ok { background: var(--ok-soft); color: #0B8A50; }
.badge.warn { background: var(--warn-soft); color: #B25E00; }
.badge.danger { background: var(--danger-soft); color: #C4302B; }
.badge.brand { background: var(--brand-soft); color: var(--brand-dark); }
.badge.purple { background: #F1EEFE; color: #5B3FD4; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: .16s; white-space: nowrap; font-family: inherit;
}
.btn:hover { border-color: #CBD3E1; color: var(--text); background: #FBFCFE; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 14px -8px rgba(76, 141, 255, .9); }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn.danger { color: var(--danger); border-color: #F8C9C5; background: #fff; }
.btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #F2F4F7; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.form-row { display: grid; gap: 14px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.input, .select, textarea.input {
  width: 100%; height: 36px; padding: 0 11px; border: 1px solid #DCE1EA; border-radius: 9px;
  background: #fff; font-size: 13.5px; color: var(--text); outline: none; transition: .16s;
  font-family: inherit;
}
textarea.input { height: auto; padding: 9px 11px; resize: vertical; min-height: 76px; line-height: 1.6; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(76, 141, 255, .13); }
.input::placeholder { color: #B3BBC9; }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2398A2B3' stroke-width='2.4'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }
.checkbox { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand); }

/* 筛选条 */
.filter {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 14px 18px; border-bottom: 1px solid var(--line); background: #FCFDFF;
}
.filter .field { min-width: 132px; }
.filter .field.grow { flex: 1; min-width: 200px; }
.filter .btns { display: flex; gap: 8px; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager .info { color: var(--muted); font-size: 12.5px; margin-right: auto; }
.pager .pgs { display: flex; gap: 5px; flex-wrap: wrap; }
.pager .pg {
  min-width: 31px; height: 31px; padding: 0 9px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; color: var(--text-2); background: #fff;
}
.pager .pg:hover { border-color: var(--brand); color: var(--brand); }
.pager .pg.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pager .pg.off { color: #CBD3E1; pointer-events: none; background: #FAFBFD; }

/* ---------- 空态 ---------- */
.empty { text-align: center; padding: 54px 20px; color: var(--muted); }
.empty .box {
  width: 58px; height: 58px; border-radius: 16px; background: #F4F6FA; display: grid;
  place-items: center; margin: 0 auto 12px; color: #B6C0D0;
}
.empty h4 { margin: 0 0 4px; color: var(--text-2); font-size: 14px; font-weight: 600; }
.empty p { margin: 0; font-size: 12.5px; }

/* ---------- 提示 ---------- */
.flash {
  display: flex; align-items: center; gap: 9px; padding: 11px 15px; border-radius: 10px;
  margin-bottom: 16px; font-size: 13.5px; font-weight: 500; border: 1px solid transparent;
}
.flash.ok { background: var(--ok-soft); color: #08804A; border-color: #BFEED9; }
.flash.err { background: var(--danger-soft); color: #C4302B; border-color: #FBD5D1; }
.alert-err { background: var(--danger-soft); color: #C4302B; border: 1px solid #FBD5D1; padding: 9px 13px; border-radius: 9px; font-size: 13px; margin-bottom: 12px; }

/* ---------- 图表 ---------- */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 8px; }
.chart .bar-wrap { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; position: relative; }
.chart .bar-stack { width: 100%; max-width: 26px; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 2px; }
.chart .bar { border-radius: 4px 4px 2px 2px; min-height: 2px; transition: .2s; }
.chart .bar.exp { background: linear-gradient(180deg, #6FA6FF, #4C8DFF); }
.chart .bar.inc { background: linear-gradient(180deg, #4ADE9B, #12B76A); }
.chart .bar:hover { filter: brightness(1.08); }
.chart .x { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.chart .val-tip {
  position: absolute; top: -6px; background: #101828; color: #fff; font-size: 11px;
  padding: 3px 7px; border-radius: 6px; opacity: 0; transition: .15s; pointer-events: none; white-space: nowrap;
}
.chart .bar-wrap:hover .val-tip { opacity: 1; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }

.hbars { display: flex; flex-direction: column; gap: 13px; }
.hbar .row { display: grid; grid-template-columns: minmax(52px, 72px) minmax(40px, 1fr) auto 40px; align-items: center; gap: 8px; font-size: 13px; }
.hbar .nm { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 8px; background: #F1F3F7; border-radius: 6px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #6FA6FF, #4C8DFF); }
.hbar .amt { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.hbar .pct { text-align: right; color: var(--muted); font-size: 12px; white-space: nowrap; }

/* 环形图（conic-gradient） */
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { width: 138px; height: 138px; border-radius: 50%; position: relative; flex: 0 0 138px; }
.donut::after {
  content: ''; position: absolute; inset: 27px; background: #fff; border-radius: 50%;
  box-shadow: inset 0 0 0 1px #F1F3F7;
}
.donut .center {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; text-align: center;
}
.donut .center b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.donut .center span { font-size: 11px; color: var(--muted); }
.donut-legend { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 8px; }
.donut-legend .li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.donut-legend .li i { width: 9px; height: 9px; border-radius: 3px; }
.donut-legend .li b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* 进度条 */
.progress { height: 7px; background: #F1F3F7; border-radius: 6px; overflow: hidden; min-width: 80px; }
.progress > i { display: block; height: 100%; border-radius: 6px; background: var(--brand); }
.progress.warn > i { background: var(--warn); }
.progress.danger > i { background: var(--danger); }

/* 详情表 */
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.kv .it { padding: 11px 0; border-bottom: 1px dashed #EDF0F5; display: flex; gap: 12px; }
.kv .it .k { width: 84px; flex: 0 0 84px; color: var(--muted); font-size: 12.5px; }
.kv .it .v { font-size: 13.5px; font-weight: 500; word-break: break-all; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 18px; overflow-x: auto; }
.tabs a { padding: 11px 13px; font-size: 13.5px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* 登录页 */
.login-page {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: #0E1729;
}
.login-art {
  position: relative; overflow: hidden; padding: 46px; display: flex; flex-direction: column;
  justify-content: space-between; color: #fff;
  background: radial-gradient(900px 500px at 10% 0%, rgba(76, 141, 255, .38), transparent 60%),
              radial-gradient(700px 500px at 90% 100%, rgba(122, 90, 248, .35), transparent 62%), #0B1322;
}
.login-art .blob { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .6; }
.login-art .b1 { width: 320px; height: 320px; background: radial-gradient(circle, rgba(76, 141, 255, .5), transparent 70%); top: -80px; right: -60px; }
.login-art .b2 { width: 260px; height: 260px; background: radial-gradient(circle, rgba(18, 183, 106, .38), transparent 70%); bottom: 40px; left: -80px; }
.login-art h2 { font-size: 30px; line-height: 1.35; margin: 0 0 14px; letter-spacing: -.5px; }
.login-art p { color: #9DB0CC; font-size: 14px; max-width: 380px; margin: 0; line-height: 1.85; }
.login-art .feats { display: grid; gap: 12px; margin-top: 30px; }
.login-art .feats .f { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: #C6D3E6; }
.login-art .feats .f i {
  width: 22px; height: 22px; border-radius: 7px; background: rgba(76, 141, 255, .18); color: #7FB0FF;
  display: grid; place-items: center; font-size: 12px; flex: 0 0 22px; font-style: normal;
}
.login-form-wrap { background: #fff; display: grid; place-items: center; padding: 40px; }
.login-card { width: 100%; max-width: 344px; }
.login-card .ttl { font-size: 21px; font-weight: 700; margin: 0 0 6px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin: 0 0 26px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { height: 40px; font-size: 14px; }
.login-foot { margin-top: 22px; font-size: 12px; color: var(--muted); text-align: center; }

/* 工具类 */
.mt0 { margin-top: 0; } .mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb0 { margin-bottom: 0; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; }
.flex { display: flex; } .aic { align-items: center; } .jcb { justify-content: space-between; }
.gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap12 { gap: 12px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.right { text-align: right; } .center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }
.c-ok { color: var(--ok); } .c-danger { color: var(--danger); } .c-brand { color: var(--brand); } .c-warn { color: var(--warn); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.scroll-y { max-height: 420px; overflow-y: auto; }

@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-6-4 { grid-template-columns: 1fr; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: .22s; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .burger { display: block; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .content { padding: 15px; }
  .topbar { padding: 0 15px; }
  .chart { height: 150px; }
}
@media print {
  .sidebar, .topbar, .pager, .filter, .actions { display: none !important; }
  .main { margin-left: 0; }
  body { background: #fff; }
}
