:root{
  --bg:#f5f6f8; --surface:#fff; --line:#e7e9ee; --line-soft:#f1f3f6;
  --text:#1f2329; --muted:#8b93a1; --sub:#5b6472;
  --primary:#2f6bff; --primary-soft:#eef3ff;
  --ok:#12925c; --ok-soft:#e6f6ee;
  --warn:#b25e00; --warn-soft:#fff4e5;
  --danger:#d4384a; --danger-soft:#fdecee;
  --side:#0e1626; --side-2:#16203200; --side-line:#1e2a3d; --side-text:#c3cbd8;
  --shadow:0 1px 2px rgba(16,24,40,.04);
}
*,*::before,*::after{box-sizing:border-box}
html,body{margin:0;padding:0;height:100%}
body{
  font-family:"PingFang SC","Microsoft YaHei","Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  font-size:14px;color:var(--text);background:var(--bg);-webkit-font-smoothing:antialiased;
  overflow-x:hidden;
}
a{color:inherit}

/* ---------- 登录 ---------- */
.login{position:fixed;inset:0;z-index:500;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,#0e1626 0%,#17233a 55%,#1e3358 100%)}
.login-card{width:360px;background:#fff;border-radius:16px;padding:32px 30px 26px;box-shadow:0 30px 80px rgba(0,0,0,.35)}
.login-logo{width:44px;height:44px;border-radius:12px;background:linear-gradient(135deg,#3b82f6,#2563eb);color:#fff;font-weight:700;font-size:19px;display:flex;align-items:center;justify-content:center;margin-bottom:16px;box-shadow:0 8px 20px rgba(37,99,235,.35)}
.login-title{font-size:19px;font-weight:680;letter-spacing:.3px}
.login-sub{font-size:12.5px;color:#8b93a1;margin:6px 0 22px}
.login-btn{width:100%;height:42px;margin-top:18px;font-size:14px;justify-content:center}
.login-err{color:#d4384a;font-size:12.5px;min-height:16px;margin-top:10px}
.login-tip{margin-top:20px;padding-top:16px;border-top:1px dashed #e7e9ee;font-size:11.5px;color:#8b93a1;line-height:1.9}
.logout-btn{margin-left:10px}

/* ---------- 布局 ---------- */
.app{display:flex;min-height:100vh}
.sidebar{
  width:236px;flex:0 0 236px;background:var(--side);
  position:fixed;top:0;left:0;bottom:0;display:flex;flex-direction:column;z-index:30;
}
.brand{display:flex;align-items:center;gap:11px;padding:22px 20px 18px}
.brand-mark{
  width:36px;height:36px;border-radius:10px;flex:0 0 36px;
  background:linear-gradient(135deg,#3b82f6,#2563eb);
  color:#fff;font-weight:700;font-size:17px;display:flex;align-items:center;justify-content:center;
  box-shadow:0 6px 16px rgba(37,99,235,.35);
}
.brand-name{font-size:15px;font-weight:650;color:#fff;letter-spacing:.2px}
.brand-sub{font-size:11px;color:#6b7789;margin-top:2px}
.nav{flex:1;overflow-y:auto;padding:6px 12px 18px}
.nav::-webkit-scrollbar{width:6px}
.nav::-webkit-scrollbar-thumb{background:#243247;border-radius:3px}
.nav-group{font-size:11px;color:#5d6b80;padding:0 10px;margin:18px 0 7px;letter-spacing:.06em}
.nav-item{
  display:flex;align-items:center;gap:10px;height:38px;padding:0 11px;margin-bottom:2px;
  border-radius:8px;color:var(--side-text);font-size:13.5px;text-decoration:none;cursor:pointer;
  transition:background .15s,color .15s;user-select:none;
}
.nav-item svg{width:17px;height:17px;flex:0 0 17px;opacity:.8}
.nav-item:hover{background:#162034;color:#e8edf5}
.nav-item.active{background:var(--primary);color:#fff;font-weight:600;box-shadow:0 6px 16px rgba(47,107,255,.3)}
.nav-item.active svg{opacity:1}
.side-foot{border-top:1px solid var(--side-line);padding:14px 18px;display:flex;align-items:center;gap:10px}
.side-user{font-size:13px;font-weight:600;color:#e7ecf4}
.side-role{font-size:11.5px;color:#6b7789;margin-top:2px}
.main{margin-left:236px;flex:1;min-width:0;display:flex;flex-direction:column}

.topbar{
  height:66px;background:#fff;border-bottom:1px solid var(--line);
  display:flex;align-items:center;justify-content:space-between;gap:16px;
  padding:0 26px;position:sticky;top:0;z-index:20;
}
.topbar h1{font-size:19px;font-weight:650;margin:0;letter-spacing:-.2px}
.top-right{display:flex;align-items:center;gap:14px}
.branch-switch{display:flex;align-items:center;gap:6px;height:36px;padding:0 10px;background:#f4f6f9;border-radius:9px;color:#5b6472}
.branch-switch select{border:none;background:transparent;font-size:13px;font-family:inherit;color:var(--text);outline:none;cursor:pointer;font-weight:500}
.top-search{
  display:flex;align-items:center;gap:8px;height:36px;padding:0 12px;
  background:#f4f6f9;border-radius:9px;min-width:250px;color:#9aa3b2;
}
.top-search svg{width:16px;height:16px}
.top-search input{border:none;background:transparent;outline:none;font-size:13px;width:100%;font-family:inherit;color:var(--text)}
.top-search input::placeholder{color:#a3abb8}
.icon-btn{
  width:36px;height:36px;border-radius:9px;border:1px solid var(--line);background:#fff;
  display:flex;align-items:center;justify-content:center;cursor:pointer;color:#4d5766;position:relative;
}
.icon-btn:hover{background:#f6f8fb}
.icon-btn .dot{position:absolute;top:8px;right:9px;width:6px;height:6px;border-radius:50%;background:#f04438;border:1.5px solid #fff}
.user-chip{display:flex;align-items:center;gap:9px}
.user-chip .u-name{font-size:13px;font-weight:600;line-height:1.2}
.user-chip .u-role{font-size:11.5px;color:var(--muted);margin-top:1px}

.page{padding:20px 26px 44px;max-width:1440px;width:100%;margin:0 auto}

/* ---------- 通用 ---------- */
.page-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:16px;flex-wrap:wrap}
.page-title{display:none}
.page-sub{font-size:12.5px;color:var(--muted)}
.grid{display:grid;gap:16px}
.grid > *{min-width:0}
.grid > .card{min-width:0}
.g4{grid-template-columns:repeat(4,1fr)}
.g3{grid-template-columns:repeat(3,1fr)}
.g2{grid-template-columns:repeat(2,1fr)}
.g21{grid-template-columns:1.55fr 1fr}
.mt{margin-top:16px}
.card{background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);overflow:hidden;min-width:0}
.card-head{padding:16px 20px;display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid var(--line-soft)}
.card-title{font-size:14.5px;font-weight:650}
.card-body{padding:18px 20px}
.card-body.tight{padding:0}

.stat{padding:18px 20px}
.stat:has(.stat-ico){display:flex;gap:14px;align-items:flex-start}
.stat-ico{width:42px;height:42px;border-radius:11px;display:flex;align-items:center;justify-content:center;flex:0 0 42px}
.stat-ico svg{width:20px;height:20px}
.stat-ico.blue{background:#eaf1ff;color:#2f6bff}
.stat-ico.green{background:#e7f7ee;color:#12925c}
.stat-ico.red{background:#fdecee;color:#d4384a}
.stat-ico.purple{background:#f1ecff;color:#7a5af8}
.stat-main{flex:1;min-width:0}
.stat-label{font-size:12.5px;color:var(--muted)}
.stat-value{font-size:25px;font-weight:680;letter-spacing:-.6px;margin-top:6px;line-height:1.15}
.stat-value small{font-size:13px;font-weight:500;color:var(--muted);margin-left:3px;letter-spacing:0}
.stat-foot{font-size:12px;color:var(--muted);margin-top:7px}
.up{color:var(--ok)}.down{color:var(--danger)}

.badge{display:inline-flex;align-items:center;gap:4px;height:22px;padding:0 8px;border-radius:6px;font-size:12px;font-weight:500;white-space:nowrap;vertical-align:middle}
.badge.green{background:var(--ok-soft);color:var(--ok)}
.badge.blue{background:var(--primary-soft);color:var(--primary)}
.badge.amber{background:var(--warn-soft);color:var(--warn)}
.badge.red{background:var(--danger-soft);color:var(--danger)}
.badge.gray{background:#f1f3f6;color:var(--sub)}

.btn{height:34px;padding:0 14px;border-radius:8px;border:1px solid var(--line);background:#fff;color:#333;
  font-size:13px;cursor:pointer;font-family:inherit;display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.btn:hover{background:#f7f9fc}
.btn.primary{background:var(--primary);border-color:var(--primary);color:#fff}
.btn.primary:hover{background:#255ae0}
.btn.ghost{border-color:transparent;background:transparent;color:var(--primary)}
.btn.ghost:hover{background:var(--primary-soft)}
.btn.sm{height:28px;padding:0 10px;font-size:12px;border-radius:6px}
.btn.danger{color:var(--danger);border-color:#f3c9c9}

.input,.select{height:34px;border:1px solid var(--line);border-radius:8px;padding:0 10px;font-size:13px;background:#fff;color:var(--text);font-family:inherit;outline:none}
.input::placeholder{color:#a8aeb7}
.input:focus,.select:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(47,107,255,.1)}
.toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:14px}
.toolbar .spacer{flex:1}
.search{width:240px}

.tbl{width:100%;border-collapse:collapse;font-size:13px}
.tbl th{text-align:left;font-weight:500;color:#6b7280;background:#fafbfc;padding:10px 16px;border-bottom:1px solid var(--line);white-space:nowrap;font-size:12.5px}
.tbl td{padding:12px 16px;border-bottom:1px solid var(--line-soft);vertical-align:middle}
.tbl tbody tr:last-child td{border-bottom:none}
.tbl tbody tr:hover{background:#fafbfc}
.tbl tbody tr.warn{background:#fffbf3}
.tbl tbody tr.warn:hover{background:#fff7e8}
.tbl tr.link{cursor:pointer}
.tbl .num{text-align:right;font-variant-numeric:tabular-nums}
.tbl th.sortable{cursor:pointer;user-select:none;white-space:nowrap}
.tbl th.sortable:hover{color:var(--primary)}
.tbl th.sortable.on{color:var(--primary)}
.pager{display:flex;align-items:center;gap:6px;padding:12px 16px;border-top:1px solid var(--line-soft);flex-wrap:wrap}
.pager-info{margin-right:auto;font-size:12.5px;color:var(--muted)}
.pg{height:30px;min-width:30px;padding:0 10px;border:1px solid var(--line);background:#fff;border-radius:7px;font-size:12.5px;cursor:pointer;color:var(--sub);font-family:inherit}
.pg:hover:not(:disabled){border-color:#c9d4e6;color:var(--text)}
.pg.on{background:var(--primary);border-color:var(--primary);color:#fff}
.pg:disabled{opacity:.45;cursor:not-allowed}
.tbl .strong{font-weight:600}

.tabs{display:flex;gap:2px;border-bottom:1px solid var(--line);margin-bottom:18px}
.tab{padding:10px 14px;font-size:13.5px;color:var(--sub);cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px;user-select:none}
.tab:hover{color:var(--text)}
.tab.active{color:var(--primary);border-bottom-color:var(--primary);font-weight:600}

.avatar{width:36px;height:36px;border-radius:50%;background:var(--primary-soft);color:var(--primary);
  display:flex;align-items:center;justify-content:center;font-weight:600;font-size:13px;flex:0 0 auto}
.avatar.lg{width:64px;height:64px;font-size:22px;border-radius:18px}
.person{display:flex;align-items:center;gap:10px}
.person-name{font-weight:600;font-size:13px}
.person-sub{font-size:12px;color:var(--muted);margin-top:2px}

.chart-wrap{padding:6px 4px 0}
.chart-svg{width:100%;max-width:100%;height:auto;display:block}
.chart-legend{display:flex;gap:16px;justify-content:center;font-size:12px;color:var(--sub);margin-top:6px}
.chart-legend i{display:inline-block;width:9px;height:9px;border-radius:2px;margin-right:5px}

.bars{display:flex;align-items:flex-end;gap:10px;height:158px;padding-top:8px}
.card:has(.bars){display:flex;flex-direction:column}
.card:has(.bars) .card-body{flex:1;display:flex;flex-direction:column;justify-content:flex-end}
.card:has(.bars) .bars{flex:1;height:auto;min-height:150px}
.bar-col{flex:1;display:flex;flex-direction:column;align-items:center;gap:7px;height:100%;justify-content:flex-end;min-width:0}
.bar-wrap{flex:1;width:100%;display:flex;align-items:flex-end;justify-content:center}
.bar{width:100%;max-width:34px;background:linear-gradient(180deg,#7aa1ff,#2f6bff);border-radius:5px 5px 0 0;min-height:4px}
.bar.soft{background:#e2e8f4}
.bar-label{font-size:11px;color:#8b93a1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}

.legend{display:flex;gap:16px;font-size:12px;color:var(--sub);flex-wrap:wrap}
.legend i{display:inline-block;width:8px;height:8px;border-radius:2px;margin-right:5px}

.donut{width:132px;height:132px;border-radius:50%;position:relative;flex:0 0 auto}
.donut::after{content:"";position:absolute;inset:26px;background:#fff;border-radius:50%}
.donut-center{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:2;font-size:12px;color:var(--muted)}
.donut-center b{font-size:19px;color:var(--text);font-weight:650}

/* 部门人数（横向条） */
.deptbar{display:flex;align-items:center;gap:10px;padding:7px 0;font-size:13px}
.deptbar .name{width:72px;color:var(--sub);flex:0 0 72px}
.deptbar .track{flex:1;height:8px;background:#eef1f6;border-radius:99px;overflow:hidden}
.deptbar .track i{display:block;height:100%;border-radius:99px}
.deptbar .val{width:52px;text-align:right;color:var(--text);font-variant-numeric:tabular-nums;font-size:12.5px}

/* 审批行 */
.appr{display:flex;align-items:center;gap:12px;padding:12px 0;border-bottom:1px solid var(--line-soft)}
.appr:last-child{border-bottom:none}
.appr-ico{width:34px;height:34px;border-radius:9px;background:#f1f5ff;color:#2f6bff;display:flex;align-items:center;justify-content:center;flex:0 0 34px}
.appr-main{flex:1;min-width:0}
.appr-title{font-size:13px;font-weight:500}
.appr-sub{font-size:12px;color:var(--muted);margin-top:3px}
.appr-act{display:flex;gap:8px}
.mini-btn{width:30px;height:30px;border-radius:8px;border:1px solid var(--line);background:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;color:#8b93a1}
.mini-btn.ok{background:#e9f8f0;border-color:#bfe8d3;color:#12925c}
.mini-btn.no{background:#fdeef0;border-color:#f6cdd2;color:#d4384a}
.mini-btn:hover{filter:brightness(.97)}

/* 公告 / 动态 */
.news{display:flex;gap:10px;padding:11px 0;border-bottom:1px solid var(--line-soft);align-items:flex-start}
.news:last-child{border-bottom:none}
.news-ico{color:#2f6bff;flex:0 0 16px;margin-top:2px}
.news-title{font-size:13px}
.news-sub{font-size:11.5px;color:var(--muted);margin-top:4px}
.feed{display:flex;gap:10px;padding:10px 0;border-bottom:1px solid var(--line-soft)}
.feed:last-child{border-bottom:none}

/* 进度条 */
.bar-line{height:7px;background:#eef1f6;border-radius:99px;overflow:hidden}
.bar-line i{display:block;height:100%;background:var(--primary);border-radius:99px}
.bar-line i.over{background:#f79009}

.tree-row{display:flex;align-items:center;gap:9px;padding:8px 10px;border-radius:8px;cursor:pointer;font-size:13.5px}
.tree-row:hover{background:#f6f8fb}
.tree-row.active{background:var(--primary-soft);color:var(--primary);font-weight:600}
.tree-row .count{margin-left:auto;color:#9aa3b2;font-size:12px;font-weight:400}
.tree-indent{display:inline-block;width:18px}

.kanban{display:grid;grid-template-columns:repeat(5,1fr);gap:12px}
.kcol{background:#f2f4f7;border-radius:10px;padding:10px;min-height:400px}
.kcol-head{font-size:12.5px;font-weight:600;color:var(--sub);display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;padding:0 2px}
.kcount{background:#fff;border-radius:99px;padding:0 7px;height:18px;display:inline-flex;align-items:center;font-size:11px;color:var(--sub)}
.kcard{background:#fff;border:1px solid #e6e9ee;border-radius:8px;padding:10px;margin-bottom:8px;cursor:pointer}
.kcard:hover{box-shadow:0 4px 14px rgba(16,24,40,.08)}
.kcard-name{font-size:13px;font-weight:600}
.kcard-sub{font-size:11.5px;color:var(--muted);margin-top:3px}
.kcard-foot{display:flex;justify-content:space-between;align-items:center;margin-top:8px;font-size:11px;color:#9aa3b2}
.tag{display:inline-block;padding:1px 6px;border-radius:4px;background:#f3f5f8;color:#6b7280;font-size:11px}

.kv{display:grid;grid-template-columns:96px 1fr;gap:12px 14px;font-size:13px;margin:0}
.kv dt{color:var(--muted)}
.kv dd{margin:0;color:var(--text)}

.payslip{max-width:620px;margin:0 auto}
.payslip-row{display:flex;justify-content:space-between;padding:9px 0;border-bottom:1px dashed #e9ebef;font-size:13px}
.payslip-row:last-child{border-bottom:none}
.total{display:flex;justify-content:space-between;align-items:baseline;padding:18px 0 6px;border-top:2px solid #1f2329;margin-top:12px}
.total .amount{font-size:28px;font-weight:700;color:var(--ok);letter-spacing:-.5px}
.section-label{font-size:11.5px;font-weight:600;color:#9aa3b2;letter-spacing:.06em;margin:16px 0 6px}

.empty{padding:44px 20px;text-align:center;color:#9aa3b2;font-size:13px}
.divider{height:1px;background:var(--line-soft);margin:14px 0}
.linklike{color:var(--primary);cursor:pointer}
.linklike:hover{text-decoration:underline}
.chips{display:flex;gap:8px;flex-wrap:wrap;margin-top:4px}
.chip{display:inline-flex;align-items:center;height:28px;padding:0 11px;border:1px solid var(--line);border-radius:99px;background:#fff;font-size:12.5px;color:var(--sub);cursor:pointer}
.chip:hover{border-color:#c9d4e6;color:var(--primary)}

.toast-wrap{position:fixed;top:22px;left:50%;transform:translateX(-50%);z-index:400;display:flex;flex-direction:column;gap:8px;align-items:center}
.toast{background:#1f2329;color:#fff;padding:9px 16px;border-radius:8px;font-size:13px;box-shadow:0 10px 30px rgba(0,0,0,.2);animation:toastIn .18s ease}
@keyframes toastIn{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:none}}

.modal-mask{position:fixed;inset:0;background:rgba(16,24,40,.36);display:none;align-items:center;justify-content:center;z-index:300;padding:20px}
.modal-mask.show{display:flex}
.modal{background:#fff;border-radius:14px;width:660px;max-width:100%;max-height:88vh;overflow:auto;box-shadow:0 30px 70px rgba(16,24,40,.28)}
.modal-head{padding:18px 22px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center}
.modal-title{font-size:15px;font-weight:650}
.modal-body{padding:20px 22px}
.modal-foot{padding:14px 22px;border-top:1px solid var(--line);display:flex;justify-content:flex-end;gap:10px}
.form-row{display:grid;grid-template-columns:1fr 1fr;gap:14px 16px}
.field{display:flex;flex-direction:column;gap:6px}
.field label{font-size:12.5px;color:var(--sub)}
.field .input,.field .select{width:100%}
.close-x{border:none;background:transparent;font-size:20px;line-height:1;color:#9aa3b2;cursor:pointer;padding:2px 6px}
.close-x:hover{color:var(--text)}

.notice{display:flex;gap:12px;padding:12px 14px;border-radius:10px;background:var(--primary-soft);color:#2b4a8a;font-size:12.5px;line-height:1.6}
.notice b{color:#1d3a7a}
.todo-item{display:flex;gap:12px;align-items:flex-start;padding:12px 0;border-bottom:1px solid var(--line-soft)}
.todo-item:last-child{border-bottom:none}
.todo-icon{width:30px;height:30px;border-radius:8px;background:#f3f5f8;display:flex;align-items:center;justify-content:center;font-size:13px;flex:0 0 30px}
.todo-title{font-size:13px;font-weight:500}
.todo-sub{font-size:12px;color:var(--muted);margin-top:3px}
.todo-item .btn{margin-left:auto}

@media (max-width:1180px){
  .g4{grid-template-columns:repeat(2,1fr)}
  .g3{grid-template-columns:repeat(2,1fr)}
  .g21{grid-template-columns:1fr}
  .kanban{grid-template-columns:repeat(2,1fr)}
}
.menu-btn{display:none}
.nav-mask{display:none;position:fixed;inset:0;background:rgba(10,16,28,.42);z-index:55}

/* 中等宽度的笔记本：缩窄侧栏，但菜单仍然常驻 */
@media (max-width:1180px){
  .sidebar{width:200px;flex:0 0 200px}
  .main{margin-left:200px}
  .brand{padding:18px 14px 14px}
  .brand-sub{display:none}
  .nav{padding:4px 10px 16px}
  .top-search{min-width:170px}
  .page{padding:18px 18px 40px}
  .topbar{padding:0 18px}
}

@media (max-width:760px){
  .menu-btn{display:flex}
  .sidebar{display:flex;transform:translateX(-100%);transition:transform .22s ease;z-index:60;box-shadow:12px 0 40px rgba(0,0,0,.25)}
  body.nav-open .sidebar{transform:none}
  body.nav-open .nav-mask{display:block}
  .main{margin-left:0}
  .g4,.g3,.g2{grid-template-columns:1fr}
  .top-search{display:none}
  .page-head{align-items:flex-start}
  .page-head > div{min-width:0}
  .page{padding:16px 14px 40px}
  .topbar{padding:0 14px}
  .topbar h1{font-size:17px}
  .user-chip .u-role{display:none}
}
