:root {
  --primary: #16324F;        /* 深海蓝 · 国际范主色 */
  --primary-dark: #0C2237;   /* 深海军蓝 */
  --primary-light: #E8EEF5;  /* 浅蓝灰底 */
  --accent: #C9A227;         /* 香槟金 · 高端点缀 */
  --danger: #C0392B;
  --success: #1F9D61;
  --warning: #E0A020;
  --text: #1A2733;
  --text-light: #64748B;
  --border: #E2E8F0;
  --bg: #F5F7FA;             /* 冷调浅灰蓝 */
  --sidebar-bg: #FFFFFF;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "Segoe UI", "PingFang SC", sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
}

/* ---------- 登录页（国际范 · 深蓝 × 香槟金） ---------- */
#login-screen {
  position: fixed; inset: 0; display: flex; align-items: stretch; justify-content: center;
  background: #fff;
}
/* 左侧品牌面板 */
.login-brand {
  flex: 0 0 46%; max-width: 560px; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1100px 650px at 18% 8%, #1E4A6E 0%, #16324F 46%, #0C2237 100%);
  color: #fff; position: relative; overflow: hidden; padding: 48px;
}
.login-brand::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 82% 86%, rgba(201,162,39,.20), transparent 42%),
    radial-gradient(circle at 10% 92%, rgba(201,162,39,.10), transparent 34%);
}
.login-brand::after {
  content: ""; position: absolute; right: -90px; top: -90px; width: 280px; height: 280px;
  border: 1px solid rgba(255,255,255,.10); border-radius: 50%;
  box-shadow: 0 0 0 42px rgba(255,255,255,.035), 0 0 0 96px rgba(255,255,255,.02);
}
.login-brand-inner { position: relative; z-index: 1; max-width: 400px; }
.login-brand-mark { display: flex; align-items: center; gap: 12px; }
.login-logo-img { height: 72px; width: auto; display: block; filter: drop-shadow(0 2px 10px rgba(0,0,0,.25)); }
.brand-k { font-size: 38px; font-weight: 800; letter-spacing: 6px; line-height: 1; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.login-brand-en {
  margin-top: 14px; font-size: 17px; letter-spacing: 4px; color: rgba(255,255,255,.88); font-weight: 600;
}
.login-brand-rule { width: 48px; height: 2px; background: var(--accent); margin: 28px 0; }
.login-brand-zh { font-size: 25px; font-weight: 700; letter-spacing: 2px; line-height: 1.4; }
.login-brand-zh b { color: var(--accent); font-weight: 800; }
.login-brand-tags { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; }
.login-brand-tags span {
  font-size: 12px; letter-spacing: 1px; padding: 6px 14px; border: 1px solid rgba(255,255,255,.22);
  border-radius: 20px; color: rgba(255,255,255,.82);
}
/* 右侧表单 */
.login-form-side {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; position: relative;
}
.login-card { width: 380px; max-width: 100%; }
.login-card-logo { text-align: center; margin-bottom: 22px; }
.login-card h2 { font-size: 25px; text-align: center; font-weight: 700; color: var(--text); letter-spacing: 2px; }
.login-card-sub { text-align: center; color: var(--text-light); margin: 10px 0 30px; font-size: 13px; }
.login-card .field { margin-bottom: 16px; }
.login-card label { display: block; margin-bottom: 6px; color: var(--text-light); font-size: 13px; }
.login-card input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,50,79,.10); }
.login-error { color: var(--danger); font-size: 12px; min-height: 16px; margin-bottom: 8px; }
.login-card .btn {
  width: 100%; padding: 12px; font-size: 15px; justify-content: center; letter-spacing: 4px; border-radius: 8px;
}
.login-tip { margin-top: 18px; font-size: 11px; color: var(--text-light); text-align: center; }

