:root {
  --brand: #1a4e8a;
  --brand-2: #2a6cb8;
  --brand-light: #eef4fb;
  --gold: #b8860b;
  --ink: #1f2328;
  --ink-2: #4a5158;
  --ink-3: #79818a;
  --line: #e4e7ea;
  --line-2: #eef0f2;
  --bg: #f4f6f8;
  --card: #ffffff;
  --ok: #1a7f4b;
  --ok-bg: #e8f5ee;
  --warn: #b26a00;
  --warn-bg: #fdf3e3;
  --danger: #c0392b;
  --danger-bg: #fdeceb;
  --info: #1f5fa8;
  --info-bg: #eaf1fa;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #123a68 0%, #1a4e8a 45%, #0f2a4a 100%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 940px; background: var(--card); border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .3); overflow: hidden;
  display: grid; grid-template-columns: 300px 1fr;
}
.login-side {
  background: linear-gradient(160deg, #1a4e8a, #0f2a4a); color: #fff;
  padding: 40px 32px; display: flex; flex-direction: column; justify-content: center;
}
.login-side h1 { font-size: 25px; margin: 0 0 6px; letter-spacing: 1px; }
.login-side .sub { font-size: 13px; opacity: .82; line-height: 1.9; }
.login-side .flow { margin-top: 26px; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, .18); }
.login-side .flow-item { font-size: 12px; opacity: .88; margin-bottom: 9px; display: flex; gap: 8px; align-items: flex-start; }
.login-side .flow-item b { background: rgba(255, 255, 255, .18); border-radius: 4px; padding: 1px 6px; font-size: 11px; flex-shrink: 0; }
.login-main { padding: 32px 36px; }
.login-main h2 { margin: 0 0 4px; font-size: 19px; }
.login-main .tip { color: var(--ink-3); font-size: 12.5px; margin-bottom: 20px; }
.role-group { margin-bottom: 16px; }
.role-group > label { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 600; margin-bottom: 8px; }
.acct-list { display: flex; flex-wrap: wrap; gap: 8px; }
.acct-chip {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 12px;
  cursor: pointer; transition: all .15s; font-size: 13px; text-align: left; line-height: 1.35;
}
.acct-chip:hover { border-color: var(--brand); background: var(--brand-light); }
.acct-chip.on { border-color: var(--brand); background: var(--brand); color: #fff; }
.acct-chip .nm { font-weight: 600; }
.acct-chip .mt { font-size: 11px; opacity: .72; }
.login-foot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-2); display: flex; align-items: center; gap: 12px; }
.pwd-input { width: 190px; }
.btn-lg { padding: 10px 26px !important; font-size: 15px !important; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px; flex-shrink: 0; background: #14243a; color: #c7d3e0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand {
  padding: 18px 20px; border-bottom: 1px solid rgba(255, 255, 255, .08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar .brand .logo {
  width: 30px; height: 30px; border-radius: 7px; background: var(--brand);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.sidebar .brand .t1 { color: #fff; font-size: 14.5px; font-weight: 600; line-height: 1.25; }
.sidebar .brand .t2 { font-size: 11px; opacity: .55; }
.menu { padding: 10px 0; flex: 1; }
.menu-group { padding: 14px 20px 6px; font-size: 11px; color: #7189a3; letter-spacing: 1px; }
.menu-item {
  padding: 9px 20px; cursor: pointer; font-size: 13.5px; display: flex; align-items: center;
  gap: 9px; border-left: 3px solid transparent; transition: all .12s; color: #b8c6d4;
}
.menu-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.menu-item.on { background: rgba(26, 78, 138, .35); color: #fff; border-left-color: #5b9bd5; font-weight: 600; }
.menu-item .ic { width: 17px; text-align: center; opacity: .9; font-size: 14px; }
.menu-item .badge {
  margin-left: auto; background: #c0392b; color: #fff; border-radius: 9px;
  padding: 0 6px; font-size: 11px; min-width: 18px; text-align: center; font-weight: 600;
}
.sidebar .foot { padding: 12px 20px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 11.5px; color: #7189a3; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--line); padding: 12px 24px;
  display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 20;
}
.topbar h2 { margin: 0; font-size: 17px; font-weight: 600; }
.topbar .crumb { color: var(--ink-3); font-size: 12.5px; }
.topbar .spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.avatar.lg { width: 46px; height: 46px; font-size: 18px; }
.content { padding: 20px 24px 40px; flex: 1; }

/* ---------- 组件 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.card-hd {
  padding: 13px 18px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 10px;
}
.card-hd h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-hd .spacer { flex: 1; }
.card-bd { padding: 16px 18px; }
.card-bd.tight { padding: 0; }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 7px 14px; border-radius: 7px; cursor: pointer; font-size: 13px;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f0c8c4; }
.btn.danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.input, select.input, textarea.input {
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; width: 100%;
  background: #fff; color: var(--ink); outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--brand); }
textarea.input { resize: vertical; min-height: 70px; line-height: 1.65; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 600; margin-bottom: 5px; }
.field label .req { color: var(--danger); }
.field .hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 16px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin-bottom: 0; min-width: 140px; }
.filters .field label { font-size: 11.5px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  background: #fafbfc; text-align: left; padding: 9px 12px; font-weight: 600;
  color: var(--ink-2); border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12.5px;
}
table.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tbl tr:hover td { background: #fcfcfd; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .act { white-space: nowrap; }
table.tbl .act a { margin-right: 10px; font-size: 12.5px; }
.empty { text-align: center; padding: 44px 20px; color: var(--ink-3); font-size: 13px; }
.empty .ico { font-size: 34px; opacity: .3; display: block; margin-bottom: 8px; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px;
  font-weight: 500; white-space: nowrap; line-height: 1.7;
}
.tag.gray { background: #f0f2f4; color: var(--ink-2); }
.tag.red { background: var(--danger-bg); color: var(--danger); }
.tag.orange { background: var(--warn-bg); color: var(--warn); }
.tag.green { background: var(--ok-bg); color: var(--ok); }
.tag.blue { background: var(--info-bg); color: var(--info); }

/* ---------- 指标卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat {
  background: var(--card); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::after { content: ''; position: absolute; right: -18px; top: -18px; width: 68px; height: 68px; border-radius: 50%; background: var(--brand-light); }
.stat .lb { font-size: 12.5px; color: var(--ink-3); position: relative; }
.stat .vl { font-size: 27px; font-weight: 700; color: var(--brand); line-height: 1.25; margin-top: 2px; position: relative; font-variant-numeric: tabular-nums; }
.stat .vl small { font-size: 13px; font-weight: 400; color: var(--ink-3); margin-left: 3px; }
.stat .ex { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; position: relative; }
.stat.blue::after { background: var(--info-bg); } .stat.blue .vl { color: var(--info); }
.stat.green::after { background: var(--ok-bg); } .stat.green .vl { color: var(--ok); }
.stat.orange::after { background: var(--warn-bg); } .stat.orange .vl { color: var(--warn); }

/* ---------- 图表 ---------- */
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-item .bar-t { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 4px; }
.bar-item .bar-t b { font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-track { height: 7px; background: #f0f2f4; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 4px; transition: width .5s ease; }
.bar-fill.blue { background: var(--info); }
.bar-fill.green { background: var(--ok); }
.bar-fill.orange { background: var(--warn); }
.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut { width: 132px; height: 132px; border-radius: 50%; position: relative; flex-shrink: 0; }
.donut .ctr {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.3;
}
.donut .ctr b { font-size: 21px; color: var(--brand); display: block; font-variant-numeric: tabular-nums; }
.donut .ctr span { font-size: 11px; color: var(--ink-3); }
.legend { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; flex: 1; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 7px; }
.legend .li { display: flex; align-items: center; justify-content: space-between; }
.legend .li b { font-variant-numeric: tabular-nums; }
.spark { display: flex; align-items: flex-end; gap: 5px; height: 108px; padding-top: 8px; }
.spark .sp { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; }
.spark .sp i { display: block; width: 100%; background: linear-gradient(180deg, #4a7fc1, var(--brand)); border-radius: 3px 3px 0 0; min-height: 2px; }
.spark .sp span { font-size: 10px; color: var(--ink-3); white-space: nowrap; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(20, 12, 12, .5); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; overflow-y: auto;
}
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 620px; box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 900px; }
.modal-hd { padding: 15px 20px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; }
.modal-hd h3 { margin: 0; font-size: 15.5px; font-weight: 600; flex: 1; }
.modal-hd .x { cursor: pointer; color: var(--ink-3); font-size: 21px; line-height: 1; padding: 0 4px; }
.modal-hd .x:hover { color: var(--ink); }
.modal-bd { padding: 18px 20px; max-height: 66vh; overflow-y: auto; }
.modal-ft { padding: 13px 20px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 9px; }

/* ---------- 详情 / 时间线 ---------- */
.dl { display: grid; grid-template-columns: 96px 1fr; gap: 9px 14px; font-size: 13px; }
.dl dt { color: var(--ink-3); font-size: 12.5px; }
.dl dd { margin: 0; }
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px;
  border-radius: 50%; background: #fff; border: 2px solid var(--brand);
}
.tl-item.done::before { background: var(--ok); border-color: var(--ok); }
.tl-item .tl-h { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; flex-wrap: wrap; }
.tl-item .tl-t { font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
.tl-item .tl-c { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.7; }

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: rgba(28, 24, 24, .93); color: #fff; padding: 10px 22px; border-radius: 8px;
  z-index: 300; font-size: 13.5px; box-shadow: var(--shadow-lg); max-width: 80vw; text-align: center;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ---------- 分段控件 ---------- */
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 8px 15px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--brand); }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.pager { display: flex; gap: 5px; justify-content: center; padding: 14px; align-items: center; }
.pager button {
  min-width: 30px; height: 30px; border: 1px solid var(--line); background: #fff;
  border-radius: 6px; cursor: pointer; font-size: 12.5px;
}
.pager button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

@media (max-width: 1080px) {
  .chart-row { grid-template-columns: 1fr; }
  .login-card { grid-template-columns: 1fr; max-width: 520px; }
  .login-side { display: none; }
  .grid3, .grid4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
}