/* AI生成 */
/* ============ 排单外脑 全局样式 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e3e6ea;
  --text: #24292f;
  --muted: #8b949e;
  --primary: #2563eb;
  --danger: #d93025;
  --warn: #f59e0b;
  --ok: #16a34a;
}
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.app-header {
  display: flex; align-items: center; gap: 24px;
  background: #1e293b; color: #fff; padding: 10px 20px;
  position: sticky; top: 0; z-index: 50;
}
.brand { font-size: 17px; font-weight: 700; white-space: nowrap; }
.brand .sub { font-size: 11px; font-weight: 400; color: #94a3b8; margin-left: 8px; }
.tabs { display: flex; gap: 4px; }
.tabs button {
  background: transparent; border: none; color: #cbd5e1; padding: 8px 16px;
  font-size: 14px; cursor: pointer; border-radius: 6px; font-family: inherit;
}
.tabs button:hover { background: #334155; color: #fff; }
.tabs button.active { background: var(--primary); color: #fff; }
.header-right { margin-left: auto; font-size: 12px; color: #94a3b8; }

main { padding: 16px 20px; max-width: 1800px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- 预警看板 ---- */
.board-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; }
.alert-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.alert-card.hot { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(217,48,37,.08); }
.card-title { font-weight: 700; font-size: 15px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.card-title .count { background: var(--danger); color: #fff; border-radius: 10px; font-size: 12px; padding: 1px 8px; }
.card-title .count.zero { background: var(--ok); }
.card-body { max-height: 300px; overflow-y: auto; }
.alert-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px;
  border-bottom: 1px dashed var(--line); cursor: pointer;
}
.alert-item:hover { background: #f0f4ff; }
.alert-item .style { font-weight: 700; color: var(--primary); white-space: nowrap; }
.alert-item .desc { flex: 1; }
.alert-item .date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.alert-item .date.late { color: var(--danger); font-weight: 700; }
.alert-item .alert-thumb {
  height: 26px; max-width: 38px; border-radius: 3px; border: 1px solid var(--line);
  object-fit: cover; vertical-align: middle; margin-right: 4px; flex-shrink: 0;
}
.alert-item .done-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 4px;
  font-size: 11px; padding: 2px 6px; cursor: pointer; color: var(--muted); font-family: inherit;
}
.alert-item .done-btn:hover { border-color: var(--ok); color: var(--ok); }
.board-note { margin-top: 14px; color: var(--muted); font-size: 12px; }
.handled { opacity: .45; text-decoration: line-through; }

/* ---- 工具栏 / 按钮 ---- */
/* 工具栏吸顶：滚动时新增/导出/搜索/筛选一直留在视图内（紧贴头部下方），
   --toolbar-top 由 app.js 按实际头部高度动态写入 */
.toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px;
  position: sticky; top: var(--toolbar-top, 57px); z-index: 40;
  background: var(--bg); padding: 8px 0 6px;
}
.btn {
  border: 1px solid var(--line); background: #fff; padding: 7px 14px; border-radius: 6px;
  cursor: pointer; font-size: 13px; font-family: inherit; color: var(--text);
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.search, .num-input {
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; font-size: 13px; width: 220px; font-family: inherit;
}
.num-input { width: 90px; }
.sort-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sort-label select { font-family: inherit; padding: 6px; border: 1px solid var(--line); border-radius: 6px; }
.file-label { position: relative; overflow: hidden; display: inline-block; }
.file-label input { position: absolute; left: -999px; }

/* ---- 表格 ---- */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table.fixed-layout { table-layout: fixed; }
.data-table.fixed-layout td {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 0; /* colgroup 控宽 + 省略号 */
}
/* 采购表例外：内容换行完整显示，不截断 */
.pur-group .data-table.fixed-layout td { max-width: none; }
.data-table th {
  background: #f1f5f9; text-align: left; padding: 8px 10px; font-weight: 600;
  border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
.data-table td { padding: 7px 10px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
.data-table.fixed-layout td { vertical-align: middle; }
.data-table tr:hover td { background: #f8fafc; }
.data-table .style-no { font-weight: 700; color: var(--primary); cursor: pointer; }
.table-wrap.small .data-table { font-size: 12px; }
.empty-tip { padding: 30px; text-align: center; color: var(--muted); }

/* 延误数字徽标 */
.late-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px;
  background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; margin-right: 6px;
}
.late-badge.today-only { background: var(--warn); }

/* 多行单元格（颜色明细/裁床数） */
td.multi-line {
  white-space: normal !important; overflow: visible !important;
  text-overflow: clip !important; max-width: none !important; line-height: 1.5;
}
td.multi-line .cl-line { display: block; }

/* 宽表格横向滚动 */
.table-wrap.wide { overflow-x: auto; }

/* ---- 采购分组模块 ---- */
.pur-groups { }
.pur-group { background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; overflow: hidden; }
.pur-group.focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.25); transition: box-shadow .3s; }
.node-row .mark-btn.undo-btn:hover { border-color: var(--warn); color: #b45309; }
.pur-group-head {
  display: flex; align-items: center; gap: 16px; padding: 8px 14px;
  background: #f1f5f9; border-bottom: 1px solid var(--line);
}
.pur-group-head .g-style { font-weight: 700; color: var(--primary); font-size: 14px; cursor: pointer; }
/* 组头款式图片（从订单带过来） */
.pur-group-head .g-order-img {
  height: 40px; max-width: 56px; border-radius: 4px; border: 1px solid var(--line);
  cursor: zoom-in; object-fit: cover; vertical-align: middle;
}
.pur-group-head .g-order-img:hover { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.2); }
.pur-group-head .g-info { color: var(--muted); font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.pur-group-head .g-info .g-late { color: var(--danger); font-weight: 700; }
.pur-group-body { overflow-x: auto; }
.pur-group-body .data-table { font-size: 12px; }
.pur-group-body .data-table th { position: static; }
/* 采购表自适应宽度：百分比列 + 100% 宽，正常屏幕无横向滚动条 */
.pur-group-body .data-table.pur-table { table-layout: fixed; width: 100%; }
.pur-group-body .data-table.pur-table td.cell-edit { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pur-group-body .data-table.pur-table td.qty-cell { white-space: nowrap; }
/* 手动修改过采购数量的格：黄底 + ✎手 角标（自动值无标记） */
.pur-group-body .data-table.pur-table td.qty-manual { background: #fef3c7 !important; box-shadow: inset 0 -2px 0 #f59e0b; }

/* 行内新增输入行 */
.inline-add-row td { background: #f8fafc; border-top: 2px dashed var(--line); padding: 3px 2px; }
.inline-add-row td.ia-placeholder { background: #f8fafc; border: none; } /* 对齐拖拽手柄列的占位 */
.inline-add-row .ia {
  width: 100%; min-width: 54px; border: 1px solid var(--line); border-radius: 4px;
  padding: 4px 5px; font-size: 12px; font-family: inherit;
}
.inline-add-row .ia:focus { border-color: var(--primary); outline: none; }

/* 直接编辑单元格（采购表）：宽度不够自动换行，内容完整显示 */
.pur-group td.cell-edit {
  cursor: text; position: relative; overflow: visible; text-overflow: clip;
  white-space: normal; word-break: break-all; vertical-align: middle;
  min-height: 18px; outline: none; line-height: 1.4;
}
.pur-group td.cell-edit:hover { background: #f0f9ff; box-shadow: inset 0 0 0 1px #bae6fd; }
.pur-group td.cell-edit:focus { background: #fff; box-shadow: inset 0 0 0 2px var(--primary); z-index: 5; }
.pur-group td.cell-edit:empty::before { content: '—'; color: #cbd5e1; }

/* 订单卡行内编辑（span 版，与采购页一致观感）：点击直接改，失焦/回车即存 */
.order-card span.cell-edit {
  cursor: text; outline: none; border-radius: 4px;
  min-width: 2em; min-height: 18px; display: inline-block;
  white-space: normal; word-break: break-all;
  transition: background .12s, box-shadow .12s;
}
.order-card span.cell-edit:hover { background: #f0f9ff; box-shadow: inset 0 0 0 1px #bae6fd; }
.order-card span.cell-edit:focus { background: #fff; box-shadow: inset 0 0 0 2px var(--primary); z-index: 5; }
.order-card span.cell-edit:empty::before { content: '—'; color: #cbd5e1; }
/* 状态原文格占满剩余宽度（原 oc-status 语义保留） */
.order-card span.cell-edit.oc-status { flex: 1; min-width: 180px; }
.pur-group td.calc { color: #475569; white-space: normal; word-break: break-all; }
.pur-group tbody tr { height: 30px; }
.pur-group td { vertical-align: middle; }
/* 可点击的状态标签（未下单/已下单切换） */
.chip.pur-toggle { font-weight: 700; padding: 3px 12px; }
.chip.pur-toggle:hover { filter: brightness(0.96); box-shadow: inset 0 0 0 2px rgba(0,0,0,.12); }
/* ---- 状态选择菜单（点击状态标签弹出，任选三态） ---- */
.state-menu {
  position: fixed; z-index: 400; min-width: 150px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15,23,42,.18); overflow: hidden;
}
.state-menu .sm-title {
  font-size: 11px; color: var(--muted); padding: 6px 10px 4px;
  border-bottom: 1px dashed var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.state-menu .sm-item {
  padding: 7px 12px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.state-menu .sm-item:hover { background: #eff6ff; color: var(--primary); font-weight: 700; }
.state-menu .sm-item.cur { background: #f8fafc; }
.state-menu .sm-item .sm-now {
  font-size: 10px; color: var(--ok); margin-left: 6px; font-weight: 400;
  border: 1px solid #bbf7d0; border-radius: 3px; padding: 0 4px; background: #f0fdf4;
}
/* 已导出标记的可删除提示（点击 ✕ 删除） */
.chip.pur-unexport:hover { background: #fef2f2 !important; color: var(--danger) !important; border: 1px solid #fecaca; }
/* 拖拽排序（行首手柄触发） */
.pur-group td.drag-handle {
  cursor: grab; color: #94a3b8; text-align: center; user-select: none;
  font-size: 14px; line-height: 1; vertical-align: middle;
}
.pur-group td.drag-handle:hover { color: var(--primary); }
.pur-group td.drag-handle:active { cursor: grabbing; }
.pur-group tr.dragging { opacity: .45; }
.pur-group tr.drag-over td { border-top: 2px solid var(--primary); }

/* ---- 图片（订单卡/采购行/放大查看） ---- */
.img-cell { display: inline-flex; align-items: center; gap: 4px; }
.thumb { height: 34px; max-width: 60px; border-radius: 4px; border: 1px solid var(--line); cursor: zoom-in; object-fit: cover; vertical-align: middle; }
.thumb.large { height: 160px; max-width: 240px; }
.btn.img-btn { padding: 2px 8px; font-size: 11px; }
/* 采购行首图片格 */
.pur-group td.p-img-cell { text-align: center; padding: 2px; vertical-align: middle; }

/* ---- 挂起与跟催（pending）---- */
.pur-group tr.row-pending td { background: #fffbeb; }
.pur-group tr.row-pending td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.pur-group tr.row-pending:hover td { background: #fef3c7; }
.pur-group td.pend-cell { text-align: center; padding: 4px 6px; }
.pend-tag {
  display: inline-block; padding: 2px 6px; border-radius: 4px; cursor: pointer;
  background: #fef3c7; color: #92400e; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.pend-tag:hover { background: #fde68a; }

/* ---- 挂起输入弹窗（原因+日期+时刻一次填完） ---- */
.pend-dialog-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 300;
  display: flex; align-items: center; justify-content: center;
}
.pend-dialog {
  background: var(--card); border-radius: 12px; padding: 18px 20px; width: 380px; max-width: 92vw;
  box-shadow: 0 12px 40px rgba(15,23,42,.25);
}
.pend-dialog .pd-title { font-weight: 700; font-size: 14px; margin-bottom: 12px; color: #92400e; }
.pend-dialog .pd-row { margin-bottom: 10px; }
.pend-dialog .pd-row label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.pend-dialog .pd-row input {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 13px; font-family: inherit; box-sizing: border-box;
}
.pend-dialog .pd-row input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.pend-dialog .pd-ops { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.node-row.row-pending { background: #fffbeb; border-radius: 4px; }
.node-row .pend-tag.node-pend { flex-shrink: 0; }
.alert-card.card-pending .pend-item .desc { color: #92400e; }
.p-thumb { height: 30px; max-width: 34px; border-radius: 3px; border: 1px solid var(--line); cursor: zoom-in; object-fit: cover; }
.p-img-up {
  border: 1px dashed #cbd5e1; background: #f8fafc; color: #64748b; cursor: pointer;
  border-radius: 4px; padding: 3px 5px; font-size: 13px; font-family: inherit;
}
.p-img-up:hover { border-color: var(--primary); color: var(--primary); }
/* 新增行图片格与清除按钮 */
.inline-add-row td.ia-img-cell { background: #f8fafc; text-align: center; vertical-align: middle; }
.img-clear-add { padding: 1px 5px; font-size: 10px; }
/* 武装粘贴态（等待 Ctrl+V） */
.btn.img-btn.waiting, .p-img-up.waiting {
  background: #fef3c7; border-color: var(--warn); color: #b45309;
  box-shadow: 0 0 0 2px rgba(245,158,11,.25); animation: pulse 1.2s infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(245,158,11,.35); } }
/* 放大查看遮罩 */
.img-lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.82); z-index: 500;
  display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: zoom-out;
}
.img-lightbox .img-lb-bar {
  position: absolute; top: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 14px; align-items: center;
  cursor: default;
}
.img-lightbox .img-lb-del { background: #d93025; border-color: #d93025; color: #fff; }
.img-lightbox .img-lb-del:hover { background: #b91c1c; }
.img-lightbox .img-lb-tip { color: #cbd5e1; font-size: 12px; }
.img-lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 8px; box-shadow: 0 10px 50px rgba(0,0,0,.5); }

/* ---- 订单两行卡片布局 ---- */
.order-cards { display: flex; flex-direction: column; gap: 8px; }
.order-card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.order-card.alarm { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(217,48,37,.08); }
.oc-row { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; line-height: 1.8; }
.oc-row .oc-field { white-space: nowrap; }
.oc-row .oc-field .k { color: var(--muted); margin-right: 4px; }
.oc-row .oc-field .v { font-weight: 600; }
.oc-row .oc-field .v.danger { color: var(--danger); }
.oc-row .oc-field .v.ok { color: var(--ok); }
.oc-style { font-weight: 700; color: var(--primary); cursor: pointer; font-size: 14px; }
.oc-status { white-space: normal !important; }
.oc-cline { display: inline-block; margin-right: 10px; white-space: nowrap; }
.oc-ops { margin-left: auto; display: flex; gap: 6px; }
.oc-bed { color: #64748b; }

/* ---- 订单行内编辑卡（新增/编辑不弹窗，卡内填写） ---- */
.order-card.editing { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.12); padding: 12px 14px; }
.order-card.editing .oc-row { gap: 6px 14px; }
.ef { display: inline-flex; align-items: center; gap: 6px; }
.ef .k { color: var(--muted); font-size: 12px; white-space: nowrap; }
.ef input, .ef textarea {
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px;
  font-size: 13px; font-family: inherit; background: #fff;
}
.ef input:focus, .ef textarea:focus { border-color: var(--primary); outline: none; }
.ef input[type=date] { width: 128px; }
.ef input[type=number] { width: 84px; }
.ef input.ef-date { width: 96px; }
.ef input:not([type=date]):not([type=number]):not(.ef-date) { width: 108px; }
.ef-wide input, .ef-wide textarea { width: 100%; }
.ef textarea { width: 300px; vertical-align: top; }
.ef .req { color: var(--danger); }
.edit-colors { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.edit-colors .color-row { margin: 0; }
.edit-colors .color-row input { width: 90px; }
.oc-edit-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---- 看板：顶部交期栏 + 三块并排 ---- */
.board-top { margin-bottom: 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.board-top .alert-card { min-width: 0; }
.board-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.alert-card .card-body { max-height: none !important; overflow: visible !important; } /* 全量展开 */
.board-grid-3 .alert-card { min-width: 0; }

/* 状态标记 */
.chip { display: inline-block; border-radius: 4px; padding: 1px 7px; font-size: 12px; white-space: nowrap; }
.chip.done { background: #dcfce7; color: #15803d; }
.chip.doing { background: #fef9c3; color: #a16207; }
.chip.todo { background: #f1f5f9; color: #64748b; }
/* 采购"未下单"状态用红色，警示待采购 */
.chip.todo.pur-toggle { background: #fee2e2; color: #b91c1c; }
.chip.todo.pur-toggle:hover { background: #fecaca; color: #991b1b; } /* 悬停加深提示可点 */
.chip.late { background: #fee2e2; color: #b91c1c; }
.chip.today { background: #ffedd5; color: #c2410c; }
.float-neg { color: var(--danger); font-weight: 700; }
.float-small { color: var(--warn); font-weight: 700; }
.float-ok { color: var(--ok); }

/* ---- 模态 ---- */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; }
.modal.open { display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; overflow-y: auto; }
.modal-box { background: #fff; border-radius: 12px; width: 640px; max-width: 96vw; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-box.large { width: 1100px; }
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 16px;
}
.modal-head .close { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 16px 18px; }
.paste-area {
  width: 100%; height: 180px; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; font-family: Consolas, monospace; font-size: 12px; resize: vertical;
}
.paste-actions { display: flex; gap: 10px; margin-top: 10px; }
.tip { color: var(--muted); font-size: 12px; margin-bottom: 8px; line-height: 1.6; }
.tip-inline { color: var(--muted); font-size: 12px; }
.parse-summary { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; line-height: 1.7; }
.parse-summary .warn-line { color: #b45309; }

/* ---- 订单详情 ---- */
.detail-sec { margin-bottom: 16px; }
.detail-sec h4 { font-size: 14px; margin-bottom: 6px; color: #334155; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 14px; font-size: 13px; }
.kv-grid .k { color: var(--muted); }
.node-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-bottom: 1px dashed var(--line); }
.node-row .name { width: 110px; font-weight: 600; }
.node-row .plan { color: var(--muted); width: 96px; }
.node-row .actual { width: 96px; }
.node-row .mark-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 2px 8px;
  font-size: 11px; cursor: pointer; font-family: inherit; color: var(--muted);
}
.node-row .mark-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ---- 排单：按工厂分组 ---- */
.fac-groups { }
.fac-group { background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 16px; overflow: hidden; }
.fac-group-head {
  display: flex; align-items: center; gap: 18px; padding: 10px 14px; flex-wrap: wrap;
  background: #f1f5f9; border-bottom: 1px solid var(--line);
}
.fac-group-head .f-name { font-weight: 700; font-size: 15px; }
.fac-group-head .f-name.nogroup { color: var(--muted); }
.fac-group-head .f-sum { color: var(--muted); font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.fac-group-head .f-sum .late { color: var(--danger); font-weight: 700; }
.fac-gantt { padding: 8px 12px 10px; overflow-x: auto; }
.fac-gantt-inner { position: relative; min-width: 100%; }
.gantt-row { display: flex; align-items: center; height: 28px; border-bottom: 1px dashed #eef0f3; }
.gantt-row:last-child { border-bottom: none; }
.gantt-label { width: 300px; flex-shrink: 0; font-size: 12px; overflow: visible; white-space: nowrap; }
.gantt-label .gl-style { font-weight: 700; color: var(--primary); cursor: pointer; }
/* 排单行款式图：小缩略图（点击放大，与订单页共享图库） */
.gantt-label .gl-thumb {
  height: 22px; width: 30px; object-fit: cover; vertical-align: middle;
  border-radius: 3px; border: 1px solid var(--line); cursor: zoom-in; margin-right: 4px;
}
.gantt-label .gl-thumb:hover { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.2); }
.gantt-label .gl-thumb-empty {
  display: inline-block; height: 22px; width: 30px; line-height: 22px; text-align: center;
  vertical-align: middle; border: 1px dashed #cbd5e1; border-radius: 3px; color: #cbd5e1;
  font-size: 12px; margin-right: 4px; cursor: default;
}
/* 距交期天数标签：贴在交期点右侧（超期=红，正常=灰绿） */
.gantt-track .gantt-due-tag {
  position: absolute; top: 6px; font-size: 11px; font-weight: 700; white-space: nowrap;
  color: #15803d; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 3px;
  padding: 0 4px; line-height: 16px; pointer-events: none;
}
.gantt-track .gantt-due-tag.overdue { color: #d93025; background: #fef2f2; border-color: #fecaca; }
/* 面辅料发往工厂标记：橙色菱形 + 小日期标签（数据来自订单页发料日期/发料节点） */
.gantt-track .gantt-sent {
  position: absolute; top: 11px; width: 9px; height: 9px;
  transform: rotate(45deg); background: var(--warn); border-radius: 2px;
  box-shadow: 0 0 0 1px #ffedd5; z-index: 3;
}
.gantt-track .gantt-sent-tag {
  position: absolute; top: 6px; font-size: 10px; font-weight: 700; white-space: nowrap;
  color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: 3px;
  padding: 0 3px; line-height: 14px; pointer-events: none; z-index: 3;
}
.gantt-track .gantt-sent-tag.outwin { color: #d97706; opacity: .8; }
/* 工厂预计交期标记：紫色方块 + 小日期标签（数据来自订单页「工厂预计交货」字段） */
.gantt-track .gantt-eta {
  position: absolute; top: 12px; width: 9px; height: 9px;
  background: #7c3aed; border-radius: 2px;
  box-shadow: 0 0 0 1px #ede9fe; z-index: 3;
}
.gantt-track .gantt-eta-tag {
  position: absolute; top: 6px; font-size: 10px; font-weight: 700; white-space: nowrap;
  color: #6d28d9; background: #f5f3ff; border: 1px solid #ddd6fe; border-radius: 3px;
  padding: 0 3px; line-height: 14px; pointer-events: none; z-index: 3;
}
.gantt-track .gantt-eta-tag.outwin { color: #7c3aed; opacity: .8; }
.gantt-track { position: relative; flex: 1; height: 100%; min-width: 320px; }
.gantt-bar { position: absolute; top: 7px; height: 15px; border-radius: 8px; background: linear-gradient(90deg,#93c5fd,#3b82f6); }
.gantt-bar.conflict { background: linear-gradient(90deg,#fca5a5,#ef4444); }
.gantt-dot { position: absolute; top: 9px; width: 11px; height: 11px; border-radius: 50%; }
.gantt-axis { display: flex; border-bottom: 1px solid var(--line); height: 22px; }
.gantt-axis .tick { font-size: 10px; color: var(--muted); }
.gantt-legend { font-size: 11px; color: var(--muted); padding: 6px 12px; border-top: 1px dashed var(--line); }
.gantt-legend span { margin-right: 14px; }
/* 排单页未分配工厂的行内分配输入（实底琥珀色，按钮感） */
.assign-factory {
  border: 1px solid var(--warn); border-radius: 4px; padding: 2px 8px;
  font-size: 11px; font-family: inherit; width: 122px; color: #92400e;
  background: #fef3c7; /* 实底，不用透明 */
}
.assign-factory::placeholder { color: #b45309; }
.assign-factory:focus { border-color: var(--primary); outline: none; background: #fff; }
/* 已分配订单的"清除工厂"按钮 */
.clear-factory {
  border: 1px dashed #cbd5e1; background: #f8fafc; color: #64748b;
  border-radius: 4px; padding: 1px 7px; font-size: 11px; cursor: pointer; font-family: inherit;
  margin-left: 6px; vertical-align: middle;
}
.clear-factory:hover { border-color: var(--danger); color: var(--danger); background: #fef2f2; }

/* ---- 导出选择列表 ---- */
.pick-list { max-height: 420px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; margin-bottom: 12px; }
.pick-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-bottom: 1px dashed #eef0f3; font-size: 13px; }
.pick-item:last-child { border-bottom: none; }
.pick-item label { display: flex; gap: 8px; align-items: center; cursor: pointer; flex: 1; }
.pick-item .p-info { color: var(--muted); font-size: 12px; }
.pick-item .p-info .late { color: var(--danger); font-weight: 700; }

/* ---- 设置 ---- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap: 14px; align-items: start; }
.settings-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.settings-card h3 { font-size: 15px; margin-bottom: 10px; }
.settings-card .tip { margin-bottom: 10px; }
.settings-card td input { width: 70px; border: 1px solid var(--line); border-radius: 4px; padding: 4px 6px; font-family: inherit; }

/* ---- 表单 ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; margin-bottom: 14px; }
.form-grid label, .form-wide { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #475569; }
.form-grid input, .form-wide input, .form-wide textarea {
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; font-size: 13px; font-family: inherit;
}
.form-wide { margin-bottom: 10px; }
.form-sec { border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.form-sec-head { font-size: 12px; font-weight: 700; color: #64748b; margin-bottom: 8px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; }
.req { color: var(--danger); font-style: normal; }
.color-row { display: flex; gap: 8px; margin-bottom: 6px; align-items: center; }
.color-row .cr-color { flex: 1.4; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; font-family: inherit; }
.color-row .cr-qty { flex: 1; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; font-family: inherit; }
.color-row .cr-del { padding: 5px 12px; }
.plan-src { font-size: 10px; padding: 0 4px; border-radius: 3px; margin-left: 4px; }
.plan-src.forward { background: #fef3c7; color: #b45309; }
.plan-src.backward { background: #dbeafe; color: #1d4ed8; }

/* ---- toast ---- */
.toast {
  position: fixed; top: 52px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: #1e293b; color: #fff; padding: 10px 22px; border-radius: 8px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 200; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.backup-hint { cursor: pointer; }
.backup-hint:hover { color: #e2e8f0; }

/* ---- 身份权限选择器（页头） ---- */
.role-sel {
  background: #334155; color: #e2e8f0; border: 1px solid #475569; border-radius: 6px;
  padding: 4px 8px; font-size: 12px; font-family: inherit; cursor: pointer; margin-left: 10px;
}
.role-sel:hover { border-color: #94a3b8; }
.role-sel:focus { outline: none; border-color: var(--primary); }

/* ---- 导出下拉菜单（采购页工具栏） ---- */
.export-menu { position: relative; display: inline-block; }
.export-menu-list {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 60;
  min-width: 180px; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15,23,42,.18); overflow: hidden;
}
.export-menu-list.open { display: block; }
.export-menu-list .em-item {
  padding: 9px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; color: var(--text);
}
.export-menu-list .em-item:hover { background: #eff6ff; color: var(--primary); font-weight: 700; }
.export-menu-list .em-item.em-ready { border-top: 1px dashed var(--line); color: #1d4ed8; }
.export-menu-list .em-item.em-sub { padding-left: 30px; font-size: 12px; color: #64748b; background: #f8fafc; }
.export-menu-list .em-item.em-sub:hover { color: #1d4ed8; }

/* 排单页只读身份的"未分配"纯文本标记 */
.assign-ro {
  border: 1px dashed #cbd5e1; border-radius: 4px; padding: 1px 7px; font-size: 11px;
  color: #94a3b8; background: #f8fafc; margin-left: 6px; vertical-align: middle;
}

/* ---- 账号系统：页头用户徽标 + 退出按钮 ---- */
.user-chip {
  margin-left: 10px; font-size: 12px; color: #e2e8f0; cursor: default;
  border: 1px solid #475569; border-radius: 999px; padding: 3px 10px; background: #334155;
}
.btn-logout {
  margin-left: 8px; padding: 4px 10px; font-size: 12px; cursor: pointer;
  background: transparent; color: #e2e8f0; border: 1px solid #475569; border-radius: 6px; font-family: inherit;
}
.btn-logout:hover { border-color: var(--danger); color: #fca5a5; }

/* ---- 账号系统：登录遮罩（完全不透明，不露出页面内容） ---- */
.login-mask {
  position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 70% -10%, #1e3a8a 0%, transparent 60%),
              radial-gradient(900px 500px at 10% 110%, #0e7490 0%, transparent 55%),
              linear-gradient(160deg, #0f172a 0%, #1e293b 100%);
}
.login-box {
  width: 330px; max-width: 92vw; background: var(--card); border: 1px solid rgba(255,255,255,.6);
  border-radius: 18px; padding: 34px 30px 24px; text-align: center;
  box-shadow: 0 30px 80px rgba(2,6,23,.55), 0 2px 0 rgba(255,255,255,.5) inset;
  animation: loginIn .35s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes loginIn { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }
.login-logo {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  box-shadow: 0 8px 22px rgba(37,99,235,.4);
}
.login-title { font-size: 18px; font-weight: 800; color: var(--text); letter-spacing: .5px; }
.login-sub { font-size: 12px; color: var(--muted); margin: 6px 0 22px; }
.login-pass-row input {
  width: 100%; padding: 11px 14px; font-size: 14px; border: 1.5px solid var(--line);
  border-radius: 10px; font-family: inherit; box-sizing: border-box; background: #f8fafc;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.login-pass-row input:focus {
  outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}
.login-pass-row input:disabled { background: #f8fafc; color: #94a3b8; }
#loginMask .login-pass-row + .login-pass-row { margin-top: 12px; }
#btnDoLogin {
  width: 100%; margin-top: 18px; padding: 11px 0; font-size: 15px; font-weight: 700; letter-spacing: 6px;
  color: #fff; background: linear-gradient(135deg, #2563eb, #0ea5e9);
  border: none; border-radius: 10px; cursor: pointer; font-family: inherit;
  box-shadow: 0 10px 24px rgba(37,99,235,.35); transition: transform .12s, box-shadow .12s;
}
#btnDoLogin:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(37,99,235,.45); }
#btnDoLogin:active { transform: translateY(0); box-shadow: 0 6px 16px rgba(37,99,235,.35); }
.login-tip { margin-top: 16px; font-size: 11px; color: var(--muted); text-align: center; }