/* ---------- 主框架 ---------- */
#app { display: none; height: 100vh; flex-direction: column; }
#app.show { display: flex; }
.topbar {
  height: 54px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 18px; gap: 12px; flex-shrink: 0;
}
.topbar .logo { display: flex; align-items: center; gap: 10px; }
.topbar .logo .logo-word { font-size: 16px; font-weight: 800; color: var(--primary); letter-spacing: 2px; }
.topbar .logo .logo-img { display: block; height: 26px; width: auto; filter: drop-shadow(0 1px 0 rgba(22,50,79,.06)); }
.topbar .logo .sys-name { font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: 1px; padding-left: 10px; border-left: 2px solid var(--border); }
.topbar .logo .mark {
  width: 28px; height: 28px; border-radius: 6px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700;
}
.topbar .spacer { flex: 1; }
.topbar .user-info { color: var(--text-light); display: flex; align-items: center; gap: 10px; }
.topbar .user-info .role-tag {
  background: var(--primary-light); color: var(--primary); padding: 2px 8px; border-radius: 10px; font-size: 11px;
}
.layout { flex: 1; display: flex; min-height: 0; position: relative; }
.sidebar {
  width: 208px; background: var(--sidebar-bg); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 10px 0 40px; flex-shrink: 0;
  transition: width .18s ease; overflow-x: hidden;
}
.sidebar .nav-group { margin: 5px 8px 9px; border-radius: 10px; }
.sidebar .group-title {
  padding: 9px 10px; border-radius: 9px;
  display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  background: linear-gradient(105deg, var(--gc, #16324F) 0%, var(--gc2, #2E5A80) 100%);
  box-shadow: 0 3px 9px -4px var(--gc, #16324F);
  transition: box-shadow .15s ease, filter .15s ease, transform .15s ease;
}
.sidebar .group-title:hover {
  filter: brightness(1.07); transform: translateY(-1px);
  box-shadow: 0 5px 14px -5px var(--gc, #16324F);
}
.sidebar .nav-group.collapsed .group-title { filter: saturate(.3) opacity(.75); box-shadow: none; transform: none; }
.sidebar .gt-arrow { font-size: 11px; width: 10px; text-align: center; transition: transform .15s ease; color: rgba(255,255,255,.85); flex-shrink: 0; }
.sidebar .nav-group.collapsed .gt-arrow { transform: rotate(-90deg); }
.sidebar .gt-code {
  color: #fff; font-size: 12.5px; font-weight: 800; letter-spacing: 1.5px;
  text-shadow: 0 1px 2px rgba(0,0,0,.16); white-space: nowrap;
}
.sidebar .gt-txt { white-space: nowrap; font-size: 12.5px; font-weight: 700; color: #fff; opacity: .96; }
.sidebar .gt-badge {
  margin-left: auto; font-size: 10px; line-height: 1; padding: 3px 7px; border-radius: 9px;
  background: rgba(255,255,255,.26); color: #fff; font-weight: 700;
}
.sidebar .gt-bar { display: none; }
.sidebar .nav-group.collapsed .group-items { display: none; }
.sidebar .group-items { border-radius: 0 0 8px 8px; }
.sidebar a {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 15px; color: var(--text);
  text-decoration: none; border-radius: 7px; position: relative; cursor: pointer;
  white-space: nowrap; overflow: hidden;
}
.sidebar a:hover { background: var(--gcl, var(--primary-light)); }
.sidebar a.active { background: var(--gcl, var(--primary-light)); color: var(--gc, var(--primary)); font-weight: 700; }
.sidebar a.active::before {
  content: ""; position: absolute; left: 4px; top: 24%; bottom: 24%; width: 3px;
  border-radius: 2px; background: var(--gc, var(--primary));
}
.sidebar a .ic { width: 20px; height: 20px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; background: var(--mc, var(--primary)); color: #fff; font-size: 11px; line-height: 1; flex-shrink: 0; }
.sidebar a .t { overflow: hidden; text-overflow: ellipsis; }

/* ---- 迷你模式（往左收窄：仅显示色块） ---- */
.sidebar.mini { width: 52px; }
.sidebar.mini .gt-arrow, .sidebar.mini .gt-txt, .sidebar.mini .gt-badge { display: none; }
.sidebar.mini .nav-group { margin: 6px 5px; }
.sidebar.mini .group-title { justify-content: center; padding: 9px 0; gap: 0; }
.sidebar.mini .gt-code { font-size: 9.5px; letter-spacing: .5px; }
.sidebar.mini .nav-group.collapsed .group-items { display: block; }
.sidebar.mini a { justify-content: center; padding: 9px 0; gap: 0; }
.sidebar.mini a .t { display: none; }
.sidebar.mini a .ic { width: 22px; height: 22px; font-size: 12px; }
.sidebar.mini a.active::before { display: none; }

/* ---- 侧栏展开/收窄切换按钮 ---- */
.sidebar-toggle {
  position: absolute; z-index: 30; top: 50%; transform: translateY(-50%); left: 208px;
  width: 18px; height: 52px; padding: 0;
  border: 1px solid var(--border); border-left: none; border-radius: 0 12px 12px 0;
  background: #fff; color: var(--primary); font-weight: 700;
  font-size: 13px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 2px 0 8px rgba(22,50,79,.12);
  transition: left .18s ease, background .15s ease, color .15s ease;
}
.sidebar-toggle:hover { background: var(--primary-light); color: var(--primary-dark); box-shadow: 2px 0 10px rgba(22,50,79,.18); }
#sidebar.mini + .sidebar-toggle { left: 52px; }
.main { flex: 1; overflow-y: auto; padding: 18px 22px; min-width: 0; }

/* ---------- 通用组件 ---------- */
.page-title { font-size: 17px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.page-title .desc { font-size: 12px; color: var(--text-light); font-weight: 400; }
.card {
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 16px;
}
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.toolbar .grow { flex: 1; }
input.ipt, select.ipt {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
  background: #fff; color: var(--text); min-width: 0;
}
input.ipt:focus, select.ipt:focus { outline: none; border-color: var(--primary); }
/* 考勤 6 次打卡时间：填写后红色显示（没填则空白） */
input.ipt[data-k^="check_"] { color: #c0392b; font-weight: 600; }
button.btn {
  padding: 7px 16px; border: none; border-radius: 6px; font-size: 13px; cursor: pointer;
  background: var(--primary); color: #fff; display: inline-flex; align-items: center; gap: 5px;
}
button.btn:hover { background: var(--primary-dark); }
button.btn.gray { background: #fff; color: var(--text); border: 1px solid var(--border); }
button.btn.gray:hover { background: var(--bg); }
button.btn.danger { background: var(--danger); }
button.btn.danger:hover { background: #b53a36; }
button.btn.sm { padding: 4px 10px; font-size: 12px; }
button.btn:disabled { opacity: .5; cursor: not-allowed; }

table.tbl { width: 100%; border-collapse: collapse; background: #fff; }
table.tbl th, table.tbl td {
  padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap;
}
table.tbl th { background: #F4EAE2; color: #7a5c52; font-weight: 600; font-size: 12px; }
table.tbl tr:hover td { background: #FBF4EE; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .pos { color: var(--success); }
table.tbl .neg { color: var(--danger); }
.empty-tip { text-align: center; color: var(--text-light); padding: 40px 0; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
/* 产品档案表格冻结列（水平滚动锁定前 N 列，left 由 JS 动态设置） */
table.tbl th.fc, table.tbl td.fc {
  position: sticky;
  z-index: 3;
}
table.tbl td.fc { background: #fff; }
table.tbl tr:hover td.fc { background: #FBF4EE; }
table.tbl th.fc { background: #F4EAE2; }
table.tbl th.fc, table.tbl td.fc { box-shadow: 1px 0 0 0 var(--border); }

/* 宽表容器（薪资管理等多列表格）：限定视口高度，横向滚动条常驻可视区底部，
   无需把页面上下滚到底才能左右滚动；表头吸顶跟随 */
.tbl-sticky {
  max-height: calc(100vh - 310px);
  min-height: 200px;
  overflow: auto;
}
.tbl-sticky table.tbl th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 0 var(--border);
}
/* 顶部内容较多（统计卡/模板卡等）的页面：容器更矮，确保横向滚动条完全落在视口内 */
.tbl-sticky-short {
  max-height: calc(100vh - 430px);
}
/* 顶部只有标题+工具栏的宽表（客户/供应商档案等）：余量更小，表格可视区更高 */
.tbl-sticky-sm {
  max-height: calc(100vh - 235px);
}

/* ============ 客户/供应商 文件柜 ============ */
.pf-cat-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.pf-cat-tab {
  padding: 6px 16px; border-radius: 18px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); color: var(--text-light); background: #fff;
  transition: all .15s ease; user-select: none;
}
.pf-cat-tab:hover { border-color: var(--primary); color: var(--primary); }
.pf-cat-tab.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.pf-cat-tab b { font-weight: 700; }
.pf-drop {
  border: 2px dashed #C3CFDC; border-radius: 12px; padding: 30px 20px;
  text-align: center; cursor: pointer; background: #FAFBFD; transition: all .18s ease;
}
.pf-drop:hover, .pf-drop.dragging { border-color: var(--primary); background: var(--primary-light); }
.pf-drop.uploading { border-color: var(--accent); background: #FBF8EE; }
.pf-drop-ico { font-size: 40px; line-height: 1; }
.pf-drop-title { font-size: 15px; font-weight: 600; color: var(--text); margin-top: 10px; }
.pf-drop-sub { font-size: 12px; color: var(--text-light); margin-top: 6px; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.tag.ok { background: #e8f7ee; color: var(--success); }
.tag.warn { background: #fdf3e3; color: var(--warning); }
.tag.bad { background: #fdecec; color: var(--danger); }
.tag.danger { background: #fdecec; color: var(--danger); }
.tag.blue { background: var(--primary-light); color: var(--primary); }
/* 技能选择芯片 */
.sk-chip {
  display: inline-block; padding: 4px 12px; border-radius: 14px; font-size: 12px; cursor: pointer;
  border: 1px solid var(--border); color: var(--text-light); background: #fff; user-select: none;
}
.sk-chip:hover { border-color: var(--primary); color: var(--primary); }
.sk-chip.on { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 600; }
/* BOM 材料标签 */
.bom-mat {
  display: inline-block; background: var(--primary-light); color: #3A5C7E; font-size: 11px;
  padding: 2px 8px; border-radius: 10px; margin: 2px 4px 2px 0; white-space: nowrap;
}

/* 首页四大版块卡片 */

/* ---- PLM 相关 ---- */
.tag.gray { background: #f0ede8; color: #8a7d72; }
.ver { display: inline-block; font-size: 11px; color: var(--text-light); margin-left: 4px; }
.lv { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 20px;
  border-radius: 10px; font-size: 12px; font-weight: 600; }
.lv1 { background: var(--primary-light); color: var(--primary); }
.lv2 { background: #fdf3e3; color: var(--warning); }
.lv3, .lv4, .lv5 { background: #f0ede8; color: #8a7d72; }
.ecn-detail > div { margin-bottom: 12px; }
.ecn-detail label { display: block; font-size: 12px; color: var(--text-light); margin-bottom: 3px; }
.ecn-detail { font-size: 13px; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 18px; }
.module-card {
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px 14px;
}
.module-card.plm { border-top: 3px solid #C9A227; }
.module-card.erp { border-top: 3px solid #16324F; }
.module-card.mes { border-top: 3px solid #d98e3a; }
.module-card.wms { border-top: 3px solid #2e9e5b; }
.module-card .m-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.module-card .m-code {
  font-family: "Arial Black", Arial, sans-serif; font-weight: 900; font-size: 21px; color: var(--text);
}
.module-card.plm .m-code { color: #B08A1F; }
.module-card.erp .m-code { color: #16324F; }
.module-card.mes .m-code { color: #b06f22; }
.module-card.wms .m-code { color: #218049; }
.module-card .m-name { font-size: 12px; color: var(--text-light); }
.module-card .m-stat { font-size: 12px; color: var(--text-light); margin-bottom: 8px; }
.module-card .m-stat b { font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.module-card .m-desc { font-size: 12px; color: var(--text-light); line-height: 1.6; margin-bottom: 12px; min-height: 38px; }
.module-card .m-links { display: flex; flex-wrap: wrap; gap: 6px; }
.module-card .m-links a {
  font-size: 12px; color: var(--primary); background: var(--primary-light); padding: 3px 11px;
  border-radius: 10px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.module-card .m-links a:hover { background: var(--primary); color: #fff; }

/* 仪表盘 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px;
}
.stat-card .label { color: var(--text-light); font-size: 12px; margin-bottom: 8px; }
.stat-card .value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-card .foot { margin-top: 6px; font-size: 11px; color: var(--text-light); }
.stat-card.blue { border-top: 3px solid var(--primary); }
.stat-card.green { border-top: 3px solid var(--success); }
.stat-card.orange { border-top: 3px solid var(--warning); }
.stat-card.red { border-top: 3px solid var(--danger); }
.dash-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .dash-cols { grid-template-columns: 1fr; } }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 30, 50, .45); display: flex;
  align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-mask.layer2 { z-index: 150; }   /* 第二层弹窗（如工商检索叠加在编辑弹窗之上） */
.modal {
  background: #fff; border-radius: 10px; width: 640px; max-width: 96vw; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0, 20, 50, .3);
}
.modal.wide { width: 960px; }
.modal .m-head {
  padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex;
  align-items: center; justify-content: space-between; font-size: 15px; font-weight: 700;
}
.modal .m-head .close { cursor: pointer; color: var(--text-light); font-size: 18px; }
.modal .m-body { padding: 18px 20px; overflow-y: auto; }
.modal .m-foot {
  padding: 12px 20px; border-top: 1px solid var(--border); display: flex;
  justify-content: flex-end; gap: 10px;
}
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 18px; }
.form-grid .f-full { grid-column: 1 / -1; }
.form-item label { display: block; margin-bottom: 5px; color: var(--text-light); font-size: 12px; }
.form-item input.ipt, .form-item select.ipt { width: 100%; }
.form-error { color: var(--danger); margin-top: 10px; font-size: 12px; min-height: 15px; }

/* 单据录入 */
.doc-head-fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 16px; margin-bottom: 14px; }
@media (max-width: 1000px) { .doc-head-fields { grid-template-columns: repeat(2, 1fr); } }
.doc-total-bar {
  display: flex; justify-content: flex-end; align-items: center; gap: 20px; padding: 12px 4px;
  font-size: 14px;
}
.doc-total-bar b { font-size: 18px; color: var(--danger); font-variant-numeric: tabular-nums; }
table.tbl input.ipt, table.tbl select.ipt { width: 100%; padding: 5px 6px; }
table.tbl td .cell-ctrl { min-width: 90px; }
table.doc-edit td { padding: 4px 6px; }
/* 报价单数量/单价数字输入框：去掉上下箭头，避免遮挡点击；兼容中文输入法输入 */
.i-qty, .i-price, .i-tax {
  -moz-appearance: textfield;
}
.i-qty::-webkit-outer-spin-button,
.i-qty::-webkit-inner-spin-button,
.i-price::-webkit-outer-spin-button,
.i-price::-webkit-inner-spin-button,
.i-tax::-webkit-outer-spin-button,
.i-tax::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.i-qty, .i-price, .i-tax { padding-right: 8px; }
.table-note { color: var(--text-light); font-size: 12px; margin: 8px 0; }
.muted { color: var(--text-light); font-size: 12px; }
.ipt.err { border-color: var(--danger); background: #fff6f5; }

/* 报价单状态流程条 */
.qt-flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.qt-step { padding: 3px 12px; border-radius: 12px; font-size: 12px; background: #f3ece9; color: var(--text-light); }
.qt-step.done { background: #e8f7ee; color: var(--success); }
.qt-step.cur { background: var(--primary); color: #fff; font-weight: 600; }
.qt-step.bad { background: #fdecec; color: var(--danger); }
.qt-arrow { color: var(--text-light); font-size: 12px; }

/* 简易条形图 */
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bar-row .bl { width: 84px; color: var(--text-light); font-size: 12px; text-align: right; flex-shrink: 0; }
.bar-row .btrack { flex: 1; background: #E6ECF2; height: 16px; border-radius: 3px; overflow: hidden; }
.bar-row .bfill { height: 100%; background: linear-gradient(90deg, #16324F, #2E5A80); border-radius: 3px; }
.bar-row .bv { width: 110px; font-size: 12px; font-variant-numeric: tabular-nums; }

/* 工单进度条 */
.prog { display: inline-block; width: 100%; min-width: 80px; background: #E6ECF2; height: 12px; border-radius: 3px; overflow: hidden; vertical-align: middle; }
.prog .prog-fill { height: 100%; background: linear-gradient(90deg, #16324F, #2E5A80); border-radius: 3px; }
.tag.warn { background: #FBEEDC; color: #9A5B00; }

.toast {
  position: fixed; top: 66px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: #4a2a22; color: #fff; padding: 10px 22px; border-radius: 6px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25); animation: fadein .2s;
}
.toast.err { background: var(--danger); }
@keyframes fadein { from { opacity: 0; top: 50px; } to { opacity: 1; top: 66px; } }
.section-h { font-size: 14px; font-weight: 700; margin: 4px 0 12px; padding-left: 8px; border-left: 3px solid var(--primary); }

/* ============ 系统管理 ============ */
.two-col { display: grid; grid-template-columns: 1fr 1.6fr; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }
.perm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 10px; margin-top: 6px; }
.perm-item { display: flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 6px; border-radius: 6px; cursor: pointer; }
.perm-item:hover { background: var(--bg-soft, #faf5ef); }
.perm-item input { accent-color: var(--primary); }
.active-row td { background: rgba(192, 39, 26, 0.06); }

/* ============ CRM 版块 ============ */
.module-card.crm { border-top: 3px solid #B8862F; }
.module-card.crm .m-code { color: #96702a; }

/* ============ 首页图表 ============ */
.chart-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.chart-grid .span-2 { grid-column: span 2; }
@media (max-width: 1100px) { .chart-grid { grid-template-columns: 1fr; } .chart-grid .span-2 { grid-column: span 1; } }
.chart-card { padding: 14px 16px; }
.chart-card .section-h .desc { font-weight: 400; font-size: 11px; color: var(--text-light); margin-left: 6px; }
.chart-empty { padding: 40px 0; text-align: center; color: var(--text-light); font-size: 12px; }
.pie-wrap { display: flex; align-items: center; gap: 14px; padding: 4px 0; }
.pie-wrap svg { flex-shrink: 0; }
.lg-list { flex: 1; min-width: 0; }
.lg-row { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 0; }
.lg-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.lg-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.lg-val { color: var(--text-light); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.bar-legend { display: flex; gap: 14px; margin-bottom: 4px; padding-left: 6px; }
.hb-list { padding: 6px 0; display: flex; flex-direction: column; gap: 8px; }
.hb-row { display: grid; grid-template-columns: 110px 1fr 64px; align-items: center; gap: 8px; font-size: 12px; }
.hb-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); text-align: right; }
.hb-track { background: #f3ebe4; border-radius: 5px; height: 14px; overflow: hidden; }
.hb-fill { height: 100%; border-radius: 5px; min-width: 2px; transition: width .5s ease; }
.hb-val { color: var(--text-light); font-variant-numeric: tabular-nums; }

/* WMS 库位 */
.tabs { display: inline-flex; gap: 4px; margin-bottom: 12px; background: var(--bg-soft, #f5f0ea); padding: 3px; border-radius: 8px; }
.tab { border: none; background: transparent; padding: 6px 18px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text-light); }
.tab.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }
.code-chip { display: inline-block; padding: 1px 8px; border-radius: 5px; background: #f3ebe4; border: 1px dashed #d9c9b8; font-family: Consolas, monospace; font-size: 12px; color: var(--text); }
.wh-type-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.wh-type-card { flex: 1; min-width: 150px; padding: 10px 14px; border: 1px solid var(--line, #e6ddd2); border-radius: 8px; background: #fff; }
.wh-type-card b { display: block; font-size: 13px; margin-bottom: 2px; }
.wh-type-card span { font-size: 11px; color: var(--text-light); }

/* 消息中心 */
.bell-btn { position: relative; }
.bell-ic { font-size: 16px; line-height: 1; }
.msg-badge { position: absolute; top: -6px; right: -8px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--danger, #C0271A); color: #fff; font-size: 10px; font-weight: 700;
  align-items: center; justify-content: center; box-shadow: 0 0 0 2px #fff; }
.msg-unread { background: #F2F6FA; }
.msg-unread td:first-child { box-shadow: inset 3px 0 0 var(--primary, #16324F); }

/* 工单问题行高亮 */
.row-warn { background: #fff6f4 !important; }
.row-warn:hover td { background: #fff0ec !important; }
.issue-card { background: var(--card, #fff); }

/* 汉堡按钮：仅手机端显示，桌面隐藏 */
.hamburger {
  display: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0; margin-right: 2px; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 9px; background: #fff;
  color: var(--primary); font-size: 19px; line-height: 1; cursor: pointer;
}
.hamburger:active { background: var(--primary-light); }
/* 抽屉遮罩：仅手机端显示 */
.sidebar-mask { display: none; }

/* ============================================================
   手机端适配（≤ 768px）
   核心变化：侧栏由「固定占宽 208px」改为「抽屉式滑出」，
   内容区拿回整屏宽度；表格保持横向滚动；表单与弹窗改纵向布局。
   ============================================================ */
@media (max-width: 768px) {
  :root { --topbar-h: 50px; }

  #app { height: 100dvh; }

  /* ---- 顶栏紧凑化 ---- */
  .topbar { height: var(--topbar-h); padding: 0 10px; gap: 8px; }
  .topbar .logo { gap: 8px; min-width: 0; }
  .topbar .logo .logo-img { height: 22px; }
  .topbar .logo .sys-name { display: none; }      /* 全称在窄屏会被挤成竖排 */
  .topbar .user-info { gap: 6px; }
  .topbar .user-info #topbar-user {
    max-width: 66px; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; font-size: 12px;
  }
  .topbar .user-info .role-tag { display: none; }
  .topbar .user-info .btn { padding: 6px 10px; font-size: 12px; }
  .hamburger { display: inline-flex; }

  /* ---- 侧栏改抽屉 ---- */
  .sidebar {
    position: fixed; top: var(--topbar-h); bottom: 0; left: 0;
    width: 264px; z-index: 70;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 4px 0 24px rgba(122, 21, 8, .18);
    padding-bottom: 60px;
  }
  .sidebar.open { transform: none; }
  .sidebar a { padding: 12px 16px; font-size: 14px; }
  .sidebar .group-title { padding: 13px 16px 6px; }
  .sidebar-toggle { display: none !important; }   /* 桌面「收窄」按钮在手机上无意义 */

  /* 从桌面带来的迷你模式残留需在手机上中和掉 */
  .sidebar.mini { width: 264px; }
  .sidebar.mini .gt-arrow, .sidebar.mini .gt-txt, .sidebar.mini .gt-badge { display: inline; }
  .sidebar.mini .gt-bar { display: none; }
  .sidebar.mini .group-title { padding: 13px 16px 6px; justify-content: flex-start; }
  .sidebar.mini .nav-group.collapsed .group-items { display: none; }
  .sidebar.mini a { justify-content: flex-start; padding: 12px 16px; gap: 8px; }
  .sidebar.mini a .t { display: inline; }
  .sidebar.mini a .ic { width: 20px; height: 20px; font-size: 11px; }

  .sidebar-mask {
    position: fixed; left: 0; right: 0; top: var(--topbar-h); bottom: 0;
    background: rgba(46, 27, 20, .42); z-index: 65;
  }
  .sidebar-mask.show { display: block; }

  /* ---- 内容区拿回整屏 ---- */
  body { font-size: 14px; }
  .main { padding: 12px 12px 40px; }
  .page-title { font-size: 15px; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
  .page-title .desc { width: 100%; font-size: 11px; }
  .card { padding: 12px; margin-bottom: 12px; }
  .section-h { font-size: 13px; margin-bottom: 10px; }

  /* ---- 表格 ---- */
  .tbl-wrap { border-radius: 6px; -webkit-overflow-scrolling: touch; }
  table.tbl th, table.tbl td { padding: 9px 10px; font-size: 13px; }
  table.tbl th { font-size: 12px; }
  table.tbl td.num, table.tbl th.num { white-space: nowrap; }

  /* ---- 表单：输入框 ≥16px 可避免 iOS 聚焦时整页放大 ---- */
  .form-grid { grid-template-columns: 1fr; gap: 10px; }
  .doc-head-fields { grid-template-columns: 1fr 1fr; gap: 10px; }
  input.ipt, select.ipt { padding: 9px 10px; font-size: 16px; }
  .form-item label { font-size: 12px; }
  .toolbar { gap: 8px; }
  .toolbar .ipt { flex: 1 1 120px; }

  /* ---- 按钮加大触摸目标 ---- */
  button.btn { padding: 9px 14px; font-size: 13px; }
  button.btn.sm { padding: 7px 11px; font-size: 12px; }

  /* ---- 弹窗：底部升起式，接近原生体验 ---- */
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal, .modal.wide {
    width: 100%; max-width: 100vw; max-height: 92dvh;
    border-radius: 14px 14px 0 0;
  }
  .modal .m-head { padding: 13px 16px; font-size: 14px; }
  .modal .m-body { padding: 14px 16px; }
  .modal .m-foot { padding: 10px 16px; }

  /* ---- 登录页（移动端：隐藏品牌面板，只留表单） ---- */
  .login-brand { display: none; }
  .login-form-side { padding: 40px 22px; }
  .login-card { width: calc(100vw - 32px); max-width: 380px; }
  .login-card h2 { font-size: 21px; }
  .login-card input { font-size: 16px; padding: 12px 13px; }
  .login-card-logo img { height: 46px; }

  /* ---- 卡片类版块改单列 ---- */
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(45%, 1fr)); gap: 10px; }
  .stat-card { padding: 12px 14px; }
  .stat-card .value { font-size: 19px; }
  .stat-card .label { font-size: 11px; margin-bottom: 5px; }
  .module-grid { grid-template-columns: 1fr; gap: 10px; }
  .module-card { padding: 14px; }
  .module-card .m-desc { min-height: 0; }
  .chart-grid { gap: 10px; }
  .chart-card { padding: 12px; }
  .dash-cols { gap: 10px; }

  /* ---- 图表自适应 ---- */
  .pie-wrap { flex-direction: column; align-items: stretch; }
  .pie-wrap svg { align-self: center; }
  .hb-row { grid-template-columns: 84px 1fr 54px; font-size: 11px; }
  .bar-row .bl { width: 60px; font-size: 11px; }
  .bar-row .bv { width: 82px; font-size: 11px; }

  /* ---- 其它 ---- */
  .perm-grid { grid-template-columns: repeat(2, 1fr); }
  .qt-flow { gap: 4px; }
  .qt-step { padding: 3px 9px; font-size: 11px; }
  .doc-total-bar { flex-wrap: wrap; gap: 12px; font-size: 13px; }
  .doc-total-bar b { font-size: 16px; }
  .toast { top: 58px; width: calc(100vw - 28px); text-align: center; }
  .wh-type-card { min-width: 100%; }

  /* ---- 触摸设备抑制 hover 残留 ---- */
  .sidebar a:hover { background: transparent; }
  .sidebar a.active:hover { background: var(--gcl, var(--primary-light)); }
  table.tbl tr:hover td { background: transparent; }
}

/* 已在桌面装过「收窄侧栏」的浏览器，切到手机后点菜单不再触发收窄逻辑 */
@media (max-width: 768px) {
  .main { padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
}

/* 添加到主屏幕后以独立窗口运行：给顶栏让出状态栏/刘海高度 */
@media (max-width: 768px) and (display-mode: standalone) {
  :root { --topbar-h: calc(50px + env(safe-area-inset-top, 0px)); }
  .topbar { padding-top: env(safe-area-inset-top, 0px); }
}

/* ---------- ICP 备案页脚（工信部要求：网站底部需展示备案号） ---------- */
.icp-foot {
  flex: none; text-align: center; font-size: 11.5px; line-height: 1.7;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  color: #A2907F; background: var(--bg);
}
.icp-foot a { color: #8a6f66; text-decoration: none; }
.icp-foot a:hover { color: var(--primary); text-decoration: underline; }
/* 登录页：备案信息固定于表单侧底部 */
#login-screen .icp-foot {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 12px 16px;
  background: transparent; color: #A2907F;
}
#login-screen .icp-foot a { color: #8a6f66; }

/* ================= 合同管理 · 版块样式 ================= */
.ct-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 14px 0 16px;
}
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 18px; display: flex; flex-direction: column; gap: 2px;
  box-shadow: 0 1px 3px rgba(46,27,20,.05); border-top: 3px solid var(--primary);
}
.stat-card.sc-ok   { border-top-color: #3E8E5A; }
.stat-card.sc-warn { border-top-color: #B8862F; }
.stat-card.sc-exp  { border-top-color: #A0522D; }
.stat-card .stat-num { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.15; font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif; }
.stat-card.sc-ok   .stat-num { color: #3E8E5A; }
.stat-card.sc-warn .stat-num { color: #B8862F; }
.stat-card.sc-exp  .stat-num { color: #A0522D; }
.stat-card .stat-lab { font-size: 12px; color: var(--text-light); letter-spacing: 1px; }

.tpl-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px;
}
.tpl-card {
  display: flex; align-items: flex-start; gap: 12px; cursor: pointer;
  background: linear-gradient(135deg, #fff 0%, #fdf9f4 100%);
  border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 12px;
  padding: 16px 16px 14px; transition: box-shadow .15s ease, transform .15s ease;
  box-shadow: 0 1px 4px rgba(46,27,20,.06);
}
.tpl-card:hover { box-shadow: 0 6px 18px rgba(22,50,79,.14); transform: translateY(-2px); }
.tpl-card.tc-red    { border-left-color: #C0271A; }
.tpl-card.tc-blue   { border-left-color: #2F7A99; }
.tpl-card.tc-orange { border-left-color: #B0571F; }
.tpl-card .tc-ic {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 800; color: #fff; background: var(--primary);
  box-shadow: 0 2px 5px rgba(46,27,20,.22);
}
.tpl-card.tc-blue   .tc-ic { background: #2F7A99; }
.tpl-card.tc-orange .tc-ic { background: #B0571F; }
.tpl-card .tc-body { flex: 1; min-width: 0; }
.tpl-card .tc-name { font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 3px; }
.tpl-card .tc-desc { font-size: 12px; color: var(--text-light); line-height: 1.55; margin-bottom: 8px; }
.tpl-card .tc-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tpl-card .tc-tags span {
  font-size: 11px; padding: 2px 8px; border-radius: 9px;
  background: var(--primary-light); color: var(--primary);
}
.tpl-card.tc-blue   .tc-tags span { background: #E8F1F5; color: #2F7A99; }
.tpl-card.tc-orange .tc-tags span { background: #F7EDE3; color: #B0571F; }
.tpl-card .tc-go {
  align-self: center; flex-shrink: 0; font-size: 12px; font-weight: 700;
  color: var(--primary); background: var(--primary-light);
  padding: 6px 12px; border-radius: 8px; white-space: nowrap;
}

/* 福利待遇勾选组（表单内） */
.chk-group { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 0; }
.chk-pill {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer; user-select: none;
  font-size: 12.5px; color: var(--text); padding: 5px 11px; border-radius: 16px;
  border: 1px solid var(--border); background: #fff; transition: all .12s ease;
}
.chk-pill:hover { border-color: var(--primary); }
.chk-pill input[type=checkbox] { accent-color: var(--primary); margin: 0; cursor: pointer; }
.chk-pill:has(input:checked) { background: var(--primary-light); border-color: var(--primary); color: var(--primary); font-weight: 600; }

@media (max-width: 1100px) {
  .tpl-cards { grid-template-columns: 1fr; }
  .ct-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---- 图片上传控件（证件照留底等） ---- */
.up-box { display: flex; align-items: flex-start; gap: 10px; }
.up-prev {
  height: 84px; width: auto; max-width: 150px; object-fit: cover;
  border: 1px solid var(--border); border-radius: 8px; cursor: zoom-in;
  background: #faf8f5; padding: 2px;
}
.up-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.up-pick { position: relative; overflow: hidden; }
.up-note { font-size: 12px; color: var(--text-light); }
