:root{
  --navy:#14305c; --navy-2:#1d4ed8; --blue:#2563eb; --blue-2:#3b82f6;
  --blue-soft:#eaf2ff; --bg:#f5f7fb; --card:#ffffff; --border:#e4e9f2;
  --text:#1f2937; --muted:#6b7689; --line:#eef1f6;
  --green:#0f9d6e; --green-bg:#e7f7f0; --red:#d64545; --red-bg:#fdeeee;
  --amber:#c47b0b; --amber-bg:#fff5e3; --gray-bg:#f0f2f7;
  --radius:10px; --shadow:0 1px 2px rgba(20,48,92,.05);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;height:100%}
body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  background:var(--bg);color:var(--text);font-size:14px;-webkit-font-smoothing:antialiased}
.hidden{display:none!important}
button,input,select,textarea{font-family:inherit;font-size:14px}
a{color:var(--blue);text-decoration:none}

/* ---------- 登录 / 改密 ---------- */
.role-switch{border:1px solid var(--border);background:#fff;border-radius:6px;padding:5px 8px;
  font-size:12.5px;color:var(--blue);font-weight:600;cursor:pointer;max-width:150px}
.pwd-root{position:fixed;inset:0;z-index:120;display:flex;align-items:center;justify-content:center;padding:20px;
  background:linear-gradient(140deg,#eef4ff 0%,#f7f9fc 55%,#eef4ff 100%)}
.pwd-card{width:100%;max-width:430px;background:#fff;border:1px solid var(--border);border-radius:14px;
  padding:28px;box-shadow:0 12px 44px rgba(20,48,92,.12)}
.pwd-head{display:flex;gap:12px;align-items:center;margin-bottom:22px}
.pwd-head h2{margin:0 0 4px;font-size:17px;color:var(--navy)}
.pwd-head p{margin:0;font-size:12px;color:var(--muted);line-height:1.55}
#special-note-block{margin-top:8px}

/* ---------- 身份选择 ---------- */
.identity-root{position:fixed;inset:0;z-index:130;display:flex;align-items:center;justify-content:center;
  padding:20px;background:linear-gradient(140deg,#eef4ff 0%,#f7f9fc 55%,#eef4ff 100%)}
.identity-root.hidden{display:none}
.identity-card{width:100%;max-width:520px;background:#fff;border:1px solid var(--border);border-radius:14px;
  padding:26px 26px 18px;box-shadow:0 12px 44px rgba(20,48,92,.12)}
.identity-brand{display:flex;align-items:center;gap:9px;font-size:16px;font-weight:600;color:var(--navy)}
.identity-brand .logo-dot{width:9px;height:9px;border-radius:50%;background:var(--blue);display:inline-block}
.identity-sub{margin:8px 0 18px;font-size:12.5px;color:var(--muted);line-height:1.6}
.identity-list{display:grid;gap:10px}
.identity-item{display:flex;flex-direction:column;gap:4px;align-items:flex-start;text-align:left;
  padding:14px 16px;border:1px solid var(--border);border-radius:11px;background:#fbfcff;cursor:pointer;
  transition:border-color .15s,box-shadow .15s,transform .15s}
.identity-item:hover{border-color:var(--blue);box-shadow:0 6px 18px rgba(37,99,235,.12);transform:translateY(-1px)}
.identity-item b{font-size:14px;color:var(--navy)}
.identity-item span{font-size:12px;color:var(--muted)}
.identity-foot{margin-top:16px;text-align:right}
.login-view{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;
  background:linear-gradient(140deg,#eef4ff 0%,#f7f9fc 55%,#eef4ff 100%)}
.login-card{width:100%;max-width:430px;background:#fff;border:1px solid var(--border);border-radius:14px;
  padding:30px 30px 24px;box-shadow:0 10px 40px rgba(20,48,92,.09)}
.login-brand{display:flex;gap:14px;align-items:center;margin-bottom:26px}
.brand-mark{width:44px;height:44px;flex:none;border-radius:11px;background:var(--navy);color:#fff;
  display:flex;align-items:center;justify-content:center;font-size:21px;font-weight:700;letter-spacing:1px}
.brand-mark.small{width:34px;height:34px;border-radius:9px;font-size:17px;background:var(--blue)}
.login-brand h1{font-size:18px;margin:0 0 4px;color:var(--navy)}
.login-brand p{font-size:12px;color:var(--muted);margin:0}
.fld{display:block;margin-bottom:16px}
.fld>span{display:block;font-size:13px;color:#475569;margin-bottom:7px;font-weight:500}
.fld input,.fld select,.fld textarea,.inp{width:100%;border:1px solid #d9e0ec;border-radius:8px;
  padding:10px 12px;background:#fff;color:var(--text);outline:none;transition:border .15s,box-shadow .15s}
.fld input:focus,.fld select:focus,.fld textarea:focus,.inp:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(37,99,235,.10)}
.fld textarea{resize:vertical;min-height:72px}
.login-error{color:var(--red);font-size:13px;min-height:18px;margin:-4px 0 8px}
.demo-box{margin-top:22px;border-top:1px solid var(--line);padding-top:16px}
.demo-title{font-size:12px;color:var(--muted);margin-bottom:10px;font-weight:600}
.demo-title span{font-weight:400;margin-left:6px}
.demo-list{display:grid;grid-template-columns:repeat(2,1fr);gap:7px}
.demo-chip{border:1px solid var(--border);background:#fbfcff;border-radius:7px;padding:7px 9px;
  cursor:pointer;text-align:left;font-size:12px;line-height:1.45;color:var(--text)}
.demo-chip:hover{border-color:var(--blue);background:var(--blue-soft)}
.demo-chip b{display:block;color:var(--navy);font-size:12px}
.demo-chip span{color:var(--muted);font-size:11px}

/* ---------- 布局 ---------- */
.app{display:flex;min-height:100vh}
.sidebar{width:218px;flex:none;background:var(--navy);color:#dbe6f8;display:flex;flex-direction:column;
  position:fixed;left:0;top:0;bottom:0;z-index:40}
.side-brand{height:64px;display:flex;align-items:center;gap:10px;padding:0 18px;border-bottom:1px solid rgba(255,255,255,.09)}
.side-brand-text b{display:block;color:#fff;font-size:14px;letter-spacing:.3px}
.side-brand-text span{font-size:11px;color:#8fa9d1}
.side-nav{padding:14px 10px;flex:1;overflow-y:auto}
.nav-item{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:8px;color:#c6d6ef;
  cursor:pointer;margin-bottom:3px;font-size:13.5px;border:none;background:transparent;width:100%;text-align:left}
.nav-item:hover{background:rgba(255,255,255,.08);color:#fff}
.nav-item.active{background:var(--blue);color:#fff;font-weight:600}
.nav-ico{width:18px;text-align:center;font-size:15px;opacity:.9}
.side-foot{padding:14px 18px;font-size:11px;color:#7e99c2;border-top:1px solid rgba(255,255,255,.09)}
.side-mask{display:none}
.main{flex:1;min-width:0;margin-left:218px;display:flex;flex-direction:column}
.topbar{height:64px;background:#fff;border-bottom:1px solid var(--border);display:flex;align-items:center;
  padding:0 22px;gap:14px;position:sticky;top:0;z-index:30}
.top-title{display:flex;align-items:baseline;gap:10px;min-width:0}
.top-title b{font-size:15px;color:var(--navy)}
.top-title span{font-size:12px;color:var(--muted)}
.top-right{margin-left:auto;display:flex;align-items:center;gap:12px;white-space:nowrap}
.role-tag{background:var(--blue-soft);color:var(--blue);border-radius:5px;padding:3px 9px;font-size:12px;font-weight:600}
.top-user{font-size:13px;color:#475569}
.icon-btn{border:1px solid var(--border);background:#fff;border-radius:7px;width:34px;height:34px;cursor:pointer;color:var(--navy)}
.menu-btn{display:none}
.content{padding:20px 22px 40px;max-width:1560px;width:100%;margin:0 auto}

/* ---------- 通用组件 ---------- */
.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:14px;margin-bottom:16px;flex-wrap:wrap}
.page-head h2{font-size:19px;margin:0 0 4px;color:var(--navy)}
.page-head p{margin:0;font-size:12.5px;color:var(--muted)}
.head-actions{display:flex;gap:8px;flex-wrap:wrap}
.card{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow)}
.card-pad{padding:18px}
.card-head{padding:14px 18px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.card-head h3{margin:0;font-size:14px;color:var(--navy)}
.card-head .sub{font-size:12px;color:var(--muted);font-weight:400;margin-left:8px}
.grid{display:grid;gap:14px}
.metrics{grid-template-columns:repeat(4,minmax(0,1fr))}
.metric{padding:16px 18px}
.metric .lbl{font-size:12.5px;color:var(--muted);margin-bottom:9px}
.metric .val{font-size:25px;font-weight:700;color:var(--navy);letter-spacing:-.5px;line-height:1.1}
.metric .unit{font-size:12px;font-weight:500;color:var(--muted);margin-left:5px}
.metric .bar{height:3px;width:30px;background:var(--blue);border-radius:2px;margin-top:12px}
.two-col{grid-template-columns:repeat(2,minmax(0,1fr))}
.three-col{grid-template-columns:repeat(3,minmax(0,1fr))}

.btn{border:1px solid var(--border);background:#fff;color:var(--text);border-radius:7px;padding:8px 14px;
  cursor:pointer;font-size:13px;font-weight:500;white-space:nowrap;transition:.15s}
.btn:hover{border-color:var(--blue);color:var(--blue)}
.btn-primary{background:var(--blue);border-color:var(--blue);color:#fff}
.btn-primary:hover{background:var(--navy-2);border-color:var(--navy-2);color:#fff}
.btn-danger{color:var(--red);border-color:#f0d4d4}
.btn-danger:hover{background:var(--red-bg);border-color:var(--red);color:var(--red)}
.btn-sm{padding:5px 10px;font-size:12px}
.btn-block{width:100%;padding:11px}
.btn-ghost{background:transparent}
.btn:disabled{opacity:.5;cursor:not-allowed}
.link-btn{border:none;background:none;color:var(--blue);cursor:pointer;padding:2px 5px;font-size:12.5px}
.link-btn:hover{text-decoration:underline}
.link-btn.danger{color:var(--red)}

.filter-bar{display:flex;gap:9px;flex-wrap:wrap;align-items:center;padding:13px 16px;border-bottom:1px solid var(--line)}
.filter-bar .inp,.filter-bar select{width:auto;min-width:120px;padding:7px 10px;font-size:13px}
.filter-bar .inp{max-width:220px}
.filter-bar .grow{flex:1}
.filter-bar label{font-size:12px;color:var(--muted)}

.table-wrap{overflow-x:auto;width:100%}
table{width:100%;border-collapse:collapse;font-size:13px}
th{background:#f8fafd;color:#5a677e;font-weight:600;text-align:left;padding:10px 12px;
  border-bottom:1px solid var(--border);white-space:nowrap;font-size:12.5px}
td{padding:10px 12px;border-bottom:1px solid var(--line);vertical-align:middle;color:#334155}
tbody tr:hover{background:#fafcff}
tbody tr.clickable{cursor:pointer}
td .sub{color:var(--muted);font-size:11.5px;display:block;margin-top:2px}
.nowrap{white-space:nowrap}
.right{text-align:right}
.empty{padding:42px 16px;text-align:center;color:var(--muted);font-size:13px}
.tag{display:inline-block;padding:2px 8px;border-radius:5px;font-size:11.5px;font-weight:600;white-space:nowrap}
.tag-blue{background:var(--blue-soft);color:var(--blue)}
.tag-green{background:var(--green-bg);color:var(--green)}
.tag-red{background:var(--red-bg);color:var(--red)}
.tag-amber{background:var(--amber-bg);color:var(--amber)}
.tag-gray{background:var(--gray-bg);color:#64748b}
.dot{display:inline-block;width:7px;height:7px;border-radius:50%;margin-right:6px}
.money{font-variant-numeric:tabular-nums;font-weight:600;color:var(--navy)}
.hint{font-size:12px;color:var(--muted);line-height:1.65}
.notice{background:var(--blue-soft);border:1px solid #d6e5ff;color:#28467e;border-radius:8px;padding:10px 13px;font-size:12.5px;line-height:1.7;margin-bottom:14px}

/* ---------- 表单 / 弹窗 / 抽屉 ---------- */
.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.form-grid .full{grid-column:1/-1}
.fitem{min-width:0}
.fitem>label{display:block;font-size:12.5px;color:#475569;margin-bottom:6px;font-weight:500}
.fitem>label .req{color:var(--red)}
/* 统一所有表单控件：高度、边框、字体、圆角一致（含原生日期选择器） */
.fitem input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
.fitem select,.fitem textarea,
.filter-bar .inp,.filter-bar select,
.combo-input,
.drawer-body input:not([type=checkbox]):not([type=radio]),
.drawer-body select,.drawer-body textarea{
  width:100%;height:38px;min-height:38px;padding:8px 11px;
  border:1px solid #d9e0ec;border-radius:7px;background:#fff;color:var(--text);
  font-family:inherit;font-size:13px;line-height:1.4;outline:none;box-sizing:border-box;
  appearance:none;-webkit-appearance:none;
}
.fitem textarea,.drawer-body textarea{height:auto;min-height:74px;resize:vertical;line-height:1.6}
.fitem select,.filter-bar select,.drawer-body select{
  padding-right:30px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7689' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 11px center;
}
.fitem input:focus,.fitem select:focus,.fitem textarea:focus,
.filter-bar .inp:focus,.filter-bar select:focus,.combo-input:focus,
.drawer-body input:focus,.drawer-body select:focus,.drawer-body textarea:focus{
  border-color:var(--blue);box-shadow:0 0 0 3px rgba(37,99,235,.10)
}
.fitem input[readonly]{background:#f6f8fc;color:var(--muted)}
.check-line{display:flex;align-items:center;gap:7px;font-size:13px;color:#334155;margin-bottom:7px}
.check-line input{width:15px;height:15px;min-height:0;accent-color:var(--blue);flex:none}
/* 筛选条控件保持紧凑，不继承表单控件的 100% 宽度 */
.filter-bar .inp,.filter-bar select{width:auto;min-width:132px;max-width:240px;flex:0 1 auto}
.field-hint{font-size:11.5px;color:var(--muted);margin-top:5px;line-height:1.5}
.dup-warning{background:#fff7e8;border:1px solid #f2d9a5;color:#8a5a00;border-radius:8px;
  padding:10px 13px;font-size:12.5px;line-height:1.7;margin-bottom:16px}
.dup-warning b{color:#a35c00}
.check-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:2px 12px}
.section-title{font-size:13px;font-weight:700;color:var(--navy);margin:22px 0 12px;padding-bottom:8px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center}
.section-title:first-child{margin-top:2px}
.kv-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 18px}
.kv-grid .kv{min-width:0}
.kv-grid .k{font-size:11.5px;color:var(--muted);margin-bottom:3px}
.kv-grid .v{font-size:13px;color:#243349;word-break:break-word}
.overlay{position:fixed;inset:0;background:rgba(15,30,60,.38);z-index:80;display:flex;align-items:center;justify-content:center;padding:16px}
.modal{background:#fff;border-radius:12px;width:100%;max-width:600px;max-height:90vh;max-height:90dvh;
  display:flex;flex-direction:column;overflow:hidden;box-shadow:0 20px 60px rgba(15,30,60,.22)}
.modal.wide{max-width:820px}
.modal-head{padding:16px 20px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;flex:none;background:#fff}
.modal-head h3{margin:0;font-size:15px;color:var(--navy)}
/* 只有中间表单区滚动；标题栏与底部操作栏始终固定可见 */
.modal-body{padding:20px 20px 28px;overflow-y:auto;flex:1 1 auto;min-height:0;overscroll-behavior:contain;-webkit-overflow-scrolling:touch}
.modal-foot{padding:13px 20px;border-top:1px solid var(--line);display:flex;justify-content:flex-end;gap:9px;flex:none;background:#fff}
/* 可搜索下拉 */
.combo{position:relative}
.combo-input{cursor:text;padding-right:30px!important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7689' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 11px center}
.combo-list{position:absolute;left:0;right:0;top:calc(100% + 4px);z-index:5;background:#fff;
  border:1px solid var(--border);border-radius:8px;box-shadow:0 8px 24px rgba(15,30,60,.14);
  max-height:220px;overflow-y:auto;padding:4px}
.combo-opt{display:block;width:100%;text-align:left;border:none;background:#fff;border-radius:6px;
  padding:8px 10px;font-size:13px;color:var(--text);cursor:pointer}
.combo-opt:hover,.combo-opt:focus{background:var(--blue-soft);color:var(--blue);outline:none}
.combo-empty{padding:10px;font-size:12px;color:var(--muted)}
/* 放弃未保存内容确认层 */
.confirm-overlay{position:fixed;inset:0;background:rgba(15,30,60,.45);z-index:95;display:flex;align-items:center;justify-content:center;padding:16px}
.confirm-box{background:#fff;border-radius:12px;width:100%;max-width:380px;padding:20px;box-shadow:0 20px 50px rgba(15,30,60,.25)}
.confirm-title{font-size:15px;font-weight:700;color:var(--navy);margin-bottom:8px}
.confirm-text{font-size:13px;color:var(--muted);line-height:1.7;margin-bottom:18px}
.confirm-foot{display:flex;justify-content:flex-end;gap:9px}
.close-x{border:none;background:transparent;font-size:22px;line-height:1;color:var(--muted);cursor:pointer;padding:0 4px}
.drawer-overlay{position:fixed;inset:0;background:rgba(15,30,60,.32);z-index:70}
.drawer{position:fixed;right:0;top:0;bottom:0;width:min(720px,100vw);background:#fff;z-index:71;
  box-shadow:-8px 0 32px rgba(15,30,60,.14);display:flex;flex-direction:column;animation:slideIn .18s ease-out}
@keyframes slideIn{from{transform:translateX(28px);opacity:.7}to{transform:translateX(0);opacity:1}}
.drawer-head{padding:16px 20px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center}
.drawer-head h3{margin:0;font-size:15px;color:var(--navy)}
.drawer-body{padding:20px;overflow-y:auto;flex:1;background:#fbfcff}
.drawer-foot{padding:12px 20px;border-top:1px solid var(--line);display:flex;justify-content:flex-end;gap:8px}
.timeline{border-left:2px solid #dce6f7;margin-left:8px;padding-left:16px}
.tl-item{position:relative;margin-bottom:16px}
.tl-item:before{content:'';position:absolute;left:-22px;top:5px;width:9px;height:9px;border-radius:50%;background:var(--blue);border:2px solid #fff;box-shadow:0 0 0 1px #c9d9f5}
.tl-time{font-size:11.5px;color:var(--muted);margin-bottom:5px}
.tl-card{background:#fff;border:1px solid var(--border);border-radius:8px;padding:11px 13px}
.tl-row{margin-top:6px;font-size:12.5px;line-height:1.6;color:#334155}
.tl-row b{color:var(--navy);font-weight:600}
.pill-row{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}
.pill{background:var(--blue-soft);color:var(--blue);border-radius:5px;padding:2px 8px;font-size:11.5px}
#toast-root{position:fixed;top:18px;right:18px;z-index:100;display:flex;flex-direction:column;gap:8px}
.toast{background:#fff;border:1px solid var(--border);border-left:3px solid var(--blue);border-radius:8px;
  padding:11px 15px;font-size:13px;box-shadow:0 6px 20px rgba(15,30,60,.13);min-width:210px}
.toast.err{border-left-color:var(--red);color:var(--red)}
.toast.ok{border-left-color:var(--green)}

/* ---------- 图表 ---------- */
.chart{width:100%;height:210px;display:block}
.chart-legend{display:flex;gap:14px;flex-wrap:wrap;font-size:11.5px;color:var(--muted);margin-top:6px}
.hbar-row{display:flex;align-items:center;gap:10px;margin-bottom:9px;font-size:12.5px}
.hbar-name{width:110px;flex:none;color:#475569;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hbar-track{flex:1;background:#f0f4fa;border-radius:4px;height:9px;overflow:hidden}
.hbar-fill{height:100%;background:var(--blue);border-radius:4px}
.hbar-val{width:82px;text-align:right;color:var(--navy);font-weight:600;font-variant-numeric:tabular-nums}

/* ---------- Tabs / 设置 ---------- */
.tabs{display:flex;gap:4px;border-bottom:1px solid var(--border);margin-bottom:16px;overflow-x:auto}
.tab{border:none;background:transparent;padding:9px 14px;font-size:13px;color:var(--muted);cursor:pointer;white-space:nowrap;border-bottom:2px solid transparent}
.tab.active{color:var(--blue);border-bottom-color:var(--blue);font-weight:600}

@media(max-width:1180px){.metrics{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:900px){
  .sidebar{transform:translateX(-100%);transition:transform .2s}
  .sidebar.open{transform:translateX(0)}
  .side-mask.show{display:block;position:fixed;inset:0;background:rgba(15,30,60,.35);z-index:39}
  .main{margin-left:0}
  .menu-btn{display:block}
  .topbar{padding:0 14px}
  .top-title b{display:none}
  .top-user{display:none}
  .content{padding:15px 13px 30px}
  .two-col,.three-col{grid-template-columns:1fr}
  .metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
  .metric .val{font-size:21px}
  .form-grid{grid-template-columns:1fr}
  .check-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .kv-grid{grid-template-columns:1fr}
  .filter-bar .inp,.filter-bar select{min-width:0;flex:1 1 130px;max-width:none}
  .table-wrap table{min-width:920px}
  .demo-list{grid-template-columns:1fr 1fr}
}
@media(max-width:520px){
  .metrics{grid-template-columns:repeat(2,minmax(0,1fr))}
  .login-card{padding:22px 18px}
  .top-right .role-tag{display:none}
}
