/* 工厂采购管理系统 - 样式表 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --sidebar-bg: #111c33;
  --sidebar-hover: #1c2b4a;
  --sidebar-active: #2563eb;
  --text: #1f2937;
  --text-soft: #6b7280;
  --text-mute: #9ca3af;
  --border: #e5e7eb;
  --bg: #f4f6fa;
  --card: #ffffff;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --info: #0891b2;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Helvetica, Arial, "Noto Sans CJK SC", sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: inherit; font-size: 14px; }

/* ---------------------------------------------------------------- 登录页 */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 55%, #2563eb 100%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 900px; background: #fff; border-radius: 14px;
  box-shadow: 0 24px 60px rgba(2, 6, 23, .45); overflow: hidden; display: flex;
}
.login-brand {
  flex: 1 1 46%; padding: 46px 40px; color: #fff;
  background: linear-gradient(160deg, #1e293b, #1e3a8a);
  display: flex; flex-direction: column; justify-content: center;
}
.login-brand h1 { font-size: 24px; margin: 0 0 10px; letter-spacing: 1px; }
.login-brand p { color: #c7d2fe; line-height: 1.9; font-size: 13px; margin: 0; }
.login-brand .feats { margin-top: 26px; }
.login-brand .feats div { padding: 5px 0; color: #dbeafe; font-size: 13px; }
.login-form { flex: 1 1 54%; padding: 46px 44px; }
.login-form h2 { margin: 0 0 6px; font-size: 20px; }
.login-form .sub { color: var(--text-soft); font-size: 13px; margin-bottom: 26px; }
.login-tip {
  margin-top: 18px; padding: 12px 14px; background: var(--primary-light);
  border-radius: 8px; color: #1e40af; font-size: 12px; line-height: 1.8;
}
@media (max-width: 820px) {
  .login-card { flex-direction: column; max-width: 420px; }
  .login-brand { padding: 30px 28px; }
  .login-brand .feats { display: none; }
  .login-form { padding: 30px 28px; }
}

/* ---------------------------------------------------------------- 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px; flex: 0 0 218px; background: var(--sidebar-bg); color: #cbd5e1;
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 60; transition: transform .22s ease;
}
.logo {
  height: 58px; display: flex; align-items: center; gap: 10px; padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .07); flex: 0 0 auto;
}
.logo .mark {
  width: 28px; height: 28px; border-radius: 7px; background: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  color: #fff; font-size: 14px; flex: 0 0 auto;
}
.logo .mark.long { font-size: 12px; letter-spacing: .3px; }
.logo .name { font-size: 14px; font-weight: 600; color: #fff; letter-spacing: .5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { flex: 1; overflow-y: auto; padding: 8px 0 20px; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
.nav-group { padding: 14px 16px 6px; font-size: 11px; color: #64748b; letter-spacing: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 16px; cursor: pointer;
  font-size: 13.5px; color: #cbd5e1; border-left: 3px solid transparent; user-select: none;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--sidebar-hover); color: #fff; border-left-color: var(--primary); }
.nav-item .ico { width: 16px; text-align: center; opacity: .85; font-style: normal; }
.nav-item .badge-dot {
  margin-left: auto; background: var(--danger); color: #fff; border-radius: 9px;
  font-size: 11px; padding: 1px 6px; line-height: 15px;
}

.main { flex: 1; margin-left: 218px; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
  position: sticky; top: 0; z-index: 40;
}
.topbar .page-title { font-size: 16px; font-weight: 600; }
.topbar .crumb { color: var(--text-mute); font-size: 12.5px; }
.topbar .spacer { flex: 1; }
.hamburger { display: none; cursor: pointer; font-size: 20px; line-height: 1; }
.user-chip {
  display: flex; align-items: center; gap: 9px; cursor: pointer; padding: 5px 9px;
  border-radius: 8px; position: relative;
}
.user-chip:hover { background: var(--bg); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.user-chip .meta { line-height: 1.3; }
.user-chip .meta b { font-weight: 600; font-size: 13px; }
.user-chip .meta span { display: block; font-size: 11.5px; color: var(--text-mute); }
.dropdown {
  position: absolute; right: 0; top: 46px; background: #fff; border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow-md); min-width: 176px; padding: 5px; z-index: 80;
}
.dropdown .dd-item { padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.dropdown .dd-item:hover { background: var(--bg); }
.dropdown .dd-sep { height: 1px; background: var(--border); margin: 4px 0; }

.content { padding: 18px 20px 40px; flex: 1; }

/* 页面缩放控件 */
.zoom-box { display: flex; align-items: center; gap: 4px; }
.zoom-box .zoom-val {
  min-width: 46px; text-align: center; font-size: 12.5px; color: var(--text-soft);
  cursor: pointer; user-select: none; padding: 2px 4px; border-radius: 6px;
}
.zoom-box .zoom-val:hover { background: var(--bg); color: var(--primary); }
/* 表格横向拖动时的鼠标样式 */
body.dragging-x, body.dragging-x * { cursor: grabbing !important; user-select: none !important; }
@media (max-width: 900px) { .zoom-box { display: none; } }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-mask { display: block; }
  .main { margin-left: 0; }
  .hamburger { display: block; }
  .nav-mask { display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(15,23,42,.5); z-index: 55; }
}

/* ---------------------------------------------------------------- 卡片与栅格 */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-head {
  padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex;
  align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.card-body.nopad { padding: 0; }

.grid { display: grid; gap: 14px; }
/* KPI 栅格后面还有别的模块时，留出和卡片一致的间距（否则上下模块会贴在一起） */
.grid + * { margin-top: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.c2-1 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1100px) {
  .grid.c4, .grid.c5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c2-1, .grid.c3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid.c2, .grid.c4, .grid.c5 { grid-template-columns: 1fr; }
  .content { padding: 12px 12px 40px; }
}

/* ---------------------------------------------------------------- KPI */
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi .label { color: var(--text-soft); font-size: 12.5px; margin-bottom: 8px; }
.kpi .value { font-size: 22px; font-weight: 600; letter-spacing: -.4px; }
.kpi .value small { font-size: 12px; font-weight: 400; color: var(--text-mute); margin-left: 3px; }
.kpi .sub { font-size: 12px; color: var(--text-mute); margin-top: 6px; }
.kpi.blue { border-top: 3px solid var(--primary); }
.kpi.green { border-top: 3px solid var(--success); }
.kpi.orange { border-top: 3px solid var(--warning); }
.kpi.red { border-top: 3px solid var(--danger); }
.kpi.cyan { border-top: 3px solid var(--info); }
/* 扁平样式：去掉上边的彩色线，用数字颜色区分（排程页顶部的流程进展用） */
.kpi.flat { border-top-width: 1px; }
.kpi.flat .value { font-weight: 700; }
.kpi.flat.blue .value { color: var(--primary); }
.kpi.flat.green .value { color: var(--success); }
.kpi.flat.orange .value { color: var(--warning); }
.kpi.flat.red .value { color: var(--danger); }
.kpi.flat.cyan .value { color: var(--info); }
.kpi.flat.purple .value { color: #7c3aed; }

/* 用户管理：自定义权限（按模块勾选） */
.perm-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.perm-group { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.perm-group .perm-head { display: flex; align-items: center; gap: 6px; font-size: 12.5px;
  font-weight: 600; margin-bottom: 6px; }
.perm-group label { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px;
  color: #374151; margin: 0 10px 4px 0; white-space: nowrap; }
@media (max-width: 760px) { .perm-groups { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 14px; border-radius: 6px; border: 1px solid var(--border);
  background: #fff; color: var(--text); cursor: pointer; font-size: 13px;
  transition: all .15s; white-space: nowrap; line-height: 1.5;
}
.btn:hover { border-color: #cbd5e1; background: #f9fafb; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
/* 选中的快捷时间段 / 选项按钮 */
.btn.chosen { background: var(--primary-light); border-color: var(--primary);
  color: var(--primary-dark); font-weight: 600; }
.btn.chosen:hover { background: #dbeafe; border-color: var(--primary-dark); }
.btn.danger { background: #fff; border-color: #fca5a5; color: var(--danger); }
.btn.danger:hover { background: #fef2f2; }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.success:hover { filter: brightness(.94); }
.btn.cyan { background: var(--info); border-color: var(--info); color: #fff; }
.btn.cyan:hover { filter: brightness(.94); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--primary); padding: 5px 8px; }
.btn.ghost:hover { background: var(--primary-light); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.lg { padding: 10px 18px; font-size: 14.5px; }
.btn.block { width: 100%; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer;
  padding: 2px 4px; font-size: 13px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }
.btn-group { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 表单 */
.form-row { margin-bottom: 14px; }
.form-row > label { display: block; margin-bottom: 6px; font-size: 13px; color: #374151; }
.form-row > label .req { color: var(--danger); margin-left: 3px; }
.input, .select, .textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.input[readonly], .input:disabled, .select:disabled { background: #f9fafb; color: var(--text-soft); }
.textarea { min-height: 72px; resize: vertical; }
.form-inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-row { margin-bottom: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 16px; }
.hint { font-size: 12px; color: var(--text-mute); margin-top: 4px; }
.err-msg { color: var(--danger); font-size: 12px; margin-top: 4px; }

.search-box { position: relative; }
.search-box .input { padding-left: 30px; min-width: 190px; }
.search-box::before {
  content: "⌕"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-mute); font-size: 15px;
}

/* ---------------------------------------------------------------- 表格 */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  background: #f8fafc; color: #475569; font-weight: 600; text-align: left;
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
table.tbl tbody tr:hover { background: #f8fafc; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.center, table.tbl th.center { text-align: center; }
table.tbl .nowrap { white-space: nowrap; }
.tbl-empty { padding: 46px 16px; text-align: center; color: var(--text-mute); }
.tbl-empty .big { font-size: 30px; display: block; margin-bottom: 8px; opacity: .4; }
.row-actions { display: flex; gap: 2px; flex-wrap: nowrap; white-space: nowrap; }
.total-row td { background: #f8fafc; font-weight: 600; }
.sub-text { color: var(--text-mute); font-size: 12px; }
.strong-text { font-weight: 600; }
.money { font-variant-numeric: tabular-nums; }

.pager { display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager .info { color: var(--text-soft); font-size: 12.5px; }
.pager .spacer { flex: 1; }
.pager .page-idx { color: var(--text-mute); font-size: 12.5px; white-space: nowrap;
  margin-left: 6px; }

/* 输入搜索下拉（物料选择等） */
.pick-wrap { position: relative; }
.pick-menu {
  position: absolute; z-index: 60; left: 0; right: 0; top: 100%; margin-top: 4px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .14); max-height: 280px; overflow: auto;
}
.pick-menu .item { padding: 8px 12px; cursor: pointer; font-size: 13px; line-height: 1.5; }
.pick-menu .item:hover, .pick-menu .item.active { background: #f1f5f9; }
.pick-menu .item .sub { color: var(--text-mute); font-size: 12px; margin-top: 2px; }
.pick-menu .item.empty { color: var(--text-mute); cursor: default; }

/* 列表勾选列 */
table.tbl th.sel-col, table.tbl td.sel-col {
  width: 50px; text-align: center; padding-left: 10px; padding-right: 6px;
}
table.tbl th.sel-col input, table.tbl td.sel-col input {
  width: 21px; height: 21px; cursor: pointer; vertical-align: middle;
  accent-color: var(--primary);
}
.pager .pages { display: flex; gap: 4px; }
.pager button {
  min-width: 30px; height: 30px; border: 1px solid var(--border); background: #fff;
  border-radius: 6px; cursor: pointer; color: var(--text); font-size: 13px;
}
.pager button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager button:disabled { opacity: .45; cursor: not-allowed; }

/* ---------------------------------------------------------------- 徽标 */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px;
  line-height: 18px; white-space: nowrap; border: 1px solid transparent;
}
.tag.gray { background: #f1f5f9; color: #475569; }
.tag.blue { background: #e0edff; color: #1d4ed8; }
.tag.green { background: #dcfce7; color: #15803d; }
.tag.orange { background: #fef3c7; color: #b45309; }
.tag.red { background: #fee2e2; color: #b91c1c; }
.tag.purple { background: #ede9fe; color: #6d28d9; }
.tag.cyan { background: #cffafe; color: #0e7490; }
.tag.solid-red { background: var(--danger); color: #fff; }

/* ---------------------------------------------------------------- 弹窗 */
.mask {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(15, 23, 42, .45); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px 24px;
  overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 10px; box-shadow: var(--shadow-md); width: 100%;
  max-width: 560px; animation: pop .16s ease-out;
}
.modal.wide { max-width: 880px; }
.modal.xwide { max-width: 1120px; }
.modal.narrow { max-width: 420px; }
@keyframes pop { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex;
  align-items: center; font-weight: 600; font-size: 15px;
}
.modal-head .close { margin-left: auto; cursor: pointer; color: var(--text-mute);
  font-size: 20px; line-height: 1; padding: 0 4px; }
.modal-head .close:hover { color: var(--danger); }
.modal-body { padding: 18px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal-foot {
  padding: 12px 18px; border-top: 1px solid var(--border); display: flex;
  justify-content: flex-end; gap: 8px; flex-wrap: wrap;
}

/* ---------------------------------------------------------------- 提示 */
.toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #fff; border-radius: 8px; box-shadow: var(--shadow-md); padding: 10px 16px;
  display: flex; align-items: center; gap: 8px; font-size: 13.5px; min-width: 200px;
  max-width: 520px; border-left: 3px solid var(--primary); animation: slideDown .18s ease-out;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
@keyframes slideDown { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
.loading { padding: 40px; text-align: center; color: var(--text-mute); font-size: 13px; }
.spinner {
  width: 22px; height: 22px; border: 2px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-block { padding: 30px; text-align: center; color: var(--text-mute); }

/* ---------------------------------------------------------------- 详情 */
.detail-head {
  display: flex; align-items: flex-start; gap: 14px; padding: 16px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.detail-head h2 { margin: 0 0 6px; font-size: 17px; }
.detail-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 18px; }
.kv .item { font-size: 13px; }
.kv .item .k { color: var(--text-mute); font-size: 12px; margin-bottom: 3px; }
.kv .item .v { color: var(--text); word-break: break-all; }

/* ---------------------------------------------------------------- 时间线 */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border);
}
.tl-item { position: relative; padding: 0 0 18px; }
.tl-item::before {
  content: ""; position: absolute; left: -22px; top: 4px; width: 10px; height: 10px;
  border-radius: 50%; background: #fff; border: 2px solid var(--primary);
}
.tl-item.done::before { background: var(--success); border-color: var(--success); }
.tl-item .t { font-size: 12px; color: var(--text-mute); }
.tl-item .h { font-size: 13.5px; font-weight: 600; margin: 2px 0; }
.tl-item .d { font-size: 12.5px; color: var(--text-soft); }

/* ---------------------------------------------------------------- 图表 */
.chart-svg { width: 100%; display: block; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 172px; padding: 10px 4px 0; }
.bars .bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  height: 100%; justify-content: flex-end; }
.bars .bar {
  width: 100%; max-width: 46px; background: linear-gradient(180deg, #60a5fa, #2563eb);
  border-radius: 5px 5px 0 0; min-height: 3px; transition: height .4s ease; position: relative;
}
.bars .bar:hover { filter: brightness(1.08); }
.bars .bar-val { font-size: 11px; color: var(--text-soft); }
.bars .bar-lbl { font-size: 11.5px; color: var(--text-mute); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-soft); }
.legend .li { display: flex; align-items: center; gap: 6px; }
.legend .dot { width: 9px; height: 9px; border-radius: 3px; }
.hbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12.5px; }
.hbar .name { width: 130px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #374151; }
.hbar .track { flex: 1 1 auto; min-width: 40px; background: #f1f5f9; border-radius: 4px;
  height: 16px; overflow: hidden; display: flex; }
.hbar .fill { display: block; height: 100%; background: linear-gradient(90deg, #60a5fa, #2563eb);
  border-radius: 4px; }
.hbar .val { width: 100px; flex: none; text-align: right; color: var(--text-soft);
  font-variant-numeric: tabular-nums; }

.todo-list { list-style: none; margin: 0; padding: 0; }
.todo-list li {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9; cursor: pointer; font-size: 13px;
}
.todo-list li:last-child { border-bottom: none; }
.todo-list li:hover { background: #f8fafc; }
.todo-list .cnt {
  margin-left: auto; background: #fee2e2; color: #b91c1c; border-radius: 10px;
  padding: 1px 9px; font-size: 12px; font-weight: 600;
}

/* ---------------------------------------------------------------- 明细编辑表 */
.item-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.item-tbl th { background: #f8fafc; padding: 8px 8px; font-weight: 600; color: #475569;
  border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.item-tbl td { padding: 5px 6px; border-bottom: 1px solid #f1f5f9; }
.item-tbl .input, .item-tbl .select { padding: 5px 7px; font-size: 12.5px; }
.item-tbl .idx { color: var(--text-mute); font-size: 12px; text-align: center; width: 34px; }
.item-tbl .rm { color: var(--danger); cursor: pointer; font-size: 15px; padding: 0 4px; }
.item-tbl tfoot td { padding: 8px; background: #f8fafc; font-weight: 600; }
/* 明细行很多时：表头固定在顶部，往下滚动时不会跟着跑掉 */
.table-scroll-y { max-height: 54vh; overflow: auto; }
.table-scroll-y > table > thead > tr > th { position: sticky; top: 0; z-index: 3;
  background: #f8fafc; box-shadow: inset 0 -1px 0 var(--border); }
.table-scroll-y > table > tfoot > tr > td { position: sticky; bottom: 0; z-index: 3;
  background: #f8fafc; }
/* 采购分单的采购计划：明细表更高一些，一屏能看到更多行 */
.plan-scroll { max-height: 62vh; }
/* BOM 表明细里的「类别」小标题行（五金 / 塑料 / 管件 / 包装 / 软件） */
.item-tbl tr.cat-row > td { background: #eef2f7; color: #334155; font-weight: 600;
  font-size: 12.5px; padding: 6px 8px; }
.item-tbl tr.cat-row > td b { color: var(--primary-dark); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px;
  flex-wrap: wrap; }
.tabs.module-tabs { margin-bottom: 6px; border-bottom: none; }
.tabs.module-tabs .tab {
  padding: 6px 14px; border-radius: 16px; font-size: 13px; background: #fff;
  border: 1px solid var(--border); color: var(--text-soft);
}
.tabs.module-tabs .tab.active {
  background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600;
}
.tabs.type-tabs { gap: 6px; }
.tabs.type-tabs .tab {
  padding: 5px 12px; border-radius: 6px; font-size: 12.5px; background: #fff;
  border: 1px solid var(--border); color: var(--text-soft);
}
.tabs.type-tabs .tab.active {
  background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark);
  font-weight: 600;
}
.tabs .tab {
  padding: 8px 14px; cursor: pointer; font-size: 13.5px; color: var(--text-soft);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs .tab:hover { color: var(--primary); }
.tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px;
  border-bottom: 1px solid var(--border); }
.filter-bar .input, .filter-bar .select { width: auto; min-width: 130px; }
.filter-bar .spacer { flex: 1; }

.stat-line { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; color: var(--text-soft); }
.stat-line b { color: var(--text); font-weight: 600; }

.alert {
  padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px;
  border-left: 3px solid var(--warning); background: #fffbeb; color: #92400e;
}
.alert.info { border-left-color: var(--primary); background: var(--primary-light); color: #1e40af; }
.alert.danger { border-left-color: var(--danger); background: #fef2f2; color: #b91c1c; }
.alert.success { border-left-color: var(--success); background: #f0fdf4; color: #15803d; }

.checkbox-list { display: flex; flex-wrap: wrap; gap: 8px; max-height: 200px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 6px; padding: 10px; }
.checkbox-list label { display: flex; align-items: center; gap: 6px; font-size: 13px;
  padding: 3px 6px; border-radius: 5px; cursor: pointer; }
.checkbox-list label:hover { background: var(--bg); }

.print-only { display: none; }

/* ---------------------------------------------------------------- 生产排程甘特图 */
.gantt { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.gantt-scroll { overflow-x: auto; }
.gantt-inner { min-width: 880px; }
.gantt-head { display: flex; background: #f8fafc; border-bottom: 1px solid var(--border); }
.gantt-corner {
  width: 176px; flex: 0 0 176px; padding: 8px 12px; font-size: 12.5px; color: #475569;
  border-right: 1px solid var(--border); display: flex; align-items: center;
}
.gantt-days { display: flex; flex: 1; }
.gantt-day {
  flex: 1; text-align: center; padding: 5px 0; font-size: 11.5px; color: #64748b;
  border-right: 1px solid #eef2f7; line-height: 1.5;
}
.gantt-day b { display: block; font-size: 12px; color: #334155; font-weight: 600; }
.gantt-day.today { background: var(--primary-light); }
.gantt-day.today b { color: var(--primary-dark); }
.gantt-day.weekend { background: #fafbfc; }
.gantt-row { display: flex; border-bottom: 1px solid #f1f5f9; }
.gantt-row:last-child { border-bottom: none; }
.gantt-name {
  width: 176px; flex: 0 0 176px; padding: 9px 12px; border-right: 1px solid var(--border);
  font-size: 13px; color: #1f2937;
}
.gantt-name .sub { display: block; font-size: 11.5px; color: #94a3b8; margin-top: 3px; }
.gantt-track {
  position: relative; flex: 1 1 auto; min-width: 0; min-height: 54px;
  display: grid; align-content: start;
}
.gantt-grid {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; pointer-events: none;
}
.gantt-grid .cell { flex: 1 1 0; min-width: 0; border-right: 1px solid #f1f5f9; }
.gantt-grid .cell.today { background: #f5f9ff; }
.gantt-grid .cell.weekend { background: #fafbfc; }
.gantt-bar {
  height: 24px; border-radius: 5px; padding: 0 8px; font-size: 12px;
  line-height: 24px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; box-shadow: 0 1px 2px rgba(15, 23, 42, .18);
  min-width: 0; margin-right: 3px; align-self: center; z-index: 1;
}
.gantt-bar.planned { background: #2563eb; }
.gantt-bar.released { background: #0891b2; }
.gantt-bar.in_progress { background: #f59e0b; }
.gantt-bar.completed { background: #16a34a; }
.gantt-bar.draft { background: #94a3b8; }
.gantt-bar.overdue { outline: 2px solid #dc2626; outline-offset: -2px; }
.gantt-bar:hover { filter: brightness(1.08); }
.gantt-empty { padding: 28px; text-align: center; color: #94a3b8; font-size: 13px; }

.loadbar { display: flex; align-items: center; gap: 7px; }
.loadbar .track { flex: 1; height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.loadbar .fill { height: 100%; border-radius: 4px; background: #2563eb; }
.loadbar .fill.warn { background: #f59e0b; }
.loadbar .fill.over { background: #dc2626; }
.loadbar .pct { font-size: 11.5px; color: #64748b; width: 42px; text-align: right; }

.lane-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: #64748b; }
.zoom-box { display: inline-flex; gap: 4px; align-items: center; }
.zoom-box .btn { min-width: 30px; padding: 4px 8px; }
.lane-legend .li { display: flex; align-items: center; gap: 5px; }
.lane-legend .sq { width: 11px; height: 11px; border-radius: 3px; }
.mini-day { width: 30px; text-align: center; font-size: 11px; color: #94a3b8; }
.wo-progress { height: 6px; background: #f1f5f9; border-radius: 3px; overflow: hidden; min-width: 60px; }
.wo-progress .fill { height: 100%; background: var(--success); border-radius: 3px; }
@media print {
  .no-print, .sidebar, .topbar, .nav-mask, .card-head .btn, .pager, .filter-bar,
  .detail-actions { display: none !important; }
  body { background: #fff; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  .card { border: none; box-shadow: none; }
  .contract-sheet { border: none; box-shadow: none; padding: 0; max-width: none; }
  .contract-sheet .table-wrap { overflow: visible; }
  .contract-sheet .ct-tbl { font-size: 9.5px; }
  .contract-sheet .ct-tbl th, .contract-sheet .ct-tbl td { padding: 2px 3px; }
  .contract-sheet .ct-line { font-size: 11px; }
  .contract-sheet .ct-terms { font-size: 10.5px; line-height: 1.6; }
  .contract-sheet .ct-sign { margin-top: 14px; font-size: 11px; }
  .contract-sheet .ct-sign .row { margin-top: 14px; }
  @page { size: A4 landscape; margin: 9mm; }
}

/* ---------------------------------------------------------- 外贸单据排版 */
.contract-sheet.ex-sheet { max-width: 1080px; }
.contract-sheet .ex-co { font-size: 15px; font-weight: 700; }
.contract-sheet .ex-co-cn { font-size: 12px; color: #4b5563; margin-bottom: 6px; }
.contract-sheet .ex-title {
  text-align: center; font-size: 18px; letter-spacing: 2px; margin: 10px 0 14px; font-weight: 700;
}
.contract-sheet .mfg-sub {
  text-align: center; font-size: 16px; letter-spacing: 6px; margin: 4px 0 12px; font-weight: 700;
}
.contract-sheet .ex-meta {
  display: flex; justify-content: space-between; gap: 20px; font-size: 12px; margin-bottom: 10px;
}
.contract-sheet .ex-meta .r { min-width: 260px; }
.contract-sheet .ex-meta div { line-height: 1.9; }
.contract-sheet .ex-tbl { font-size: 11px; }
.contract-sheet .ex-tbl td { white-space: pre-line; }
.contract-sheet .ex-tbl th { white-space: pre-line; }
.contract-sheet .ex-tbl td.r { text-align: right; }
.contract-sheet .ex-tbl tfoot td { font-weight: 700; background: #f8fafc; }
.contract-sheet .ex-terms { margin-top: 14px; font-size: 12px; line-height: 1.9; }
.contract-sheet .ex-bank { margin-top: 18px; font-size: 12px; line-height: 1.8; }
.contract-sheet .ex-sign {
  display: flex; justify-content: space-between; margin-top: 34px; font-size: 12.5px;
}
.contract-sheet .ex-line {
  display: flex; justify-content: space-between; gap: 16px; font-size: 12.5px; padding: 3px 0;
}
.contract-sheet .mfg-tbl { font-size: 12px; }
.contract-sheet .mfg-tbl td.k { background: #f8fafc; font-weight: 600; white-space: nowrap; }
.contract-sheet .mfg-tbl td.sec { background: #99ccff; font-weight: 700; text-align: center; }
.contract-sheet .mfg-tbl td.mfg-content { white-space: pre-wrap; line-height: 1.7; }
.contract-sheet .mfg-photo {
  border: 1px dashed #94a3b8; height: 120px; display: flex; align-items: center;
  justify-content: center; color: #94a3b8; font-size: 12.5px; margin: 10px 0;
}
.contract-sheet .mfg-sign {
  display: flex; justify-content: space-between; margin-top: 26px; font-size: 12.5px;
}
.ex-page-break { page-break-after: always; break-after: page; height: 0; }
@media print {
  .ex-sheet .mfg-photo { display: none; }
}

/* ---------------------------------------------------------- 采购合同排版 */
.contract-sheet {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 22px 26px 30px; max-width: 1180px; margin: 0 auto; color: #111827;
  box-shadow: var(--shadow);
}
.contract-sheet .ct-title {
  font-size: 19px; text-align: center; margin: 0 0 4px; letter-spacing: 1px; font-weight: 700;
}
.contract-sheet .ct-addr { text-align: center; font-size: 12.5px; color: #374151; margin-bottom: 12px; }
.contract-sheet .ct-line {
  display: flex; justify-content: space-between; gap: 16px; font-size: 12.5px;
  padding: 3px 0; border-bottom: 1px dashed #e5e7eb;
}
.contract-sheet .ct-line:last-of-type { border-bottom: none; }
.contract-sheet .ct-tbl { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 11.5px; }
.contract-sheet .ct-tbl th, .contract-sheet .ct-tbl td {
  border: 1px solid #9ca3af; padding: 4px 5px; vertical-align: middle;
}
.contract-sheet .ct-tbl th { background: #f1f5f9; font-weight: 600; text-align: center; white-space: nowrap; }
.contract-sheet .ct-tbl td.c { text-align: center; white-space: nowrap; }
.contract-sheet .ct-tbl td:first-child { white-space: nowrap; }
.contract-sheet .ct-tbl td.r { text-align: right; font-variant-numeric: tabular-nums; }
.contract-sheet .ct-total { margin-top: 10px; font-size: 13px; }
.contract-sheet .ct-terms { margin-top: 14px; font-size: 12px; line-height: 1.95; }
.contract-sheet .ct-sign { margin-top: 30px; font-size: 12.5px; }
.contract-sheet .ct-sign .row { display: flex; justify-content: space-between; gap: 20px; margin-top: 24px; }

/* 批量打印：一张合同一页 */
.contract-page + .contract-page { margin-top: 18px; }

/* 采购分单：类别分组块 */
.cat-block {
  border: 1px solid var(--border); border-radius: 8px; margin-bottom: 14px; overflow: hidden;
}
.cat-block .cat-head {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  background: #f8fafc; border-bottom: 1px solid var(--border);
}
.cat-block .cat-head input {
  width: 21px; height: 21px; cursor: pointer; accent-color: var(--primary);
}
/* 采购分单等明细表里的勾选框也放大 */
.item-tbl input.row-sel, .item-tbl input[type="checkbox"] {
  width: 21px; height: 21px; cursor: pointer; accent-color: var(--primary);
}
.item-tbl td.sel-col { width: 50px; text-align: center; }
.filter-bar .sub-text b { color: var(--text); }
@media print {
  .contract-page { page-break-after: always; break-after: page; }
  .contract-page:last-child { page-break-after: auto; break-after: auto; }
}
